From aa4ae983bf62467e62c6214bab04664d0c83a34c Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Mon, 9 May 2022 17:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E9=A3=9E=E9=A3=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/base/huji/chusheng/cpts/edit.vue | 701 ++++++++++++------ .../modules/base/huji/chusheng/index.vue | 38 +- 2 files changed, 489 insertions(+), 250 deletions(-) diff --git a/src/views/modules/base/huji/chusheng/cpts/edit.vue b/src/views/modules/base/huji/chusheng/cpts/edit.vue index 59ec51c3..b48889af 100644 --- a/src/views/modules/base/huji/chusheng/cpts/edit.vue +++ b/src/views/modules/base/huji/chusheng/cpts/edit.vue @@ -4,14 +4,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19,15 +125,15 @@ class="item_width_1" maxlength="50" show-word-limit - placeholder="请输入组织名称 " - v-model="dataForm.organizationName" + placeholder="请输入姓名 " + v-model="fmData.name" > @@ -36,75 +142,84 @@ type="number" maxlength="50" show-word-limit - placeholder="请输入组织人数 " - v-model="dataForm.organizationPersonCount" + placeholder="请输入手机号 " + v-model="fmData.mobile" > + + + + -
-
+ - - - - - 删除 -
- -
- 添加 -
-
+ + +
+ + + + + placeholder="请输入出生地" + v-model="fmData.birthplace" + > + @@ -112,15 +227,15 @@ class="item_width_1" maxlength="50" show-word-limit - placeholder="请输入负责人 " - v-model="dataForm.principalName" + placeholder="请输入出生人父亲姓名" + v-model="fmData.father" > @@ -128,70 +243,82 @@ class="item_width_1" maxlength="50" show-word-limit - placeholder="请输入联系电话 " - v-model="dataForm.principalPhone" + placeholder="请输入出生人母亲姓名" + v-model="fmData.mother" > + + + + -
- - - 查询 + + + + + + -
-
- 经度 - - - 纬度 - - -
-
+ +
@@ -228,6 +355,8 @@ import { mapGetters } from "vuex"; import { Loading } from "element-ui"; // 引入Loading服务 import { requestPost } from "@/js/dai/request"; import formVltHelper from "dai-js/tools/formVltHelper"; +import { computedCard } from "@/utils/index"; +import { isCard, isMobile } from "@/utils/validate"; var map; var search; @@ -235,6 +364,28 @@ var markers; var infoWindowList; let loading; // 加载动画 +function iniFmData() { + return { + gridId: "", + villageId: "", + buildId: "", + unitId: "", + homeId: "", + name: "", + mobile: "", + idCard: "", + welfare: "", //福利0否,1是 + gender: "", + birthplace: "", + father: "", + mother: "", + count: "", + reportDate: "", + houseHolderName: "", + houseHolderRelation: "", + }; +} + export default { data() { return { @@ -242,149 +393,243 @@ export default { btnDisable: false, - orgId: "", - dataForm: { - organizationName: "", - serviceItem: "", - organizationPersonCount: "", - principalName: "", - principalPhone: "", - organizationCreatedTime: "", - address: "", - remark: "", - longitude: "", - latitude: "", - organizationPersonnel: [], - }, + optionsV: [], + optionsB: [], + optionsH: [], + optionsD: [], + optionsG: [], + optionsGender: [ + { + value: "1", + label: "男", + }, + { + value: "2", + label: "女", + }, + ], + optionsRelation: [], + + fmData: iniFmData(), }; }, components: {}, computed: { dataRule() { + let checkIdCard = (rule, value, callback) => { + if (value === "") { + callback(new Error("请输入身份证")); + } else { + if (!isCard(value)) { + callback(new Error("身份证号格式不正确")); + } + callback(); + } + }; + return { - organizationName: [ - { 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" }, + gridId: [ + { required: true, message: "所属网格不能为空", trigger: "blur" }, ], - principalName: [ - { required: true, message: "负责人不能为空", trigger: "blur" }, + homeId: [ + { required: true, message: "所属房屋不能为空", trigger: "blur" }, ], - principalPhone: [ - { required: true, message: "联系电话不能为空", trigger: "blur" }, + name: [{ required: true, message: "姓名不能为空", trigger: "blur" }], + idCard: [ + { required: true, message: "身份证号不能为空", trigger: "blur" }, + { required: true, validator: checkIdCard, trigger: "blur" }, ], - longitude: [ - { required: true, message: "位置坐标不能为空", trigger: "blur" }, + birthplace: [ + { required: true, message: "出生地不能为空", trigger: "blur" }, ], }; }, + + changeVDisabled() { + return !this.fmData.villageId; + }, + changeBDisabled() { + return !this.fmData.buildId; + }, + changeDDisabled() { + return !this.fmData.unitId; + }, }, props: {}, watch: {}, async mounted() { - this.initMap(); + this.getGridList(); + this.getValiheList(); + this.getRelationList(); }, methods: { - handleAddStaff() { - this.dataForm.organizationPersonnel = [ - ...this.dataForm.organizationPersonnel, - { personName: "", personPhone: "" }, - ]; + handleBlurId() { + console.log("33333333333333333333"); + const { sex, birth, age } = computedCard(this.fmData.idCard); + 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 }); - // 新建一个地点搜索类 - markers = new TMap.MultiMarker({ - map: map, - geometries: [], - }); - infoWindowList = Array(10); - - // 监听地图平移结束 - map.on("panend", () => { - this.handleMoveCenter(); - }); - this.handleMoveCenter(); + handleClearVillage() { + this.fmData.buildId = ""; + this.fmData.homeId = ""; + }, + handleClearBuild() { + this.fmData.buildId = ""; + this.fmData.unitId = ""; + this.fmData.homeId = ""; + }, + handleClearDan() { + this.fmData.unitId = ""; + this.fmData.homeId = ""; + }, + 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) { - markers.setGeometries([]); - markers.add([ - { - id: "4", - styleId: "marker", - position: new TMap.LatLng(lat, lng), - properties: { - title: "marker4", - }, - }, - ]); + getRelationList() { + const { user } = this.$store.state; + this.$http + .post("/sys/dict/data/relationship", { + formCode: "resi_base_info", + }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg); + } else { + console.log("获取查询详情成功", res.data); + this.optionsRelation = res.data; + } + }) + .catch(() => { + return this.$message.error("网络错误"); + }); }, - handleSearchMap() { - infoWindowList.forEach((infoWindow) => { - infoWindow.close(); - }); - infoWindowList.length = 0; - markers.setGeometries([]); - // 在地图显示范围内以给定的关键字搜索地点 - search - .searchRectangle({ - keyword: this.dataForm.address, - bounds: map.getBounds(), + 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("网络错误"); + }); + }, + getValiheList() { + const { user } = this.$store.state; + this.$http + .post("/gov/org/icneighborhood/neighborhoodoption", { + gridId: this.fmData.gridId, + agencyId: "", + // agencyId: user.agencyId }) - .then((result) => { - let { data } = result; - if (Array.isArray(data) && data.length > 0) { - 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; + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg); } 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() { - //修改地图中心点 - const center = map.getCenter(); - const lat = center.getLat(); - const lng = center.getLng(); - this.dataForm.latitude = lat; - this.dataForm.longitude = lng; - this.setMarker(lat, lng); + handleAddStaff() { + this.fmData.organizationPersonnel = [ + ...this.fmData.organizationPersonnel, + { personName: "", personPhone: "" }, + ]; + }, + handleDelStaff(index) { + const { organizationPersonnel } = this.fmData; + organizationPersonnel.splice(index, 1); + this.fmData.organizationPersonnel = organizationPersonnel; }, async initForm(type, row) { @@ -393,9 +638,7 @@ export default { this.formType = type; console.log(row); if (row) { - this.dataForm = { ...this.dataForm, ...row }; - this.orgId = this.dataForm.orgId; - map.setCenter(new TMap.LatLng(row.latitude, row.longitude)); + this.fmData = { ...this.fmData, ...row }; } }, @@ -409,7 +652,7 @@ export default { app.util.validateRule(messageObj); this.btnDisable = false; } else { - if (!formVltHelper.userOrMobile(this.dataForm.principalPhone)) { + if (!formVltHelper.userOrMobile(this.fmData.mobile)) { return this.$message({ type: "error", message: "手机号格式有误", @@ -423,16 +666,14 @@ export default { async submit() { let url = ""; if (this.formType === "add") { - url = "/heart/iccommunityselforganization/addcommunityselforganization"; - // url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd" + url = "/epmetuser/birth/save"; } else { - url = - "/heart/iccommunityselforganization/editcommunityselforganization"; + url = "/epmetuser/birth/edit"; - 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) { this.$message({ @@ -454,19 +695,7 @@ export default { }, resetData() { this.orgId = ""; - this.dataForm = { - organizationName: "", - serviceItem: "", - organizationPersonCount: "", - principalName: "", - principalPhone: "", - organizationCreatedTime: "", - address: "", - remark: "", - longitude: "", - latitude: "", - organizationPersonnel: [], - }; + this.fmData = iniFmData(); }, // 开启加载动画 startLoading() { diff --git a/src/views/modules/base/huji/chusheng/index.vue b/src/views/modules/base/huji/chusheng/index.vue index 3ab387f6..4055aefc 100644 --- a/src/views/modules/base/huji/chusheng/index.vue +++ b/src/views/modules/base/huji/chusheng/index.vue @@ -195,7 +195,7 @@
新增出生登记 - +