瀏覽代碼

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

yusheng 6 月之前
父節點
當前提交
5fb1d526cb

+ 17 - 0
src/api/system/organization/index.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request';
+import { download } from '@/utils/file';
 
 /**
  * 查询机构列表
@@ -171,3 +172,19 @@ export async function getCurrentUserAuthorityDeptAPI() {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+/**
+ * 组织结构导出
+ * @param
+ */
+export async function exportGroupsAPI() {
+  const res = await request.post(
+    '/main/group/exportGroups',
+    {},
+    {
+      responseType: 'blob'
+    }
+  );
+  download(res.data, '组织机构列表.xlsx');
+}

+ 17 - 1
src/views/enterpriseModel/dept/index.vue

@@ -31,6 +31,15 @@
             折叠全部
           </el-button>
           <!-- <el-button type="primary" size="mini" icon="el-icon-upload2" plain @click="uploadFile">导入</el-button> -->
+           <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-download"
+            class="ele-btn-icon"
+            @click="exportData"
+          >
+            导出
+          </el-button>
         </template>
         <!-- 标题列 -->
         <template v-slot:name="{ row }">
@@ -123,7 +132,8 @@ import importDialog from '@/components/upload/import-dialog.vue';
 
 import {
   listOrganizations,
-  removeOrganization
+  removeOrganization,
+  exportGroupsAPI
 } from '@/api/system/organization';
 
 export default {
@@ -275,6 +285,12 @@ export default {
     foldAll() {
       this.$refs.table.toggleRowExpansionAll(false);
     },
+    // 导出数据
+    exportData() {
+      exportGroupsAPI().then(() => {
+        // this.$message.success('导出成功');
+      });
+    },
     /* 显示编辑 */
     openEdit(item) {
       this.editData = item;

+ 184 - 0
src/views/material/BOMmanage/components/craftFile.vue

@@ -0,0 +1,184 @@
+<template>
+  <ele-modal
+    width="75vw"
+    :visible.sync="visible"
+    v-if="visible"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="工艺文件"
+    append-to-body
+    :maxable="true"
+    @closed="onClose"
+  >
+    <ele-pro-table
+      ref="fileTable"
+      :columns="jobColumns1"
+      :datasource="tableData"
+      :need-page="false"
+      :immediate="true"
+      row-key="code"
+    >
+      <!-- 表头工具栏 -->
+      <template v-slot:toolbar v-if="canEdit">
+        <el-button type="primary" @click="addFile">添加</el-button>
+      </template>
+
+      <!-- 操作列 -->
+      <template v-slot:action="{ row, $index }">
+        <el-link v-if="canEdit" type="primary" @click="handleDel($index)">
+          删除
+        </el-link>
+        <el-link type="primary" @click="fileDetails(row)"> 详情 </el-link>
+      </template>
+    </ele-pro-table>
+
+    <!-- 底部按钮 -->
+    <span slot="footer" class="dialog-footer" v-if="canEdit">
+      <el-button @click="visible = false">取 消</el-button>
+      <el-button type="primary" @click="saveFile">保 存</el-button>
+    </span>
+
+    <fileIndex v-if="fileShow" @close="fileClose" />
+  </ele-modal>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import { newFilePageAPI } from '@/api/material/file';
+  import fileIndex from '../file/index.vue';
+  import { setFileUrl } from '@/components/addDoc/util.js';
+
+  export default {
+    components: { fileIndex },
+    mixins: [dictMixins],
+
+    props: {
+      attributeData: {
+        type: Object,
+        default: () => ({})
+      },
+      isWt: {
+        type: Boolean,
+        default: false
+      }
+    },
+
+    data() {
+      return {
+        visible: false,
+        fileShow: false,
+        routeData: null,
+        tableData: [],
+
+        jobColumns1: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '文档名称',
+            prop: 'name',
+            align: 'center',
+            minWidth: 200,
+            showOverflowTooltip: true
+          },
+          {
+            label: '文件名称',
+            prop: 'storagePath',
+            align: 'center',
+            minWidth: 200,
+            showOverflowTooltip: true,
+            formatter: (_, __, val) =>
+              Array.isArray(val) && val.length ? val[0].name : '-'
+          },
+          { label: '版本', prop: 'version', align: 'center', minWidth: 100 },
+          {
+            label: '创建时间',
+            prop: 'createTime',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            label: '操作',
+            columnKey: 'action',
+            slot: 'action',
+            width: 260,
+            align: 'center'
+          }
+        ]
+      };
+    },
+
+    computed: {
+      /** 是否可编辑 */
+      canEdit() {
+        const { approvalStatus, parentId, resourceBomId } = this.attributeData;
+        const notApproved = approvalStatus !== 1 && approvalStatus !== 2;
+
+        return (
+          (!this.isWt && parentId === '0' && notApproved) ||
+          (!resourceBomId && !this.isWt && notApproved)
+        );
+      }
+    },
+
+    methods: {
+      open(item) {
+        this.routeData = item;
+        this.visible = true;
+        this.fetchFiles();
+      },
+
+      async fetchFiles() {
+        const ids = this.routeData?.fileParam?.map((i) => i.id) || [];
+
+        if (!ids.length) {
+          this.tableData = [];
+          return;
+        }
+
+        const res = await newFilePageAPI({
+          ids: `'${ids.join(',')}'`
+        });
+
+        this.tableData = res || [];
+      },
+
+      addFile() {
+        this.fileShow = true;
+      },
+
+      fileClose(list) {
+        this.tableData = list || [];
+        this.fileShow = false;
+      },
+
+      handleDel(index) {
+        this.tableData.splice(index, 1);
+      },
+
+      fileDetails(row) {
+        window.open(setFileUrl(row));
+      },
+
+      saveFile() {
+        if (!this.tableData.length) {
+          return this.$message.warning('请添加工艺路线');
+        }
+
+        this.$emit('updataFile', this.tableData);
+        this.visible = false;
+      },
+
+      onClose() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 50 - 10
src/views/material/BOMmanage/components/routing.vue

@@ -69,6 +69,15 @@
           }}
         </template>
 
+        <template v-slot:fileParam="{ row, $index }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="fileBtn(row, $index)"
+            >文件
+          </el-link></template
+        >
+
         <template v-slot:action="{ row, $index }">
           <el-link
             type="danger"
@@ -90,6 +99,13 @@
     </el-card>
     <routingDialog ref="routingDialogRef" @reload="reload"></routingDialog>
 
+    <craft-file
+      ref="craftFileRef"
+      @updataFile="updataFile"
+      :attributeData="attributeData"
+      :isWt="isWt"
+    ></craft-file>
+
     <!-- 编辑弹窗 -->
     <user-edit
       :visible.sync="showEdit"
@@ -112,12 +128,14 @@
     workingProcedureUpdate,
     workingProcedureSave
   } from '@/api/material/BOM';
