Browse Source

智能查询默认选中and

V1.0
mk 2 years ago
parent
commit
a1323ee9a6
  1. 11
      src/views/modules/home/index.vue
  2. 75
      src/views/modules/shequ/chaxun.vue
  3. 183
      src/views/modules/shequ/cpts/smatr-rules.vue

11
src/views/modules/home/index.vue

@ -1,3 +1,4 @@
<template> <template>
<div> <div>
<div class="g-row"> <div class="g-row">
@ -49,7 +50,7 @@
查一下 查一下
</div> </div>
</div> </div>
<div class="btn2" @click="handleClickSearchBtn"> <div class="btn2" @click="handleClickSearchBtn('smart')">
<img src="@/assets/images/index/i-search.png" /> <img src="@/assets/images/index/i-search.png" />
智能查询 智能查询
</div> </div>
@ -278,7 +279,6 @@
<fastcall ref="fastcall" /> <fastcall ref="fastcall" />
</div> </div>
</template> </template>
<script> <script>
import { requestPost, requestGet } from "@/js/dai/request"; import { requestPost, requestGet } from "@/js/dai/request";
import resiCategoryMap from "@/views/business/resi-category-map.js"; import resiCategoryMap from "@/views/business/resi-category-map.js";
@ -384,11 +384,14 @@ export default {
localStorage.setItem('homeSearchKey',searchKey) localStorage.setItem('homeSearchKey',searchKey)
}, },
handleClickSearchBtn() { handleClickSearchBtn(str) {
console.log("dddd")
const { const {
searchData: { type, searchKey }, searchData: { type, searchKey },
} = this; } = this;
if(str){
this.toSearchPage(type, searchKey);
return
}
if (!searchKey) return this.$message.error("请输入搜索条件"); if (!searchKey) return this.$message.error("请输入搜索条件");
this.toSearchPage(type, searchKey); this.toSearchPage(type, searchKey);
}, },

75
src/views/modules/shequ/chaxun.vue

