Sfoglia il codice sorgente

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

lucw 9 mesi fa
parent
commit
3a2d58e06b

+ 1 - 1
src/api/technology/route/index.js

@@ -51,7 +51,7 @@ export default {
       data
     );
     if (res.data.code == 0) {
-      return res.data.message;
+      return res.data;
     }
   },
   //工艺路线工序实例-删除

+ 140 - 139
src/views/codeManagement/businessCode/codeValueList.vue

@@ -73,7 +73,6 @@
             title="确定要删除此码值吗?"
             @confirm="remove(scoped.$index)"
             v-if="$hasPermission('mian:businessCode:delete')"
-
           >
             <template v-slot:reference>
               <el-button type="danger"> 删除 </el-button>
@@ -90,7 +89,10 @@
         <template v-slot:remark="{ row }">
           <el-input v-model="row.remark" @change="valueChange(row)"></el-input>
         </template>
-        <template v-slot:toolbar v-if="form.roughRule != 4&&$hasPermission('mian:businessCode:save')">
+        <template
+          v-slot:toolbar
+          v-if="form.roughRule != 4 && $hasPermission('mian:businessCode:save')"
+        >
           <el-button type="primary" @click.native="openEdit('add')">
             增加
           </el-button>
@@ -102,148 +104,147 @@
 </template>
 
 <script>
-  import { roughRule, fineRule } from '@/enum/dict.js';
-  import { saveSegment } from '@/api/businessCode';
+import { roughRule, fineRule } from '@/enum/dict.js';
+import { saveSegment } from '@/api/businessCode';
 
