¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | |
| | | <!-- æä½æé®åºå --> |
| | | <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> |
| | |
| | | </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' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | |
| | | :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> |