Browse Source

智能查询简单逻辑接口传参

feature
mk 2 years ago
parent
commit
0e8467c36c
  1. 15
      src/views/modules/communityService/labelConfig/addForm.vue
  2. 473
      src/views/modules/shequ/chaxun.vue
  3. 483
      src/views/modules/shequ/cpts/smatr-rules.vue

15
src/views/modules/communityService/labelConfig/addForm.vue

@ -7,19 +7,6 @@
class="div_form" class="div_form"
:rules="rules" :rules="rules"
> >
<!-- <el-form-item
label="标签名称"
label-width="100px"
prop="tagName"
v-if="!infoType"
>
<el-input
v-model="formData.tagName"
placeholder="请输入内容"
clearable
></el-input>
</el-form-item> -->
<!-- -------------------------------------------------------------------------------------------------------------------------------- -->
<el-form-item label="标签名称" label-width="100px" prop="tagName"> <el-form-item label="标签名称" label-width="100px" prop="tagName">
<el-autocomplete <el-autocomplete
v-model="formData.tagName" v-model="formData.tagName"
@ -674,7 +661,7 @@ export default {
return message; return message;
}, },
handleClickAddRow() { handleClickAddRow() {
if (this.tableData == undefined||this.tableData.length>1) this.tableData = []; if (this.tableData === undefined) this.tableData = [];
let obj = {}; let obj = {};
obj.dataSource = ""; obj.dataSource = "";
obj.itemGroupId = ""; obj.itemGroupId = "";

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

@ -3,20 +3,14 @@
<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>社区查询</span> <span>{{smatrFlag?'智能查询':'社区查询'}}</span>
</div> </div>
<div class="tabs"> <div class="tabs">
<div <div :class="searchData.type == 'jumin' ? 'z-on' : ''" @click="handelClickTab('jumin')">
:class="searchData.type == 'jumin'?'z-on':''"
@click="handelClickTab('jumin')"
>
查居民 查居民
</div> </div>
<div <div :class="searchData.type == 'fangwu' ? 'z-on' : ''" @click="handelClickTab('fangwu')">
:class="searchData.type == 'fangwu'?'z-on':''"
@click="handelClickTab('fangwu')"
>
查房屋 查房屋
</div> </div>
</div> </div>
@ -24,66 +18,39 @@
<div class="search"> <div class="search">
<div class="search-input"> <div class="search-input">
<div class="input"> <div class="input">
<input <input type="text" :placeholder="typePlaceholder[searchData.type]" v-model="searchData.searchKey"
type="text" @keyup.enter="handleClickSearchBtn" />
:placeholder="typePlaceholder[searchData.type]" <div class="close-btn" v-if="searchData.searchKey != ''" @click="searchData.searchKey = ''">
v-model="searchData.searchKey"
@keyup.enter="handleClickSearchBtn"
/>
<div
class="close-btn"
v-if="searchData.searchKey != ''"
@click="searchData.searchKey = ''"
>
<img src="@/assets/img/shequ/close.png" /> <img src="@/assets/img/shequ/close.png" />
</div> </div>
</div> </div>
<div class="btn" @click="handleClickSearchBtn">查一下</div> <div class="btn" @click="handleClickSearchBtn">查一下</div>
</div> </div>
<div class="btn2" @click="handleClickSearchBtn"> <div class="btn2" @click="handleClickSmartSearchBtn">
<img src="@/assets/images/index/i-search.png" /> <img src="@/assets/images/index/i-search.png" />
智能查询 {{ smatrFlag ? '关闭智能查询' : '智能查询' }}
</div> </div>
</div> </div>
<p v-show="smatrFlag && searchStatus == 'ing'" class="rules_box">
已显示{{ searchData.type == 'fangwu' ? '房屋' : '居民' }}状态为{{ keyWordStr }}的搜索结果如不满足需求 <el-button type="text"
@click="handleClickEditRules">请点击此处调整</el-button>
</p>
</div> </div>
</div> </div>
<div class="m-box" v-if="searchStatus == 'ing'"> <div class="m-box" v-if="searchStatus == 'ing'">
<div <div class="m-tb" v-if="searchData.type == 'jumin' &&
class="m-tb"
v-if="
searchData.type == 'jumin' &&
searchData.searchKey != '' && searchData.searchKey != '' &&
searchStatus == 'ing' searchStatus == 'ing'
" ">
>
<div class="tb"> <div class="tb">
<el-table <el-table class="m-table" v-loading="searchJumin.loading" :data="searchJumin.list" border style="width: 100%"
class="m-table" :max-height="1000">
v-loading="searchJumin.loading" <el-table-column label="序号" type="index" align="center" width="50" />
:data="searchJumin.list" <el-table-column v-for="item in searchJumin.header" :key="item.columnName" :prop="item.columnName"
border :label="item.label" align="center" :show-overflow-tooltip="true" :width="item.itemType === 'radio' ? computedWidth(item.label) : 180
style="width: 100%" ">
:max-height="1000"
>
<el-table-column
label="序号"
type="index"
align="center"
width="50"
/>
<el-table-column
v-for="item in searchJumin.header"
:key="item.columnName"
:prop="item.columnName"
:label="item.label"
align="center"
:show-overflow-tooltip="true"
:width="
item.itemType === 'radio' ? computedWidth(item.label) : 180
"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ handleFilterSpan(scope.row, item) }}</span> <span>{{ handleFilterSpan(scope.row, item) }}</span>
</template> </template>
@ -213,55 +180,30 @@
<el-table-column fixed="right" label="操作" align="center"> <el-table-column fixed="right" label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button class="f-fc" @click="handleWatchSearchJumin(scope.$index)" type="text"
class="f-fc" size="small">查看</el-button>
@click="handleWatchSearchJumin(scope.$index)"
type="text"
size="small"
>查看</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div> <div>
<el-pagination <el-pagination @size-change="handleSizeChangeSearchJumin" @current-change="handleCurrentChangeSearchJumin"
@size-change="handleSizeChangeSearchJumin" :current-page.sync="searchJumin.pageNo" :page-sizes="[20, 50, 100, 200]"
@current-change="handleCurrentChangeSearchJumin" :page-size="parseInt(searchJumin.pageSize)" layout="sizes, prev, pager, next, total"
:current-page.sync="searchJumin.pageNo" :total="searchJumin.total">
:page-sizes="[20, 50, 100, 200]"
:page-size="parseInt(searchJumin.pageSize)"
layout="sizes, prev, pager, next, total"
:total="searchJumin.total"
>
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div> </div>
<div <div class="m-tb" v-if="searchData.type == 'fangwu' &&
class="m-tb"
v-if="
searchData.type == 'fangwu' &&
searchData.searchKey != '' && searchData.searchKey != '' &&
searchStatus == 'ing' searchStatus == 'ing'
" ">
>
<div class="tb"> <div class="tb">
<el-table <el-table class="m-table" :data="searchFangwu.list" v-loading="searchFangwu.loading" border :max-height="1000"
class="m-table" style="width: 100%">
:data="searchFangwu.list" <el-table-column label="序号" type="index" align="center" width="50" />
v-loading="searchFangwu.loading"
border
:max-height="1000"
style="width: 100%"
>
<el-table-column
label="序号"
type="index"
align="center"
width="50"
/>
<el-table-column prop="houseName" label="房屋名称" width="120"> <el-table-column prop="houseName" label="房屋名称" width="120">
</el-table-column> </el-table-column>
<el-table-column prop="quartersName" label="所属小区" width="160"> <el-table-column prop="quartersName" label="所属小区" width="160">
@ -281,51 +223,32 @@
</el-table-column> </el-table-column>
<el-table-column prop="ownerIdCard" label="证件号" width="170"> <el-table-column prop="ownerIdCard" label="证件号" width="170">
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="操作" fixed="right" header-align="center" align="center" class="operate">
label="操作"
fixed="right"
header-align="center"
align="center"
class="operate"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button class="f-fc" type="text" size="small"
class="f-fc" @click="handleWatchSearchFangwu(scope.$index)">查看</el-button>
type="text"
size="small"
@click="handleWatchSearchFangwu(scope.$index)"
>查看</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div> <div>
<el-pagination <el-pagination @size-change="handleSizeChangeSearchFangwu" @current-change="handleCurrentChangeSearchFangwu"
@size-change="handleSizeChangeSearchFangwu" :current-page.sync="searchFangwu.pageNo" :page-sizes="[20, 50, 100, 200]"
@current-change="handleCurrentChangeSearchFangwu" :page-size="parseInt(searchFangwu.pageSize)" layout="sizes, prev, pager, next" :total="searchFangwu.total">
:current-page.sync="searchFangwu.pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="parseInt(searchFangwu.pageSize)"
layout="sizes, prev, pager, next"
:total="searchFangwu.total"
>
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<resi-info <resi-info v-if="showedResiInfo && currentResiId" :resi-id="currentResiId" @close="showedResiInfo = false" />
v-if="showedResiInfo && currentResiId" <house-info v-if="showedHouseInfo && currentHouseId" :house-id="currentHouseId" @close="showedHouseInfo = false" />
:resi-id="currentResiId"
@close="showedResiInfo = false"
/>
<house-info <el-dialog v-if="showSmatrForm" :visible.sync="showSmatrForm" :append-to-body="true" :close-on-click-modal="false"
v-if="showedHouseInfo && currentHouseId" :close-on-press-escape="false" :title="'修改条件'" width="880px" top="5vh" class="dialog-h"
:house-id="currentHouseId" @closed="showSmatrForm = false">
@close="showedHouseInfo = false" <smatr-rules @dialogCancle="dialogCancle" @dialogOk="dialogOk">
/> </smatr-rules>
</el-dialog>
</div> </div>
</template> </template>
@ -336,11 +259,12 @@ import nextTick from "dai-js/tools/nextTick";
import getQueryPara from "dai-js/modules/getQueryPara"; 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";
export default { export default {
components: { components: {
resiInfo, resiInfo,
houseInfo, houseInfo,
smatrRules
}, },
props: { props: {
@ -430,253 +354,7 @@ export default {
width: 110, width: 110,
options: [], options: [],
}, },
// {
// itemId: "20220422102809_1011",
// label: "",
// columnName: "remark",
// itemType: "textarea",
// width: 110,
// options: [],
// },
// {
// itemId: "20220422102809_1012",
// label: "",
// columnName: "resiClass",
// itemType: "textarea",
// width: 110,
// options: [],
// },
// {
// itemId: "20220422102809_1015",
// label: "",
// columnName: "partyFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1016",
// label: "",
// columnName: "subsistenceAllowanceFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1017",
// label: "",
// columnName: "ensureHouseFlag",
// itemType: "radio",
// width: 100,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1018",
// label: "",
// columnName: "unemployedFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1019",
// label: "",
// columnName: "fertileWomanFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1020",
// label: "退",
// columnName: "veteranFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1021",
// label: "",
// columnName: "unitedFrontFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1022",
// label: "访",
// columnName: "petitionOfficerFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1023",
// label: "",
// columnName: "volunteerFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1024",
// label: "",
// columnName: "oldPeopleFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1025",
// label: "",
// columnName: "emptyNesterFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1026",
// label: "",
// columnName: "bereavedPersonFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1027",
// label: "",
// columnName: "disabledFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1028",
// label: "",
// columnName: "dementedFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1029",
// label: "",
// columnName: "disabilityFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1030",
// label: "",
// columnName: "seriousIllnessFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_1031",
// label: "",
// columnName: "chronicDiseaseFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_10310",
// label: "",
// columnName: "specialCrowdFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_202204141504102",
// label: "",
// columnName: "floatingFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "20220422102809_202204141504101",
// label: "",
// columnName: "tenantFlag",
// itemType: "radio",
// width: 80,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
// {
// itemId: "202208111008491",
// label: "",
// columnName: "liveAloneFlag",
// itemType: "radio",
// width: 100,
// options: [
// { label: "", value: "1" },
// { label: "", value: "0" },
// ],
// },
], ],
pageNo: 1, pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20, pageSize: window.localStorage.getItem("pageSize") || 20,
@ -692,6 +370,7 @@ export default {
list: [], list: [],
}, },
// //
showedResiInfo: false, showedResiInfo: false,
@ -702,6 +381,12 @@ export default {
currentHouseId: "", currentHouseId: "",
currentPage: "chaxun", // , currentPage: "chaxun", // ,
smatrFlag: false,
keyWordStr: '',
showSmatrForm: false,
rulesData : []
}; };
}, },
computed: { computed: {
@ -734,7 +419,10 @@ export default {
this.searchData.type = localStorage.getItem('homeSearchType') || '' this.searchData.type = localStorage.getItem('homeSearchType') || ''
this.handleClickSearchBtn(); this.handleClickSearchBtn();
}, },
//
handleClickEditRules() {
this.showSmatrForm = true
},
computedWidth(label) { computedWidth(label) {
const wd = 20 * label.length; const wd = 20 * label.length;
return wd > 80 ? wd : 80; return wd > 80 ? wd : 80;
@ -747,10 +435,10 @@ export default {
}); });
} }
if(row.mobile == '' || row.mobile == '--'){ if (row.mobile != ''&&row.mobile) {
row.mobile = ""
}else{
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 == '--'){
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];
@ -763,6 +451,7 @@ export default {
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.$message.error("请输入搜索条件");
this.keyWordStr = searchKey
if (type == "jumin") { if (type == "jumin") {
this.searchJumin.pageNo = 1; this.searchJumin.pageNo = 1;
this.searchJumin.total = 0; this.searchJumin.total = 0;
@ -771,14 +460,14 @@ export default {
this.searchFangwu.pageNo = 1; this.searchFangwu.pageNo = 1;
this.searchFangwu.total = 0; this.searchFangwu.total = 0;
this.getSearchFangwu(); this.getSearchFangwu();
} else if (type == "xuqiu") {
this.searchXuqiu.pageNo = 1;
this.searchXuqiu.total = 0;
this.getSearchXuqiu();
} }
this.searchStatus = "ing"; this.searchStatus = "ing";
}, },
handleClickSmartSearchBtn() {
this.smatrFlag = !this.smatrFlag
this.searchData.searchKey = ''
},
handleSizeChangeSearchJumin(val) { handleSizeChangeSearchJumin(val) {
console.log(`每页 ${val}`); console.log(`每页 ${val}`);
this.searchJumin.pageSize = val; this.searchJumin.pageSize = val;
@ -829,6 +518,7 @@ export default {
searchKey, searchKey,
pageSize, pageSize,
pageNo, pageNo,
smartSearchRules:this.rulesData
}); });
this.searchJumin.loading = false; this.searchJumin.loading = false;
if (code === 0) { if (code === 0) {
@ -855,6 +545,7 @@ export default {
searchKey, searchKey,
pageSize, pageSize,
pageNo, pageNo,
smartSearchRules:this.rulesData
}); });
this.searchFangwu.loading = false; this.searchFangwu.loading = false;
if (code === 0) { if (code === 0) {
@ -895,6 +586,16 @@ export default {
this.handleClickSearchBtn() this.handleClickSearchBtn()
// this.searchData.searchKey = '' // this.searchData.searchKey = ''
},
dialogCancle(){
this.showSmatrForm = false
},
dialogOk(rulesData){
this.showSmatrForm = false
if(rulesData){
this.rulesData = rulesData || null
this.handleClickSearchBtn()
}
} }
}, },
destroyed() { destroyed() {
@ -923,6 +624,7 @@ export default {
max-height: 83vh; max-height: 83vh;
box-sizing: border-box; box-sizing: border-box;
padding: 0 0 20px !important; padding: 0 0 20px !important;
.dialog-h-content { .dialog-h-content {
max-height: calc(83vh - 80px); max-height: calc(83vh - 80px);
box-sizing: border-box; box-sizing: border-box;
@ -960,6 +662,7 @@ export default {
margin: 24px auto 0; margin: 24px auto 0;
display: flex; display: flex;
align-items: center; align-items: center;
>div { >div {
position: relative; position: relative;
margin-right: 30px; margin-right: 30px;
@ -975,6 +678,7 @@ export default {
&:hover { &:hover {
color: $c1_on; color: $c1_on;
} }
&.z-on { &.z-on {
color: #ffffff; color: #ffffff;
background: #0056d6; background: #0056d6;
@ -982,6 +686,7 @@ export default {
&:hover { &:hover {
color: #ffffff; color: #ffffff;
} }
// &::after { // &::after {
// content: ""; // content: "";
// display: block; // display: block;
@ -1075,7 +780,7 @@ export default {
.btn2 { .btn2 {
margin-left: 35px; margin-left: 35px;
width: 100px; width: 150px;
height: 39px; height: 39px;
line-height: 39px; line-height: 39px;
border-radius: 6px; border-radius: 6px;
@ -1085,6 +790,7 @@ export default {
font-weight: 500; font-weight: 500;
color: #0056d6; color: #0056d6;
cursor: pointer; cursor: pointer;
img { img {
width: 20px; width: 20px;
height: 20px; height: 20px;
@ -1096,5 +802,10 @@ export default {
} }
} }
} }
.rules_box {
width: 692px;
margin: 15px auto 0;
}
} }
</style> </style>

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

@ -0,0 +1,483 @@
<template>
<div class="my_form">
<el-table border :data="tableData" style="width: 100%" height="200">
<el-table-column label="选择数据源" align="center" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.dataSource" placeholder="请选择"
@change="handleChangeSource(scope.row, scope.$index)" clearable>
<el-option v-for="item in dataSourceOpction" :label="item.label" :value="item.value"
:key="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="字段类别" align="center" width="120">
<template slot-scope="scope" v-if="scope.row.dataSource == 'resi'">
<el-select v-model="scope.row.itemGroupId" placeholder="请选择" clearable
@change="handleChangeFieldsType(scope.row, scope.$index)">
<el-option v-for="item in scope.row.itemGroupIdOpction" :label="item.label" :value="item.id"
:key="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="字段名称" align="center" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.itemId" placeholder="请选择"
@change="handleChangeFieldsName(scope.row, scope.$index)"
@clear="handleClearItemId(scope.row, scope.$index)" clearable>
<el-option v-for="item in scope.row.itemIdOpction" :label="item.label" :value="scope.row.dataSource == 'resi' ? item.itemId : item.colKey
" :key="scope.row.dataSource == 'resi' ? item.itemId : item.colKey">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="比较符" align="center" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.queryType" placeholder="请选择" clearable>
<el-option v-for="item in queryTypeOpction" :label="item.label" :value="item.value"
:key="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="对应值" width="120" align="center">
<template slot-scope="scope">
<template v-for="item in scope.row.correspondingOpction">
<el-select v-if="item.itemType == 'select' ||
item.itemType == 'radio' ||
item.itemType == 'checkbox'
" v-model="scope.row.colVal" placeholder="请选择" clearable>
<el-option v-for="items in item.options" :label="items.label" :value="items.value"
:key="items.label">
</el-option>
</el-select>
<el-input v-else-if="item.itemType === 'input' || item.itemType === 'textarea'
" v-model="scope.row.colVal" placeholder="请输入" clearable>
</el-input>
<el-input-number v-else-if="item.itemType === 'inputNum'" class="item_width_2"
v-model="scope.row.colVal" :min="0" size="mini" label="请输入"></el-input-number>
<el-date-picker v-else-if="item.itemType === 'datepicker' || item.itemType === 'date'
" v-model="scope.row.colVal" class="item_width_2" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd HH:mm:ss" placeholder="开始时间">
</el-date-picker>
<el-input v-else class="item_width_2" size="mini" placeholder="请输入" v-model="personItem.colVal">
</el-input>
</template>
</template>
</el-table-column>
<el-table-column label="条件关系" align="center" width="100">
<template slot-scope="scope" v-if="scope.$index != tableData.length - 1">
<el-select v-model="scope.row.nextLogicalRel" placeholder="请选择" clearable>
<el-option v-for="item in nextLogicalRelOpction" :label="item.label" :value="item.value"
:key="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button type="primary" @click="handleClickAddRow" v-if="scope.$index == tableData.length - 1"
size="small" icon="el-icon-plus" circle></el-button>
<el-button type="danger" @click="handleClickDelete(scope.$index)"
v-if="scope.$index != tableData.length - 1 || (tableData.length - 1 >= 1 && scope.$index != '0')"
size="small" icon="el-icon-minus" circle> </el-button>
</template>
</el-table-column>
</el-table>
<div class="div_btn">
<el-button size="small" @click="handleCancle"> </el-button>
<el-button size="small" type="primary" @click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { requestPost, requestGet } from "@/js/dai/request";
export default {
data() {
return {
timeout: null,
tagObj: {},
searchList: [],
tableData: [
{
dataSource: "", //
itemGroupId: "", //
itemId: "", //
queryType: "", //
colVal: "", //
nextLogicalRel: "", //,
tableName: "", //
colKey: "",
itemIdOpction: [],
itemGroupIdOpction: [],
correspondingOpction: [],
},
],
dataSourceOpction: [
{ label: "人员信息", value: "resi" },
{ label: "房屋信息", value: "house" },
],
queryTypeOpction: [{}],
nextLogicalRelOpction: [
{ label: "并且", value: "and" },
{ label: "或者", value: "or" },
],
};
},
created() { },
async mounted() {
await this.getLabelList();
},
methods: {
async initForm(type, row) {
await this.getFormEdit();
for (let i in this.tableData) {
this.handleChangeSource(this.tableData[i], [i], type);
this.handleChangeFieldsType(this.tableData[i], [i], type);
setTimeout(() => {
this.handleChangeFieldsName(this.tableData[i], [i], type);
}, 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) {
console.log(row);
if (row.dataSource == "resi") {
let url = "/oper/customize/icformitemgroup/list";
let params = {
formCode: "resi_base_info",
policyFlag: "1",
};
let { data, code, msg } = await requestPost(url, params);
if (code == 0) {
this.$set(this.tableData[index], "itemGroupIdOpction", data);
console.log(this.tableData[index].itemGroupIdOpction);
} else {
this.$message.error(msg);
}
this.hadeleClearForm(this.tableData[index], index);
if (!type) {
this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = "";
this.tableData[index].colKey = "";
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
this.tableData[index].itemIdOpction = [];
}
} else if (row.dataSource == "house") {
let url = "/governance/policy/item-list/house";
let params = {};
let { data, code, msg } = await requestPost(url, params);
if (code == 0) {
this.tableData[index].itemIdOpction = data;
} else {
this.$message.error(msg);
}
this.hadeleClearForm(this.tableData[index], index);
if (!type) {
this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = "";
this.tableData[index].colKey = "";
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
}
} else if (row.dataSource == "stat") {
let url = "/governance/policy/item-list/stat";
let params = {};
let { data, code, msg } = await requestPost(url, params);
if (code == 0) {
this.tableData[index].itemIdOpction = data;
} else {
this.$message.error(msg);
}
this.hadeleClearForm(this.tableData[index], index);
if (!type) {
this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = "";
this.tableData[index].colKey = "";
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
}
} else {
this.hadeleClearForm(this.tableData[index], index);
this.tableData[index].itemGroupId = "";
this.tableData[index].itemId = "";
this.tableData[index].colKey = "";
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
this.tableData[index].itemIdOpction = [];
}
this.getCompareList();
},
//
async handleChangeFieldsType(row, index, type) {
console.log(row, index, "字段类别row");
if (row.dataSource != "resi") return;
const url = "/oper/customize/icformitem/getItemListV2";
let params = {
groupId: row.itemGroupId,
policyFlag: "1",
};
this.hadeleClearForm(this.tableData[index], index);
if (!type) {
this.tableData[index].itemId = "";
this.tableData[index].colKey = "";
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
this.tableData[index].itemIdOpction = [];
}
let { data, code, msg } = await requestPost(url, params);
if (code == 0) {
this.$set(this.tableData[index], "itemIdOpction", data);
console.log(this.tableData[index].itemIdOpction, "see");
} else {
this.$message.error(msg);
}
},
//
async handleChangeFieldsName(row, index, type) {
console.log(row, "字段名称row");
var arr = [];
// colKeycolumnName
if (row.dataSource == "house" || row.dataSource == "stat") {
arr = row.itemIdOpction.filter((item) => item.colKey == row.itemId);
this.tableData[index].tableName = arr[0].tableName;
this.tableData[index].colKey = arr[0].colKey;
if (!type) {
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
}
// this.tableData[index].colVal = ''
// this.tableData[index].queryType = ''
} else if (row.dataSource == "resi" && row.itemId != "") {
arr = row.itemIdOpction.filter((item) => item.itemId == row.itemId);
this.tableData[index].tableName = arr[0].tableName;
this.tableData[index].colKey = arr[0].columnName;
if (!type) {
this.tableData[index].colVal = "";
this.tableData[index].nextLogicalRel = "";
this.tableData[index].queryType = "";
}
// this.tableData[index].colVal = ''
// this.tableData[index].queryType = ''
}
if (row.itemId == "") return;
// optionoptionSourceType
console.log(arr[0].optionSourceType);
if (arr[0].optionSourceType == "remote") {
let url = "";
let params = {};
if (row.dataSource == "house") {
url = arr[0].optionSourceUrl;
params = JSON.parse(arr[0].optionSourceParam);
} else {
url = arr[0].optionSourceValue;
}
const { data, code, msg } = await requestPost(url, params);
if (code == 0) {
arr[0].options = data;
this.$set(this.tableData[index], "correspondingOpction", arr);
} else {
this.$message.error(msg);
}
} else {
this.$set(this.tableData[index], "correspondingOpction", arr);
}
console.log(this.tableData);
},
async getCompareList() {
const url = "/sys/dict/data/dictlist";
let params = {
dictType: "sql_query_type",
};
let { data, code, msg } = await requestPost(url, params);
if (code == 0) {
this.queryTypeOpction = data;
} else if (code >= 8000) {
this.$message.error(msg);
}
},
//
hadeleClearForm(row, index) {
let obj = {};
obj = {
dataSource: row.dataSource ? row.dataSource : "",
itemId: row.itemId ? row.itemId : "",
queryType: row.queryType ? row.queryType : "",
colVal: row.colVal ? row.colVal : "",
colKey: row.colKey ? row.colKey : "",
nextLogicalRel: row.nextLogicalRel ? row.nextLogicalRel : "",
tableName: row.tableName ? row.tableName : "",
itemGroupId: row.itemGroupId ? row.itemGroupId : "",
itemIdOpction: row.itemIdOpction ? row.itemIdOpction : [],
itemGroupIdOpction: row.itemGroupIdOpction
? row.itemGroupIdOpction
: [],
};
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() {
let messageObj = {};
messageObj = this.validateRule(this.tableData);
if (messageObj) {
this.$message.error(messageObj);
return;
}
for (let i in this.tableData) {
for (let j in this.tableData[i]) {
if (
typeof this.tableData[i][j] != "string" &&
typeof this.tableData[i][j] != "number"
) {
this.$delete(this.tableData[i], j);
}
}
}
this.$emit("dialogOk", this.tableData);
// this.addSubmit();
},
handleCancle() {
this.$emit("dialogCancle");
},
validateRule(tabList) {
console.log(tabList);
let message = "";
tabList.forEach((item, index) => {
if (
(item.itemGroupId === "" && item.dataSource == "resi") ||
item.itemId === "" ||
item.queryType === "" ||
item.colKey === ""
) {
message = `匹配规则${item.dataSource == "resi"
? "人员"
: item.dataSource == "house"
? "房屋"
: item.dataSource == "stat"
? "统计"
: ""
}信息不完整请填写完整 !`;
return message;
}
if (index != this.tableData.length - 1 && item.nextLogicalRel === "") {
message = `匹配规则${item.dataSource == "resi"
? "人员"
: item.dataSource == "house"
? "房屋"
: item.dataSource == "stat"
? "统计"
: ""
}信息不完整请填写完整 !`;
console.log(item);
return message;
}
if (
item.queryType !== "is_null" &&
item.queryType !== "is_not_null" &&
item.colVal === ""
) {
message = `匹配规则${item.dataSource == "resi"
? "人员"
: item.dataSource == "house"
? "房屋"
: item.dataSource == "stat"
? "统计"
: ""
}信息不完整请填写完整 !`;
return message;
}
});
return message;
},
handleClickAddRow() {
if (this.tableData === undefined) this.tableData = [];
let obj = {};
obj.dataSource = "";
obj.itemGroupId = "";
obj.itemId = "";
obj.queryType = "";
obj.colVal = "";
obj.nextLogicalRel = "";
obj.itemIdOpction = [];
this.tableData.push(obj);
},
//
handleClickDelete(index) {
this.tableData.splice(index, 1);
},
handleClearItemId(row, index) {
this.tableData[index].colVal = "";
this.tableData[index].queryType = "";
},
},
props: {},
computed: {},
watch: {},
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/modules/management/list-main.scss";
.imgBtn {
width: 25px;
height: 25px;
margin-top: 3px;
cursor: pointer;
}
.div_btn {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.my_form {
padding: 10px 20px 0;
}
</style>
Loading…
Cancel
Save