From b9f3e4a899013ce21de3fc1ac127d137c7494595 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 02 九月 2024 15:21:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue |  536 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 536 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue
new file mode 100644
index 0000000..2b7229c
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue
@@ -0,0 +1,536 @@
+<template>
+  <el-dialog v-dialogDrag
+             :title="dialog.title"
+             :visible.sync="dialog.showDialog"
+             width="1600px"
+             :append-to-body="true"
+             class="avue-dialog"
+             :destroy-on-close="true"
+             :close-on-click-modal="false"
+             @close="cancelDialog">
+    <div style="min-height: 665px;max-height: 85vh;padding-bottom: 50px;">
+      <basic-form key="linkQueryForm" style="margin-bottom: 0"
+                  ref="form"
+                  :span="4"
+                  :formItems="formItems"
+                  :formData="form"
+                  @getFormData="getFormData">
+      </basic-form>
+      <avue-crud  ref="crud" title="璁剧疆鎺掑簭"
+                  :data="orderInfoList" :option="crudOption">
+        <template slot="menuLeft" slot-scope="scope">
+          <el-button icon="el-icon-plus" size="small" type="primary" @click="addRow">鍒涘缓</el-button>
+        </template>
+        <template slot="menu" slot-scope="scope">
+          <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope)">鍒犻櫎
+          </el-button>
+        </template>
+      </avue-crud>
+      <el-dialog v-dialogDrag
+                 title="鍒涘缓"
+                 :visible.sync="crudDialog.showDialog"
+                 width="500px"
+                 :append-to-body="true"
+                 class="avue-dialog"
+                 :destroy-on-close="true"
+                 :close-on-click-modal="false"
+                 @close="crudDialog.showDialog=false">
+        <avue-form ref="tableForm" :option="tableFormOption" v-model="tableForm"></avue-form>
+        <div class="dialog-footer avue-dialog__footer">
+          <el-button type="primary" plain size="small" @click="rowSave" >淇� 瀛�</el-button>
+        </div>
+      </el-dialog>
+      <el-container style="margin-top: 10px;">
+        <el-aside style="width:350px">
+          <fieldset>
+            <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-tree>
+            </div>
+          </fieldset>
+        </el-aside>
+        <el-main>
+          <fieldset style="margin: 0 10px">
+            <legend>&nbsp;鏌ヨ鏉′欢&nbsp;</legend>
+            <form-query-dialog style="height: 300px;" :queryCondition="queryCondition" :queryTree="queryTree"></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">
+      <el-button type="primary" plain size="small" @click="submitDialog" >淇� 瀛�</el-button>
+      <el-button size="small" @click="cancelDialog">鍙� 娑�</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import {getAllOrderbyAttributeByLink} from "@/api/modeling/linkType/api";
+import {linkSave} from "@/api/queryTemplate/linkTypeQuery";
+import basicOption from "@/util/basic-option";
+import {gridTemplate} from "@/api/queryTemplate/queryDefine";
+import formQueryDialog from "./formQueryDialog.vue";
+export default {
+  name: "formDialog",
+  components:{formQueryDialog},
+  data(){
+    return {
+      dialog: {
+        showDialog: false,
+        title: "鍒涘缓",
+        submitTxt: "淇濆瓨",
+        submitIcon: "el-icon-check",
+        loading: false,
+        type: "add",
+      },
+      crudDialog: {
+        showDialog: false,
+        submitTxt: "淇濆瓨",
+        submitIcon: "el-icon-check",
+      },
+      formItems:[{
+        label: '鏌ヨ妯℃澘鍚嶇О',
+        prop: 'qtName',
+        type: 'input',
+        span:5,
+        rules: [{
+          required: true,
+          message: "璇疯緭鍏ユ煡璇㈡ā鏉垮悕绉�",
+          trigger: "blur"
+        }]
+      },{
+        label: '鏂瑰悜',
+        prop: 'direction',
+        type: 'radio',
+        value:'positive',
+        labelWidth:70,
+        span: 3,
+        dicData: [{
+          label: '姝e悜',
+          value: 'positive'
+        }, {
+          label: '鍙嶅悜',
+          value: 'opposite'
+        }]
+      },{
+        label: '涓氬姟绫诲瀷',
+        prop: 'btmType',
+        type: 'select',
+        labelWidth:110,
+        dicData: []
+      }, {
+        label: '鐗堟湰鐗堟',
+        prop: 'version',
+        type: 'select',
+        span:5,
+        dicData: [{
+          label: '褰撳墠鐗堟湰褰撳墠鐗堟',
+          value: 1
+        }, {
+          label: '褰撳墠鐗堟湰鏈�鏂扮増娆�',
+          value: 2
+        }, {
+          label: '鏈�鏂扮増鏈渶鏂扮増娆�',
+          value: 3
+        }, {
+          label: '宸插彂甯冪殑鏈�鏂扮増鏈�',
+          value: 7
+        }],
+        value: 1
+      },{
+        label: '鏌ヨ鏄惁鏈変笅绾�',
+        prop: 'queryISLeaf',
+        type: 'switch',
+        labelWidth:140,
+        dicData: [ {
+          label: '鍚�',
+          value: false
+        },{
+          label: '鏄�',
+          value: true
+        }],
+        value:false
+      }, {
+        label: '瀛愯妭鐐瑰眰娆℃暟',
+        prop: 'level',
+        type: 'number',
+        span:3,
+        value:1
+      }],
+      form:{
+        btmName:'',
+        qtName: '',
+        queryTemplate:{}
+      },
+      //宸叉湁鎺掑簭鍒楄〃閰嶇疆
+      crudOption: {
+        ...basicOption,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        selection: false,
+        height: "220",
+        tip: false,
+        column: [{
+          label: '鎺掑簭瀛楁',
+          prop: 'orderField'
+        }, {
+          label: '鎺掑簭鏂瑰紡',
+          prop: 'orderMode'
+        }, {
+          label: '浼樺厛绾�',
+          prop: 'level'
+        }]
+      },
+      //宸叉湁鎺掑簭
+      orderInfoList:[],
+      //璁剧疆鎺掑簭寮圭獥琛ㄥ崟鏁版嵁
+      tableForm:{
+        orderField:'',
+        orderMode:'ASC',
+        level:''
+      },
+      //璁剧疆鎺掑簭寮圭獥鎵�鏈夊彲鎺掑簭瀛楁
+      orderFieldList:[],
+      //璁剧疆鎺掑簭寮圭獥琛ㄥ崟閰嶇疆
+      tableFormOption: {
+        menuBtn: false,
+        submitBtn: false,
+        emptyBtn: false,
+        span:24,
+        column: [{
+          label: '鎺掑簭瀛楁',
+          prop: 'orderField',
+          type:'select',
+          props: {
+            label: 'id',
+            value: 'id'
+          },
+          rules: [{
+            required: true,
+            message: "璇烽�夋嫨鎺掑簭瀛楁",
+            trigger: "blur"
+          }]
+        }, {
+          label: '鎺掑簭鏂瑰紡',
+          prop: 'orderMode',
+          type: 'select',
+          dicData: [{
+            label: '鍗囧簭',
+            value: 'ASC'
+          }, {
+            label: '闄嶅簭',
+            value: 'DESC'
+          }],
+          value: 'ASC'
+        }, {
+          label: '浼樺厛绾�',
+          prop: 'level',
+          type: 'number',
+          min:1,
+          rules: [{
+            required: true,
+            message: "璇疯緭鍏ヤ紭鍏堢骇",
+            trigger: "blur"
+          }]
+        }]
+      },
+      treeOption:{
+        defaultExpandAll:true,
+        menu: false,
+        addBtn: false,
+        filter:false,
+        draggable: true,
+        allowDrop: () => {
+          return false;
+        },
+        allowDrag: () => {
+          return true;
+        },
+      },
+      linkQueryDefineForm:'',//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊�
+      linkQueryDefineDic:[],//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁
+      //閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬�
+      linkTreeData: [],
+      businessQueryDefineForm:'',//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊�
+      businessQueryDefineDic:[],//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁
+      //涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬�
+      businessTreeData: [],
+      //楂樼骇鏌ヨ鏉′欢
+      queryTree:{},
+      //鏅�氭煡璇㈡潯浠�
+      queryCondition:[]
+    };
+  },
+  watch: {
+    //鏂瑰悜
+    'form.direction': {
+      handler(val) {
+        if(val=='positive'){
+          //姝e悜
+          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,
+    },
+    'dialog.type': {
+      handler(val) {
+        if(val=='edit'){
+        }
+      },
+      immediate: true,
+    },
+  },
+  methods: {
+    openDialog(btmName, title, mode, data) {
+      this.dialog.title = title;
+      this.dialog.type = mode;
+      this.form.btmName = btmName;
+      this.treeData = data.treeData;
+
+      if (data.selectData) {
+        this.selectData = data.selectData;
+        this.form.qtName = this.selectData.qtName;
+        this.form.direction = this.selectData.queryTemplate.direction;
+        this.form.btmType = this.selectData.queryTemplate.btmType;
+        this.form.version = this.selectData.queryTemplate.version;
+        this.form.queryISLeaf = this.selectData.queryTemplate.queryISLeaf;
+        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));//宸叉湁鎺掑簭
+        }
+        this.queryCondition=this.selectData.queryTemplate.condition;
+        this.queryTree=this.selectData.queryTemplate.tree;
+      } else {
+        this.selectData = {};
+        this.orderInfoList = [];
+        this.queryCondition=[];
+        this.queryTree={};
+      }
+      this.dialog.showDialog = true;
+      this.getTemp(data.treeData.label, true)
+    },
+    cancelDialog() {
+      this.dialog.loading = false;
+      this.dialog.showDialog = false;
+      this.$nextTick(() => {
+        this.form = {
+          btmName: '',
+          qtName: '',
+          queryTemplate: {}
+        };
+        this.orderInfoList =[];
+        this.businessQueryDefineForm='';
+        this.linkQueryDefineForm='';
+        this.$refs.form.clearValidate();
+      });
+    },
+    submitDialog() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          let formData={
+            btmName:this.form.btmName,
+            qtName:this.form.qtName,
+            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,
+              queryISLeaf:this.form.queryISLeaf,
+              recReturnMode:1,//閫掑綊杩斿洖鏁版嵁妯″紡:1锛歊ECRETURNMODE_FLAT, 2锛歊ECRETURNMODE_FILTER
+              rightFlag:true,
+              secretFlag:true,
+              type:'link',
+              version:this.form.version
+            }
+          }
+          formData.condition=[]
+          linkSave(formData).then(res => {
+            if (res.data.success) {
+              this.$message.success("淇濆瓨鎴愬姛");
+              this.cancelDialog();
+              this.$emit("refresh");
+            }
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    getFormData(form) {
+      this.form = form;
+    },
+    addRow() {
+      this.crudDialog.showDialog = true;
+    },
+    // 琛屽垹闄�
+    rowDeleteHandler(data) {
+      this.orderInfoList.splice(data.index,1);
+      this.orderFieldList.unshift({
+        id: data.row.orderField
+      });
+      this.tableFormOption.column[0].dicData= this.orderFieldList
+    },
+    //鑾峰彇鎺掑簭璁剧疆涓墍鏈夋帓搴忓瓧娈�
+    getAllAttr() {
+      getAllOrderbyAttributeByLink({
+        name: this.treeData.label,
+        btmType: this.form.btmType,
+        direction: this.form.direction
+      }).then(res => {
+        const orderInfoStr = JSON.stringify(this.orderInfoList);
+        const dicData = [];
+        res.data.data.forEach(item => {
+          if (orderInfoStr.indexOf('"orderField":"' + item + '"') == -1) {
+            dicData.push({id: item});
+          }
+        })
+        this.tableFormOption.column[0].dicData=dicData;
+        this.orderFieldList=dicData;
+      })
+    },
+    //鎺掑簭璁剧疆淇濆瓨
+    rowSave() {
+      this.$refs.tableForm.validate((valid) => {
+        if(valid){
+          this.orderInfoList.push(JSON.parse(JSON.stringify(this.tableForm)));
+          this.crudDialog.showDialog=false;
+          const orderInfoStr = JSON.stringify(this.orderInfoList);
+          const dicData = [];
+          this.orderFieldList.forEach(item => {
+            if (orderInfoStr.indexOf('"orderField":"' + item.id + '"') == -1) {
+              dicData.push(item);
+            }
+          })
+          this.tableFormOption.column[0].dicData=dicData;
+          this.orderFieldList=dicData;
+          this.tableForm= {
+            orderField: '',
+            orderMode: 'ASC',
+            level: ''
+          }
+        }
+      })
+    },
+    //鑾峰彇鏌ヨ妯℃澘瀹氫箟涓嬫媺
+    getTemp(btmName,linkFlag) {
+      if (btmName) {
+        gridTemplate({btmName: btmName, linkFlag: linkFlag}).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.abNames.map(item => {
+          return {
+            label: item,
+            value: item
+          };
+        });
+        this.linkTreeData = [{
+          label: data.value,
+          value: data.value,
+          children: childData
+        }]
+      }
+    },
+    businessQueryDefineChange(data) {
+      if (data.value) {
+        const childData = data.item.abNames.map(item => {
+          return {
+            label: item,
+            value: item
+          };
+        });
+        this.businessTreeData = [{
+          label: data.value,
+          value: data.value,
+          children: childData
+        }]
+      }
+    },
+    // 寮�濮嬫嫋鎷芥爲鑺傜偣浜嬩欢
+    handleDragStart(node, ev) {
+      // 浣跨敤 setData 鏂规硶璁剧疆鏁版嵁
+      ev.dataTransfer.setData('item', JSON.stringify(node.data));
+    },
+  },
+}
+</script>
+
+<style scoped>
+fieldset {
+  border-radius: 5px;
+  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
+  padding: 10px 6px;
+  box-sizing: border-box;
+  margin: 0;
+  border: 1px solid #EBEEF5;
+}
+</style>

--
Gitblit v1.9.3