From 7282d4b49f4577c6807a78bdd6e705feb2fe0e2c Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 14 八月 2025 20:47:04 +0800 Subject: [PATCH] art: 线边库管理,物料台账相关代码修改 --- src/views/lsw/modules/LswMaterialModal.vue | 5 src/views/base/WarehouseList.vue | 119 ++++--- src/views/base/modules/warehouse/WarehouseModel.vue | 137 ++++----- src/views/lsw/modules/LswMaterialForm.vue | 325 ++++++---------------- src/views/lsw/LswMateriaView.vue | 203 ++++++++++++-- src/views/system/DictList.vue | 4 6 files changed, 402 insertions(+), 391 deletions(-) diff --git a/src/views/base/WarehouseList.vue b/src/views/base/WarehouseList.vue index 38dde11..510079e 100644 --- a/src/views/base/WarehouseList.vue +++ b/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("璇疯缃畊rl.active!") + this.$message.error('璇疯缃畊rl.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; } diff --git a/src/views/base/modules/warehouse/WarehouseModel.vue b/src/views/base/modules/warehouse/WarehouseModel.vue index 2e3c80f..e8b6ce8 100644 --- a/src/views/base/modules/warehouse/WarehouseModel.vue +++ b/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: "", //淇濆瓨绾胯竟搴搃d + warehouseId: '', //淇濆瓨绾胯竟搴搃d 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() } diff --git a/src/views/lsw/LswMateriaView.vue b/src/views/lsw/LswMateriaView.vue index fdb4d69..adbb7c5 100644 --- a/src/views/lsw/LswMateriaView.vue +++ b/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 @@ // 鍗曢�夋ā寮忎笅锛宻electedRowKeys 鏄暟缁勶紝浣嗛暱搴︽渶澶氫负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> \ No newline at end of file diff --git a/src/views/lsw/modules/LswMaterialForm.vue b/src/views/lsw/modules/LswMaterialForm.vue index 98276bb..cb1d462 100644 --- a/src/views/lsw/modules/LswMaterialForm.vue +++ b/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) - }, - /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */ - 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) - } - }) - }) - }, - /** 鏁寸悊鎴恌ormData */ - 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> diff --git a/src/views/lsw/modules/LswMaterialModal.vue b/src/views/lsw/modules/LswMaterialModal.vue index b7b424f..4ec79d2 100644 --- a/src/views/lsw/modules/LswMaterialModal.vue +++ b/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'); diff --git a/src/views/system/DictList.vue b/src/views/system/DictList.vue index 30fc051..a5cd8c0 100644 --- a/src/views/system/DictList.vue +++ b/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"> -- Gitblit v1.9.3