From 7e0c515f1170d41a62dc73c1ea7c6cb4e40ce3c9 Mon Sep 17 00:00:00 2001 From: cuijian <cuijian@xalxzn.com> Date: 星期六, 28 六月 2025 21:58:33 +0800 Subject: [PATCH] 供应商管理、线边库管理、产线人员绑定 --- src/views/base/modules/FactoryManager/SelectUserModal.vue | 287 ++++++++ src/views/base/WarehouseList.vue | 356 ++++++++++ src/views/base/modules/supplier/SupplierModel.vue | 521 ++++++++++++++ src/views/base/FactoryManager.vue | 159 --- src/views/base/modules/warehouse/WarehouseModel.vue | 238 ++++++ src/views/base/SupplierList.vue | 383 ++++++++++ src/views/base/modules/FactoryManager/UserFactory.vue | 149 +-- 7 files changed, 1,871 insertions(+), 222 deletions(-) diff --git a/src/views/base/FactoryManager.vue b/src/views/base/FactoryManager.vue index d0048aa..c2f7347 100644 --- a/src/views/base/FactoryManager.vue +++ b/src/views/base/FactoryManager.vue @@ -7,11 +7,11 @@ <a-row style="margin-left: 14px"> <a-button @click="handleAdd(1)" type="primary">娣诲姞杞﹂棿</a-button> <a-button @click="handleAdd(2)" type="primary">娣诲姞涓嬬骇</a-button> - <a-button type="primary" icon="download" @click="handleExportXls('杞﹂棿淇℃伅')">瀵煎嚭</a-button> + <!-- <a-button type="primary" icon="download" @click="handleExportXls('杞﹂棿淇℃伅')">瀵煎嚭</a-button> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-button type="primary" icon="import">瀵煎叆</a-button> - </a-upload> + </a-upload> --> <a-button @click="handleDelete" v-if="selectedKeys.length>0">鍒犻櫎</a-button> <a-button title="鍒犻櫎澶氭潯鏁版嵁" @click="batchDel" v-if="checkedKeys.length>0">鎵归噺鍒犻櫎</a-button> <!--<a-button @click="refresh" type="default" icon="reload" :loading="loading">鍒锋柊</a-button>--> @@ -27,38 +27,11 @@ <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="璇疯緭鍏ヨ溅闂村悕绉�"/> <!-- 鏍�--> <a-col :md="10" :sm="24"> - <!--<template>--> - <!--<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">--> - <!--<span style="user-select: none">--> - <!--<a-tree--> - <!--checkable--> - <!--multiple--> - <!--@select="onSelect"--> - <!--@check="onCheck"--> - <!--@rightClick="rightHandle"--> - <!--:selectedKeys="selectedKeys"--> - <!--:checkedKeys="checkedKeys"--> - <!--:treeData="factoryTree"--> - <!--:checkStrictly="checkStrictly"--> - <!--:expandedKeys="iExpandedKeys"--> - <!--:autoExpandParent="autoExpandParent"--> - <!--@expand="onExpand"/>--> - <!--</span>--> - <!--<!–鏂板鍙抽敭鐐瑰嚮浜嬩欢,鍜屽鍔犳坊鍔犲拰鍒犻櫎鍔熻兘–>--> - - <!--<a-menu slot="overlay">--> - <!--<a-menu-item @click="handleAdd(3)" key="1">娣诲姞</a-menu-item>--> - <!--<a-menu-item @click="handleDelete" key="2">鍒犻櫎</a-menu-item>--> - <!--<a-menu-item @click="closeDrop" key="3">鍙栨秷</a-menu-item>--> - <!--</a-menu>--> - <!--</a-dropdown>--> - <!--</template>--> <a-tree checkable multiple @select="onSelect" @check="onCheck" - @rightClick="rightHandle" :selectedKeys="selectedKeys" :checkedKeys="checkedKeys" :treeData="factoryTree" @@ -128,9 +101,17 @@ </a-card> </a-tab-pane> - <!-- <a-tab-pane tab="璁惧鍒楄〃" key="2" forceRender> - <factory-equipment ref="departAuth"></factory-equipment> - </a-tab-pane> --> + <a-tab-pane tab="浜哄憳鍒楄〃" key="2" forceRender> + <user-factory ref="userFactory"></user-factory> + <!-- <a-card v-if="factoryCategory == '3'"> + <user-factory ref="userFactory"></user-factory> + </a-card> + <a-card v-else> + <a-empty> + <span slot="description"> 璇峰厛閫夋嫨涓�涓骇绾�! </span> + </a-empty> + </a-card> --> + </a-tab-pane> </a-tabs> </a-col> @@ -138,7 +119,7 @@ </a-row> </template> <script> - import FactoryEquipment from './modules/FactoryManager/FactoryEquipment' + import UserFactory from './modules/FactoryManager/UserFactory' import { queryFactoryTreeList, searchByKeywords, deleteByFactory } from '@/api/api' import { httpAction, deleteAction } from '@/api/manage' import { JeecgListMixin } from '@/mixins/JeecgListMixin' @@ -148,7 +129,7 @@ name: 'FactoryManager', mixins: [JeecgListMixin], components: { - FactoryEquipment, + UserFactory, FactoryModal }, data() { @@ -162,16 +143,10 @@ treeData: [], visible: false, factoryTree: [], - rightClickSelectedKey: '', - rightClickSelectedOrgCode: '', hiding: true, model: {}, - dropTrigger: '', - depart: {}, - disableSubmit: false, checkedKeys: [], selectedKeys: [], - autoIncr: 1, currSelected: {}, allTreeKeys: [], checkStrictly: true, @@ -198,7 +173,8 @@ importExcelUrl: '/base/factory/importExcel' }, orgCategoryDisabled: false, - isIncludesNotLeaf: false + isIncludesNotLeaf: false, + factoryCategory:'' } }, computed: { @@ -216,7 +192,6 @@ that.factoryTree = [] queryFactoryTreeList().then((res) => { if (res.success) { - //閮ㄩ棬鍏ㄩ�夊悗锛屽啀娣诲姞閮ㄩ棬锛岄�変腑鏁伴噺澧炲 this.allTreeKeys = [] for (let i = 0; i < res.result.length; i++) { let temp = res.result[i] @@ -224,7 +199,6 @@ that.factoryTree.push(temp) that.setThisExpandedKeys(temp) that.getAllKeys(temp) - // console.log(temp.id) } this.loading = false } @@ -242,40 +216,14 @@ this.loading = true this.loadTree() }, - // 鍙抽敭鎿嶄綔鏂规硶 - rightHandle({ event, node }) { - this.dropTrigger = 'contextmenu' - const record = node.dataRef - this.rightClickSelectedKey = record.id - this.rightClickSelected = record - this.rightClickSelectedOrgCode = record.orgCode - }, onExpand(expandedKeys) { - console.log('onExpand', expandedKeys) this.iExpandedKeys = expandedKeys this.autoExpandParent = false }, - backFlowList() { - this.$router.back(-1) - }, - // 鍙抽敭鐐瑰嚮涓嬫媺妗嗘敼鍙樹簨浠� - dropStatus(visible) { - if (visible == false) { - this.dropTrigger = '' - } - }, - // 鍙抽敭涓嬫媺鍏抽棴涓嬫媺妗� - closeDrop() { - this.dropTrigger = '' - }, - addRootNode() { - this.$refs.nodeModal.add(this.currFlowId, '') - }, + batchDel: function() { - console.log(this.checkedKeys) this.isIncludesNotLeaf = false this.includesNotLeaf(this.factoryTree) - console.log('isIncludesNotLeaf', this.isIncludesNotLeaf) // 涓簍rue鍒欒〃绀洪�変腑椤瑰寘鍚潪鍙跺瓙缁撶偣 false鍒欒〃绀洪�変腑椤瑰潎涓哄彾瀛愮粨鐐� if (!this.isIncludesNotLeaf) { @@ -355,17 +303,7 @@ } }, - nodeModalOk() { - this.loadTree() - }, - nodeModalClose() { - }, - hide() { - console.log(111) - this.visible = false - }, onCheck(checkedKeys, info) { - console.log('onCheck', checkedKeys, info) this.hiding = false //---- author:os_chengtgen -- date:20190827 -- for:鍒囨崲鐖跺瓙鍕鹃�夋ā寮� =======------ if (this.checkStrictly) { @@ -376,17 +314,20 @@ //---- author:os_chengtgen -- date:20190827 -- for:鍒囨崲鐖跺瓙鍕鹃�夋ā寮� =======------ }, onSelect(selectedKeys, e) { - console.log('selected', selectedKeys, e) this.hiding = false this.deleteTrigger = 'leftClick' let record = e.node.dataRef - console.log('onSelect-record', record) + this.factoryCategory = record.factoryCategory this.currSelected = Object.assign({}, record) this.model = this.currSelected this.selectedKeys = [record.key] this.model.parentId = record.parentId this.setValuesToForm(record) - this.$refs.departAuth.show(record.id) + if(record.factoryCategory == '3'){ + this.$refs.userFactory.show(record.id) + }else{ + this.$refs.userFactory.factoryId = '' + } }, // 瑙﹀彂onSelect浜嬩欢鏃�,涓洪儴闂ㄦ爲鍙充晶鐨刦orm琛ㄥ崟璧嬪�� setValuesToForm(record) { @@ -404,16 +345,7 @@ this.checkedKeys = [] this.currSelected = {} this.selectedKeys = [] - this.$refs.departAuth.departId = '' - }, - handleNodeTypeChange(val) { - this.currSelected.nodeType = val - }, - notifyTriggerTypeChange(value) { - this.currSelected.notifyTriggerType = value - }, - receiptTriggerTypeChange(value) { - this.currSelected.receiptTriggerType = value + this.$refs.userFactory.departId = '' }, submitCurrForm() { this.$refs.form.validate(valid => { @@ -450,22 +382,11 @@ this.$refs.form.resetFields() this.model = {} }, - nodeSettingFormSubmit() { - this.$refs.form.validate(valid => { - if (valid) { - console.log('Received values of form: ', this.model) - } - }) - }, - openSelect() { - this.$refs.sysDirectiveModal.show() - }, handleAdd(num) { if (num == 1) { this.$refs.departModal.add() this.$refs.departModal.title = '鏂板' } else if (num == 2) { - console.log(this.currSelected) let key = this.currSelected.key if (!key) { // this.$message.warning('璇峰厛鐐瑰嚮閫変腑涓婄骇杞﹂棿锛�') @@ -487,7 +408,7 @@ if (this.currSelected.leaf) { this.$confirm({ title: '纭鍒犻櫎', - content: `纭畾瑕佸垹闄� ${that.currSelected.productionName} 鍚�?`, + content: `纭畾瑕佸垹闄� ${that.currSelected.factoryName} 鍚�?`, onOk: function() { deleteByFactory({ id: that.currSelected.id }).then((resp) => { if (resp.success) { @@ -499,13 +420,8 @@ description: '鍒犻櫎鎴愬姛' }) that.loadTree() - //鍒犻櫎鍚庡悓姝ユ竻绌哄彸渚у熀鏈俊鎭唴瀹� - // let orgCode=that.model.orgCode; - // if(orgCode && orgCode === that.rightClickSelectedOrgCode){ that.onClearSelected() - // } } else { - // that.$message.warning('鍒犻櫎澶辫触!') that.$notification.warning({ message: '娑堟伅', description: '鍒犻櫎澶辫触' @@ -519,28 +435,6 @@ message: '娑堟伅', description: '姝よ溅闂村凡鎸傝浇瀛愯妭鐐�' }) - } - console.log('deletedRecord', deletedRecord) - }, - selectDirectiveOk(record) { - console.log('閫変腑鎸囦护鏁版嵁', record) - this.nodeSettingForm.setFieldsValue({ directiveCode: record.directiveCode }) - this.currSelected.sysCode = record.sysCode - }, - getFlowGraphData(node) { - this.graphDatasource.nodes.push({ - id: node.id, - text: node.flowNodeName - }) - if (node.children.length > 0) { - for (let a = 0; a < node.children.length; a++) { - let temp = node.children[a] - this.graphDatasource.edges.push({ - source: node.id, - target: temp.id - }) - this.getFlowGraphData(temp) - } } }, //---- author:os_chengtgen -- date:20190827 -- for:鍒囨崲鐖跺瓙鍕鹃�夋ā寮� =======------ @@ -566,7 +460,6 @@ } }, getAllKeys(node) { - // console.log('node',node); this.allTreeKeys.push(node.key) if (node.children && node.children.length > 0) { for (let a = 0; a < node.children.length; a++) { diff --git a/src/views/base/SupplierList.vue b/src/views/base/SupplierList.vue new file mode 100644 index 0000000..701e9a6 --- /dev/null +++ b/src/views/base/SupplierList.vue @@ -0,0 +1,383 @@ +<template> + <a-card + :bordered="false" + title="渚涘簲鍟�" + > + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form + layout="inline" + @keyup.enter.native="searchQuery" + > + <a-row :gutter="30"> + + <a-col + :md="6" + :sm="24" + > + <a-form-item label="渚涘簲鍟嗙紪鍙�"> + <j-input + placeholder="璇疯緭鍏ヤ緵搴斿晢缂栧彿妫�绱�" + v-model="queryParam.supplierCode" + ></j-input> + </a-form-item> + </a-col> + + <a-col + :md="6" + :sm="24" + > + <a-form-item label="渚涘簲鍟嗗悕绉�"> + <j-input + placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О妫�绱�" + v-model="queryParam.supplierName" + ></j-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </div> + + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button + type="primary" + @click="searchQuery" + icon="search" + >鏌ヨ</a-button> + <a-button + type="primary" + @click="searchReset" + icon="reload" + >閲嶇疆</a-button> + <a-button + @click="handleAdd" + type="primary" + icon="plus" + >鏂板</a-button> + </div> + + <!-- table鍖哄煙-begin --> + <div> + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + filterMultiple="filterMultiple" + :columns="columns" + :rowClassName="tableRowClass" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}" + @change="handleTableChange" + :customRow="clickThenCheck" + > + <span + slot="partCount" + slot-scope="text,record" + class="fontweight" + > + {{record.partCount}} + </span> + <!--鐘舵�佹爮涓�у睍绀�--> + <span + slot="status" + slot-scope="text,record" + > + <a-badge + v-if="record.supplierStatus==1" + status="success" + /> + <span + v-if="record.supplierStatus==1" + class="success" + >鍚敤</span> + <a-badge + v-if="record.supplierStatus==0" + status="error" + /> + <span + v-if="record.supplierStatus==0" + class="error" + >绂佺敤</span> + </span> + <span + slot="action" + slot-scope="text, record" + > + <a + href="javascript:;" + @click="handleDetail(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="handleEdit(record)">缂栬緫</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(record.id)" + > + <a>鍒犻櫎</a> + </a-popconfirm> + + </a-menu-item> + <a-menu-item v-if="record.supplierStatus == 0"> + <a-popconfirm + title="纭畾鍚敤鍚�?" + @confirm="() => handleActive(record.id)" + > + <a>鍚敤</a> + </a-popconfirm> + </a-menu-item> + <a-menu-item v-if="record.supplierStatus == 1"> + <a-popconfirm + title="纭畾绂佺敤鍚�?" + @confirm="() => handleActive(record.id)" + > + <a>绂佺敤</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + <!-- table鍖哄煙-end --> + + <!-- 琛ㄥ崟鍖哄煙 --> + <supplier-model + ref="modalForm" + @ok="modalFormOk" + ></supplier-model> + </a-card> +</template> + +<script> +//鎸夐渶寮曞叆 缁勪欢 +import SupplierModel from './modules/supplier/SupplierModel' + +import { deleteAction, requestPut, getAction } from '@/api/manage' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import JEllipsis from '@/components/jeecg/JEllipsis' +import JInput from '@/components/jeecg/JInput' + +export default { + name: 'SupplierList', + mixins: [JeecgListMixin], + components: { + SupplierModel, + JEllipsis, + JInput, + }, + data() { + return { + selectedRowRecord: {}, + dataSource: [], + partCount: "", + /* 鍒嗛〉鍙傛暟 */ + ipagination: { + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '20'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '渚涘簲鍟嗙紪鍙�', + align: "center", + dataIndex: 'supplierCode' + }, + { + title: '渚涘簲鍟嗗悕绉�', + align: "center", + dataIndex: 'supplierName' + }, + { + title: '鍥藉', + align: 'center', + dataIndex: 'country' + }, + { + title: '鐪佷唤', + align: 'center', + dataIndex: 'province' + }, + { + title: '鍩庡競', + align: 'center', + dataIndex: 'city' + }, + { + title: '璇︾粏鍦板潃', + align: 'center', + dataIndex: 'address' + }, + { + title: '鑱旂郴浜�', + align: 'center', + dataIndex: 'contact' + }, + { + title: '鐢佃瘽', + align: 'center', + dataIndex: 'phone' + }, + { + width: 100, + title: '鐘舵��', + align: 'center', + scopedSlots: { + customRender: 'status', + }, + dataIndex: 'supplierStatus' + }, + { + width: 150, + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' }, + } + ], + type: "radio", + url: { + list: '/base/supplier/list', + delete: '/base/supplier/delete', + active: '/base/supplier/active', + }, + } + }, + mounted() { + this.$bus.$on('refreshParentPage', (data) => { + this.loadData(); + }) + }, + methods: { + loadData(arg) { + if (arg === 1) { + this.ipagination.current = 1; + } + 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; + } + if (res.code === 510) { + this.$message.warning(res.message) + } + this.loading = false; + }) + }, + //绂佺敤鐘舵�佹牱寮� + tableRowClass(record, index) { + if (record.supplierStatus != "1") { + return "frozenRowClass"; + } + return ""; + }, + //鍚敤绂佺敤 + handleActive(id) { + if (!this.url.active) { + this.$message.error("璇疯缃畊rl.active!") + return + } + let that = this; + requestPut(that.url.active, {}, { id: id }).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.loadData(); + } else { + that.$message.warning(res.message); + } + }); + }, + clickThenCheck(record) { + return { + on: { + click: (e) => { + this.selectedRowRecord = record; + this.onSelectChange(record.id.split(","), [record]); + } + } + }; + }, + onSelectChange(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + }, + }, + +} +</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; +} + +.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/base/WarehouseList.vue b/src/views/base/WarehouseList.vue new file mode 100644 index 0000000..cfbe06e --- /dev/null +++ b/src/views/base/WarehouseList.vue @@ -0,0 +1,356 @@ +<template> + <a-card + :bordered="false" + title="渚涘簲鍟�" + > + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form + layout="inline" + @keyup.enter.native="searchQuery" + > + <a-row :gutter="30"> + + <a-col + :md="6" + :sm="24" + > + <a-form-item label="浠撳簱缂栧彿"> + <j-input + placeholder="璇疯緭鍏ヤ粨搴撶紪鍙锋绱�" + v-model="queryParam.warehouseCode" + ></j-input> + </a-form-item> + </a-col> + + <a-col + :md="6" + :sm="24" + > + <a-form-item label="浠撳簱鍚嶇О"> + <j-input + placeholder="璇疯緭鍏ヤ粨搴撳悕绉版绱�" + v-model="queryParam.warehouseName" + ></j-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </div> + + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button + type="primary" + @click="searchQuery" + icon="search" + >鏌ヨ</a-button> + <a-button + type="primary" + @click="searchReset" + icon="reload" + >閲嶇疆</a-button> + <a-button + @click="handleAdd" + type="primary" + icon="plus" + >鏂板</a-button> + </div> + + <!-- table鍖哄煙-begin --> + <div> + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + filterMultiple="filterMultiple" + :columns="columns" + :rowClassName="tableRowClass" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}" + @change="handleTableChange" + :customRow="clickThenCheck" + > + <span + slot="partCount" + slot-scope="text,record" + class="fontweight" + > + {{record.partCount}} + </span> + <!--鐘舵�佹爮涓�у睍绀�--> + <span + slot="status" + slot-scope="text,record" + > + <a-badge + v-if="record.warehouseStatus==1" + status="success" + /> + <span + v-if="record.warehouseStatus==1" + class="success" + >鍚敤</span> + <a-badge + v-if="record.warehouseStatus==0" + status="error" + /> + <span + v-if="record.warehouseStatus==0" + class="error" + >绂佺敤</span> + </span> + <span + slot="action" + slot-scope="text, record" + > + <a + href="javascript:;" + @click="handleDetail(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="handleEdit(record)">缂栬緫</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(record.id)" + > + <a>鍒犻櫎</a> + </a-popconfirm> + + </a-menu-item> + <a-menu-item v-if="record.warehouseStatus == 0"> + <a-popconfirm + title="纭畾鍚敤鍚�?" + @confirm="() => handleActive(record.id)" + > + <a>鍚敤</a> + </a-popconfirm> + </a-menu-item> + <a-menu-item v-if="record.warehouseStatus == 1"> + <a-popconfirm + title="纭畾绂佺敤鍚�?" + @confirm="() => handleActive(record.id)" + > + <a>绂佺敤</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + <!-- table鍖哄煙-end --> + + <!-- 琛ㄥ崟鍖哄煙 --> + <warehouse-model + ref="modalForm" + @ok="modalFormOk" + ></warehouse-model> + </a-card> +</template> + +<script> +//鎸夐渶寮曞叆 缁勪欢 +import WarehouseModel from './modules/warehouse/WarehouseModel' + +import { deleteAction, requestPut, getAction } from '@/api/manage' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import JEllipsis from '@/components/jeecg/JEllipsis' +import JInput from '@/components/jeecg/JInput' + +export default { + name: 'WarehouseList', + mixins: [JeecgListMixin], + components: { + WarehouseModel, + JEllipsis, + JInput, + }, + data() { + return { + selectedRowRecord: {}, + dataSource: [], + partCount: "", + /* 鍒嗛〉鍙傛暟 */ + ipagination: { + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '20'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + total: 0 + }, + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '绾胯竟搴撶紪鍙�', + align: "center", + dataIndex: 'warehouseCode' + }, + { + title: '绾胯竟搴撳悕绉�', + align: "center", + dataIndex: 'warehouseName' + }, + { + title: '浜х嚎', + align: 'center', + dataIndex: 'factoryId_dictText' + }, + { + width: 100, + title: '鐘舵��', + align: 'center', + scopedSlots: { + customRender: 'status', + }, + dataIndex: 'warehouseStatus' + }, + { + width: 150, + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' }, + } + ], + type: "radio", + url: { + list: '/base/lineSideWarehouse/list', + delete: '/base/lineSideWarehouse/delete', + active: '/base/lineSideWarehouse/active', + }, + } + }, + mounted() { + this.$bus.$on('refreshParentPage', (data) => { + this.loadData(); + }) + }, + methods: { + loadData(arg) { + if (arg === 1) { + this.ipagination.current = 1; + } + 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; + } + if (res.code === 510) { + this.$message.warning(res.message) + } + this.loading = false; + }) + }, + //绂佺敤鐘舵�佹牱寮� + tableRowClass(record, index) { + if (record.warehouseStatus != "1") { + return "frozenRowClass"; + } + return ""; + }, + //鍚敤绂佺敤 + handleActive(id) { + if (!this.url.active) { + this.$message.error("璇疯缃畊rl.active!") + return + } + let that = this; + requestPut(that.url.active, {}, { id: id }).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.loadData(); + } else { + that.$message.warning(res.message); + } + }); + }, + clickThenCheck(record) { + return { + on: { + click: (e) => { + this.selectedRowRecord = record; + this.onSelectChange(record.id.split(","), [record]); + } + } + }; + }, + onSelectChange(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys; + }, + }, + +} +</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; +} + +.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/base/modules/FactoryManager/SelectUserModal.vue b/src/views/base/modules/FactoryManager/SelectUserModal.vue new file mode 100644 index 0000000..4a374c6 --- /dev/null +++ b/src/views/base/modules/FactoryManager/SelectUserModal.vue @@ -0,0 +1,287 @@ +<template> + <div> + <a-modal + centered + :title="title" + :width="1000" + :visible="visible" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + + <a-col :span="10"> + <a-form-item label="鐢ㄦ埛璐﹀彿"> + <a-input placeholder="璇疯緭鍏ョ敤鎴疯处鍙�" v-model="queryParam.username"></a-input> + </a-form-item> + </a-col> + <a-col :span="8"> + <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> + </span> + </a-col> + + </a-row> + </a-form> + </div> + <!-- table鍖哄煙-begin --> + <div> + <a-table + size="small" + bordered + rowKey="id" + :columns="columns1" + :dataSource="dataSource1" + :pagination="ipagination" + :loading="loading" + :scroll="{ y: 240 }" + :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}" + @change="handleTableChange"> + + </a-table> + </div> + <!-- table鍖哄煙-end --> + + + </a-modal> + </div> +</template> + +<script> + import {filterObj} from '@/utils/util' + import {getAction} from '@/api/manage' + + export default { + name: "SelectUserModal", + data() { + return { + title: "娣诲姞浜х嚎浜哄憳", + names: [], + visible: false, + placement: 'right', + description: '', + // 鏌ヨ鏉′欢 + queryParam: {}, + // 琛ㄥご + columns1: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 50, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '鐢ㄦ埛璐﹀彿', + align: "center", + width: 100, + dataIndex: 'username' + }, + { + title: '鐢ㄦ埛鍚嶇О', + align: "center", + width: 100, + dataIndex: 'realname' + }, + { + title: '鎬у埆', + align: "center", + width: 100, + dataIndex: 'sex_dictText' + }, + { + title: '鐢佃瘽', + align: "center", + width: 100, + dataIndex: 'phone' + }, + { + title: '閮ㄩ棬', + align: "center", + width: 150, + dataIndex: 'orgCode' + } + ], + columns2: [ + { + title: '鐢ㄦ埛璐﹀彿', + align: "center", + dataIndex: 'username', + + }, + { + title: '鐢ㄦ埛鍚嶇О', + align: "center", + dataIndex: 'realname', + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: "center", + width: 100, + scopedSlots: {customRender: 'action'}, + } + ], + //鏁版嵁闆� + dataSource1: [], + dataSource2: [], + // 鍒嗛〉鍙傛暟 + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + isorter: { + column: 'createTime', + order: 'desc', + }, + loading: false, + selectedRowKeys: [], + selectedRows: [], + url: { + list: "/sys/user/list", + } + } + }, + created() { + this.loadData(); + }, + methods: { + searchQuery() { + this.loadData(1); + }, + searchReset() { + this.queryParam = {}; + this.loadData(1); + }, + handleCancel() { + this.visible = false; + }, + handleOk() { + this.dataSource2 = this.selectedRowKeys; + console.log("data:" + this.dataSource2); + this.$emit("selectFinished", this.dataSource2); + this.visible = false; + }, + add() { + this.visible = true; + }, + loadData(arg) { + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource1 = res.result.records; + this.ipagination.total = res.result.total; + } + }) + }, + getQueryParams() { + var param = Object.assign({}, this.queryParam, this.isorter); + param.field = this.getQueryField(); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + return filterObj(param); + }, + getQueryField() { + //TODO 瀛楁鏉冮檺鎺у埗 + }, + onSelectAll(selected, selectedRows, changeRows) { + if (selected === true) { + for (var a = 0; a < changeRows.length; a++) { + this.dataSource2.push(changeRows[a]); + } + } else { + for (var b = 0; b < changeRows.length; b++) { + this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1); + } + } + // console.log(selected, selectedRows, changeRows); + }, + onSelect(record, selected) { + if (selected === true) { + this.dataSource2.push(record); + } else { + var index = this.dataSource2.indexOf(record); + //console.log(); + if (index >= 0) { + this.dataSource2.splice(this.dataSource2.indexOf(record), 1); + } + + } + }, + onSelectChange(selectedRowKeys, selectedRows) { + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectedRows; + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + }, + handleDelete: function (record) { + this.dataSource2.splice(this.dataSource2.indexOf(record), 1); + }, + handleTableChange(pagination, filters, sorter) { + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + console.log(sorter); + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" + } + this.ipagination = pagination; + this.loadData(); + } + } + } +</script> +<style lang="less" scoped> + .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 + } + + .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/base/modules/FactoryManager/FactoryEquipment.vue b/src/views/base/modules/FactoryManager/UserFactory.vue similarity index 63% rename from src/views/base/modules/FactoryManager/FactoryEquipment.vue rename to src/views/base/modules/FactoryManager/UserFactory.vue index c9ada63..fc69a7d 100644 --- a/src/views/base/modules/FactoryManager/FactoryEquipment.vue +++ b/src/views/base/modules/FactoryManager/UserFactory.vue @@ -1,16 +1,16 @@ <template> <a-card :bordered="false"> - <template v-if="this.productionId"> + <template v-if="this.factoryId"> <div class="table-page-search-wrapper"> <a-form layout="inline" @keyup.enter.native="searchQuery"> <a-row :gutter="24"> - <a-col :md="6" :sm="12"> - <a-form-item label="璁惧缂栧彿"> - <a-input placeholder="璇疯緭鍏ヨ澶囩紪鍙�" v-model="queryParam.equipmentId"></a-input> + <a-col :md="12" :sm="12"> + <a-form-item label="浜哄憳缂栧彿"> + <a-input placeholder="璇疯緭鍏ヤ汉鍛樼紪鍙�" v-model="queryParam.username"></a-input> </a-form-item> </a-col> - <a-col :md="6" :sm="8"> + <a-col :md="12" :sm="12"> <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-col> @@ -18,6 +18,8 @@ </a-form> </div> <div class="table-operator" style="border-top: 5px"> + <a-button @click="handleAddUserFactory" type="primary" icon="plus" style="margin-top: 16px">娣诲姞浜х嚎浜哄憳</a-button> + <a-dropdown v-if="selectedRowKeys.length > 0"> <a-menu slot="overlay" @click="handleMenuClick"> <a-menu-item key="1"> @@ -44,12 +46,6 @@ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" @change="handleTableChange"> - <!--<template slot="avatarslot" slot-scope="text, record, index">--> - <!--<div class="anty-img-wrap">--> - <!--<a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>--> - <!--</div>--> - <!--</template>--> - <span slot="action" slot-scope="text, record"> <a-popconfirm title="纭畾绉婚櫎鍚�?" @confirm="() => handleDelete(record.id)"> <a>绉婚櫎</a> @@ -59,21 +55,24 @@ </template> <a-card v-else :bordered="false" style="height:200px"> <a-empty> - <span slot="description"> 璇峰厛閫夋嫨涓�涓儴闂�! </span> + <span slot="description"> 璇峰厛閫夋嫨涓�涓骇绾�! </span> </a-empty> </a-card> + <Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal> </a-card> </template> <script> import { filterObj } from '@/utils/util'; - import {queryTreeListForRole,queryDepartPermission,saveDepartPermission} from '@/api/api' import {JeecgListMixin} from '@/mixins/JeecgListMixin' - import { getAction,postAction } from '@/api/manage' - import qs from 'qs' + import { getAction,postAction,deleteAction } from '@/api/manage' + import SelectUserModal from './SelectUserModal' export default { - name: 'FactoryEquipment', + name: 'UserFactory', mixins: [JeecgListMixin], + components: { + SelectUserModal + }, data(){ return { queryParam:{}, @@ -89,34 +88,17 @@ } }, { - title: '璁惧缂栧彿', + title: '浜哄憳缂栧彿', align: "center", - dataIndex: 'equipmentId', + dataIndex: 'username', width: 120, - // sorter: true }, { - title: '璁惧鍚嶇О', + title: '浜哄憳鍚嶇О', align: "center", width: 150, - dataIndex: 'equipmentName', + dataIndex: 'realname', }, - { - title: '璁惧绫诲瀷', - align: "center", - width: 120, - dataIndex: 'equipmentType', - // scopedSlots: {customRender: "avatarslot"} - }, - - { - title: '椹卞姩绫诲瀷', - align: "center", - width: 80, - dataIndex: 'driveType', - // sorter: true - }, - { title: '鎿嶄綔', dataIndex: 'action', @@ -127,22 +109,23 @@ ], disableMixinCreated:true, - productionId:"", - title:"閮ㄩ棬鏉冮檺閰嶇疆", + factoryId:"", + title:"浜х嚎浜哄憳閰嶇疆", visible: false, loading: false, url:{ - list:'/mdc/mdcEquipment/equipmentListByProduction', - removeEquipmentForDepart:'/mdc/mdcEquipment/removeEquipmentForProduction', + list:'/sys/user/userFactoryList', + deleteUserFactory:'/sys/user/deleteUserFactory', serachEquipment:'/mdc/mdcEquipment/equipmentListByProduction', - removeEquipmentsForProduction:"/mdc/mdcEquipment/removeEquipmentsForProduction" + deleteBatch:"/sys/user/deleteUserFactoryBatch", + addUserFactory:'/sys/user/addBaseUserFactory' } } }, methods: { - show(productionId){ - this.productionId=productionId + show(factoryId){ + this.factoryId=factoryId this.loadData(); }, close () { @@ -155,39 +138,14 @@ this.loadData(); }, searchQuery() { - var id = this.queryParam.equipmentId this.loading = true; var params = this.getQueryParams();//鏌ヨ鏉′欢 params.pageNo = this.ipagination.current; params.pageSize = this.ipagination.pageSize; - getAction(this.url.serachEquipment,{equipmentId:this.queryParam.equipmentId,productionId:this.productionId,pageNo:params.pageNo,pageSize:params.pageSize}).then((res)=>{ - if (res.success) { - // console.log(res) - //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ - this.dataSource = res.result.records||res.result; - if(res.result.total) - { - this.ipagination.total = res.result.total; - }else{ - this.ipagination.total = 0; - } - //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ - }else{ - // this.$message.warning(res.message) - this.$notification.warning({ - message:'娑堟伅', - description:res.message - }); - } - }).finally(() => { - this.loading = false - }) + this.loadData(); }, handleTableChange(pagination, filters, sorter) { - //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 - //TODO 绛涢�� - // console.log(pagination) if (Object.keys(sorter).length > 0) { this.isorter.column = sorter.field; this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" @@ -196,19 +154,12 @@ this.loadData(); }, loadData(){ - //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 - // if (arg === 1) { - // this.ipagination.current = 1; - // } var params = this.getQueryParams();//鏌ヨ鏉′欢 - params.pageNo = this.ipagination.current; params.pageSize = this.ipagination.pageSize; this.loading = true; getAction(this.url.list,params).then((res)=>{ if (res.success) { - // console.log(res) - //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ this.dataSource = res.result.records||res.result; if(res.result.total) { @@ -216,9 +167,7 @@ }else{ this.ipagination.total = 0; } - //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ }else{ - // this.$message.warning(res.message) this.$notification.warning({ message:'娑堟伅', description:res.message @@ -239,7 +188,7 @@ param.field = this.getQueryField(); param.pageNo = this.ipagination.current; param.pageSize = this.ipagination.pageSize; - param.productionId = this.productionId; + param.factoryId = this.factoryId; //鑾峰彇鐢ㄦ埛瀹氬埗鐨勫弬鏁板睘鎬� if (this.getCustomQueryParams) { param = this.getCustomQueryParams(param); @@ -250,15 +199,15 @@ return filterObj(param); }, - handleDelete(equipmentId){ + handleDelete(id){ - postAction(this.url.removeEquipmentForDepart,qs.stringify({productionId:this.productionId,equipmentId:equipmentId})).then((res)=>{ + deleteAction(this.url.deleteUserFactory,{factoryId:this.factoryId,userId:id}).then((res)=>{ if (res.success) { this.$notification.success({ message:'娑堟伅', description:res.message }); - this.loadData(this.productionId); + this.loadData(this.factoryId); }else{ this.$notification.warning({ message:'娑堟伅', @@ -275,8 +224,8 @@ } }, batchDel: function () { - if(!this.url.removeEquipmentsForProduction){ - this.$message.error("璇疯缃畊rl.removeEquipmentsForProduction灞炴��!") + if(!this.url.deleteBatch){ + this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!") return } if (this.selectedRowKeys.length <= 0) { @@ -297,19 +246,17 @@ content: "鏄惁鍒犻櫎閫変腑鏁版嵁?", onOk: function () { that.loading = true; - postAction(that.url.removeEquipmentsForProduction,qs.stringify({productionId:that.productionId,equipmentIds:ids})).then((res) => { + deleteAction(that.url.deleteBatch,{factoryId:that.factoryId,userIds:ids}).then((res) => { if (res.success) { //閲嶆柊璁$畻鍒嗛〉闂 that.reCalculatePage(that.selectedRowKeys.length) - // that.$message.success(res.message); this.$notification.success({ message:'娑堟伅', description:res.message }); - that.loadData(that.productionId); + that.loadData(that.factoryId); that.onClearSelected(); } else { - // that.$message.warning(res.message); this.$notification.warning({ message:'娑堟伅', description:res.message @@ -322,6 +269,30 @@ }); } }, + handleAddUserFactory() { + if (this.factoryId == '') { + this.$message.error('璇烽�夋嫨涓�涓骇绾�!') + } else { + this.$refs.selectUserModal.visible = true + } + }, + selectOK(data) { + let params = {} + params.factoryId = this.factoryId + params.userIdList = [] + for (var a = 0; a < data.length; a++) { + params.userIdList.push(data[a]) + } + console.log(params) + postAction(this.url.addUserFactory, params).then((res) => { + if (res.success) { + this.loadData() + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }) + }, }, } </script> diff --git a/src/views/base/modules/supplier/SupplierModel.vue b/src/views/base/modules/supplier/SupplierModel.vue new file mode 100644 index 0000000..098050f --- /dev/null +++ b/src/views/base/modules/supplier/SupplierModel.vue @@ -0,0 +1,521 @@ +<template> + <a-modal + :title="title" + :width="800" + :visible="visible" + :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + > + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="渚涘簲鍟嗙紪鍙�" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ヤ緵搴斿晢缂栧彿" + v-decorator="['supplierCode', validatorRules.supplierCode ]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="渚涘簲鍟嗗悕绉�" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" + v-decorator="['supplierName', validatorRules.supplierName ]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鍥藉" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ュ浗瀹�" + v-decorator="['country', validatorRules.country ]" + /> + <!-- <j-dict-select-tag + :disabled="disableSubmit" + placeholder="璇烽�夋嫨鍥藉" + :triggerChange="true" + dictCode="country_list" + v-decorator="['country', validatorRules.country]" + /> --> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鐪佷唤" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ョ渷浠�" + v-decorator="['province', validatorRules.province ]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鍩庡競" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ュ煄甯�" + v-decorator="['city', validatorRules.city ]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鑱旂郴浜�" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ヨ仈绯讳汉" + v-decorator="['contact', validatorRules.contact]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="璇︾粏鍦板潃" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" + v-decorator="['address', validatorRules.address]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="閭" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ラ偖绠�" + v-decorator="['email', validatorRules.email]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="閭紪" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ラ偖缂�" + v-decorator="['postcode', validatorRules.postcode]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="浼犵湡" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ヤ紶鐪�" + v-decorator="['fax', validatorRules.fax]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鎵嬫満鍙风爜" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" + v-decorator="['phone', validatorRules.phone]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鍏徃鐢佃瘽" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ュ叕鍙哥數璇�" + v-decorator="['companyTelephone', validatorRules.companyTelephone]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="瀹樻柟缃戠珯" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ュ畼鏂圭綉绔�" + v-decorator="['officialWebsite', validatorRules.officialWebsite]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="澶囨敞" + > + <a-textarea + :readOnly="disableSubmit" + placeholder="璇疯緭鍏ュ娉�" + allow-clear + v-decorator="['remark', validatorRules.remark]" + /> + </a-form-item> + </a-col> + </a-row> + + </a-form> + </a-spin> + </a-modal> +</template> + +<script> +import { httpAction, getAction } from '@/api/manage' +import JDate from '@/components/jeecg/JDate' +import pick from 'lodash.pick' +import moment from 'moment' +import { duplicateCheck } from '@/api/api'//閲嶅鏍¢獙 +import JTreeDict from '@/components/jeecg/JTreeDict'//鍒嗙被瀛楀吀鏍戝舰涓嬫媺缁勪欢 + +export default { + name: "SpplierModal", + components: { + JDate, + JTreeDict, + }, + data() { + return { + editorValue: '', + title: "鎿嶄綔", + visible: false, + disableSubmit: false, + model: {}, + treeData: [], + supplierId: "", //淇濆瓨渚涘簲鍟唅d + labelCol: { + xs: { span: 24 }, + sm: { span: 6 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 }, + }, + + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + supplierCode: { + rules: [ + { required: true, message: '璇疯緭鍏ョ紪鍙�' }, + { min: 2, max: 30, message: '闀垮害鍦� 2 鍒� 30 涓瓧绗�', trigger: 'blur' }, + { validator: this.validateNum }, + ] + }, + supplierName: { + rules: [ + { required: true, message: '璇疯緭鍏ュ悕绉�' }, + { min: 0, max: 64, message: '闀垮害涓嶈秴杩� 64 涓瓧绗�', trigger: 'blur' }, + { validator: this.validateName }, + ] + }, + country: { + rules: [ + { required: true, message: '璇烽�夋嫨鍥藉' }, + ] + }, + address: { + rules: [ + { min: 0, max: 100, message: '鏈�闀� 100 涓瓧绗�', trigger: 'blur' }, + ] + }, + postcode: { + rules: [ + { pattern: /^[0-9]{6}$/, message: '璇疯緭鍏ユ纭偖缂�' }, + ] + }, + email: { + rules: [ + { validator: this.validateEmail }, + ] + }, + contact: { + rules: [ + { min: 0, max: 30, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' }, + ] + }, + fax: { + rules: [ + { min: 0, max: 30, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' }, + // { pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '璇疯緭鍏ユ纭紶鐪�' }, + ] + }, + phone: { + rules: [ + { validator: this.validatePhone }, + ] + }, + companyTelephone: { + rules: [ + { min: 0, max: 30, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' }, + // { pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '璇疯緭鍏ユ纭骇鏈哄彿鐮�' }, + ] + }, + officialWebsite: { + rules: [ + { pattern: /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, message: '璇疯緭鍏ユ纭綉缁滃湴鍧�' }, + ] + }, + remark: { + rules: [ + { min: 0, max: 100, message: '鏈�闀� 100 涓瓧绗�', trigger: 'blur' }, + ] + }, + }, + url: { + add: "/base/supplier/add", + edit: "/base/supplier/edit", + }, + } + }, + created() { + }, + methods: { + add() { + this.edit({}); + }, + edit(record) { + this.form.resetFields(); + this.model = Object.assign({}, record); + this.supplierId = record.id; + this.visible = true; + this.$nextTick(() => { + this.form.setFieldsValue( + pick(this.model, 'supplierCode', 'supplierName', 'country','province','city', 'address', 'contact', 'postcode', 'fax', 'email', 'phone', 'companyTelephone', 'officialWebsite', 'remark') + ) + //鏃堕棿鏍煎紡鍖� + }); + }, + close() { + this.$emit('close'); + this.visible = false; + }, + handleOk() { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if (!this.model.id) { + httpurl += this.url.add; + method = 'post'; + } else { + httpurl += this.url.edit; + method = 'put'; + } + let formData = Object.assign(this.model, values); + httpAction(httpurl, formData, method).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.$emit('ok'); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + } + }) + }, + handleCancel() { + this.close() + }, + //楠岃瘉 缂栧彿 + validateNum(rule, value, callback) { + var params = { + tableName: 'base_supplier', + fieldName: 'supplier_code', + fieldVal: value, + dataId: this.supplierId, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true', + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback(); + } else { + callback("渚涘簲鍟嗙紪鍙峰凡瀛樺湪!"); + } + }) + }, + //楠岃瘉 鍚嶇О + validateName(rule, value, callback) { + var params = { + tableName: 'base_supplier', + fieldName: 'supplier_name', + fieldVal: value, + dataId: this.supplierId, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true', + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback(); + } else { + callback("渚涘簲鍟嗗悕绉板凡瀛樺湪!"); + } + }) + }, + //楠岃瘉 鎵嬫満鍙� + validatePhone(rule, value, callback) { + if (!value) { + callback() + } else { + //[05] 鎵嬫満鍙蜂笉鏀寔199鍙风爜娈�-------------------- + if (new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)) { + var params = { + tableName: 'base_supplier', + fieldName: 'phone', + fieldVal: value, + dataId: this.supplierId + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback("鎵嬫満鍙峰凡瀛樺湪!") + } + }) + } else { + callback("璇疯緭鍏ユ纭牸寮忕殑鎵嬫満鍙风爜!"); + } + } + }, + //楠岃瘉 Email + validateEmail(rule, value, callback) { + if (!value) { + callback() + } else { + if (new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)) { + var params = { + tableName: 'base_supplier', + fieldName: 'email', + fieldVal: value, + dataId: this.supplierId + }; + duplicateCheck(params).then((res) => { + console.log(res) + if (res.success) { + callback() + } else { + callback("閭宸插瓨鍦�!") + } + }) + } else { + callback("璇疯緭鍏ユ纭牸寮忕殑閭!") + } + } + }, + } +} +</script> + +<style scoped> +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file diff --git a/src/views/base/modules/warehouse/WarehouseModel.vue b/src/views/base/modules/warehouse/WarehouseModel.vue new file mode 100644 index 0000000..dfde18b --- /dev/null +++ b/src/views/base/modules/warehouse/WarehouseModel.vue @@ -0,0 +1,238 @@ +<template> + <a-modal + :title="title" + :width="800" + :visible="visible" + :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + > + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="绾胯竟搴撶紪鍙�" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ョ嚎杈瑰簱缂栧彿" + v-decorator="['warehouseCode', validatorRules.warehouseCode ]" + /> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="绾胯竟搴撳悕绉�" + > + <a-input + :readOnly="disableSubmit" + allow-clear + placeholder="璇疯緭鍏ョ嚎杈瑰簱鍚嶇О" + v-decorator="['warehouseName', validatorRules.warehouseName ]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="浜х嚎" + > + <j-dict-select-tag + type="list" + v-model="model.factoryId" + :trigger-change="true" + dictCode="base_factory,factory_name,id" + placeholder="璇烽�夋嫨浜х嚎" + /> + </a-form-item> + </a-col> + </a-row> + </a-form> + </a-spin> + </a-modal> +</template> + +<script> +import { httpAction, getAction } from '@/api/manage' +import JDate from '@/components/jeecg/JDate' +import pick from 'lodash.pick' +import moment from 'moment' +import { duplicateCheck } from '@/api/api'//閲嶅鏍¢獙 +import JTreeDict from '@/components/jeecg/JTreeDict'//鍒嗙被瀛楀吀鏍戝舰涓嬫媺缁勪欢 + +export default { + name: "WarehouseModal", + components: { + JDate, + JTreeDict, + }, + data() { + return { + title: "鎿嶄綔", + visible: false, + disableSubmit: false, + model: {}, + treeData: [], + warehouseId: "", //淇濆瓨绾胯竟搴搃d + labelCol: { + xs: { span: 24 }, + sm: { span: 6 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 }, + }, + + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + warehouseCode: { + rules: [ + { required: true, message: '璇疯緭鍏ョ嚎杈瑰簱缂栧彿' }, + { min: 2, max: 30, message: '闀垮害鍦� 2 鍒� 30 涓瓧绗�', trigger: 'blur' }, + { validator: this.validateNum }, + ] + }, + warehouseName: { + rules: [ + { required: true, message: '璇疯緭鍏ョ嚎杈瑰簱鍚嶇О' }, + { min: 0, max: 64, message: '闀垮害涓嶈秴杩� 64 涓瓧绗�', trigger: 'blur' }, + { validator: this.validateName }, + ] + }, + }, + url: { + add: "/base/lineSideWarehouse/add", + edit: "/base/lineSideWarehouse/edit", + }, + } + }, + created() { + }, + methods: { + add() { + this.edit({}); + }, + edit(record) { + 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; + }, + handleOk() { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if (!this.model.id) { + httpurl += this.url.add; + method = 'post'; + } else { + httpurl += this.url.edit; + method = 'put'; + } + let formData = Object.assign(this.model, values); + httpAction(httpurl, formData, method).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.$emit('ok'); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + } + }) + }, + handleCancel() { + this.close() + }, + //楠岃瘉 缂栧彿 + validateNum(rule, value, callback) { + var params = { + tableName: 'base_line_side_warehouse', + fieldName: 'warehouse_code', + fieldVal: value, + dataId: this.warehouseId, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true', + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback(); + } else { + callback("绾胯竟搴撶紪鍙峰凡瀛樺湪!"); + } + }) + }, + //楠岃瘉 鍚嶇О + validateName(rule, value, callback) { + var params = { + tableName: 'base_line_side_warehouse', + fieldName: 'warehouse_name', + fieldVal: value, + dataId: this.warehouseId, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true', + }; + duplicateCheck(params).then((res) => { + if (res.success) { + callback(); + } else { + callback("绾胯竟搴撳悕绉板凡瀛樺湪!"); + } + }) + }, + } +} +</script> + +<style scoped> +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3