From 36183a25c19f8c31ba082592329e7aff3caf97d5 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期一, 30 六月 2025 21:57:30 +0800 Subject: [PATCH] 岗位管理、业务编码规则 --- src/views/system/modules/SysBusinessCodeRuleModal.vue | 138 +++++++++++ src/views/system/SysPositionList.vue | 161 ++++++------- src/views/system/modules/SysPositionModal.vue | 214 ++++++----------- src/views/system/SysBusinessCodeRuleList.vue | 177 ++++++++++++++ 4 files changed, 471 insertions(+), 219 deletions(-) diff --git a/src/views/system/SysBusinessCodeRuleList.vue b/src/views/system/SysBusinessCodeRuleList.vue new file mode 100644 index 0000000..df1b693 --- /dev/null +++ b/src/views/system/SysBusinessCodeRuleList.vue @@ -0,0 +1,177 @@ +<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="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="涓氬姟鍚嶇О"> + <j-input placeholder="璇疯緭鍏ヤ笟鍔″悕绉�" v-model="queryParam.businessName"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="涓氬姟缂栫爜"> + <j-input placeholder="璇疯緭鍏ヤ笟鍔$紪鐮�" v-model="queryParam.businessCode"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="缂栫爜鍓嶇紑"> + <j-input placeholder="璇疯緭鍏ョ紪鐮佸墠缂�" v-model="queryParam.prefix"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :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 @click="handleAdd" type="primary" icon="plus">鏂板</a-button> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"> + <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">{{ selectedRowKeys.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + class="j-table-force-nowrap" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + <!-- table鍖哄煙-end --> + + <!-- 琛ㄥ崟鍖哄煙 --> + <sysBusinessCodeRule-modal ref="modalForm" @ok="modalFormOk"></sysBusinessCodeRule-modal> + </a-card> +</template> + +<script> +import '@/assets/less/TableExpand.less' +import SysBusinessCodeRuleModal from './modules/SysBusinessCodeRuleModal' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' + +export default { + name: 'SysBusinessCodeRuleList', + mixins: [JeecgListMixin], + components: { + SysBusinessCodeRuleModal + }, + data() { + return { + description: '涓氬姟缂栫爜瑙勫垯绠$悊椤甸潰', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + } + }, + { + title: '涓氬姟鍚嶇О', + align: 'center', + dataIndex: 'businessName' + }, + { + title: '涓氬姟缂栫爜', + align: 'center', + dataIndex: 'businessCode' + }, + { + title: '缂栫爜鍓嶇紑', + align: 'center', + dataIndex: 'prefix' + }, + { + title: '骞翠唤缂栫爜鏍煎紡', + align: 'center', + dataIndex: 'yearFormat' + }, + { + title: '鏈堜唤缂栫爜鏍煎紡', + align: 'center', + dataIndex: 'monthFormat' + }, + { + title: '澶╃紪鐮佹牸寮�', + align: 'center', + dataIndex: 'dayFormat' + }, + { + title: '搴忓彿闀垮害', + align: 'center', + dataIndex: 'seqLength' + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: '/sys/sysBusinessCodeRule/list', + delete: '/sys/sysBusinessCodeRule/delete', + deleteBatch: '/sys/sysBusinessCodeRule/deleteBatch', + } + } + }, + computed: { + }, + methods: {} +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/src/views/system/SysPositionList.vue b/src/views/system/SysPositionList.vue index e3e8a2b..2decdbc 100644 --- a/src/views/system/SysPositionList.vue +++ b/src/views/system/SysPositionList.vue @@ -7,31 +7,19 @@ <a-row :gutter="24"> <a-col :md="6" :sm="8"> - <a-form-item label="鑱屽姟缂栫爜"> - <a-input placeholder="璇疯緭鍏ヨ亴鍔$紪鐮�" v-model="queryParam.code"></a-input> + <a-form-item label="宀椾綅缂栫爜"> + <j-input placeholder="璇疯緭鍏ュ矖浣嶇紪鐮�" v-model="queryParam.code"></j-input> </a-form-item> </a-col> <a-col :md="6" :sm="8"> - <a-form-item label="鑱屽姟鍚嶇О"> - <a-input placeholder="璇疯緭鍏ヨ亴鍔″悕绉�" v-model="queryParam.name"></a-input> + <a-form-item label="宀椾綅鍚嶇О"> + <j-input placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" v-model="queryParam.name"></j-input> </a-form-item> </a-col> - <template v-if="toggleSearchStatus"> - <a-col :md="6" :sm="8"> - <a-form-item label="鑱岀骇"> - <j-dict-select-tag v-model="queryParam.postRank" placeholder="璇烽�夋嫨鑱岀骇" dictCode="position_rank"/> - </a-form-item> - </a-col> - - </template> <a-col :md="6" :sm="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> - <a @click="handleToggleSearch" style="margin-left: 8px"> - {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }} - <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> - </a> + <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> </span> </a-col> @@ -41,20 +29,19 @@ <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> <div class="table-operator"> - <a-button @click="handleAdd" type="primary" icon="plus">鏂板</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-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-dropdown v-if="selectedRowKeys.length > 0"> <a-menu slot="overlay"> <a-menu-item key="1" @click="batchDel"> <a-icon type="delete"/> 鍒犻櫎 </a-menu-item> - </a-menu> <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 - + </a-menu> + <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down"/> </a-button> </a-dropdown> @@ -105,74 +92,74 @@ </template> <script> - import SysPositionModal from './modules/SysPositionModal' - import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import JDictSelectTag from '@/components/dict/JDictSelectTag' +import SysPositionModal from './modules/SysPositionModal' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import JDictSelectTag from '@/components/dict/JDictSelectTag' - export default { - name: 'SysPositionList', - mixins: [JeecgListMixin], - components: { - SysPositionModal, - JDictSelectTag - }, - data() { - return { - description: '鑱屽姟琛ㄧ鐞嗛〉闈�', - // 琛ㄥご - columns: [ - { - title: '#', - dataIndex: '', - key: 'rowIndex', - width: 60, - align: 'center', - customRender: function (t, r, index) { - return parseInt(index) + 1 - } - }, - { - title: '鑱屽姟缂栫爜', - align: 'center', - dataIndex: 'code' - }, - { - title: '鑱屽姟鍚嶇О', - align: 'center', - dataIndex: 'name' - }, - { - title: '鑱岀骇', - align: 'center', - dataIndex: 'postRank_dictText' - }, - // { - // title: '鍏徃id', - // align: 'center', - // dataIndex: 'companyId' - // }, - { - title: '鎿嶄綔', - dataIndex: 'action', - align: 'center', - scopedSlots: { customRender: 'action' }, +export default { + name: 'SysPositionList', + mixins: [JeecgListMixin], + components: { + SysPositionModal, + JDictSelectTag + }, + data() { + return { + description: '鑱屽姟琛ㄧ鐞嗛〉闈�', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 } - ], - url: { - list: '/sys/position/list', - delete: '/sys/position/delete', - deleteBatch: '/sys/position/deleteBatch', - exportXlsUrl: '/sys/position/exportXls', - importExcelUrl: 'sys/position/importExcel', }, - } - }, - computed: { - importExcelUrl: function () { - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` - } + { + title: '宀椾綅缂栫爜', + align: 'center', + dataIndex: 'code' + }, + { + title: '宀椾綅鍚嶇О', + align: 'center', + dataIndex: 'name' + }, + // { + // title: '鑱岀骇', + // align: 'center', + // dataIndex: 'postRank_dictText' + // }, + // { + // title: '鍏徃id', + // align: 'center', + // dataIndex: 'companyId' + // }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: '/sys/position/list', + delete: '/sys/position/delete', + deleteBatch: '/sys/position/deleteBatch', + exportXlsUrl: '/sys/position/exportXls', + importExcelUrl: 'sys/position/importExcel', + }, + } + }, + computed: { + importExcelUrl: function () { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` } } +} </script> <style scoped> @import '~@assets/less/common.less' diff --git a/src/views/system/modules/SysBusinessCodeRuleModal.vue b/src/views/system/modules/SysBusinessCodeRuleModal.vue new file mode 100644 index 0000000..af61492 --- /dev/null +++ b/src/views/system/modules/SysBusinessCodeRuleModal.vue @@ -0,0 +1,138 @@ +<template> + <j-modal + :title="title" + :width="800" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessName" label="涓氬姟鍚嶇О"> + <a-input placeholder="璇疯緭鍏ヤ笟鍔″悕绉�" v-model="model.businessName" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessCode" label="涓氬姟缂栫爜"> + <a-input placeholder="璇疯緭鍏ヤ笟鍔$紪鐮�" v-model="model.businessCode" :disabled="editable" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="prefix" label="缂栫爜鍓嶇紑"> + <a-input placeholder="璇疯緭鍏ョ紪鐮佸墠缂�" v-model="model.prefix" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yearFormat" label="骞翠唤缂栫爜鏍煎紡"> + <a-input placeholder="鍙傝�冩棩鏈熷勾浠界紪鐮佹牸寮�" v-model="model.yearFormat" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="monthFormat" label="鏈堜唤缂栫爜鏍煎紡"> + <a-input placeholder="鍙傝�冩棩鏈熸湀浠界紪鐮佹牸寮�" v-model="model.monthFormat" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dayFormat" label="澶╃紪鐮佹牸寮�"> + <a-input placeholder="鍙傝�冩棩鏈熷ぉ鐨勭紪鐮佹牸寮�" v-model="model.dayFormat" /> + </a-form-model-item> + <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="seqLength" label="搴忓彿闀垮害"> + <a-input-number v-model="model.seqLength" :min="1" :max="10" :precision="0" /> + </a-form-model-item> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> +import { httpAction } from '@/api/manage' +import { validateDuplicateValue } from '@/utils/util' + +export default { + name: 'SysBusinessCodeRuleModal', + data() { + return { + title: '鎿嶄綔', + visible: false, + editable: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + confirmLoading: false, + validatorRules: { + businessName: [ + { required: true, message: '璇疯緭鍏ヤ笟鍔″悕绉�!' } + ], + businessCode: [ + { required: true, message: '璇疯緭鍏ヤ笟鍔$紪鐮�!' }, + { validator: (rule, value, callback) => validateDuplicateValue('sys_business_code_rule', 'business_code', value, this.model.id, callback) } + ], + seqLength: [ + { required: true, message: '璇疯緭鍏ュ簭鍙烽暱搴�!' } + ] + }, + url: { + add: '/sys/sysBusinessCodeRule/add', + edit: '/sys/sysBusinessCodeRule/edit' + } + } + }, + created() { + }, + methods: { + add() { + this.model = {}; + this.model.seqLength = 4; + this.editable = false; + this.visible = true + }, + edit(record) { + this.editable = true; + this.model = Object.assign({}, record) + this.visible = true + }, + close() { + this.$emit('close') + this.visible = false + this.$refs.form.clearValidate() + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' + } + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } else { + return false + } + }) + }, + handleCancel() { + this.close() + } + } +} +</script> + +<style lang="less" scoped> + +</style> \ No newline at end of file diff --git a/src/views/system/modules/SysPositionModal.vue b/src/views/system/modules/SysPositionModal.vue index 770f444..4d8a9b8 100644 --- a/src/views/system/modules/SysPositionModal.vue +++ b/src/views/system/modules/SysPositionModal.vue @@ -16,158 +16,108 @@ :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code" - required - label="鑱屽姟缂栫爜"> - <a-input placeholder="璇疯緭鍏ヨ亴鍔$紪鐮�" v-model="model.code" :read-only="readOnly"/> + label="宀椾綅缂栫爜"> + <a-input placeholder="宀椾綅缂栫爜鑷姩鐢熸垚" v-model="model.code" disabled /> </a-form-model-item> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name" - required - label="鑱屽姟鍚嶇О"> - <a-input placeholder="璇疯緭鍏ヨ亴鍔″悕绉�" v-model="model.name"/> + label="宀椾綅鍚嶇О"> + <a-input placeholder="璇疯緭鍏ュ矖浣嶅悕绉�" v-model="model.name" /> </a-form-model-item> - <a-form-model-item - :labelCol="labelCol" - :wrapperCol="wrapperCol" - prop="postRank" - required - label="鑱岀骇" - > - <j-dict-select-tag - placeholder="璇烽�夋嫨鑱岀骇" - dictCode="position_rank" - v-model="model.postRank" - /> - </a-form-model-item> - </a-form-model> </a-spin> </a-modal> </template> <script> - import pick from 'lodash.pick' - import { httpAction } from '@/api/manage' - import { duplicateCheck } from '@/api/api' - import JDictSelectTag from '@/components/dict/JDictSelectTag' +import { httpAction } from '@/api/manage' - let validatorCodeTimer = null - - export default { - name: 'SysPositionModal', - components: { JDictSelectTag }, - data() { - return { - title: '鎿嶄綔', - visible: false, - model: {}, - labelCol: { - xs: { span: 24 }, - sm: { span: 5 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 }, - }, - confirmLoading: false, - validatorRules: { - code: [ - { required: true, message: '璇疯緭鍏ヨ亴鍔$紪鐮�' }, - { - validator: (rule, value, callback) => { - // 鍑芥暟娑堟姈鐨勭畝鍗曞疄鐜帮紝闃叉涓�娈垫椂闂村唴鍙戦�佸娆¤姹� - if (validatorCodeTimer) { - // 鍋滄涓婃寮�鍚殑瀹氭椂鍣� - clearTimeout(validatorCodeTimer) - } - validatorCodeTimer = setTimeout(() => { - duplicateCheck({ - tableName: 'sys_position', - fieldName: 'code', - fieldVal: value, - dataId: this.model.id - }).then((res) => { - if (res.success) { - callback() - } else { - callback(res.message) - } - }).catch(console.error) - }, 300) - } - } - ], - name: [{ required: true, message: '璇疯緭鍏ヨ亴鍔″悕绉�' }] , - postRank: [{ required: true, message: '璇烽�夋嫨鑱岀骇' }] , - }, - url: { - add: '/sys/position/add', - edit: '/sys/position/edit', - }, - readOnly:false +export default { + name: 'SysPositionModal', + data() { + return { + title: '鎿嶄綔', + visible: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + confirmLoading: false, + validatorRules: { + name: [{ required: true, message: '璇疯緭鍏ュ矖浣嶅悕绉�' }] + }, + url: { + add: '/sys/position/add', + edit: '/sys/position/edit' + }, + readOnly: false + } + }, + created() { + }, + methods: { + add() { + this.edit({}) + }, + edit(record) { + this.model = Object.assign({}, record) + this.visible = true + if (record.id) { + this.readOnly = true + } else { + this.readOnly = false } }, - created() { + close() { + this.$emit('close') + this.visible = false + this.$refs.form.resetFields() }, - methods: { - add() { - this.edit({}) - }, - edit(record) { - this.model = Object.assign({}, record) - this.visible = true - if(record.id){ - this.readOnly=true - }else{ - this.readOnly=false - } - }, - close() { - this.$emit('close') - this.visible = false - this.$refs.form.resetFields(); - }, - handleOk() { - const that = this - // 瑙﹀彂琛ㄥ崟楠岃瘉 - this.$refs.form.validate(valid => { - if (valid) { - that.confirmLoading = true - let httpurl = '' - let method = '' - if (!this.model.id) { - httpurl += this.url.add - method = 'post' - } else { - httpurl += this.url.edit - method = 'put' - } - - httpAction(httpurl, this.model, method).then((res) => { - if (res.success) { - that.$message.success(res.message) - that.$emit('ok') - } else { - that.$message.warning(res.message) - } - }).finally(() => { - that.confirmLoading = false - that.close() - }) - }else{ - return false; + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' } - }) - }, - handleCancel() { - this.close() - }, - + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } else { + return false + } + }) + }, + handleCancel() { + this.close() } + } +} </script> <style lang="less" scoped> -- Gitblit v1.9.3