zhangherong
14 小时以前 7282d4b49f4577c6807a78bdd6e705feb2fe0e2c
art: 线边库管理,物料台账相关代码修改
已修改6个文件
793 ■■■■ 文件已修改
src/views/base/WarehouseList.vue 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/modules/warehouse/WarehouseModel.vue 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/lsw/LswMateriaView.vue 203 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/lsw/modules/LswMaterialForm.vue 325 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/lsw/modules/LswMaterialModal.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/DictList.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/WarehouseList.vue
@@ -11,18 +11,18 @@
        <a-row :gutter="30">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="仓库编号">
            <a-form-item label="线边库编号">
              <j-input
                placeholder="请输入仓库编号检索"
                placeholder="请输入线边库编号检索"
                v-model="queryParam.warehouseCode"
              ></j-input>
            </a-form-item>
          </a-col>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="仓库名称">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="线边库名称">
              <j-input
                placeholder="请输入仓库名称检索"
                placeholder="请输入线边库名称检索"
                v-model="queryParam.warehouseName"
              ></j-input>
            </a-form-item>
@@ -44,7 +44,8 @@
        @click="handleAdd"
        type="primary"
        icon="plus"
      >新增</a-button>
      >新增
      </a-button>
    </div>
    <!-- table区域-begin -->
@@ -60,6 +61,7 @@
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <!--状态栏个性展示-->
        <span
@@ -89,8 +91,8 @@
        >
          <a
            href="javascript:;"
            @click="handleDetail(record)"
          >详情</a>
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
@@ -98,19 +100,10 @@
              <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item v-if="record.warehouseStatus==1">
                <a @click="handleEdit(record)">编辑</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item v-if="record.warehouseStatus == 0">
               <a-menu-item v-if="record.warehouseStatus == 0">
                <a-popconfirm
                  title="确定启用吗?"
                  @confirm="() => handleActive(record.id)"
@@ -126,6 +119,16 @@
                  <a>禁用</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
