田源
2025-01-16 cfd8d4c470cc6db6f6689ebf01eae07e47a46990
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue
@@ -18,33 +18,49 @@
          @current-change="currentChange"
        >
          <template slot="menuLeft" slot-scope="scope">
            <el-button v-if="permissionList.addBtn" icon="el-icon-plus" plain size="small" type="primary"
                       @click="rowSaveHandlerClick">创建
            <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary"
                       @click="rowSaveHandlerClick">
              <icon-show :name="permissionList.addBtn.source"></icon-show>
              创建
            </el-button>
            <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger"
                       @click="allDelHandler">删除
            <el-button v-if="permissionList.delBtn" class="button-custom-icon" plain size="small" type="danger"
                       @click="allDelHandler">
              <icon-show :name="permissionList.delBtn.source"></icon-show>
              删除
            </el-button>
            <el-button v-if="permissionList.viewTheScopeBtn" icon="el-icon-view" plain size="small" type="primary"
                       @click="chekView">查看使用范围
            <el-button v-if="permissionList.viewTheScopeBtn" class="button-custom-icon" plain size="small"
                       type="primary"
                       @click="chekView">
              <icon-show :name="permissionList.viewTheScopeBtn.source"></icon-show>
              查看使用范围
            </el-button>
            <el-button v-if="permissionList.downloadImportTemplateBtn" icon="el-icon-download" plain size="small"
            <el-button v-if="permissionList.downloadImportTemplateBtn" class="button-custom-icon" plain size="small"
                       type="primary" @click="downloadTemplateHandler">
              <icon-show :name="permissionList.downloadImportTemplateBtn.source"></icon-show>
              下载导入模板
            </el-button>
            <el-button v-if="permissionList.importBtn" icon="el-icon-upload2" plain size="small" type="primary"
                       @click="upLoadHandler">导入
            <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary"
                       @click="upLoadHandler">
              <icon-show :name="permissionList.importBtn.source"></icon-show>
              导入
            </el-button>
            <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary"
                       @click="downLoadHandler">导出
            <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary"
                       @click="downLoadHandler">
              <icon-show :name="permissionList.exportBtn.source"></icon-show>
              导出
            </el-button>
          </template>
          <template slot="menu" slot-scope="scope">
            <el-button v-if="permissionList.editBtn" icon="el-icon-edit" size="small" type="text"
                       @click="editBtnClick(scope.row)">编辑
            <el-button v-if="permissionList.editBtn" size="small" type="text"
                       @click="editBtnClick(scope.row)">
              <icon-show :name="permissionList.editBtn.source"></icon-show>
              编辑
            </el-button>
            <el-button v-if="permissionList.delBtn" icon="el-icon-delete" size="small" type="text"
                       @click="rowDeleteHandler(scope.row)">删除
            <el-button v-if="permissionList.delBtn" size="small" type="text"
                       @click="rowDeleteHandler(scope.row)">
              <icon-show :name="permissionList.delBtn.source"></icon-show>
              删除
            </el-button>
          </template>
        </avue-crud>
@@ -189,8 +205,8 @@
                使用枚举
              </template>
              <div>
                <el-tag :type="lastItem.enumFlag ? 'success' : 'danger'">
                  {{ lastItem.enumFlag ? '是' : '否' }}
                <el-tag :type="lastItem.enumId ? 'success' : 'danger'">
                  {{ lastItem.enumId ? '是' : '否' }}
                </el-tag>
              </div>
            </el-descriptions-item>
