Преглед изворни кода

Merge branch 'test' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

yusheng пре 6 месеци
родитељ
комит
b6d4d6b9ac

+ 51 - 36
src/views/rulesManagement/releaseRules/components/experimentationProcess.vue

@@ -1,12 +1,12 @@
 <template>
   <div class="ele-body">
-    <el-button type="primary" @click="addHtml('customText')"
+    <el-button type="primary" @click="addHtml('customText')" v-if="edit"
       >插入自定义文本</el-button
     >
-    <el-button type="primary" @click="addHtml('customTable')"
+    <el-button type="primary" @click="addHtml('customTable')" v-if="edit"
       >插入表格</el-button
     >
-    <el-button type="primary" @click="save()">保存</el-button>
+    <!-- <el-button type="primary" @click="save()">保存</el-button> -->
     <div
       style="
         display: flex;
@@ -29,9 +29,14 @@
           :key="item.id"
         >
           <div class="listItem">
-            <i class="sort-handle el-icon-_nav move" style="display: none"></i>
+            <i
+              class="sort-handle el-icon-_nav move"
+              style="display: none"
+              v-if="edit"
+            ></i>
             <i
               class="sort-handle el-icon-delete delete"
+              v-if="edit"
               style="display: none"
               @click="del(item.id)"
             ></i>
@@ -43,6 +48,7 @@
               :form="item.value"
               :valueObj="item.valueObj"
               @editShow="editShowFn"
+              :edit="edit"
             ></customText>
             <customTable
               :ref="'customTextRef' + item.id"
@@ -52,12 +58,13 @@
               :form="item.value"
               :valueObj="item.valueObj"
               @editShow="editShowFn"
+              :edit="edit"
             ></customTable>
           </div>
         </div>
       </vue-draggable>
 
-      <el-card class="box-card" v-show="editShow">
+      <el-card class="box-card" v-show="editShow" style="width: 320px">
         <div slot="header" class="clearfix">
           <span>配置</span>
         </div>
@@ -98,14 +105,19 @@
   import customTable from './templateDiv/customTable.vue';
   import VueDraggable from 'vuedraggable';
   import { generateRandomString } from '@/utils/util';
