田源
2023-08-31 7e312ecf7100ca8931421e6200a145e6f26bc20e
Source/UBCS-WEB/src/views/docking/info.vue
@@ -2,31 +2,34 @@
  <el-container>
    <el-main>
      <basic-container>
        <avue-crud v-model="form" ref="crud" :option="option" :data="data" @on-load="onLoad" :page.sync="page"
        <avue-crud ref="crud" v-model="form" :data="data" :option="option" :page.sync="page" @on-load="onLoad"
                   @search-change="searchChange"
                   @search-reset="searchReset"
                   @selection-change="selectionChange"
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   @refresh-change="refreshChange" @row-click="rowClick">
                   @refresh-change="refreshChange" @row-click="rowClick" :cell-style="cellStyle">
          <template slot="menu" slot-scope="{row,index}">
            <el-button icon="el-icon-edit" size="small" type="text" @click="updateSave(row,index)">编辑</el-button>
            <el-button icon="el-icon-edit" size="small" type="text" @click="updateSave(row,index)" :disabled="row.usedFlag === 'true' ? false :true">编辑</el-button>
            <el-button icon="el-icon-delete" size="small" type="text" @click="deleteSave(row,index)">删除</el-button>
            <el-button v-if="row.usedflag=='false'" icon="el-icon-position" size="small" type="text" @click="ENABLE(row,index)">启用</el-button>
            <el-button v-else icon="el-icon-finished" size="small" type="text" @click="DISABLE(row,index)">停用</el-button>
            <el-button v-if="row.usedFlag=='false' || row.usedFlag==''" icon="el-icon-position" size="small" type="text"
                       @click="ENABLE(row,index)">启用
            </el-button>
            <el-button v-else icon="el-icon-finished" size="small" type="text" @click="DISABLE(row,index)">停用
            </el-button>
          </template>
          <template slot="menuLeft">
            <el-button size="small" type="primary" icon="el-icon-plus" @click="addSave">新&nbsp;&nbsp;增
            <el-button icon="el-icon-plus" size="small" type="primary" @click="addSave">新&nbsp;&nbsp;增
            </el-button>
            <el-button size="small" icon="el-icon-share" @click="PUSH">同  步
            <el-button icon="el-icon-share" size="small" @click="PUSH">同 步
            </el-button>
            <el-button size="small" icon="el-icon-search" @click="openAdvancedQuery">查  询
            <el-button icon="el-icon-search" size="small" @click="openAdvancedQuery">查 询
            </el-button>
          </template>
        </avue-crud>
      </basic-container>
    </el-main>
    <originalAdd ref="originalAdd" @refreshTable="refreshChange" :attribute="editAttribute"></originalAdd>
    <infoForm ref="infoForm" :formData="editAttribute" @refreshTable="refreshChange"></infoForm>
    <!-- 高级查询对话框 -->
    <advanced-query
      :ref="advancedQueryParam.ref"
