田源
2023-06-09 f7e33d69713a5145d19fde5792b422826bc14107
Source/UBCS-WEB/src/components/Tree/attrCrud.vue
@@ -1,10 +1,26 @@
<template>
  <avue-crud :data="ProData" :option="option" @sort-change="sortChange" @row-update="addUpdate"
             @cell-click="handleRowClick">
             @cell-click="handleRowClick" @select="selectHandle">
    <template slot="menuLeft">
      <el-button v-if="attrEditVisible == false" size="small" type="primary" @click="addVisible=true">+ 添加 {{msg}}</el-button>
      <el-button v-if="attrEditVisible == false" size="small" type="primary" @click="busineHandle">+ 添加 {{msg}}</el-button>
      <el-dialog :visible.sync="addVisible" append-to-body title="从业务类型中选择属性">
        <avue-crud :data="businessData" :option="businessOption"></avue-crud>
        <avue-crud :data="businessData" :option="businessOption">
          <template slot="menuLeft">
            <div style="display: flex;">
              <el-select>
                <el-option>属性英文名称</el-option>
                <el-option>属性中文名称</el-option>
              </el-select>
              <el-input style="width: 300px;margin-left: 20px"></el-input>
              <el-button size="small" style="margin-left: 10px">查询</el-button>
            </div>
          </template>
        </avue-crud>
       <div style="display: flex;justify-content: flex-end;margin-top: 15px">
         <el-button size="small" type="primary">保存</el-button>
         <el-button size="small" type="primary">取消</el-button>
       </div>
      </el-dialog>
    </template>
    <!--        全屏编辑-->
@@ -14,6 +30,12 @@
      <el-dialog :visible.sync="attrEditVisible" append-to-body fullscreen="true">
        <attrCrud></attrCrud>
      </el-dialog>
    </template>
<!--    组合规则-->
    <template slot="menuLeft">
      <el-button size="small" @click="isShowformulaEdit=true">组合规则</el-button>
        <formula-editor :visible="isShowformulaEdit" :systemVariableTableData="systemVariableTableData" :thisSceneTableData="thisSceneTableData"></formula-editor>
    </template>
    <!--        验证规则-->
    <template slot="menuLeft">
@@ -133,7 +155,7 @@
    </template>
    <!--    级联属性-->
    <template slot="menuLeft">
      <el-button size="small" @click="CascadeVisible=true">级联属性</el-button>
      <el-button size="small" @click="CascadeHandle">级联属性</el-button>
      <el-dialog :visible.sync="CascadeVisible" append-to-body title="请选择级联属性">
        <avue-crud ref="crud" :data="CascadeData" :option="CascadeOption" @row-click="CascaderowClick">
          <template slot="radio"
@@ -168,31 +190,115 @@
    </template>
    <!--    同步到其他模板-->
    <template slot="menuLeft">
      <el-button size="small">同步到其他模板</el-button>
      <el-button size="small" style="margin-top: 10px">同步到其他模板</el-button>
    </template>
  </avue-crud>
