Browse Source

飞飞飞

shibei_master
dai 3 years ago
parent
commit
aa4ae983bf
  1. 701
      src/views/modules/base/huji/chusheng/cpts/edit.vue
  2. 38
      src/views/modules/base/huji/chusheng/index.vue

701
src/views/modules/base/huji/chusheng/cpts/edit.vue

@ -4,14 +4,120 @@
<el-form <el-form
ref="ref_form" ref="ref_form"
:inline="true" :inline="true"
:model="dataForm" :model="fmData"
:rules="dataRule" :rules="dataRule"
:disabled="formType === 'detail'" :disabled="formType === 'detail'"
class="form" class="form"
> >
<el-form-item <el-form-item
label="组织名称 " label="所属网格 "
prop="organizationName" prop="gridId"
label-width="150px"
style="display: block"
>
<el-select
v-model.trim="fmData.gridId"
placeholder="请选择"
size="small"
clearable
class="resi-cell-select"
@change="handleChangeGrid"
style="width: 250px"
>
<el-option
v-for="item in optionsG"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="所属房屋 "
prop="homeId"
label-width="150px"
style="display: block"
>
<el-select
v-model.trim="fmData.villageId"
placeholder="请选择小区"
size="small"
clearable
class="resi-cell-select"
@clear="handleClearVillage"
@change="handleChangeV"
style="margin-right: 8px; width: 120px"
>
<el-option
v-for="item in optionsV"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model.trim="fmData.buildId"
placeholder="楼号"
size="small"
clearable
style="margin-right: 8px; width: 120px"
class="resi-cell-select"
:disabled="changeVDisabled"
@clear="handleClearBuild"
@change="handleChangeB"
>
<el-option
v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model.trim="fmData.unitId"
:disabled="changeBDisabled"
placeholder="单元"
size="small"
clearable
style="margin-right: 8px; width: 120px"
class="resi-cell-select"
@click="handleClearDan"
@change="handleChangeD"
>
<el-option
v-for="item in optionsD"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-model.trim="fmData.homeId"
:disabled="changeDDisabled"
placeholder="房号"
size="small"
clearable
style="width: 120px"
class="resi-cell-select"
>
<el-option
v-for="item in optionsH"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="姓名"
prop="name"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
@ -19,15 +125,15 @@
class="item_width_1" class="item_width_1"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入组织名称 " placeholder="请输入姓名 "
v-model="dataForm.organizationName" v-model="fmData.name"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="组织人数 " label="手机号"
prop="organizationPersonCount" prop="mobile"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
@ -36,75 +142,84 @@
type="number" type="number"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入组织人数 " placeholder="请输入手机号 "
v-model="dataForm.organizationPersonCount" v-model="fmData.mobile"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="组织成员 " label="身份证号"
prop="organizationPersonnel" prop="idCard"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
placeholder="请输入身份证号"
v-model="fmData.idCard"
@blur="handleBlurId"
></el-input>
</el-form-item>
<el-form-item
label="性别"
prop="principalName"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
<div class="m-staffs"> <el-select
<div v-model.trim="fmData.gender"
class="item" placeholder="性别"
:key="'staff' + index" size="small"
v-for="(item, index) in dataForm.organizationPersonnel" clearable
style="width: 120px"
class="resi-cell-select"
>
<el-option
v-for="item in optionsGender"
:key="item.value"
:label="item.label"
:value="item.value"
> >
<el-input </el-option>
class="item_width_1" </el-select>
maxlength="50" </el-form-item>
show-word-limit
placeholder="成员姓名" <el-form-item
v-model="item.personName" label="出生日期"
/> prop="birthday"
label-width="150px"
<el-input style="display: block"
style="margin-left: 10px" >
class="item_width_1" <el-date-picker
maxlength="50" v-model="fmData.birthday"
show-word-limit type="date"
placeholder="联系电话" placeholder="出生日期"
v-model="item.personPhone" value-format="yyyy-MM-dd"
/> >
</el-date-picker>
<el-button
style="margin-left: 10px"
size="small"
@click="handleDelStaff(index)"
>删除</el-button
>
</div>
<div class="item-add">
<el-button size="small" @click="handleAddStaff">添加</el-button>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="服务事项" label="出生地"
prop="serviceItem" prop="birthplace"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
<el-input <el-input
class="item_width_1" class="item_width_1"
type="textarea" maxlength="50"
maxlength="1000"
show-word-limit show-word-limit
:rows="3" placeholder="请输入出生地"
placeholder="请输入服务事项,不超过1000字" v-model="fmData.birthplace"
v-model="dataForm.serviceItem" >
></el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="负责人 " label="出生人父亲姓名"
prop="principalName" prop="father"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
@ -112,15 +227,15 @@
class="item_width_1" class="item_width_1"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入负责人 " placeholder="请输入出生人父亲姓名"
v-model="dataForm.principalName" v-model="fmData.father"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="联系电话 " label="出生人母亲姓名"
prop="principalPhone" prop="mother"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
@ -128,70 +243,82 @@
class="item_width_1" class="item_width_1"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入联系电话 " placeholder="请输入出生人母亲姓名"
v-model="dataForm.principalPhone" v-model="fmData.mother"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="创建时间" label="胎次"
prop="organizationCreatedTime" prop="count"
label-width="150px"
style="display: block"
>
<el-input-number
v-model="fmData.count"
:min="1"
:max="50"
label="请输入胎次"
></el-input-number>
</el-form-item>
<el-form-item
label="申报户口日期"
prop="reportDate"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
<el-date-picker <el-date-picker
v-model="dataForm.organizationCreatedTime" v-model="fmData.reportDate"
placeholder="创建时间" placeholder="申报户口日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="位置坐标" label="户主姓名"
prop="longitude" prop="houseHolderName"
label-width="150px" label-width="150px"
style="display: block" style="display: block"
> >
<div style="width: 500px"> <el-input
<el-input class="item_width_1"
class="item_width_4" maxlength="50"
maxlength="50" show-word-limit
placeholder="请输入关键字" placeholder="请输入户主姓名"
v-model="dataForm.address" v-model="fmData.houseHolderName"
> >
</el-input> </el-input>
<el-button </el-form-item>
style="margin-left: 10px"
type="primary" <el-form-item
size="small" label="与户主关系"
@click="handleSearchMap" prop="houseHolderRelation"
>查询</el-button label-width="150px"
style="display: block"
>
<el-select
v-model.trim="fmData.houseHolderRelation"
placeholder="与户主关系"
size="small"
clearable
style="width: 120px"
class="resi-cell-select"
>
<el-option
v-for="item in optionsRelation"
:key="item.value"
:label="item.label"
:value="item.value"
> >
<div id="app" class="div_map"></div> </el-option>
<div style="margin-top: 10px"> </el-select>
<span>经度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="dataForm.longitude"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="dataForm.latitude"
>
</el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="false"
label="备注" label="备注"
prop="remark" prop="remark"
label-width="150px" label-width="150px"
@ -204,7 +331,7 @@
show-word-limit show-word-limit
:rows="3" :rows="3"
placeholder="请输入备注,不超过500字" placeholder="请输入备注,不超过500字"
v-model="dataForm.remark" v-model="fmData.remark"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -228,6 +355,8 @@ import { mapGetters } from "vuex";
import { Loading } from "element-ui"; // Loading import { Loading } from "element-ui"; // Loading
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper"; import formVltHelper from "dai-js/tools/formVltHelper";
import { computedCard } from "@/utils/index";
import { isCard, isMobile } from "@/utils/validate";
var map; var map;
var search; var search;
@ -235,6 +364,28 @@ var markers;
var infoWindowList; var infoWindowList;
let loading; // let loading; //
function iniFmData() {
return {
gridId: "",
villageId: "",
buildId: "",
unitId: "",
homeId: "",
name: "",
mobile: "",
idCard: "",
welfare: "", //01
gender: "",
birthplace: "",
father: "",
mother: "",
count: "",
reportDate: "",
houseHolderName: "",
houseHolderRelation: "",
};
}
export default { export default {
data() { data() {
return { return {
@ -242,149 +393,243 @@ export default {
btnDisable: false, btnDisable: false,
orgId: "", optionsV: [],
dataForm: { optionsB: [],
organizationName: "", optionsH: [],
serviceItem: "", optionsD: [],
organizationPersonCount: "", optionsG: [],
principalName: "", optionsGender: [
principalPhone: "", {
organizationCreatedTime: "", value: "1",
address: "", label: "男",
remark: "", },
longitude: "", {
latitude: "", value: "2",
organizationPersonnel: [], label: "女",
}, },
],
optionsRelation: [],
fmData: iniFmData(),
}; };
}, },
components: {}, components: {},
computed: { computed: {
dataRule() { dataRule() {
let checkIdCard = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入身份证"));
} else {
if (!isCard(value)) {
callback(new Error("身份证号格式不正确"));
}
callback();
}
};
return { return {
organizationName: [ gridId: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" }, { required: true, message: "所属网格不能为空", trigger: "blur" },
{
min: 1,
max: 50,
message: "组织名称 长度在 1 到 50个字符",
trigger: "blur",
},
],
organizationPersonCount: [
{ required: true, message: "组织人数不能为空", trigger: "blur" },
],
serviceItem: [
{ required: true, message: "服务事项不能为空", trigger: "blur" },
], ],
principalName: [ homeId: [
{ required: true, message: "负责人不能为空", trigger: "blur" }, { required: true, message: "所属房屋不能为空", trigger: "blur" },
], ],
principalPhone: [ name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
{ required: true, message: "联系电话不能为空", trigger: "blur" }, idCard: [
{ required: true, message: "身份证号不能为空", trigger: "blur" },
{ required: true, validator: checkIdCard, trigger: "blur" },
], ],
longitude: [ birthplace: [
{ required: true, message: "位置坐标不能为空", trigger: "blur" }, { required: true, message: "出生地不能为空", trigger: "blur" },
], ],
}; };
}, },
changeVDisabled() {
return !this.fmData.villageId;
},
changeBDisabled() {
return !this.fmData.buildId;
},
changeDDisabled() {
return !this.fmData.unitId;
},
}, },
props: {}, props: {},
watch: {}, watch: {},
async mounted() { async mounted() {
this.initMap(); this.getGridList();
this.getValiheList();
this.getRelationList();
}, },
methods: { methods: {
handleAddStaff() { handleBlurId() {
this.dataForm.organizationPersonnel = [ console.log("33333333333333333333");
...this.dataForm.organizationPersonnel, const { sex, birth, age } = computedCard(this.fmData.idCard);
{ personName: "", personPhone: "" }, this.fmData.birthday = birth;
]; this.fmData.gender = sex == 1 ? "1" : "2";
}, },
handleDelStaff(index) {
const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel;
},
// init
initMap() {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("app"), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
search = new window.TMap.service.Search({ pageSize: 10 }); handleClearVillage() {
// this.fmData.buildId = "";
markers = new TMap.MultiMarker({ this.fmData.homeId = "";
map: map, },
geometries: [], handleClearBuild() {
}); this.fmData.buildId = "";
infoWindowList = Array(10); this.fmData.unitId = "";
this.fmData.homeId = "";
// },
map.on("panend", () => { handleClearDan() {
this.handleMoveCenter(); this.fmData.unitId = "";
}); this.fmData.homeId = "";
this.handleMoveCenter(); },
handleChangeGrid(val) {
console.log("val", val);
this.fmData.villageId = "";
this.fmData.buildId = "";
this.fmData.unitId = "";
this.fmData.homeId = "";
this.getValiheList();
},
handleChangeV(val) {
console.log("val", val);
this.fmData.buildId = "";
this.fmData.unitId = "";
this.fmData.homeId = "";
this.getBuildList();
},
handleChangeB(val) {
console.log("val", val);
this.fmData.unitId = "";
this.fmData.homeId = "";
this.getUniList();
},
handleChangeD(val) {
console.log("val", val);
this.fmData.homeId = "";
this.getHouseList();
}, },
setMarker(lat, lng) { getRelationList() {
markers.setGeometries([]); const { user } = this.$store.state;
markers.add([ this.$http
{ .post("/sys/dict/data/relationship", {
id: "4", formCode: "resi_base_info",
styleId: "marker", })
position: new TMap.LatLng(lat, lng), .then(({ data: res }) => {
properties: { if (res.code !== 0) {
title: "marker4", return this.$message.error(res.msg);
}, } else {
}, console.log("获取查询详情成功", res.data);
]); this.optionsRelation = res.data;
}
})
.catch(() => {
return this.$message.error("网络错误");
});
}, },
handleSearchMap() { getGridList() {
infoWindowList.forEach((infoWindow) => { const { user } = this.$store.state;
infoWindow.close(); this.$http
}); .post("/gov/org/customergrid/gridoption", {
infoWindowList.length = 0; agencyId: user.agencyId,
markers.setGeometries([]); purpose: "query",
// })
search .then(({ data: res }) => {
.searchRectangle({ if (res.code !== 0) {
keyword: this.dataForm.address, return this.$message.error(res.msg);
bounds: map.getBounds(), } 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.fmData.gridId,
agencyId: "",
// agencyId: user.agencyId
}) })
.then((result) => { .then(({ data: res }) => {
let { data } = result; if (res.code !== 0) {
if (Array.isArray(data) && data.length > 0) { return this.$message.error(res.msg);
const {
location: { lat, lng },
} = data[0];
map.setCenter(new TMap.LatLng(lat, lng));
this.setMarker(lat, lng);
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
} else { } else {
this.$message.error("未检索到相关位置坐标"); console.log("获取查询详情成功", res.data);
this.optionsV = res.data;
} }
})
.catch(() => {
return this.$message.error("网络错误");
});
},
getBuildList() {
this.$http
.post("/gov/org/icbuilding/buildingoption", {
neighborHoodId: this.fmData.villageId,
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log("获取查询详情成功", res.data);
this.optionsB = res.data;
}
})
.catch(() => {
return this.$message.error("网络错误");
});
},
getUniList() {
this.$http
.post("/gov/org/icbuildingunit/unitoption", {
buildingId: this.fmData.buildId,
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log("获取查询详情成功", res.data);
this.optionsD = res.data;
}
})
.catch(() => {
return this.$message.error("网络错误");
});
},
getHouseList() {
this.$http
.post("/gov/org/ichouse/houseoption", { unitId: this.fmData.unitId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log("获取查询详情成功", res.data);
this.optionsH = res.data;
}
})
.catch(() => {
return this.$message.error("网络错误");
}); });
}, },
handleMoveCenter() { handleAddStaff() {
// this.fmData.organizationPersonnel = [
const center = map.getCenter(); ...this.fmData.organizationPersonnel,
const lat = center.getLat(); { personName: "", personPhone: "" },
const lng = center.getLng(); ];
this.dataForm.latitude = lat; },
this.dataForm.longitude = lng; handleDelStaff(index) {
this.setMarker(lat, lng); const { organizationPersonnel } = this.fmData;
organizationPersonnel.splice(index, 1);
this.fmData.organizationPersonnel = organizationPersonnel;
}, },
async initForm(type, row) { async initForm(type, row) {
@ -393,9 +638,7 @@ export default {
this.formType = type; this.formType = type;
console.log(row); console.log(row);
if (row) { if (row) {
this.dataForm = { ...this.dataForm, ...row }; this.fmData = { ...this.fmData, ...row };
this.orgId = this.dataForm.orgId;
map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
} }
}, },
@ -409,7 +652,7 @@ export default {
app.util.validateRule(messageObj); app.util.validateRule(messageObj);
this.btnDisable = false; this.btnDisable = false;
} else { } else {
if (!formVltHelper.userOrMobile(this.dataForm.principalPhone)) { if (!formVltHelper.userOrMobile(this.fmData.mobile)) {
return this.$message({ return this.$message({
type: "error", type: "error",
message: "手机号格式有误", message: "手机号格式有误",
@ -423,16 +666,14 @@ export default {
async submit() { async submit() {
let url = ""; let url = "";
if (this.formType === "add") { if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization"; url = "/epmetuser/birth/save";
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd"
} else { } else {
url = url = "/epmetuser/birth/edit";
"/heart/iccommunityselforganization/editcommunityselforganization";
this.dataForm.orgId = this.orgId; this.fmData.orgId = this.orgId;
} }
const { data, code, msg } = await requestPost(url, this.dataForm); const { data, code, msg } = await requestPost(url, this.fmData);
if (code === 0) { if (code === 0) {
this.$message({ this.$message({
@ -454,19 +695,7 @@ export default {
}, },
resetData() { resetData() {
this.orgId = ""; this.orgId = "";
this.dataForm = { this.fmData = iniFmData();
organizationName: "",
serviceItem: "",
organizationPersonCount: "",
principalName: "",
principalPhone: "",
organizationCreatedTime: "",
address: "",
remark: "",
longitude: "",
latitude: "",
organizationPersonnel: [],
};
}, },
// //
startLoading() { startLoading() {

38
src/views/modules/base/huji/chusheng/index.vue

@ -195,7 +195,7 @@
<el-card class="resi-card-table"> <el-card class="resi-card-table">
<div class="resi-row-btn"> <div class="resi-row-btn">
<el-button class="diy-button--add" size="small" @click="handleAdd" <el-button class="diy-button--add" size="small" @click="handleAdd"
>新增</el-button >出生登记</el-button
> >
<el-button <el-button
v-if="false" v-if="false"
@ -238,7 +238,13 @@
class="resi-table" class="resi-table"
:height="maxTableHeight" :height="maxTableHeight"
> >
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> <el-table-column
label="序号"
fixed="left"
type="index"
align="center"
width="50"
/>
<el-table-column prop="name" fixed="left" label="姓名" align="center"> <el-table-column prop="name" fixed="left" label="姓名" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -284,7 +290,11 @@
<el-table-column prop="birthplace" align="center" label="出生地"> <el-table-column prop="birthplace" align="center" label="出生地">
</el-table-column> </el-table-column>
<el-table-column prop="parentName" align="center" label="出生人父/母姓名"> <el-table-column
prop="parentName"
align="center"
label="出生人父/母姓名"
>
</el-table-column> </el-table-column>
<el-table-column prop="count" align="center" label="胎次"> <el-table-column prop="count" align="center" label="胎次">
@ -387,7 +397,7 @@ export default {
openSearch: false, openSearch: false,
formShow: false, formShow: false,
formTitle: "组织信息", formTitle: "出生登记",
pageNo: 1, pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20, pageSize: window.localStorage.getItem("pageSize") || 20,
@ -474,17 +484,17 @@ export default {
}, },
methods: { methods: {
handleClearVillage() { handleClearVillage() {
this.form.buildId = ""; this.fmData.buildId = "";
this.form.homeId = ""; this.fmData.homeId = "";
}, },
handleClearBuild() { handleClearBuild() {
this.form.buildId = ""; this.fmData.buildId = "";
this.form.unitId = ""; this.fmData.unitId = "";
this.form.homeId = ""; this.fmData.homeId = "";
}, },
handleClearDan() { handleClearDan() {
this.form.unitId = ""; this.fmData.unitId = "";
this.form.homeId = ""; this.fmData.homeId = "";
}, },
handleChangeGrid(val) { handleChangeGrid(val) {
console.log("val", val); console.log("val", val);
@ -882,14 +892,14 @@ export default {
overflow: visible; overflow: visible;
} }
.resi-cell { .demo-form-inline .resi-cell {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 20px; // margin-bottom: 20px;
.resi-cell-label { .resi-cell-label {
flex-shrink: 0; flex-shrink: 0;
// min-width: 70px; min-width: 0;
box-sizing: border-box; box-sizing: border-box;
margin-right: 15px; margin-right: 15px;
// text-align: right; // text-align: right;

Loading…
Cancel
Save