+  import craftFile from './craftFile.vue';
   // import { workingProcedureUpdate } from '@/api/material/BOM';
   export default {
     name: 'technologyRoute',
     components: {
       routingDialog,
-      UserEdit
+      UserEdit,
+      craftFile
     },
     props: {
       taskParam: Object,
@@ -182,6 +200,13 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'fileParam',
+            label: '工艺文件',
+            slot: 'fileParam',
+            align: 'center',
+            showOverflowTooltip: true
+          },
 
           {
             prop: 'status',
@@ -222,7 +247,8 @@
         ],
         loading: false,
         isBomRoute: false,
-        isCategory: false
+        isCategory: false,
+        routeIndex: ''
       };
     },
 
@@ -278,11 +304,9 @@
       },
 
       selected(dataList) {
-        console.log(dataList, 'dataList');
         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++) {
@@ -376,6 +400,12 @@
               this.getAllRouteList();
             }
           }
+          // console.log(this.tableData, 'tableData');
+          // console.log(data[0].processRoute.list, 'data[0].processRoute.list');
+          data[0].processRoute.list.forEach((item) => {
+            item.fileParam = item.fileParam ? item.fileParam : [];
+          });
+
           return data[0].processRoute.list || [];
         } else {
           this.tableData = {};
@@ -383,6 +413,21 @@
         }
       },
 
