Kaynağa Gözat

Merge branch 'master' of http://s.dev01.dkiboss.com:9001/DK-MES-2.0/HEGII.ss.mes.web

qinqi 5 ay önce
ebeveyn
işleme
ce4d88a0a9

+ 13 - 0
wwwroot/mes/pc/intelligence/Richtext.ashx

@@ -170,6 +170,19 @@ public class Richtext : IHttpHandler, IReadOnlySessionState
                 context.Response.Write(JsonConvert.SerializeObject(result, Formatting.Indented));
             }
         }
+        if (context.Request["m"].ToString() == "deletedata")
+        {
+            //获取前端传递的表单
+            var formData = context.Request.Form;
+            var id = formData["id"];
+            int code = 500;
+            using (IDataAccess conn = DataAccess.Create())
+            {
+                int result = conn.ExecuteNonQuery(" UPDATE TP_PM_QUALITYLIBRARY   SET VALUEFLAG=0  WHERE LIBRARYID=" + id);
+                code = result != 0 ? 200 : 500;
+            }
+           context.Response.Write(JsonConvert.SerializeObject(code, Formatting.Indented));
+        }
     }
 
     public bool IsReusable

+ 87 - 44
wwwroot/mes/pc/intelligence/Richtext.html

@@ -90,9 +90,10 @@
                     </div>
                     <div class="ddd" style=" flex: 1;margin-left:0;">
                         产品型号:
-                        <select id="modelSelect">
-                            <option disabled selected value="">请选择型号</option>
-                        </select>
+                        <!--<select id="modelSelect">
+        <option disabled selected value="">请选择型号</option>
+    </select>-->
+                        <input class="easyui-combobox" id="modelSelect" name="modelSelect" data-options="required:false,prompt:'',tipPosition:'top',url:'../intelligence/Richtext.ashx?m=getproductmodel',method:'get',valueField:'ID',textField:'GOODSCODE',panelHeight:'300px',editable:'true'" style="width:490px;height:32px;">
                     </div>
                 </div>
                 <div class="ddd">
@@ -107,7 +108,7 @@
                 <form enctype="multipart/form-data">
                     <div id="presetFileName" class="ddd">
                         <span id="filename"></span>
-                        <button type="button" class="ddd" style="padding-top:0; " onclick="deletefile()">删除</button>
+                        <button id="is_delete" type="button" class="ddd" style="padding-top:0; " onclick="deletefile()">删除</button>
                         <button type="button" class="ddd" style="padding-top:0; " onclick="downfile()">下载已上传文件</button>
                     </div>
 
@@ -127,7 +128,7 @@
                     </div>
                 </div>
                 <div class="ddd" style="text-align:center">
-                    <button type="button" class="ddd" style="padding-top: 0; margin:0 auto" onclick="add()">提交/修改</button>
+                    <button id="add_button" type="button" class="ddd" style="padding-top: 0; margin:0 auto" onclick="add()">提交/修改</button>
                 </div>
             </div>
         </div>
@@ -136,39 +137,50 @@
     <script>
         //加载前调用
         $(document).ready(function () {
-            getproductmodel();
+            //getproductmodel();
             getQueryParam();
+            //input框modelSelect 选择内容放入对象addsb中
+            $('#modelSelect').combobox({
+                onSelect: function (rec) {
+                    // 将选中的值存储到对象中
+                    addsb.modelid = rec.ID;
+                    addsb.modelname = rec.GOODSCODE;
+                    console.log('选中的值已存储到对象中:', addsb);
+                }
+            });
         });
-        //创建富文本编辑器初始对象
-        const E = window.wangEditor
-        //语言切换(没用上 放着吧)
-        const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
-        E.i18nChangeLanguage(LANG)
-        //创建初始项
-        const editorConfig = {
-            //自定义配置项
-            MENU_CONF: {},
-            //将画布上的内容添加到对象中
-            onChange(editor) {
-                const html = editor.getHtml()
-                addsb.problem = html;
-            },
-        }
-        //上传图片
-        editorConfig.MENU_CONF['uploadImage'] = {
-            server: 'Richtext.ashx?m=0',
-        }
-        // 上传视频
-        editorConfig.MENU_CONF['uploadVideo'] = { 
-            server: 'Richtext.ashx?m=0',
-        }
-        //画布初始化
-        const editor = E.createEditor({
-            selector: '#editor-container',
-            html: '<p><br></p>',
-            config: editorConfig,
-            mode: 'default', 
-        })
+         
+            //创建富文本编辑器初始对象
+            const E = window.wangEditor
+            //语言切换(没用上 放着吧)
+            const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
+            E.i18nChangeLanguage(LANG)
+            //创建初始项
+            const editorConfig = {
+                //自定义配置项
+                MENU_CONF: {},
+                //将画布上的内容添加到对象中
+                onChange(editor) {
+                    const html = editor.getHtml()
+                    addsb.problem = html;
+                },
+                 
+            }
+            //上传图片
+            editorConfig.MENU_CONF['uploadImage'] = {
+                server: 'Richtext.ashx?m=0',
+            }
+            // 上传视频
+            editorConfig.MENU_CONF['uploadVideo'] = { 
+                server: 'Richtext.ashx?m=0',
+            }
+            //画布初始化
+            const editor = E.createEditor({
+                selector: '#editor-container',
+                html: '<p><br></p>',
+                config: editorConfig,
+                mode: 'default', 
+            })
         //顶栏自定义
         const toolbarConfig = {}
         //顶栏配置项