@@ -199,7 +215,7 @@
                枚举类型
              </template>
              <div>
                {{ lastItem.enumFlag }}
                {{ lastItem.enumId }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
@@ -304,18 +320,19 @@
              </el-col>
              <el-col :span="8">
                <el-form-item label="选择参照类型:" prop="referValue">
                  <el-input v-model="form.referValue" :clearable="true" @focus="referFormFocusHandler"></el-input>
                  <avue-input-tree key="businessReferValue" v-if="form.attributeSelectType === 'business'" default-expand-all :clearable="true" v-model="form.referValue" placeholder="请选择内容" :dic="businessData" @change="referValueChange"></avue-input-tree>
                  <avue-input-tree key="linkReferValue" v-else default-expand-all v-model="form.referValue" placeholder="请选择内容" :clearable="true" :dic="linkTypeData" @change="referValueChange"></avue-input-tree>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item v-if="form.attributeSelectType === 'link'" label="版本次:" prop="version">
                <el-form-item v-show="form.attributeSelectType === 'link'" label="版本次:" prop="version">
                  <el-select v-model="form.version" placeholder="请选择版本次">
                    <el-option :value="1" label="当前版本次"></el-option>
                    <el-option :value="3" label="最新版本次"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <div v-if="!form.referValue" style="clear: both">
              <div v-show="showEnumSwitch" style="clear: both">
                <el-col :span="8">
                  <el-form-item label="使用枚举:" prop="enumSwitch">
                    <el-switch v-model="form.enumSwitch" @change="switchEnumChange"></el-switch>
@@ -497,62 +514,10 @@
            </div>
          </div>
        </el-form>
        <!-- 业务类型对话框 -->
        <el-dialog
          v-dialogDrag
          :visible.sync="businessVisible"
          append-to-body="true"
          class="avue-dialog"
          title="业务类型选择"
          width="70%"
        >
          <avue-crud
            ref="businessCrud"
            :data="businessData"
            :option="businessOption"
            :table-loading="businessLoading"
            @search-change="businessHandleSearch"
            @search-reset="businessHandleReset"
            @row-click="businessRowClick"
          >
          </avue-crud>
          <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="businessSaveHandler">确 定</el-button>
          <el-button @click="businessEmpty">清 空</el-button>
         <el-button @click="businessVisible = false">取 消</el-button>
        </span>
        </el-dialog>
        <!-- 链接类型对话框 -->
        <el-dialog
          v-dialogDrag
          :visible.sync="linkTypeVisible"
          append-to-body="true"
          class="avue-dialog"
          title="链接类型选择"
          width="70%"
        >
          <avue-crud
            ref="linkTypeCrud"
            :data="linkTypeData"
            :option="linkTypeOption"
            :table-loading="linkTypeLoading"
            @search-change="linkHandleSearch"
            @search-reset="linkHandleReset"
            @row-click="linkRowClick"
          >
          </avue-crud>
          <span slot="footer" class="dialog-footer">
          <el-button @click="linkEmpty">清 空</el-button>
         <el-button @click="linkTypeVisible = false">取 消</el-button>
         <el-button type="primary" @click="linkSaveHandler">确 定</el-button>
        </span>
        </el-dialog>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addSaveHandler">确 定</el-button>
        <el-button @click="addEscHandler">取 消</el-button>
        <el-button size="small" type="primary" @click="addSaveHandler">确 定</el-button>
        <el-button size="small" @click="addEscHandler">取 消</el-button>
      </span>
    </el-dialog>
    <!--导入    -->
@@ -609,73 +574,8 @@
        ]
      },
      dialogTitle: "",
      businessRow: {},
      linkRow: {},
      linkDataSearch: [],
      businessSearchParams: {},
      linkTypeSearchParams: {},
      businessLoading: false,
      linkTypeLoading: false,
      businessVisible: false,
      linkTypeVisible: false,
      businessData: [],
      linkTypeData: [],
      businessOption: {
        ...basicOption,
        addBtn: false,
        menu: false,
        searchMenuSpan: 8,
        selection: false,
        refreshBtn: false,
        searchLabelWidth: 100,
        highlightCurrentRow: true,
        column: [
          {
            label: '业务类型名',
            prop: 'name',
            sortable: true,
            search: true
          },
          {
            label: '标签',
            prop: 'label',
            sortable: true,
          },
          {
            label: '父类',
            prop: 'fName',
            sortable: true,
          },
          {
            label: '版本规则',
            prop: 'revRuleName',
            sortable: true,
          },
          {
            label: '生命周期',
            prop: 'lifeCycle',
            sortable: true,
          },
        ]
      },
      linkTypeOption: {
        ...basicOption,
        addBtn: false,
        menu: false,
        searchMenuSpan: 8,
        selection: false,
        refreshBtn: false,
        searchLabelWidth: 100,
        highlightCurrentRow: true,
        column: [
          {
            label: '链接类型名',
            prop: 'name',
            sortable: true,
            search: true
          },
        ]
      },
      tableData: [],
      option: {
        ...basicOption,
@@ -728,6 +628,8 @@
      },
      addVisible: false,
      addLoading: false,
      referValueDic:[],
      showEnumSwitch:false,
      form: {
        id: "",
        name: "",
@@ -773,8 +675,8 @@
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].downloadImportTemplate, false),
        viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].viewTheScope, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOAD, false),
        viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].VIRTUALVIEW, false),
      };
    },
    lastItem() {
@@ -817,9 +719,24 @@
        this.tableData = data;
        this.page.total = res.data.total;
        this.tableLoading = false;
      }).catch(err => {
        this.$message.error(err)
      });
      //获取业务类型数据
      getBizTypes().then(res => {
        const data = res.data.data.map(item => ({
          label: item.name,
          value:item.name,
          desc:item.label
        }));
        this.businessData = data;
      })
      //获取链接类型数据
      getAllLtName().then(res => {
        const data = res.data.data.map(item => ({
          label: item,
          value:item
        }));
        this.linkTypeData = data;
      })
    },
    // 表格头部刷新