-  import { save } from '@/api/businessCode';
 
   export default {
     components: {
       customText,
-      VueDraggable,customTable
+      VueDraggable,
+      customTable
+    },
+    props: {
+      edit: {
+        default:true,
+        type:Boolean
+      }
     },
-
     computed: {},
     data() {
       return {
@@ -117,26 +129,28 @@
     },
     mounted() {},
     created() {
-      if (sessionStorage['valueJSON']) {
-        this.list = JSON.parse(sessionStorage['valueJSON']);
-      }
-       if (localStorage['valueJSON']) {
-        this.list = JSON.parse(localStorage['valueJSON']);
-      }
-
-      if (this.list.length) {
-        this.$nextTick(() => {
-          this.list.forEach((item) => {
-            this.$refs['customTextRef' + item.id][0].init({
-              form: item.value,
-              valueObj: item.valueObj
-            });
-          });
-        });
-      }
-      console.log(this.list);
+      // if (sessionStorage['valueJSON']) {
+      //   this.list = JSON.parse(sessionStorage['valueJSON']);
+      // }
+      //  if (localStorage['valueJSON']) {
+      //   this.list = JSON.parse(localStorage['valueJSON']);
+      // }
     },
     methods: {
+      init(list) {
+        this.list = JSON.parse(list);
+        console.log(this.list, ' this.list');
+        if (this.list.length) {
+          this.$nextTick(() => {
+            this.list.forEach((item) => {
+              this.$refs['customTextRef' + item.id][0].init({
+                form: item.value,
+                valueObj: item.valueObj
+              });
+            });
+          });
+        }
+      },
       editShowFn({ templateDivRef, domObj }) {
         this.templateDivRef = templateDivRef;
         this.$set(this, 'domObj', domObj);
@@ -158,17 +172,18 @@
           valueObj: {}
         });
       },
-      save() {
-        this.$nextTick(() => {
-          this.list.forEach((item, index) => {
-            let { form, valueObj } =
-              this.$refs['customTextRef' + item.id][0].getValue();
-            this.$set(this.list[index], 'value', form);
-            this.$set(this.list[index], 'valueObj', valueObj);
-          });
-          sessionStorage['valueJSON'] = JSON.stringify(this.list);
-          localStorage['valueJSON'] = JSON.stringify(this.list);
+      getValue() {
+        // this.$nextTick(() => {
+        //   // sessionStorage['valueJSON'] = JSON.stringify(this.list);
+        //   // localStorage['valueJSON'] = JSON.stringify(this.list);
+        // });
+        this.list.forEach((item, index) => {
+          let { form, valueObj } =
+            this.$refs['customTextRef' + item.id][0].getValue();
+          this.$set(this.list[index], 'value', form);
+          this.$set(this.list[index], 'valueObj', valueObj);
         });
+        return this.list;
       }
     }
   };

+ 58 - 25
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -581,9 +581,21 @@
         </template>
       </ele-pro-table>
 
-      <header-title :title="formData.reportWorkType==5?'实验过程':formData.reportWorkType==6?'工艺要求':formData.reportWorkType==7?'实验记录':''" v-if="qmsReportWorkType.includes(formData.reportWorkType)">
+      <header-title
+        :title="
+          formData.reportWorkType == 5
+            ? '实验过程'
+            : formData.reportWorkType == 6
+            ? '工艺要求'
+            : formData.reportWorkType == 7
+            ? '实验记录'
+            : ''
+        "
+        v-if="qmsReportWorkType.includes(formData.reportWorkType)"
+      >
       </header-title>
       <experimentationProcess
+        :edit="type!='detail'"
         v-if="qmsReportWorkType.includes(formData.reportWorkType)"
         ref="experimentationProcess"
       ></experimentationProcess>
@@ -1023,7 +1035,7 @@
       };
 
       return {
-        qmsReportWorkType:['5','6','7'],
+        qmsReportWorkType: ['5', '6', '7'],
         dialogTitle: '',
         visible: false,
         formDateBase,
@@ -1252,6 +1264,9 @@
             this.$refs.cycleMultipleRef?.setRecordRulesCycleList(
               this.formData.recordRulesCycleList
             );
+            if (this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
+              this.$refs.experimentationProcess.init(data.tempJson.tempJson);
+            }
           });
 
           this.formData.startDate = new Date(data.startDate);
@@ -1311,6 +1326,7 @@
 
           this.loading = false;
         } catch (error) {
+          console.log(error, 'error');
           this.loading = false;
         }
       },
@@ -1349,7 +1365,10 @@
           if (!valid) {
             return false;
           }
-          if (this.formData.details.length == 0) {
+          if (
+            this.formData.details.length == 0 &&
+            !this.qmsReportWorkType.includes(this.formData.reportWorkType)
+          ) {
             return this.$message.warning('至少条件一条规则项');
           }
 
@@ -1380,6 +1399,7 @@
             this.$emit('reload');
             this.$emit('reloadTypeList');
           } catch (error) {
+            console.log(error, 'dasda');
             this.btnLoading = false;
           }
         });
@@ -1391,22 +1411,24 @@
           if (!valid) {
             return false;
           }
-          if (this.formData.details.length == 0) {
-            return this.$message.warning('至少条件一条规则项');
-          }
+          if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
+            if (this.formData.details.length == 0) {
+              return this.$message.warning('至少条件一条规则项');
+            }
 
-          if (this.formData.reportWorkType == 4) {
-            // 生产统计过滤掉非成品统计的明细
-            this.formData.details = this.formData.details.filter(
-              (i) => i.statisticsType
-            );
-          }
+            if (this.formData.reportWorkType == 4) {
+              // 生产统计过滤掉非成品统计的明细
+              this.formData.details = this.formData.details.filter(
+                (i) => i.statisticsType
+              );
+            }
 