@@ -204,6 +216,7 @@
                 addsb.modelid = this.value;
                 addsb.modelname = models.find(ex => ex.ID == addsb.modelid).GOODSCODE;
             });
+            
         };
         //提交内容
         const addsb = {
@@ -246,7 +259,7 @@
                 alert('请填写产品名称');
                 return;
             }
-            if (addsb.model == '') {
+            if (addsb.modelid == '') {
                 alert('请填写产品型号');
                 return;
             }
@@ -341,6 +354,8 @@
                             input_participants.value = addsb.participants;
                             input_solution.value = addsb.solution;
                             input_solutioneffect.value = addsb.solutioneffect;
+                            $('#modelSelect').combobox('setValue', addsb.modelid);
+                            $('#modelSelect').combobox('setText', addsb.modelname); 
                             //异步完成标识
                             resolve();
                         } else {
@@ -357,25 +372,53 @@
         const getQueryParam = async () => {
             let libraryIdFound = false;
             let libraryPromise = null;
+            let show = null;
             // 获取URL的查询字符串部分  
             var search = window.location.search.substring(1);
             // 将查询字符串分割成键值对数组  
-            var params = search.split("&");
+            var params = search.split("&"); 
             for (var i = 0; i < params.length; i++) {
                 var val = params[i].split("=");
                 // 如果找到了匹配的参数名,则返回其值  
-                if (val[0] == 'id') {
+                if (val[0] == 'id') { 
+                    libraryPromise = getlibrary(val[1]); 
+                }
+                if (val[0] == 'show') {
                     libraryIdFound = true;
-                    libraryPromise = getlibrary(val[1]);
-                    break;
+                    show = val[1]; 
                 }
             } 
             if (libraryIdFound) { 
                  // 等待getlibrary完成  
                 await libraryPromise; 
-            } 
+            }
+
+            if (show) {
+                console.log('show', show)
+                // 获取输入框元素
+                const input_participants = document.getElementById('input_participants'); 
+                input_participants.disabled = true;
+                const input_name = document.getElementById('input_name');
+                input_name.disabled = true;
+                const input_solution = document.getElementById('input_solution');
+                input_solution.disabled = true; 
+                $('#modelSelect').combobox('disable');
+                const input_solutioneffect = document.getElementById('input_solutioneffect');
+                input_solutioneffect.disabled = true;
+               
+                // 获取按钮元素
+                const deleteButton = document.getElementById('is_delete');
+                // 设置按钮为不可点击状态
+                deleteButton.disabled = true;
+                const add_button = document.getElementById('add_button'); 
+                add_button.disabled = true;
+                const ff = document.getElementById('ff'); 
+                ff.disabled = true;
+                //富文本编译器不可编辑
+                editor.disable()
+            }
             opendiv();
-            loadModelsToSelect(); 
+            /*loadModelsToSelect(); */
         };
         /**删除按钮 */
         const deletefile = () => {
@@ -427,7 +470,7 @@
                 // 设置编辑器的内容为从服务器返回的问题数据  
                 editor.setHtml(addsb.problem);
             }
-        }
+        } 
     </script>
 </body>
 </html >

+ 31 - 1
wwwroot/mes/pc/intelligence/intelligence.html

@@ -34,15 +34,18 @@
         <div id="tb" class="i-toolbar">
             <a class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="jump()">添加</a>
             <a class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="tbReportEdit()">修改</a>
+            <a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deletelick()">删除</a>
+            <a class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="showReport()">预览</a>
             <a class="easyui-linkbutton" iconcls="icon-excel" plain="true" onclick="tbExport()">导出</a>
             <a class="easyui-linkbutton" iconcls="icon-reload" plain="true" onclick="restore()">刷新</a>
             <a class="easyui-linkbutton" iconcls="icon-print" plain="true" onclick="downfile()">下载附件</a>
+
             <div id="tbSearchDiv" style="display: block; padding: 10px;">
                 <div>
                     时间:
                     <input id="opentime" type="text" class="easyui-datebox" style="width:165px; height:32px;">
                     -
-                    <input id="closetime" type="text" class="easyui-datebox" style="width:165px; height:32px;"> 
+                    <input id="closetime" type="text" class="easyui-datebox" style="width:165px; height:32px;">
                 </div>
                 <div style="padding-top:10px;">
                     项目名称:
@@ -222,6 +225,16 @@
                 url: 'Richtext.html?id=' + selectedRow.id
             });
         }
+        /**查看 */
+        const showReport = () => {
+            var selectedRow = $('#myTable').datagrid('getSelected');
+            $('#myTable').datagridDialog({
+                title: '预览数据', 
+                width: width,
+                height: height,
+                url: 'Richtext.html?id=' + selectedRow.id+'&show=true'
+            });
+        }
         // 响应式数据:产品型号列表
         let models = [];
         /** 获取产品型号 */
@@ -296,6 +309,23 @@
                 read.modelid = newValue;
             }
         });
+        /**删除 */
+        const deletelick = async() => {
+            var selectedRow = $('#myTable').datagrid('getSelected');
+            const data = await $.ajax({
+                url: "Richtext.ashx?m=deletedata",
+                type: "POST",
+                data: { id: selectedRow.id},
+                dataType: "json"
+            });
+            console.log('data', data)
+            if (data == 200) {
+                getcontent();
+            }
+            else {
+                console.warn('删除失败')
+            }
+        }
     </script>
 </body>
 </html >