ludc
2023-06-07 a17f731ee4bcad459c184be5a7c3de6c3619443b
Source/UBCS-WEB/src/views/code/code.vue
@@ -63,40 +63,46 @@
            @click="handleDelete">
            删 除
          </el-button>
          <el-button size="small"
          <el-button type="primary"
            size="small"
            icon="el-icon-search"
            plain
            @click="openAdvancedQuery('codeRule')">
            高级查询
          </el-button>
          <el-button
            size="small"
            icon="icon-kelong"
            plain
            @click="openCodeRuleDialog">
            克 隆
          </el-button>
          <el-button size="small"
          <el-button
            size="small"
            icon="icon-lianjiekelong"
            style="font-size: 12px;"
            plain
            @click="openOtherCodeRuleDialog">
            从其他规则中克隆码段
          </el-button>
          <el-button size="small"
          <el-button
            size="small"
            icon="el-icon-s-help"
            plain
            @click="handleRange">
            使用范围
          </el-button>
          <el-button size="small"
          <el-button
              size="small"
              icon="icon-qingkong"
              plain
              @click="clearAllCodeSec">
              清空码值
          </el-button>
          <el-button size="small"
            icon="el-icon-search"
            plain
            @click="openAdvancedQuery">
            高级查询
        </el-button>
        </template>
      </avue-crud>
    </basic-container>
    <!-- 高级查询对话框 -->
    <advanced-query
      :ref="advancedQueryParam.ref"
@@ -104,6 +110,7 @@
      :visible.sync="advancedQueryParam.advancedQuerySettingBox"
      @echoContion="echoSeniorContionMap">
    </advanced-query>
    <!-- 编码规则相关对话框 -->
    <el-dialog title="编码规则使用范围"
      append-to-body
@@ -117,6 +124,7 @@
        @refresh-change="refreshUseRangeChange">
      </avue-crud>
    </el-dialog>
    <!-- 编码规则,克隆对话框 -->
    <el-dialog title="克隆编码规则"
      append-to-body
@@ -170,6 +178,7 @@
        <el-button @click="cloneSettingBox = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 编码规则,从其他规则克隆对话框 -->
    <el-dialog title="克隆编码规则的基础信息"
      append-to-body
@@ -286,6 +295,13 @@
            plain
            @click="deleteBasicCode(scope.row)">
            删 除
        </el-button>
        <el-button type="primary"
            size="small"
            icon="el-icon-search"
            plain
            @click="openAdvancedQuery('codeBasicSec')">
            高级查询
        </el-button>
      </template>
@@ -1052,7 +1068,8 @@
          advancedQueryParam: {
            ref: 'advancedQuery',
            advancedQuerySettingBox: false,
            options: {},
            options: [],
            currentOpen: '', //当前打开高级查询的窗口是
            //conditionMapParams: {},
          },