@@ -146,7 +149,7 @@
//按需引入 组件
import WarehouseModel from './modules/warehouse/WarehouseModel'
import { deleteAction, requestPut, getAction } from '@/api/manage'
import { getAction, requestPut } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JInput from '@/components/jeecg/JInput'
@@ -157,7 +160,7 @@
  components: {
    WarehouseModel,
    JEllipsis,
    JInput,
    JInput
  },
  data() {
    return {
@@ -165,12 +168,19 @@
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '20'],
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      /* 排序参数 */
      isorter:{
        column: 'warehouseCode',
        order: 'asc',
      },
      // 表头
      columns: [
@@ -179,19 +189,19 @@
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '线边库编号',
          align: "center",
          align: 'center',
          dataIndex: 'warehouseCode'
        },
        {
          title: '线边库名称',
          align: "center",
          align: 'center',
          dataIndex: 'warehouseName'
        },
        {
@@ -204,7 +214,7 @@
          title: '状态',
          align: 'center',
          scopedSlots: {
            customRender: 'status',
            customRender: 'status'
          },
          dataIndex: 'warehouseStatus'
        },
@@ -213,78 +223,83 @@
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/base/lineSideWarehouse/list',
        delete: '/base/lineSideWarehouse/delete',
        active: '/base/lineSideWarehouse/active',
      },
        active: '/base/lineSideWarehouse/active'
      }
    }
  },
  mounted() {
  },
  methods: {
    loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
        this.ipagination.current = 1
      }
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      var params = this.getQueryParams()//查询条件
      this.loading = true
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
        this.loading = false
      })
    },
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.warehouseStatus != "1") {
        return "frozenRowClass";
      if (record.warehouseStatus != '1') {
        return 'frozenRowClass'
      }
      return "";
      return ''
    },
    //启用禁用
    handleActive(id) {
      if (!this.url.active) {
        this.$message.error("请设置url.active!")
        this.$message.error('请设置url.active!')
        return
      }
      let that = this;
      let that = this
      requestPut(that.url.active, {}, { id: id }).then((res) => {
        if (res.success) {
          that.$message.success(res.message);
          that.loadData();
          that.$message.success(res.message)
          that.loadData()
        } else {
          that.$message.warning(res.message);
          that.$message.warning(res.message)
        }
      });
    },
  },
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.ant-card-body .table-operator {
  margin-bottom: 18px;
}
@@ -298,7 +313,7 @@
  margin: 0 5px;
}
/deep/.ant-btn-danger {
/deep/ .ant-btn-danger {
  background-color: #ffffff;
}
src/views/base/modules/warehouse/WarehouseModel.vue
@@ -16,7 +16,7 @@
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="labelCol"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="线边库编号"
            >
@@ -33,7 +33,7 @@
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="labelCol"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="线边库名称"
            >
@@ -53,14 +53,9 @@
              :wrapperCol="wrapperCol"
              label="产线"
            >
            <j-select-factory
            :disabled="disableSubmit"
            v-model="model.factoryId"
            :multi="true"
            @back="backFactoryInfo"
            :backProduction="true"
            :treeProductOpera="true"
          ></j-select-factory>
              <j-dict-select-tag :disabled="disableSubmit" type="list" placeholder="请选择产线"
                                 v-model="model.factoryId"
                                 dictCode="base_factory,factory_name,id,del_flag='0' and factory_category='3'" />
            </a-form-item>
          </a-col>
        </a-row>
@@ -70,37 +65,29 @@
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jeecg/JDate'
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import moment from 'moment'
import { duplicateCheck } from '@/api/api'//重复校验
import JTreeDict from '@/components/jeecg/JTreeDict'//分类字典树形下拉组件
import JSelectFactory from '../../../../components/jeecgbiz/JSelectFactory'
import { duplicateCheck } from '@/api/api' //重复校验
export default {
  name: "WarehouseModal",
  components: {
    JDate,
    JTreeDict,
    JSelectFactory
  },
  name: 'WarehouseModal',
  components: {},
  data() {
    return {
      title: "操作",
      title: '操作',
      visible: false,
      disableSubmit: false,
      model: {},
      treeData: [],
      warehouseId: "", //保存线边库id
      warehouseId: '', //保存线边库id
      labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
@@ -109,71 +96,71 @@
          rules: [
            { required: true, message: '请输入线边库编号' },
            { min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' },
            { validator: this.validateNum },
            { validator: this.validateNum }
          ]
        },
        warehouseName: {
          rules: [
            { required: true, message: '请输入线边库名称' },
            { min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },
            { validator: this.validateName },
            { validator: this.validateName }
          ]
        },
        }
      },
      url: {
        add: "/base/lineSideWarehouse/add",
        edit: "/base/lineSideWarehouse/edit",
        add: '/base/lineSideWarehouse/add',
        edit: '/base/lineSideWarehouse/edit'
      },
      nextFactoryOptions: [],
      nextFactoryOptions: []
    }
  },
  created() {
  },
  methods: {
    add() {
      this.edit({});
      this.edit({})
    },
    edit(record) {
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.warehouseId = record.id;
      this.visible = true;
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.warehouseId = record.id
      this.visible = true
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'warehouseCode', 'warehouseName', 'factoryId')
        )
      });
      })
    },
    close() {
      this.$emit('close');
      this.visible = false;
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      const that = this;
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add;
            method = 'post';
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit;
            method = 'put';
            httpurl += this.url.edit
            method = 'put'
          }
          let formData = Object.assign(this.model, values);
          let formData = Object.assign(this.model, values)
          httpAction(httpurl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
              that.$message.success(res.message)
              that.$emit('ok')
            } else {
              that.$message.warning(res.message);
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
            that.confirmLoading = false
            that.close()
          })
        }
      })
@@ -189,13 +176,13 @@
        fieldVal: value,
        dataId: this.warehouseId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false 假删除:true
        delFlag: 'true',
      };
        delFlag: 'true'
      }
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
          callback()
        } else {
          callback("线边库编号已存在!");
          callback('线边库编号已存在!')
        }
      })
    },
@@ -207,24 +194,24 @@
        fieldVal: value,
        dataId: this.warehouseId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false 假删除:true
        delFlag: 'true',
      };
        delFlag: 'true'
      }
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
          callback()
        } else {
          callback("线边库名称已存在!");
          callback('线边库名称已存在!')
        }
      })
    },
     backFactoryInfo(info) {
        this.model.factoryIds = this.model.factoryId
        this.nextFactoryOptions = info.map((item, index, arr) => {
          let c = { label: item.text, value: item.value + '' }
          return c
        })
      },
      // 关闭弹窗时清除表单校验
    backFactoryInfo(info) {
      this.model.factoryIds = this.model.factoryId
      this.nextFactoryOptions = info.map((item, index, arr) => {
        let c = { label: item.text, value: item.value + '' }
        return c
      })
    },
    // 关闭弹窗时清除表单校验
    removeValidate() {
      if (this.$refs.form) this.$refs.form.clearValidate()
    }
src/views/lsw/LswMateriaView.vue
@@ -1,12 +1,10 @@
<template>
  <a-card
    :bordered="false"
    title="线边库物料信息"
  >
    :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料编码">
              <j-input placeholder="请输入物料编码" v-model="queryParam.materialNumber"></j-input>
            </a-form-item>
