田源
2024-10-22 08579f2efb9bd870a9ad4cae3ec5b25cbb30a198
表单定义克隆功能 以及 模糊查询功能
已修改2个文件
362 ■■■■ 文件已修改
Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js 209 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/UI/formDefine/api.js
@@ -77,10 +77,26 @@
  })
}
const obj ={
  "id": "",// 修改时候必传
// 克隆接口
export function clone(params) {
  return request({
    url: "/api/portalVIController/clone",
    method: "post",
    data: params
  })
}
const cloneObj = {
  "clonePortalVIDTOList": [{
    "viName": "ppartProp",//--克隆的表单/表格名称
    "typeName": "ppart",//----克隆的业务类型,为“” 则为当前业务类型
    "typeFlag": "0",//--业务类型,0: 业务类型,1:链接类型
//--克隆的对象
    "oldPortalVIDTO": {
      "id": "5963B31F-287B-6B01-3544-D6ECF9CFDC96",
  "prm": {
  "formQtName": "", // 表单名称对应下面视图名称
        "formQtName": "",
    "prmItemList": [
    {
      "itemAddFilter": "",
@@ -579,186 +595,15 @@
  ],
    "showCols": "2"
},
  "typeFlag": 0, // 业务类型0 or 链接类型1
  "typeFlagText": "业务类型的表单",// 业务类型显示值
  "typeName": "ppart",// 业务类型名
  "viName": "ppartProp_test3", // 视图名称
  "viType": 1, // 视图类型
  "viTypeText": "表单" // 视图中文名称
      "typeFlag": 0,
      "typeFlagText": "业务类型的表单",
      "typeName": "ppart",
      "viName": "ppartProp",
      "viType": 1,
      "viTypeText": "表单"
    }
  }]
}
const dataForm = {
  "id": "",
  "prm": {
    "formQtName": "",
    "prmItemList": [
      {
        "itemAddFilter": "",
        "itemBat": "",
        "itemCols": "",
        "itemCtrlDisplyCol": "",
        "itemCtrlDisplyCondition": "",
        "itemCustomClass": "",
        "itemCut": "",
        "itemDateFormat": "",
        "itemDbl": "3",
        "itemEQ": "",
        "itemEditCondition": "",
        "itemEditableProgram": "",
        "itemField": "",
        "itemFieldWidth": "150,150,100,80,80,80,100,100,100,100,50,100,250",
        "itemFieldWidthList": [
          {
            "attributes": {},
            "key": "code",
            "value": "150"
          },
          {
            "attributes": {},
            "key": "partoid.name",
            "value": "150"
          },
          {
            "attributes": {},
            "key": "validity",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "lcstatus",
            "value": "80"
          },
          {
            "attributes": {},
            "key": "additionalunit",
            "value": "80"
          },
          {
            "attributes": {},
            "key": "distributeunittwo",
            "value": "80"
          },
          {
            "attributes": {},
            "key": "anticollaboration",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "holistic",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "scale",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "source",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "isforging",
            "value": "50"
          },
          {
            "attributes": {},
            "key": "isproductbring",
            "value": "100"
          },
          {
            "attributes": {},
            "key": "processremark",
            "value": "250"
          }
        ],
        "itemHrefConf": "",
        "itemHrefFields": "",
        "itemHttpPathField": "",
        "itemHttpVolumnPath": "",
        "itemImgWH": "0,0",
        "itemInObj": "A5791895-83D1-D63F-40C4-26705FF3A2BB",
        "itemIsEditable": "",
        "itemIsHidden": "",
        "itemIsHttpSave": "",
        "itemIsNavigatorExpand": "false",
        "itemIsRequired": "",
        "itemIsShowFolder": "false",
        "itemKeyFieldList": null,
        "itemKeyFields": "",
        "itemListTable": "",
        "itemListTxt": "",
        "itemListVal": "",
        "itemName": "",
        "itemOR": "",
        "itemOutFieldList": [
          "code",
          "partoid.name",
          "validity",
          "lcstatus",
          "additionalunit",
          "distributeunittwo",
          "anticollaboration",
          "holistic",
          "scale",
          "source",
          "isforging",
          "isproductbring",
          "processremark"
        ],
        "itemOutFields": "code,partoid.name,validity,lcstatus,additionalunit,distributeunittwo,anticollaboration,holistic,scale,source,isforging,isproductbring,processremark",
        "itemOutType": "",
        "itemPageSize": "",
        "itemParentFolderName": "",
        "itemQtName": "queryppartbypbom",
        "itemQueryRefFields": "",
        "itemQuerySql": "",
        "itemRight": "",
        "itemRows": "",
        "itemScript": "",
        "itemSearchFieldList": [
          "code",
          "partoid.name",
          "validity",
          "lcstatus",
          "additionalunit",
          "distributeunittwo",
          "anticollaboration",
          "holistic",
          "scale",
          "source",
          "isforging",
          "isproductbring",
          "processremark"
        ],
        "itemSelectoutFieldList": [
          "produceroute",
          "hotsurfaceroute"
        ],
        "itemSeniorQueryBOS": [],
        "itemSeniorQueryCols": "",
        "itemSeniorQueryColsCounts": "",
        "itemShowExpression": "",
        "itemStyle": "",
        "itemTips": "",
        "itemTrim": "",
        "itemTxf": "",
        "itemType": "",
        "itemTypeText": "",
        "itemValue": "",
        "itemValueList": []
      }
    ],
    "showCols": "3"
  },
  "typeFlag": 0,
  "typeFlagText": "业务类型的表格",
  "typeName": "ppart",
  "viName": "ppart_auditlist_test",
  "viType": 0,
  "viTypeText": "表格"
}
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue
@@ -55,12 +55,6 @@
                <el-input v-model="topName" placeholder="请输入内容" size="mini" style="margin-right: 10px;"></el-input>
                <el-button plain size="mini" type="success" @click="nameSearchHandler">查询</el-button>
              </span>
              <span style="display: flex; align-items: center;">
                <p
                  style="display: flex; align-items: center; margin: 0 10px 0 0;flex-shrink: 0;font-size: 14px">克隆目标:</p>
                <el-input v-model="input" placeholder="请输入内容" size="mini" style="margin-right: 10px;"></el-input>
                <el-button plain size="mini" type="success">克隆目标</el-button>
              </span>
            </div>
          </template>
          <template slot="menu" slot-scope="scope">
@@ -72,12 +66,44 @@
        </avue-crud>
      </basic-container>
    </el-main>
    <form-dialog ref="formDialog" :TreeNodeRow="this.nodeRow" :treeRadio="treeRadio" :editRow="editRow"></form-dialog>
    <form-dialog ref="formDialog" :TreeNodeRow="this.nodeRow" :editRow="editRow" :treeRadio="treeRadio"></form-dialog>
    <table-dialog ref="tableDialog" :TreeNodeRow="this.nodeRow" :treeRadio="treeRadio"
                  @updataTable="getRightPortalVIDatas"></table-dialog>
    <!-- 导入 -->
    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入"
                 @updata="getRightPortalVIDatas"></upload-file>
    <el-dialog
      v-dialogDrag
      :visible.sync="cloneVisible"
      append-to-body="true"
      class="avue-dialog"
      title="克隆"
      width="50%">
      <basic-container>
        <div ref="TreeBox" style="height: calc(100vh - 294px);!important;">
          <!-- 左侧树 -->
          <div style="height:  calc(100vh - 370px);">
            <div style="margin-bottom: 10px;display: flex;justify-content: center">
              <el-radio v-model="cloneTreeRadio" label="0" @input="cloneTreeRadioChange">业务类型树</el-radio>
              <el-radio v-model="cloneTreeRadio" label="1" @input="cloneTreeRadioChange">链接类型树</el-radio>
            </div>
            <avue-tree ref="cloneTree" v-loading="cloneTreeLoading" :data="cloneTreeData" :option="treeOption"
                       @node-click="cloneTreeNodeClick">
          <span slot-scope="{ node, data }" class="el-tree-node__label">
           <span style="font-size: 15px">
              <i class="el-icon-s-promotion"></i>
                {{ (node || {}).label }}
            </span>
          </span>
            </avue-tree>
          </div>
        </div>
      </basic-container>
      <span slot="footer" class="dialog-footer">
         <el-button @click="cloneVisible = false">取 消</el-button>
         <el-button type="primary" @click="cloneSaveHandler">确 定</el-button>
        </span>
    </el-dialog>
  </el-container>
</template>
@@ -85,7 +111,7 @@
import basicOption from "@/util/basic-option";
import FormDialog from "@/views/modelingMenu/ui/formDefine/components/formDialog";
import TableDialog from "@/views/modelingMenu/ui/formDefine/components/tableDialog";
import {gridPortalVIDatas, getPortalVIById, deleteByIds, exportExcel} from "@/api/UI/formDefine/api";
import {gridPortalVIDatas, getPortalVIById, deleteByIds, exportExcel, clone} from "@/api/UI/formDefine/api";
import {getBizTypes} from "@/api/modeling/businessType/api";
import {gridLink} from "@/api/modeling/linkType/api";
import func from "@/util/func";
@@ -95,6 +121,11 @@
  components: {FormDialog, TableDialog},
  data() {
    return {
      cloneTreeNode: {},
      cloneTreeRadio: '0',
      cloneTreeData: [],
      cloneTreeLoading: false,
      cloneVisible: false,
      tipList: [
        "导入业务类型名称不可为空",
        "导入名称不可为空且名称只能为英文字母",
@@ -190,7 +221,7 @@
        this.treeData = data;
        this.treeLoading = false;
      }).catch(error => {
        loading.close();
        this.treeLoading = false;
      });
    },
@@ -381,12 +412,13 @@
    // 名称查询
    nameSearchHandler() {
      if (!this.topName) {
        this.data = this.defaultData;
        this.getRightPortalVIDatas();
        return;
      }
      const list = this.data.filter(item => item.viName.includes(this.topName.trim()));
      const list = this.defaultData.filter(item => item.viName.includes(this.topName.trim()));
      this.data = list;
      this.page.total = this.data.length;
    },
    // 删除按钮
@@ -457,7 +489,7 @@
      this.$refs.upload.visible = true;
    },
    // 导出
    // 克隆
    copyClickHandler() {
      if (this.selectList.length <= 0) {
        this.$message.error('请至少选择一条数据');
@@ -468,6 +500,103 @@
        this.$message.error('只能选择一条数据');
        return;
      }
      this.cloneVisible = true;
      this.cloneTreeLoading = true;
      getBizTypes().then(res => {
        const data = res.data.data.map(item => {
          this.processChildren(item); // 处理每个节点
          item.attributes.id = item.attributes.id;
          return item.attributes; // 返回处理后的 attributes
        });
        this.cloneTreeData = data;
        this.cloneTreeLoading = false;
      }).catch(error => {
        this.cloneTreeLoading = false;
      });
    },
    // 克隆树点击
    cloneTreeNodeClick(row) {
      console.log(row);
      this.cloneTreeNode = row;
    },
    // 克隆树类型切换
    cloneTreeRadioChange(val) {
      this.cloneTreeLoading = true;
      if (val === "0") {
        getBizTypes().then(res => {
          const data = res.data.data.map(item => {
            this.processChildren(item); // 处理每个节点
            item.attributes.id = item.attributes.id;
            return item.attributes; // 返回处理后的 attributes
          });
          this.cloneTreeData = data;
          this.cloneTreeLoading = false;
        });
      } else {
        gridLink().then(res => {
          const data = res.data.data.map(item => {
            item.id = item.name;
            return item;
          });
          this.cloneTreeData = data;
          this.cloneTreeLoading = false;
        })
      }
    },
    // 查询表格数据详情
    searchDetail() {
      return new Promise((resolve, reject) => {
        const params = {
          id: this.selectList[0].id,
          viType: this.selectList[0].viType
        };
        getPortalVIById(params).then(res => {
          const obj = res.data.obj;
          resolve(obj);
        }).catch(error => {
          reject(error);
        });
      });
    },
    // 克隆保存
    async cloneSaveHandler() {
      if (func.isEmptyObject(this.cloneTreeNode)) {
        this.$message.error('请选择一条数据进行克隆');
        return;
      }
      const obj = await this.searchDetail();
      this.$prompt('请输入克隆文件名称', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
      }).then(({value}) => {
        console.log(obj);
        const params = {
          clonePortalVIDTOList: [
            {
              viName: value,
              typeName: this.cloneTreeRadio === '0' ? this.cloneTreeNode.id : this.cloneTreeNode.name,
              typeFlag: this.cloneTreeRadio,
              oldPortalVIDTO: {...obj}
            }
          ],
        }
        clone(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success('克隆成功');
            this.cloneVisible = false;
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '取消输入'
        });
      });
    }
  }
}