houjie
2023-08-31 45137d5dcee4b62d33df8d84abeb79ca3114b15e
库存信息 调整
已修改1个文件
172 ■■■■ 文件已修改
src/views/spare/modules/sparePartInventory/SparePart2List.vue 172 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/spare/modules/sparePartInventory/SparePart2List.vue
@@ -53,16 +53,19 @@
        type="primary"
        @click="searchQuery"
        icon="search"
      >查询</a-button>
      >查询
      </a-button>
      <a-button
        @click="searchReset"
        icon="reload"
      >重置</a-button>
      >重置
      </a-button>
      <a-button
        type="primary"
        icon="download"
        @click="handleExportXls('库存信息')"
      >导出</a-button>
        @click="handleExportXls('备件信息')"
      >导出
      </a-button>
      <a-upload
        name="file"
        :showUploadList="false"
@@ -72,7 +75,10 @@
        @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-tag color="#55acee" style="height:15px"></a-tag>库存积压 <a-tag color="#cd201f" style="height:15px"></a-tag>库存不足
      <a-tag color="#55acee" style="height:15px"></a-tag>
      库存积压
      <a-tag color="#cd201f" style="height:15px"></a-tag>
      库存不足
    </div>
    <a-table
@@ -138,12 +144,13 @@
  },
  data() {
    return {
      mainId: '',
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '20'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
@@ -154,7 +161,7 @@
      //默认排序
      isorter: {
        column: 'num',
        order: 'asc',
        order: 'asc'
      },
      columns: [
@@ -163,94 +170,95 @@
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          },
          width: 50,
          width: 50
        },
        {
          title: '备件编码',
          align: "center",
          dataIndex: 'num',
          align: 'center',
          dataIndex: 'num'
        },
        {
          title: '备件名称',
          align: "center",
          dataIndex: 'name',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '型号',
          align: "center",
          dataIndex: 'model',
          align: 'center',
          dataIndex: 'model'
        },
        {
          title: '规格',
          align: "center",
          dataIndex: 'specification',
          align: 'center',
          dataIndex: 'specification'
        },
        {
          title: '制造商',
          align: "center",
          dataIndex: 'constructorId_dictText',
          align: 'center',
          dataIndex: 'constructorId_dictText'
        },
        {
          title: '单位',
          align: "center",
          dataIndex: 'mainUnitId_dictText',
          align: 'center',
          dataIndex: 'mainUnitId_dictText'
        },
      /*   {
          title: '辅单位',
          align: "center",
          dataIndex: 'auxiliaryUnitId_dictText',
        }, */
        /*   {
            title: '辅单位',
            align: "center",
            dataIndex: 'auxiliaryUnitId_dictText',
          }, */
        {
          title: '总数量',
          align: "center",
          dataIndex: 'totalMainQuantity',
          align: 'center',
          dataIndex: 'totalMainQuantity'
        },
       /*  {
          title: '总辅数量',
          align: "center",
          dataIndex: 'totalAuxiliaryQuantity',
        }, */
        /*  {
           title: '总辅数量',
           align: "center",
           dataIndex: 'totalAuxiliaryQuantity',
         }, */
        {
          title: '有效期',
          align: "center",
          dataIndex: 'validityPeriod',
          align: 'center',
          dataIndex: 'validityPeriod'
        },
        {
          title: '有效单位',
          align: "center",
          dataIndex: 'validityPeriodUnitId_dictText',
          align: 'center',
          dataIndex: 'validityPeriodUnitId_dictText'
        },
        {
          title: '库存上限值',
          align: "center",
          dataIndex: 'inventoryUpperLimit',
          align: 'center',
          dataIndex: 'inventoryUpperLimit'
        },
        {
          title: '库存下限值',
          align: "center",
          dataIndex: 'inventoryLowerLimit',
          align: 'center',
          dataIndex: 'inventoryLowerLimit'
        },
        {
          title: '经济订货量',
          align: "center",
          dataIndex: 'economicOrderQuantity',
          align: 'center',
          dataIndex: 'economicOrderQuantity'
        },
        {
          title: '采购提前期',
          align: "center",
          dataIndex: 'purchaseLeadTime',
        },
          align: 'center',
          dataIndex: 'purchaseLeadTime'
        }
      ],
      url: {
        list: "/spare/sparePart/sparePartInventoryList",
        importExcelUrl:'/spare/SparesPartInventory/importExcel'
        list: '/spare/sparePart/sparePartInventoryList',
        importUrl: '/spare/SparesPartInventory/importExcel',
        exportXlsUrl: '/spare/sparePart/exportXls',
      },
      //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
      alterFlag: "",
    };
      alterFlag: ''
    }
  },
  computed: {
@@ -258,12 +266,17 @@
      return {
        type: 'radio',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys;
          this.onSelectChange(selectedRowKeys, selectedRows);
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRowKeys, selectedRows)
        },
        selectedRowKeys: this.selectedRowKeys,
      };
        selectedRowKeys: this.selectedRowKeys
      }
    },
    importExcelUrl: function() {
      console.log(this.mainId)
      /* return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; */
      return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`
    }
  },
  methods: {
@@ -271,7 +284,7 @@
      return {
        on: {
          click: () => {
            this.onSelectChange(record.id.split(","), [record]);
            this.onSelectChange(record.id.split(','), [record])
          }
        }
      }
@@ -280,73 +293,76 @@
    onSelectChange(selectedRowKeys, selectionRows) {
      if (selectedRowKeys.length == 1) {
        this.$refs.SparePartInventoryList.sparePartId = selectedRowKeys[0]
        this.mainId = selectedRowKeys[0]
      } else {
        this.$refs.SparePartInventoryList.sparePartId = '-1'
      }
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
    },
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.totalMainQuantity < record.inventoryLowerLimit) {
          return 'downLimit'
        }else if(record.totalMainQuantity > record.inventoryUpperLimit){
          return 'upLimit'
        }
        return 'downLimit'
      } else if (record.totalMainQuantity > record.inventoryUpperLimit) {
        return 'upLimit'
      }
      },
    },
    searchReset() {
      this.queryParam = {};
      this.queryParam = {}
      if (this.nodeSelected.key != -1) {
        this.queryParam.sparePartCategoryId = this.nodeSelected.key;
        this.queryParam.sparePartCategoryId = this.nodeSelected.key
      }
      this.selectedRowKeys = []
      this.selectionRows = []
      this.$refs.SparePartInventoryList.sparePartId = '-1'
      this.loadData(1);
      this.loadData(1)
    },
    searchQuery() {
      this.selectedRowKeys = []
      this.selectionRows = []
      this.$refs.SparePartInventoryList.sparePartId = '-1'
      this.loadData(1);
    },
      this.loadData(1)
    }
  },
  watch: {
    alterFlag() {
      this.$bus.$emit('queryTreeData');
      this.$bus.$emit('queryTreeData')
    },
    nodeSelected() {
      this.queryParam = {};
      this.queryParam = {}
      if (this.nodeSelected.key != -1) {
        this.queryParam.sparePartCategoryId = this.nodeSelected.key;
        this.queryParam.sparePartCategoryId = this.nodeSelected.key
      }
      this.selectedRowKeys = []
      this.selectionRows = []
      this.$refs.SparePartInventoryList.sparePartId = '-1'
      this.loadData(1);
    },
      this.loadData(1)
    }
  },
  created() {
    this.queryParam = {};
    this.queryParam.sparePartCategoryId = this.nodeSelected.key;
    this.queryParam = {}
    this.queryParam.sparePartCategoryId = this.nodeSelected.key
    this.selectedRowKeys = []
    this.selectionRows = []
    this.loadData(1);
    this.loadData(1)
  }
}
</script>
<style  lang="less" >
<style lang="less">
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
@@ -369,6 +385,6 @@
}
.ant-table-tbody .red {
    background-color: red !important
  }
  background-color: red !important
}
</style>