@@ -16,26 +14,33 @@
              <j-input placeholder="请输入物料名称" v-model="queryParam.materialName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料型号">
              <j-input placeholder="请输入物料型号" v-model="queryParam.materialModel"></j-input>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="状态">
              <j-dict-select-tag placeholder="请选择状态" dictCode="dict_item_status"
                                 v-model="queryParam.materialStatus"></j-dict-select-tag>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料类型">
              <j-dict-select-tag placeholder="请输入物料类型"  dictCode="material_category" v-model="queryParam.materialCategory"></j-dict-select-tag>
              <j-dict-select-tag placeholder="请选择物料类型" dictCode="material_category"
                                 v-model="queryParam.materialCategory"></j-dict-select-tag>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
          <a-col :xl="2" :lg="7" :md="8" :sm="24">
            <a-form-item label="空类型">
              <a-switch v-model="queryParam.materialCategoryNull"></a-switch>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
<!--    <a-button @click="handleAdd" type="primary" icon="plus">新增物料信息-测试</a-button>-->
    <!--    <a-button @click="handleAdd" type="primary" icon="plus">新增物料信息-测试</a-button>-->
    <a-spin :spinning="confirmLoading">
      <div>
        <!-- 主表单区域 -->
@@ -44,14 +49,72 @@
          size="middle"
          bordered
          rowKey="id"
          :rowClassName="tableRowClass"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{ selectedRowKeys: selectedRowKeys,
  onChange: onSelectChange,
  type: 'radio'}"
          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
          @change="handleTableChange">
          <!--状态栏个性展示-->
          <span
            slot="status"
            slot-scope="text,record"
          >
          <a-badge
            v-if="record.materialStatus==='1'"
            status="success"
          />
          <span
            v-if="record.materialStatus==='1'"
            class="success"
          >启用</span>
          <a-badge
            v-if="record.materialStatus==='0'"
            status="error"
          />
          <span
            v-if="record.materialStatus==='0'"
            class="error"
          >禁用</span>
        </span>
          <span
            slot="action"
            slot-scope="text, record"
          >
          <a
            href="javascript:;"
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多
              <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item v-if="record.materialStatus === '1'">
                <a-popconfirm
                  title="确定禁用吗?"
                  @confirm="() => handleActive(record)"
                >
                  <a>禁用</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-else>
                <a-popconfirm
                  title="确定启用吗?"
                  @confirm="() => handleActive(record)"
                >
                  <a>启用</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        </a-table>
      </div>
      <!-- 子表单区域 -->
@@ -85,8 +148,6 @@
import { getAction } from '@/api/manage'
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import LswMaterialModal from '@views/lsw/modules/LswMaterialModal.vue'
@@ -140,9 +201,12 @@
          dataIndex: 'materialName'
        },
        {
          title: '物料型号',
          title: '物料状态',
          align: 'center',
          dataIndex: 'materialModel'
          scopedSlots: {
            customRender: 'status'
          },
          dataIndex: 'materialStatus'
        },
        {
          title: '物料类型',
@@ -150,9 +214,16 @@
          dataIndex: 'materialCategory_dictText'
        },
        {
          title: '单位',
          title: '基本计量单位',
          align: 'center',
          dataIndex: 'materialUnit'
        },
        {
          width: 150,
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      // 物料库存信息
@@ -204,10 +275,13 @@
      },
      url: {
        //searchlikeQuery
        list: '/lswmaterial/lswMaterial/list',
        queryById: '/lswmaterial/lswMaterial/queryById',
        list: '/lsw/lswMaterial/list',
        edit: '/lsw/lswMaterial/edit',
        active: '/lsw/lswMaterial/active',
        inactive: '/lsw/lswMaterial/inactive',
        queryById: '/lsw/lswMaterial/queryById',
        lswMaterialInventory: {
          list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId'
          list: '/lsw/lswMaterial/queryLswMaterialInventoryByMainId'
        }
      }
    }
