From b446560ccc97aedde9917db2273c6c6fb8b71acb Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 14 一月 2024 17:05:29 +0800
Subject: [PATCH] 277:参照配置界面,关于包含条件,同一个字段具备多个包含条件时,需要重新设置一下界面更改一下后端查询接口

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   48 ++++++------
 Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue                                 |  160 +++++++++++++++++++++++++++++++--------
 2 files changed, 150 insertions(+), 58 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
index 8c30e40..295ca05 100644
--- a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
@@ -189,45 +189,27 @@
             @echoSelectedAttr="echoSelectedAttr">
         </refer-select-btm-attr-dialog>
 
-        <el-dialog title="閫夋嫨鏄剧ず瀛楁"
+        <el-dialog title="閫夊彇IN鎴朜OTIN鏉′欢"
             append-to-body
-            :visible.sync="isShowShowField"
+            :visible.sync="isShowInOrNotInCondition"
             width="70%"
             destroy-on-close
             style="height: 110vh; margin-top: -12vh; overflow-y: hidden">
-            <avue-crud :option="selectionShowFieldOption"
-                :table-loading="selectShowFieldLoading"
-                :data="selectShowFieldData"
-                ref="selectShowFieldCrud"
-                @row-click="showFieldRowClick"
-                @selection-change="selectionShowFieldDataChange"
-                @search-change="showFieldSearchChange"
-                @search-reset="showFieldSearchReset">
+            <avue-crud :option="selectInOrNotInCondOption"
+                :page.sync="inOrNotInPage"
+                @current-change="inOrNotInCurrentChange"
+                @size-change="inOrNotInSizeChange"
+                @selection-change="selectionInOrNotInChange"
+                @row-click="rowInOrNotInClick"
+                @search-change="selectInOrNotInSearchChange"
+                @search-reset="searchInOrNotInReset"
+                :data="selectInOrNotInCondData"
+                ref="inOrNotInConditionCrud">
             </avue-crud>
             <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="selectedShowField">纭� 瀹�</el-button>
-                <el-button @click="isShowShowField = false">鍙� 娑�</el-button>
-            </div>
-        </el-dialog>
-
-        <el-dialog title="閫夋嫨鏌ヨ鏉′欢"
-            append-to-body
-            :visible.sync="isShowSearchCondition"
-            width="70%"
-            destroy-on-close
-            style="height: 110vh; margin-top: -12vh; overflow-y: hidden">
-            <avue-crud :option="selectionSearchConditionOption"
-                :table-loading="selectSearchConditionLoading"
-                :data="selectSearchConditionData"
-                ref="selectSearchConditionCrud"
-                @row-click="searchConditionRowClick"
-                @selection-change="searchConditionDataChange"
-                @search-change="searchConditionSearchChange"
-                @search-reset="searchConditionSearchReset">
-            </avue-crud>
-            <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="selectedSearchCondition">纭� 瀹�</el-button>
-                <el-button @click="isShowSearchCondition = false">鍙� 娑�</el-button>
+              <!-- <div class="avue-dialog__footer--left valueInfo">{{ valueInfo }}</div> -->
+              <el-button type="primary" @click="selectedInOrNotInCond">纭� 瀹�</el-button>
+              <el-button @click="isShowInOrNotInCondition = false">鍙� 娑�</el-button>
             </div>
         </el-dialog>
 
@@ -236,6 +218,7 @@
 
 <script>
     import func from "@/util/func";
+    import {getList} from "@/api/refer/table";
     export default {
         name: "referConfigFormDialog",
         props: {
@@ -420,7 +403,7 @@
                             clearable: false,
                             dicData: [
                                 {   
-                                    value: '_in', label: '瀛樺湪浜�'
+                                  value: '_in', label: '瀛樺湪浜�'
                                 },{
                                     value: '_notin', label: '涓嶅瓨鍦ㄤ簬'
                                 },{
@@ -473,6 +456,37 @@
                 preClickAttrRow: '',
                 preClickAddSearchConditionRow: '',
 
+                //鐐瑰嚮琛屽脊鍑篿n鎴杗otin鐨勫��
+                isShowInOrNotInCondition: false,
+                selectInOrNotInCondData: [],
+                selectInOrNotInCondOption: {
+                  height:'220',
+                  tip: false,
+                  addBtn: false,
+                  editBtn: false,
+                  searchShow: true,
+                  searchMenuSpan: 6,
+                  border: false,
+                  index: true,
+                  viewBtn: false,
+                  delBtn: false,
+                  selection: true,
+                  disablePage: false,
+                  refreshBtn: false,
+                  columnBtn: false,
+                  menu: false,
+                  dialogClickModal: false,
+                  highlightCurrentRow: true,
+                  column: []
+                },
+                inOrNotInPage: {
+                  pageSize: 10,
+                  currentPage: 1,
+                  total: 0,
+                },
+                selectionInOrNotInList: [],
+                inOrNotInParam: {},
+                
             };
         },
         // 琛ㄥ崟鐣岄潰鏄剧ず鍐呭閰嶇疆
@@ -981,9 +995,78 @@
                     //console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
                     this.form.codeSrchCondConfigVOS[this.preClickAddSearchConditionRow.$index].$cellEdit = false;
                 }
+                if(row.filterType === '_in' || row.filterType === '_notin'){
+                  //console.log(row);
+                  this.selectInOrNotInCondOption.column = [{
+                    prop: row.filterField,
+                    label: row.filterTypeText,
+                    search: true,
+                    searchLabelWidth: 45,
+                    searchSpan: 8,
+                    sortable: true,
+                  }]
+                  this.initPageData.pageSize = 10;
+                  this.initPageData.currentPage = 1;
+                  this.loadInOrNotInConditionData(this.initPageData);
+                  this.isShowInOrNotInCondition = true;
+                }
                 row.$cellEdit = true;
                 this.preClickAddSearchConditionRow = row;
             },