@ -3,7 +3,7 @@
<div class="m-box m-search"> <div class="m-box m-search">
<div class="wrap"> <div class="wrap">
<div class="title"> <div class="title">
<span>{{smatrFlag?'智能查询':'社区查询'}}</span> <span>{{ smatrFlag ? '智能查询' : '社区查询' }}</span>
</div> </div>
<div class="tabs"> <div class="tabs">
@ -14,13 +14,14 @@
查房屋 查房屋
</div> </div>
</div> </div>
<!-- -->
<div class="search"> <div class="search">
<div class="search-input"> <div class="search-input">
<div class="input"> <div class="input">
<input type="text" :placeholder="typePlaceholder[searchData.type]" v-model="searchData.searchKey" <input type="text" :placeholder="typePlaceholder[searchData.type]" v-model="searchData.searchKey"
@keyup.enter="handleClickSearchBtn" /> @keyup.enter="handleClickSearchBtn" />
<div class="close-btn" v-if="searchData.searchKey != ''" @click="searchData.searchKey = ''"> <div class="close-btn" v-if="searchData.searchKey != ''"
@click="searchData.searchKey = '', childrenRulesData = []">
<img src="@/assets/img/shequ/close.png" /> <img src="@/assets/img/shequ/close.png" />
</div> </div>
</div> </div>
@ -33,8 +34,8 @@
</div> </div>
<p v-show="smatrFlag && searchStatus == 'ing'" class="rules_box"> <p v-show="smatrFlag && searchStatus == 'ing'" class="rules_box">
已显示{{ searchData.type == 'fangwu' ? '房屋' : '居民' }}状态为{{ keyWordStr }}的搜索结果如不满足需求 <el-button type="text" 已显示{{ searchData.type == 'fangwu' ? '房屋' : '居民' }}状态为{{ searchData.searchKey }}的搜索结果如不满足需求 <el-button
@click="handleClickEditRules">请点击此处调整</el-button> type="text" @click="handleClickEditRules">请点击此处调整</el-button>
</p> </p>
</div> </div>
</div> </div>
@ -246,7 +247,7 @@
<el-dialog v-if="showSmatrForm" :visible.sync="showSmatrForm" :append-to-body="true" :close-on-click-modal="false" <el-dialog v-if="showSmatrForm" :visible.sync="showSmatrForm" :append-to-body="true" :close-on-click-modal="false"
:close-on-press-escape="false" :title="'修改条件'" width="880px" top="5vh" class="dialog-h" :close-on-press-escape="false" :title="'修改条件'" width="880px" top="5vh" class="dialog-h"
@closed="showSmatrForm = false"> @closed="showSmatrForm = false">
<smatr-rules @dialogCancle="dialogCancle" @dialogOk="dialogOk"> <smatr-rules ref="smatr_rules_form" @dialogCancle="dialogCancle" @dialogOk="dialogOk" :rulesData="rulesData">
</smatr-rules> </smatr-rules>
</el-dialog> </el-dialog>
</div> </div>
@ -260,6 +261,7 @@ import getQueryPara from "dai-js/modules/getQueryPara";
import resiInfo from "@/views/modules/cpts/resi/info"; import resiInfo from "@/views/modules/cpts/resi/info";
import houseInfo from "@/views/modules/cpts/house/info"; import houseInfo from "@/views/modules/cpts/house/info";
import smatrRules from "./cpts/smatr-rules.vue"; import smatrRules from "./cpts/smatr-rules.vue";
import { requestGet } from '../../../js/dai/request';
export default { export default {
components: { components: {
resiInfo, resiInfo,
@ -383,10 +385,10 @@ export default {
currentPage: "chaxun", // , currentPage: "chaxun", // ,
smatrFlag: false, smatrFlag: false,
keyWordStr: '',
showSmatrForm: false, showSmatrForm: false,
rulesData : [] rulesData: [],
childrenRulesData: []
}; };
}, },
computed: { computed: {
@ -410,18 +412,15 @@ export default {
}, },
methods: { methods: {
firstSearch() { firstSearch() {
console.log(getQueryPara("type"));
console.log(this.$route.query.type, 'type');
console.log(this.$route.query.searchKey, 'search');
// this.searchData.searchKey = getQueryPara("searchKey");
// this.searchData.type = getQueryPara("type");
this.searchData.searchKey = localStorage.getItem('homeSearchKey') || '' this.searchData.searchKey = localStorage.getItem('homeSearchKey') || ''
this.searchData.type = localStorage.getItem('homeSearchType') || '' this.searchData.type = localStorage.getItem('homeSearchType') || ''
this.handleClickSearchBtn(); this.handleClickSearchBtn();
}, },
//
handleClickEditRules() { handleClickEditRules() {
this.showSmatrForm = true this.showSmatrForm = true
this.$nextTick(() => {
this.$refs.smatr_rules_form.initForm(this.rulesData.length == 0 ? this.childrenRulesData : this.rulesData)
})
}, },
computedWidth(label) { computedWidth(label) {
const wd = 20 * label.length; const wd = 20 * label.length;
@ -435,23 +434,24 @@ export default {
}); });
} }
if (row.mobile != ''&&row.mobile) { if (row.mobile != '' && row.mobile) {
row.mobile = row.mobile.substr(0, 3) + '****' + row.mobile.substr(7, 4) row.mobile = row.mobile.substr(0, 3) + '****' + row.mobile.substr(7, 4)
} else if(row.mobile == '' || row.mobile == '--'){ } else if (row.mobile == '' || row.mobile == '--') {
row.mobile = "" row.mobile = ""
} }
row.idNum = row.idNum.substr(0, 11) + '*****' + row.idNum.substr(16, 2) row.idNum = row.idNum.substr(0, 11) + '*****' + row.idNum.substr(16, 2)
return _val || row[item.columnName]; return _val || row[item.columnName];
}, },
handleClickSearchBtn() { async handleClickSearchBtn() {
const { const {
searchData: { type, searchKey }, searchData: { type, searchKey },
} = this; } = this;
localStorage.setItem('homeSearchType', type) localStorage.setItem('homeSearchType', type)
localStorage.setItem('homeSearchKey', searchKey) localStorage.setItem('homeSearchKey', searchKey)
if (!searchKey) return this.$message.error("请输入搜索条件"); if (!searchKey) return
this.keyWordStr = searchKey if (!this.smatrFlag) this.childrenRulesData = []
if (type == "jumin") { if (type == "jumin") {
this.searchJumin.pageNo = 1; this.searchJumin.pageNo = 1;
this.searchJumin.total = 0; this.searchJumin.total = 0;
@ -460,10 +460,28 @@ export default {
this.searchFangwu.pageNo = 1; this.searchFangwu.pageNo = 1;
this.searchFangwu.total = 0; this.searchFangwu.total = 0;
this.getSearchFangwu(); this.getSearchFangwu();
}
if (this.smatrFlag && this.childrenRulesData.length === 0) {
this.getRulesList()
} }
this.searchStatus = "ing"; this.searchStatus = "ing";
}, },
async getRulesList() {
//MOCK http://127.0.0.1:4523/mock2/2515967/96358430
let url = 'http://127.0.0.1:4523/mock2/2515967/96358430'
let par = {
keyWord: this.searchData.searchKey,
type: this.searchData.type
}
const { data, code, msg } = await requestGet(url, par)
if (code == 0) {
this.rulesData = data
console.log(this.rulesData);
} else {
console.log(msg);
}
},
handleClickSmartSearchBtn() { handleClickSmartSearchBtn() {
this.smatrFlag = !this.smatrFlag this.smatrFlag = !this.smatrFlag
this.searchData.searchKey = '' this.searchData.searchKey = ''
@ -513,12 +531,14 @@ export default {
searchData: { searchKey }, searchData: { searchKey },
searchJumin: { pageSize, pageNo }, searchJumin: { pageSize, pageNo },
} = this; } = this;
console.log(this.rulesData);
console.log(this.childrenRulesData);
this.searchJumin.loading = true; this.searchJumin.loading = true;
const { data, code, msg } = await requestPost(url, { const { data, code, msg } = await requestPost(url, {
searchKey, searchKey,
pageSize, pageSize,
pageNo, pageNo,
smartSearchRules:this.rulesData smartSearchRules: this.childrenRulesData || null
}); });
this.searchJumin.loading = false; this.searchJumin.loading = false;
if (code === 0) { if (code === 0) {
@ -545,7 +565,7 @@ export default {
searchKey, searchKey,
pageSize, pageSize,
pageNo, pageNo,
smartSearchRules:this.rulesData smartSearchRules: this.childrenRulesData || null
}); });
this.searchFangwu.loading = false; this.searchFangwu.loading = false;
if (code === 0) { if (code === 0) {
@ -587,14 +607,15 @@ export default {
this.handleClickSearchBtn() this.handleClickSearchBtn()
// this.searchData.searchKey = '' // this.searchData.searchKey = ''
}, },
dialogCancle(){ dialogCancle() {
this.showSmatrForm = false this.showSmatrForm = false
}, },
dialogOk(rulesData){ dialogOk(rulesData) {
this.showSmatrForm = false this.showSmatrForm = false
if(rulesData){ this.rulesData = []
this.rulesData = rulesData || null if (rulesData) {
this.handleClickSearchBtn() this.childrenRulesData = rulesData || null
this.handleClickSearchBtn()
} }
} }
}, },