@@ -226,19 +300,23 @@
    },
    totalInventoryQuantity() {
      if (!this.lswMaterialInventoryTable.dataSource || this.lswMaterialInventoryTable.dataSource.length === 0) {
        return '0';
        return '0'
      }
      return this.lswMaterialInventoryTable.dataSource.reduce((sum, item) => {
        const quantity = Number(item.quantity) || 0;
        return sum + quantity;
      }, 0);
        const quantity = Number(item.quantity) || 0
        return sum + quantity
      }, 0)
    },
  },
  created() {
  },
  methods: {
    handleCustomAdd(){
      console.log('点击新增了')
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.warehouseStatus != '1') {
        return 'frozenRowClass'
      }
      return ''
    },
    handleTableChange() {
      console.log('test---->', this.selectedRowKeys[0])
@@ -248,7 +326,7 @@
      // 单选模式下,selectedRowKeys 是数组,但长度最多为1
      console.log('点击了---->')
      this.selectedRowKeys = selectedRowKeys
      this.lswMaterialInventoryTable.dataSource=[]
      this.lswMaterialInventoryTable.dataSource = []
      // 获取选中行的完整数据
      if (selectedRowKeys.length > 0) {
        const selectedId = selectedRowKeys[0] // 选中行的id
@@ -256,11 +334,74 @@
        this.lswMaterialInventoryTable.dataSource = lswMaterialInventoryResult.result
        this.lswMaterialInventoryTable.loading = false
      }
    },
    handleActive(record) {
      let url = this.url.active;
      if (record.materialStatus === '1') {
        url = this.url.inactive
      }
      let that = this
      getAction(url, { id: record.id }).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.loadData()
        } else {
          that.$message.warning(res.message)
        }
      })
    }
  }
}
</script>
<style scoped>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.ant-card-body .table-operator {
  margin-bottom: 18px;
}
.ant-table-tbody .ant-table-row td {
  padding-top: 15px;
  padding-bottom: 15px;
}
.anty-row-operator button {
  margin: 0 5px;
}
/deep/ .ant-btn-danger {
  background-color: #ffffff;
}
.ant-modal-cust-warp {
  height: 100%;
}
.ant-modal-cust-warp .ant-modal-body {
  height: calc(100% - 110px) !important;
  overflow-y: auto;
}
.ant-modal-cust-warp .ant-modal-content {
  height: 90% !important;
  overflow-y: hidden;
}
</style>
src/views/lsw/modules/LswMaterialForm.vue
@@ -1,260 +1,129 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
    <j-form-container :disabled="true">
      <!-- 主表单区域 -->
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
      <a-form-model ref="form1" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="12" >
          <a-col :span="24">
            <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialNumber">
              <a-input v-model="model.materialNumber" placeholder="请输入物料编码" ></a-input>
              <a-input v-model="model.materialNumber"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
          <a-col :span="24">
            <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName">
              <a-input v-model="model.materialName" placeholder="请输入物料名称" ></a-input>
              <a-input v-model="model.materialName"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="物料型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialModel">
              <a-input v-model="model.materialModel" placeholder="请输入物料型号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="物料类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCategory">
              <j-dict-select-tag type="list" v-model="model.materialCategory" dictCode="material_category" placeholder="请选择物料类型" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
              <a-input v-model="model.materialUnit" placeholder="请输入单位" ></a-input>
          <a-col :span="24">
            <a-form-model-item label="基本计量单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
              <a-input v-model="model.materialUnit"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
      <!-- 子表单区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="物料库存信息" :key="refKeys[0]" :forceRender="true">
        <j-vxe-table
          keep-source
          :ref="refKeys[0]"
          :loading="lswMaterialInventoryTable.loading"
          :columns="lswMaterialInventoryTable.columns"
          :dataSource="lswMaterialInventoryTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :toolbar="true"
          />
      </a-tab-pane>
    </a-tabs>
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="物料类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCategory">
              <j-dict-select-tag type="list" v-model="model.materialCategory" dictCode="material_category" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
  import { validateDuplicateValue } from '@/utils/util'
  import JFormContainer from '@/components/jeecg/JFormContainer'
