qushaowei
2025-05-22 536786768f4dd03ebf2ff76b3a00adc9d1e5c043
备件管理、备件库存管理
已添加1个文件
已修改3个文件
286 ■■■■■ 文件已修改
src/views/eam/spare/EamSparePartsList.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/spare/EamSparePartsList.vue
@@ -98,6 +98,12 @@
        type="primary"
        icon="plus"
      >新增</a-button>
      <a-button
        @click="handleInto"
        type="primary"
        icon="plus"
      >入库</a-button>
      <!-- <a-button
        type="primary"
        icon="download"
@@ -198,6 +204,11 @@
      ref="modalForm"
      @ok="modalFormOk"
    ></eamSpareParts-modal>
    <eamSpare-part-into-modal
      ref="intoModalForm"
      @ok="modalFormOk"
    ></eamSpare-part-into-modal>
  </a-card>
</template>
@@ -205,6 +216,7 @@
import '@assets/less/TableExpand.less'
import EamSparePartsModal from './modules/EamSpareParts/EamSparePartsModal.vue'
import EamSparePartInventoryList from './modules/EamSpareParts/EamSparePartInventoryList.vue'
import EamSparePartIntoModal from './modules/EamSpareParts/EamSparePartIntoModal.vue'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
@@ -212,7 +224,8 @@
  mixins: [JeecgListMixin],
  components: {
    EamSparePartsModal,
    EamSparePartInventoryList
    EamSparePartInventoryList,
    EamSparePartIntoModal
  },
  data() {
    return {
@@ -281,6 +294,11 @@
          dataIndex: 'inventoryWarning'
        },
        {
          title: '库存总数',
          align: "center",
          dataIndex: 'totalQuantity'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
@@ -302,11 +320,20 @@
    }
  },
  methods: {
    handleInto() {
      this.$refs.intoModalForm.add();
      this.$refs.intoModalForm.title = "入库";
    },
    searchReset() {
      this.queryParam = {}
      this.onClearSelected()
      this.loadData(1);
    },
    searchQuery() {
      this.onClearSelected()
      this.loadData(1);
    },
    clickThenSelect(record) {
      return {
        on: {
src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,233 @@
<template>
  <j-modal
    :title="title"
    :width="1500"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    centered
    :mask-closable="false"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="spinning">
      <a-form-model
        ref="form"
        :model="model"
        :rules="validatorRules"
        :labelCol="labelCol"
        :wrapperCol="wrapperCol"
      >
        <a-row :gutter="24">
          <j-vxe-table
            ref="editableDetailTable"
            :rowNumber="true"
            :rowSelection="true"
            :bordered="true"
            :alwaysEdit="true"
            :toolbar="true"
            keep-source
            :height="300"
            :loading="detail.loading"
            :dataSource="detail.dataSource"
            :columns="detail.columns"
            style="margin-top: 8px;"
          />
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
import { getAction, httpAction } from '@/api/manage'
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
export default {
  name: 'EamSparePartIntoModal',
  mixins: [JVxeTableModelMixin],
  components: {},
  data() {
    return {
      title: '操作',
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      confirmLoading: false,
      spinning: false,
      disabled: false,
      validatorRules: {},
      url: {
        add: '/eam/eamSparePartInventory/add',
        edit: '/eam/eamSparePartInventory/edit',
      },
      detail: {
        loading: false,
        dataSource: [],
        columns: [
          {
            title: '来源类型',
            key: 'sparePartIntoType',
            type: JVXETypes.hidden,
            width: '12%',
            align: 'center',
            defaultValue: '1',
            validateRules: [
              { required: true, message: '备件不能为空!' }
            ]
          },
          {
            title: '备件',
            key: 'sparePartId',
            type: JVXETypes.select,
            width: '12%',
            align: 'center',
            dictCode: 'eam_spare_parts,part_name,id, del_flag!=\'1\'',
            validateRules: [
              { required: true, message: '备件不能为空!' }
            ]
          },
          {
            title: '批次号',
            key: 'batchNum',
            type: JVXETypes.input,
            width: '10%',
            align: 'center',
            validateRules: [
              { required: true, message: '批次号不能为空!' }
            ]
          },
          {
            title: '数量',
            key: 'inventory',
            type: JVXETypes.inputNumber,
            width: '10%',
            align: 'center',
            validateRules: [
              { required: true, message: '数量不能为空!' }
            ]
          },
          {
            title: '出厂日期(生产日期)',
            key: 'manufactureDate',
            type: JVXETypes.datetime,
            width: '16%',
            align: 'center',
            validateRules: [
              { required: false, message: '出厂日期(生产日期)不能为空!' }
            ]
          },
          {
            title: '供应商',
            key: 'supplier',
            type: JVXETypes.textarea,
            width: '15%',
            align: 'center',
            validateRules: [
              { required: false, message: '供应商不能为空!' }
            ]
          },
          {
            title: '截止有效期',
            key: 'expirationOfValidity',
            type: JVXETypes.datetime,
            width: '16%',
            align: 'center',
            validateRules: [
              { required: false, message: '截止有效期不能为空!' }
            ]
          },
          {
            title: '存放位置',
            key: 'location',
            type: JVXETypes.textarea,
            width: '13%',
            align: 'center',
            validateRules: [
              { required: false, message: '存放位置不能为空!' }
            ]
          },
        ]
      }
    }
  },
  created() {
  },
  methods: {
    add() {
      this.model = {}
      this.detail.dataSource = []
      this.visible = true
    },
    async handleOk() {
      const that = this
      let errMap = await that.$refs.editableDetailTable.validateTable()
      if (errMap) {
        this.$message.warning('数据校验失败!')
        return
      }
      // è§¦å‘表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          let tableData = that.$refs.editableDetailTable.getTableData()
          let removeData = that.$refs.editableDetailTable.getDeleteData()
          that.model.eamSparePartInventories = [...tableData]
          that.model.removeDetailList = [...removeData]
          that.confirmLoading = that.spinning = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }
          httpAction(httpurl, this.model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
              that.close()
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = that.spinning = false
          })
        } else {
          return false
        }
      })
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.clearValidate()
    }
  }
}
</script>
<style lang="less" scoped>
</style>
src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue
@@ -81,11 +81,11 @@
            return parseInt(index) + 1;
          }
        },
        // {
        //   title: '备品备件ID',
        //   align: "center",
        //   dataIndex: 'sparePartId'
        // },
        {
          title: '来源类型',
          align: "center",
          dataIndex: 'sparePartIntoType_dictText'
        },
        {
          title: '批次号',
          align: "center",
@@ -116,12 +116,12 @@
          align: "center",
          dataIndex: 'location'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: { customRender: 'action' },
        }
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   align: "center",
        //   scopedSlots: { customRender: 'action' },
        // }
      ],
      url: {
        list: "/eam/eamSparePartInventory/list",
src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue
@@ -1,7 +1,7 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen