wangting
2024-09-06 99dda6d4254e062f386976e0d66c8379020d3944
查询模板导出导入
已修改8个文件
383 ■■■■■ 文件已修改
Source/plt-web/plt-web-ui/src/api/queryTemplate/businessTypeQuery.js 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/queryTemplate/businessTypeQuery.js
@@ -1,12 +1,48 @@
import request from '@/router/axios';
//业务类型查询模板
// 模板列表查询
export function gridTemplate(params) {
// 创建
export function linkSave(params) {
  return request({
    url: "/api/templateController/queryTemplateList",
    method: "get",
    params:{
      ...params
    }
    url: "/api/templateController/linkSave",
    method: "post",
    data:params
  });
}
// 删除
export function deleteLinkTemplate(params) {
  return request({
    url: "/api/templateController/deleteLinkTemplate",
    method: "delete",
    params:params
  });
}
// 查询条件的查询接口,接口方式POST,参数与保存接口传参一致
export function getCriteria(params) {
  return request({
    url: "/api/templateController/getCriteria",
    method: "post",
    data:params
  });
}
// 导出
export function expBtmQTTemplate  (params) {
  return request({
    url: '/api/templateController/expBtmQTTemplate',
    method: 'post',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    data:params
  })
}
// 导入
export function impBtmTemplate  (params) {
  return request({
    url: '/api/templateController/impBtmTemplate',
    method: 'post',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    data:params
  })
}
Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js
@@ -1,15 +1,6 @@
import request from '@/router/axios';
//链接类型查询模板
//列表
export function getObjTypeQTs(btName) {
  return request({
    url: "/api/templateController/getObjTypeQTs",
    method: "get",
    params:{
      btName
    }
  });
}
// 创建
export function linkSave(params) {
  return request({
@@ -39,10 +30,10 @@
export function expLinkTemplate  (params) {
  return request({
    url: '/api/templateController/expLinkTemplate',
    method: 'get',
    //headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    method: 'post',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    params
    data:params
  })
}
@@ -50,9 +41,9 @@
export function impLinkTemplate  (params) {
  return request({
    url: '/api/templateController/impLinkTemplate',
    method: 'get',
    method: 'post',
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
    responseType: 'blob',
    params
    data:params
  })
}
Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js
@@ -24,8 +24,17 @@
    }
  });
}
//获取所有查询模板
//查询模板列表
export function getObjTypeQTs(btName) {
  return request({
    url: "/api/templateController/getObjTypeQTs",
    method: "get",
    params:{
      btName
    }
  });
}
//获取所有查询模板列表
export function getAllQTs(page,limit) {
  return request({
    url: "/api/templateController/getAllQTs",
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue
@@ -43,11 +43,11 @@
      <el-container style="margin-top: 10px;">
        <el-aside style="width:350px">
          <fieldset>
            <legend>&nbsp;链接类型候选条件&nbsp;</legend>
            <legend>&nbsp;候选条件&nbsp;</legend>
            <div>
              查询模板定义
              <avue-select @change="linkQueryDefineChange" class="el-input--small" v-model="linkQueryDefineForm" placeholder="请选择内容" type="tree" :dic="linkQueryDefineDic" style="width:240px"></avue-select>
              <avue-tree style="height: 265px" :data="linkTreeData" :option="treeOption"  @node-drag-start="handleDragStart">
              <avue-select @change="businessQueryDefineChange" class="el-input--small" v-model="businessQueryDefineForm" placeholder="请选择内容" type="tree" :dic="businessQueryDefineDic" style="width: 240px;"></avue-select>
              <avue-tree style="height: 265px" :data="businessTreeData" :option="treeOption"  @node-drag-start="handleDragStart" @node-drag-end="handleDragEnd">
              </avue-tree>
            </div>
          </fieldset>
@@ -63,17 +63,6 @@
            ></form-query-dialog>
          </fieldset>
        </el-main>
        <el-aside style="width:350px">
          <fieldset>
            <legend>&nbsp;业务类型候选条件&nbsp;</legend>
            <div>
              查询模板定义
              <avue-select @change="businessQueryDefineChange" class="el-input--small" v-model="businessQueryDefineForm" placeholder="请选择内容" type="tree" :dic="businessQueryDefineDic" style="width: 240px;"></avue-select>
              <avue-tree style="height: 265px" :data="businessTreeData" :option="treeOption"  @node-drag-start="handleDragStart">
              </avue-tree>
            </div>
          </fieldset>
        </el-aside>
      </el-container>
    </div>
    <div class="dialog-footer avue-dialog__footer">
@@ -210,10 +199,6 @@
          return true;
        },
      },
      linkQueryDefineForm:'',//链接类型查询模板定义选中值
      linkQueryDefineDic:[],//链接类型查询模板定义下拉数据
      //链接类型查询模板定义选中项属性
      linkTreeData: [],
      businessQueryDefineForm:'',//业务类型查询模板定义选中值
      businessQueryDefineDic:[],//业务类型查询模板定义下拉数据
      //业务类型查询模板定义选中项属性
@@ -222,56 +207,9 @@
      queryTree:{},
      //普通查询条件
      queryCondition:[],
    };
  },
  watch: {
    //方向
    'form.direction': {
      handler(val) {
        if(val=='positive'){
          //正向
          const dicData=this.treeData.btmItemsTo.map(item=>{
            return {
              label: item,
              value: item
            }
          })
          dicData.push({
            label: '所有类型',
            value: '*'
          })
          this.$refs.form.updateDic('btmType', dicData);
          this.form.btmType=dicData[0].value
          this.getAllAttr();
        }else if(val=='opposite'){
          //反向
          const dicData=this.treeData.btmItemsFrom.map(item=>{
            return {
              label: item,
              value: item
            }
          })
          dicData.push({
            label: '所有类型',
            value: '*'
          })
          this.$refs.form.updateDic('btmType', dicData);
          this.form.btmType=dicData[0].value
          this.getAllAttr();
        }
      },
      immediate: true,
    },
    //业务类型
    'form.btmType': {
      handler(val) {
        if(val && val!='*'){
          this.getTemp(val,false);
        }
      },
      immediate: true,
    }
  },
  methods: {
    openDialog(btmName, title, mode, data) {
@@ -283,6 +221,7 @@
      if (data.selectData) {
        this.selectData = data.selectData;
        this.form.qtName = this.selectData.qtName;
        this.form.level = this.selectData.queryTemplate.level;
        if (data.selectData.queryTemplate.orderInfoList && data.selectData.queryTemplate.orderInfoList.length > 0) {
          this.orderInfoList = JSON.parse(JSON.stringify(data.selectData.queryTemplate.orderInfoList));//已有排序
        }
@@ -327,6 +266,8 @@
              this.$message.success("保存成功");
              this.cancelDialog();
              this.$emit("refresh");
            }else {
              this.$refs.form.clearValidate();
            }
          });
        } else {
@@ -340,10 +281,9 @@
        qtName: this.form.qtName,
        levelFlag: this.form.levelFlag,
        queryTemplate: {
          btmType: this.form.btmType,
          clauseList: ['*'],
          direction: this.form.direction,
          id: this.form.qtName,
          level: this.form.level,
          linkType: this.form.btmName,
          orderInfoList: this.orderInfoList,
          recReturnMode: 1,//递归返回数据模式:1:RECRETURNMODE_FLAT, 2:RECRETURNMODE_FILTER
@@ -444,36 +384,16 @@
    //获取查询模板定义下拉
    getTemp(btmName,linkFlag) {
      if (btmName) {
        queryTemplateListByAttr({btmName: btmName, linkFlag: linkFlag,direction:this.form.direction}).then(res => {
        queryTemplateListByAttr({btmName: btmName}).then(res => {
          const data = res.data.data.map(item => {
            item.label = item.name + '-' + (item.linkTypeName || item.btmName);
            item.value = item.name;
            return item;
          });
          if(linkFlag){
            this.linkQueryDefineDic=data
            data.length>0 && (this.linkQueryDefineForm=data[0].value);
          }else {
            this.businessQueryDefineDic=data;
            data.length>0 && (this.businessQueryDefineForm= data[0].value);
          }
        })
      }
    },
    linkQueryDefineChange(data) {
      if (data.value) {
        const childData = data.item.attrs.map(item => {
          return {
            label: item.name,
            value: item.name,
            atttributes:item
          };
        });
        this.linkTreeData = [{
          label: data.value,
          value: data.value,
          children: childData
        }]
      }
    },
    businessQueryDefineChange(data) {
@@ -496,7 +416,15 @@
    handleDragStart(node, ev) {
      // 使用 setData 方法设置数据
      ev.dataTransfer.setData('item', JSON.stringify(node.data));
      if(this.form.levelFlag==1){
        this.$refs.formQuery.$refs.tree.$emit('tree-node-drag-start', ev,{node:this.$refs.formQuery.initItem(node)});
      }
    },
    handleDragEnd(draggingNode,endNode,position,ev){
      if(this.form.levelFlag==1) {
        this.$refs.formQuery.$refs.tree.$emit('tree-node-drag-end', ev);
      }
    }
  },
}
</script>
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue
@@ -24,8 +24,9 @@
        <el-button  size="mini" type="danger" icon="el-icon-delete" @click="delCondition(index)" style="padding: 7px 8px"></el-button>
      </div>
    </div>
    <div v-else style="height: 220px;text-align: left">
      <avue-tree ref="tree" @node-drop="handleDrop" style="height: 220px" :data="treeData" :option="treeOption"  @node-click="nodeClick" node-key="value"></avue-tree>
    <div v-else @drop="drop" @dragover.prevent style="height: 220px;text-align: left">
      <avue-tree ref="tree" @node-drag-end="handleDragEnd" @node-drag-leave="handleDragLeave"  @node-drag-over="handleDragOver"
                  style="height: 220px" :data="treeData" :option="treeOption"  @node-click="nodeClick" node-key="value"></avue-tree>
    </div>
    <div style="text-align: right;margin-top: 10px;">
      <el-button v-if="radioForm==1"  plain size="mini" type="primary" @click="addHandler">增加逻辑</el-button>
@@ -35,6 +36,7 @@
      <el-button  plain size="mini" type="primary" @click="">取消</el-button>
    </div>
    <!--修改条件-->
    <el-dialog v-dialogDrag
               :title="dialog.title"
               :visible.sync="dialog.showDialog"
@@ -114,7 +116,7 @@
import basicOption from "@/util/basic-option";
import {getAllQTs} from "@/api/queryTemplate/queryDefine";
import {getCriteria} from "@/api/queryTemplate/linkTypeQuery";
import {dateFormat} from "@/util/date"
export default {
name: "formQueryDialog",
  props: {
@@ -374,11 +376,38 @@
              nodeChild.forEach((item,index)=>{
                that.treeIndex++;
                if(item.column !=null && item.column != undefined){
                  const values= item.column.split(' ');
                  let inputValue='';
                  let operator='';
                  let showLabel=''
                  if(item.column.indexOf('not in')!=-1){
                    operator='not in';
                    if(values.length>3){
                      inputValue=values[3];
                    }
                  }else{
                    if(values.length>1){
                      operator=values[1];
                      if(values.length>2){
                        inputValue=values[2];
                      }
                    }
                  }
                  if(values[0].indexOf('.')!=-1){
                    const labels=values[0].split('.')
                    showLabel=labels[labels.length-1];
                  }else {
                    showLabel=values[0];
                  }
                  children.push({
                    label:item.column,
                    value:item.column+that.treeIndex,
                    type:item.type,
                    valueIndex:'v'+that.treeIndex
                    valueIndex:'v'+that.treeIndex,
                    inputValue:inputValue,
                    operator:operator,
                    showLabel:showLabel
                  })
                }else {
                  children.push({
@@ -437,23 +466,47 @@
        }
        params.type=data.atttributes.vtDataType;
        this.conditionList.push(params)
      }else {debugger;
      }else {
        if (this.clickNode.label != '并且' && this.clickNode.label != '或者') {
          this.$message.error('请选中逻辑条件添加查询项');
          return;
        }
        this.$refs.tree.append(this.initItem(data), this.clickNode);
      }
    },
    initItem(data){
        this.treeIndex++;
        this.$refs.tree.append({
      let item={
          label: data.value,
          value: data.value + this.treeIndex,
          valueIndex: 'v' + this.treeIndex,
          children: []
        }, this.clickNode);
        type:data.vtDataType,
        children: [],
        inputValue:data.value,
        operator:'=',
        showLabel:data.value
      };
      let showLabel='';
      if(data.value.indexOf('.')!=-1){
        const labels=data.value.split('.')
        showLabel=labels[labels.length-1];
      }else {
        showLabel=data.value;
      }
      item.showLabel=showLabel;
      return item
    },
    handleDrop(draggingNode, dropNode, dropType, ev) {
    handleDragEnd(draggingNode, dropNode, dropType, ev) {
      debugger;
      console.log('tree drop: ', dropNode.label, dropType);
      console.log('tree drag end: ', dropNode && dropNode.label, dropType);
    },
    handleDragOver({event}) {
      // 阻止默认事件,允许放置
      event.preventDefault();
    },
    handleDragLeave({event}) {
      // 清除放置效果
      event.preventDefault();
    },
    //删除普通查询条件
    delCondition(index) {
@@ -478,9 +531,13 @@
        if(node.children){
          this.clearTreeValue(node.children)
        }else {
          if(node.label.indexOf('not in')!=-1){
            node.label=node.label.split(' ')[0]+' not in'
          }else {
          let values=node.label.split(' ');
          if(values.length>2){
            node.label=values[0]+' '+values[1];
            }
          }
        }
      })
@@ -535,24 +592,6 @@
        } else if (this.clickNode.label == '或者') {
          this.clickNode.label = '并且'
        } else {
          const values= this.clickNode.label.split(' ');
          this.clickNode.inputValue='';
          if(values.length>1){
            this.clickNode.operator=values[1];
            if(values.length>2){
              if(['VTDateTime','VTDate','VTTime'].includes(this.clickNode.type)){
                this.clickNode.inputValue=new Date(values[2]);
              }else {
                this.clickNode.inputValue=values[2];
              }
            }
          }
          if(values[0].indexOf('.')!=-1){
            const labels=values[0].split('.')
            this.clickNode.showLabel=labels[labels.length-1];
          }else {
            this.clickNode.showLabel=values[0];
          }
          this.dialog.showDialog = true;
        }
      } else {
@@ -609,6 +648,18 @@
    submitDialog() {
      const values= this.clickNode.label.split(' ');
      this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+this.clickNode.inputValue;
      try{
        if(['VTDateTime'].includes(this.clickNode.type)){
          this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue);
        }else  if(['VTDate'].includes(this.clickNode.type)){
          this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue ,'yyyy-MM-dd');
        }else  if(['VTTime'].includes(this.clickNode.type)){
          this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue ,'hh:mm:ss');
        }
      }catch (e) {
      }
      this.dialog.showDialog = false;
    },
    //获取查询模板列表
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue
@@ -34,6 +34,9 @@
                    :data="crudData" :option="crudOption" :table-loading="tableLoading" style="margin-top: 10px">
        </avue-crud>
        <form-dialog ref="formRef" @refresh="getTemp"></form-dialog>
        <!--导入    -->
        <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入"
                     @updata="uploadCallBack"></upload-file>
      </basic-container>
    </el-main>
@@ -42,12 +45,12 @@
<script>
import {getBizTypes} from "@/api/modeling/businessType/api";
import {gridTemplate,saveTemplate,updateTemplate,deleteTemplate} from "@/api/queryTemplate/queryDefine";
import {deleteLinkTemplate,expBtmQTTemplate,impBtmTemplate} from "@/api/queryTemplate/businessTypeQuery";
import {getObjTypeQTs} from "@/api/queryTemplate/queryDefine";
import basicOption from "@/util/basic-option";
import func from "@/util/func";
import {dateFormat} from "@/util/date";
import FormDialog from "./formDialog.vue"
import {deleteLinkTemplate} from "@/api/queryTemplate/linkTypeQuery";
export default {
  name: "index",
  components: {FormDialog},
@@ -94,21 +97,24 @@
        height: "auto",
        calcHeight: -40,
        tip: false,
        header:false,
        column: [{
          label: '查询模板名称',
          prop: 'name'
          prop: 'qtName'
        }, {
          label: '创建人',
          prop: 'creator'
        }, {
          label: '创建时间',
          prop: 'createTime',
          formatter:function (row, value) {
            return dateFormat(new Date(value))
          }
          prop: 'createTimeText'
        }]
      },
      selectionRow: [],
      tipList: [
        "导入仅能上传.vciqtf格式文件"
      ],
      upFileType: ['vciqtf'],
      fileUrl: 'api/templateController/impBtmTemplate',
    }
  },
  created() {
@@ -135,7 +141,7 @@
      this.getTemp();
    },
    getTemp() {
      gridTemplate({btmName: this.nodeRow.label, linkFlag: false}).then(res => {
      getObjTypeQTs(this.nodeRow.label).then(res => {
        this.crudData =  res.data.data;
        this.tableLoading = false;
      })
@@ -198,6 +204,42 @@
          message: '已取消删除'
        });
      });
    },
    //导出
    exportClickHandler(){
      if (this.selectionRow.length <= 0) {
        this.$message.warning('请至少选择一条数据进行导出');
        return;
      }
      let qtNames = this.selectionRow.map(item => item.qtName).join(',');
      expBtmQTTemplate({qtNames: qtNames}).then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('导出成功');
      })
    },
    upLoadClickHandler(){
      this.$refs.upload.visible = true;
    },
    uploadCallBack(res){
      function getText(child){
        let text=''
        if(child[0].children && child[0].children.length>0){
          text=getText(child[0].children)
        }else{
          text=child[0].text ||child[0];
        }
        return text
      }
      if(res.obj) {
        if (res.obj.children) {
          this.$message.info(getText(res.obj.children));
        }
      }
      if(res.data){
        this.crudData = res.data;
      }
      //this.getTemp();
    }
  }
}
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue
@@ -25,7 +25,8 @@
      </div>
    </div>
    <div v-else @drop="drop" @dragover.prevent style="height: 220px;text-align: left">
      <avue-tree ref="tree" @node-drop="handleDrop" @node-drag-end="handleDragEnd" style="height: 220px" :data="treeData" :option="treeOption"  @node-click="nodeClick" node-key="value"></avue-tree>
      <avue-tree ref="tree" @node-drag-end="handleDragEnd" @node-drag-leave="handleDragLeave"  @node-drag-over="handleDragOver"
                  style="height: 220px" :data="treeData" :option="treeOption"  @node-click="nodeClick" node-key="value"></avue-tree>
    </div>
    <div style="text-align: right;margin-top: 10px;">
      <el-button v-if="radioForm==1"  plain size="mini" type="primary" @click="addHandler">增加逻辑</el-button>
@@ -495,14 +496,18 @@
      item.showLabel=showLabel;
      return item
    },
    handleDrop(draggingNode, dropNode, dropType, ev) {
      debugger;
      console.log('tree drop: ', dropNode.label, dropType);
    },
    handleDragEnd(draggingNode, dropNode, dropType, ev) {
      debugger;
      console.log('tree drag end: ', dropNode && dropNode.label, dropType);
    },
    handleDragOver({event}) {
      // 阻止默认事件,允许放置
      event.preventDefault();
    },
    handleDragLeave({event}) {
      // 清除放置效果
      event.preventDefault();
    },
    //删除普通查询条件
    delCondition(index) {
      this.conditionList.splice(index, 1);
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue
@@ -43,7 +43,8 @@
<script>
import {gridLink} from "@/api/modeling/linkType/api";
import {getObjTypeQTs,deleteLinkTemplate,expLinkTemplate,impLinkTemplate} from "@/api/queryTemplate/linkTypeQuery";
import {deleteLinkTemplate,expLinkTemplate,impLinkTemplate} from "@/api/queryTemplate/linkTypeQuery";
import {getObjTypeQTs} from "@/api/queryTemplate/queryDefine";
import basicOption from "@/util/basic-option";
import FormDialog from "./formDialog.vue"
import func from "@/util/func";
@@ -70,16 +71,6 @@
        oid: 'topNode',
        children: []
      }],
      templateForm: '',
      templateData: [],
      form: {
        name: ''
      },
      rules: {
        name: [
          {required: true, message: '请输入查询模板名称', trigger: 'blur'}
        ]
      },
      title: '',
      visible: false,
      tableLoading: false,