@@ -39,31 +42,53 @@
<script>
import {
  getList,
  remove,
  add,
  update, getPage, getApplyRange
} from "@/api/omd/OmdAttribute";
  getList, add, edit, del, push, updateStatus
} from "@/api/docking/info";
import {getDictionary} from "@/api/omd/enum";
import {mapGetters} from "vuex";
import infoForm from "./infoForm.vue";
export default {
  name: "info",
  components: {infoForm},
  data() {
    return {
      //接口类型下拉
      interfaceTypeList: [{
        label: 'webService', value: 'webService'
      }, {
        label: '类路径', value: 'classPath'
      }, {
        label: 'Http', value: 'http'
      }],
      //参数类型下拉
      paramTypeList: [{
        label: 'xml', value: 'xml'
      }, {
        label: 'Json', value: 'json'
      }],
      //返回值类型下拉
      returnTypeList: [{
        label: 'xml', value: 'xml'
      }, {
        label: 'Json', value: 'json'
      }],
      //推送类型
      pushTypeList: [{value: '1', label: '数据推送'},
        {value: '2', label: '分类推送'},
        {value: '3', label: '编码申请'},
        {value: '4', label: '编码更改(状态、回收)'},
        {value: '5', label: '分类查询'},
        {value: '6', label: '含规则信息的分类查询'},
        {value: '7', label: '数据查询'}],
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 100
      },
      selectRow: "",
      selectRow: {},
      data: [],
      form: {},
      attribute: {
        nullable: true
      },
      editAttribute: {},
      applyRangeData: [],
      selectionList: [],
      option: {
        height: "auto",
@@ -85,85 +110,126 @@
        editBtn: false,
        delBtn: false,
        columnBtn: false,
        column: [{
          label: '推送类型',
          field: 'pushTypeText',
        column: [ {
          label: '是否启用',
          prop: 'usedFlag',
          width: 150,
          formatter: res => res.usedFlag === "true" ? "启用" : "停用"
        },{
          label: '集成系统',
          prop: 'sysBaseName',
          sortable: true,
          width: 150
        },{
          label: '分类选择',
          prop: 'classifyName',
          align:'center',
          // sortable: true,
          width: 150
        },{
          label: '编码类型',
          prop: 'isGroupCodeFlag',
          sortable: true,
          width: 150,
          type: 'select',
          dicData: this.pushType,
          props: {
            label: "value",
            value: "key"
          },
        }, {
          label: '系统名称',
          prop: 'sysbasename',
          formatter: res => res.isGroupCodeFlag ? '集团码' : '企业编码'
        },{
          label: '接口类型',
          prop:'dataFlowTypeText',
          align:'center',
          sortable: true,
          search: true,
          width: 150
          width:150,
        },{
          label: '推送类型',
          prop: 'pushTypeText',
          sortable: true,
          overHidden:true,
          align:'center',
          width: 150,
          //pushTypeList作用域
          // formatter: (d) => {
          //   return this.pushTypeList[d.pushType]
          // }
        }, {
          label: '系统编号',
          prop: 'sysbaseid',
          prop: 'id',
          sortable: true,
          search: true,
          hide:true,
          width: 150
        }, {
          label: '接口函数',
          prop: 'interfaceFunction',
          label: '系统名称',
          prop: 'name',
          hide:true,
          sortable: true,
          width: 150
        }, {
          label: '命名空间',
          prop: 'namespace',
          sortable: true,
        },{
          label: '接口方式',
          prop: 'interfaceType',
          // sortable: true,
          width: 150
        }, {
        },{
          label: '类路径',
          prop: 'classPath',
          // sortable: true,
          width: 150
        },{
          label: 'soapAction',
          prop: 'soapaction',
          prop: 'soapAction',
          sortable: true,
          width: 150
        }, {
          label: '参数名称',
          prop: 'targName',
          sortable: true,
          width: 150
        }, {
        },  {
          label: '调用方式',
          prop: 'cxfaxis',
          sortable: true,
          width: 150
        }, {
            label: '请求方式',
            prop: 'requestMethod',
            align:'center',
            // sortable: true,
            width: 150
          }, {
          label: '请求地址',
          prop: 'requesturl',
          prop: 'requestUrl',
          sortable: true,
          width: 150
        },  {
          label: '接口函数',
          prop: 'interfaceFunction',
          sortable: true,
          align:'center',
          width: 150
        }, {
            label: '参数名称',
            prop: 'targetName',
            sortable: true,
            width: 150
          },{
          label: '参数类型',
          prop: 'paramtype',
          prop: 'paramType',
          sortable: true,
          width: 150
          width: 150,
          formatter: (d) => {
            return this.paramTypeList[d.paramType]
          }
        }, {
          label: '返回值类型',
          prop: 'returntype',
          prop: 'returnType',
          sortable: true,
          width: 150,
          formatter: (d) => {
            return this.returnTypeList[d.returnType]
          }
        }, {
          label: '命名空间',
          prop: 'nameSpace',
          sortable: true,
          width: 150
        },{
          label: '系统描述',
          prop: 'description',
          width: 150
        }]
      },
      itemForm: {
        itemData: {},
        activeName: "referTab",
        enumInitFlag: false,
        referInitFlag: false,
        form: {}
      },
      pushType: [{key: '1', value: '数据推送'},
        {key: '2', value: '分类推送'},
        {key: '3', value: '编码申请'},
        {key: '4', value: '编码更改(状态、回收)'},
        {key: '5', value: '分类查询'},
        {key: '6', value: '含规则信息的分类查询'},
        {key: '7', value: '数据查询'}],
      // 高级查询对话框相关参数
      advancedQueryParam: {
        ref: 'advancedQuery',
@@ -185,7 +251,27 @@
      return oids.join(",");
    }
  },
  watch:{
    // editAttribute:{
    //   immediate: true,
    //   handler(newData) {
    //     this.$refs.infoForm.formData  = Object.assign({}, newData);
    //   }
    // }
  },
  methods: {
    //单元格样式
    cellStyle(row,column,rowIndex,columnIndex){
      if(row.columnIndex==2) {
        if(row.row.usedFlag == '' || row.row.usedFlag == 'false'){
          return {
            color: 'red',
            fontWeight: 'bold',
            fontSize: '20'
          }
        }
      }
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
@@ -198,15 +284,11 @@
    },
    selectionChange(list) {
      this.selectionList = list;
      if(this.selectionList.length <= 0){
        this.itemForm.itemData = null
      if (this.selectionList.length <= 0) {
        this.selectRow = null
        this.attribute = null
      }
      if (this.selectionList.length > 0) {
        this.itemForm.itemData = this.selectionList[list.length-1];
        this.selectRow = this.selectionList[list.length-1].$index;
        this.attribute = this.selectionList[list.length-1];
        this.selectRow = this.selectionList[list.length - 1].$index;
      }
    },
    selectionClear() {
@@ -223,44 +305,82 @@
      this.onLoad(this.page, this.query);
    },
    addSave() {
      this.$refs.originalAdd.showSubmitDialog = true;
      const newAttr = {};
      newAttr.nullable = true;
      this.$refs.originalAdd.attribute = newAttr;
      this.$refs.infoForm.showSubmitDialog = true;
      this.$refs.infoForm.formData = {
        dataFlowType: '',
        pushType: '',
        sourceSystemName: '',
        sourceSystemOid: '',
        sourceSystemId: '',
        targetSystemName: '',
        targetSystemOid: '',
        targetSystemId: '',
        sysIntParamVOs: [],
        sysIntHeaderVOs: []
      };
    },
    updateSave(row,index) {
      this.selectRow = index;
      var json = JSON.stringify(row);
      this.editAttribute = JSON.parse(json);
      this.editAttribute.nullable = row.nullable == 'true' ? true : false;
      this.$refs.originalAdd.attribute = this.editAttribute;
      this.$refs.originalAdd.showSubmitDialog = true;
      this.checkUsingReferDict(row);
      this.$refs.originalAdd.activeName = this.itemForm.activeName;
      this.$refs.originalAdd.enumInitFlag = this.itemForm.enumInitFlag;
      this.$refs.originalAdd.referInitFlag = this.itemForm.referInitFlag;
      // this.refreshChange()
    updateSave(row, index) {
      this.selectRow = row;
      this.editAttribute = row;
      this.editAttribute.sysIntParamVOs = row.sysIntParamVOs || [];
      this.editAttribute.sysIntHeaderVOs = row.sysIntHeaderVOs || [];
      this.editAttribute.type = 'edit';
      this.$refs.infoForm.formData = this.editAttribute;
      this.$refs.infoForm.showSubmitDialog = true;
      // console.log('row',this.editAttribute.pushType)
      // console.log('editAttribute',this.editAttribute.dataFlowTypeText)
    },
    deleteSave(row,index) {
      this.$confirm("删除元数据将无法被恢复, 是否继续?", "提示", {
    deleteSave(row, index) {
      this.$confirm("删除数据将无法被恢复, 是否继续?", "提示", {
        iconClass: 'el-icon-question',
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        showClose: true,
        type: "warning"
      }).then(() => {
        remove(row.oid).then(res => {
        del({oids:row.oid}).then(res => {
          this.$message.success("删除成功");
          this.refreshChange();
        });
      });
    },
    PUSH(){
    ENABLE(row, index) {
      //启用
      this.updateStatus(row, "enable");
    },
    DISABLE(row, index) {
      //停用
      this.updateStatus(row, "disable");
    },
    updateStatus(selectRow, able) {
      var that = this;
      var paramTemp = {
        update: able,
        oid: selectRow.oid,
        ts: selectRow.ts
      };
      this.$confirm("是否要" + (able == "enbale" ? "启用" : (able == "disable" ? "停用" : "发布")) + "这条数据?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return updateStatus(paramTemp);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: (able == "enbale" ? "启用成功" : (able == "disable" ? "停用成功" : "发布成功"))
          });
        });
    },
    PUSH() {
      if (this.selectionList.length != 1) {
        this.$message.error('请选择一条数据')
        this.$message.warning('请选择数据')
        return false;
      }
      this.$confirm("是否要"+ (this.selectionList[0].pushType == "1" ? "推送数据" : "推送分类"), {
      this.$confirm("是否要" + (this.selectionList[0].pushType == "1" ? "推送数据" : "推送分类"), {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
@@ -279,108 +399,98 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getPage(this.page.currentPage, this.page.pageSize, Object.assign(params, this.query)).then(res => {
      getList(this.page.currentPage, this.page.pageSize, Object.assign(params, this.query)).then(res => {
        console.log(res)
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        // const Props = {
        //   paramType: '',
        //   returnType: '',
        //   dataFlowType: '',
        //   pushType: '',
        //   classifyName: '',
        //   sourceSystemName: '',
        //   targetSystemName: '',
        //   classPath:'',
        //   requestMethod:'',
        //   requestUrl:'',
        //   interfaceFunction:'',
        //   nameSpace:'',
        //   soapAction:'',
        //   targetName:'',
        //   cxfaxis:''
        // };
        // this.pushTypeList.forEach(item => {
        //   Object.assign(item, Props);
        // });
        this.loading = false;
        this.data = res.data.data.records;
        this.itemData = this.data[0];
      });
    },
    rowClick(row) {
      this.itemForm.itemData = row;
      this.selectRow = row.$index;
      this.attribute = row;
      this.selectRow = row;
      this.$refs.crud.toggleSelection();
      this.$refs.crud.toggleRowSelection(row); //选中当前行
      //this.checkUsingReferDict(row);
    },
    checkUsingReferDict(row){
      if (row.referToId !== null && row.referToId !== ""){
        this.itemForm.activeName = 'referTab';
        this.itemForm.referInitFlag = true;
        this.itemForm.enumInitFlag = false;
      }else if (row.usingDict === 'true'){
        this.itemForm.activeName = 'enumTab';
        this.itemForm.referInitFlag = false;
        this.itemForm.enumInitFlag = true;
        getDictionary({code: row.dictCode}).then(res => {
          this.editAttribute.dictValue = res.data.data[0].label;
          this.itemForm.itemData.dictValue = this.editAttribute.dictValue;
          this.$refs.originalAdd.dictEnums = res.data.data;
        })
      }else {
        this.itemForm.activeName = 'referTab';
        this.itemForm.referInitFlag = true;
        this.itemForm.enumInitFlag = false;
      }
    },
    selectBtmType() {
      this.referType.display = true;
      this.referType.title = "请选择" + this.referType.value;
    },
    applyRangeOpen() {
      if (!this.selectRow && this.selectRow != 0) {
        this.$message({
          type: "warning",
          message: "请先选择属性"
        });
      }
      var oid = this.data[this.selectRow].oid;
      getApplyRange(oid).then(res => {
        this.applyRangeData = res.data.data;
        this.$refs.applyRange.rangeData = this.applyRangeData;
        this.$refs.applyRange.showDialog = true;
      });
    },
    /** 高级查询对话框组件,组件返回的值是condtionMap[field]形式的查询条件,保留了和之前一样的方式 */
    echoSeniorContionMap(conditionMaps){
      if(JSON.stringify(conditionMaps)!='{}'){
    echoSeniorContionMap(conditionMaps) {
      if (JSON.stringify(conditionMaps) != '{}') {
        this.query = conditionMaps;
        this.onLoad(this.page);
      }
    },
    openAdvancedQuery(){
        this.advancedQueryParam.options = [
          {
            data: [],
            title: '编号',
            fieldType: 'text',
            queryField: 'id',
          },{
            data: [],
            title: '名称',
            fieldType: 'text',
            queryField: 'name',
          },{
            data: [],
            title: '描述',
            fieldType: 'text',
            queryField: 'description',
          },{
            data: [
              // {
              //   key: '编辑中',
              //   value: 'Editing',
              // },
              // {
              //   key: '已发布',
              //   value: 'Released',
              // },
              // {
              //   key: '停用',
              //   value: 'Disabled',
              // },
            ],
            title: '状态',
            fieldType: 'combox',
            queryField: 'lcStatus',
            comboxKey: 'codeSearchLCStatus',
          },
        ]
    openAdvancedQuery() {
      this.advancedQueryParam.options = [{
        data: this.pushTypeList,
        title: '推送类型',
        queryField: 'pushType',
        fieldType: 'combox',
        comboxKey: 'searchPushType'
      }, {
        title: '系统名称',
        queryField: 'sysBaseName',
        fieldType: 'text'
      }, {
        title: '系统编号',
        queryField: 'sysBaseId',
        fieldType: 'text'
      }, {
        title: '接口函数',
        queryField: 'interfaceFunction',
        fieldType: 'text'
      }, {
        title: '命名空间',
        queryField: 'nameSpace',
        fieldType: 'text'
      }, {
        title: 'soapAction',
        queryField: 'soapAction',
        fieldType: 'text'
      }, {
        title: '参数名称',
        queryField: 'targetName',
        fieldType: 'text'
      }, {
        title: '调用方式',
        queryField: 'cxfaxis',
        fieldType: 'text'
      }, {
        title: '请求地址',
        queryField: 'requestUrl',
        fieldType: 'text'
      }, {
        title: '参数类型',
        queryField: 'paramType',
        fieldType: 'combox',
        comboxKey: 'searchparamType',
        data: this.paramTypeList
      }, {
        title: '返回值类型',
        queryField: 'returnType',
        fieldType: 'combox',
        comboxKey: 'searchreturnType',
        data: this.returnTypeList
      }]
      this.advancedQueryParam.currentOpen = 'info';
      this.advancedQueryParam.advancedQuerySettingBox = true;
@@ -390,7 +500,7 @@
</script>
<style lang="scss">
.applyRangeTable>.el-card:nth-of-type(2)>.el-card__body>.avue-crud__menu {
.applyRangeTable > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
  display: none !important;
}
</style>