wangting
2024-09-06 5042cc0622d36e3df27d0d086219ba17bc40e2f5
Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue
@@ -60,6 +60,7 @@
                               :queryCondition="queryCondition"
                               :queryTree="queryTree"
                               :levelFlag.sync="form.levelFlag"
                               @queryHandler="queryHandler"
            ></form-query-dialog>
          </fieldset>
        </el-main>
@@ -73,10 +74,10 @@
</template>
<script>
import {linkSave,getBizTypeQTDs} from "@/api/queryTemplate/businessTypeQuery";
import {btmSave,getBizTypeQTDs,getCriteriaBtm} from "@/api/queryTemplate/businessTypeQuery";
import basicOption from "@/util/basic-option";
import {queryTemplateListByAttr} from "@/api/queryTemplate/queryDefine";
import formQueryDialog from "./formQueryDialog.vue";
import formQueryDialog from "@/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue";
export default {
  name: "formDialog",
  components:{formQueryDialog},
@@ -201,9 +202,18 @@
        allowDrop: () => {
          return false;
        },
        allowDrag: () => {
          return true;
        allowDrag: (dropNode) => {
          if (dropNode.data.attrs && dropNode.data.attrs.length>0) {
            return false;
          } else {
            return true;
          }
        },
        props:{
          label:'name',
          value:'name',
          children:'attrs'
        }
      },
      businessQueryDefineForm:'',//业务类型查询模板定义选中值
      businessQueryDefineDic:[],//业务类型查询模板定义下拉数据
@@ -227,7 +237,6 @@
      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));//已有排序
        }
@@ -244,6 +253,7 @@
        };
      }
      this.dialog.showDialog = true;
      this.treeOption.defaultExpandedKeys=[data.treeData.label]
      this.getTemp(data.treeData.label)
      this.getAllAttr();
    },
@@ -268,7 +278,7 @@
        if (valid) {
          const formData=this.initFormData();
          console.log(formData)
          linkSave(formData).then(res => {
          btmSave(formData).then(res => {
            if (res.data.success) {
              this.$message.success("保存成功");
              this.cancelDialog();
@@ -288,16 +298,7 @@
        qtName: this.form.qtName,
        levelFlag: this.form.levelFlag,
        queryTemplate: {
          clauseList: ['*'],
          direction: this.form.direction,
          id: this.form.qtName,
          linkType: this.form.btmName,
          orderInfoList: this.orderInfoList,
          recReturnMode: 1,//递归返回数据模式:1:RECRETURNMODE_FLAT, 2:RECRETURNMODE_FILTER
          rightFlag: true,
          secretFlag: true,
          type: 'link',
          version: this.form.version
        }
      }
      if (formData.levelFlag == 1) {
@@ -341,7 +342,6 @@
    },
    // 行删除
    rowDeleteHandler(data) {
      debugger;
      this.orderInfoList.splice(data.index,1);
      this.orderFieldList.unshift({
        id: data.row.orderField
@@ -390,31 +390,22 @@
    //获取查询模板定义下拉
    getTemp(btmName) {
      if (btmName) {
        queryTemplateListByAttr({btmName: btmName}).then(res => {
        queryTemplateListByAttr({btmName: btmName,linkFlag:false}).then(res => {
          const data = res.data.data.map(item => {
            item.label = item.name + '-' + (item.linkTypeName || item.btmName);
            item.label = item.name + '-' + item.btmName;
            item.value = item.name;
            return item;
          });
            this.businessQueryDefineDic=data;
            data.length>0 && (this.businessQueryDefineForm= data[0].value);
        })
      }
    },
    businessQueryDefineChange(data) {
      if (data.value) {
        const childData = data.item.attrs.map(item => {
          return {
            label: item.name,
            value: item.name,
            atttributes:item
          };
        });
        this.businessTreeData = [{
          label: data.value,
          value: data.value,
          children: childData
          name: data.value,
          attrs: data.item.attrs
        }]
      }
    },
@@ -430,7 +421,25 @@
      if(this.form.levelFlag==1) {
        this.$refs.formQuery.$refs.tree.$emit('tree-node-drag-end', ev);
      }
    }
    },
    //查询
    queryHandler(){
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$refs.formQuery.queryResultDialog.loading=true;
          const formData=this.initFormData();
          getCriteriaBtm(formData).then(res => {
            if (res.data.success) {
              this.resultData=res.data.data;
              this.$refs.formQuery.queryResultDialog.showDialog=true;
              this.$refs.formQuery.queryResultDialog.loading=false;
            }
          });
        } else {
          return false;
        }
      });
    },
  },
}
</script>