-          // 判断参数类型是否选择
-          for (const detail of this.formData.details) {
-            if (!detail.paramType) {
-              console.log('detail', detail);
-              return this.$message.warning('请选择规则明细中的参数类型!');
+            // 判断参数类型是否选择
+            for (const detail of this.formData.details) {
+              if (!detail.paramType) {
+                console.log('detail', detail);
+                return this.$message.warning('请选择规则明细中的参数类型!');
+              }
             }
           }
 
@@ -1427,6 +1449,7 @@
             this.handleClose();
             this.$emit('reload');
           } catch (error) {
+            console.log(error, 'error');
             this.btnLoading = false;
           }
         });
@@ -1565,6 +1588,7 @@
       // 数据格式化
       formatBody() {
         this.formData.recordRulesCycleList =
+          this.$refs.cycleMultipleRef &&
           this.$refs.cycleMultipleRef.recordRulesCycleList
             .map((i) => {
               // 根据月日时分排序计算权重排序
@@ -1601,7 +1625,14 @@
           body.stopDate,
           'yyyy-MM-dd HH:mm:ss'
         );
-
+        if (this.qmsReportWorkType.includes(body.reportWorkType)) {
+          let tempJson = this.$refs.experimentationProcess.getValue();
+          if (tempJson) {
+            body.tempJson = {
+              tempJson: JSON.stringify(tempJson)
+            };
+          }
+        }
         // details 根据下标添加 sortNum
         body.details = body.details.map((item, index) => {
           return { ...item };
@@ -1818,14 +1849,16 @@
       // 过程控制修改 保存
       processEditSave() {
         // 只验证详情内容
-        if (this.formData.details.length == 0) {
-          return this.$message.warning('至少条件一条规则项');
-        }
+        if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
+          if (this.formData.details.length == 0) {
+            return this.$message.warning('至少条件一条规则项');
+          }
 
-        // 判断参数类型是否选择
-        for (const detail of this.formData.details) {
-          if (!detail.paramType) {
-            return this.$message.warning('请选择规则明细中的参数类型!');
+          // 判断参数类型是否选择
+          for (const detail of this.formData.details) {
+            if (!detail.paramType) {
+              return this.$message.warning('请选择规则明细中的参数类型!');
+            }
           }
         }
 

+ 20 - 10
src/views/rulesManagement/releaseRules/components/templateDiv/customTable.vue

@@ -1,8 +1,8 @@
 <!-- 搜索表单 -->
 <template>
   <div style="margin-top: 10px">
-    <el-button type="primary" @click="addColumn">新增列</el-button>
-    <el-button type="primary" @click="addRow">新增行</el-button>
+    <el-button type="primary" @click="addColumn" v-if="edit">新增列</el-button>
+    <el-button type="primary" @click="addRow" v-if="edit">新增行</el-button>
 
     <table style="margin-top: 10px" :id="id">
       <thead>
@@ -12,17 +12,18 @@
               class="el-icon-delete delete"
               style="display: none"
               @click="removeColumn(index)"
+              v-if="edit"
             ></i>
             <input
               v-model="item.value"
               type="text"
               class="templateInput"
               :id="item.id"
-              :readonly="item.readonly == 2"
+              :readonly="item.readonly == 2||!edit"
               @click="inputClick(item)"
             />
           </th>
-          <th></th>
+          <th v-if="edit"></th>
         </tr>
       </thead>
       <tbody>
@@ -33,10 +34,10 @@
               type="text"
               class="templateInput"
               :id="item.id"
-              :readonly="item.readonly == 2"
+               :readonly="item.readonly == 2||!edit"
               @click="inputClick(item)"
           /></td>
-          <td>
+          <td v-if="edit">
             <i
               class="sort-handle el-icon-delete delete"
               style="color: #f56c6c"
@@ -57,7 +58,12 @@
     props: {},
     mixins: [dictMixins],
     props: {
-      id: ''
+      id: '',
+      edit: {
+        default: true,
+        type: Boolean
+      },
+    
     },
     data() {
       return {
@@ -157,6 +163,9 @@
       },
 
       inputClick(item) {
+        if(!this.edit){
+          return
+        }
         this.domId = item.id;
         this.$emit('editShow', {
           templateDivRef: 'customTextRef' + this.id,
@@ -203,11 +212,12 @@
   }
   .tableTh:hover {
     position: relative;
-    .delete{
+    .delete {
       display: block !important;
       position: absolute;
-      right: 0;top: 0;
-      color: #F56C6C;
+      right: 0;
+      top: 0;
+      color: #f56c6c;
     }
   }
 </style>

+ 18 - 2
src/views/rulesManagement/releaseRules/components/templateDiv/customText.vue

@@ -14,7 +14,7 @@
     </el-popover>
     <div
       v-html="form"
-      contenteditable
+      :contenteditable="edit"
       class="contenteditable"
       :ref="'valueChange'"
       :id="id"
@@ -32,7 +32,11 @@
     props: {},
     mixins: [dictMixins],
     props: {
-      id: ''
+      id: '',
+      edit: {
+        default: true,
+        type: Boolean
+      }
     },
     data() {
       return {
@@ -106,6 +110,14 @@
       init({ form, valueObj }) {
         this.form = form;
         this.valueObj = valueObj;
+        this.$nextTick(() => {
+          if (!this.edit) {
+            let inputs = document.querySelectorAll('.templateInput');
+            inputs.forEach((item) => {
+              item.setAttribute('readonly', 'readonly');
+            });
+          }
+        });
         this.objInit();
       },
       editInputChange(domObj) {
@@ -138,6 +150,9 @@
         }
       },
       inputClick(event) {
+        if (!this.edit) {
+          return;
+        }
         if (event.target && event.target.className == 'templateInput') {
           this.domId = event.target.id;
           console.log(event, 'event');
@@ -175,6 +190,7 @@
     padding: 1px;
     margin: 1px;
     margin-left: 3px;
+    text-align: center;
   }
   .contenteditable {
     // padding: 5px;

+ 10 - 10
src/views/system/user/components/role-select.vue

@@ -62,18 +62,18 @@
       // }
 
       updateValue(value) {
-        const dataList = [];
-        console.log(value);
-        for (let it of value) {
-          const data = this.data.find((item) =>
-            item.id == it.id ? it.id : it
-          );
-          if (data) dataList.push(data);
-        }
+        // const dataList = [];
+        // console.log(value);
+        // for (let it of value) {
+        //   const data = this.data.find((item) =>
+        //     item.id == it.id ? it.id : it
+        //   );
+        //   if (data) dataList.push(data);
+        // }
 
-        console.log(dataList);
+        // console.log(dataList);
 
-        this.$emit('input', dataList);
+        this.$emit('input', value);
       }
     }
   };

+ 1 - 0
src/views/system/user/components/user-edit.vue

@@ -242,6 +242,7 @@
       },
       /* 保存编辑 */
       save() {
+        console.log(this.form.groupRolePOList,'this.form.groupRolePOList')
         this.$refs.form.validate((valid) => {
           let isRole = true;
           if (!valid) {

+ 2 - 2
vue.config.js

@@ -32,7 +32,7 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        // target: 'http://192.168.1.105:18086',
+        target: 'http://192.168.1.3:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.1.176:18086',
         // target: 'http://192.168.1.125:18086',
@@ -46,7 +46,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.11:18086', // 开发
         // target: 'http://192.168.1.116:18086', // 赵沙金
-        target: 'http://aiot.zoomwin.com.cn:51001/api',
+        // target: 'http://aiot.zoomwin.com.cn:51001/api',
         // target: 'http://f222326r53.imwork.net',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域