wangting
2025-01-02 e358d69fc18870584dd2d9f531910b7838ea27d9
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue
@@ -5,9 +5,9 @@
        <div ref="TreeBox" style="height: calc(100vh - 154px);!important;">
          <!-- 左侧树         -->
          <div style="height:  calc(100vh - 190px);">
            <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
            <avue-tree v-loading="loading" :data="treeData" :option="treeOption" @node-click="nodeClick">
              <span slot-scope="{ node, data }" class="el-tree-node__label">
               <span style="font-size: 15px">
               <span>
                  <i class="el-icon-s-promotion"></i>
                    {{ (node || {}).label }}
                </span>
@@ -33,19 +33,31 @@
          @search-reset="handleReset"
          @row-click="rowClickHandler">
          <template slot="menuLeft">
            <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">创建</el-button>
            <el-button v-if="permissionList.addBtn" icon="el-icon-plus" size="small" type="primary" @click="addHandler">
              创建
            </el-button>
            <!--<el-button icon="el-icon-edit" plain size="small" type="primary" @click="editHandler">修改</el-button>
            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">删除</el-button>-->
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出</el-button>
            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">导入</el-button>
            <el-button icon="el-icon-place" plain size="small" type="primary" @click="uiAuthorHandler">授权</el-button>
            <el-button v-if="permissionList.importBtn" icon="el-icon-upload2" plain size="small" type="primary"
                       @click="upLoadClickHandler">导入
            </el-button>
            <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary"
                       @click="exportClickHandler">导出
            </el-button>
            <el-button v-if="permissionList.RIGHTBtn" icon="el-icon-place" plain size="small" type="primary"
                       @click="uiAuthorHandler">授权
            </el-button>
          </template>
          <template slot="menu" slot-scope="scope">
            <el-button icon="el-icon-edit" size="small" type="text" @click="rowEditBtnClick(scope.row)">编辑
            <el-button v-if="permissionList.editBtn" icon="el-icon-edit" size="small" type="text"
                       @click="rowEditBtnClick(scope.row)">编辑
            </el-button>
            <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope.row)">删除
            <el-button v-if="permissionList.delBtn" icon="el-icon-delete" size="small" type="text"
                       @click="rowDeleteHandler(scope.row)">删除
            </el-button>
            <el-button icon="el-icon-document-copy" size="small" type="text" @click="rowCloneHandler(scope.row)">克隆</el-button>
            <el-button v-if="permissionList.cloneBtn" icon="el-icon-document-copy" size="small" type="text"
                       @click="rowCloneHandler(scope.row)">克隆
            </el-button>
          </template>
          <template slot="plName" slot-scope="{row}">
            <el-link type="primary" @click="linkClickHandler(row)">{{ row.plName }}</el-link>
@@ -55,11 +67,11 @@
        <el-dialog
          v-dialogDrag
          v-loading="dialogLoading"
          :close-on-click-modal="false"
          :title="dialogType === 'add' ? ' 创建 上下文' : '编辑 上下文'"
          :visible.sync="dialogVisible"
          append-to-body="true"
          class="avue-dialog"
          :close-on-click-modal="false"
          width="500px"
          @close="dialogClose"
        >
@@ -78,7 +90,7 @@
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="描述:" prop="plDesc">
              <el-input type="textarea" :rows="5" v-model="form.plDesc"></el-input>
              <el-input v-model="form.plDesc" :rows="5" type="textarea"></el-input>
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
@@ -90,14 +102,14 @@
        <el-dialog
          key="cloneDialog"
          v-dialogDrag
          title="克隆"
          :visible.sync="cloneDialogVisible"
          append-to-body="true"
          class="avue-dialog"
          title="克隆"
          width="500px"
          @close="cloneDialogClose"
        >
          <avue-form ref="cloneForm" :option="cloneOption" v-model="cloneForm"></avue-form>
          <avue-form ref="cloneForm" v-model="cloneForm" :option="cloneOption"></avue-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="cloneDialogClose">取 消</el-button>
            <el-button type="primary" @click="cloneSaveHandler">确 定</el-button>
@@ -107,10 +119,10 @@
        <el-dialog
          key="cloneDialog"
          v-dialogDrag
          title="导出"
          :visible.sync="expDialogVisible"
          append-to-body="true"
          class="avue-dialog"
          title="导出"
          width="500px"
          @close="expDialogVisible=false"
        >