+            loadInOrNotInConditionData(page, params = {}){
+              let mustParams = {
+                referType: this.form.referType,
+                referBo: this.form.referType,
+              };
+              getList(Object.assign(mustParams,params),page.currentPage,page.pageSize,'/api/ubcs-code/mdmEngineController/defaultReferDataGrid','GET').then(res=>{
+                //console.log(res.data);
+                this.selectInOrNotInCondData = res.data.records;
+                this.inOrNotInPage.total = res.data.total;
+              });
+            },
+            inOrNotInCurrentChange(currentPage) {
+              this.inOrNotInPage.currentPage = currentPage;
+            },
+            inOrNotInSizeChange(pageSize) {
+              this.inOrNotInPage.pageSize = pageSize;
+            },
+            rowInOrNotInClick(row){
+              this.$refs.inOrNotInConditionCrud.toggleSelection();
+              this.$refs.inOrNotInConditionCrud.toggleRowSelection(row); //閫変腑褰撳墠琛�
+            },
+            selectionInOrNotInChange(list){
+              if (this.isMuti && list.length > 1) {
+                const nowVal = list.shift();
+                this.$refs.inOrNotInConditionCrud.toggleRowSelection(nowVal, false);
+              }
+              this.selectionInOrNotInList = list
+            },
+            selectedInOrNotInCond(){
+              if(this.selectionInOrNotInList && this.selectionInOrNotInList.length > 0){
+                // console.log(this.selectionInOrNotInList)
+                this.preClickAddSearchConditionRow.filterValue = this.selectionInOrNotInList.map(item => item[this.selectInOrNotInCondOption.column[0].prop]).join(',');
+                this.isShowInOrNotInCondition = false;
+              }
+            },
+            /** 鐐瑰嚮鎼滅储鍚庤Е鍙戣浜嬩欢 */
+            selectInOrNotInSearchChange(params, done) {
+              this.initPageData.currentPage = 1;
+              let requestData = {};
+              if(params) {
+                Object.keys(params).forEach((key)=>{
+                  requestData["conditionMap" + "["+ key +"_like]"] = params[key].trim();
+                })
+              }
+              this.inOrNotInParam = requestData;
+              this.loadInOrNotInConditionData(this.initPageData,this.inOrNotInParam);
+              done();
+            },
+            /** 閲嶇疆浣嶅睘鎬ч�夊彇鍊艰〃鏍肩殑鎼滅储妗嗕箣鍚庣殑鍥炶皟 */
+            searchInOrNotInReset() {
+              this.inOrNotInParam = {};
+              this.loadInOrNotInConditionData(this.initPageData);
+            },
+
             //涓婁竴涓〉闈㈠凡缁忛�変腑鍙傜収搴旂敤鐨勪笟鍔$被鍨嬬殑鎯呭喌锛屽拰涓婁竴娆″凡缁忛厤缃繃鍙傜収閰嶇疆鐨勬儏鍐典笅杩涜椤甸潰鍒濆鍖栨覆鏌�
             initPageData(val){
                 // console.log(val.referConfig);
@@ -1263,4 +1346,13 @@
         transition:opacity .0s !important;
     }
 
+    /* .valueInfo {
+      float: left;
+      border: 1px solid #E9E7E7;
+      display: inline-block;
+      vertical-align: middle;
+      padding: 9px 15px;
+      line-height: 1;
+    } */
+
 </style>
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index c536b4f..c3618b2 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -4397,29 +4397,29 @@
             throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
         }
 		// TODO:鍙傜収閰嶇疆鐨勬ā绯婃煡璇㈣繃婊ゆ潯浠舵殏鏈鐞�
-/*        String namesql = "";
-        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
-            String s = baseQueryObject.getConditionMap().get("name");
-            s = "%" + s + "%";
-            namesql = "and name like" + VciBaseUtil.toInSql(s);
-        }
+		/*        String namesql = "";
+				if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
+					String s = baseQueryObject.getConditionMap().get("name");
+					s = "%" + s + "%";
+					namesql = "and name like" + VciBaseUtil.toInSql(s);
+				}
 
-        String codesql = "";
-        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
-            String s = baseQueryObject.getConditionMap().get("id");
-            s = "%" + s + "%";
-            codesql = "and id like" + VciBaseUtil.toInSql(s);
-        }
+				String codesql = "";
+				if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
+					String s = baseQueryObject.getConditionMap().get("id");
+					s = "%" + s + "%";
+					codesql = "and id like" + VciBaseUtil.toInSql(s);
+				}
 
-        String lcstatusSql = "";
-        if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
-            lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
-        }*/
-//        String where = "";
+				String lcstatusSql = "";
+				if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
+					lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
+				}*/
+		//        String where = "";
 
-//        if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
-//            where = "where ";
-//        }
+		//        if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
+		//            where = "where ";
+		//        }
 		String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap());
 
 		String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
@@ -4427,8 +4427,8 @@
 
         List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
                 + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
-                + whereSqlByMap + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
+                + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
+                + (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"") + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
 		));
         List<BaseModel> baseModels = new ArrayList<>();
         //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
@@ -4476,8 +4476,8 @@
         }
         int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
                 + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
-                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
-                + whereSqlByMap
+                + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
+				+ (Func.isNotBlank(whereSqlByMap) ? "and "+whereSqlByMap:"")
         );
         IPage<BaseModelVO> objectDataGrid = new Page<>();
         objectDataGrid.setPages(baseQueryObject.getPage());

--
Gitblit v1.9.3