From 694d882c7a27bc276d37f1c06d0c67a03146e086 Mon Sep 17 00:00:00 2001 From: cuijian <cuijian@xalxzn.com> Date: 星期四, 26 六月 2025 11:45:28 +0800 Subject: [PATCH] 基础数据,产线,班次,班组 --- /dev/null | 49 - src/api/api.js | 10 src/views/base/modules/group/SelectUserModal.vue | 287 ++++++++++ src/views/base/ShiftGroupManager.vue | 501 +++++++++++++++++ src/views/base/modules/FactoryManager/FactoryEquipment.vue | 2 src/views/base/FactoryManager.vue | 71 +- src/views/base/modules/shift/ShiftModel.vue | 324 +++++++++++ src/views/base/modules/group/GroupModal.vue | 171 ++++++ src/views/base/modules/FactoryManager/FactoryModal.vue | 37 src/views/base/ShiftManager.vue | 195 ++++++ 10 files changed, 1,534 insertions(+), 113 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index e43da5b..f8be8dd 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -57,9 +57,9 @@ const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTreeList",params); //杞﹂棿绠$悊 -const queryProductionTreeList = (params)=>getAction("/mdc/mdcProduction/queryTreeList",params); -const queryById = (params)=>getAction("/mdc/mdcProduction/queryIdTree",params); -const deleteByProduction = (params)=>deleteAction("/mdc/mdcProduction/delete",params); +const queryFactoryTreeList = (params)=>getAction("/base/factory/queryTreeList",params); +const queryById = (params)=>getAction("/base/factory/queryIdTree",params); +const deleteByFactory = (params)=>deleteAction("/base/factory/delete",params); //鏃ュ織绠$悊 @@ -165,8 +165,8 @@ queryMyDepartTreeList, getUserNoticeInfo, getDictItemsFromCache, - queryProductionTreeList, - deleteByProduction, + queryFactoryTreeList, + deleteByFactory, queryById, addEquipment, editEquipment diff --git a/src/views/system/ProductionManager.vue b/src/views/base/FactoryManager.vue similarity index 91% rename from src/views/system/ProductionManager.vue rename to src/views/base/FactoryManager.vue index de94956..d0048aa 100644 --- a/src/views/system/ProductionManager.vue +++ b/src/views/base/FactoryManager.vue @@ -38,7 +38,7 @@ <!--@rightClick="rightHandle"--> <!--:selectedKeys="selectedKeys"--> <!--:checkedKeys="checkedKeys"--> - <!--:treeData="departTree"--> + <!--:treeData="factoryTree"--> <!--:checkStrictly="checkStrictly"--> <!--:expandedKeys="iExpandedKeys"--> <!--:autoExpandParent="autoExpandParent"--> @@ -61,7 +61,7 @@ @rightClick="rightHandle" :selectedKeys="selectedKeys" :checkedKeys="checkedKeys" - :treeData="departTree" + :treeData="factoryTree" :checkStrictly="checkStrictly" :expandedKeys="iExpandedKeys" :autoExpandParent="autoExpandParent" @@ -93,11 +93,11 @@ <a-tab-pane tab="鍩烘湰淇℃伅" key="1"> <a-card :bordered="false" v-if="selectedKeys.length>0"> <a-form-model ref="form" :model="model" :rules="validatorRules"> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionCode" label="杞﹂棿缂栧彿"> - <a-input placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿缂栧彿" v-model="model.productionCode"/> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryCode" label="杞﹂棿缂栧彿"> + <a-input placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿缂栧彿" v-model="model.factoryCode"/> </a-form-model-item> - <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionName" label="杞﹂棿鍚嶇О"> - <a-input placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О" v-model="model.productionName"/> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryName" label="杞﹂棿鍚嶇О"> + <a-input placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О" v-model="model.factoryName"/> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="涓婄骇杞﹂棿"> <a-tree-select @@ -110,10 +110,10 @@ </a-tree-select> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="鎺掑簭"> - <a-input-number v-model="model.productionOrder"/> + <a-input-number v-model="model.sorter"/> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="澶囨敞"> - <a-textarea placeholder="璇疯緭鍏ュ娉�" v-model="model.memo"/> + <a-textarea placeholder="璇疯緭鍏ュ娉�" v-model="model.remark"/> </a-form-model-item> </a-form-model> <div class="anty-form-btn"> @@ -127,32 +127,29 @@ </a-empty> </a-card> </a-tab-pane> - <!--<a-tab-pane tab="閮ㄩ棬鏉冮檺" key="2" forceRender>--> - <!--<depart-auth-modal ref="departAuth"/>--> - <!--</a-tab-pane>--> - <a-tab-pane tab="璁惧鍒楄〃" key="2" forceRender> - <!--<depart-auth-modal/>--> - <production-equipment ref="departAuth"></production-equipment> - </a-tab-pane> + + <!-- <a-tab-pane tab="璁惧鍒楄〃" key="2" forceRender> + <factory-equipment ref="departAuth"></factory-equipment> + </a-tab-pane> --> </a-tabs> </a-col> - <production-modal ref="departModal" @ok="loadTree"></production-modal> + <factory-modal ref="departModal" @ok="loadTree"></factory-modal> </a-row> </template> <script> - import ProductionEquipment from './modules/ProductionManager/ProductionEquipment' - import { queryProductionTreeList, searchByKeywords, deleteByProduction } from '@/api/api' + import FactoryEquipment from './modules/FactoryManager/FactoryEquipment' + import { queryFactoryTreeList, searchByKeywords, deleteByFactory } from '@/api/api' import { httpAction, deleteAction } from '@/api/manage' import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import ProductionModal from './modules/ProductionManager/ProductionModal' + import FactoryModal from './modules/FactoryManager/FactoryModal' export default { - name: 'ProductionManager', + name: 'FactoryManager', mixins: [JeecgListMixin], components: { - ProductionEquipment, - ProductionModal + FactoryEquipment, + FactoryModal }, data() { return { @@ -164,7 +161,7 @@ disable: true, treeData: [], visible: false, - departTree: [], + factoryTree: [], rightClickSelectedKey: '', rightClickSelectedOrgCode: '', hiding: true, @@ -191,14 +188,14 @@ edges: [] }, validatorRules: { - productionName: [{ required: true, message: '璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О!' }] + factoryName: [{ required: true, message: '璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О!' }] }, url: { - delete: '/mdc/mdcProduction/delete', - edit: '/mdc/mdcProduction/edit', - deleteBatch: '/mdc/mdcProduction/deleteBatch', - exportXlsUrl: '/mdc/mdcProduction/exportXls', - importExcelUrl: '/mdc/mdcProduction/importExcel' + delete: '/base/factory/delete', + edit: '/base/factory/edit', + deleteBatch: '/base/factory/deleteBatch', + exportXlsUrl: '/base/factory/exportXls', + importExcelUrl: '/base/factory/importExcel' }, orgCategoryDisabled: false, isIncludesNotLeaf: false @@ -216,15 +213,15 @@ loadTree() { var that = this that.treeData = [] - that.departTree = [] - queryProductionTreeList().then((res) => { + that.factoryTree = [] + queryFactoryTreeList().then((res) => { if (res.success) { //閮ㄩ棬鍏ㄩ�夊悗锛屽啀娣诲姞閮ㄩ棬锛岄�変腑鏁伴噺澧炲 this.allTreeKeys = [] for (let i = 0; i < res.result.length; i++) { let temp = res.result[i] that.treeData.push(temp) - that.departTree.push(temp) + that.factoryTree.push(temp) that.setThisExpandedKeys(temp) that.getAllKeys(temp) // console.log(temp.id) @@ -277,7 +274,7 @@ batchDel: function() { console.log(this.checkedKeys) this.isIncludesNotLeaf = false - this.includesNotLeaf(this.departTree) + this.includesNotLeaf(this.factoryTree) console.log('isIncludesNotLeaf', this.isIncludesNotLeaf) // 涓簍rue鍒欒〃绀洪�変腑椤瑰寘鍚潪鍙跺瓙缁撶偣 false鍒欒〃绀洪�変腑椤瑰潎涓哄彾瀛愮粨鐐� @@ -340,10 +337,10 @@ if (value) { searchByKeywords({ keyWord: value }).then((res) => { if (res.success) { - that.departTree = [] + that.factoryTree = [] for (let i = 0; i < res.result.length; i++) { let temp = res.result[i] - that.departTree.push(temp) + that.factoryTree.push(temp) } } else { // that.$message.warning(res.message) @@ -481,7 +478,7 @@ this.$refs.departModal.add(this.selectedKeys) this.$refs.departModal.title = '鏂板' } else { - this.$refs.departModal.add(this.rightClickSelectedKey) + this.$refs.departModal.add(this.currSelected) this.$refs.departModal.title = '鏂板' } }, @@ -492,7 +489,7 @@ title: '纭鍒犻櫎', content: `纭畾瑕佸垹闄� ${that.currSelected.productionName} 鍚�?`, onOk: function() { - deleteByProduction({ id: that.currSelected.id }).then((resp) => { + deleteByFactory({ id: that.currSelected.id }).then((resp) => { if (resp.success) { //鍒犻櫎鎴愬姛鍚庯紝鍘婚櫎宸查�変腑涓殑鏁版嵁 // that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1) diff --git a/src/views/base/ShiftGroupManager.vue b/src/views/base/ShiftGroupManager.vue new file mode 100644 index 0000000..532d70a --- /dev/null +++ b/src/views/base/ShiftGroupManager.vue @@ -0,0 +1,501 @@ +<template> + <a-row :gutter="10"> + <a-col :md="leftColMd" :sm="24" style="margin-bottom: 20px"> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <!-- 鎼滅储鍖哄煙 --> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="12" :sm="8"> + <a-form-item label="鐝粍鍚嶇О" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}"> + <a-input placeholder="" v-model="queryParam.groupName"></a-input> + </a-form-item> + </a-col> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-col :md="12" :sm="24"> + <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 21px">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </a-col> + </span> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator" style="margin: 5px 0 10px 2px"> + <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button> + </div> + + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"> + </i> 宸查�夋嫨 <a><b>{{ selectedRowKeys1.length }}</b></a>椤� + <a style="margin-left: 24px" @click="onClearSelected1">娓呯┖</a> + </div> + + <div style="margin-top: 15px"> + <a-table + style="height:500px" + ref="table" + size="middle" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type:'radio'}" + @change="handleTableChange"> + <span slot="action" slot-scope="text, record"> + <a @click="handleOpen(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="() => handleDelete1(record.id)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + </a-table> + </div> + <!-- 鍙充晶鐨勮鑹叉潈闄愰厤缃� --> + <group-modal ref="modalForm" @ok="modalFormOk"></group-modal> + </a-card> + </a-col> + <a-col :md="rightColMd" :sm="24" v-if="this.rightcolval == 1"> + <a-card :bordered="false"> + <div style="text-align: right;"> + <a-icon type="close-circle" @click="hideUserList" /> + </div> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline"> + <a-row :gutter="24"> + + <a-col :md="12" :sm="12"> + <a-form-item label="鐢ㄦ埛璐﹀彿"> + <a-input placeholder="" v-model="queryParam2.username"></a-input> + </a-form-item> + </a-col> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-col :md="9" :sm="24"> + <a-button type="primary" @click="searchQuery2" icon="search" style="margin-left: 21px">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset2" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + + </a-col> + </span> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator" :md="24" :sm="24"> + <a-button @click="handleAddUserGroup" type="primary" icon="plus" style="margin-top: 16px">娣诲姞鐝粍浜哄憳</a-button> + + <a-dropdown v-if="selectedRowKeys2.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel2"> + <a-icon type="delete"/> + 鍙栨秷鍏宠仈 + </a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 + <a-icon type="down"/> + </a-button> + </a-dropdown> + </div> + <!-- table鍖哄煙-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ + selectedRowKeys2.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected2">娓呯┖</a> + </div> + <a-table + style="height:500px" + ref="table2" + bordered + size="middle" + rowKey="id" + :columns="columns2" + :dataSource="dataSource2" + :pagination="ipagination2" + :loading="loading2" + :rowSelection="{selectedRowKeys: selectedRowKeys2, onChange: onSelectChange2}" + @change="handleTableChange2"> + <span slot="action" slot-scope="text, record"> + <a-popconfirm title="纭畾鍙栨秷鍏宠仈鍚�?" @confirm="() => handleDelete2(record.id)"> + <a>鍙栨秷鍏宠仈</a> + </a-popconfirm> + </span> + </a-table> + </div> + <!-- 琛ㄥ崟鍖哄煙 --> + <group-modal ref="modalForm" @ok="modalFormOk"></group-modal> + <Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal> + </a-card> + </a-col> + </a-row> +</template> +<script> + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import { deleteAction, postAction, getAction } from '@/api/manage' + import SelectUserModal from './modules/group/SelectUserModal' + import GroupModal from './modules/group/GroupModal' + import { filterObj } from '@/utils/util' + import moment from 'moment' + + export default { + name: 'ShiftGroupManager', + mixins: [JeecgListMixin], + components: { + SelectUserModal, + GroupModal, + moment + }, + data() { + return { + model1: {}, + model2: {}, + currentGroupId: '', + queryParam1: {}, + queryParam2: {}, + dataSource1: [], + dataSource2: [], + ipagination1: { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + ipagination2: { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + isorter1: { + column: 'createTime', + order: 'desc' + }, + isorter2: { + column: 'createTime', + order: 'desc' + }, + filters1: {}, + filters2: {}, + loading1: false, + loading2: false, + selectedRowKeys1: [], + selectedRowKeys2: [], + selectionRows1: [], + selectionRows2: [], + test:{}, + rightcolval:0, + columns: + [ + { + title: '鐝粍缂栫爜', + align: 'center', + dataIndex: 'groupCode' + }, + { + title: '鐝粍鍚嶇О', + align: 'center', + dataIndex: 'groupName' + }, + { + title: '鍒涘缓鏃堕棿', + dataIndex: 'createTime', + align:"center", + sorter: true, + customRender: (text) => { + return moment(text).format('YYYY-MM-DD') + } + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' } + } + ], + columns2: [{ + title: '鐢ㄦ埛璐﹀彿', + align: 'center', + dataIndex: 'username', + width: 120 + }, + { + title: '鐢ㄦ埛鍚嶇О', + align: 'center', + width: 100, + dataIndex: 'realname' + }, + { + title: '鐘舵��', + align: 'center', + width: 80, + dataIndex: 'status_dictText' + }, + + { + title: '鎿嶄綔', + dataIndex: 'action', + scopedSlots: { customRender: 'action' }, + align: 'center', + width: 120 + }], + + // 楂樼骇鏌ヨ鍙傛暟 + superQueryParams2: '', + // 楂樼骇鏌ヨ鎷兼帴鏉′欢 + superQueryMatchType2: 'and', + url: { + list: '/base/shiftGroup/list', + delete: '/base/shiftGroup/delete', + list2: '/sys/user/userGroupList', + addUserGroup: '/sys/user/addBaseUserGroup', + delete2: '/sys/user/deleteUserGroup', + deleteBatch2: '/sys/user/deleteUserGroupBatch', + exportXlsUrl: 'sys/role/exportXls', + importExcelUrl: 'sys/role/importExcel' + } + } + }, + computed: { + importExcelUrl: function() { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` + }, + leftColMd() { + return this.selectedRowKeys1.length === 0 ? 24 : 12 + }, + rightColMd() { + return this.selectedRowKeys1.length === 0 ? 0 : 12 + } + }, + methods: { + onSelectChange2(selectedRowKeys, selectionRows) { + this.selectedRowKeys2 = selectedRowKeys + this.selectionRows2 = selectionRows + }, + onClearSelected2() { + this.selectedRowKeys2 = [] + this.selectionRows2 = [] + }, + onClearSelected1() { + this.selectedRowKeys1 = [] + this.selectionRows1 = [] + }, + onSelectChange1(selectedRowKeys, selectionRows) { + this.rightcolval = 1 + this.selectedRowKeys1 = selectedRowKeys + this.selectionRows1 = selectionRows + this.model1 = Object.assign({}, selectionRows[0]) + this.currentGroupId = selectedRowKeys[0] + this.loadData2() + this.onClearSelected2() + }, + searchQuery() { + this.loadData(1); + this.onClearSelected1() + this.onClearSelected2() + }, + searchReset() { + this.queryParam = {} + this.loadData(1); + this.onClearSelected1() + this.onClearSelected2() + }, + modalFormOk() { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.loadData(1); + this.loadData2(1); + //娓呯┖鍒楄〃閫変腑 + this.onClearSelected1() + this.onClearSelected2() + }, + getQueryParams2() { + //鑾峰彇鏌ヨ鏉′欢 + let sqp = {} + if (this.superQueryParams2) { + sqp['superQueryParams'] = encodeURI(this.superQueryParams2) + sqp['superQueryMatchType'] = this.superQueryMatchType2 + } + var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2) + param.field = this.getQueryField2() + param.pageNo = this.ipagination2.current + param.pageSize = this.ipagination2.pageSize + return filterObj(param) + }, + getQueryField2() { + //TODO 瀛楁鏉冮檺鎺у埗 + var str = 'id,' + this.columns2.forEach(function(value) { + str += ',' + value.dataIndex + }) + return str + }, + loadData2(arg) { + if (!this.url.list2) { + this.$message.error('璇疯缃畊rl.list2灞炴��!') + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination2.current = 1 + } + if (this.currentGroupId === '') return + let params = this.getQueryParams2()//鏌ヨ鏉′欢 + params.groupId = this.currentGroupId + this.loading2 = true + getAction(this.url.list2, params).then((res) => { + if (res.success) { + this.dataSource2 = res.result.records + this.ipagination2.total = res.result.total + + } + this.loading2 = false + }) + + }, + handleDelete1: function(id) { + this.handleDelete(id) + this.dataSource2 = [] + this.currentGroupId = '' + this.onClearSelected1() + this.onClearSelected2() + }, + handleDelete2: function(id) { + if (!this.url.delete2) { + this.$message.error('璇疯缃畊rl.delete2灞炴��!') + return + } + var that = this + deleteAction(that.url.delete2, { groupId: this.currentGroupId, userId: id }).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.loadData2() + this.onClearSelected2() + } else { + that.$message.warning(res.message) + } + }) + }, + batchDel2: function() { + + if (!this.url.deleteBatch2) { + this.$message.error('璇疯缃畊rl.deleteBatch2灞炴��!') + return + } + if (this.selectedRowKeys2.length <= 0) { + this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒') + return + } else { + var ids = '' + for (var a = 0; a < this.selectedRowKeys2.length; a++) { + ids += this.selectedRowKeys2[a] + ',' + } + var that = this + console.log(this.currentDeptId) + this.$confirm({ + title: '纭鍙栨秷鍏宠仈', + content: '鏄惁鍒犻櫎閫変腑鏁版嵁?', + onOk: function() { + deleteAction(that.url.deleteBatch2, { groupId: that.currentGroupId, userIds: ids }).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.loadData2() + that.onClearSelected2() + } else { + that.$message.warning(res.message) + } + }) + } + }) + } + }, + selectOK(data) { + let params = {} + params.groupId = this.currentGroupId + params.userIdList = [] + for (var a = 0; a < data.length; a++) { + params.userIdList.push(data[a]) + } + console.log(params) + postAction(this.url.addUserGroup, params).then((res) => { + if (res.success) { + this.loadData2() + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }) + }, + + handleAddUserGroup() { + if (this.currentGroupId == '') { + this.$message.error('璇烽�夋嫨涓�涓彮缁�!') + } else { + this.$refs.selectUserModal.visible = true + } + }, + handleOpen(record) { + this.rightcolval = 1 + this.selectedRowKeys1 = [record.id] + this.model1 = Object.assign({}, record) + this.currentGroupId = record.id + this.onClearSelected2() + this.loadData2() + }, + searchQuery2() { + this.loadData2(1) + this.onClearSelected2() + }, + searchReset2() { + this.queryParam2 = {} + this.loadData2(1) + this.onClearSelected2() + }, + handleTableChange2(pagination, filters, sorter) { + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter2.column = sorter.field + this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc' + } + this.ipagination2 = pagination + this.loadData2() + }, + hideUserList(){ + //this.rightcolval = 0 + this.selectedRowKeys1 = [] + }, + } + } +</script> +<style scoped> +@import '~@assets/less/common.less'; + /** Button鎸夐挳闂磋窛 */ + .ant-btn { + margin-left: 8px + } +</style> \ No newline at end of file diff --git a/src/views/base/ShiftManager.vue b/src/views/base/ShiftManager.vue new file mode 100644 index 0000000..28075cc --- /dev/null +++ b/src/views/base/ShiftManager.vue @@ -0,0 +1,195 @@ +<template> + <a-card :bordered="false"> + + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐝缂栧彿"> + <j-input placeholder="璇疯緭鍏ョ彮娆$紪鍙�" v-model="queryParam.shiftCode"></j-input> + </a-form-item> + </a-col> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐝鍚嶇О"> + <j-input placeholder="璇疯緭鍏ョ彮娆″悕绉�" v-model="queryParam.shiftName"></j-input> + </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="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button type="primary" @click="handleAdd" icon="plus">鏂板</a-button> + </div> + <!-- table鍖哄煙-begin --> + <div style="width: 100%;flex: 1;overflow: auto"> + <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" + :dataSource="dataSource" :pagination="false" class="j-table-force-nowrap" :loading="loading"> + <span + slot="shiftStatus" + slot-scope="text, record" + > + <span v-if="text == 0" style="color:red;">鍋滅敤</span> + <span v-if="text == 1" style="color:green;">鍚敤</span> + </span> + <span + slot="crossDayFlag" + slot-scope="text, record" + > + <span v-if="text == '1'">鏄�</span> + <span v-if="text == '0'">鍚�</span> + </span> + <span + slot="action" + slot-scope="text, record" + > + <a v-if="record.shiftStatus == 1" @click="handleEdit(record)">缂栬緫</a> + <a-divider type="vertical" v-if="record.shiftStatus == 1"/> + <a v-if="record.shiftStatus == 0" @click="handleStatus(record.id,1)">鍚敤</a> + <a v-if="record.shiftStatus == 1" @click="handleStatus(record.id,0)">鍋滅敤</a> + <a-divider type="vertical" /> + <a @click="handleDelete(record.id)">鍒犻櫎</a> + </span> + </a-table> + </div> + + <shift-model ref="modalForm" @ok="modalFormOk"></shift-model> + </a-card> +</template> + +<script> + import { + requestPut, putAction, deleteAction + } from '@/api/manage' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + import ShiftModel from './modules/shift/ShiftModel' + + export default { + name: 'ShiftManager', + mixins: [JeecgListMixin], + components: { + ShiftModel + }, + props: {}, + data() { + return { + url: { + list: '/base/shift/list', + changeStatus: '/base/shift/updateStatusById', + deleteBatch: '/base/shift/delete' + }, + columns: [ + { + title: '鐝缂栧彿', + align: 'center', + dataIndex: 'shiftCode' + }, + { + title: '鐝鍚嶇О', + align: 'center', + dataIndex: 'shiftName' + }, + { + title: '寮�濮嬫椂闂�', + align: 'center', + dataIndex: 'startTime' + }, + { + title: '缁撴潫鏃堕棿', + align: 'center', + dataIndex: 'endTime' + }, + { + title: '宸ヤ綔鏃堕暱', + align: 'center', + dataIndex: 'workHours' + }, + { + title: '鏄惁璺ㄥぉ', + align: 'center', + dataIndex: 'crossDayFlag', + scopedSlots: { customRender: 'crossDayFlag' } + }, + { + title: '鐘舵��', + align: 'center', + dataIndex: 'shiftStatus', + scopedSlots: { customRender: 'shiftStatus' } + }, + { + title: '鎿嶄綔', + align: 'center', + dataIndex: 'action', + scopedSlots: { customRender: 'action' } + } + ] + } + }, + methods: { + handleAdd() { + this.$refs.modalForm.add() + this.$refs.modalForm.title = '鏂板鐝' + this.$refs.modalForm.disableSubmit = false + }, + handleEdit(record) { + this.$refs.modalForm.edit(record) + this.$refs.modalForm.title = '缂栬緫鐝' + this.$refs.modalForm.disableSubmit = true + }, + handleDelete: function(record){ + if(!this.url.deleteBatch){ + this.$message.error("璇疯缃畊rl.delete灞炴��!") + return + } + var that = this; + deleteAction(that.url.deleteBatch, {id: record}).then((res) => { + if (res.success) { + that.$notification.success({ + message:'娑堟伅', + description:res.message + }); + that.loadData(); + } else { + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }); + }, + handleStatus(id, status) { + let _this = this + putAction(this.url.changeStatus, { id: id, status: status }).then((res) => { + if (res.success) { + _this.$notification.success({ + message:'娑堟伅', + description:"鎿嶄綔鎴愬姛" + }); + _this.loadData() + } else { + _this.$notification.warning({ + message:'娑堟伅', + description:"鎿嶄綔澶辫触" + }); + } + }) + }, + }, + created() { + } + + } +</script> + +<style lang="less" scoped> +@import '~@assets/less/common.less'; +</style> diff --git a/src/views/system/modules/ProductionManager/ProductionEquipment.vue b/src/views/base/modules/FactoryManager/FactoryEquipment.vue similarity index 99% rename from src/views/system/modules/ProductionManager/ProductionEquipment.vue rename to src/views/base/modules/FactoryManager/FactoryEquipment.vue index 6227bb9..c9ada63 100644 --- a/src/views/system/modules/ProductionManager/ProductionEquipment.vue +++ b/src/views/base/modules/FactoryManager/FactoryEquipment.vue @@ -72,7 +72,7 @@ import { getAction,postAction } from '@/api/manage' import qs from 'qs' export default { - name: 'ProductionEquipment', + name: 'FactoryEquipment', mixins: [JeecgListMixin], data(){ return { diff --git a/src/views/system/modules/ProductionManager/ProductionModal.vue b/src/views/base/modules/FactoryManager/FactoryModal.vue similarity index 82% rename from src/views/system/modules/ProductionManager/ProductionModal.vue rename to src/views/base/modules/FactoryManager/FactoryModal.vue index 7c76baf..328546f 100644 --- a/src/views/system/modules/ProductionManager/ProductionModal.vue +++ b/src/views/base/modules/FactoryManager/FactoryModal.vue @@ -16,25 +16,25 @@ :labelCol="labelCol" :wrapperCol="wrapperCol" label="杞﹂棿缂栫爜" - prop="productionCode" + prop="factoryCode" :hidden="false" hasFeedback > - <a-input id="productionCode" placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿缂栧彿" v-model="model.productionCode"/> + <a-input id="factoryCode" placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿缂栧彿" v-model="model.factoryCode"/> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="杞﹂棿鍚嶇О" - prop="productionName" + prop="factoryName" :hidden="false" hasFeedback > - <a-input id="departName" placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О" v-model="model.productionName"/> + <a-input id="factoryName" placeholder="璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О" v-model="model.factoryName"/> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :hidden="seen" label="涓婄骇杞﹂棿" hasFeedback> <a-tree-select style="width:100%" :dropdownStyle="{maxHeight:'200px',overflow:'auto'}" - :treeData="departTree" + :treeData="factoryTree" v-model="model.parentId" placeholder="璇烽�夋嫨涓婄骇杞﹂棿" :disabled="condition"> @@ -44,13 +44,13 @@ :labelCol="labelCol" :wrapperCol="wrapperCol" label="鎺掑簭"> - <a-input-number v-model="model.productionOrder"/> + <a-input-number v-model="model.sorter"/> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="澶囨敞"> - <a-textarea placeholder="璇疯緭鍏ュ娉�" v-model="model.memo"/> + <a-textarea placeholder="璇疯緭鍏ュ娉�" v-model="model.remark"/> </a-form-model-item> </a-form-model> @@ -63,22 +63,17 @@ import { queryById } from '@/api/api' import pick from 'lodash.pick' export default { - name: "ProductionModal", + name: "FactoryModal", components: { }, data () { return { - departTree:[], - orgTypeData:[], - phoneWarning:'', - departName:"", + factoryTree:[], title:"鎿嶄綔", seen:false, visible: false, condition:true, disableSubmit:false, model: {}, - menuhidden:false, - menuusing:true, labelCol: { xs: { span: 24 }, sm: { span: 5 }, @@ -90,10 +85,10 @@ confirmLoading: false, validatorRules:{ - productionName:[{ required: true, message: '璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О!' }], + factoryName:[{ required: true, message: '璇疯緭鍏ヤ骇绾�/杞﹂棿鍚嶇О!' }], }, url: { - add: "/mdc/mdcProduction/add", + add: "/base/factory/add", }, dictDisabled:true, } @@ -105,24 +100,24 @@ var that = this; queryById().then((res)=>{ if(res.success){ - that.departTree = []; + that.factoryTree = []; for (let i = 0; i < res.result.length; i++) { let temp = res.result[i]; - that.departTree.push(temp); + that.factoryTree.push(temp); } } }) }, - add (depart) { - if(depart){ + add (factory) { + if(factory){ this.seen = false; this.dictDisabled = false; }else{ this.seen = true; this.dictDisabled = true; } - this.edit(depart); + this.edit(factory); }, edit (record) { this.visible = true; diff --git a/src/views/base/modules/group/GroupModal.vue b/src/views/base/modules/group/GroupModal.vue new file mode 100644 index 0000000..d067b93 --- /dev/null +++ b/src/views/base/modules/group/GroupModal.vue @@ -0,0 +1,171 @@ +<template> + <a-modal + :title="title" + :width="800" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + wrapClassName="ant-modal-cust-warp" + style="top:5%;height: 85%;overflow-y: hidden"> + + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" v-bind="layout" :model="model" :rules="validatorRules"> + <a-form-model-item label="鐝粍缂栫爜" required prop="groupCode"> + <a-input v-model="model.groupCode" :disabled="roleDisabled" placeholder="璇疯緭鍏ョ彮缁勭紪鐮�"/> + </a-form-model-item> + <a-form-model-item label="鐝粍鍚嶇О" required prop="groupName"> + <a-input v-model="model.groupName" placeholder="璇疯緭鍏ョ彮缁勫悕绉�"/> + </a-form-model-item> + <a-form-model-item label="鐝粍闀�" prop="groupManager"> + <j-dict-select-tag + type="list" + v-model="model.groupManager" + :trigger-change="true" + dictCode="sys_user,realname,id" + placeholder="璇烽�夋嫨鐝粍闀�" + /> + </a-form-model-item> + <a-form-model-item label="浜х嚎" prop="factoryId"> + <j-dict-select-tag + type="list" + v-model="model.factoryId" + :trigger-change="true" + dictCode="base_factory,factory_name,id" + placeholder="璇烽�夋嫨浜х嚎" + /> + </a-form-model-item> + <a-form-model-item label="鐝" prop="shiftId"> + <j-dict-select-tag + type="list" + v-model="model.shiftId" + :trigger-change="true" + dictCode="base_shift,shift_name,id" + placeholder="璇烽�夋嫨鐝" + /> + </a-form-model-item> + <a-form-model-item label="澶囨敞" prop="remark"> + <a-textarea :rows="5" v-model="model.remark" placeholder="璇疯緭鍏ュ娉�"/> + </a-form-model-item> + </a-form-model> + </a-spin> + </a-modal> +</template> + +<script> + import {duplicateCheck } from '@/api/api' + import {postAction,requestPut} from '@/api/manage' + import JDictSelectTag from '@/components/dict/JDictSelectTag' + export default { + name: "GroupModal", + components: { + JDictSelectTag, + }, + data () { + return { + title:"鎿嶄綔", + visible: false, + roleDisabled: false, + model: {}, + layout: { + labelCol: { span: 3 }, + wrapperCol: { span: 14 }, + }, + confirmLoading: false, + validatorRules:{ + groupName: [ + { required: true, message: '璇疯緭鍏ョ彮缁勫悕绉�!' }, + { min: 2, max: 30, message: '闀垮害鍦� 2 鍒� 30 涓瓧绗�', trigger: 'blur' } + ], + groupCode: [ + { required: true, message: '璇疯緭鍏ョ彮缁勫悕绉�!'}, + { min: 0, max: 64, message: '闀垮害涓嶈秴杩� 64 涓瓧绗�', trigger: 'blur' }, + { validator: this.validategroupCode} + ], + remark: [ + { min: 0, max: 126, message: '闀垮害涓嶈秴杩� 126 涓瓧绗�', trigger: 'blur' } + ] + }, + url: { + add: "/base/shiftGroup/add", + edit: "/base/shiftGroup/edit", + } + } + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$refs.form.clearValidate(); + this.$emit('close'); + this.visible = false; + }, + handleOk () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let obj; + if(!this.model.id){ + obj=postAction(this.url.add, this.model) + }else{ + obj=requestPut(this.url.edit, this.model, { + id: this.model.id + }) + } + obj.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(); + }) + }else{ + return false; + } + }) + }, + handleCancel () { + this.close() + }, + validategroupCode(rule, value, callback){ + if(/[\u4E00-\u9FA5]/g.test(value)){ + callback("鐝粍缂栫爜涓嶅彲杈撳叆姹夊瓧!"); + }else{ + let params = { + tableName: "base_shift_group", + fieldName: "group_code", + fieldVal: value, + dataId: this.model.id, + }; + duplicateCheck(params).then((res)=>{ + if(res.success){ + callback(); + }else{ + callback(res.message); + } + }); + } + } + } + } +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/base/modules/group/SelectUserModal.vue b/src/views/base/modules/group/SelectUserModal.vue new file mode 100644 index 0000000..5aed197 --- /dev/null +++ b/src/views/base/modules/group/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/shift/ShiftModel.vue b/src/views/base/modules/shift/ShiftModel.vue new file mode 100644 index 0000000..872d4b8 --- /dev/null +++ b/src/views/base/modules/shift/ShiftModel.vue @@ -0,0 +1,324 @@ +<template> + <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" + @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="鐝缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input allow-clear placeholder="璇疯緭鍏ョ彮娆$紪鐮�" + v-decorator="['shiftCode',validatorRules.shiftCode]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="鐝鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input allow-clear placeholder="璇疯緭鍏ョ彮娆″悕绉�" v-decorator="['shiftName',validatorRules.shiftName]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker v-decorator="['startTime',validatorRules.startTime]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-time-picker v-decorator="['endTime',validatorRules.endTime]"/> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="宸ヤ綔鏃堕暱" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input-number v-decorator="['workHours',validatorRules.workHours]" placeholder="璇疯緭鍏ュ伐浣滄椂闀�(灏忔椂)" style="width: 100%" /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="鏄惁璺ㄥぉ" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-switch v-model="crossDayFlag" checked-children="鏄�" un-checked-children="鍚�"/> + </a-form-item> + </a-col> + </a-row> + + </a-form> + </a-spin> + </a-modal> +</template> + +<script> + import moment from 'moment' + import pick from 'lodash.pick' + import { + getAction, + postAction, + requestPut + } from '@/api/manage' + import { + duplicateCheck + } from '@/api/api' + + + export default { + name: 'ShiftModel', + components: {}, + props: {}, + data() { + return { + title: '', + crossDayFlag: false, + visible: false, + model: {}, + labelCol: { + xs: { + span: 24 + }, + sm: { + span: 6 + } + }, + wrapperCol: { + xs: { + span: 24 + }, + sm: { + span: 18 + } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + shiftCode: { + rules: [ + { + required: true, + message: '璇疯緭鍏ョ彮娆$紪鍙�' + }, + { validator: this.validateNum } + ] + }, + shiftName: { + rules: [ + { + required: true, + message: '璇疯緭鍏ョ彮娆″悕绉�' + }, + { validator: this.validateName } + ] + }, + startDate: { + rules: [ + { + required: true, + message: '璇烽�夋嫨寮�濮嬫椂闂�' + } + ] + }, + endDate: { + rules: [ + { + required: true, + message: '璇烽�夋嫨缁撴潫鏃堕棿' + } + ] + } + }, + url: { + add: '/base/shift/add', + edit: '/base/shift/edit', + list: '/base/shift/list' + }, + disableSubmit: true + } + }, + created() { + + }, + + methods: { + + add() { + let _this = this + this.visible = true + this.form.resetFields() + this.model = {} + this.$nextTick(() => { + this.crossDayFlag = false + }) + }, + edit(record) { + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'shiftCode', 'shiftName', 'startTime', 'endTime','workHours')) + this.form.setFieldsValue({ + startTime: moment(this.model.startTime, 'HH:mm:ss'), + endTime: moment(this.model.endTime, 'HH:mm:ss') + }) + if (record.crossDayFlag == '1') { + this.crossDayFlag = true + } else { + this.crossDayFlag = false + } + }) + }, + close() { + this.$emit('close') + this.visible = false + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + // debugger + that.confirmLoading = true + let formData = Object.assign(this.model, values) + if(that.crossDayFlag == true){ + formData.crossDayFlag = '1' + }else if(that.crossDayFlag == false){ + formData.crossDayFlag = '0' + } + formData.startTime = moment(formData.startTime).format('HH:mm:ss') + formData.endTime = moment(formData.endTime).format('HH:mm:ss') + if (formData.crossDayFlag == '0') { + let startTimeOne = formData.startTime.replace(/:/g, '') + let endTimeOne = formData.endTime.replace(/:/g, '') + if (startTimeOne > endTimeOne) { + // that.$message.warning("闈炶法澶╃彮娆$粨鏉熸椂闂翠笉鑳藉皬浜庣瓑浜庡紑濮嬫椂闂达紒") + that.$notification.warning({ + message: '娑堟伅', + description: '闈炶法澶╃彮娆$粨鏉熸椂闂翠笉鑳藉皬浜庣瓑浜庡紑濮嬫椂闂达紒' + }) + that.confirmLoading = false + that.close() + } else { + formData.shiftStatus = 1 + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success("淇濆瓨鎴愬姛") + that.$notification.success({ + message: '娑堟伅', + description: '淇濆瓨鎴愬姛' + }) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + } else { + formData.shiftStatus = 1 + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success + that.$notification.success({ + message: '娑堟伅', + description: '淇濆瓨鎴愬姛' + }) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + + } + }) + }, + handleCancel() { + this.close() + }, + //楠岃瘉 缂栫爜 + validateNum(rule, value, callback) { + var params = { + tableName: 'base_shift', + fieldName: 'shift_code', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true' + } + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback('鐝缂栧彿宸插瓨鍦�!') + } + }) + }, + //楠岃瘉 鍚嶇О + validateName(rule, value, callback) { + var params = { + tableName: 'base_shift', + fieldName: 'shift_name', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁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 diff --git a/src/views/mdc/base/ShiftManager.vue b/src/views/mdc/base/ShiftManager.vue deleted file mode 100644 index 6565735..0000000 --- a/src/views/mdc/base/ShiftManager.vue +++ /dev/null @@ -1,49 +0,0 @@ -<template> - <a-card :bordered="false"> - <a-row type="flex" :gutter="16"> - <a-col :md="7" :sm="24"> - <shift-system @selectionShiftRow="selectionShiftRow"></shift-system> - </a-col> - <a-col :md="24-7" :sm="24"> - <shift-info :shiftSystemRow="shiftSystemRow"></shift-info> - </a-col> - </a-row> - - - </a-card> -</template> - -<script> - import { putAction, getAction } from '@/api/manage' - import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import BaseTree from '../common/BaseTree' - import ShiftSystem from './modules/shift/ShiftSystem' - import ShiftInfo from './modules/shift/ShiftInfo' - - export default { - name: 'ShiftManager', - components: { - BaseTree, ShiftSystem, ShiftInfo - }, - data() { - return { - shiftSystemRow: {}, - description: '鐝埗鐝', - url: { - equipmentStatistics: '/mdc/equipment/equipmentStatistics' - } - } - }, - created() { - }, - methods: { - selectionShiftRow(val) { - this.shiftSystemRow = val - } - } - - } -</script> -<style scoped> - -</style> \ No newline at end of file -- Gitblit v1.9.3