zhangherong
2025-03-17 d917606e37cb420a1a2fe8245b7a82cbb2795a0f
art:系统管理-业务编码规则 新增
已添加2个文件
316 ■■■■■ 文件已修改
src/views/system/SysBusinessCodeRuleList.vue 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SysBusinessCodeRuleModal.vue 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/SysBusinessCodeRuleList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,182 @@
<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: '当前序号',
          align: 'center',
          dataIndex: 'currentNum'
        },
        {
          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/modules/SysBusinessCodeRuleModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,134 @@
<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" />
        </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,
      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.edit({ seqLength: 4 })
    },
    edit(record) {
      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>