+      fileBtn(item, index) {
+        this.routeIndex = index;
+        this.$refs.craftFileRef.open(item);
+      },
+
+      updataFile(fileList) {
+        this.$set(
+          this.tableData.processRoute.list[this.routeIndex],
+          'fileParam',
+          fileList
+        );
+
+        this.selected([]);
+      },
+
       async getAllRouteList() {
         await route
           .list({
@@ -392,6 +437,7 @@
           .then((res) => {
             let routeList = [];
             let routeItem = [];
+
             this.tableData.routingIdList.forEach((id) => {
               routeItem = res.list.find((item) => item.id == id);
               if (routeItem) {
@@ -406,12 +452,6 @@
       },
 
       handleDel(row) {
-        // route.getProcessById([row.id]).then((data) => {
-
-        // })
-
-        // console.log(row,'41444444',this.tableData.processRoute.list);
-        // return
         this.$confirm('是否删除?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',

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

@@ -757,7 +757,6 @@
             :need-page="false"
             :immediate="true"
           >
-            <!-- 表头工具栏 -->
             <template v-if="!isView" v-slot:toolbar>
               <el-button type="primary" @click="addFile">添加</el-button>
             </template>
@@ -1438,7 +1437,7 @@
 
           this.tableData.taskParam[this.currentIndex].materialQuota = res.data;
 
-       
+
 
           console.log(this.tableData, 'this.tableData');
         });

+ 65 - 39
src/views/rulesManagement/components/programRulesDialog.vue

@@ -36,15 +36,15 @@
           </el-form-item>
         </el-col>
         <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
-          <el-form-item label="类型" prop="autoOrder">
-            <el-select v-model="addForm.executeUserType" :disabled="isBindPlan" size="small" @change="typeChange" style="width: 100%">
+          <el-form-item label="类型" prop="type">
+            <el-select v-model="addForm.type" :disabled="isBindPlan" size="small" @change="typeChange" 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 :span="8" v-if="((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 1 && !dialogTitle.includes('量具送检')">
+        <el-col :span="8" v-if="dispatchType && addForm.type == 1 && !dialogTitle.includes('量具送检')">
           <el-form-item label="班组" prop="teamId">
             <el-select
               v-model="addForm.teamId"
@@ -63,14 +63,12 @@
           </el-form-item>
         </el-col>
 
-        <el-col :span="8" v-if="((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 0 && !dialogTitle.includes('量具送检')">
+        <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')">
           <el-form-item label="部门" prop="groupId">
             <deptSelect v-model="addForm.groupId" @changeGroup="searchDeptNodeClick" :disabled="isBindPlan" />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="
-          ((addForm.autoOrder && (modelType == 'add' || modelType == 'edit')) || (!addForm.autoOrder && modelType == 'dispatch')) && addForm.executeUserType == 0 &&
-          !dialogTitle.includes('量具送检')
+        <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')
         ">
           <!-- <el-form-item label="负责人" prop="executeIdList">
             <el-select v-model="addForm.executeIdList" size="small" style="width: 100%" :disabled="isBindPlan" multiple
@@ -346,7 +344,6 @@ export default {
       brandNum: '',
       specification: '',
       measuringUnit: '',
-
       bomList: []
     };
     return {
@@ -364,7 +361,7 @@ export default {
       addForm: {
         code: '', // 计划配置单号
         name: '', // 计划配置名称
-        executeUserType: 0, // 默认个人
+        type: 0, // 默认个人
         autoOrder: 1, // 自动派单
         ruleId: '', // 规则id
         ruleName: '', // 规则名称
@@ -376,7 +373,9 @@ export default {
         executorPhone: '',
         status: 1, // 状态
         remark: '', // 备注
-        urgent: '1'
+        urgent: '1',
+        teamId: '', // 班组id
+        executeUsers: [], // 执行人
       },
       ruleNameList: [], // 规则列表
       uerList: [], // 审核人列表
@@ -421,7 +420,7 @@ export default {
         urgent: [
           { required: true, message: '请选择紧急程度', trigger: 'change' }
         ],
-        executeUserType: [
+        type: [
           { required: true, message: '请选择', trigger: 'change' }
         ],
       },
@@ -523,6 +522,9 @@ export default {
     // 是否开启响应式布局
     styleResponsive() {
       return this.$store.state.theme.styleResponsive;
+    },
+    dispatchType() {
+      return ((this.addForm.autoOrder && (this.modelType == 'add' || this.modelType == 'edit')) || (!this.addForm.autoOrder && this.modelType == 'dispatch'))
     }
   },
   watch: {
@@ -562,7 +564,7 @@ export default {
           code: '', // 计划配置单号
           name: '', // 计划配置名称
           autoOrder: 1, // 自动派单
-          executeUserType: 0, // 默认个人
+          type: 0, // 默认个人
           ruleId: '', // 规则id
           ruleName: '', // 规则名称
           duration: null, // 计划完成时长
@@ -573,7 +575,9 @@ export default {
           executorPhone: '',
           status: 1, // 状态
           remark: '', // 备注
-          urgent: '1'
+          urgent: '1',
+          teamId: '', // 班组id
+          executeUsers: [], // 执行人
         };
         this.ruleIdList = [];
         this.isBindPlan = false;
@@ -605,9 +609,20 @@ export default {
         ];
       }
     },
-    typeChange() {
-      this.addForm.groupId = '';
-      this.addForm.executeIdList = [];
+    typeChange(v) {
+      console.log('typeChange', v, this.addForm.executeIdList);
+      // this.addForm.groupId = '';
+      // this.addForm.executeIdList = [];
+      // this.addForm.teamId = '';
+      // this.addForm.executeUsers = [];
+      this.$set(this.addForm, 'executeUsers', []);
+      if(v == 0) {
+        this.$set(this.addForm, 'groupId', '');
+        this.$set(this.addForm, 'executeIdList', []);
+      } else {
+        this.$set(this.addForm, 'teamId', '');
+      }
+      this.$forceUpdate();
     },
     ruleChange(item) {
       this.ruleObj.name = item.name;
@@ -747,7 +762,8 @@ export default {
       try {
         const res = await getInfoById(id);
         console.log('res----------', res);
-        this.addForm = res;
+        // this.addForm = res;
+        
         this.isBindPlan = res.isBindPlan;
         this.categoryEquipment(res.categoryLevelId);
         this.ruleIdList = res.planConfigVOList.map((item) => {
@@ -774,42 +790,50 @@ export default {
         });
 
         // 处理回显数据
-        if (this.addForm.executeUserType === 0) {
+        if (res.type === 0) {
           // 个人
-          this.addForm.executeIdList = this.addForm.executeUsers.map(
+          res.executeIdList = res.executeUsers.map(
             (item) => item.userId
           );
 
-          let groupIds = this.addForm.executeUsers
+          let groupIds = res.executeUsers
             .map((i) => i.groupId)
             .filter((i) => i);
           groupIds = Array.from(new Set(groupIds));
 
           if (groupIds.includes('1')) {
             // 包含全部部门,置空
-            this.addForm.groupId = '1';
+            res.groupId = '1';
           } else {
-            this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '1';
+            res.groupId = res.executeUsers?.[0]?.groupId || '1';
           }
 
+          // this.addForm.teamId = ''
+          // this.$set(this.addForm, 'teamId', '');
+
           groupIds.map((item) => {
             this.searchDeptNodeClick(item);
           });
         } else {
           // 班组
-          this.addForm.teamId = this.addForm.executeUsers[0]?.teamId || '';
+          res.teamId = res.executeUsers?.[0]?.teamId || '';
+          // this.$set(this.addForm, 'groupId', '');
+          // this.$set(this.addForm, 'executeIdList', []);
+          // this.addForm.groupId = ''
+          // this.addForm.executeIdList = []
         }
         this.tabsValue = this.ruleIdList[0].ruleId;
         if (res.groupId) {
           const params = { groupId: res.groupId };
           this.getUserList(params);
         }
+        this.$set(this, 'addForm', res)
         // this._getMatterRulesDetails(res.ruleId);
         this.$set(this.addForm, 'code', res.code);
-        this.$set(this.addForm, 'urgent', res.urgent+'');
+        this.$set(this.addForm, 'urgent', JSON.stringify(res.urgent));
         // this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
         this.$set(this.addForm, 'imageUrl', {});
-        console.log(this.rootData);
+        // console.log(this.rootData);
         const rep = await getTreeByType(0);
         console.log('sasas', res);
         const ids = this.findTopLevelAncestorId(
@@ -871,12 +895,13 @@ export default {
     },
     //选择部门(搜索)
     async searchDeptNodeClick(info, data) {
+      console.log('searchDeptNodeClick', info, data);
       if (info) {
         // 根据部门获取人员
-        this.addForm.groupName = data.name;
+        // this.addForm.groupName = data.name;
         const params = { groupId: info };
         await this.getUserList(params);
-        // if (this.addForm.executeUserType == 1) {
+        // if (this.addForm.type == 1) {
         //   this.addForm.executeIdList = this.executorList.map(
         //     (item) => item.id
         //   );
@@ -886,19 +911,20 @@ export default {
       }
     },
     // 负责人变更 同步执行人列表
-      executeIdListChange() {
-        this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
-          const user = this.executorList.find((u) => u.id === userId);
-          return {
-            userId: user.id,
-            userName: user.name,
+    executeIdListChange(v) {
+      console.log('executeIdListChange', v);
+      this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
+        const user = this.executorList.find((u) => u.id === userId);
+        return {
+          userId: user.id,
+          userName: user.name,
 
-            groupId: user.groupId,
-            groupName: user.groupName
-          };
-        });
-        console.log('this.addForm.executeUsers', this.addForm.executeUsers);
-      },
+          groupId: user.groupId,
+          groupName: user.groupName
+        };
+      });
+      console.log('this.addForm.executeUsers', this.addForm.executeUsers);
+    },
     // 过滤计划完成时长
     formDataDurationTime(value) {
       if (value > 0) {

+ 3 - 3
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -1376,7 +1376,7 @@
             this.formData.details.length == 0 &&
             !this.qmsReportWorkType.includes(this.formData.reportWorkType)
           ) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           try {
@@ -1420,7 +1420,7 @@
           }
           if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
             if (this.formData.details.length == 0) {
-              return this.$message.warning('至少条件一条规则项');
+              return this.$message.warning('至少选择一条规则项');
             }
 
             if (this.formData.reportWorkType == 4) {
@@ -1858,7 +1858,7 @@
         // 只验证详情内容
         if (!this.qmsReportWorkType.includes(this.formData.reportWorkType)) {
           if (this.formData.details.length == 0) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           // 判断参数类型是否选择

+ 1 - 1
src/views/rulesManagement/releaseRules/index.vue

@@ -522,7 +522,7 @@
         console.log('row~~~~~', row)
         if (!this.qmsReportWorkType.includes(row.reportWorkType)) {
           if (row.details.length == 0) {
-            return this.$message.warning('至少条件一条规则项');
+            return this.$message.warning('至少选择一条规则项');
           }
 
           if (row.reportWorkType == 4) {

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

@@ -560,6 +560,19 @@
             </el-radio-group>
           </el-form-item>
         </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="是否需要NC代码:" label-width="200px">
+            <el-radio-group v-model="form.needNCCode">
+              <el-radio
+                :label="item.value"
+                v-for="(item, i) in radioList"
+                :key="i"
+                >{{ item.name }}</el-radio
+              >
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
       </el-row>
     </el-form>
 
@@ -632,6 +645,7 @@
           isPostCheckProduction: '',
           isFinalCheckProduction: '',
           isFirstArticleDualInspection: '',
+          needNCCode: '',
           sort: null,
           intervalTime: {
             nextShortPreTime: '', // 时间单位转换后的下一个短周期的时间,格式为YYYY-MM-DDTHH'