wsx hai 11 meses
pai
achega
d0c78e2055

+ 12 - 3
src/views/project-manage/project-initiation/components/addOrEditDialog.vue

@@ -31,6 +31,7 @@
 </template>
 
 <script>
+  import { getProjectCodeG } from '@/api/project-manage';
   import projectForm from './project-form.vue';
   import projectInfoTable from './projectInfoTable.vue';
   import {
@@ -47,6 +48,7 @@
   import { deepClone } from '@/utils';
 
   export default {
+    inject: ['ruleCode'],
     name: 'addOrEditDialog',
     components: {
       projectForm,
@@ -108,12 +110,20 @@
       this.getTeamList();
     },
     methods: {
-      init(row = {}, type) {
+      async init(row = {}, type) {
+        console.log(row);
+
         this.title = type === 'add' ? '新增' : '编辑';
         this.dialogType = type;
         if (type === 'add') {
           console.log(row);
-          this.$set(this.dialogForm, 'parentId', row.id);
+          this.$set(this.dialogForm, 'parentId', row?.id);
+          // 新建代入项目类型
+          if (row) {
+            const res = await getProjectCodeG(this.ruleCode());
+            this.$set(this.dialogForm, 'type', row);
+            this.$set(this.dialogForm, 'code', res);
+          }
         } else {
           this.getInfo(row.id);
         }
@@ -201,7 +211,6 @@
       },
       cancel() {
         this.$refs.projectForm.$refs.form.resetFields();
-
         this.$emit('update:addOrEditDialogFlag', false);
       }
     }

+ 78 - 56
src/views/project-manage/project-initiation/components/project-form.vue

@@ -342,58 +342,59 @@
 
   import linkParentDialog from '@/components/linkParentDialog';
 
-import PersonSelect from '@/components/CommomSelect/person-select.vue';
-import customDialog from '../../components/custom-dialog.vue';
-// import fileUpload from '@/BIZComponents/addDoc/index.vue';
-import { getFile } from '@/api/system/file';
-import contractListDialog from '@/views/project-manage/components/contractListDialog.vue';
-import orderListDialog from '@/BIZComponents/orderListDialog/orderListDialog.vue';
-import { getProduceTreeByCode } from '@/api/custom';
-import moment from 'moment';
-import { cityData } from 'ele-admin/packages/utils/regions';
+  import PersonSelect from '@/components/CommomSelect/person-select.vue';
+  import customDialog from '../../components/custom-dialog.vue';
+  // import fileUpload from '@/BIZComponents/addDoc/index.vue';
+  import { getFile } from '@/api/system/file';
+  import contractListDialog from '@/views/project-manage/components/contractListDialog.vue';
+  import orderListDialog from '@/BIZComponents/orderListDialog/orderListDialog.vue';
+  import { getProduceTreeByCode } from '@/api/custom';
+  import moment from 'moment';
+  import { cityData } from 'ele-admin/packages/utils/regions';
 
   import { contactDetail } from '@/api/eos';
 
-import { reviewStatusEnum } from '@/enum/dict';
-export default {
-  name: 'project-form',
-  components: {
-    // fileUpload,
-    PersonSelect,
-    customDialog,
-    contractListDialog,
-    orderListDialog,
-    linkParentDialog
-  },
-  props: {
-    code: {
-      type: String,
-      default: ''
-    },
-    dialogType: {
-      type: String,
-      default: ''
-    },
-    dialogForm: {
-      type: Object,
-      default: () => {
-        return {
-          ...this.form
-        };
-      }
-    },
-    teamList: {
-      type: Array,
-      default: () => {
-        return [];
-      }
-    },
-    deptList: {
-      type: Array,
-      default: () => {
-        return [];
-      }
+  import { reviewStatusEnum } from '@/enum/dict';
+  export default {
+    name: 'project-form',
+    inject: ['ruleCode'],
+    components: {
+      // fileUpload,
+      PersonSelect,
+      customDialog,
+      contractListDialog,
+      orderListDialog,
+      linkParentDialog
     },
+    props: {
+      code: {
+        type: String,
+        default: ''
+      },
+      dialogType: {
+        type: String,
+        default: ''
+      },
+      dialogForm: {
+        type: Object,
+        default: () => {
+          return {
+            ...this.form
+          };
+        }
+      },
+      teamList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
+      deptList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
 
       deptTreeList: {
         type: Array,
@@ -405,8 +406,6 @@ export default {
     watch: {
       dialogForm: {
         handler(val) {
-          console.log();
-          
           this.form = { ...this.dialogForm };
           // 回显地址选择器
           if (
@@ -421,9 +420,22 @@ export default {
         },
         deep: true
       }
+      // 'form.type': {
+      //   handler(val) {
+      //     console.log(this.dialogType);
+      //     if (this.dialogType == 'add' && this.watchOnce ) {
+      //       this.watchOnce=false
+      //       this.getCode().then((res) => {
+      //         this.form.code = res;
+      //       });
+      //     }
+      //     // console.log(val);
+      //   }
+      // }
     },
     data() {
       return {
+        watchOnce: true,
         tableDataParams: {
           code: '',
           name: ''
@@ -600,7 +612,7 @@ export default {
         linkParentDialogFlag: false,
         rootId: [],
         // 编码规则要传的参数
-        ruleCode: '',
+        // ruleCode: '',
         cityData,
         typeOptions: [
           {
@@ -649,7 +661,7 @@ export default {
           contractId: '',
           contractName: '',
           files: [],
-          relationType: 1
+          relationType: ''
         },
         typeTreeList: [],
         projectList: [],
@@ -721,7 +733,7 @@ export default {
       this.rootId = res1.map((item) => item.id);
       let res2 = await projectsTeamPageAPI({ pageNum: 1, size: 999 });
       this.grouplist = res2;
-      this.ruleCode = this.typeTreeList[0].ruleCode;
+      // this.ruleCode = this.typeTreeList[0].ruleCode;
     },
 
     methods: {
@@ -752,12 +764,17 @@ export default {
         this.form.cycle = a.diff(b, 'days') + 1 + ' 天'; // 1
       },
       async changeType(e) {
+        console.log('进来了');
         if (this.rootId.includes(e)) {
-          console.log('不饿能');
           return;
         }
-        this.form.code = await getProjectCodeG(this.ruleCode);
+        this.form.code = await this.getCode();
+      },
+
+      async getCode() {
+        return await getProjectCodeG(this.ruleCode());
       },
+
       async teamChange(val) {
         let find = this.teamList.find((e) => e.id == val) || {};
         this.form.teamName = find.name;
@@ -843,7 +860,7 @@ export default {
       //选择客户信息回调
       async getCusInfo(obj) {
         console.log(obj);
-        
+
         const { base, other } = await contactDetail(obj.id);
         this.form = Object.assign({}, this.form, {
           contactId: base.id,
@@ -851,6 +868,11 @@ export default {
           contactRelationPhone: obj.linkPhone || obj.phone,
           contactRelationUserName: obj.linkName
         });
+
+        this.form.contactAddressId = '';
+        this.form.contactAddressName = '';
+        this.form.contactAddress = '';
+
         if (other.addressId) {
           this.form.contactAddressId =
             other.addressId && other.addressId.split(',');

+ 381 - 365
src/views/project-manage/project-initiation/components/projectInfoTable.vue

@@ -250,399 +250,415 @@
   </div>
 </template>
 
-
 <script>
-import { mapGetters } from 'vuex';
-import { getByCode } from '@/api/system/dictionary-data';
-import fileUpload from '@/components/upload/fileUpload.vue';
-import { getFile } from '@/api/system/file';
-import PersonSelect from '@/components/CommomSelect/person-select.vue';
-import { proStatusEnum } from '@/enum/dict';
-import { listOrganizations } from '@/api/system/organization';
-// import { deepClone } from '@/utils';
-import { deepClone } from '@/components/FormGenerator/utils/index';
-import {
-  projectsstageSave,
-  projectsstageSaveBatch,
-  projectsGetByIdDetailsAPI,
-  projectsStageUpdateAPI,
-  projectsStageDeleteAPI
-} from '@/api/project-manage';
+  import { mapGetters } from 'vuex';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import fileUpload from '@/components/upload/fileUpload.vue';
+  import { getFile } from '@/api/system/file';
+  import PersonSelect from '@/components/CommomSelect/person-select.vue';
+  import { proStatusEnum } from '@/enum/dict';
+  import { listOrganizations } from '@/api/system/organization';
+  // import { deepClone } from '@/utils';
+  import { deepClone } from '@/components/FormGenerator/utils/index';
+  import {
+    projectsstageSave,
+    projectsstageSaveBatch,
+    projectsGetByIdDetailsAPI,
+    projectsStageUpdateAPI,
+    projectsStageDeleteAPI
+  } from '@/api/project-manage';
 
-export default {
-  name: 'stageInfoTable',
-  components: {
-    PersonSelect,
-    fileUpload
-  },
-  props: {
-    responsibleDeptId: {
-      type: String
-    },
-    dialogForm: {
-      type: Object,
-      default: () => {
-        return {
-          ...this.form
-        };
-      }
-    },
-    dialogType: {
-      type: String,
-      default: ''
+  export default {
+    name: 'stageInfoTable',
+    components: {
+      PersonSelect,
+      fileUpload
     },
-    deptList: {
-      type: Array,
-      default: () => {
-        return [];
-      }
-    },
-    userList: {
-      type: Array,
-      default: () => {
-        return [];
+    props: {
+      responsibleDeptId: {
+        type: String
+      },
+      dialogForm: {
+        type: Object,
+        default: () => {
+          return {
+            ...this.form
+          };
+        }
+      },
+      dialogType: {
+        type: String,
+        default: ''
+      },
+      deptList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
+      userList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
+      deptTreeList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
       }
     },
-    deptTreeList: {
-      type: Array,
-      default: () => {
-        return [];
-      }
-    }
-  },
-  watch: {
-    dialogForm: {
-      handler(val) {
-        this.form.datasource = deepClone(this.dialogForm.stageList) || [];
-        this.form.datasource.forEach((item) => {
-          this.$set(item, 'isEdit', true);
-        });
-        this.$nextTick(async () => {
-          if (this.dialogType === 'view') return;
+    watch: {
+      dialogForm: {
+        handler(val) {
+          this.form.datasource = deepClone(this.dialogForm.stageList) || [];
           this.form.datasource.forEach((item) => {
             this.$set(item, 'isEdit', true);
           });
-        });
+          this.$nextTick(async () => {
+            if (this.dialogType === 'view') return;
+            this.form.datasource.forEach((item) => {
+              this.$set(item, 'isEdit', true);
+            });
+          });
+        },
+        deep: true
       },
-      deep: true
-    },
-    deptList: {
-      handler(newValue, oldValue) {
-        console.log('bianhua');
+      deptList: {
+        handler(newValue, oldValue) {
+          console.log('bianhua');
 
-        console.log(newValue, oldValue);
-      },
-      deep: true
-    }
-  },
-  data() {
-    return {
-      editIndex: undefined, //当前修改数据的下标
-      form: {
-        datasource: []
-      },
-      responceUserList: []
-    };
-  },
-  computed: {
-    columns() {
-      let list = [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'name',
-          label: '阶段名称',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120,
-          slot: 'name',
-          headerSlot: 'headerRequired'
-        },
-        // {
-        //   prop: 'responsibleDeptName',
-        //   label: '负责部门',
-        //   align: 'center',
-        //   showOverflowTooltip: true,
-        //   minWidth: 130,
-        //   slot: 'responsibleDeptId',
-        //   headerSlot: 'headerRequired',
-        // },
-        {
-          prop: 'responsibleUserNames',
-          label: '负责人',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 200,
-          slot: 'responsibleUserId',
-          headerSlot: 'headerRequired'
-        },
-        {
-          prop: 'planStartDate',
-          label: '开始时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 170,
-          slot: 'planStartDate',
-          headerSlot: 'headerRequired'
-        },
-        {
-          prop: 'planEndDate',
-          label: '结束时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 170,
-          slot: 'planEndDate',
-          headerSlot: 'headerRequired'
-        },
-        {
-          prop: 'realStartTime',
-          label: '实际开始时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 170
-        },
-        {
-          prop: 'realEndTime',
-          label: '实际结束时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 170
+          console.log(newValue, oldValue);
         },
-        {
-          prop: 'remark',
-          label: '备注',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 160,
-          slot: 'remark'
-        },
-        {
-          prop: 'isOverTime',
-          label: '是否超时',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          slot: 'isOverTime'
-        },
-        // {
-        //   prop: 'proportion',
-        //   label: '权重占比(%)',
-        //   align: 'center',
-        //   showOverflowTooltip: true,
-        //   minWidth: 110,
-        //   slot: 'proportion'
-        // },
-        {
-          prop: 'speedPercent',
-          label: '进度',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 150,
-          slot: 'speedPercent'
-        },
-        {
-          prop: 'status',
-          label: '状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 130,
-          formatter: (_row, _column, cellValue) => {
-            return proStatusEnum[cellValue].label;
-          }
-        }
-      ];
-      let action = [
-        {
-          columnKey: 'action',
-          slot: 'action',
-          label: '操作',
-          resizable: false,
-          minWidth: 180,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'right'
-        }
-      ];
-      this.dialogType === 'view'
-        ? (list = [...list])
-        : (list = [...list, ...action]);
-      return list;
-    }
-  },
-  methods: {
-    // 选择负责人部门
-    changeDeptInfo(id, index) {
-      console.log(id, index);
-      const info = this.deptList.find((e) => e.id == id) || {};
-      this.$set(this.form.datasource[index], 'responsibleDeptName', info.name);
-      this.$set(this.form.datasource[index], 'responsibleUserId', '');
-      this.$set(this.form.datasource[index], 'responsibleUserName', '');
-      // this.getUserList(id, index);
-    },
-    // 获取人员数据
-    getUserList(groupId, index) {
-      // if (groupId) {
-      //   this.$refs['directorRef' + index].getList({groupId});
-      // }
-    },
-    personChange(val, index) {
-      const info = this.userList.find((e) => e.id == val) || {};
-      console.log(val, info, index);
-      console.log(this.dialogForm);
-      this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
-      // this.$set(
-      //   this.form.datasource[index],
-      //   'responsibleDeptName',
-      //   this.dialogForm.responsibleDeptName
-      // );
+        deep: true
+      }
     },
-    // personChange(val, index) {
-    //
-    //   // this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
-    // },
-    downloadFile(file) {
-      getFile({ objectName: file.storePath }, file.name);
+    data() {
+      return {
+        editIndex: undefined, //当前修改数据的下标
+        form: {
+          datasource: []
+        },
+        responceUserList: [],
+        addFlag: false
+      };
     },
-    //新增计划数据
-    handleAddInfo() {
-      this.$nextTick(() => {
-        this.form.datasource.push({
-          projectId: localStorage.getItem('projectId'),
-          milepost: '',
-          isMilepost: 0,
-          responsibleUserList: [],
-          responsibleUserId: '',
-          responsibleDeptId: this.responsibleDeptId,
-          responsibleDeptName: this.dialogForm.responsibleDeptName,
-          planStartDate: '',
-          planEndDate: '',
-          name: '',
-          content: '',
-          status: 0,
-          isOverTime: 0,
-          speedPercent: 0,
-          remark: ''
-        });
-        console.log(this.form.datasource);
-      });
+    computed: {
+      columns() {
+        let list = [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'name',
+            label: '阶段名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120,
+            slot: 'name',
+            headerSlot: 'headerRequired'
+          },
+          // {
+          //   prop: 'responsibleDeptName',
+          //   label: '负责部门',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   minWidth: 130,
+          //   slot: 'responsibleDeptId',
+          //   headerSlot: 'headerRequired',
+          // },
+          {
+            prop: 'responsibleUserNames',
+            label: '负责人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200,
+            slot: 'responsibleUserId',
+            headerSlot: 'headerRequired'
+          },
+          {
+            prop: 'planStartDate',
+            label: '开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170,
+            slot: 'planStartDate',
+            headerSlot: 'headerRequired'
+          },
+          {
+            prop: 'planEndDate',
+            label: '结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170,
+            slot: 'planEndDate',
+            headerSlot: 'headerRequired'
+          },
+          {
+            prop: 'realStartTime',
+            label: '实际开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          },
+          {
+            prop: 'realEndTime',
+            label: '实际结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          },
+          {
+            prop: 'remark',
+            label: '备注',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            slot: 'remark'
+          },
+          {
+            prop: 'isOverTime',
+            label: '是否超时',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            slot: 'isOverTime'
+          },
+          // {
+          //   prop: 'proportion',
+          //   label: '权重占比(%)',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   minWidth: 110,
+          //   slot: 'proportion'
+          // },
+          {
+            prop: 'speedPercent',
+            label: '进度',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            slot: 'speedPercent'
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (_row, _column, cellValue) => {
+              return proStatusEnum[cellValue].label;
+            }
+          }
+        ];
+        let action = [
+          {
+            columnKey: 'action',
+            slot: 'action',
+            label: '操作',
+            resizable: false,
+            minWidth: 180,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ];
+        this.dialogType === 'view'
+          ? (list = [...list])
+          : (list = [...list, ...action]);
+        return list;
+      }
     },
-    //
-    clearData() {
-      this.form.datasource.forEach((item, index) => {
-        this.$set(this.form.datasource[index], 'milepost', '');
-        this.$set(this.form.datasource[index], 'isMilepost', 0);
-        this.$set(this.form.datasource[index], 'isOverTime', 0);
-        this.$set(this.form.datasource[index], 'speedPercent', 0);
+    methods: {
+      // 选择负责人部门
+      changeDeptInfo(id, index) {
+        console.log(id, index);
+        const info = this.deptList.find((e) => e.id == id) || {};
+        this.$set(
+          this.form.datasource[index],
+          'responsibleDeptName',
+          info.name
+        );
         this.$set(this.form.datasource[index], 'responsibleUserId', '');
         this.$set(this.form.datasource[index], 'responsibleUserName', '');
-        this.$set(this.form.datasource[index], 'responsibleDeptId', '');
-        this.$set(this.form.datasource[index], 'responsibleDeptName', '');
-        this.$set(this.form.datasource[index], 'planStartDate', '');
-        this.$set(this.form.datasource[index], 'planEndDate', '');
-        this.$set(this.form.datasource[index], 'name', '');
-        this.$set(this.form.datasource[index], 'content', '');
-      });
-    },
-
-    //删除关联信息数据
-    async handleDelInfo(row, index) {
-      if (!row.id) {
-        this.form.datasource.splice(index, 1);
-        return;
-      }
-      const res = await projectsStageDeleteAPI([row.id]);
-      this.init();
-    },
-    customColorMethod(percentage) {
-      if (percentage < 30) {
-        return '#909399';
-      } else if (percentage < 70) {
-        return '#e6a23c';
-      } else {
-        return '#67c23a';
-      }
-    },
-    async save() {
-      let form = await this.getTableValidate();
-      let saveForm = form.filter((item) => !item.id);
-      console.log(form);
-      const res = await projectsstageSaveBatch(saveForm);
+        // this.getUserList(id, index);
+      },
+      // 获取人员数据
+      getUserList(groupId, index) {
+        // if (groupId) {
+        //   this.$refs['directorRef' + index].getList({groupId});
+        // }
+      },
+      personChange(val, index) {
+        const info = this.userList.find((e) => e.id == val) || {};
+        console.log(val, info, index);
+        console.log(this.dialogForm);
+        this.$set(
+          this.form.datasource[index],
+          'responsibleUserName',
+          info.name
+        );
+        // this.$set(
+        //   this.form.datasource[index],
+        //   'responsibleDeptName',
+        //   this.dialogForm.responsibleDeptName
+        // );
+      },
+      // personChange(val, index) {
+      //
+      //   // this.$set(this.form.datasource[index], 'responsibleUserName', info.name);
+      // },
+      downloadFile(file) {
+        getFile({ objectName: file.storePath }, file.name);
+      },
+      //新增计划数据
+      handleAddInfo() {
+        this.addFlag = true;
+        this.$nextTick(() => {
+          this.form.datasource.push({
+            projectId: localStorage.getItem('projectId'),
+            milepost: '',
+            isMilepost: 0,
+            responsibleUserList: [],
+            responsibleUserId: '',
+            responsibleDeptId: this.responsibleDeptId,
+            responsibleDeptName: this.dialogForm.responsibleDeptName,
+            planStartDate: '',
+            planEndDate: '',
+            name: '',
+            content: '',
+            status: 0,
+            isOverTime: 0,
+            speedPercent: 0,
+            remark: ''
+          });
+          console.log(this.form.datasource);
+        });
+      },
+      //
+      clearData() {
+        this.form.datasource.forEach((item, index) => {
+          this.$set(this.form.datasource[index], 'milepost', '');
+          this.$set(this.form.datasource[index], 'isMilepost', 0);
+          this.$set(this.form.datasource[index], 'isOverTime', 0);
+          this.$set(this.form.datasource[index], 'speedPercent', 0);
+          this.$set(this.form.datasource[index], 'responsibleUserId', '');
+          this.$set(this.form.datasource[index], 'responsibleUserName', '');
+          this.$set(this.form.datasource[index], 'responsibleDeptId', '');
+          this.$set(this.form.datasource[index], 'responsibleDeptName', '');
+          this.$set(this.form.datasource[index], 'planStartDate', '');
+          this.$set(this.form.datasource[index], 'planEndDate', '');
+          this.$set(this.form.datasource[index], 'name', '');
+          this.$set(this.form.datasource[index], 'content', '');
+        });
+      },
 
-      if (res) {
+      //删除关联信息数据
+      async handleDelInfo(row, index) {
+        if (!row.id) {
+          this.form.datasource.splice(index, 1);
+          return;
+        }
+        const res = await projectsStageDeleteAPI([row.id]);
         this.init();
-      }
-    },
-    getTableValidate() {
-      return new Promise((resolve, reject) => {
-        // if (this.form.datasource.length == 0) return this.$message.warning('')
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            this.$message.warning('有必填项未填,请检查');
-            reject('有必填项未填,请检查');
-          } else {
-            resolve(this.form.datasource);
-          }
+      },
+      customColorMethod(percentage) {
+        if (percentage < 30) {
+          return '#909399';
+        } else if (percentage < 70) {
+          return '#e6a23c';
+        } else {
+          return '#67c23a';
+        }
+      },
+      async save() {
+        let form = await this.getTableValidate();
+        let saveForm = form.filter((item) => !item.id);
+        console.log(form);
+        const res = await projectsstageSaveBatch(saveForm);
+
+        if (res) {
+          this.init();
+        }
+      },
+      getTableValidate() {
+        return new Promise((resolve, reject) => {
+          // if (this.form.datasource.length == 0) return this.$message.warning('')
+          this.$refs.form.validate((valid) => {
+            if (!valid) {
+              this.$message.warning('有必填项未填,请检查');
+              reject('有必填项未填,请检查');
+            } else {
+              resolve(this.form.datasource);
+            }
+          });
         });
-      });
-    },
-    init() {
-      this.$nextTick(async () => {
-        const res = await projectsGetByIdDetailsAPI(
-          localStorage.getItem('projectId')
-        );
-        console.log(res);
+      },
+      init() {
+        this.$nextTick(async () => {
+          const res = await projectsGetByIdDetailsAPI(
+            localStorage.getItem('projectId')
+          );
+          console.log(res);
 
-        this.form.datasource = res.allStageList || [];
-        this.form.datasource.forEach((item) => {
-          this.$set(item, 'isEdit', true);
+          this.form.datasource = res.allStageList || [];
+          this.form.datasource.forEach((item) => {
+            this.$set(item, 'isEdit', true);
+          });
+          console.log(this.form);
         });
-        console.log(this.form);
-      });
 
-      // projectsGetByIdDetailsAPI
-      // this.form.datasource=
-    },
-    editFn(row, index) {
-      console.log('xiugai', index, this.form.datasource);
-      this.$nextTick(() => {
-        this.$set(this.form.datasource[index], 'isEdit', false);
-      });
-    },
-    async updateFn() {
-      let form = await this.getTableValidate();
-      let updateForm = form.filter((item) => !item.isEdit);
-      console.log(updateForm);
+        // projectsGetByIdDetailsAPI
+        // this.form.datasource=
+      },
+      editFn(row, index) {
+        console.log('xiugai', index, this.form.datasource);
+        this.$nextTick(() => {
+          this.$set(this.form.datasource[index], 'isEdit', false);
+        });
+      },
+      async updateFn() {
+        let form = await this.getTableValidate();
+        let findItem = form.find((item) => !item.id);
+        console.log(findItem);
 
-      // const res = await projectsStageUpdateAPI(updateForm[0]);
+        if(findItem){
+          this.$message('请先保存新增的数据')
+          return
+        }
+        
+        let updateForm = form.filter((item) => !item.isEdit);
+        console.log(updateForm);
 
-      for (const item of updateForm) {
-        await projectsStageUpdateAPI(item);
-      }
-      this.init();
+        // const res = await projectsStageUpdateAPI(updateForm[0]);
+
+        for (const item of updateForm) {
+          await projectsStageUpdateAPI(item);
+        }
+        this.init();
 
-      // const res = await projectsStageUpdateAPI(saveForm);
+        // const res = await projectsStageUpdateAPI(saveForm);
 
-      // if (res) {
-      //   this.init();
-      // }
+        // if (res) {
+        //   this.init();
+        // }
+      }
+    },
+    created() {
+      this.init();
     }
-  },
-  created() {
-    this.init();
-  }
-};
+  };
 </script>
 
-
 <style scoped lang="scss">
-:deep(.el-form-item) {
-  margin-bottom: 0;
-}
+  :deep(.el-form-item) {
+    margin-bottom: 0;
+  }
 </style>

+ 422 - 405
src/views/project-manage/project-initiation/index.vue

@@ -47,7 +47,7 @@
                   icon="el-icon-plus"
                   class="ele-btn-icon"
                   v-if="$hasPermission('pro:projects:save')"
-                  @click="openEdit('', 'add')"
+                  @click="openEdit(treeId, 'add')"
                 >
                   新建
                 </el-button>
@@ -308,426 +308,443 @@
 </template>
 
 <script>
-import ProjectDetailDialog from '@/views/BOMmanage/ProjectDetailDialog.vue';
-import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-import indexSearch from './components/index-search.vue';
-import addOrEditDialog from './components/addOrEditDialog.vue';
-import addPlanDialog from '../planManage/components/addOrEditDialog.vue';
-import detailDialog from './components/detailDialog.vue';
-import {
-  projectsDeleteAPI,
-  projectsPageAPI,
-  submit,
-  projectsFinishAPI,
-  projectsPauseAPI,
-  projectsStartupAPI,
-  projectsTerminationAPI,
-  getMyProjectsPage
-} from '@/api/project-manage';
-import { reviewStatusEnum } from '@/enum/dict';
-import { mapGetters } from 'vuex';
-import { getByCode } from '@/api/system/dictionary-data';
-import popModal from '@/components/pop-modal/index.vue';
-import AssetTree from '@/components/AssetTree';
-export default {
-  name: 'index',
-  components: {
-    popModal,
-    addOrEditDialog,
-    detailDialog,
-    indexSearch,
-    processSubmitDialog,
-    addPlanDialog,
-    AssetTree,
-    ProjectDetailDialog
-  },
-  computed: {
-    ...mapGetters(['getDictValue']),
+  import ProjectDetailDialog from '@/views/BOMmanage/ProjectDetailDialog.vue';
+  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import indexSearch from './components/index-search.vue';
+  import addOrEditDialog from './components/addOrEditDialog.vue';
+  import addPlanDialog from '../planManage/components/addOrEditDialog.vue';
+  import detailDialog from './components/detailDialog.vue';
+  import {
+    projectsDeleteAPI,
+    projectsPageAPI,
+    submit,
+    projectsFinishAPI,
+    projectsPauseAPI,
+    projectsStartupAPI,
+    projectsTerminationAPI,
+    getMyProjectsPage
+  } from '@/api/project-manage';
+  import { reviewStatusEnum } from '@/enum/dict';
+  import { mapGetters } from 'vuex';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import popModal from '@/components/pop-modal/index.vue';
+  import AssetTree from '@/components/AssetTree';
+  export default {
+    name: 'index',
+    components: {
+      popModal,
+      addOrEditDialog,
+      detailDialog,
+      indexSearch,
+      processSubmitDialog,
+      addPlanDialog,
+      AssetTree,
+      ProjectDetailDialog
+    },
+    computed: {
+      ...mapGetters(['getDictValue']),
 
-    columns() {
-      return [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center'
-        },
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'typeName',
-          label: '项目类型',
-          showOverflowTooltip: true,
-          minWidth: 150,
-          align: 'center'
-          // slot: 'type',
-        },
-        {
-          prop: 'code',
-          label: '项目编码',
-          showOverflowTooltip: true,
-          minWidth: 160,
-          slot: 'code',
-          align: 'center'
-        },
-        {
-          prop: 'name',
-          label: '项目名称',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 140
-        },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'typeName',
+            label: '项目类型',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            align: 'center'
+            // slot: 'type',
+          },
+          {
+            prop: 'code',
+            label: '项目编码',
+            showOverflowTooltip: true,
+            minWidth: 160,
+            slot: 'code',
+            align: 'center'
+          },
+          {
+            prop: 'name',
+            label: '项目名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
 
-        {
-          prop: 'responsibleDeptName',
-          label: '负责部门',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'responsibleUserName',
-          label: '项目经理',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'teamName',
-          label: '项目团队',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'cycle',
-          label: '项目周期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'budget',
-          label: '项目预算',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue
-              ? cellValue + this.getDictV('pro_projects_budget_unit', _row.unit)
-              : '';
-          }
-        },
-        {
-          prop: 'planStartDate',
-          label: '计划开始日期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120
-        },
-        {
-          prop: 'planEndDate',
-          label: '计划完成日期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120
-        },
-        {
-          prop: 'realStartTime',
-          label: '实际开始日期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120
-        },
-        {
-          prop: 'realEndTime',
-          label: '实际完成日期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120
-        },
-        {
-          prop: 'cost',
-          label: '费用(元)',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 140
-        },
-        {
-          prop: 'status',
-          label: '项目状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          slot: 'status'
-        },
-        {
-          prop: 'processStatus',
-          label: '审核状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          formatter: (_row, _column, cellValue) => {
-            return reviewStatusEnum[_row.processStatus].label;
+          {
+            prop: 'responsibleDeptName',
+            label: '负责部门',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'responsibleUserName',
+            label: '项目经理',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'teamName',
+            label: '项目团队',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'cycle',
+            label: '项目周期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'budget',
+            label: '项目预算',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue
+                ? cellValue +
+                    this.getDictV('pro_projects_budget_unit', _row.unit)
+                : '';
+            }
+          },
+          {
+            prop: 'planStartDate',
+            label: '计划开始日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'planEndDate',
+            label: '计划完成日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'realStartTime',
+            label: '实际开始日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'realEndTime',
+            label: '实际完成日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120
+          },
+          {
+            prop: 'cost',
+            label: '费用(元)',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
+          {
+            prop: 'status',
+            label: '项目状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            slot: 'status'
+          },
+          {
+            prop: 'processStatus',
+            label: '审核状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            formatter: (_row, _column, cellValue) => {
+              return reviewStatusEnum[_row.processStatus].label;
+            }
+          },
+          {
+            prop: 'isOverTime',
+            label: '是否超时',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            slot: 'isOverTime'
+          },
+          {
+            prop: 'isOverbudget',
+            label: '是否超预算',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            slot: 'isOverbudget'
+          },
+          {
+            prop: 'speedPercent',
+            label: '项目进度',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            slot: 'speedPercent'
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 280,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
           }
-        },
-        {
-          prop: 'isOverTime',
-          label: '是否超时',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          slot: 'isOverTime'
-        },
-        {
-          prop: 'isOverbudget',
-          label: '是否超预算',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100,
-          slot: 'isOverbudget'
-        },
-        {
-          prop: 'speedPercent',
-          label: '项目进度',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 150,
-          slot: 'speedPercent'
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 280,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          fixed: 'right'
-        }
-      ];
-    }
-  },
-  data() {
-    return {
-      projectsFinishAPI: projectsFinishAPI,
-      projectsPauseAPI: projectsPauseAPI,
-      projectsStartupAPI: projectsStartupAPI,
-      projectsTerminationAPI: projectsTerminationAPI,
-      parentId: '',
-      selection: [],
-      dictList: [],
-      // 表格列配置
-
-      // 是否显示编辑弹窗
-      addOrEditDialogFlag: false,
-      detailDialogFlag: false,
-      processSubmitDialogFlag: false,
-      delVisible: false,
-      addPlanDialogFLag: false,
-      // 全部菜单数据
-      menuList: [],
-      // 展开折叠
-      expandAllFlag: false
-    };
-  },
-  async created() {
-    console.log(111);
-  },
-  watch: {
-    $route() {
-      this.reload && this.reload();
-    }
-  },
-  methods: {
-    getDictV(code, val) {
-      if (!this.dictList[code]) return '';
-      return this.dictList[code].find((item) => item.value == val)?.label;
-    },
-    async getDictList(code) {
-      let { data: res } = await getByCode(code);
-      this.dictList[code] = res.map((item) => {
-        let values = Object.keys(item);
-        return {
-          value: values[0],
-          label: item[values[0]]
-        };
-      });
-    },
-    handelBOMConstructDetail(row, type = '') {
-      // this.$router.push({
-      //   path: '/BOMmanage/details',
-      //   query: {
-      //     id: row.id,
-      //     type
-      //   }
-      // });
-      localStorage.setItem('projectId', row.id);
-      this.$refs.ProjectDetailDialogFlag.open(row, type);
-    },
-    customColorMethod(percentage) {
-      if (percentage < 30) {
-        return '#909399';
-      } else if (percentage < 70) {
-        return '#e6a23c';
-      } else {
-        return '#67c23a';
+        ];
       }
     },
-    /* 表格数据源 */
-    async datasource({ page, limit, where, parent }) {
-      await this.getDictList('pro_projects_status');
-      await this.getDictList('pro_projects_type');
-      await this.getDictList('pro_projects_budget_unit');
-      // /project-manage/myProject
-      const api =
-        this.$route.path == '/project-manage/myProject'
-          ? getMyProjectsPage
-          : projectsPageAPI;
-      return api({
-        pageNum: page,
-        size: limit,
-        parentId: parent?.id ?? '0',
-        // parentId:this.parentId,
-        ...where,
-        type: this.treeId
-      });
+    provide() {
+      return {
+        ruleCode: () => this.ruleCode
+      };
     },
-    onDone(row) {
-      console.log(row);
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ where, size: 1, pageNum: 10, parentId: '0' });
-      this.$refs.table.reRenderTable();
-    },
-    handleNodeClick(data, node) {
-      this.parentId = data.parentId;
-      this.treeId = data.id;
-      this.reload();
-    },
-    /* 显示编辑 */
-    openEdit(row = {}, type) {
-      this.addOrEditDialogFlag = true;
-      this.$nextTick(() => {
-        this.$refs.addOrEditDialogRef.init(row, type);
-      });
-    },
-    openDetail(row = {}) {
-      this.detailDialogFlag = true;
-      this.$nextTick(() => {
-        this.$refs.detailDialogRef.init(row);
-      });
-    },
-    handleAddPlan(row) {
-      console.log(row);
-      this.addPlanDialogFLag = true;
-      this.$nextTick(() => {
-        row.projectId = row.id;
-        this.$refs.addPlanDialogRef.init(row, 'add');
-      });
-    },
-    async handleStatus(API, msg, row) {
-      let message = '确定' + msg + '该项目吗';
-      this.$confirm(message, '提示', {
-        type: 'warning'
-      })
-        .then(async () => {
-          await API(row.id);
-          this.$message.success('操作成功');
-          this.reload();
-        })
-        .catch(() => {});
-    },
-    //流程提交
-    processSubmit(row) {
-      this.processSubmitDialogFlag = true;
-      this.$nextTick(() => {
-        let params = {
-          businessId: row.id,
-          businessKey: 'pro_project_approve',
-          formCreateUserId: row.createUserId
-        };
-        this.$refs.processSubmitDialogRef.init(params);
-      });
-      // submit({
-      //   projectId: row.id
-      // }).then((res) => {
-      //   this.$message.success('提交成功');
-      //   this.reload();
-      // });
+    data() {
+      return {
+        projectsFinishAPI: projectsFinishAPI,
+        projectsPauseAPI: projectsPauseAPI,
+        projectsStartupAPI: projectsStartupAPI,
+        projectsTerminationAPI: projectsTerminationAPI,
+        parentId: '',
+        selection: [],
+        dictList: [],
+        // 表格列配置
+
+        // 是否显示编辑弹窗
+        addOrEditDialogFlag: false,
+        detailDialogFlag: false,
+        processSubmitDialogFlag: false,
+        delVisible: false,
+        addPlanDialogFLag: false,
+        // 全部菜单数据
+        menuList: [],
+        // 展开折叠
+        expandAllFlag: false,
+        ruleCode: '',
+        rootId:'',
+        isRootId: true
+      };
     },
-    //批量删除
-    allDelBtn() {
-      if (this.selection.length === 0) return;
-      let flag = this.selection.some((item) =>
-        [1, 2].includes(item.processStatus)
-      );
-      if (flag)
-        return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查');
-      this.delVisible = true;
+    async created() {
+      console.log(111);
     },
-    //删除弹框确定
-    commitBtn() {
-      const dataId = this.selection.map((v) => v.id);
-      this.remove(dataId);
+    watch: {
+      $route() {
+        this.reload && this.reload();
+      }
     },
-    /* 删除 */
-    remove(ids) {
-      const loading = this.$loading({ lock: true });
-      projectsDeleteAPI(ids)
-        .then((res) => {
-          loading.close();
-          this.$message.success('删除成功');
-          this.reload();
+    methods: {
+      getDictV(code, val) {
+        if (!this.dictList[code]) return '';
+        return this.dictList[code].find((item) => item.value == val)?.label;
+      },
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList[code] = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: values[0],
+            label: item[values[0]]
+          };
+        });
+      },
+      handelBOMConstructDetail(row, type = '') {
+        // this.$router.push({
+        //   path: '/BOMmanage/details',
+        //   query: {
+        //     id: row.id,
+        //     type
+        //   }
+        // });
+        localStorage.setItem('projectId', row.id);
+        this.$refs.ProjectDetailDialogFlag.open(row, type);
+      },
+      customColorMethod(percentage) {
+        if (percentage < 30) {
+          return '#909399';
+        } else if (percentage < 70) {
+          return '#e6a23c';
+        } else {
+          return '#67c23a';
+        }
+      },
+      /* 表格数据源 */
+      async datasource({ page, limit, where, parent }) {
+        await this.getDictList('pro_projects_status');
+        await this.getDictList('pro_projects_type');
+        await this.getDictList('pro_projects_budget_unit');
+        // /project-manage/myProject
+        const api =
+          this.$route.path == '/project-manage/myProject'
+            ? getMyProjectsPage
+            : projectsPageAPI;
+        return api({
+          pageNum: page,
+          size: limit,
+          parentId: parent?.id ?? '0',
+          // parentId:this.parentId,
+          ...where,
+          type: this.treeId
+        });
+      },
+      onDone(row) {
+        console.log(row);
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ where, size: 1, pageNum: 10, parentId: '0' });
+        this.$refs.table.reRenderTable();
+      },
+      handleNodeClick(data, node) {
+        console.log(data);
+        this.parentId = data.parentId;
+        this.treeId = data.parentId === '0' ? '' : data.id;
+
+        if (!this.ruleCode) {
+          this.ruleCode = data.parentId === '0' ? data.ruleCode : '';
+        }
+        // console.log(this.ruleCode);
+        this.reload();
+      },
+      /* 显示编辑 */
+      openEdit(row = {}, type) {
+        this.addOrEditDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.addOrEditDialogRef.init(row, type);
+        });
+      },
+      openDetail(row = {}) {
+        this.detailDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.detailDialogRef.init(row);
+        });
+      },
+      handleAddPlan(row) {
+        console.log(row);
+        this.addPlanDialogFLag = true;
+        this.$nextTick(() => {
+          row.projectId = row.id;
+          this.$refs.addPlanDialogRef.init(row, 'add');
+        });
+      },
+      async handleStatus(API, msg, row) {
+        let message = '确定' + msg + '该项目吗';
+        this.$confirm(message, '提示', {
+          type: 'warning'
         })
-        .catch((e) => {
-          loading.close();
-          // this.$message.error(e.message);
+          .then(async () => {
+            await API(row.id);
+            this.$message.success('操作成功');
+            this.reload();
+          })
+          .catch(() => {});
+      },
+      //流程提交
+      processSubmit(row) {
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: row.id,
+            businessKey: 'pro_project_approve',
+            formCreateUserId: row.createUserId
+          };
+          this.$refs.processSubmitDialogRef.init(params);
         });
-    },
-    /* 展开/折叠全部 */
-    expandAll() {
-      this.expandAllFlag = !this.expandAllFlag;
-      this.$refs.table.toggleRowExpansionAll(this.expandAllFlag);
+        // submit({
+        //   projectId: row.id
+        // }).then((res) => {
+        //   this.$message.success('提交成功');
+        //   this.reload();
+        // });
+      },
+      //批量删除
+      allDelBtn() {
+        if (this.selection.length === 0) return;
+        let flag = this.selection.some((item) =>
+          [1, 2].includes(item.processStatus)
+        );
+        if (flag)
+          return this.$message.warning(
+            '抱歉已审核、审核中的数据不能删除,请检查'
+          );
+        this.delVisible = true;
+      },
+      //删除弹框确定
+      commitBtn() {
+        const dataId = this.selection.map((v) => v.id);
+        this.remove(dataId);
+      },
+      /* 删除 */
+      remove(ids) {
+        const loading = this.$loading({ lock: true });
+        projectsDeleteAPI(ids)
+          .then((res) => {
+            loading.close();
+            this.$message.success('删除成功');
+            this.reload();
+          })
+          .catch((e) => {
+            loading.close();
+            // this.$message.error(e.message);
+          });
+      },
+      /* 展开/折叠全部 */
+      expandAll() {
+        this.expandAllFlag = !this.expandAllFlag;
+        this.$refs.table.toggleRowExpansionAll(this.expandAllFlag);
+      }
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped>
-:deep(.el-link--inner) {
-  margin-left: 0px !important;
-}
-::v-deep .el-dropdown-link {
-  cursor: pointer;
-  color: #188ffd;
-}
-::v-deep .el-dropdown-menu__item {
-  .el-link {
-    width: 100%;
-    display: flex;
-    flex: 1;
-    justify-content: flex-start;
+  :deep(.el-link--inner) {
+    margin-left: 0px !important;
+  }
+  ::v-deep .el-dropdown-link {
+    cursor: pointer;
+    color: #188ffd;
+  }
+  ::v-deep .el-dropdown-menu__item {
+    .el-link {
+      width: 100%;
+      display: flex;
+      flex: 1;
+      justify-content: flex-start;
+    }
+  }
+  .sys-organization-list {
+    height: calc(100vh - 230px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
   }
-}
-.sys-organization-list {
-  height: calc(100vh - 230px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
 
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 40px;
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 40px;
 
-  & > .el-tree-node__expand-icon {
-    margin-left: 10px;
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
   }
-}
 </style>