-  export default {
-    props: {
-      // 上级
-      parentData: {
-        type: Object,
-        default: () => {}
-      }
-    },
+export default {
+  props: {
+    // 上级
+    parentData: {
+      type: Object,
+      default: () => {}
+    }
+  },
 
-    data() {
-      return {
-        form: {
-          roughRuleName: '',
-          fineRuleName: '',
-          name: '', //码段名称
-          businessCodeCategoryId: '', //分类id
-          length: '', //长度
-          delimiter: '', //间隔符
-          roughRule: '', //粗规则
-          fineRule: '', //细规则
-          value: [],
-          remark: '' //描述
-        },
-        tableList: [],
-        // 表格列配置
-        columns: []
-      };
-    },
-    created() {},
-    // watch: {
-    //   parentData(){
-    //     this.init()
-    //   }
-    // },
-    methods: {
-      reload() {
-        this.form = JSON.parse(JSON.stringify(this.parentData));
-        this.tableList = this.form.value;
-        this.form['roughRuleName'] = roughRule.find(
-          (item) => item.value == this.form.roughRule
-        )?.label;
-        let _fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-        this.form['fineRuleName'] = _fineRule.find(
-          (item) => item.value == this.form.fineRule
-        )?.label;
-        this.setColumns();
-      },
-      setColumns() {
-        this.columns = [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
-          },
-          {
-            label:
-              '编码值' +
-              '(规则:' +
-              this.form.fineRuleName +
-              ',长度:' +
-              (this.form.length || '') +
-              ')',
-            prop: 'value',
-            width: 240,
-            slot: 'value',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'remark',
-            slot: 'remark',
-            label: '描述',
-            showOverflowTooltip: true
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true,
-            fixed: 'right'
-          }
-        ];
+  data() {
+    return {
+      form: {
+        roughRuleName: '',
+        fineRuleName: '',
+        name: '', //码段名称
+        businessCodeCategoryId: '', //分类id
+        length: '', //长度
+        delimiter: '', //间隔符
+        roughRule: '', //粗规则
+        fineRule: '', //细规则
+        value: [],
+        remark: '' //描述
       },
-      valueChange(row) {
-        console.log(this.isReg(row), 'this.isReg(row)');
-        if (this.isReg(row)) {
-          this.save();
-        }
-      },
-      isReg(row) {
-        if (this.form.roughRule == 6) {
-          if (row.value.length == this.form.length) {
-            return true;
-          } else {
-            return false;
-          }
+      tableList: [],
+      // 表格列配置
+      columns: []
+    };
+  },
+  created() {},
+  // watch: {
+  //   parentData(){
+  //     this.init()
+  //   }
+  // },
+  //1111
+  methods: {
+    reload() {
+      this.form = JSON.parse(JSON.stringify(this.parentData));
+      this.tableList = this.form.value;
+      this.form['roughRuleName'] = roughRule.find(
+        (item) => item.value == this.form.roughRule
+      )?.label;
+      let _fineRule = fineRule.filter(
+        (item) => item.pid == this.form.roughRule
+      );
+      this.form['fineRuleName'] = _fineRule.find(
+        (item) => item.value == this.form.fineRule
+      )?.label;
+      this.setColumns();
+    },
+    setColumns() {
+      this.columns = [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center'
+        },
+        {
+          label:
+            '编码值' +
+            '(规则:' +
+            this.form.fineRuleName +
+            ',长度:' +
+            (this.form.length || '') +
+            ')',
+          prop: 'value',
+          width: 240,
+          slot: 'value',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'remark',
+          slot: 'remark',
+          label: '描述',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 200,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true,
+          fixed: 'right'
         }
-        let _fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-        let reg = _fineRule.find(
-          (item) => item.value == this.form.fineRule
-        )?.reg;
-        let regexp = '/^' + reg + '{' + this.form.length + '}$/';
-        return RegExp(eval(regexp)).test(row.value);
-      },
-      /* 显示编辑 */
-      openEdit() {
-        this.tableList.push({
-          value: '',
-          remark: ''
-        });
-      },
-      /* 保存编辑 */
-      save() {
-        this.form.value = this.tableList;
-        saveSegment(this.form)
-          .then((msg) => {
-            this.$message.success('操作成功');
-            this.$emit('done', this.form);
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      },
-      /* 删除 */
-      remove(index) {
-        this.tableList.splice(index, 1);
+      ];
+    },
+    valueChange(row) {
+      console.log(this.isReg(row), 'this.isReg(row)');
+      if (this.isReg(row)) {
         this.save();
-      },
-      done() {
-        this.$emit('done', this.parentData);
       }
+    },
+    isReg(row) {
+      if (this.form.roughRule == 6) {
+        if (row.value.length == this.form.length) {
+          return true;
+        } else {
+          return false;
+        }
+      }
+      let _fineRule = fineRule.filter(
+        (item) => item.pid == this.form.roughRule
+      );
+      let reg = _fineRule.find((item) => item.value == this.form.fineRule)?.reg;
+      let regexp = '/^' + reg + '{' + this.form.length + '}$/';
+      return RegExp(eval(regexp)).test(row.value);
+    },
+    /* 显示编辑 */
+    openEdit() {
+      this.tableList.push({
+        value: '',
+        remark: ''
+      });
+    },
+    /* 保存编辑 */
+    save() {
+      this.form.value = this.tableList;
+      saveSegment(this.form)
+        .then((msg) => {
+          this.$message.success('操作成功');
+          this.$emit('done', this.form);
+        })
+        .catch((e) => {
+          this.loading = false;
+        });
+    },
+    /* 删除 */
+    remove(index) {
+      this.tableList.splice(index, 1);
+      this.save();
+    },
+    done() {
+      this.$emit('done', this.parentData);
     }
-  };
+  }
+};
 </script>

+ 140 - 4
src/views/material/BOMmanage/components/routing.vue

@@ -28,6 +28,22 @@
             @click="add"
             >新增</el-button
           >
+
+          <el-button
+            v-if="
+              (attributeData.approvalStatus != 1 &&
+                attributeData.approvalStatus != 2 &&
+                !isWt &&
+                attributeData.parentId == '0') ||
+              !attributeData.resourceBomId
+            "
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="createRoute(null)"
+            >创建工艺路线</el-button
+          >
         </template>
         <!-- 状态列 -->
         <template v-slot:status="{ row }">
@@ -63,6 +79,16 @@
       </ele-pro-table>
     </el-card>
     <routingDialog ref="routingDialogRef" @reload="reload"></routingDialog>
+
+    <!-- 编辑弹窗 -->
+    <user-edit
+      :visible.sync="showEdit"
+      :data="current"
+      @done="routeReload"
+      :isUpdate="isUpdate"
+      ref="userEdit"
+      :isBomRoute="isBomRoute"
+    />
   </div>
 </template>
 
@@ -70,12 +96,17 @@
   import { getMbomPage } from '@/api/material/BOM';
   import routingDialog from './routingDialog.vue';
   import route from '@/api/technology/route';
-
-  import { workingProcedureUpdate } from '@/api/material/BOM';
+  import UserEdit from '@/views/technology/route/components/user-edit.vue';
+  import {
+    workingProcedureUpdate,
+    workingProcedureSave
+  } from '@/api/material/BOM';
+  // import { workingProcedureUpdate } from '@/api/material/BOM';
   export default {
     name: 'technologyRoute',
     components: {
-      routingDialog
+      routingDialog,
+      UserEdit
     },
     props: {
       taskParam: Object,
@@ -171,13 +202,15 @@
         // 是否显示编辑弹窗
         showEdit: false,
         detailEdit: false,
+        isUpdate: false,
 
         statusList: [
           { label: '草稿', value: -1 },
           { label: '失效', value: 0 },
           { label: '生效', value: 1 }
         ],
-        loading: false
+        loading: false,
+        isBomRoute: false
       };
     },
 
@@ -191,6 +224,109 @@
 
         this.$refs.routingDialogRef.open(this.taskParam, this.tableData);
       },
+
+      createRoute(row) {
+        this.current = row;
+        this.showEdit = true;
+        this.isBomRoute = true;
+        this.$refs.userEdit.isUpdate = true;
+        this.$refs.userEdit.$refs.form &&
+          this.$refs.userEdit.$refs.form.clearValidate();
+      },
+
+      routeReload(routeID) {
+        this.getAllRouteData(routeID);
+      },
+
+      async getAllRouteData(routeID) {
+        const res = await route.list({
+          pageNum: 1,
+          size: -1
+        });
+
+        const dataList = [];
+
+        if (routeID && res.list.length != 0) {
+          const data = res.list.find((item) => item.id == routeID);
+
+          if (data) {
+            dataList.push(data);
+          }
+
+          this.selected(dataList);
+        }
+      },
+
+      selected(dataList) {
+        console.log('1112233');
+        // let routingId = this.selection.map((it) => it.id);
+        let routingId = dataList.map((it) => it.id);
+
+        route.getProcessById(routingId).then((data) => {
+          console.log(this.tableData);
+          if (this.tableData.taskParam) {
+            let newArr = [];
+            for (let i = 0; i < data.length; i++) {
+              let isHas = false;
+              for (let j = 0; j < this.tableData.taskParam.length; j++) {
+                if (
+                  data[i].sourceTaskId ==
+                  this.tableData.taskParam[j].sourceTaskId
+                ) {
+                  isHas = true;
+                  break;
+                }
+              }
+              if (!isHas) {
+                newArr.push(data[i]);
+              }
+            }
+
+            workingProcedureUpdate({
+              id: this.tableData.id,
+              categoryId: this.taskParam.categoryId,
+              bomCategoryId: this.taskParam.id,
+              categoryCode: this.taskParam.categoryCode,
+              processRoute: {
+                list: this.tableData.processRoute.list.concat(dataList)
+              },
+              taskParam: this.tableData.taskParam.concat(newArr)
+            }).then(() => {
+              // this.$emit('reload');
+              this.reload();
+              this.showEdit = false;
+            });
+          } else {
+            workingProcedureSave({
+              categoryId: this.taskParam.categoryId,
+              bomCategoryId: this.taskParam.id,
+              categoryCode: this.taskParam.categoryCode,
+              processRoute: {
+                list: this.selection
+              },
+              taskParam: data.map((item) => {
+                return {
+                  ...item,
+                  versions: this.taskParam.versions,
+                  status: this.taskParam.status
+                };
+              })
+            }).then(() => {
+              let taskParam = data.map((item) => {
+                return {
+                  ...item,
+                  versions: this.taskParam.versions,
+                  status: this.taskParam.status
+                };
+              });
+              // this.$emit('reload');
+              this.reload();
+              this.showEdit = false;
+            });
+          }
+        });
+      },
+
       search(e) {
         this.reload(this.where);
       },

+ 3 - 1
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -792,6 +792,8 @@
   import { newFilePageAPI } from '@/api/material/file';
   import { getBomGetById, getDetailList } from '@/api/material/BOM.js';
   import mbomDatailList from './mbomDatailList.vue';
+  import { setFileUrl } from '@/components/addDoc/util.js';
+
   export default {
     components: {
       userSearch,
@@ -1251,7 +1253,7 @@
       },
 
       fileDetails(row) {
-        this.$refs.browseRef.setFileUrl(row);
+        window.open(setFileUrl(row));
       },
       addJob() {
         this.$refs.jobRef.open();

+ 20 - 1
src/views/material/product/components/index-data.vue

@@ -139,6 +139,14 @@
       </template>
 
       <template v-slot:action="{ row }">
+        <!-- <el-link
+          type="primary"
+          :underline="false"
+          @click="openEdit(row, 1)"
+          v-if="$hasPermission('main:category:update')"
+        >
+          {{ row.isEnabled == 1 ? '停用' : '启用' }}
+        </el-link> -->
         <el-link
           type="primary"
           :underline="false"
@@ -454,6 +462,16 @@
             label: '级别',
             align: 'center',
             showOverflowTooltip: true
+          },
+            {
+            prop: 'bomStatus',
+            label: 'BOM状态',
+            align: 'center',
+            minWidth: 120,
+            formatter: (row, column) => {
+              return row.bomStatus == 1 ? '有' : '无';
+            },
+            showOverflowTooltip: true
           },
           {
             prop: 'isUnpack',
@@ -485,6 +503,7 @@
             },
             showOverflowTooltip: true
           },
+        
 
           {
             prop: 'measuringUnit',
@@ -797,7 +816,7 @@
             {
               columnKey: 'action',
               label: '操作',
-              width: 220,
+              width: 260,
               align: 'center',
               resizable: false,
               slot: 'action',

+ 29 - 23
src/views/material/product/components/index-search.vue

@@ -8,13 +8,11 @@
     @submit.native.prevent
   >
     <el-row :gutter="10">
-
       <el-col v-bind="styleResponsive ? { lg: 3, md: 6 } : { span: 3 }">
-        <el-form-item label=""  label-width="20px">
+        <el-form-item label="" label-width="20px">
           <el-checkbox v-model="where.allSearch">全局</el-checkbox>
         </el-form-item>
-      
-        </el-col>
+      </el-col>
       <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
         <el-form-item label="关键词">
           <el-input
@@ -26,8 +24,6 @@
         </el-form-item>
       </el-col>
 
-
-
       <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
         <el-form-item label="编码">
           <el-input
@@ -48,17 +44,25 @@
           />
         </el-form-item>
       </el-col>
-
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="BOM状态">
+          <el-select v-model="where.bomStatus" style="width: 100%">
+            <el-option :value="1" label="有"></el-option>
+            <el-option :value="0" label="无"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
       <!-- <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
         <el-form-item label="组织机构:">
           <auth-selection v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
         </el-form-item>
       </el-col> -->
-
-
     </el-row>
     <el-row>
-      <el-col v-bind="styleResponsive ? { md: 24} : { span: 24 }" style="display: flex;justify-content: flex-end">
+      <el-col
+        v-bind="styleResponsive ? { md: 24 } : { span: 24 }"
+        style="display: flex; justify-content: flex-end"
+      >
         <el-form-item>
           <el-button
             size="mini"
@@ -75,7 +79,7 @@
             icon="el-icon-refresh"
             class="ele-btn-icon"
             size="mini"
-          >重置</el-button
+            >重置</el-button
           >
 
           <!-- <el-button
@@ -101,13 +105,14 @@
       const defaultWhere = {
         name: '',
         code: '',
-        modelType: ''
+        modelType: '',
+        bomStatus:''
       };
       return {
         defaultWhere,
         // 表单数据
         where: { ...defaultWhere },
-        loading:false
+        loading: false
       };
     },
     computed: {
@@ -128,18 +133,19 @@
       },
 
       resetAllSearch() {
-        this.$set(this.where,'allSearch',false)
+        this.$set(this.where, 'allSearch', false);
       },
-      
+
       // 刷新数据
-      refreshData(){
-          this.loading = true;
-          syncMateriel().then(res=>{
-             if(res=='0'){
-               this.loading = false;
-                this.$message.success('数据刷新成功!')
-                this.search()
-             }
+      refreshData() {
+        this.loading = true;
+        syncMateriel()
+          .then((res) => {
+            if (res == '0') {
+              this.loading = false;
+              this.$message.success('数据刷新成功!');
+              this.search();
+            }
           })
           .catch((e) => {
             this.loading = false;

+ 1 - 1
src/views/system/organization/components/org-user-search.vue

@@ -40,7 +40,7 @@
       </el-col>
       <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
         <DictSelection
-          dictName="岗位"
+          dictName="岗位"   placeholder="请选择岗位"
           clearable
           filterable
           v-model="where.postId"

+ 1 - 1
src/views/technology/production/components/user-edit.vue

@@ -699,7 +699,7 @@
                 (this.isUpdate ? '修改' : '新建') + msg.message
               );
               this.updateVisible(false);
-              this.$emit('done');
+              this.$emit('done', msg.data);
             })
             .catch((e) => {
               this.loading = false;

+ 22 - 8
src/views/technology/route/components/user-edit.vue

@@ -128,14 +128,18 @@
       visible: Boolean,
       isUpdate: Boolean,
       // 修改回显的数据
-      data: Object
+      data: Object,
+      isBomRoute: {
+        type: Boolean,
+        default: false
+      }
     },
     data() {
       const defaultForm = {
         code: '',
         name: '',
         factoryId: '',
-        status: -1,
+        status: 1,
         categoryId: '',
         produceVersionId: '',
         version: '1.0',
@@ -192,6 +196,14 @@
         removeList: []
       };
     },
+
+    mounted() {
+      console.log(this.isBomRoute, 'isBomRoute');
+      if (this.isBomRoute) {
+        this.form.status = 1;
+      }
+    },
+
     computed: {
       statusTitle() {
         return this.isUpdate ? '修改' : '保存';
@@ -248,12 +260,14 @@
 
           route
             .taskinstanceSave(param)
-            .then((msg) => {
-              if (msg) {
-                this.$message.success(msg);
-                this.updateVisible(false);
-                this.$emit('done');
-              }
+            .then((res) => {
+              console.log(res, 'msg77777');
+
+              // if (msg) {
+              this.$message.success(res.message);
+              this.updateVisible(false);
+              this.$emit('done', res.data);
+              // }
             })
             .finally(() => {});
         });

+ 101 - 3
src/views/technology/route/components/user-taskinstance.vue

@@ -20,6 +20,16 @@
           >
             添加工序
           </el-button>
+
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="showAddProcess"
+          >
+            新增工序
+          </el-button>
         </template>
 
         <template v-slot:orderNum="{ row }">
@@ -90,17 +100,29 @@
       :data="current"
       ref="userSetting"
     />
+
+    <!-- 新增工序 -->
+    <add-process
+      :visible.sync="showProcessEdit"
+      :data="currentData"
+      :controlList="controlList"
+      ref="addProcessRef"
+      :typeList="typeList"
+      @done="reloadProcess"
+    />
   </div>
 </template>
 
 <script>
   import route from '@/api/technology/route';
   import Production from './production';
+  import producetask from '@/api/technology/production';
   import UserEdit from './production/components/user-edit.vue';
   import UserSetting from './production/components/user-setting.vue';
   import control from '@/api/technology/control';
+  import addProcess from '@/views/technology/production/components/user-edit.vue';
   export default {
-    components: { Production, UserEdit, UserSetting },
+    components: { Production, UserEdit, UserSetting, addProcess },
     props: {
       // 修改回显的数据
       taskInfo: Object,
@@ -173,12 +195,42 @@
         addDialog: false,
         showSetting: false,
         showEdit: false,
-        current: {},
+        showProcessEdit: false,
+        current: null,
         removeList: [],
         tableData: [],
         controlList: [],
 
-        visible: true
+        visible: true,
+        showEdit: false,
+        typeList: [
+          {
+            value: 1,
+            label: '普通工序'
+          },
+          // {
+          //   value: 2,
+          //   label: '抽样质检'
+          // },
+
+          {
+            value: 3,
+            label: '抽样质检'
+          },
+          {
+            value: 4,
+            label: '包装工序'
+          },
+          {
+            value: 6,
+            label: '质检工序'
+          },
+          {
+            value: 7,
+            label: '生产准备'
+          }
+        ],
+        currentData: null
       };
     },
 
@@ -259,6 +311,52 @@
         return [];
       },
 
+      reloadProcess(processId) {
+        this.getProcessData(processId);
+      },
+
+      async getProcessData(processId) {
+        const res = await producetask.list({
+          pageNum: 1,
+          isDetail: true,
+          size: -1
+        });
+
+        let data = [];
+
+        if (processId && res.list.length != 0) {
+          const processData = res.list.find((it) => it.id == processId);
+
+          if (processData) {
+            data.push(processData);
+          }
+        }
+
+        if (data.length != 0) {
+          let len = this.$refs.table.getData().length + 1;
+          let arrM = data.map((item, index) => {
+            return { ...item.detail, orderNum: len + index };
+          });
+          arrM.forEach((element) => {
+            if (element.id) {
+              this.$set(element, 'sourceTaskId', element.id);
+              delete element.id;
+            }
+          });
+
+          this.$refs.table.setData([...this.$refs.table.getData(), ...arrM]);
+          this.$emit('taskList', this.$refs.table.getData());
+        }
+      },
+
+      showAddProcess() {
+        this.getControlList();
+        this.currentData = undefined;
+        this.showProcessEdit = true;
+        this.$refs.addProcessRef.$refs.form &&
+          this.$refs.addProcessRef.$refs.form.clearValidate();
+      },
+
       async getList() {
         this.removeList = [];
         if (this.isEdit) {

+ 1 - 1
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
         // target: 'http://192.168.1.176:18086',
 
         // target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',