Browse Source

修改bug

695593266@qq.com 7 tháng trước cách đây
mục cha
commit
e858ecb9a7

+ 67 - 2
src/views/factoryModel/station/components/ProduceDialogAll.vue

@@ -58,6 +58,9 @@
       row-key="id"
       :selection.sync="selection"
     >
+      <template v-slot:type="{ row }">
+        {{ typeLabel(row.type) }}
+      </template>
     </ele-pro-table>
 
     <div slot="footer">
@@ -124,18 +127,59 @@
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 110
+          },
+          {
+            prop: 'type',
+            slot: 'type',
+            label: '工序类型',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
           }
         ],
-        workCenterList: []
+        workCenterList: [],
+        typeList: [
+          {
+            value: 99,
+            label: '关键工序'
+          },
+          {
+            value: 1,
+            label: '普通工序'
+          },
+          // {
+          //   value: 2,
+          //   label: '抽样质检'
+          // },
+
+          {
+            value: 3,
+            label: '抽样质检'
+          },
+          {
+            value: 4,
+            label: '包装工序'
+          },
+          {
+            value: 6,
+            label: '质检工序'
+          },
+          {
+            value: 7,
+            label: '生产准备'
+          }
+        ],
+        forData: {}
       };
     },
     methods: {
-      open() {
+      open(data) {
         this.visible = true;
         this.getListWorkCenter();
         this.$nextTick(() => {
           this.$refs.table.reload();
         });
+        this.forData = data;
       },
       /* 表格数据源 */
       async datasource({ page, limit, where, order }) {
@@ -155,6 +199,21 @@
         if (!this.selection.length) {
           return this.$message.warning('请选择工序');
         }
+
+        const { keyEquipment, criticalEquipment } = this.forData.extInfo;
+
+        const hasInvalidSelection = this.selection.some((item) => {
+          return item.type == 99 && keyEquipment != 1 && criticalEquipment != 1;
+        });
+
+        console.log(hasInvalidSelection, 'hasInvalidSelection');
+
+        if (hasInvalidSelection) {
+          return this.$message.warning(
+            '该设备不是关键或关重设备,不能绑定关键工序!'
+          );
+        }
+
         this.$emit('changeProduct', this.selection);
         this.cancel();
       },
@@ -171,6 +230,12 @@
         await work.list({ pageNum: 1, size: -1 }).then((res) => {
           this.workCenterList = res.list;
         });
+      },
+      typeLabel(type) {
+        return (
+          this.typeList.find((m) => m.value == type) &&
+          this.typeList.find((m) => m.value == type).label
+        );
       }
     }
   };

+ 28 - 16
src/views/factoryModel/station/components/edit.vue

@@ -53,6 +53,8 @@
                   @click.native="
                     form.extInfo.assetName = null;
                     form.extInfo.assetCode = null;
+                    form.extInfo.criticalEquipment = '';
+                    form.extInfo.keyEquipment = '';
                   "
                 />
               </el-select>
@@ -84,11 +86,7 @@
           </el-col>
 
           <el-col :span="8">
-            <el-form-item
-              label="班组:"
-              prop="extInfo.teamId"
-              v-if="form.extInfo.type == 3"
-            >
+            <el-form-item label="班组:" prop="extInfo.teamId">
               <el-select
                 style="width: 100%"
                 v-model="form.extInfo.teamId"
@@ -106,11 +104,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item
-              label="人员:"
-              prop="extInfo.teamId"
-              v-if="form.extInfo.type == 3"
-            >
+            <el-form-item label="人员:" prop="extInfo.teamId">
               <el-select
                 style="width: 100%"
                 v-model="form.extInfo.userIds"
@@ -292,6 +286,20 @@
               </el-select>
             </el-form-item>
           </el-col>
+
+          <el-col :span="8" v-if="form.extInfo.type == 1">
+            <el-form-item label="关键设备:" prop="criticalEquipment">
+              <el-tag v-if="form.extInfo.criticalEquipment == '1'">是</el-tag>
+              <el-tag v-if="form.extInfo.criticalEquipment == '2'">否</el-tag>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8" v-if="form.extInfo.type == 1">
+            <el-form-item label="关重设备:" prop="keyEquipment">
+              <el-tag v-if="form.extInfo.keyEquipment == '1'">是</el-tag>
+              <el-tag v-if="form.extInfo.keyEquipment == '2'">否</el-tag>
+            </el-form-item>
+          </el-col>
           <!-- <el-col :span="14">
             <el-form-item label="节拍时间:" prop="extInfo.meterTime">
               <div class="workMeter-warp">
@@ -350,6 +358,7 @@
             <stationMeter
               ref="stationMeter"
               :factoryWorkstationId="form.id"
+              :formData="form"
             ></stationMeter>
           </el-col>
         </el-row>
@@ -436,7 +445,10 @@
             workCenterId: null, //所属工作中心
             // produceId: null, //可执行工序
             type: null,
-            teamId: null
+            teamId: null,
+            userIds: [],
+            criticalEquipment: '',
+            keyEquipment: ''
           },
           id: '',
           leaderId: '', // 负责人
@@ -582,13 +594,9 @@
         console.log(e);
         let that = this;
         listUserByIds([e]).then((res) => {
-          console.log(res, '5263', that.userList);
           that.userList = res;
-          // this.$set(this, 'userList', res);
         });
-        // listUserByIds
-        // userList
-        // console.log(this.userList);
+        that.form.extInfo.userIds = [];
       },
 
       // 选择可执行工序
@@ -609,6 +617,10 @@
       },
 
       determineChoose(title, row) {
+        const equipmentLabel = row.equipmentLabelJson[0];
+        this.form.extInfo.criticalEquipment = equipmentLabel.GJSB;
+        this.form.extInfo.keyEquipment = equipmentLabel.GZSB;
+
         if (title == '选择设备') {
           this.form.extInfo.assetCode = row.code;
           this.form.extInfo.assetName = row.name;

+ 5 - 1
src/views/factoryModel/station/components/stationMeter.vue

@@ -101,6 +101,10 @@
       factoryWorkstationId: {
         type: String,
         default: ''
+      },
+      formData: {
+        type: Object,
+        default: () => {}
       }
     },
     data() {
@@ -188,7 +192,7 @@
     methods: {
       // 选择可执行工序
       handleProduce() {
-        this.$refs.produceRef.open();
+        this.$refs.produceRef.open(this.formData);
       },
       handParent(data, index) {
         this.currentIndex = index;

+ 28 - 0
src/views/technology/production/index.vue

@@ -66,6 +66,22 @@
           >
             生产前生产后配置
           </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="bingdingUser"
+          >
+            绑定人员
+          </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="bingdingWork"
+          >
+            绑定任务
+          </el-button>
         </template>
 
         <template v-slot:name="{ row }">
@@ -237,6 +253,7 @@
           },
 
           {
+            prop: 'type',
             slot: 'type',
             label: '工序类型',
             showOverflowTooltip: true,
@@ -493,6 +510,17 @@
         });
       },
 
+      bingdingUser() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选中一条数据!');
+        }
+      },
+
+      bingdingWork() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选中一条数据!');
+        }
+      },
       /* 删除 */
       remove(row) {
         // 规则正在执行中,无法删除

+ 1 - 3
vue.config.js

@@ -35,14 +35,12 @@ module.exports = {
         // target: 'http://192.168.1.105:18086',
         // target: 'http://192.168.1.158:18086',
         // 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.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', // 赵沙金