@@ -1069,47 +1086,23 @@
          };
        },
      },
      created() {
          MasterTable({
            codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
            functionId: 5,
          }).then(res=>{
            console.log(res.data.tableDefineVO.seniorQueryColumns);
            this.advancedQueryParam.options = res.data.tableDefineVO.seniorQueryColumns;
          })
          // this.advancedQueryParam.options = [
          //   {
          //     data: [],
          //     title: '编号',
          //     fieldType: 'text',
          //     queryField: 'id',
          //   },{
          //     data: [],
          //     title: '名称',
          //     fieldType: 'text',
          //     queryField: 'name',
          //   },{
          //     data: [],
          //     title: '描述',
          //     fieldType: 'text',
          //     queryField: 'description',
          //   }, {
          //     data: [],
          //     title: '状态',
          //     fieldType: 'text',
          //     queryField: 'description',
          //   }
          // ]
      },
      watch:{
      },
      methods: {
        /** 高级查询对话框组件,组件返回的值是condtionMap[field]形式的查询条件,保留和之前一样 */
        /** 高级查询对话框组件,组件返回的值是condtionMap[field]形式的查询条件,保留了和之前一样的方式 */
        echoSeniorContionMap(conditionMaps){
          console.log(conditionMaps);
          //console.log(conditionMaps);
          if(JSON.stringify(conditionMaps)!='{}'){
            if(this.advancedQueryParam.currentOpen =='codeRule'){
              this.query = conditionMaps;
              this.onLoad(this.page);
            }else{
              this.sendGridCodeBasicSec(conditionMaps,true);
            }
            //console.log(conditionMaps);
          }
        },
        /* 公式编辑框内容改变,子组件编辑完公式之后内容回显时调用 */
@@ -1180,12 +1173,17 @@
        refreshParentClassifyDataChange() {
          this.parentClassifyOnLoad(this.parentClsfyParams.parentClassifyDataPage, this.parentClsfyParams.parentClassifyQuery);
        },
        // TODO:待修改
        parentClassifyOnLoad(page, params = {}) {
          let parentClsParam = this.parentClsfyParams;
          parentClsParam.classifyDialogLoading = true;
          let oid = this.selectionList.length==0 ? this.form.pkCodeRule:this.selectionList[0].oid;
          Object.assign(params,{pkCodeRule:oid})
          refDataGridClassifySec(page.currentPage, page.pageSize, Object.assign(params, parentClsParam.parentClassifyQuery)).then(res => {
          let conditionMaps = this.paramsToConditionMa({"pkCodeRule":oid});
          refDataGridClassifySec(
            page.currentPage,
            page.pageSize,
            conditionMaps
          ).then(res => {
            //console.log(res.data);
            const data = res.data.data;
            parentClsParam.parentClassifyDataPage.total = data.total;
@@ -1207,16 +1205,15 @@
          let attrParam = this.selectAttrParams;
          //console.log(this.currentSelectTreeData);
          attrParam.selectAttrOptionLoading = true;
          let param = {};
          // 多个conditionMap这样传参
          let conditionMaps = {};
          if(attrParam.selectAttrQeury){
              Object.keys(attrParam.selectAttrQeury).forEach(key=>{
                  param['conditionMap['+key+']'] = attrParam.selectAttrQeury[key];
              });
            Object.keys(attrParam.selectAttrQeury).forEach(key=>{
              conditionMaps['conditionMap['+key+']'] = attrParam.selectAttrQeury[key];
            });
          }
          param['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid;
          param['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid;
          listClassifyLinkAttr(param).then(res=>{
          conditionMaps['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid;
          conditionMaps['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid;
          listClassifyLinkAttr(conditionMaps).then(res=>{
            //console.log(res.data.data);
            attrParam.selectAttrData = res.data.data;
            attrParam.selectAttrOptionLoading = false;
@@ -1902,15 +1899,25 @@
          //存储当前关联的编码规则相关信息
          this.currentCodeRuleOid = row.oid;
          this.currentRuleLcStatus = row.lcStatus;
          this.sendGridCodeBasicSec({"pkCodeRule":row.oid});
          this.sendGridCodeBasicSec({"pkCodeRule_equal":row.oid},false);
        },
        // 发送加载基础码段的请求
        sendGridCodeBasicSec(condition){
        sendGridCodeBasicSec(condition,isAdancedQuery/** 是否高级查询 */){
          // 如果当前基础码段表中的搜索按钮被隐藏,就需要在此开启
          if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){
            this.hideBasicTable(true);
          }
          gridCodeBasicSec(1, -1, condition).then(res => {
          let conditionMaps = {};
          if(condition && !isAdancedQuery){
            Object.keys(condition).forEach(key=>{
              conditionMaps['conditionMap[t.'+key+']'] = condition[key];
            });
          }
          if(isAdancedQuery){
            condition['conditionMap[t.pkCodeRule_equal]'] = this.currentCodeRuleOid == null || this.currentCodeRuleOid == ''
            ? this.selectionList[0].oid:this.currentCodeRuleOid;
          }
          gridCodeBasicSec(1, -1,isAdancedQuery ? condition:conditionMaps).then(res => {
            const data = res.data.data;
            if(this.cloneSettingBox){
              this.cloneData = data.records;
@@ -1938,11 +1945,11 @@
        },
        basicSearchChange(params, done){
          //console.log(this.$refs.crudBasic);
          this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}));
          this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule_equal":this.selectionList[this.selectionList.length-1].oid}),false);
          done();
        },
        basicSearchReset(){
          this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid});
          this.sendGridCodeBasicSec({"pkCodeRule_equal":this.selectionList[this.selectionList.length-1].oid},false);
        },
        // 上移下移基础码段
        upOrderNum(row){
@@ -2005,8 +2012,79 @@
        /** 编码规则相关方法 */
        // 打开高级查询窗口
        openAdvancedQuery(){
          this.advancedQueryParam.advancedQuerySettingBox = !this.advancedQueryParam.advancedQuerySettingBox;
        openAdvancedQuery(condition){
          // MasterTable({
          //   codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
          //   functionId: 5,
          // }).then(res=>{
          //   console.log(res.data.tableDefineVO.seniorQueryColumns);
          // })
          if(condition=='codeRule'){
            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',
              }
            ]
          }else {
            this.advancedQueryParam.options = [
              {
                data: [],
                title: '码段编号',
                fieldType: 'text',
                queryField: 't.id',
              },{
                data: [],
                title: '码段名称',
                fieldType: 'text',
                queryField: 't.name',
              },{
                data: [],
                title: '描述',
                fieldType: 'text',
                queryField: 't.description',
              },{
                data: [],
                title: '码段类型',
                fieldType: 'combox',
                queryField: 't.secType',
                comboxKey: 'codeSecType',
              }
            ]
          }
          this.advancedQueryParam.currentOpen = condition;
          this.advancedQueryParam.advancedQuerySettingBox = true;
        },
        // 查询使用范围
        handleRange(){
@@ -2275,16 +2353,21 @@
          this.onLoad(this.page);
        },
        searchChange(params, done) {
          this.query = params;
          this.page.currentPage = 1;
          this.onLoad(this.page, params);
          // 多个conditionMap这样传参,快速查询默认采用模糊查询
          if(params){
            Object.keys(params).forEach(key=>{
              this.query['conditionMap['+key+'_like]'] = params[key];
            });
          }
          this.onLoad(this.page);
          done();
        }, 
        // 编码规则当前选中行变化的时候触发
        selectionChange(list) {
          this.selectionList = list;
          this.$refs.crud.setCurrentRow(this.selectionList[list.length-1]);
          //当前选中行为空的时候就将码段管理表格数据置空
          //当前选中行为空的时候就将码段管理表格数据置空,并禁用相关功能
          if(list == ''){
            this.basicData = [];
            this.hideBasicTable(false);
@@ -2308,14 +2391,25 @@
        refreshChange() {
          this.onLoad(this.page, this.query);
        },
        onLoad(page, params = {}) {
        onLoad(page,params={}) {
          this.loading = true;
          gridCodeRule(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          gridCodeRule(
            page.currentPage,
            page.pageSize,
            this.query
          ).then(res => {
            //console.log(res.data);
            const data = res.data.data;
            this.page.total = data.total;
            this.data = data.records;
            this.loading = false;
            // 查询的值为空时,要将码段管理相关的内容禁用
            if(data.records.length <= 0) {
              this.hideBasicTable(false);
              this.selectionList = [];
              this.basicData = [];
              return;
            }
            this.loadBasic(this.data[0])
            this.$nextTick(() => {
              this.$refs.crud.toggleRowSelection(this.data[0]);
@@ -2527,42 +2621,39 @@
          }
          // console.log(this.form);
        },
        // 第一次请求的枚举数据放缓存
        getLocalStorageEnum(key){
          let enumCach = JSON.parse(localStorage.getItem(key));
          if(enumCach == null) {
            getDictionary({code: key}).then(res=>{
              enumCach = res.data.data;
              localStorage.setItem(key,JSON.stringify(res.data.data));
            })
          }
          return enumCach;
        },
        //枚举和可输可选内容查询
        loadCodeSecType(){
          getDictionary({code: "codeSecType"}).then(res=>{
            this.enumParam.secTypeList = res.data.data;
          })
          this.enumParam.secTypeList = this.getLocalStorageEnum("codeSecType");
          this.loadCodeSecLength();
        },
        loadCodeSecLength(){
          getDictionary({code: "codeSecLength"}).then(res=>{
            this.enumParam.codeSecLengthType = res.data.data;
          })
          this.enumParam.codeSecLengthType = this.getLocalStorageEnum("codeSecLength");
        },
        loadCodeFillType(){
          getDictionary({code: "codeFillType"}).then(res=>{
            this.enumParam.codeFillType = res.data.data;
          })
          this.enumParam.codeFillType = this.getLocalStorageEnum("codeFillType");
        },
        loadCodeFillSeparator(){
          getDictionary({code: "codeFillSeparator"}).then(res=>{
            this.enumParam.codeFillSeparator = res.data.data;
          })
          this.enumParam.codeFillSeparator = this.getLocalStorageEnum("codeFillSeparator");
        },
        loadCodeLevelType(){
          getDictionary({code: "codeLevelType"}).then(res=>{
            this.enumParam.codeLevelType = res.data.data;
          })
          this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType");
        },
        loadCodeCutType(){
          getDictionary({code: "codeCutType"}).then(res=>{
            this.enumParam.codeCutType = res.data.data;
          })
          this.enumParam.codeCutType = this.getLocalStorageEnum("codeCutType");
        },
        loadCodeGetValueType(){
          getDictionary({code: "codeGetValueType"}).then(res=>{
            this.enumParam.codeGetValueType = res.data.data;
          })
          this.enumParam.codeGetValueType =  this.getLocalStorageEnum("codeGetValueType");
        },
        
      }