haoyahui
2023-11-13 6843b10472482b305b5580cc2f5cdbb97fb9a203
admin-web/src/views/stock/inventorycount/inventorytask/index.vue
@@ -41,6 +41,7 @@
import * as finsystenant from '@/api/baseSetting/finsystenant';
import myImport from '@/views/components/myImport';
import { getBaseUrl } from '@/utils/base';
import { selectTenantWarehouse } from '@/api/baseSetting/finsystenant';
export default {
  name: 'index',
@@ -51,16 +52,36 @@
      items: [
        {
          type: 'text',
          dataIndex: 'name',
          dataIndex: 'businessFormCode',
          label: '盘点单号',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'text',
          dataIndex: 'name',
          dataIndex: 'businessFormName',
          label: '任务名称',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'select',
          dataIndex: 'warehouseId',
          label: '盘点仓库',
          placeholder: '请选择',
          defaultValue: '',
          options: [],
        },
        {
          type: 'date-picker',
          dataIndex: 'incomeTimeStart',
          label: '盘点时间',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'incomeTimeEnd',
          label: '至',
          defaultValue: '',
        },
      ],
@@ -130,14 +151,14 @@
        },
        // 列信息
        columns: [
          { title: '盘点单号', field: 'name', align: 'left' },
          { title: '任务名称', field: 'code', align: 'center' },
          { title: '盘点仓库', field: 'lv', align: 'center' },
          { title: '盘点人', field: 'lv', align: 'center' },
          { title: '监盘人', field: 'summary', align: 'left' },
          { title: '盘点时间', field: 'summary', align: 'left' },
          { title: '创建时间', field: 'summary', align: 'left' },
          { title: '状态', field: 'summary', align: 'left' },
          { title: '盘点单号', field: 'businessFormCode', align: 'left' },
          { title: '任务名称', field: 'businessFormName', align: 'center' },
          { title: '盘点仓库', field: 'warehouseName', align: 'center' },
          { title: '盘点人', field: 'operatorName', align: 'center' },
          { title: '监盘人', field: 'operatorName2', align: 'left' },
          { title: '盘点时间', field: 'inventoryDate', align: 'left' },
          { title: '创建时间', field: 'createTime', align: 'left' },
          { title: '状态', field: 'states', align: 'left' },
        ],
        // 操作信息
        operation: {
@@ -152,7 +173,7 @@
            },
            {
              title: '盘点',
              type:'success',
              type: 'success',
              events: (row) => {
                this.showInventory(row);
              },
@@ -173,8 +194,17 @@
    };
  },
  created() {
    // 获取机构树
    this.initTreeData();
    selectTenantWarehouse().then(res=>{
      this.items.forEach(v=>{
        if(v.label=='盘点仓库') {
          v.options = res.map(item=>{
            item.label=item.warehouseName
            item.vlaue=item.id
            return item
          })
        }
      })
    })
  },
  methods: {
    //导入
@@ -190,41 +220,14 @@
        callBack();
      };
    },
    // 左侧树初始化
    initTreeData() {
      finsystenant.getTree().then((res) => {
        const content = res || [];
        this.treeDataList.splice(0, this.treeDataList.length);
        this.treeDataList = content;
        if (content.length > 0) {
          this.importSetting.fileSettings.data = { pid: content[0].id };
        }
      });
    },
    updState(row) {
      let vm = this;
      let text = row.status == 0 ? '启用' : '禁用';
      vm.$modal.confirm('确认要' + text + '"' + row.name + '"吗?').then(function () {
        let params = Object.assign({}, row);
        params.status = row.status == 1 ? 0 : 1;
        finsystenant.edit(params).then((res) => {
          if (res) {
            row.status = row.status === 1 ? 0 : 1;
            vm.$modal.msgSuccess(text + '成功');
            vm.search();
          }
        });
      });
    },
    del(row) {
      this.$modal
        .confirm('是否确认删除名称为"' + row.name + '"的机构吗?')
        .then(function () {
          finsystenant.del({ id: row.id }).then((res) => {});
        })
        .then((res) => {
          this.$message.success('删除成功!');
          this.search();
        .then(() => {
          finsystenant.del({ id: row.id }).then((res) => {
            this.$message.success('删除成功!');
            this.search();
          });
        })
        .catch(() => {});
    },
@@ -240,30 +243,12 @@
      this.editSetting.title = '编辑';
      this.editSetting.show = true;
    },
    // 盘点
    showInventory(row) {
      this.inventorySetting.id = row.id;
      this.inventorySetting.info = JSON.stringify(row);
      this.inventorySetting.title = '盘点';
      this.inventorySetting.show = true;
    },
    nodeClick(param) {
      param = param || {};
      this.p = Object.assign(
        {},
        {
          id: param.id,
          name: param.name,
        },
      );
      if (this.p.id != undefined && this.p.id != null) {
        this.filterFrom.tenantId = this.p.id;
        this.editSetting.orgId = this.p.id;
      } else {
        this.filterFrom.tenantId = null;
        this.editSetting.orgId = null;
      }
      this.importSetting.fileSettings.data = { pid: param.id };
      this.search(1);
    },
    // 查询table列表
    search(pageNum) {