183
src/views/modules/shequ/cpts/smatr-rules.vue

@ -68,7 +68,7 @@
</el-table-column> </el-table-column>
<el-table-column label="条件关系" align="center" width="100"> <el-table-column label="条件关系" align="center" width="100">
<template slot-scope="scope" v-if="scope.$index != tableData.length - 1"> <template slot-scope="scope" v-if="scope.$index != tableData.length - 1">
<el-select v-model="scope.row.nextLogicalRel" placeholder="请选择" clearable> <el-select v-model="scope.row.nextLogicalRel" placeholder="请选择" clearable disabled>
<el-option v-for="item in nextLogicalRelOpction" :label="item.label" :value="item.value" <el-option v-for="item in nextLogicalRelOpction" :label="item.label" :value="item.value"
:key="item.value"> :key="item.value">
</el-option> </el-option>
@ -98,11 +98,6 @@ import { requestPost, requestGet } from "@/js/dai/request";
export default { export default {
data() { data() {
return { return {
timeout: null,
tagObj: {},
searchList: [],
tableData: [ tableData: [
{ {
dataSource: "", // dataSource: "", //
@ -110,7 +105,7 @@ export default {
itemId: "", // itemId: "", //
queryType: "", // queryType: "", //
colVal: "", // colVal: "", //
nextLogicalRel: "", //, nextLogicalRel: "and", //,
tableName: "", // tableName: "", //
colKey: "", colKey: "",
itemIdOpction: [], itemIdOpction: [],
@ -122,7 +117,7 @@ export default {
{ label: "人员信息", value: "resi" }, { label: "人员信息", value: "resi" },
{ label: "房屋信息", value: "house" }, { label: "房屋信息", value: "house" },
], ],
queryTypeOpction: [{}], queryTypeOpction: [],
nextLogicalRelOpction: [ nextLogicalRelOpction: [
{ label: "并且", value: "and" }, { label: "并且", value: "and" },
{ label: "或者", value: "or" }, { label: "或者", value: "or" },
@ -131,38 +126,23 @@ export default {
}, },
created() { }, created() { },
async mounted() { async mounted() {
await this.getLabelList();
}, },
methods: { methods: {
async initForm(type, row) { async initForm(data) {
await this.getFormEdit(); // await this.getFormEdit();
this.tableData = data
console.log(data);
for (let i in this.tableData) { for (let i in this.tableData) {
this.handleChangeSource(this.tableData[i], [i], type); this.handleChangeSource(this.tableData[i], [i]);
this.handleChangeFieldsType(this.tableData[i], [i], type); this.handleChangeFieldsType(this.tableData[i], [i]);
setTimeout(() => { setTimeout(() => {
this.handleChangeFieldsName(this.tableData[i], [i], type); this.handleChangeFieldsName(this.tableData[i], [i]);
}, 300); }, 300);
} }
}, },
async handleSelect(item) {
console.log(item);
await this.initForm("info", item);
},
async getLabelList() {
const url = "/governance/resiSearchTag/listResiSearchTags";
let params = {
pageSize: 99,
};
let { data, msg, code } = await requestPost(url, params);
if (code == 0) {
this.searchList = data.list;
} else {
this.$message.error(msg);
}
},
// //
async handleChangeSource(row, index, type) { async handleChangeSource(row, index) {
console.log(row); console.log(row);
if (row.dataSource == "resi") { if (row.dataSource == "resi") {
let url = "/oper/customize/icformitemgroup/list"; let url = "/oper/customize/icformitemgroup/list";
@ -178,15 +158,15 @@ export default {
this.$message.error(msg); this.$message.error(msg);
} }
this.hadeleClearForm(this.tableData[index], index); this.hadeleClearForm(this.tableData[index], index);
if (!type) { // if (!type) {
this.tableData[index].itemGroupId = ""; // this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = ""; // this.tableData[index].itemId = "";
this.tableData[index].colKey = ""; // this.tableData[index].colKey = "";
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
this.tableData[index].itemIdOpction = []; // this.tableData[index].itemIdOpction = [];
} // }
} else if (row.dataSource == "house") { } else if (row.dataSource == "house") {
let url = "/governance/policy/item-list/house"; let url = "/governance/policy/item-list/house";
let params = {}; let params = {};
@ -197,14 +177,14 @@ export default {
this.$message.error(msg); this.$message.error(msg);
} }
this.hadeleClearForm(this.tableData[index], index); this.hadeleClearForm(this.tableData[index], index);
if (!type) { // if (!type) {
this.tableData[index].itemGroupId = ""; // this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = ""; // this.tableData[index].itemId = "";
this.tableData[index].colKey = ""; // this.tableData[index].colKey = "";
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
} // }
} else if (row.dataSource == "stat") { } else if (row.dataSource == "stat") {
let url = "/governance/policy/item-list/stat"; let url = "/governance/policy/item-list/stat";
let params = {}; let params = {};
@ -215,14 +195,14 @@ export default {
this.$message.error(msg); this.$message.error(msg);
} }
this.hadeleClearForm(this.tableData[index], index); this.hadeleClearForm(this.tableData[index], index);
if (!type) { // if (!type) {
this.tableData[index].itemGroupId = ""; // this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = ""; // this.tableData[index].itemId = "";
this.tableData[index].colKey = ""; // this.tableData[index].colKey = "";
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
} // }
} else { } else {
this.hadeleClearForm(this.tableData[index], index); this.hadeleClearForm(this.tableData[index], index);
this.tableData[index].itemGroupId = ""; this.tableData[index].itemGroupId = "";
@ -238,7 +218,7 @@ export default {
}, },
// //
async handleChangeFieldsType(row, index, type) { async handleChangeFieldsType(row, index) {
console.log(row, index, "字段类别row"); console.log(row, index, "字段类别row");
if (row.dataSource != "resi") return; if (row.dataSource != "resi") return;
const url = "/oper/customize/icformitem/getItemListV2"; const url = "/oper/customize/icformitem/getItemListV2";
@ -247,14 +227,14 @@ export default {
policyFlag: "1", policyFlag: "1",
}; };
this.hadeleClearForm(this.tableData[index], index); this.hadeleClearForm(this.tableData[index], index);
if (!type) { // if (!type) {
this.tableData[index].itemId = ""; // this.tableData[index].itemId = "";
this.tableData[index].colKey = ""; // this.tableData[index].colKey = "";
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
this.tableData[index].itemIdOpction = []; // this.tableData[index].itemIdOpction = [];
} // }
let { data, code, msg } = await requestPost(url, params); let { data, code, msg } = await requestPost(url, params);
if (code == 0) { if (code == 0) {
this.$set(this.tableData[index], "itemIdOpction", data); this.$set(this.tableData[index], "itemIdOpction", data);
@ -264,7 +244,7 @@ export default {
} }
}, },
// //
async handleChangeFieldsName(row, index, type) { async handleChangeFieldsName(row, index) {
console.log(row, "字段名称row"); console.log(row, "字段名称row");
var arr = []; var arr = [];
// colKeycolumnName // colKeycolumnName
@ -272,22 +252,22 @@ export default {
arr = row.itemIdOpction.filter((item) => item.colKey == row.itemId); arr = row.itemIdOpction.filter((item) => item.colKey == row.itemId);
this.tableData[index].tableName = arr[0].tableName; this.tableData[index].tableName = arr[0].tableName;
this.tableData[index].colKey = arr[0].colKey; this.tableData[index].colKey = arr[0].colKey;
if (!type) { // if (!type) {
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
} // }
// this.tableData[index].colVal = '' // this.tableData[index].colVal = ''
// this.tableData[index].queryType = '' // this.tableData[index].queryType = ''
} else if (row.dataSource == "resi" && row.itemId != "") { } else if (row.dataSource == "resi" && row.itemId != "") {
arr = row.itemIdOpction.filter((item) => item.itemId == row.itemId); arr = row.itemIdOpction.filter((item) => item.itemId == row.itemId);
this.tableData[index].tableName = arr[0].tableName; this.tableData[index].tableName = arr[0].tableName;
this.tableData[index].colKey = arr[0].columnName; this.tableData[index].colKey = arr[0].columnName;
if (!type) { // if (!type) {
this.tableData[index].colVal = ""; // this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = ""; // this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = ""; // this.tableData[index].queryType = "";
} // }
// this.tableData[index].colVal = '' // this.tableData[index].colVal = ''
// this.tableData[index].queryType = '' // this.tableData[index].queryType = ''
} }
@ -348,36 +328,26 @@ export default {
}; };
this.$set(this.tableData, index, obj); this.$set(this.tableData, index, obj);
}, },
async getFormEdit(id) {
const url = `/governance/resiSearchTag/listResiSearchRulesByTagId?tagId=${id}`;
let { code, msg, data } = await requestGet(url);
if (code == 0) {
console.log(data, "获取到的详情信息");
this.tableData = data;
} else if (code >= 8000) {
this.$message.error(msg);
}
},
async handleComfirm() { async handleComfirm() {
let messageObj = {}; let messageObj = {};
messageObj = this.validateRule(this.tableData); messageObj = this.validateRule(this.tableData);
if (messageObj) { if (messageObj) {
this.$message.error(messageObj); this.$message.error(messageObj);
return; return;
} }
for (let i in this.tableData) { for (let i in this.tableData) {
for (let j in this.tableData[i]) { for (let j in this.tableData[i]) {
if ( if (
typeof this.tableData[i][j] != "string" && typeof this.tableData[i][j] != "string" &&
typeof this.tableData[i][j] != "number" typeof this.tableData[i][j] != "number"
) { ) {
this.$delete(this.tableData[i], j); this.$delete(this.tableData[i], j);
}
} }
} }
this.$emit("dialogOk", this.tableData); }
this.$emit("dialogOk", this.tableData);
// this.addSubmit(); // this.addSubmit();
}, },
handleCancle() { handleCancle() {
this.$emit("dialogCancle"); this.$emit("dialogCancle");
@ -441,7 +411,7 @@ export default {
obj.itemId = ""; obj.itemId = "";
obj.queryType = ""; obj.queryType = "";
obj.colVal = ""; obj.colVal = "";
obj.nextLogicalRel = ""; obj.nextLogicalRel = "and";
obj.itemIdOpction = []; obj.itemIdOpction = [];
this.tableData.push(obj); this.tableData.push(obj);
}, },
@ -454,7 +424,12 @@ export default {
this.tableData[index].queryType = ""; this.tableData[index].queryType = "";
}, },
}, },
props: {}, props: {
rulesData: {
type: Array,
default: () => []
}
},
computed: {}, computed: {},
watch: {}, watch: {},
}; };

Loading…
Cancel
Save