| | |
| | | <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-form-item label="线边库名称"> |
| | | <j-input |
| | | placeholder="请输入仓库名称检索" |
| | | placeholder="请输入线边库名称检索" |
| | | v-model="queryParam.warehouseName" |
| | | ></j-input> |
| | | </a-form-item> |
| | |
| | | @click="handleAdd" |
| | | type="primary" |
| | | icon="plus" |
| | | >新增</a-button> |
| | | >新增 |
| | | </a-button> |
| | | </div> |
| | | |
| | | <!-- table区域-begin --> |
| | |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | :loading="loading" |
| | | @change="handleTableChange" |
| | | > |
| | | <!--状态栏个性展示--> |
| | | <span |
| | |
| | | > |
| | | <a |
| | | href="javascript:;" |
| | | @click="handleDetail(record)" |
| | | >详情</a> |
| | | @click="handleEdit(record)" |
| | | >编辑</a> |
| | | |
| | | <a-divider type="vertical" /> |
| | | <a-dropdown> |
| | |
| | | <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-popconfirm |
| | |
| | | <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> |
| | |
| | | //按需引入 组件 |
| | | 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' |
| | |
| | | components: { |
| | | WarehouseModel, |
| | | JEllipsis, |
| | | JInput, |
| | | JInput |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | /* 分页参数 */ |
| | | 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: [ |
| | |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | width: 60, |
| | | align: "center", |
| | | align: 'center', |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1; |
| | | return parseInt(index) + 1 |
| | | } |
| | | }, |
| | | { |
| | | title: '线边库编号', |
| | | align: "center", |
| | | align: 'center', |
| | | dataIndex: 'warehouseCode' |
| | | }, |
| | | { |
| | | title: '线边库名称', |
| | | align: "center", |
| | | align: 'center', |
| | | dataIndex: 'warehouseName' |
| | | }, |
| | | { |
| | |
| | | title: '状态', |
| | | align: 'center', |
| | | scopedSlots: { |
| | | customRender: 'status', |
| | | customRender: 'status' |
| | | }, |
| | | dataIndex: 'warehouseStatus' |
| | | }, |
| | |
| | | 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; |
| | | } |
| | |
| | | :wrapperCol="wrapperCol" |
| | | label="产线" |
| | | > |
| | | <j-select-factory |
| | | :disabled="disableSubmit" |
| | | <j-dict-select-tag :disabled="disableSubmit" type="list" placeholder="请选择产线" |
| | | v-model="model.factoryId" |
| | | :multi="true" |
| | | @back="backFactoryInfo" |
| | | :backProduction="true" |
| | | :treeProductOpera="true" |
| | | ></j-select-factory> |
| | | dictCode="base_factory,factory_name,id,del_flag='0' and factory_category='3'" /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | |
| | | </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' |
| | | |
| | | 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 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | sm: { span: 16 } |
| | | }, |
| | | |
| | | confirmLoading: false, |
| | |
| | | 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() |
| | | }) |
| | | } |
| | | }) |
| | |
| | | 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('线边库编号已存在!') |
| | | } |
| | | }) |
| | | }, |
| | |
| | | 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('线边库名称已存在!') |
| | | } |
| | | }) |
| | | }, |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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> |
| | | <!-- 子表单区域 --> |
| | |
| | | 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' |
| | |
| | | dataIndex: 'materialName' |
| | | }, |
| | | { |
| | | title: '物料型号', |
| | | title: '物料状态', |
| | | align: 'center', |
| | | dataIndex: 'materialModel' |
| | | scopedSlots: { |
| | | customRender: 'status' |
| | | }, |
| | | dataIndex: 'materialStatus' |
| | | }, |
| | | { |
| | | title: '物料类型', |
| | |
| | | dataIndex: 'materialCategory_dictText' |
| | | }, |
| | | { |
| | | title: '单位', |
| | | title: '基本计量单位', |
| | | align: 'center', |
| | | dataIndex: 'materialUnit' |
| | | }, |
| | | { |
| | | width: 150, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | | // 物料库存信息 |
| | |
| | | }, |
| | | 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' |
| | | } |
| | | } |
| | | } |
| | |
| | | }, |
| | | 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]) |
| | |
| | | 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> |
| | |
| | | <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: [], |
| | | confirmLoading: false, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | 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' |
| | | }, |
| | | model: {}, |
| | | validatorRules: { |
| | | materialCategory: [ |
| | | { required: true, message: '物料类型必选', trigger: 'change' } |
| | | ] |
| | | }, |
| | | 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' |
| | | }, |
| | | add: '', |
| | | edit: '/lsw/lswMaterial/edit' |
| | | } |
| | | } |
| | | }, |
| | |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | }, |
| | | } |
| | | }, |
| | | created () { |
| | | this.loadWarehouseOptions(); |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)) |
| | | console.log('formDisabled' + this.formDisabled) |
| | | }, |
| | | 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); |
| | | } |
| | | this.$nextTick(() => { |
| | | this.$forceUpdate(); |
| | | console.log("已强制更新视图"); |
| | | }); |
| | | } catch (error) { |
| | | console.error('加载仓库列表失败:', error); |
| | | } |
| | | add() { |
| | | this.edit(this.modelDefault) |
| | | }, |
| | | addBefore(){ |
| | | this.lswMaterialInventoryTable.dataSource=[] |
| | | edit(record) { |
| | | this.model = Object.assign({}, record) |
| | | this.visible = true |
| | | }, |
| | | 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] |
| | | 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 { |
| | | console.error(e) |
| | | httpurl += this.url.edit |
| | | method = 'put' |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | /** 整理成formData */ |
| | | classifyIntoFormData(allValues) { |
| | | let main = Object.assign(this.model, allValues.formValue) |
| | | return { |
| | | ...main, // 展开 |
| | | lswMaterialInventoryList: allValues.tablesValue[0].tableData, |
| | | httpAction(httpurl, this.model, method).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }, |
| | | validateError(msg){ |
| | | this.$message.error(msg) |
| | | }, |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="1200" |
| | | :width="800" |
| | | :visible="visible" |
| | | :maskClosable="false" |
| | | switchFullscreen |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import LswMaterialForm from './LswMaterialForm' |
| | | |
| | | export default { |
| | |
| | | this.visible = false; |
| | | }, |
| | | handleOk () { |
| | | this.$refs.realForm.handleOk(); |
| | | this.$refs.realForm.submitForm(); |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | |
| | | <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"> |