zenglf
2023-09-18 92ff846fb659c62037a32b1d8c15eae9df9d9b54
src/views/spare/modules/sparePartInventory/SparePartInventoryList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,197 @@
<template>
  <a-card :bordered="false">
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
      </a-table>
    </div>
  </a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, postAction } from '@/api/manage'
import JInput from '@/components/jeecg/JInput'
import Tooltip from 'ant-design-vue/es/tooltip'
import JEllipsis from "@/components/jeecg/JEllipsis";
export default {
  name: "EquipmentList",
  mixins: [JeecgListMixin],
  components: {
    JInput,
    Tooltip,
    JEllipsis,
  },
  data() {
    return {
      description: '适配设备',
      ipagination:{
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " å…±" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '批次号',
          align: "center",
          dataIndex: 'batchNum',
        },
        {
          title: '单位',
          align: "center",
          dataIndex: 'mainUnitName',
        },
        {
          title: '数量',
          align: "center",
          dataIndex: 'mainQuantity',
        },
       /*  {
          title: '辅单位',
          align: "center",
          dataIndex: 'auxiliaryUnitName',
        },
        {
          title: '辅数量',
          align: "center",
          dataIndex: 'auxiliaryQuantity',
        }, */
        {
          title: '仓库',
          align: "center",
          dataIndex: 'warehouseName',
        },
        {
          title: '库区',
          align: "center",
          dataIndex: 'warehouseAreaName',
        },
        {
          title: '库位',
          align: "center",
          dataIndex: 'warehouseLocationNum',
        },
        {
          title: '出厂日期',
          align: "center",
          dataIndex: 'manufactureDate',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '供应商',
          align: "center",
          dataIndex: 'supplierName',
        },
        {
          title: '有效期',
          align: "center",
          dataIndex: 'validityPeriod',
        },
        {
          title: '失效预警报',
          align: "center",
          dataIndex: 'validityForecast',
        },
      ],
      url: {
        list: "/spare/SparesPartInventory/getSparePartInventoryList",
      },
      sparePartId: '-1',
    }
  },
  watch: {
    sparePartId() {
      this.queryParam = {};
      this.queryParam.sparePartId = this.sparePartId;
      this.loadData(1);
    },
  },
  methods: {
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error("请设置url.list属性!")
        return
      }
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      var params = this.getQueryParams();//查询条件
      if (this.sparePartId == '-1') {
        params.sparePartId = '-1';
      }
      this.loading = true;
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records || res.result;
          if (res.result.total) {
            this.ipagination.total = res.result.total;
          } else {
            this.ipagination.total = 0;
          }
        } else {
          this.$message.warning(res.message)
        }
      }).finally(() => {
        this.loading = false
      })
    },
  },
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
/deep/ .frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.fontweightGreen {
  font-weight: bold;
  color: green;
}
.ant-card {
  margin-left: -30px;
  margin-right: -30px;
}
</style>