Browse Source

新增/搜索

V1.0
马魁 3 years ago
parent
commit
61b2778d4d
  1. 14
      src/views/components/resiForm.vue
  2. 267
      src/views/components/resiSearch.vue
  3. 19
      src/views/modules/base/resi.vue

14
src/views/components/resiForm.vue

@ -1152,10 +1152,16 @@ export default {
methods: {
submit_from(){
return this.form
// this.$refs.formId.validate(v=>{
// this.validateFlag = v
// })
var flag = false
this.$refs.formId.validate(v=>{
this.validateFlag = v
flag = v
})
if(flag){
return this.form
}
return this.form
},
getAllNation(){

267
src/views/components/resiSearch.vue

@ -2,63 +2,84 @@
<div class="resi-container">
<!-- <el-card class="resi-card"> -->
<div class="g-main">
<el-form :inline="true" class="header_form_box" v-for="(item, index) in sliceList(itemList, 4)"
:class="boxHeight ? 'm-form-box-height-auto' : 'm-form-box-height'" :key="index">
<el-form-item v-for="n in item" :key="n.id">
<div class="resi-cell">
<div style="width:100px;text-align: right;padding-right:14px ;">{{ n.label }}:</div>
<div class="resi-cell-value" :class="n.itemType === 'radio' && 'resi-cell-value-radio'">
<el-input v-if="n.itemType === 'input' || n.itemType === 'textarea'" v-model.trim="form[n.columnName]"
class="u-item-width-normal" size="small" clearable placeholder="请输入内容">
</el-input>
<template v-else-if="n.itemType == 'inputRange'">
<!-- <el-input
v-model.trim="form[n.columnName]"
class="resi-cell-input"
<el-form :inline="true" class="header_form_box" :model="form" :label-width="'100px'">
<el-form-item label="居民姓名" >
<el-input v-model="form.name" placeholder="请输入" size="small" class="u-item-width-normal" clearable ></el-input>
</el-form-item>
<el-form-item label="联系电话" >
<el-input v-model="form.mobile" size="small" placeholder="请输入" class="u-item-width-normal" clearable ></el-input>
</el-form-item>
<el-form-item label="证件号" >
<el-input v-model="form.idNum" size="small" placeholder="请输入" class="u-item-width-normal" clearable ></el-input>
</el-form-item>
<el-form-item label="居民性别" >
<el-select v-model="form.gender" class="u-item-width-normal" clearable size="small">
<el-option label='男' value='1'> </el-option>
<el-option label='女' value='2'> </el-option>
</el-select>
</el-form-item>
<el-form-item label="出生日期" >
<el-date-picker
v-model="form.birthdayStart"
type="date"
size="small"
clearable
placeholder="请输入内容"
/> -->
<inputRange style="height:37px;" v-model="form[n.columnName]" :type="n.validType" @change="handleAgeChange" />
</template>
<template v-else-if="n.itemType === 'datepicker'">
<el-date-picker v-if="n.queryType === 'daterange'" v-model.trim="timer.startPickerTime"
:picker-options="startPickerOptions" type="date" align="right" unlink-panels placeholder="开始时间"
class="u-item-width-daterange" style="margin-right:34px;" size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
</el-date-picker>
<el-date-picker v-if="n.queryType === 'daterange'" v-model.trim="timer.endPickerTime"
:picker-options="endPickerOptions" class="u-item-width-daterange data-tag" size="small" type="date"
value-format="yyyy-MM-dd" value="yyyy-MM-dd" placeholder="结束时间">
</el-date-picker>
<el-date-picker v-else v-model.trim="form[n.columnName]" class="resi-cell-input" type="inputRange"
size="small" clearable format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择日期">
</el-date-picker>
</template>
<el-select v-else-if="n.itemType === 'select' || n.itemType === 'radio'" v-model.trim="form[n.columnName]"
placeholder="请选择" size="small" clearable class="u-item-width-normal"
:collapse-tags="n.multiSelect == 1 ? true : false" :multiple="n.multiSelect == 1 ? true : false">
<el-option v-for="item in n.options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
class="u-item-width-daterange"
placeholder="开始日期">
</el-date-picker>
<span class="u-data-tag"></span>
<el-date-picker
v-model="form.birthdayEnd"
type="date"
size="small"
class="u-item-width-daterange u-data-tag"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="居民年龄" >
<el-input v-model="form.ageStart" class="u-item-width-normal" placeholder="请输入" clearable size="small">
</el-input>
</el-form-item>
<el-form-item label="文化程度" >
<el-select v-model="form.cultureLevel" class="u-item-width-normal" clearable size="small">
<template v-for="item in Education" >
<el-option :label='item.label' :value='item.value'> </el-option>
</template>
</el-select>
<el-cascader v-else-if="n.itemType === 'cascader'" v-model.trim="form[n.columnName]" :options="n.options"
:props="{ checkStrictly: true }" clearable size="small" class="resi-cell-select">
</el-cascader>
<template v-else-if="n.itemType === 'checkbox'">
<el-checkbox-group v-model="form[n.columnName]">
<el-checkbox v-for="ns in n.options" :key="ns.value" :label="ns.value">{{ ns.label }}</el-checkbox>
</el-checkbox-group>
</template>
</div>
</div>
</el-form-item>
<el-form-item prop="agencyIdArray">
</el-form-item>
<el-form-item label="本地户籍" >
<el-select v-model="form.localResidenceFlag" class="u-item-width-normal" clearable size="small">
<el-option label='是' value='1'> </el-option>
<el-option label='否' value='0'> </el-option>
</el-select>
</el-form-item>
<el-form-item label="居民类别">
<el-select v-model="form.categoryKey" collapse-tags multiple class="u-item-width-normal" clearable size="small">
<template v-for="item in resiClass" >
<el-option :label='item.label' :value='item.value'> </el-option>
</template>
</el-select>
</el-form-item>
<el-form-item label="人户状况" >
<el-select v-model="form.householdSituation" class="u-item-width-normal" clearable size="small">
<template v-for="item in household" >
<el-option :label='item.label' :value='item.value'> </el-option>
</template>
</el-select>
</el-form-item>
<el-form-item label="民族" >
<el-select v-model="form.nation" class="u-item-width-normal" clearable size="small">
<template v-for="item in nation" >
<el-option :label='item.label' :value='item.value'> </el-option>
</template>
</el-select>
</el-form-item>
<el-form-item prop="agencyIdArray">
<span style="width:100px;text-align: right;padding-right:14px;display: inline-block; " >所属组织:</span>
<el-cascader class="u-item-width-normal" ref="myCascader" v-model="agencyIdArray" :options="orgOptions"
<el-cascader class="u-item-width-normal" size="small" ref="myCascader" v-model="agencyIdArray" :options="orgOptions"
:props="orgOptionProps" :show-all-levels="false" @change="handleChangeAgency"></el-cascader>
</el-form-item>
<el-form-item prop="VILLAGE_ID" >
<div class="resi-cell">
<div class="resi-cell-value">
@ -88,7 +109,9 @@
</div>
</div>
</el-form-item>
<el-form-item label="备注" >
<el-input v-model="form.remark" placeholder="请输入" size="small" class="u-item-width-normal" clearable ></el-input>
</el-form-item>
</el-form>
</div>
@ -104,7 +127,7 @@
<smart-search-rule ref="ref_rule" :formType="formType"></smart-search-rule>
</el-col>
</el-row>
<el-row v-if="isArrow" class="resi-search">
<!-- <el-row v-if="isArrow" class="resi-search">
<el-col :span="24">
<el-button type="primary" size="small" plain class="diy-button--blue"
@ -116,7 +139,7 @@
@click="boxHeight = !boxHeight">{{ boxHeight ? '收起' : '展开' }}<i
:class="boxHeight ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i></el-button>
</el-col>
</el-row>
</el-row> -->
</div>
</template>
@ -185,7 +208,26 @@ export default {
}
})
let constForm = {
...form,
name:'',
mobile:'',
idNum:'',
birthdayStart:'',
birthdayEnd:'',
ageStart:'',
ageEnd:'',
gender:'',
cultureLevel:'',
localResidenceFlag:'',
householdSituation:'',
nation:'',
agencyId:'',
buildId:'',
homeId:'',
unitId:'',
gridId:'',
villageId:'',
categoryKey:[],
remark:'',
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
@ -228,20 +270,16 @@ export default {
agencyIdArray: [],
value: '',
// 1
Education:[],
nation:[],
household:[],
resiClass:[],
itemList,
fixedList: [],
fixedForm: {
AGENCY_ID: '',
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
UNIT_ID: '',
HOME_ID: ''
},
constForm,
form: {
...form,
AGENCY_ID: '',
agencyId : '',
GRID_ID: '',
VILLAGE_ID: '',
BUILD_ID: '',
@ -282,7 +320,7 @@ export default {
},
queryType: {
'AGENCY_ID': 'like'
'agencyId ': 'like'
},
showSmartSearchForm: false,
@ -447,7 +485,11 @@ export default {
// console.log('formcccc---', this.form)
this.getOrgTreeList()
this.getGridList()
this.getEducation()
this.getValiheList()
this.getDictList()
this.getHousehold()
this.getResident()
if (this.columnName) this.handleChangeForm(this.columnName)
},
methods: {
@ -577,14 +619,14 @@ export default {
if (obj) {
if (obj.level === 'grid') {
this.form.GRID_ID = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.form.AGENCY_ID = ''
this.form.agencyId = ''
} else {
this.form.AGENCY_ID = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.form.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.form.GRID_ID = ''
}
} else {
this.form.AGENCY_ID = ''
this.form.agencyId = ''
this.form.GRID_ID = ''
}
@ -661,7 +703,6 @@ export default {
})
},
getOrgTreeList() {
const { user } = this.$store.state
this.$http
.post('/gov/org/customeragency/agencygridtree', {})
.then(({ data: res }) => {
@ -677,28 +718,28 @@ export default {
return this.$message.error('网络错误')
})
},
getGridList() {
const { user } = this.$store.state
this.$http
.post('/gov/org/customergrid/gridoption', { agencyId: user.agencyId, purpose: 'query' })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsG = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getGridList () {
const { user } = this.$store.state
this.$http
.post('/gov/org/customergrid/gridoption', { agencyId: user.agencyId, purpose: 'addorupdate' })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsG = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getValiheList() {
const { user } = this.$store.state
this.$http
.post('/gov/org/icneighborhood/neighborhoodoption', {
gridId: this.form.GRID_ID,
agencyId: this.form.AGENCY_ID,
agencyId: this.form.agencyId ,
// agencyId: user.agencyId
})
.then(({ data: res }) => {
@ -762,6 +803,58 @@ export default {
return this.$message.error('网络错误')
})
},
getTreeData (data) {
if (!Array.isArray(data)) return [];
let arr = data.map((item) => {
let _item = {};
if (item.children) {
if (item.children.length === 0)
_item = { ...item, children: undefined };
else _item = { ...item, children: this.getTreeData(item.children) };
} else {
_item = { ...item };
}
return _item;
});
return arr;
},
async getEducation(){
try {
let { data } = await this.$http.post('sys/dict/data/education',{formCode: "resi_base_info"})
data.data = this.getTreeData(data.data)
this.Education = data.data
console.log(this.Education);
} catch (error) {
console.log(error,'获取民族字典');
}
},
async getDictList(){
try {
const { data } = await this.$http.post('sys/dict/data/nation',{formCode: "resi_base_info"})
this.nation = data.data
} catch (error) {
console.log(error,'获取民族字典');
}
},
async getHousehold(){
try {
const { data } = await this.$http.post('sys/dict/data/dictlist', {'dictType':'household_situation'})
this.household = data.data
} catch (error) {
console.log(error,'获取人户状况字典');
}
},
async getResident(){
try {
const { data } = await this.$http.post('sys/dict/data/dictlist', {'dictType':'resident_category'})
this.resiClass = data.data
} catch (error) {
console.log(error,'获取配偶情况字典');
}
},
computedBirth(age) {
let now = new Date();
let nowYear = now.getFullYear();

19
src/views/modules/base/resi.vue

@ -39,6 +39,21 @@
<img v-else
src="../../../assets/img/arrow-down.png" />
</div> -->
<resi-search ref="myResiSearch" />
<el-row class="resi-search">
<el-col :span="24">
<el-button size="small"
class="diy-button--blue"
@click="handleSearchFrom">查询</el-button>
<!-- -->
<el-button style="margin-left:10px"
size="small"
class="diy-button--white"
@click="">重置</el-button>
<!-- resetSearchForm -->
</el-col>
</el-row>
</div>
<div class="m-table">
@ -668,7 +683,9 @@ export default {
},
});
},
handleSearchFrom(){
console.log(this.$refs.myResiSearch.form);
},
//
checkSelectable(row, index) {
return this.filterEdit(row.agencyId);

Loading…
Cancel
Save