import { httpAction } from '@/api/manage'
  export default {
    name: 'LswMaterialForm',
    mixins: [JVxeTableModelMixin],
    components: {
      JFormContainer,
    },
    data() {
      return {
        warehouseColOptions: [],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        model:{
         },
        // 新增时子表默认添加几行空数据
        addDefaultRowNum: 1,
        refKeys: ['lswMaterialInventory', ],
        tableKeys:['lswMaterialInventory', ],
        activeKey: 'lswMaterialInventory',
        // 物料库存信息
        lswMaterialInventoryTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '批次号',
              key: 'batchNumber',
               type: JVXETypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '库存类型',
              key: 'inventoryCategory',
               type: JVXETypes.select,
              width:"200px",
              placeholder: '请选择${title}',
              defaultValue:'',
              options:[],
              dictCode: 'inventoryCategory'
            },
            {
              title: '数量',
              key: 'quantity',
               type: JVXETypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '库存地',
              key: 'warehouseId',
              type: JVXETypes.select,
              width: "200px",
              options: this.warehouseColOptions,
            },
            {
              title: '库存状态',
              key: 'inventoryStatus',
               type: JVXETypes.select,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
              options:[],
              dictCode: 'inventory_status'
            },
          ]
        },
        validatorRules: {
          materialNumber: [
            { required: true, message: '物料编码是必选项', trigger: 'change' }
          ],
          materialName: [
            { required: true, message: '物料名称是必选项', trigger: 'change' }
          ],
          materialModel: [
            { required: true, message: '物料型号是必选项', trigger: 'change' }
          ],
          materialCategory: [
            { required: true, message: '物料类型是必选项', trigger: 'change' }
          ],
          materialUnit: [
            { required: true, message: '单位是必选项', trigger: 'change' }
          ],
        },
        url: {
          add: "/lswmaterial/lswMaterial/add",
          edit: "/lswmaterial/lswMaterial/edit",
          queryById: "/lswmaterial/lswMaterial/queryById",
          warehouseList:"/base/lineSideWarehouse/list",
          lswMaterialInventory: {
            list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId'
          },
        }
      }
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
export default {
  name: 'LswMaterialForm',
  components: {
  },
  data() {
    return {
      confirmLoading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      model: {},
      validatorRules: {
        materialCategory: [
          { required: true, message: '物料类型必选', trigger: 'change' }
        ]
      },
      url: {
        add: '',
        edit: '/lsw/lswMaterial/edit'
      }
    }
  },
  props: {
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    }
  },
  computed: {
    formDisabled() {
      return this.disabled
    }
  },
  created() {
    //备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model))
    console.log('formDisabled' + this.formDisabled)
  },
  methods: {
    add() {
      this.edit(this.modelDefault)
    },
    created () {
      this.loadWarehouseOptions();
    edit(record) {
      this.model = Object.assign({}, record)
      this.visible = true
    },
    methods: {
      async loadWarehouseOptions() {
        try {
          const res = await getAction(this.url.warehouseList);
          console.log("仓库API响应:", res);
          let data = [];
          data = res.result.records;
          console.log("处理后的仓库数据:", data);
          const options = data.map(item => ({
            text: item.warehouseName || `仓库(${item.id})`, // 显示文本
            value: item.id // 实际值
          }));
          console.log("格式化后的选项:", options);
          const warehouseCol = this.lswMaterialInventoryTable.columns.find(
            col => col.key === 'warehouseId'
          );
          if (warehouseCol) {
            this.$set(warehouseCol, 'options', options);
            this.warehouseColOptions = warehouseCol.options
            console.log("更新后的列选项:", warehouseCol.options);
    submitForm() {
      const that = this
      // 触发表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }
          this.$nextTick(() => {
            this.$forceUpdate();
            console.log("已强制更新视图");
          });
        } catch (error) {
          console.error('加载仓库列表失败:', error);
          httpAction(httpurl, this.model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        }
      },
      addBefore(){
        this.lswMaterialInventoryTable.dataSource=[]
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** 调用完edit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // 加载子表数据
        if (this.model.id) {
          let params = { id: this.model.id }
          this.requestSubTableData(this.url.lswMaterialInventory.list, params, this.lswMaterialInventoryTable)
        }
      },
      //校验所有一对一子表表单
        validateSubForm(allValues){
            return new Promise((resolve,reject)=>{
              Promise.all([
              ]).then(() => {
                resolve(allValues)
              }).catch(e => {
                if (e.error === VALIDATE_FAILED) {
                  // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
                  this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
                } else {
                  console.error(e)
                }
              })
            })
        },
      /** 整理成formData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // 展开
          lswMaterialInventoryList: allValues.tablesValue[0].tableData,
        }
      },
      validateError(msg){
        this.$message.error(msg)
      },
      })
    }
  }
}
</script>
<style scoped>
src/views/lsw/modules/LswMaterialModal.vue
@@ -1,7 +1,7 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :width="800"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
@@ -13,7 +13,6 @@
</template>
<script>
  import LswMaterialForm from './LswMaterialForm'
  export default {
@@ -47,7 +46,7 @@
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.handleOk();
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
src/views/system/DictList.vue
@@ -7,12 +7,12 @@
        <a-row :gutter="12">
          <a-col :md="7" :sm="8">
            <a-form-item label="字典名称" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入字典名称" v-model="queryParam.dictName"></a-input>
              <j-input placeholder="请输入字典名称" v-model="queryParam.dictName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="7" :sm="8">
            <a-form-item label="字典编号" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入字典编号" v-model="queryParam.dictCode"></a-input>
              <j-input placeholder="请输入字典编号" v-model="queryParam.dictCode"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="7" :sm="8">