gjy 4 anos atrás
pai
commit
0c9cb6d967
1 arquivos alterados com 49 adições e 10 exclusões
  1. 49 10
      src/views/warehouse/warehouseManagementEdit.vue

+ 49 - 10
src/views/warehouse/warehouseManagementEdit.vue

@@ -46,12 +46,20 @@
           </ws-form-item>
           <!--负责人-->
           <ws-form-item label="负责人" span="1" prop="personCharge">
-            <ws-input
+            <el-select
               v-model="deptBudgetList.personCharge"
-              placeholder="请输入负责人"
-              maxlength="100"
-              size="small"
-            />
+              placeholder="请选择负责人"
+              filterable
+              :filter-method="dataFilter"
+              @change="selectstaff"
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :label="item.staffName"
+                :value="item.staffName"
+              />
+            </el-select>
           </ws-form-item>
           <!--负责人电话-->
           <ws-form-item
@@ -263,6 +271,7 @@ export default {
         year: dayjs().format('YYYY'),
         month: dayjs().format('MM'),
       },
+      staffList: [],
       contractList: [],
       deptBudgetList: {},
       historyList: [],
@@ -272,11 +281,20 @@ export default {
           return time.getTime() > Date.now()
         },
       },
+
+      options: [],
+      value: '',
       accessoryTFs: false,
     }
   },
   activated() {
     this.loaddata()
+    getstaff({ compId: sessionStorage.getItem('ws-pf_compId') })
+      .toPromise()
+      .then((response) => {
+        this.options = response
+        this.staffList = response
+      })
     this.showType = this.isShow
   },
   computed: {
@@ -297,6 +315,32 @@ export default {
     },
   },
   methods: {
+    dataFilter(val) {
+      console.log(val)
+      this.deptBudgetList.personCharge = val
+      if (val) {
+        //val存在
+        this.options = this.staffList.filter((item) => {
+          if (
+            !!~item.staffName.indexOf(val) ||
+            !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
+          ) {
+            return true
+          }
+        })
+        console.log(this.options)
+      } else {
+        //val为空时,还原数组
+        this.options = this.staffList
+      }
+    },
+    selectstaff(e) {
+      for (var i = 0; i < this.staffList.length; i++) {
+        if (this.staffList[i].staffName == e) {
+          this.deptBudgetList.personChargeKey = this.staffList[i].staffId
+        }
+      }
+    },
     //返回按钮
     returnWarehouse() {
       this.deptBudgetList = {}
@@ -397,11 +441,6 @@ export default {
         .then((response) => {
           this.packtypeList = response
         })
-      getstaff({ compId: sessionStorage.getItem('ws-pf_compId') })
-        .toPromise()
-        .then((response) => {
-          console.log(response)
-        })
     },
     getUnitList() {
       xiala({