695593266@qq.com hace 6 meses
padre
commit
9cf7c23af1

+ 13 - 10
src/views/factoryModel/station/components/ProduceDialogAll.vue

@@ -174,6 +174,7 @@
     },
     methods: {
       open(data) {
+        console.log(data, '获取的数据');
         this.visible = true;
         this.getListWorkCenter();
         this.$nextTick(() => {
@@ -200,18 +201,20 @@
           return this.$message.warning('请选择工序');
         }
 
-        const { keyEquipment, criticalEquipment } = this.forData.extInfo;
+        const { keyEquipment, criticalEquipment, type } = this.forData.extInfo;
 
-        const hasInvalidSelection = this.selection.some((item) => {
-          return item.type == 99 && keyEquipment != 1 && criticalEquipment != 1;
-        });
-
-        console.log(hasInvalidSelection, 'hasInvalidSelection');
+        if (type == 1) {
+          const hasInvalidSelection = this.selection.some((item) => {
+            return (
+              item.type == 99 && keyEquipment != 1 && criticalEquipment != 1
+            );
+          });
 
-        if (hasInvalidSelection) {
-          return this.$message.warning(
-            '该设备不是关键或关重设备,不能绑定关键工序!'
-          );
+          if (hasInvalidSelection) {
+            return this.$message.warning(
+              '该设备不是关键或关重设备,不能绑定关键工序!'
+            );
+          }
         }
 
         this.$emit('changeProduct', this.selection);

+ 63 - 7
src/views/notifyManage/templateManage/components/addOrEditDialog.vue

@@ -3,6 +3,7 @@
   <ele-modal
     width="30%"
     :visible.sync="addOrEditDialogFlag"
+    v-if="addOrEditDialogFlag"
     :close-on-click-modal="false"
     :title="title"
     :before-close="closeDialog"
@@ -53,10 +54,26 @@
         label="接收人:"
         prop="recipient"
       >
-        <role-select
+        <!-- <role-select
           v-if="formData.recipientType == 2"
           v-model="formData.recipient"
-        />
+        /> -->
+        <el-select
+          v-if="formData.recipientType == 2"
+          multiple
+          clearable
+          v-model="formData.recipient"
+          class="ele-block"
+          placeholder="请选择"
+          filterable
+        >
+          <el-option
+            v-for="item in data"
+            :key="item.id"
+            :value="item.id"
+            :label="item.name"
+          />
+        </el-select>
         <el-input
           v-if="formData.recipientType == 1"
           clearable
@@ -122,6 +139,7 @@
   } from '@/api/notifyManage';
   import RoleSelect from '@/views/system/user/components/role-select.vue';
   import staffSelection from '@/views/enterpriseModel/dept/components/staffSelection.vue';
+  import { getlistRole } from '@/api/system/role';
   export default {
     name: 'addOrEditDialog',
     props: {
@@ -165,7 +183,8 @@
 
         dialogType: '',
         // 提交状态
-        loading: false
+        loading: false,
+        data: []
       };
     },
     computed: {
@@ -224,7 +243,17 @@
         };
       }
     },
-    created() {},
+    created() {
+      getlistRole()
+        .then((res) => {
+          this.data = res;
+
+          console.log(this.data, '返回的数据');
+        })
+        .catch((e) => {
+          // this.$message.error(e.message);
+        });
+    },
     methods: {
       handleRecipientTypeChange() {
         this.formData.recipient = [];
@@ -248,6 +277,7 @@
           };
         });
         this.formData.recipientName = data.map((item) => item.name).join(',');
+        this.$forceUpdate();
       },
       init(type, row = {}) {
         this.title = type == 'add' ? '新增' : '修改';
@@ -259,9 +289,15 @@
       async getNotifyTemplateInfo(row) {
         this.formData = await notifyTemplateGetByIdAPI(row.id);
 
-        this.formData.recipientName = this.formData.recipient
-          .map((item) => item.recipientName)
-          .join(',');
+        if (this.formData.recipientType == 1) {
+          this.formData.recipientName = this.formData.recipient
+            .map((item) => item.recipientName)
+            .join(',');
+        } else if (this.formData.recipientType == 2) {
+          this.formData.recipient = this.formData.recipient.map(
+            (item) => item.recipientId
+          );
+        }
       },
       /* 保存编辑 */
       save() {
@@ -269,7 +305,27 @@
           if (!valid) return this.$message.warning('有必填项未填写,请检查');
           this.loading = true;
 
+          let dataList = [];
+          if (this.formData.recipientType == 2) {
+            for (let it of this.formData.recipient) {
+              const data = this.data.find((item) => item.id == it);
+
+              if (data) {
+                const userData = {
+                  recipientId: data.id,
+                  recipientName: data.name,
+                  type: this.formData.recipientType
+                };
+
+                dataList.push(userData);
+              }
+            }
+
+            this.formData.recipient = dataList;
+          }
+
           const params = { ...this.formData };
+
           const API =
             this.dialogType == 'add'
               ? notifyTemplateSaveAPI

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

@@ -41,14 +41,39 @@
       getlistRole()
         .then((res) => {
           this.data = res;
+
+          console.log(this.data, '返回的数据');
         })
         .catch((e) => {
           // this.$message.error(e.message);
         });
     },
     methods: {
+      // updateValue(value) {
+      //   // console.log(value, '值值');
+      //   // const data = this.data.find((item) => value.has(item.id));
+      //   // console.log(data);
+      //   // this.$emit('input', value);
+
+      //   const selectedSet = new Set(value);
+      //   const data = this.data.find((item) => selectedSet.has(item.id));
+      //   console.log(data);
+      //   this.$emit('input', data);
+      // }
+
       updateValue(value) {
-        this.$emit('input', 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);
+        }
+
+        console.log(dataList);
+
+        this.$emit('input', dataList);
       }
     }
   };

+ 4 - 2
vue.config.js

@@ -37,15 +37,17 @@ module.exports = {
         // target: 'http://192.168.1.176:18086',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.251:18186', // 测试环境
+        // target: 'http://192.168.1.251:18186', // 测试环境
         // target: 'http://192.168.1.251:18087',
         // target: 'http://192.168.1.116:18086',
         // 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://f222326r53.imwork.net',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {