ludc
2023-07-05 1c407a93546036bc0438fbe019aeaf03f6ef1805
Source/UBCS-WEB/src/components/Tree/attrCrud.vue
@@ -1,34 +1,34 @@
<template>
  <div>
    <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag">
      <el-button-group>
      <!--新增-->
      <el-button v-if="attrEditVisible == false && attrFlagChiledren==false" size="small" type="primary"
                 @click="busineHandle">+ 添加 {{ msg }}
      </el-button>
      <el-button v-if="attrEditVisible == false && attrFlagChiledren==false" size="small" type="primary" icon="el-icon-plus" @click="busineHandle">添加 {{ msg }}</el-button>
      <!--        全屏编辑-->
      <el-button v-if=" attrEditVisible == false && attrFlagChiledren==false" size="small" @click="fullscreenHandle">
        全屏编辑
      </el-button>
      <!--    组合规则-->
      <el-button size="small" @click="isShowHandler">组合规则</el-button>
      <el-button v-if=" attrEditVisible == false && attrFlagChiledren==false" size="small" @click="fullscreenHandle" icon="el-icon-full-screen">全屏编辑</el-button>
      <!--        验证规则-->
      <el-button icon="el-icon-info" size="small" @click="rulesVisible=true">验证规则</el-button>
      <!--        属性分组-->
      <el-button icon="el-icon-menu" size="small" @click="attrVisibleHandle">属性分组</el-button>
      <!--        分类注入-->
      <el-button icon="el-icon-magic-stick" size="small" @click="injectBtn">分类注入</el-button>
      <!--        枚举注入-->
      <el-button size="small" @click="enmuVisHandle">枚举注入</el-button>
      <!--    级联属性-->
      <el-button size="small" @click="CascadeHandle">级联属性</el-button>
      <!--    预览排序-->
      <el-button size="small">预览排序</el-button>
      </el-button-group>
      <el-button-group>
        <!--        分类注入-->
        <el-button icon="el-icon-magic-stick" size="small" @click="injectBtn">分类注入</el-button>
          <!--    组合规则-->
          <el-button size="small" @click="isShowHandler">组合规则</el-button>
        <!--        枚举注入-->
        <el-button size="small" @click="enmuVisHandle">枚举注入</el-button>
        <!--    级联属性-->
        <el-button size="small" @click="CascadeHandle">级联属性</el-button>
        <!--    预览排序-->
        <el-button size="small" icon="el-icon-arrow-down">预览排序</el-button>
      </el-button-group>
      <!--    保存-->
      <el-button size="small" @click="addsHandler">保存</el-button>
      <el-button size="small" @click="addsHandler" icon="el-icon-check">保存</el-button>
      <!--    删除-->
      <el-button size="small" @click="CrudRemove">删除</el-button>
      <el-button size="small" @click="CrudRemove" icon="el-icon-delete">删除</el-button>
      <!--    重置-->
      <el-button size="small" @click="reset">重置</el-button>
      <el-button size="small" @click="reset" icon="el-icon-refresh-right">重置</el-button>
      <!--    同步到其他模板-->
      <el-button size="small" @click="syncHandle">同步到其他模板</el-button>
      <!--    编码申请预览-->
@@ -92,7 +92,7 @@
            </el-table-column>
            <el-table-column fixed="right" label="操作" width="120">
              <template slot-scope="scope">
                <el-button size="small" type="text" @click.native.prevent="enumDeleteRow(scope.$index, tableData)">
                <el-button size="small" type="text" plain @click="enumDeleteRow">
                  移除
                </el-button>
              </template>
@@ -209,7 +209,7 @@
      ></formula-editor>
      <!--    新增  -->
      <el-dialog :visible.sync="addVisible" append-to-body title="从业务类型中选择属性">
        <avue-crud :data="businessData" :option="businessOption" @select="businessSelect">
        <avue-crud :data="businessData" :option="businessOption" @selection-change="businessSelect">
          <template slot="menuLeft">
            <div style="display: flex;">
              <el-select>
@@ -224,7 +224,7 @@
        </avue-crud>
        <div style="display: flex;justify-content: flex-end;margin-top: 15px">
          <el-button size="small" type="primary" @click="busineAddHandle">保存</el-button>
          <el-button size="small" type="primary">取消</el-button>
          <el-button size="small" type="primary" @click="addVisible=false">取消</el-button>
        </div>
      </el-dialog>
    </div>
@@ -232,28 +232,30 @@
              style="width: 100%"
              @cell-click="handleCellClicks"
              @select="selectHandle"
              @selection-change="selectionChange"
              v-if="this.crudArrayFlag"
    >
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column fixed label="序号" type="index" width="55"></el-table-column>
      <!--<el-table-column fixed label="序号" type="index" width="55"></el-table-column>-->
      <el-table-column v-for="item in this.option.column" :key="item.id"
                       :label="item.label"
                       :prop="item.prop"
                       :formatter="formAttr"
                       :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'"
                       :width="item.width||(item.label.length >=4 ?'150':item.label.length==3 ?'120':'90')"
                       :show-overflow-tooltip="true"
                       align="center"
      >
        <template slot-scope="{ row }">
          <el-input v-if="editingRows === row && editShows== item.prop" v-model="row[item.prop]"
          <el-input v-if="editingRows === row && editShows== item.prop && (item.edit == 'text' || item.edit == 'select' ||item.edit == 'refer')" v-model="row[item.prop]"
                    @blur="saveRows"></el-input>
          <el-input-number controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
                           @blur="saveRows"></el-input-number>
          <el-switch
            v-if="item.label === 'true' || item.label === 'false'"
            active-color="#13ce66"
            inactive-color="#ff4949">
            v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true"
            inactive-value="false">
          </el-switch>
          <span v-else>{{ row[item.prop] }}</span>
        </template>
@@ -335,14 +337,14 @@
      },
      // 编码申请预览data
      applicationData: [],
      //业务类型单选数组
      //业务类型选择数组
      busineSelectList: [],
      //业务类型添加数据
      busineAddList: {},
      //表格单选数组
      CrudSelect: [],
      attrSelectList: [],
      //表格oid
      CrudOid: "",
      attrOid: "",
      //场景变量
      thisSceneTableData: [
        {
@@ -900,11 +902,27 @@
          },
          {
            label: "数据类型",
            prop: "attrDataType"
            prop: "attrDataType",
            formatter:function(row,column){
              let vciFieldTypeMap = {
                VTBoolean: "布尔型",
                VTClob: "长文本",
                VTDate: "日期",
                VTDateTime: "日期时间",
                VTTime: "时间",
                VTLong: "长整型",
                VTDouble: "金额/双精度",
                VTInteger: "整形",
                VTFilePath: "文件",
                VTString: "字符串"
              }
              return vciFieldTypeMap[row.attrDataType];
            }
          },
          {
            label: "可空",
            prop: "nullableFlag"
            prop: "nullableFlag",
            formatter:function(row,column){return row.nullableFlag=='true' || row.nullableFlag=='1'?'是':'否'}
          },
          {
            label: "默认值",
@@ -924,11 +942,25 @@
          },
          {
            label: "参照",
            prop: "referFlag"
            prop: "referFlag",
            formatter: function (d) {
              if (!d.referFlag) {
                return '';
              } else {
                return d.referBtmTypeId
              }
            }
          },
          {
            label: "枚举",
            prop: "enumFlag"
            prop: "enumFlag",
            formatter: function (d) {
              if (!d.enumFlag) {
                return '';
              } else {
                return d.enumId
              }
            }
          },
        ]
      },
@@ -940,7 +972,7 @@
      rowCellList: [],
      List: [],
      option: {
        index: true,
        index: false,
        border: true,
        editBtn: false,
        selection: true,
@@ -953,8 +985,14 @@
          prop: 'name',
          order: 'descending'
        },
        column: [
          {
        column: [{
          prop: 'orderNum',
          label: '排序号',
          sortable: true,
          edit: 'number',
          width: 70,
          fixed: true
        }, {
            label: "属性英文编号",
            prop: "id",
            fixed: true,
@@ -969,6 +1007,7 @@
            fixed: true,
            cell: false,
            width: 125,
            edit: 'text',
            sortable: true
          },
          {
@@ -976,6 +1015,7 @@
            prop: "attributeGroup",
            cell: false,
            sortable: true,
            edit: 'text',
            width: 125,
          },
          {
@@ -990,78 +1030,90 @@
            cell: false,
            sortable: true,
            width: 105,
            edit: 'number'
          },
          {
            label: "关键属性",
            prop: "keyAttrFlag",
            cell: false,
            type: "switch",
            edit: "switch"
          },
          {
            label: "查询属性",
            prop: "queryAttrFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "高级查询属性",
            prop: "seniorQueryAttrFlag",
            width: 95,
            width: 110,
            cell: false,
            edit: "switch"
          },
          {
            label: "相似查询属性",
            label: "相似查重属性",
            prop: "sameRepeatAttrFlag",
            width: 95,
            width: 110,
            cell: false,
            edit: "switch"
          },
          {
            label: "必输",
            prop: "requireFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "表单显示",
            prop: "formDisplayFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "列表显示",
            prop: "tableDisplayFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "只读",
            prop: "readonlyFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "列表排序",
            prop: "sortAttrFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "多行文本",
            prop: "textareaFlag",
            cell: false,
            edit: "switch"
          },
          {
            label: "默认值",
            prop: "defaultValue",
            sortable: true,
            cell: false,
            edit: 'text',
            width: 95,
          },
          {
            label: "前缀",
            prop: "prefixValue",
            sortable: true,
            edit: 'select',
            cell: false,
          },
          {
            label: "后缀",
            prop: "suffixValue",
            sortable: true,
            edit: 'select',
            cell: false,
          },
          {
@@ -1069,6 +1121,7 @@
            prop: "componentRule",
            sortable: true,
            cell: false,
            edit: 'refer',
            width: 105,
          },
          {
@@ -1076,6 +1129,7 @@
            prop: "verifyRule",
            sortable: true,
            cell: false,
            edit: 'refer',
            width: 105,
          },
          {
@@ -1083,84 +1137,97 @@
            prop: "codeDateFormat",
            sortable: true,
            width: 105,
            edit: 'select',
            cell: false,
          },
          {
            label: "分类注入",
            prop: "classifyInvokeLevel",
            cell: false,
            edit: 'refer'
          },
          {
            label: "枚举注入",
            prop: "enumString",
            cell: false,
            edit: 'refer'
          },
          {
            label: "级联属性",
            prop: "parentCode",
            cell: false,
            edit: 'refer'
          },
          {
            label: "参照配置",
            prop: "referConfig",
            cell: false,
            edit: 'refer'
          },
          {
            label: "级联查询属性",
            prop: "parentQueryAttr",
            width: 105,
            cell: false,
            edit: 'text'
          },
          {
            label: "选择库标识",
            prop: "libraryIdentification",
            width: 105,
            cell: false,
            edit: 'text'
          },
          {
            label: "填写提示",
            prop: "explain",
            cell: false,
            edit: 'text'
          },
          {
            label: "表单显示样式",
            prop: "formDisplayStyle",
            width: 105,
            cell: false,
            edit: 'text'
          },
          {
            label: "表格显示样式",
            prop: "tableDisplayStyle",
            width: 105,
            cell: false,
            edit: 'text'
          },
          {
            label: "表单超链接",
            prop: "formHref",
            width: 95,
            cell: false,
            edit: 'text'
          },
          {
            label: "表格超链接",
            prop: "tableHref",
            width: 95,
            cell: false,
            edit: 'text'
          },
          {
            label: "表格显示js",
            prop: "tableDisplayJs",
            width: 95,
            cell: false,
            edit: 'text'
          },
          {
            label: "长度",
            prop: "controlLength",
            cell: false,
            cell: false
          },
          {
            label: "小数精度",
            prop: "precisionLength",
            cell: false,
            cell: false
          },
          {
            label: "取值范围",
@@ -1168,10 +1235,39 @@
            sortable: true,
            cell: false,
            width: 105,
            edit: 'text'
          },
        ],
        List: []
      },
      vciFieldTypeMap : {
        VTBoolean: "布尔型",
        VTClob: "长文本",
        VTDate: "日期",
        VTDateTime: "日期时间",
        VTTime: "时间",
        VTLong: "长整型",
        VTDouble: "金额/双精度",
        VTInteger: "整形",
        VTFilePath: "文件",
        VTString: "字符串"
      }
    }
  },
  computed:{
    attrOids() {
      let oids = [];
      this.attrSelectList.forEach(ele => {
        oids.push(ele.oid);
      });
      return oids.join(",");
    },
    busineOids() {
      let oids = [];
      this.busineSelectList.forEach(ele => {
        oids.push(ele.oid);
      });
      return oids.join(",");
    }
  },
  mounted() {
@@ -1185,11 +1281,12 @@
    },
    //属性分组按钮
    attrVisibleHandle() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板属性')
      } else if (this.CrudSelect < 1) {
      } else if (this.attrSelectList < 1) {
        this.$message.warning('请选择一条模板属性')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        this.attrVisible = true;
      }
    },
@@ -1215,34 +1312,71 @@
    },
    //业务类型保存
    busineAddHandle() {
      this.$set(this.busineAddList, 'classifytemplateoid', this.crudOid)
      this.$set(this.busineAddList, 'oid', '')
      this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
      if (this.busineSelectList.length == 0) {
        this.$message.warning('请选择属性集');
        return false;
      }
      let ordernum = this.ProData.length;
      this.busineSelectList.forEach((citem) => {
        let isCopy = false;
        this.ProData.forEach((item) => {
          if (citem.id == item.id) {
            isCopy = true;
            return false;
          }
        })
        if (!isCopy) {
          citem.oid = ''
          this.busineAddList=Object.assign(citem, {
            orderNum: ++ordernum,
            attributedatatype: citem.attrDataType,
            attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType],
            controlLength: citem.attributeLength,
            valueArea: citem.range,
            referbtmid: citem.referBtmTypeId,
            referbtmname: citem.referBtmTypeName,
            referConfig: '',
            enumid: citem.enumId,
            precisionLength: (citem.precisionLength ? citem.precisionLength : '') + (citem.scaleLength ? '(' + citem.scaleLength + ')' : ''),
            classifyTemplateOid: this.crudOid,
            classifytemplateoid: this.crudOid,
            formDisplayFlag: true,
            tableDisplayFlag: true,
            sortAttrFlag: false,
            queryAttrFlag: true,
            seniorQueryAttrFlag: true,
            attrTableWidth: 120
          })
          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
        }
      })
      this.addVisible = false;
    },
    //业务类型单选
    //业务类型选择
    businessSelect(selection, row) {
      this.busineSelectList = selection
      this.busineAddList = row
    },
    // 从业务类型中选择数据
    // 从业务类型中选择数据弹窗
    busineHandle() {
        this.addVisible = true;
        AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
          this.businessData = res.data.data;
        })
      this.addVisible = true;
      this.busineSelectList = []
      this.busineAddList = [];
      AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
        this.businessData = res.data.data;
      })
    },
    // 级联属性按钮
    CascadeHandle() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板属性')
      } else if (this.CrudSelect.length < 1) {
      } else if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板属性')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        this.CascadeVisible = true;
        gridCodeClassifyTemplateAttr({
          'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
          'conditionMap[oid_notequal]': this.CrudOid
          'conditionMap[oid_notequal]': this.attrOid
        }).then(res => {
          this.CascadeData = res.data.data;
        })
@@ -1250,10 +1384,12 @@
    },
    //表格单选
    selectHandle(selection, row) {
      this.CrudOid = row.oid;
      this.CrudSelect = selection;
      this.attrOid = row.oid;
      this.attrRow = row;
      console.log('123',row,selection)
    },
    //表格选择
    selectionChange(list) {
      this.attrSelectList = list;
    },
    //保存
    addsHandler() {
@@ -1278,9 +1414,9 @@
    },
    //表格行编辑
    handleCellClicks(row, column) {
      this.editingRows = row;
      this.editShows = column.property;
      this.rowOid = row.oid;
        this.editingRows = row;
        this.editShows = column.property;
        this.rowOid = row.oid;
    },
    saveRows() {
      this.editingRows = null;
@@ -1299,15 +1435,15 @@
    },
    //枚举注入删除
    enumDeleteRow(row) {
      this.tableData.splice(row, 1)
      this.tableData.splice(row.$index, 1)
    },
    //枚举注入按钮
    enmuVisHandle() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板属性')
      } else if (this.CrudSelect < 1) {
      } else if (this.attrSelectList < 1) {
        this.$message.warning('请选择一条模板属性')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        this.enumVisible = true;
      }
    },
@@ -1349,11 +1485,11 @@
    },
    //点击分类注入按钮
    injectBtn() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板数据')
      } else if (this.CrudSelect.length < 1) {
      } else if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板数据')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        this.injectVisible = true
      }
    },
@@ -1406,7 +1542,10 @@
    },
    //表格删除
    CrudRemove() {
      this.ProData.splice(this.attrRow.$index, 1)
      this.attrSelectList.forEach((item)=>{
        this.ProData.splice(item.$index, 1)
      })
    },
    //表格重置
    reset() {
@@ -1414,11 +1553,11 @@
    },
    //同步到其他模板
    syncHandle() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板属性数据')
      } else if (this.CrudSelect.length < 1) {
      } else if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板属性数据')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        copyto({oid: this.attrRow.oid}).then(res => {
          this.$message.success('同步成功')
        })
@@ -1430,11 +1569,11 @@
    },
    //组合规则
    isShowHandler() {
      if (this.CrudSelect.length > 1) {
      if (this.attrSelectList.length > 1) {
        this.$message.warning('只能选择一条模板属性数据')
      } else if (this.CrudSelect.length < 1) {
      } else if (this.attrSelectList.length < 1) {
        this.$message.warning('请选择一条模板属性数据')
      } else if (this.CrudSelect.length === 1) {
      } else if (this.attrSelectList.length === 1) {
        this.isShowformulaEdit = true;
      }
    },