zhangherong
2025-07-05 fe1ca6baff74b189c737e28e4a5fc2090e0e55b5
art: HF编码维护-新增页面
已添加2个文件
326 ■■■■■ 文件已修改
src/views/eam/base/EamBaseHFCodeList.vue 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/modules/EamBaseHFCodeModal.vue 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/base/EamBaseHFCodeList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,183 @@
<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="HF编码">
              <j-input placeholder="请输入HF编码" v-model="queryParam.hfCode"></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.hfName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="模板分类">
              <j-dict-select-tag dict-code="hf_template_category" placeholder="请选择模板分类"
                                 v-model="queryParam.hfCategory"></j-dict-select-tag>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="状态">
              <j-dict-select-tag dict-code="enable_disable" placeholder="请选择状态"
                                 v-model="queryParam.hfStatus"></j-dict-select-tag>
            </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 @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)" v-if="record.hfStatus === 'ENABLE'">编辑</a>
          <a-divider type="vertical" v-if="record.hfStatus === 'ENABLE'" />
          <a @click="handleUpgrade(record)" v-if="record.hfStatus === 'ENABLE'">升版</a>
          <a-divider type="vertical" v-if="record.hfStatus === 'ENABLE'" />
          <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 -->
    <!-- è¡¨å•区域 -->
    <eamBaseHFCode-modal ref="modalForm" @ok="modalFormOk"></eamBaseHFCode-modal>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import EamBaseHFCodeModal from './modules/EamBaseHFCodeModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'EamBaseHFCodeList',
  mixins: [JeecgListMixin],
  components: {
    EamBaseHFCodeModal
  },
  data() {
    return {
      description: 'HFCode维护管理页面',
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: 'HF编码',
          align: 'center',
          dataIndex: 'hfCode'
        },
        {
          title: '模板名称',
          align: 'center',
          dataIndex: 'hfName'
        },
        {
          title: '模板分类',
          align: 'center',
          dataIndex: 'hfCategory_dictText'
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'hfStatus_dictText'
        },
        {
          title: '版本',
          align: 'center',
          dataIndex: 'hfVersion'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/eam/eamBaseHFCode/list',
        delete: '/eam/eamBaseHFCode/delete',
        deleteBatch: '/eam/eamBaseHFCode/deleteBatch'
      }
    }
  },
  computed: {},
  methods: {
    handleUpgrade(record) {
      //升版
      this.$refs.modalForm.upgrade(record);
      this.$refs.modalForm.title = "升版";
      this.$refs.modalForm.disableSubmit = false;
    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/base/modules/EamBaseHFCodeModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,143 @@
<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="hfCode" label="HF编码">
          <a-input placeholder="请输入HF编码" v-model="model.hfCode" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hfName" label="模板名称">
          <a-input placeholder="请输入模板名称" v-model="model.hfName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hfCategory" label="模板分类">
          <j-dict-select-tag dict-code="hf_template_category" placeholder="请选择模板分类" :disabled="editable"
                             v-model="model.hfCategory"></j-dict-select-tag>
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import moment from 'moment'
export default {
  name: 'EamBaseHFCodeModal',
  data() {
    return {
      title: '操作',
      visible: false,
      model: {},
      editable: false,
      upgradeFlag: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      validatorRules: {
        hfCode:[
          { required: true, message: '请输入HF编码!' }
        ],
        hfName: [
          { required: true, message: '请输入模板名称!' }
        ],
        hfCategory: [
          { required: true, message: '请选择模板分类!' }
        ],
      },
      url: {
        add: '/eam/eamBaseHFCode/add',
        edit: '/eam/eamBaseHFCode/edit',
        upgrade: '/eam/eamBaseHFCode/upgrade',
      }
    }
  },
  created() {
  },
  methods: {
    add() {
      //初始化默认值
      this.model = {};
      this.visible = true;
      this.editable = false;
      this.upgradeFlag = false;
    },
    edit(record) {
      this.model = Object.assign({}, record);
      this.visible = true;
      this.editable = true;
      this.upgradeFlag = false;
    },
    upgrade(record) {
      this.model = Object.assign({}, record);
      this.visible = true;
      this.editable = true;
      this.upgradeFlag = 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 {
            if(this.upgradeFlag) {
              httpurl+=this.url.upgrade;
            }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')
              that.close();
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        } else {
          return false
        }
      })
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
<style lang="less" scoped>
</style>