@@ -124,19 +136,20 @@
        </el-dialog>
      </basic-container>
      <!-- 导入 -->
      <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" :fileData="fileData" title="导入"
      <upload-file ref="upload" :fileData="fileData" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList"
                   title="导入"
                   @updata="getTableList" @upfaildata="upFail"></upload-file>
      <!--页签窗口-->
      <el-dialog v-dialogDrag
                 :append-to-body="true"
                 :close-on-click-modal="false"
                 :destroy-on-close="true"
                 :fullscreen="true"
                 :title="dialog.title"
                 :visible.sync="dialog.showDialog"
                 :fullscreen="true"
                 :append-to-body="true"
                 class="avue-dialog"
                 :destroy-on-close="true"
                 :close-on-click-modal="false"
                 @close="dialog.showDialog=false">
          <pl-show :uiDefineData="dialog.uiDefineData"></pl-show>
        <pl-show :uiDefineData="dialog.uiDefineData"></pl-show>
      </el-dialog>
      <!--ui授权-->
      <ui-author ref="uiAuthor"></ui-author>
@@ -146,26 +159,38 @@
</template>
<script>
import {getBizTree,gridUIContextData,saveUIContextData,updateUIContextData,delUIContextData, cloneUIContextData ,getExpContextTree,expUIContextData} from "@/api/UI/uiDefine";
import {
  getBizTree,
  gridUIContextData,
  saveUIContextData,
  updateUIContextData,
  delUIContextData,
  cloneUIContextData,
  getExpContextTree,
  expUIContextData
} from "@/api/UI/uiDefine";
import basicOption from "@/util/basic-option";
import func from "@/util/func";
import plShow from "@/views/modelingMenu/ui/uiDefine/rightRegion/plShow";
import uiAuthor from "@/views/authority/ui/uiAuthorization/UIDialog"
import {mapGetters} from "vuex";
export default {
  name: "index",
  components:{plShow,uiAuthor},
  components: {plShow, uiAuthor},
  data() {
    return {
      loading: false,
      dialog: {
        showDialog: false,
        title: "上下文详情",
        loading: false,
        uiDefineData:null
        uiDefineData: null
      },
      tipList: [],
      upFileType: ['xls'],
      fileUrl: 'api/uiManagerController/impUIContextData',
      fileData:{},
      fileData: {},
      lastIndex: null,
      treeOption: {
        height: 'auto',
@@ -194,13 +219,12 @@
      selectList: [],
      option: {
        ...basicOption,
        calcHeight: -40,
        calcHeight: -50,
        addBtn: false,
        editBtn: false,
        delBtn: false,
        tip: false,
        searchMenuSpan: 6,
        align:'left',
        align: 'left',
        column: [{
          label: '名称',
          prop: 'plName',
@@ -214,7 +238,7 @@
          label: '导航区',
          prop: 'plIsShowNavigator',
          width: 130,
          align:'center',
          align: 'center',
          formatter: function (row, value) {
            if (row.plIsShowNavigator == 0) {
              return '不显示'
@@ -226,7 +250,7 @@
          label: '控制区',
          prop: 'plIsShowForm',
          width: 130,
          align:'center',
          align: 'center',
          formatter: function (row, value) {
            if (row.plIsShowForm == 0) {
              return '不显示'
@@ -238,7 +262,7 @@
          label: '操作区',
          prop: 'plIsShowTab',
          width: 130,
          align:'center',
          align: 'center',
          formatter: function (row, value) {
            if (row.plIsShowTab == 0) {
              return '不显示'
@@ -274,18 +298,18 @@
          trigger: 'blur'
        }]
      },
      cloneDialogVisible:false,
      cloneDialogVisible: false,
      cloneOption: {
        submitBtn:false,
        emptyBtn:false,
        submitBtn: false,
        emptyBtn: false,
        column: [{
          label: '克隆目标',
          prop: 'cloneTargetName',
          span:24,
          span: 24,
          type: 'tree',
          clearable: true,
          dicData: [],
          defaultExpandAll:true,
          defaultExpandAll: true,
          rules: [
            {
              required: true,
@@ -296,7 +320,7 @@
        }, {
          label: 'UI名称',
          prop: 'cloneName',
          span:24,
          span: 24,
          type: 'input',
          rules: [
            {
@@ -308,7 +332,7 @@
        }, {
          label: 'UI上下文',
          prop: 'cloneContextCode',
          span:24,
          span: 24,
          type: 'input',
          rules: [
            {
@@ -319,19 +343,19 @@
          ]
        }]
      },
      cloneForm:{
      cloneForm: {
        //克隆的源对象的信息
        sourcePLUILayout:null,
        cloneTargetName:'n',
        cloneName:'',
        cloneContextCode:''
        sourcePLUILayout: null,
        cloneTargetName: 'n',
        cloneName: '',
        cloneContextCode: ''
      },
      expDialogVisible:false,
      expTreeData:[],
      expOption:{
      expDialogVisible: false,
      expTreeData: [],
      expOption: {
        height: 'auto',
        filter:false,
        multiple:true,
        filter: false,
        multiple: true,
        defaultExpandAll: true,
        menu: false,
        addBtn: false,
@@ -343,29 +367,43 @@
      }
    }
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        cloneBtn: this.vaildData(this.permission[this.$route.query.id].clone, false),
        RIGHTBtn: this.vaildData(this.permission[this.$route.query.id].RIGHT, false),
      };
    },
  },
  created() {
    this.getTreeList();
  },
  methods: {
    //树表查询
    getTreeList() {
      const loading = this.$loading({});
      this.loading = true;
      getBizTree().then(res => {
        this.treeData=[res.data.obj];
        this.treeData = [res.data.obj];
        const dicData = res.data.obj.children.map(item => {
          item.label=item.attributes.name;
          item.value=item.attributes.name;
          item.label = item.attributes.name;
          item.value = item.attributes.name;
          return item;
        });
        this.cloneOption.column[0].dicData=[{
          label:'业务类型树',
          value:'业务类型树',
        this.cloneOption.column[0].dicData = [{
          label: '业务类型树',
          value: '业务类型树',
          disabled: true,
          children:dicData
          children: dicData
        }];
        loading.close();
        this.loading = false;
      }).catch(error => {
        loading.close();
        this.loading = false;
      })
    },
    // 树点击
@@ -376,8 +414,8 @@
        this.getTableList();
      }
    },
    getTableList(){
      const params = Object.assign(this.searchParams,{
    getTableList() {
      const params = Object.assign(this.searchParams, {
        'conditionMap[btmName]': this.nodeRow.attributes.name,
      })
      gridUIContextData(this.page.currentPage, this.page.pageSize, params).then(res => {
@@ -387,14 +425,14 @@
        this.tableLoading = false;
      })
    },
    linkClickHandler(row){
      this.dialog.title='【'+row.plName+' - '+row.plCode+'】详情'
      this.dialog.uiDefineData=row;
      this.dialog.showDialog=true;
    linkClickHandler(row) {
      this.dialog.title = '【' + row.plName + ' - ' + row.plCode + '】详情'
      this.dialog.uiDefineData = row;
      this.dialog.showDialog = true;
      return false;
      this.$router.push({
        path: '/UIDefineShow/:'+row.plOId,
        name: row.plName+'详情'
        path: '/UIDefineShow/:' + row.plOId,
        name: row.plName + '详情'
      });
    },
    sizeChange(val) {
@@ -433,31 +471,31 @@
          this.lastIndex = newIndex;
        },
        () => {
          this.selectList = [];
          this.selectList = [row];
        }
      );
    },
    //创建
    addHandler(){
      if(this.nodeRow && this.nodeRow.oid){
        this.form.plIsShow=[];
        this.form.plRelatedType=this.nodeRow.attributes.name;
    addHandler() {
      if (this.nodeRow && this.nodeRow.oid) {
        this.form.plIsShow = [];
        this.form.plRelatedType = this.nodeRow.attributes.name;
        this.dialogType = 'add';
        this.dialogVisible = true;
      }else {
      } else {
        this.$message.error('请选择业务类型');
      }
    },
    editHandler(){
      if(this.selectList.length!=0){
    editHandler() {
      if (this.selectList.length != 0) {
        this.rowEditBtnClick(this.selectList[0]);
      }else {
      } else {
        this.$message.error('请选择一条数据进行编辑');
      }
    },
    delHandler(){
    delHandler() {
      if (this.selectList.length <= 0) {
        this.$message.error('请至少选择一条数据');
        return;
@@ -491,31 +529,31 @@
      this.form = {
        plName: '',
        plCode: '',
        plDesc:'',
        plDesc: '',
        plIsShow: [],
      }
    },
    // 保存UI上下文
    saveHandler() {
      this.$refs.form.validate((valid,done) => {
      this.$refs.form.validate((valid, done) => {
        if (valid) {
          let params = {
            ...this.form
          }
          if(this.form.plIsShow.includes('导航区')){
            params.plIsShowNavigator=1
          }else {
            params.plIsShowNavigator=0
          if (this.form.plIsShow.includes('导航区')) {
            params.plIsShowNavigator = 1
          } else {
            params.plIsShowNavigator = 0
          }
          if(this.form.plIsShow.includes('控制区')){
            params.plIsShowForm=1;
          }else {
            params.plIsShowForm=0;
          if (this.form.plIsShow.includes('控制区')) {
            params.plIsShowForm = 1;
          } else {
            params.plIsShowForm = 0;
          }
          if(this.form.plIsShow.includes('操作区')){
            params.plIsShowTab=1;
          }else {
            params.plIsShowTab=0;
          if (this.form.plIsShow.includes('操作区')) {
            params.plIsShowTab = 1;
          } else {
            params.plIsShowTab = 0;
          }
          delete params.plIsShow;
          if (this.dialogType === 'add') {
@@ -550,62 +588,60 @@
        expDatas: this.selectList.map(item => item.plOId).join(',')
      }
      getExpContextTree(params).then(res => {
        this.expTreeData=[res.data.obj];
        this.expTreeData = [res.data.obj];
      })
      this.expDialogVisible=true;
      this.expDialogVisible = true;
    },
    exportData(){
    exportData() {
      const params = {}
      const checkedDatas=this.$refs.expTree.getCheckedNodes();
      const checkedDatas = this.$refs.expTree.getCheckedNodes();
      if (checkedDatas.length <= 0) {
        this.$message.error('请选择数据');
        return;
      }
      this.selectList.forEach(item=>{
        params[item.plOId]=checkedDatas.filter(checkitem => checkitem.parentId==item.plOId).map(checkitem => checkitem.oid).join(',')
      this.selectList.forEach(item => {
        params[item.plOId] = checkedDatas.filter(checkitem => checkitem.parentId == item.plOId).map(checkitem => checkitem.oid).join(',')
      })
      expUIContextData(params).then(res => {
        func.downloadFileByBlobHandler(res);
        this.$message.success('导出成功');
        this.expDialogVisible=false;
      }).catch(err => {
        this.$message.error(err);
        this.expDialogVisible = false;
      });
    },
    // 导入
    upLoadClickHandler() {
      this.fileData={
        isCovered:false,
        selectBtm:this.nodeRow.attributes.name
      this.fileData = {
        isCovered: false,
        selectBtm: this.nodeRow.attributes.name
      }
      this.$refs.upload.visible = true;
    },
    //导入失败
    upFail(response){
    upFail(response) {
    },
    //ui授权
    uiAuthorHandler(){
      if (this.selectList.length!=1) {
    uiAuthorHandler() {
      if (this.selectList.length != 1) {
        this.$message.error('请选择一条数据');
        return;
      }
      this.$refs.uiAuthor.openDialog(this.nodeRow.attributes.name,this.selectList[0].plCode);
      this.$refs.uiAuthor.openDialog(this.nodeRow.attributes.name, this.selectList[0].plCode);
    },
    // 编辑按钮
    rowEditBtnClick(row) {
      this.form={
      this.form = {
        ...row,
        plIsShow: [],
      };
      if(row.plIsShowNavigator){
      if (row.plIsShowNavigator) {
        this.form.plIsShow.push('导航区')
      }
      if(row.plIsShowForm){
      if (row.plIsShowForm) {
        this.form.plIsShow.push('控制区')
      }
      if(row.plIsShowTab){
      if (row.plIsShowTab) {
        this.form.plIsShow.push('操作区')
      }
      this.dialogType = 'edit';
@@ -632,17 +668,17 @@
      });
    },
    //克隆
    rowCloneHandler(row){
      this.cloneForm={
        sourcePLUILayout:row,
        cloneTargetName:'',
        cloneName:row.plName+'_copy(0)',
        cloneContextCode:row.plCode+'_copy(0)',
    rowCloneHandler(row) {
      this.cloneForm = {
        sourcePLUILayout: row,
        cloneTargetName: '',
        cloneName: row.plName + '_copy(0)',
        cloneContextCode: row.plCode + '_copy(0)',
      }
      this.cloneDialogVisible=true;
      this.cloneDialogVisible = true;
    },
    cloneSaveHandler(){
      this.$refs.cloneForm.validate((valid,done) => {
    cloneSaveHandler() {
      this.$refs.cloneForm.validate((valid, done) => {
        if (valid) {
          cloneUIContextData(this.cloneForm).then(res => {
            if (res.data.code === 200) {
@@ -656,9 +692,9 @@
        }
      });
    },
    cloneDialogClose(){
      this.cloneDialogVisible=false;
      this.cloneForm= {
    cloneDialogClose() {
      this.cloneDialogVisible = false;
      this.cloneForm = {
        //克隆的源对象的信息
        sourcePLUILayout: null,
        cloneTargetName: '',
@@ -675,40 +711,5 @@
  .el-scrollbar__wrap {
    overflow: auto !important;
  }
  .headerCon{
    .el-button{
      width: 82px;
    }
  }
}
.headerCon {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5px;
  .el-button + .el-button {
    margin-left: 5px;
  }
  .el-button {
    margin-top: 5px;
  }
}
.headerCon > .el-button:nth-child(4) {
  margin-left: 0;
}
.headerCon > .el-button:nth-child(7) {
  margin-left: 0;
}
.smallBtn {
  width: 82px;
  text-align: center;
  padding-left: 4.5px;
}
</style>