</template>
<script>
import {AttrByBtm,gridCodeClassifyTemplateAttr} from '@/api/template/templateAttr'
export default {
  name: "attrCrud .vue",
  props: ['ProData'],
  props: ['ProData','crudOid','crudArray','Formlist'],
  data() {
    return {
      //表格单选数组
      CrudSelect:[],
      //表格oid
      CrudOid:"",
      //场景变量
      thisSceneTableData:[
        {
          formula: "lcstatus",
          desc: "状态",
        },
        {
          formula: "name",
          desc: "集团码",
        },
        {
          formula: "materialname",
          desc: "部门名称",
        },
        {
          formula: "parentcode",
          desc: "上级部门编号",
        },
        {
          formula: "parentname",
          desc: "上级部门名称",
        },
        {
          formula: "description",
          desc: "描述",
        },
      ],
      // 系统变量
      systemVariableTableData:[
        {
          formula: "#CURRENTUSER.OID#",
          desc: "当前用户的主键",
        },
        {
          formula:"#CURRENTUSER.ID",
          desc:"当前用户的账户"
        },
        {
          formula:"#CURRENTTIME#",
          desc:"当前时间"
        },
        {
          formula:"#CURRENTDATE#",
          desc:"当前日期"
        },
        {
          formula:"#CURRENTDATETIME#",
          desc:"当前日期时间"
        },
        {
          formula:"#CURRENTUSER_NAME#",
          desc:"当前用户的姓名"
        },
        {
          formula:"#CURRENTUSER.SECRETGRADE#",
          desc:"当前用户密级"
        },
        {
          formula:"#CURRENTUSER.IPSECRET#",
          desc:"当前用户的IP密级"
        },
        {
          formula:"#CURRENTUSER.BUSINESSUNIT#",
          desc:"当前用户所属业务单元"
        },
        {
          formula:"#CURRENTUSER.BUSINESSUNITNAME#",
          desc:"当前用户所属业务单元名称"
        },
        {
          formula:"#CURRENTUSER.GROUPOID#",
          desc:"当前用户的部门主键"
        },
        {
          formula:"#CURRENTUSER.GROUPNAME#",
          desc:"当前用户所属部门名称"
        },
        {
          formula:"#CURRENTUSER.EMAIL#",
          desc:"当前用户邮件地址"
        },
        {
          formula:"#CURRENTUSER.ROLENAME#",
          desc:"当前用户所属角色名称 "
        },
      ],
      CascadeVisible: false,
      attrEditVisible: false,
      isShowformulaEdit:false,
      // 级联单选
      selectRow: '',
      // 级联data
      CascadeData: [{
        id: 1,
        name: '张三',
        attrIn: '测试一'
      }, {
        id: 2,
        name: '李四',
        attrIn: '测试二'
      }],
      CascadeData: [],
      // 级联option
      CascadeOption: {
        menu: false,
@@ -208,18 +314,19 @@
        },
          {
            label: '属性英文编号',
            prop: 'nid'
          }, {
            label: '性别',
            prop: 'id'
          },
          {
            label: '属性中文名称',
            prop: 'name'
          },
          {
            label: '属性分组',
            prop: 'attrIn'
            prop: 'attributeGroup'
          },
          {
            label: '类型',
            prop: 'type'
            prop: 'attributeDataTypeText'
          },
          {
            label: '列表宽度',
@@ -227,19 +334,63 @@
          },
          {
            label: '关键属性',
            prop: 'keyattrflag'
            prop: 'keyAttrFlag',
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: '查询属性',
            prop: 'queryattrflag'
            prop: 'queryAttrFlag',
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: '高级查询属性',
            prop: 'seniorqueryattrflag'
            prop: 'seniorQueryAttrFlag',
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: '相似查重属性',
            prop: 'samerepeatattrflag'
            prop: 'sameRepeatAttrFlag',
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: '一维码',
@@ -248,6 +399,170 @@
          {
            label: '二维码',
            prop: 'TwoDimensional'
          },
          {
            label: '必输',
            prop: 'requireFlag',
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: "表单显示",
            prop: "formDisplayFlag",
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: "列表显示",
            prop: "tableDisplayFlag",
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: "只读",
            prop: "readonlyFlag",
          },
          {
            label: "列表排序",
            prop: "sortAttrFlag",
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: "多行文本",
            prop: "textAreaFlag",
            type:'text',
            dicData:[
              {
                label:"是",
                value:'true'
              },
              {
                label:"否",
                value:'false'
              }
            ]
          },
          {
            label: "默认值",
            prop: "defaultValue",
          },
          {
            label: "前缀",
            prop: "prefixValue",
          },
          {
            label: "后缀",
            prop: "suffixValue",
          },
          {
            label: "组合规则",
            prop: "componentRule",
          },
          {
            label: "验证规则",
            prop: "verifyRule",
          },
          {
            label: "时间格式",
            prop: "codeDateFormat",
          },
          {
            label: "分类注入",
            prop: "classifyInvokeLevel",
          },
          {
            label: "枚举注入",
            prop: "enumString",
          },
          {
            label: "级联属性",
            prop: "parentCode",
          },
          {
            label: "参照配置",
            prop: "referConfig",
          },
          {
            label: "级联查询属性",
            prop: "parentQueryAttr",
          },
          {
            label: "选择库标识",
            prop: "libraryIdentification",
          },
          {
            label: "填写提示",
            prop: "explain",
          },
          {
            label: "表单显示样式",
            prop: "formDisplayStyle",
          },
          {
            label: "表格显示样式",
            prop: "tableDisplayStyle",
          },
          {
            label: "表单超链接",
            prop: "formHref",
          },
          {
            label: "表格超链接",
            prop: "tableHref",
          },
          {
            label: "表格显示js",
            prop: "tableDisplayJs",
          },
          {
            label: "长度",
            prop: "controlLength",
          },
          {
            label: "小数精度",
            prop: "precisionLength",
          },
          {
            label: "取值范围",
            prop: "valueArea",
          },
        ]
      },
@@ -359,90 +674,14 @@
          bds: "测试一",
          shiyong: "测试一"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        },
        {
          bds: "测试二",
          shiyong: "测试二"
        }
      ],
      // 新增业务类型
      businessData: [
        {
          id: "测试一",
          name: "测试一",
          attributeLength: "测试一",
          attrDataType: "测试一"
        },
        {
          id: "测试二",
          name: "测试二",
          attributeLength: "测试二",
          attrDataType: "测试二"
        },
        {
          id: "测试三",
          name: "测试三",
          attributeLength: "测试三",
          attrDataType: "测试三",
        },
        {
          id: "测试三",
          name: "测试三",
          attributeLength: "测试三",
          attrDataType: "测试三",
        }
      ],
      businessData: [],
      businessOption: {
        index: true,
        border: true,
        addBtn: true,
        addBtn: false,
        menu:false,
        column: [
          {
            label: "属性英文名称",
@@ -522,6 +761,7 @@
        index: true,
        border: true,
        editBtn: false,
        selection:true,
        labelWidth: 110,
        cellBtn: true,
        cancelBtn: false,
@@ -756,6 +996,36 @@
    console.log(this.ProData)
  },
  methods: {
    // 从业务类型中选择数据
    busineHandle(){
      if(this.crudArray.length<1){
        this.$message.error('请选择一条模板')
      }else {
        this.addVisible=true;
        AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res=>{
          this.businessData=res.data.data;
          console.log(res.data)
        })
      }
    },
    // 级联属性
    CascadeHandle(){
      if(this.CrudSelect.length >0){
        this.CascadeVisible=true;
        gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
          'conditionMap[oid_notequal]':this.CrudOid
        }).then(res=>{
         this.CascadeData=res.data.data
        })
      }else {
        this.$message.warning('请选择一条模板属性')
      }
    },
    //表格单选
    selectHandle(selection,row){
      this.CrudOid=row.oid;
      this.CrudSelect=selection
    },
    addsHandler(){
    },