@@ -828,7 +745,7 @@
    },
    // 搜索
    handleSearch(params, done) {
    handleSearch(params, done) {debugger;
      this.searchParams = {
        "conditionMap[id]": "*" + params.id + "*"
      };
@@ -857,7 +774,7 @@
          this.lastIndex = newIndex;
        },
        () => {
          this.selectList = [];
          this.selectList = [row];
        }
      );
    },
@@ -1168,136 +1085,13 @@
    },
    // 值域类型切换
    attributeSelectTypeChange() {
      this.form.referValue = ''; // 切换值域类型 清空当前参照
      this.$forceUpdate(); // 强制更新form组件
      this.form.referValue = null; // 切换值域类型 清空当前参照
    },
    // 选择参照
    referFormFocusHandler() {
      const handlers = {
        business: () => {
          this.businessVisible = true;
          this.businessLoading = true;
          this.businessGetTable();
        },
        link: () => {
          this.linkTypeVisible = true;
          this.linkTypeLoading = true;
          this.linkGetTable();
        }
      };
      const {attributeSelectType} = this.form;
      const handler = handlers[attributeSelectType];
      if (handler) {
        handler();
      }
      ;
    //参照类型数据变化
    referValueChange(data){
      this.showEnumSwitch=!data.value;
    },
    // 业务类型表格数据请求
    businessGetTable() {
      getBizTypes(this.businessSearchParams).then(res => {
        const data = res.data.data;
        this.businessData = data;
        this.businessLoading = false;
      })
    },
    // 业务类型参照搜索
    businessHandleSearch(val, done) {
      this.businessSearchParams = {
        btmName: val.name
      }
      this.businessGetTable();
      done()
    },
    // 业务类型参照清空搜索
    businessHandleReset() {
      this.businessSearchParams = {};
      this.businessGetTable();
    },
    // 链接类型表格数据请求
    linkGetTable() {
      getAllLtName(this.linkTypeSearchParams).then(res => {
        const data = res.data.data.map(item => ({name: item}));
        ;
        this.linkTypeData = data;
        this.linkDataSearch = data;
        this.linkTypeLoading = false;
      })
    },
    // 链接类型参照搜索
    linkHandleSearch(params, done) {
      const {name} = params;
      if (!params.name) {
        this.linkTypeData = this.linkDataSearch;
        return done();
      }
      ;
      this.linkTypeData = this.linkDataSearch.filter(item => {
        console.log(item)
        return item.name && item.name.includes(name);
      });
      done();
    },
    // 链接类型参照清空搜索
    linkHandleReset() {
      this.linkTypeData = this.linkDataSearch;
    },
    // 业务类型表格行点击
    businessRowClick(row) {
      this.businessRow = row;
    },
    // 业务类型确定保存
    businessSaveHandler() {
      if (func.isEmptyObject(this.businessRow)) {
        this.$message.error('请选择一条数据!')
        return;
      }
      this.form.referValue = this.businessRow.name;
      this.businessVisible = false;
    },
    // 业务类型清空
    businessEmpty() {
      this.form.referValue = null;
      this.businessVisible = false;
    },
    // 链接类型确定保存
    linkRowClick(row) {
      this.linkRow = row;
    },
    // 业务类型确定保存
    linkSaveHandler() {
      if (func.isEmptyObject(this.linkRow)) {
        this.$message.error('请选择一条数据!')
        return;
      }
      this.form.referValue = this.linkRow.name;
      this.linkTypeVisible = false;
    },
    // 链接类型清空
    linkEmpty() {
      this.form.referValue = null;
      this.linkTypeVisible = false;
    },
    // 关闭新增对话框
    addEscHandler() {
      this.addVisible = false;
@@ -1318,7 +1112,7 @@
        attributeSelectType: "business",
        version: 1,
        defaultValue: "",//默认值
        referValue: "",
        referValue: null,
        btmTypeId: "",
        linkTypeName: "",
        rangeValue: ""
@@ -1331,7 +1125,17 @@
    addSaveHandler() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.form.range = this.form.rangeValue ? this.form.rangeValue.replace(/\n/g, ';') : '';
          if(this.form.attributeDataType === 'VTString'){
            if(!this.form.referValue){
              //参照类型没有值
            }else {
              this.form.enumSwitch=false;
              this.form.rangeValue=''
            }
          }
          this.form.range = this.form.rangeValue.length>0 ? this.form.rangeValue.replace(/\n/g, ';') : '';
          if (this.form.attributeSelectType === 'business') {
            this.form.btmTypeId = this.form.referValue;
            this.form.linkTypeName = "";