黎星凯
2024-04-15 62b6a7fac3f2acde70b578431147c4a01f19c182
admin-web/src/views/stock/inventorycount/inventorytask/index.vue
@@ -41,10 +41,9 @@
import edit from './edit';
import inventory from './inventory';
import detail from './detail';
import {selectTenantWarehouse} from '@/api/baseSetting/finsystenant';
import myImport from '@/views/components/myImport';
import {getBaseUrl} from '@/utils/base';
import {inventoryDel, inventoryListApi} from '@/api/stock/inventory';
import {inventoryDel, inventoryListApi,isAddInventory} from '@/api/stock/inventory';
import * as DateFormatter from '@/utils/DateFormatter';
import {mapGetters} from 'vuex';
import listPage from '@/views/mixins/listPage';
@@ -72,12 +71,27 @@
          defaultValue: '',
        },
        {
          type: 'cascader',
          dataIndex: 'agencyId',
          label: '机构',
          placeholder: '请选择',
          optionsConfig: {url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null},
          cascader: [{key:'warehouseId',queryKey: 'agencyId'}],
          defaultValue: '',
          options: [],
        },
        {
          type: 'select',
          dataIndex: 'warehouseId',
          label: '盘点仓库',
          label: '仓库',
          placeholder: '请选择',
          defaultValue: '',
          options: [],
          optionsConfig: {
            label: 'warehouseName',
            value: 'id',
            url: SettingIplatform.apiBaseURL + '/pc/base/warehouse/select/tenant_warehouse'
          },
        },
        {
          type: 'date-picker',
@@ -296,17 +310,6 @@
    ...mapGetters(['userInfo']),
  },
  created() {
    selectTenantWarehouse({agencyId: this.userInfo.tenantId}).then((res) => {
      this.items.forEach((v) => {
        if (v.label == '盘点仓库') {
          v.options = res.map((item) => {
            item.label = item.warehouseName;
            item.value = item.id;
            return item;
          });
        }
      });
    });
  },
  methods: {
    //导入
@@ -335,10 +338,22 @@
          });
    },
    showAdd() {
      this.editSetting.id = null;
      this.editSetting.info = null;
      this.editSetting.title = '新增';
      this.editSetting.show = true;
      // 先查询是否能增加新的盘点任务
      // 编辑接口
      isAddInventory().then((res) => {
        if(res == 0){
          this.$message.warning('当前有未完成的盘点任务!');
        }else if(res == -1){
          this.$message.warning('当前仓库无物品!');
        }else{
          this.editSetting.id = null;
          this.editSetting.info = null;
          this.editSetting.title = '新增';
          this.editSetting.show = true;
        }
      }).catch(()=>{
        //this.loading = false
      });
    },
    showAudit(row) {
      this.editSetting.id = row.id;
@@ -362,7 +377,7 @@
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {
        this.$refs.myTable.search(pageNum);
        this.$refs.myTable.search({pageNum});
      } else {
        this.$refs.myTable.search();
      }