Lius
2025-06-30 36183a25c19f8c31ba082592329e7aff3caf97d5
岗位管理、业务编码规则
已添加2个文件
已修改2个文件
436 ■■■■ 文件已修改
src/views/system/SysBusinessCodeRuleList.vue 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/SysPositionList.vue 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SysBusinessCodeRuleModal.vue 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SysPositionModal.vue 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
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>
@@ -132,20 +119,20 @@
            }
          },
          {
            title: '职务编码',
          title: '岗位编码',
            align: 'center',
            dataIndex: 'code'
          },
          {
            title: '职务名称',
          title: '岗位名称',
            align: 'center',
            dataIndex: 'name'
          },
          {
            title: '职级',
            align: 'center',
            dataIndex: 'postRank_dictText'
          },
        // {
        //   title: '职级',
        //   align: 'center',
        //   dataIndex: 'postRank_dictText'
        // },
          // {
          //   title: '公司id',
          //   align: 'center',
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>
src/views/system/modules/SysPositionModal.vue
@@ -16,48 +16,26 @@
          :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'
  let validatorCodeTimer = null
  export default {
    name: 'SysPositionModal',
    components: { JDictSelectTag },
    data() {
      return {
        title: '操作',
@@ -65,46 +43,19 @@
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        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: '请选择职级' }] ,
        name: [{ required: true, message: '请输入岗位名称' }]
        },
        url: {
          add: '/sys/position/add',
          edit: '/sys/position/edit',
        edit: '/sys/position/edit'
        },
        readOnly:false
      }
@@ -127,7 +78,7 @@
      close() {
        this.$emit('close')
        this.visible = false
        this.$refs.form.resetFields();
      this.$refs.form.resetFields()
      },
      handleOk() {
        const that = this
@@ -157,14 +108,13 @@
              that.close()
            })
          }else{
            return false;
          return false
          }
        })
      },
      handleCancel() {
        this.close()
      },
    }
    }
  }