田源
2024-11-08 d336c430e5d22ade703ff12f3d523889eb3d75d6
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue
@@ -46,8 +46,8 @@
            v-model="form"
            :data="data"
            :option="option"
            :page.sync="page"
            :table-loading="tableLoading"
            :before-open="beforeOpen"
            @row-del="rowDelHandler"
            @row-save="rowSaveHandler"
            @row-update="rowUpdateHandler"
@@ -74,6 +74,7 @@
        <div style="margin-top: 10px">
          <avue-crud
            ref="BottomCrud"
            v-model="bottomForm"
            :data="bottomData"
            :option="bottomOption"
            :table-loading="bottomTableLoading"
@@ -85,7 +86,13 @@
              <el-button icon="el-icon-plus" plain size="small" type="primary" @click="bottomAddClickHandler">增加
              </el-button>
            </template>
            <template slot="menuForm" slot-scope="scope">
              <el-button type="primary"
                         size="small"
                         icon="el-icon-check"
                         v-if="scope.type === 'add'"
                         @click="handleSaveNext()">保存后继续添加</el-button>
            </template>
          </avue-crud>
        </div>
      </basic-container>
@@ -138,6 +145,7 @@
      rightRoleData: [],
      form: {},
      bottomTableLoading: false,
      bottomForm:{},
      bottomData: [],
      bottomOption: {
        ...basicOption,
@@ -145,6 +153,7 @@
        calcHeight: -30,
        selection: false,
        refreshBtn: false,
        dialogWidth:'700',
        // height:'auto',
        column: [
          {
@@ -180,10 +189,15 @@
        addBtn: false,
        height: 350,
        highlightCurrentRow: true,
        menuWidth:160,
        span:24,
        labelWidth:100,
        dialogWidth:'700',
        column: [
          {
            label: '编号',
            prop: 'plCode',
            overHidden: true,
            search: true,
            rules: [
              {
@@ -196,6 +210,7 @@
          {
            label: '名称',
            prop: 'plName',
            overHidden: true,
            search: true,
            rules: [
              {
@@ -204,12 +219,6 @@
                trigger: 'blur'
              }
            ]
          },
          {
            label: '类路径',
            prop: 'plCSClass',
            search: true,
            overHidden: true,
          },
          {
            label: '分类',
@@ -231,15 +240,25 @@
            dicData: []
          },
          {
            label: '链接地址',
            label: 'C/S类路径',
            prop: 'plCSClass',
            search: true,
            searchLabelWidth:120,
            overHidden: true,
          },
          {
            label: 'B/S链接地址',
            prop: 'plBSUrl',
            search: true,
            searchLabelWidth:120,
            overHidden: true,
          },
          {
            label: '类型',
            prop: 'plTypeType',
            search: true,
            type: 'select',
            type: 'radio',
            width:100,
            dicData: [{
              label: '业务类型',
              value: 'business'
@@ -260,6 +279,7 @@
            prop: 'plDesc',
            search: true,
            overHidden: true,
            type: 'textarea'
          },
        ]
      },
@@ -273,7 +293,10 @@
          value: 'id',
          children: 'childs'
        },
        dialogWidth:'800',
        dialogMenuPosition: 'right',
        formOption: {
          dialogMenuPosition: 'right',
          column: [
            {
              label: '分类名称',
@@ -300,21 +323,24 @@
            {
              label: '创建者',
              prop: 'creator',
              readonly: true,
              disabled: true,
            },
            {
              label: '创建时间',
              prop: 'createTime',
              readonly: true,
              disabled: true,
            },
            {
              label: '父主类',
              prop: 'pidName',
              readonly: true,
              disabled: true,
              span:24
            },
            {
              label: '备注',
              prop: 'description'
              prop: 'description',
              type:'textarea',
              span:24
            },
          ],
        }
@@ -335,7 +361,9 @@
        const data = res.data.obj;
        this.treeData = [data];
        const selectTreeData = this.option.column.find(item => item.prop === 'plActionCls'); // 找到action添加分类树
        selectTreeData.dicData = [data];
        const dicData=[data];
        dicData[0].disabled=true;//根节点不能选
        selectTreeData.dicData = dicData;
      })
    },
@@ -420,6 +448,17 @@
      this.getRightTableList(this.treeNodeRow);
    },
    beforeOpen(done, type, loading) {
      if ([ 'edit'].includes(type)) {
        // 编辑逻辑
        this.$set(this.option.column[2],'disabled',false);
      } else {
        // 新增逻辑
        this.$set(this.option.column[2],'disabled',true);
      }
      done();
      console.log(this.option.column)
    },
    // action列表增加
    addClickHandler() {
      if (func.isEmptyObject(this.treeNodeRow)) {
@@ -464,29 +503,24 @@
      this.leftRoleData = [{
        name: '编号',
        oid: '编号'
      },
        {
          name: '类路径',
          oid: '类路径'
        },
        {
          name: '链接地址',
          oid: '链接地址'
        },
        {
          name: '类型',
          oid: '类型'
        },
        {
          name: '描述',
          oid: '描述'
        },]
      }, {
        name: '类路径',
        oid: '类路径'
      }, {
        name: '链接地址',
        oid: '链接地址'
      }, {
        name: '类型',
        oid: '类型'
      }, {
        name: '描述',
        oid: '描述'
      },]
      this.$refs.transfer.visible = true;
    },
    // 穿梭框保存 index为0是选择 1是全部
    exportSendHandler(row, index) {
      console.log(row, index);
      const params = {
        dataType: index,
        chooseDataOid: index === 0 ? this.selectList.map(item => item.plOId) : [],
@@ -544,6 +578,7 @@
    // 参数列表新增保存
    BottomRowSaveHandler(form, done, loading) {
      form.actionOid=this.currenRow.plOId;
      savePLActionParam(form).then(res => {
        if (res.data.code === 200) {
          this.$message.success('添加成功');
@@ -553,7 +588,24 @@
      })
      loading();
    },
    handleSaveNext(){
      this.$refs.BottomCrud.$refs.dialogForm.$refs.tableForm.$refs.form.validate((valid) => {
        if (valid) {
          this.bottomForm.actionOid=this.currenRow.plOId;
          savePLActionParam(this.bottomForm).then(res => {
            if (res.data.code === 200) {
              this.$message.success('添加成功');
              this.bottomForm={};
              this.getBottomList();
              this.$refs.BottomCrud.$refs.dialogForm.$refs.tableForm.$refs.form.resetFields()
            }
          })
        } else {
          return false;
        }
      });
    },
    // 参数列表修改保存
    BottomRowUpdateHandler(row, index, done, loading) {
      updatePLActionParam(row).then(res => {
@@ -593,7 +645,10 @@
        this.$message.error('请选择一条分类进行添加');
        return;
      }
      if (!this.treeNodeRow.id && this.treeNodeRow.name=='未分类') {
        this.$message.error('未分类下不能创建子分类');
        return;
      }
      const {createTime, creator, name, id, description} = this.treeNodeRow;
      this.$set(this.treeForm, 'createTime', func.formattedDate(createTime));
      this.$set(this.treeForm, 'creator', creator);
@@ -626,6 +681,10 @@
        this.$message.error('根节点不能修改');
        return;
      }
      if (!this.treeNodeRow.id && this.treeNodeRow.name=='未分类') {
        this.$message.error('未分类不能修改');
        return;
      }
      const {name, serialno, creator, createTime, pid, description, id} = this.treeNodeRow;
      const pidName = this.findObjectNameById(this.treeData, pid);
      this.$set(this.treeForm, 'name', name);
@@ -645,7 +704,7 @@
      updateActionCls(data).then(res => {
        if (res.data.code === 200) {
          this.$message.success('修改成功');
          this.getBottomList();
          //this.getBottomList();
        }
        done();
      })
@@ -718,40 +777,8 @@
  .el-scrollbar__wrap {
    overflow: auto !important;
  }
  .headerCon {
    .el-button {
      width: 82px;
    }
  .avue-dialog .el-dialog__body .avue-form{
    margin: 0 auto;
  }
}
.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>