Przeglądaj źródła

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

yusheng 11 miesięcy temu
rodzic
commit
743158b42c

+ 9 - 0
src/api/factoryModel/index.js

@@ -208,3 +208,12 @@ export async function getVendorPageList(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 编码是否存在
+export async function codeExists(code) {
+  const res = await request.get(`/main/factoryworkstation/codeExists/${code}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 3 - 1
src/components/upload/import-dialogNew.vue

@@ -107,8 +107,10 @@
         await importBatch({
           module: this.module,
           multiPartFiles: this.attaments
+        }).finally(() => {
+          this.uploading = false;
         });
-        this.uploading = false;
+
         this.$message.success('操作成功!');
         this.dialogVisible = false;
         this.$emit('success');

+ 128 - 98
src/views/factoryModel/station/components/codeDialog.vue

@@ -1,125 +1,155 @@
 <template>
-    <ele-modal title="自定义编码" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
-        :close-on-press-escape="false" append-to-body width="40%" :maxable="true">
-        <el-form label-width="120px" ref="formRef" :model="formData" :rules="rules" class="rx-sc">
-
-
-
-            <el-form-item label="">
-                <el-input v-model="formData.leave" readonly style="width: 120px;margin-left: 8px;"></el-input>
-            </el-form-item>
-
-
-            <span>-</span>
-            <el-form-item label="" prop="leave2">
-                <DictSelection :ChinEng="true" dictName="工位编码" clearable v-model="formData.leave2">
-                </DictSelection>
-            </el-form-item>
-
-            <span>-</span>
-
-            <el-form-item label="" prop="code">
-                <el-input v-model="formData.code" maxlength="3" placeholder="流水号"
-                    style="width: 120px;margin-left: 8px;"></el-input>
-            </el-form-item>
-
-
-
-
-
-
-        </el-form>
-        <div class="des">工位编码规则,例如:GW-PL(本级)-0001 </div>
-
-        <template v-slot:footer>
-            <el-button @click="handleClose">取消</el-button>
-            <el-button type="primary" @click="save" :loading="loading">
-                保存
-            </el-button>
-        </template>
-
-    </ele-modal>
+  <ele-modal
+    title="自定义编码"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="40%"
+    :maxable="true"
+  >
+    <el-form
+      label-width="120px"
+      ref="formRef"
+      :model="formData"
+      :rules="rules"
+      class="rx-sc"
+    >
+      <el-form-item label="">
+        <el-input
+          v-model="formData.leave"
+          readonly
+          style="width: 120px; margin-left: 8px"
+        ></el-input>
+      </el-form-item>
+
+      <span>-</span>
+      <el-form-item label="" prop="leave2">
+        <DictSelection
+          :ChinEng="true"
+          dictName="工位编码"
+          clearable
+          v-model="formData.leave2"
+        >
+        </DictSelection>
+      </el-form-item>
+
+      <span>-</span>
+
+      <el-form-item label="" prop="code">
+        <el-input
+          v-model="formData.code"
+          maxlength="3"
+          placeholder="流水号"
+          style="width: 120px; margin-left: 8px"
+        ></el-input>
+      </el-form-item>
+    </el-form>
+    <div class="des">工位编码规则,例如:GW-PL(本级)-0001 </div>
+
+    <template v-slot:footer>
+      <el-button @click="handleClose">取消</el-button>
+      <el-button type="primary" @click="save" :loading="loading">
+        保存
+      </el-button>
+    </template>
+  </ele-modal>
 </template>
-  
+
 <script>
+  import { codeExists } from '@/api/factoryModel';
 
-export default {
+  export default {
     data() {
-        return {
-            visible: true,
-            loading: false,
+      return {
+        visible: true,
+        loading: false,
 
-            formData: {
-                leave: 'GW',
-                leave2: null,
+        formData: {
+          leave: 'GW',
+          leave2: null,
 
-                code: null
-            },
+          code: null
+        },
+
+        rules: {
+          leave2: { required: true, message: '请选择', trigger: 'change' },
 
-            rules: {
-                leave2: { required: true, message: '请选择', trigger: 'change' },
-   
-                code: [
-                    { required: true, message: '请输入流水号', trigger: 'blur' },
-                    {
-                        pattern: /^\d{3}$/,
-                        message: '请输入三位数的流水号'
-                    }
-                ]
-            }
+          code: [
+            { required: true, message: '请输入流水号', trigger: 'blur' },
+            {
+              pattern: /^\d{3}$/,
+              message: '请输入三位数的流水号'
+            },
+            { validator: this.codeExist, trigger: 'blur' }
+          ]
         }
+      };
     },
 
-    watch: {
-
-    },
+    watch: {},
     methods: {
-
-        handleClose() {
-            this.$emit('close')
-
-        },
-
-        save() {
-            this.$refs.formRef.validate((valid) => {
-                if (!valid) {
-                    return false;
-                }
-                let code = this.formData.leave + '-' + this.formData.leave2 + '-'  + this.formData.code
-                this.$emit('chooseCode', code)
-                this.handleClose()
-
-
-            })
-        },
-
-
+      async codeExist(rule, value, callback) {
+        debugger;
+        const stationCode =
+          this.formData.leave +
+          '-' +
+          this.formData.leave2 +
+          '-' +
+          this.formData.code;
+        const result = await codeExists(stationCode);
+        console.log('result:', result);
+        if (result.data) {
+          callback(new Error('编码已存在!'));
+        } else {
+          callback();
+        }
+      },
+
+      handleClose() {
+        this.$emit('close');
+      },
+
+      save() {
+        this.$refs.formRef.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+          let code =
+            this.formData.leave +
+            '-' +
+            this.formData.leave2 +
+            '-' +
+            this.formData.code;
+          this.$emit('chooseCode', code);
+          this.handleClose();
+        });
+      }
     }
-}
+  };
 </script>
-  
+
 <style lang="scss" scoped>
-.row_flex {
+  .row_flex {
     display: flex;
     flex-direction: row;
     align-items: center;
-}
+  }
 
-::v-deep .el-form-item__content {
+  ::v-deep .el-form-item__content {
     margin: 0 8px !important;
-}
+  }
 
-::v-deep .el-form-item {
+  ::v-deep .el-form-item {
     margin-bottom: 0px;
-}
+  }
 
-::v-deep .el-form-item:last-child {
+  ::v-deep .el-form-item:last-child {
     margin-bottom: 0px !important;
+  }
 
-}
-
-.des {
+  .des {
     margin-top: 20px;
-}
+  }
 </style>
-  

+ 3 - 3
src/views/rulesManagement/meteringManagement/index.vue

@@ -179,9 +179,9 @@
         this.getPages();
       },
       addType(type) {
-        if (!this.currentObj.id) {
-          return this.$message.warning('请选择分类');
-        }
+        // if (!this.currentObj.id) {
+        //   return this.$message.warning('请选择分类');
+        // }
         if (type == '新增') {
           this.$refs.typeDialogRef.open(type);
         } else {

+ 1 - 1
src/views/workforceManagement/schedule/index.vue

@@ -225,7 +225,7 @@
         };
         teamqueueUpdate(param)
           .then((msg) => {
-            this.$message.success(message);
+            this.$message.success(msg);
             this.done();
           })
           .catch((e) => {