石广澎
2023-11-27 75aaca3a95314be8c384df18dba23c661dea742c
admin-web/src/views/stock/inventorycount/inventorytask/edit.vue
@@ -1,6 +1,6 @@
<template>
  <win-sm :title="`${setting.title}盘点`" @close="close" :width="'800px'">
    <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
    <el-form v-loading="loading" ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
      <el-form-item label="盘点单名" prop="businessFormName">
        <el-input
          v-model="formData.businessFormName"
@@ -62,13 +62,20 @@
  },
  data() {
    return {
      loading:true,
      count: 0,
      loading: true,
      checkAll: false,
      checkedList: [],
      warehouseOptions: [], // 仓库列表
      operatorOptions: [],
      operatorOptions2: [],
      formData: {},
      formData: {
        businessFormName: '',
        warehouseId: '',
        operatorUserId: '',
        monitorUserId: '',
        remark: '',
      },
      rules: {
        businessFormName: [{ required: true, message: '请输入', trigger: 'blur' }],
        warehouseId: [{ required: true, message: '请选择', trigger: 'blur' }],
@@ -97,19 +104,31 @@
    // 获取仓库列表
    handleSelectTenantWarehouse() {
      selectTenantWarehouse({ agencyId: this.userInfo.tenantId }).then((res) => {
        this.count++
        this.warehouseOptions = res;
        if(this.count>1){
          this.loading = false
        }
      });
    },
    // 获取盘点人
    getPdr() {
      warehouseManagerList({ tenantId: this.userInfo.tenantId }).then((res) => {
        this.count++
        this.operatorOptions = res;
        if(this.count>1){
          this.loading = false
        }
      });
    },
    // 获取监盘人
    getJpr() {
      tenantUserQueryUser({ tenantId: this.userInfo.tenantId }).then((res) => {
        this.count++
        this.operatorOptions2 = res;
        if(this.count>1){
          this.loading = false
        }
      });
    },
    getEditInfo(id) {},
@@ -120,18 +139,25 @@
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.formData);
          this.loading = true
          if (this.setting.id) {
            // 编辑接口
            inventoryEdit(params).then((res) => {
              this.loading = false
              this.$message.success('保存成功!');
              this.close();
              this.$emit('search');
            }).catch(()=>{
              this.loading = false
            });
          } else {
            inventoryAdd(params).then((res) => {
              this.loading = false
              this.$message.success('保存成功!');
              this.close();
              this.$emit('search');
            }).catch(()=>{
              this.loading = false
            });
          }
        } else {