695593266@qq.com 4 päivää sitten
vanhempi
commit
4ac3ce4710

+ 8 - 3
src/components/processSubmitDialog/processSubmitDialog.vue

@@ -220,6 +220,10 @@
       apiFunName: {
         type: String,
         default: ''
+      },
+      customSubmit: {
+        type: Function,
+        default: null
       }
     },
     data() {
@@ -455,12 +459,14 @@
           text: '提交中',
           background: 'rgba(0, 0, 0, 0.7)'
         });
-        await processInstanceCreateAPI(this.form)
+        const submitPromise = this.customSubmit
+          ? this.customSubmit(this.form.businessId, this.form)
+          : processInstanceCreateAPI(this.form);
+        await submitPromise
           .then((res) => {
             console.log(res, 'res');
             this.loading.close();
             this.$message('提交成功');
-            this.$emit('reload');
             this.cancel();
           })
           .catch((err) => {
@@ -484,7 +490,6 @@
             console.log(res, 'res');
             this.loading.close();
             this.$message('提交成功');
-            this.$emit('reload');
             this.cancel();
           })
           .catch((err) => {

+ 14 - 6
src/views/bpm/processInstance/businessDetail.vue

@@ -141,6 +141,7 @@
         getProcessInstance(this.id).then((response) => {
           if (!response) {
             this.$message.error('查询不到流程信息!');
+            this.processInstanceLoading = false;
             return;
           }
           // 设置流程信息
@@ -152,15 +153,22 @@
           //   require([`@/views${path}`], resolve);
           // });
 
+          const processDefinitionId =
+            this.processInstance.processDefinition?.id ||
+            this.processInstance.processDefinitionId;
+          const processInstanceId = this.processInstance.id || this.id;
+
           // 加载流程图
-          getProcessDefinitionBpmnXML(
-            this.processInstance.processDefinition.id
-          ).then((response) => {
-            this.bpmnXML = response;
-          });
+          if (processDefinitionId) {
+            getProcessDefinitionBpmnXML(processDefinitionId).then((response) => {
+              this.bpmnXML = response;
+            });
+          } else {
+            this.bpmnXML = null;
+          }
           // 加载活动列表
           getActivityList({
-            processInstanceId: this.processInstance.id
+            processInstanceId
           }).then((response) => {
             console.log(response, 'response');
             this.activityList = response;

+ 177 - 18
src/views/material/product/components/index-data.vue

@@ -159,6 +159,7 @@
             inactive-color="#ff4949"
             :active-value="1"
             :inactive-value="0"
+            :disabled="isApproving(row)"
             @change="changeEnable(row)"
           >
           </el-switch>
@@ -184,7 +185,25 @@
         </div>
       </template>
 
+      <template v-slot:approveStatus="{ row }">
+        <el-tag
+          v-if="hasApproveStatus(row)"
+          size="mini"
+          :type="getApproveStatusTagType(row)"
+        >
+          {{ getApproveStatusText(row) }}
+        </el-tag>
+      </template>
+
       <template v-slot:action="{ row }">
+        <!-- <el-link
+          type="primary"
+          :underline="false"
+          @click="openEdit(row, 3)"
+          v-if="isApproving(row)"
+        >
+          详情
+        </el-link> -->
         <!-- <el-link
           type="primary"
           :underline="false"
@@ -197,7 +216,7 @@
           type="primary"
           :underline="false"
           @click="openEdit(row, 1)"
-          v-if="$hasPermission('main:category:save')"
+          v-if="!isApproving(row) && $hasPermission('main:category:save')"
         >
           复制
         </el-link>
@@ -208,7 +227,7 @@
           type="primary"
           :underline="false"
           @click="openEdit(row, 0)"
-          v-if="$hasPermission('main:category:update')"
+          v-if="!isApproving(row) && $hasPermission('main:category:update')"
         >
           修改
         </el-link>
@@ -216,7 +235,11 @@
           class="ele-action"
           title="确定要删除此物料吗?"
           @confirm="remove(row)"
-          v-if="$hasPermission('main:category:delete')"
+          v-if="
+            !isApproving(row) &&
+            !isApprovePassed(row) &&
+            $hasPermission('main:category:delete')
+          "
         >
           <template v-slot:reference>
             <el-link type="danger" :underline="false"> 删除 </el-link>
@@ -232,20 +255,28 @@
           工艺参数
         </el-link> -->
 
-        <el-link type="primary" :underline="false" @click="toBomManager(row)">
+        <el-link
+          v-if="!isApproving(row)"
+          type="primary"
+          :underline="false"
+          @click="toBomManager(row)"
+        >
           BOM
         </el-link>
 
-        <el-popconfirm
-          class="ele-action"
-          title="确定要发布此物品吗?"
-          @confirm="publish(row)"
-          v-if="row.isPublished != 1 && $hasPermission('main:category:update')"
+        <el-link
+          type="primary"
+          :underline="false"
+          @click="publish(row)"
+          v-if="
+            !isApproving(row) &&
+            !isApprovePassed(row) &&
+            row.isPublished != 1 &&
+            $hasPermission('main:category:update')
+          "
         >
-          <template v-slot:reference>
-            <el-link type="primary" :underline="false"> 发布 </el-link>
-          </template>
-        </el-popconfirm>
+          发布
+        </el-link>
 
         <!-- <el-link
           type="primary"
@@ -267,7 +298,7 @@
 
         <el-link
           type="primary"
-          v-if="row.categoryLevelPathIdParent == 7"
+          v-if="!isApproving(row) && row.categoryLevelPathIdParent == 7"
           :underline="false"
           @click="handAllocation(row)"
         >
@@ -276,7 +307,7 @@
 
         <el-link
           type="primary"
-          v-if="row.categoryLevelPathIdParent == 11"
+          v-if="!isApproving(row) && row.categoryLevelPathIdParent == 11"
           :underline="false"
           @click="handleAridRegion(row)"
         >
@@ -351,6 +382,13 @@
       ref="warehouseDialogRef"
       @success="success"
     ></warehouseDialog>
+    <process-submit-dialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      :custom-submit="submitCategoryPublish"
+      @reload="handleProcessReload"
+    ></process-submit-dialog>
   </div>
 </template>
 
@@ -381,6 +419,7 @@
   import { fieldModel } from '@/api/codeManagement';
   import DialogMoveTo from './DialogMoveTo.vue';
   import warehouseDialog from './warehouseDialog.vue';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { produceTypeList } from '@/enum/dict.js';
   import request from '@/utils/request';
@@ -440,7 +479,8 @@
       aridRegion,
       BomDetailsPop,
       DialogMoveTo,
-      warehouseDialog
+      warehouseDialog,
+      processSubmitDialog
     },
     props: {
       // 物料组id
@@ -477,7 +517,8 @@
             width: 45,
             type: 'selection',
             columnKey: 'selection',
-            align: 'center'
+            align: 'center',
+            selectable: (row) => !this.isApproving(row)
           },
           {
             columnKey: 'index',
@@ -740,6 +781,14 @@
             },
             showOverflowTooltip: true
           },
+          {
+            prop: 'approveStatus',
+            label: '审核状态',
+            align: 'center',
+            minWidth: 100,
+            slot: 'approveStatus',
+            showOverflowTooltip: true
+          },
           {
             prop: 'isEnabled',
             align: 'center',
@@ -790,7 +839,8 @@
         rowCurrent: null,
         isLoading: false,
         pageSize: this.$store.state.tablePageSize,
-        isBatchPublish: true
+        isBatchPublish: true,
+        processSubmitDialogFlag: false
       };
     },
 
@@ -879,10 +929,16 @@
       },
       //采购
       moveTo() {
+        if (this.hasApprovingSelection()) {
+          return;
+        }
         this.$refs.DialogMoveToRef.open(this.selection);
       },
       //仓库
       warehouseOpen() {
+        if (this.hasApprovingSelection()) {
+          return;
+        }
         this.$refs.warehouseDialogRef.open(this.selection);
       },
       successUpload(response) {
@@ -1014,6 +1070,10 @@
       },
 
       publish(row) {
+        if (this.isBatchPublish) {
+          this.submitApprove(row);
+          return;
+        }
         const loading = this.$loading({ lock: true });
         publishCategory({ categoryId: row.id })
           .then((res) => {
@@ -1025,6 +1085,43 @@
           });
       },
 
+      submitApprove(row) {
+        if (!row || !row.id) {
+          return;
+        }
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          const userInfo = this.$store.state.user.info || {};
+          const params = {
+            businessId: row.id,
+            businessKey: 'category_need_approve',
+            formCreateUserId: row.createUserId || userInfo.userId || userInfo.id,
+            variables: {
+              businessCode: row.code,
+              businessName: row.name,
+              businessType: this.getCategoryBusinessType(row)
+            }
+          };
+
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
+
+      getCategoryBusinessType(row) {
+        return row.categoryLevelPath || row.categoryName || '物品发布';
+      },
+
+      submitCategoryPublish(businessId, form) {
+        return publishCategory({
+          categoryId: businessId,
+          ...form
+        });
+      },
+
+      handleProcessReload() {
+        this.reloadNew();
+      },
+
       /* 显示编辑 */
       batchPublish() {
         if (!this.selection.length) {
@@ -1032,6 +1129,10 @@
           return;
         }
 
+        if (this.hasApprovingSelection()) {
+          return;
+        }
+
         const publishedList = this.selection.filter((item) => item.isPublished == 1);
         if (publishedList.length) {
           const publishedNames = publishedList
@@ -1159,6 +1260,64 @@
         this.reload();
       },
 
+      hasApproveStatus(row) {
+        return (
+          row &&
+          Object.prototype.hasOwnProperty.call(row, 'approveStatus') &&
+          row.approveStatus !== null &&
+          row.approveStatus !== undefined &&
+          row.approveStatus !== ''
+        );
+      },
+
+      isApproving(row) {
+        if (!this.hasApproveStatus(row)) {
+          return false;
+        }
+        return Number(row.approveStatus) === 1 || row.approveStatus === '审核中';
+      },
+
+      isApprovePassed(row) {
+        if (!this.hasApproveStatus(row)) {
+          return false;
+        }
+        return Number(row.approveStatus) === 2 || row.approveStatus === '已审核';
+      },
+
+      hasApprovingSelection() {
+        if (this.selection.some((item) => this.isApproving(item))) {
+          this.$message.warning('审核中的数据只能查看详情');
+          return true;
+        }
+        return false;
+      },
+
+      getApproveStatusTagType(row) {
+        if (!this.hasApproveStatus(row)) {
+          return '';
+        }
+        return (
+          {
+            0: 'info',
+            1: 'warning',
+            2: 'success',
+            3: 'danger'
+          }[Number(row.approveStatus)] || ''
+        );
+      },
+
+      getApproveStatusText(row) {
+        if (!this.hasApproveStatus(row)) {
+          return '';
+        }
+        return {
+          0: '未提交',
+          1: '审核中',
+          2: '已审核',
+          3: '审核不通过'
+        }[Number(row.approveStatus)] || row.approveStatus;
+      },
+
       handAllocation(row) {
         this.$refs.allocationRef.open(row);
       },

+ 93 - 28
src/views/material/product/detail.vue

@@ -1,12 +1,14 @@
 <template>
   <div class="ele-body">
-    <el-card shadow="never">
-      <el-form
-        label-width="100px"
-        ref="manageForm"
-        :model="form"
-        :rules="rules"
-      >
+    <el-tabs v-model="activeTab" type="card" class="product-detail-tabs">
+      <el-tab-pane label="详情" name="detail">
+        <el-card shadow="never">
+          <el-form
+            label-width="100px"
+            ref="manageForm"
+            :model="form"
+            :rules="rules"
+          >
         <headerTitle title="基本信息">
           <el-button @click="cancel">返回</el-button>
           <el-button
@@ -553,23 +555,23 @@
             </el-form-item>
           </el-col>
         </el-row>
-      </el-form>
-    </el-card>
-    <el-card shadow="never">
-      <headerTitle title="标签"></headerTitle>
-      <!-- {{ form.extTagField }} -->
-      <el-form label-width="100px">
-        <el-form-item label="是否消耗品">
-          <el-radio-group
-            v-model="form.extTagField.isConsumables"
-            :disabled="isReadOnly"
-          >
-            <el-radio :label="1">是</el-radio>
-            <el-radio :label="0">否</el-radio>
-          </el-radio-group>
-        </el-form-item>
-      </el-form>
-    </el-card>
+          </el-form>
+        </el-card>
+        <el-card shadow="never">
+          <headerTitle title="标签"></headerTitle>
+          <!-- {{ form.extTagField }} -->
+          <el-form label-width="100px">
+            <el-form-item label="是否消耗品">
+              <el-radio-group
+                v-model="form.extTagField.isConsumables"
+                :disabled="isReadOnly"
+              >
+                <el-radio :label="1">是</el-radio>
+                <el-radio :label="0">否</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-form>
+        </el-card>
 
     <!--  自定义编码 -->
     <!-- <CodeDialog
@@ -633,9 +635,14 @@
       :code="form.code"
       :disabled="isReadOnly"
     />
-    <!-- 申请编码 -->
-
-    <GetCodeDialog ref="GetCodeDialogRef" @setCode="setCode"></GetCodeDialog>
+        <!-- 申请编码 -->
+
+        <GetCodeDialog ref="GetCodeDialogRef" @setCode="setCode"></GetCodeDialog>
+      </el-tab-pane>
+      <el-tab-pane v-if="hasProcessInstanceId" label="流程详情" name="bpm">
+        <bpmDetail :id="form.processInstanceId"></bpmDetail>
+      </el-tab-pane>
+    </el-tabs>
   </div>
 </template>
 
@@ -676,6 +683,7 @@
   import GetCodeDialog from '@/components/addDoc/getCode.vue';
   import { getCode, listCode } from '@/components/addDoc/api/index.js';
   import ImgUpload from '@/components/upload/imgUploadNew.vue';
+  import bpmDetail from '@/views/bpm/processInstance/businessDetail.vue';
   const defCategoryQms = [
     {
       categoryId: '',
@@ -752,10 +760,12 @@
       CategoryDialog,
       // CodeDialog,
       GetCodeDialog,
-      ImgUpload
+      ImgUpload,
+      bpmDetail
     },
     data() {
       return {
+        activeTab: 'detail',
         isReadOnly: false,
         isShow: true,
         industryAttribute: '',
@@ -900,6 +910,11 @@
       };
     },
     watch: {
+      hasProcessInstanceId(value) {
+        if (!value && this.activeTab === 'bpm') {
+          this.activeTab = 'detail';
+        }
+      },
       '$route.query.id': {
         handler(id) {
           console.log(id, 'id');
@@ -998,6 +1013,13 @@
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
       },
+      hasProcessInstanceId() {
+        return (
+          this.form.processInstanceId !== null &&
+          this.form.processInstanceId !== undefined &&
+          this.form.processInstanceId !== ''
+        );
+      },
       rules() {
         return {
           measureType: [
@@ -1935,6 +1957,49 @@
     border: none;
   }
 
+  .product-detail-tabs {
+    ::v-deep .el-tabs__header {
+      margin: 0 0 12px;
+      border-bottom: 1px solid #d8e6f5;
+    }
+
+    ::v-deep .el-tabs__nav {
+      border: none;
+    }
+
+    ::v-deep .el-tabs__item {
+      height: 40px;
+      padding: 0 22px;
+      border: 1px solid #d8e6f5;
+      border-radius: 4px 4px 0 0;
+      background: #f5f7fa;
+      color: #606266;
+      font-weight: 600;
+      line-height: 40px;
+      transition: all 0.18s ease;
+    }
+
+    ::v-deep .el-tabs__item + .el-tabs__item {
+      margin-left: 6px;
+    }
+
+    ::v-deep .el-tabs__item:hover {
+      color: #1684df;
+      background: #eef7ff;
+    }
+
+    ::v-deep .el-tabs__item.is-active {
+      border-color: #1684df;
+      background: #1684df;
+      color: #fff;
+      box-shadow: 0 4px 10px rgba(22, 132, 223, 0.22);
+    }
+
+    ::v-deep .el-tabs__content {
+      overflow: visible;
+    }
+  }
+
   .body-top {
     display: flex;
     align-items: center;

+ 137 - 129
src/views/workforceManagement/team/components/staffSelection.vue

@@ -60,16 +60,22 @@
                     </template>
                   </el-table-column>
                   <el-table-column width="180" label="操作" align="right">
-                    <template slot="header" slot-scope="scope">
+                    <template slot="header">
                       <div style="display: flex">
-
-                        <el-input v-model="userName" placeholder="输入姓名查询" clearable
-                                  @change="changeUserName"></el-input>
+                        <el-input
+                          v-model="userName"
+                          placeholder="输入姓名查询"
+                          clearable
+                          autocomplete="new-password"
+                          @change="changeUserName"
+                        ></el-input>
                         <div
                           v-if="staffList.length !== 0 && isMore"
                           class="zw-page-list-more"
                         >
-                          <el-button type="text" @click="getMore()">更多<i class="el-icon-caret-bottom"></i></el-button>
+                          <el-button type="text" @click="getMore()"
+                            >更多<i class="el-icon-caret-bottom"></i
+                          ></el-button>
                         </div>
                       </div>
                     </template>
@@ -85,32 +91,28 @@
                       </el-button>
                     </template>
                   </el-table-column>
-                 <el-table-column width="80" label="操作">
-
-
-
-
-<!--                 <template slot-scope="{ row }">-->
-<!--                    <el-button-->
-<!--                       size="mini"-->
-<!--                        type="primary"-->
-<!--                        @click="choiceAsset(row)"-->
-<!--                        :disabled="row.disabled"-->
-<!--                       icon="el-icon-arrow-right"-->
-<!--                        circle-->
-<!--                     >-->
-<!--                     </el-button>-->
-<!--                 </template>-->
+                  <el-table-column width="80" label="操作">
+                    <!--                 <template slot-scope="{ row }">-->
+                    <!--                    <el-button-->
+                    <!--                       size="mini"-->
+                    <!--                        type="primary"-->
+                    <!--                        @click="choiceAsset(row)"-->
+                    <!--                        :disabled="row.disabled"-->
+                    <!--                       icon="el-icon-arrow-right"-->
+                    <!--                        circle-->
+                    <!--                     >-->
+                    <!--                     </el-button>-->
+                    <!--                 </template>-->
                   </el-table-column>
                 </el-table>
-<!--                <div-->
-<!--                  v-if="staffList.length !== 0 && isMore"-->
-<!--                  class="zw-page-list-more"-->
-<!--                >-->
-<!--                  <el-link @click="getMore()" type="primary"-->
-<!--                    >更多<i class="el-icon-caret-bottom"></i>-->
-<!--                  </el-link>-->
-<!--                </div>-->
+                <!--                <div-->
+                <!--                  v-if="staffList.length !== 0 && isMore"-->
+                <!--                  class="zw-page-list-more"-->
+                <!--                >-->
+                <!--                  <el-link @click="getMore()" type="primary"-->
+                <!--                    >更多<i class="el-icon-caret-bottom"></i>-->
+                <!--                  </el-link>-->
+                <!--                </div>-->
               </el-container>
             </div>
           </el-card>
@@ -191,20 +193,25 @@
     },
     props: {
       type: {},
-      hasAccount:{
-        default:0
+      hasAccount: {
+        default: 0
       },
-      factoryId:String,
-   
+      factoryId: String
     },
     created() {},
     methods: {
       open(selectedList) {
+        this.resetSearchState();
         this.dialogVisible = true;
-        this.pageNum = 1;
         this.selectStafflist = selectedList;
         this.getInfo();
       },
+      resetSearchState() {
+        this.userName = '';
+        this.staffList = [];
+        this.pageNum = 1;
+        this.isMore = false;
+      },
       //初始数据
       async getInfo() {
         let list = await listOrganizations();
@@ -213,27 +220,26 @@
           idField: 'id',
           parentIdField: 'parentId'
         });
-        this.$nextTick(()=>{
-          this.handleNodeClick(this.treeList[0])
-          this.$refs.tree.setCurrentKey(this.treeList[0].id)
-
-        })
+        this.$nextTick(() => {
+          this.handleNodeClick(this.treeList[0]);
+          this.$refs.tree.setCurrentKey(this.treeList[0].id);
+        });
         //this.treeList = res.data;
       },
-     //选择分类
-    handleNodeClick(data) {
-      this.currentData = data
-      this.staffList = [];
-      this.pageNum = 1;
-      this.form.groupId = data.id;
-      let params = {
-        pageNum: 1,
-        size: this.size,
-        groupId: this.form.groupId,
-        // hasAccount:this.hasAccount
-      };
-      this.getStaffList(params);
-    },
+      //选择分类
+      handleNodeClick(data) {
+        this.currentData = data;
+        this.staffList = [];
+        this.pageNum = 1;
+        this.form.groupId = data.id;
+        let params = {
+          pageNum: 1,
+          size: this.size,
+          groupId: this.form.groupId
+          // hasAccount:this.hasAccount
+        };
+        this.getStaffList(params);
+      },
       changeUserName() {
         this.staffList = [];
         this.pageNum = 1;
@@ -244,91 +250,93 @@
           groupId: this.form.groupId,
           name: this.userName
         };
-   
+
         this.getStaffList(params);
       },
-    //获取员工列表
-    async getStaffList(params) {
-      console.log(this.factoryId,'factoryId')
-      if(this.factoryId){
-          params['factoryId']=this.factoryId
+      //获取员工列表
+      async getStaffList(params) {
+        console.log(this.factoryId, 'factoryId');
+        if (this.factoryId) {
+          params['factoryId'] = this.factoryId;
         }
-      let res = await getUserPage(params);
-      let list = res.list;
-      
-      list.forEach((el) => {
-        let _index = this.selectStafflist.findIndex((n) => n.id == el.id);
-        if (_index !== -1) {
-          el.disabled = true;
+        let res = await getUserPage(params);
+        let list = res.list;
+
+        list.forEach((el) => {
+          let _index = this.selectStafflist.findIndex((n) => n.id == el.id);
+          if (_index !== -1) {
+            el.disabled = true;
+          } else {
+            el.disabled = false;
+          }
+        });
+        this.staffList = [...this.staffList, ...list];
+
+        if (this.staffList.length < res.count) {
+          this.isMore = true;
         } else {
-          el.disabled = false;
+          this.isMore = false;
         }
-      });
-      this.staffList = [...this.staffList, ...list];
-      
-      if (this.staffList.length < res.count) {
-        this.isMore = true;
-      } else {
-        this.isMore = false;
-      }
-      // this.pageNum = res.pageNum;
-    },
-    //查询更多员工
-    async getMore() {
-      this.pageNum = this.pageNum + 1;
-      let params = {
-        pageNum:this.pageNum,
-        size: this.size,
-        groupId: this.form.groupId,
-        name: this.userName
-      };
-      this.getStaffList(params);
-    },
-    //选择员工
-    choiceAsset(info) {
-      let data = JSON.parse(JSON.stringify(info));
-      if (info.teamId &&this.type!='bpm') {
-        this.$confirm('当前员工已有所属班组, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-          .then(() => {
-            this.selectStafflist.push(data);
-            info.disabled = true;
+        // this.pageNum = res.pageNum;
+      },
+      //查询更多员工
+      async getMore() {
+        this.pageNum = this.pageNum + 1;
+        let params = {
+          pageNum: this.pageNum,
+          size: this.size,
+          groupId: this.form.groupId,
+          name: this.userName
+        };
+        this.getStaffList(params);
+      },
+      //选择员工
+      choiceAsset(info) {
+        let data = JSON.parse(JSON.stringify(info));
+        if (info.teamId && this.type != 'bpm') {
+          this.$confirm('当前员工已有所属班组, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
           })
-          .catch(() => {});
-      } else {
-        this.selectStafflist.push(data);
-        info.disabled = true;
-      }
-    },
-    //删除已选员工
-    deleteSelectStaff(info, index) {
-      this.staffList.forEach((el) => {
-        if (el.id == info.id) {
-          el.disabled = false;
+            .then(() => {
+              this.selectStafflist.push(data);
+              info.disabled = true;
+            })
+            .catch(() => {});
+        } else {
+          this.selectStafflist.push(data);
+          info.disabled = true;
         }
-      });
-      this.selectStafflist.splice(index, 1);
-    },
-    //保存
-    sumbit() {
-      if (this.selectStafflist.length === 0) {
-        this.$message.warning('请选择员工');
-      } else {
-        this.$emit('confirm', JSON.parse(JSON.stringify(this.selectStafflist)));
-        this.handleClose();
+      },
+      //删除已选员工
+      deleteSelectStaff(info, index) {
+        this.staffList.forEach((el) => {
+          if (el.id == info.id) {
+            el.disabled = false;
+          }
+        });
+        this.selectStafflist.splice(index, 1);
+      },
+      //保存
+      sumbit() {
+        if (this.selectStafflist.length === 0) {
+          this.$message.warning('请选择员工');
+        } else {
+          this.$emit(
+            'confirm',
+            JSON.parse(JSON.stringify(this.selectStafflist))
+          );
+          this.handleClose();
+        }
+      },
+      handleClose() {
+        this.resetSearchState();
+        this.selectStafflist = [];
+        this.dialogVisible = false;
       }
-    },
-    handleClose() {
-      this.staffList = [];
-      this.selectStafflist = [];
-      this.userName = '';
-      this.dialogVisible = false;
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>