From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化
---
src/views/place/components/baseAllInfo.vue | 333 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 213 insertions(+), 120 deletions(-)
diff --git a/src/views/place/components/baseAllInfo.vue b/src/views/place/components/baseAllInfo.vue
index 2785e80..a5cfff3 100644
--- a/src/views/place/components/baseAllInfo.vue
+++ b/src/views/place/components/baseAllInfo.vue
@@ -4,14 +4,22 @@
<div class="content-box">
<box-title class="m10" :classVal="9" :title="'基本信息'"></box-title>
<avue-form v-if="baseShow" ref="baseForm" :option="option" v-model="form">
+ <template slot-scope="{ row, size, index }" slot="houseCodeBinds">
+ <el-select v-model="form.houseCodeBinds" filterable remote multiple :remote-method="onRemoteMethod"
+ @change="onSelectChange" placeholder="请选择标准地址" reserve-keyword>
+ <el-option v-for="item in standardAddressList" :key="item.addressCode" :label="item.addressName"
+ :value="item.addressCode">
+ </el-option>
+ </el-select>
+ </template>
</avue-form>
<box-title class="m10" :classVal="9" :title="'房东信息'"></box-title>
- <avue-form v-if="restShow" ref="restForm" :option="houseOwnerOption" v-model="form"></avue-form>
+ <avue-form v-if="restShow" ref="restForm" :option="houseOwnerOption" v-model="placeForm"></avue-form>
- <box-title class="m10" :classVal="9" :title="'其他信息'"></box-title>
- <avue-form v-if="restShow" ref="restForm" :option="optionDetail" v-model="placeForm"></avue-form>
+ <box-title class="m10" :classVal="9" :title="'学校信息'" v-if="schoolShow"></box-title>
+ <avue-form v-if="schoolShow" ref="restForm" :option="optionDetail" v-model="placeForm"></avue-form>
<box-title class="m10" :classVal="9" :title="'从业人员'"></box-title>
<avue-crud :option="placeOption" :table-loading="loading" :data="placeExt" ref="crud" v-model="houseHoldForm"
@@ -22,7 +30,7 @@
</div>
<div class="footer-btn-box">
- <el-button size="small" type="primary" @click="dataUpdate">保 存</el-button>
+ <el-button size="small" :disabled="disabled" type="primary" @click="dataUpdate">保 存</el-button>
<el-button size="small" @click="roleBoxClose">关 闭</el-button>
</div>
@@ -40,6 +48,7 @@
getHoldList,
update,
updatePlaceExt,
+ getPlaceAddressList
} from "@/api/place/place"
import {
getPlaceList
@@ -63,9 +72,11 @@
}
return {
+ disabled: false,
roleBox: false,
baseShow: false,
restShow: false,
+ schoolShow: false,
placeExt: [],
@@ -73,25 +84,22 @@
option: {
submitBtn: false,
emptyBtn: false,
-
+ dialogMenuPosition: 'right',
column: [{
span: 12,
label: "场所名称",
prop: "placeName",
- labelWidth:120,
+ labelWidth: 120,
rules: [{
required: true,
message: "请输入场所名称",
trigger: "blur",
}, ],
},
-
-
-
{
label: "负责人",
prop: "principal",
- labelWidth:120,
+ labelWidth: 120,
rules: [{
required: false,
message: "请输入负责人",
@@ -103,7 +111,7 @@
width: 96,
label: "手机号码",
prop: "principalPhone",
- labelWidth:120,
+ labelWidth: 120,
search: true,
searchSpan: 4,
slot: true,
@@ -117,7 +125,7 @@
width: 120,
overHidden: true,
label: "身份证号",
- labelWidth:120,
+ labelWidth: 120,
prop: "principalIdCard",
search: true,
searchSpan: 4,
@@ -133,11 +141,11 @@
hide: true,
parent: false,
label: "所属社区",
- labelWidth:120,
+ labelWidth: 120,
prop: "neiCode",
search: false,
type: "tree",
- dicUrl: "/api/blade-system/region/tree",
+ dicUrl: "/api/blade-system/region/treeToCommunity",
props: {
label: "name",
value: "id",
@@ -157,7 +165,7 @@
label: "所属网格",
prop: "gridCode",
type: "tree",
- labelWidth:120,
+ labelWidth: 120,
cell: true,
props: {
label: "gridName",
@@ -176,7 +184,7 @@
span: 7,
label: "场所标签",
prop: "label",
- labelWidth:120,
+ labelWidth: 120,
type: "select",
dicUrl: "/api/blade-category/category/getCategory?level=2",
cascader: ["smallLabel"],
@@ -193,8 +201,11 @@
}, ],
},
{
+ collapseTags: true,
+ maxCollapseTags: 3,
+ collapseTagsTooltip: true,
+ multiple: true,
span: 5,
- label: "",
labelWidth: 20,
prop: "smallLabel",
type: "select",
@@ -212,7 +223,7 @@
label: "标签颜色",
prop: "color",
type: "select",
- labelWidth:120,
+ labelWidth: 120,
dicData: [{
label: "绿",
value: "green",
@@ -236,7 +247,7 @@
span: 12,
label: "九小场所",
prop: "isNine",
- labelWidth:120,
+ labelWidth: 120,
type: "select",
dicData: [{
label: "是",
@@ -258,7 +269,7 @@
span: 12,
label: "九小分类",
prop: "nineType",
- labelWidth:120,
+ labelWidth: 120,
type: "select",
display: false,
dicUrl: "/api/blade-system/dict-biz/dictionary?code=nineType",
@@ -273,7 +284,7 @@
span: 12,
label: "阵地",
prop: "isFront",
- labelWidth:120,
+ labelWidth: 120,
type: "select",
dicData: [{
label: "是",
@@ -296,7 +307,7 @@
label: "阵地类型",
prop: "frontType",
type: "select",
- labelWidth:120,
+ labelWidth: 120,
display: false,
row: true,
dicUrl: "/api/blade-system/dict-biz/dictionary?code=frontType",
@@ -311,7 +322,7 @@
span: 12,
label: "三级消防单位",
prop: "threeFireProtection",
- labelWidth:120,
+ labelWidth: 120,
type: "select",
dicData: [{
label: "是",
@@ -327,14 +338,32 @@
required: false,
message: "请选择三级消防单位",
trigger: "blur",
- }, ],
+ }],
},
+
+ {
+ span: 12,
+ label: "无炸类型",
+ prop: "noExplosionCategory",
+ type: "select",
+ labelWidth: 120,
+ display: true,
+ row: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=noExplosionCategory",
+ dataType: "number",
+ hide: true,
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
{
label: "场所照片",
prop: "imageUrls",
width: 80,
type: "upload",
- labelWidth:120,
+ labelWidth: 120,
listType: "picture-card",
dataType: "string",
multiple: true,
@@ -354,7 +383,7 @@
prop: "location",
type: "map",
dataType: "string",
- labelWidth:120,
+ labelWidth: 120,
span: 24,
value: [117.96646, 28.431002, ""],
cascader: ['houseCodeBinds'],
@@ -368,44 +397,26 @@
width: 160,
overHidden: true,
display: false,
- labelWidth:120,
+ labelWidth: 120,
hide: true,
label: "地址",
prop: "addressName",
span: 12
},
-
{
- width: 160,
- overHidden: true,
+ span: 24,
+ hide: true,
+ prop: "houseCodeBinds",
slot: true,
label: "标准地址",
- prop: "houseCodeBinds",
- span: 24,
- type: 'tree',
- labelWidth:120,
- dataType: "object",
- remote: true,
- multiple: true,
- hide: true,
- display: false,
- dicUrl: `/api/blade-doorplateAddress/doorplateAddress/getPlaceList?addressName={{addressName}}`,
- props: {
- label: 'addressName',
- value: 'addressCode',
- },
- dicData: [],
- rules: [{
- required: false,
- message: "请选择标准地址",
- trigger: "blur",
- }, ],
+ labelWidth: 120,
+
},
{
label: "备注",
prop: "remark",
type: 'textarea',
- labelWidth:120,
+ labelWidth: 120,
hide: true,
span: 24,
rules: [{
@@ -422,11 +433,41 @@
submitBtn: false,
emptyBtn: false,
column: [{
+ label: "学生人数",
+ prop: "studentNumber",
+ },
+ {
+ label: "教职工人数",
+ prop: "workersNumber",
+ },
+ {
+ label: "专职保安",
+ prop: "securityNumber",
+ },
+ {
+ label: "专职门卫",
+ prop: "guardNumber",
+ },
+ {
+ label: "专兼职保卫人员",
+ prop: "temporarySecurityNumber",
+ },
+ {
+ label: "走读/寄宿",
+ prop: "dayStudentsNumber",
+ },
+ {
+ label: "住校生人数",
+ prop: "residentialStudentsNumber",
+ },
+ {
+ label: "宿舍管理人员",
+ prop: "housemasterNumber",
+ }, {
labelWidth: 100,
label: "法人信息",
prop: "legalPerson",
},
-
{
labelWidth: 100,
label: "法人电话",
@@ -440,8 +481,6 @@
trigger: "blur",
}, ],
},
-
-
{
label: "营业执照",
prop: "imageUrls",
@@ -477,7 +516,6 @@
},
],
},
-
loading: true,
placeOption: {
menu: true,
@@ -499,35 +537,6 @@
searchSpan: 4,
search: true,
},
-
- {
- labelWidth: 100,
- label: "电话号码",
- prop: "telephone",
- search: true,
- searchSpan: 4,
- slot: true,
- overHidden: true,
- rules: [{
- validator: validatorPhone,
- trigger: "blur",
- }, ],
- },
-
- {
- labelWidth: 100,
- label: "身份证号",
- prop: "idCard",
- },
-
- {
- labelWidth: 100,
- label: "现居住地",
- prop: "tempAddress",
- searchSpan: 4,
- search: true,
- },
-
{
labelWidth: 100,
label: "性别",
@@ -547,7 +556,6 @@
}
],
},
-
{
labelWidth: 100,
span: 12,
@@ -562,20 +570,93 @@
value: "dictKey",
},
},
-
+ {
+ labelWidth: 100,
+ label: "身份证号",
+ prop: "idCard",
+ },
+ {
+ labelWidth: 100,
+ label: "电话号码",
+ prop: "telephone",
+ search: true,
+ searchSpan: 4,
+ slot: true,
+ overHidden: true,
+ rules: [{
+ validator: validatorPhone,
+ trigger: "blur",
+ }, ],
+ },
+ {
+ labelWidth: 100,
+ label: "现居住地",
+ prop: "tempAddress",
+ searchSpan: 4,
+ search: true,
+ },
{
labelWidth: 100,
label: "岗位",
prop: "jobNature",
// hide: true
},
-
+ {
+ label: "从业人员照片",
+ prop: "employerImg",
+ labelWidth: 100,
+ type: "upload",
+ listType: "picture-card",
+ dataType: "string",
+ multiple: true,
+ action: "/api/blade-resource/oss/endpoint/put-file",
+ propsHttp: {
+ res: "data",
+ name: "name",
+ url: "link",
+ },
+ span: 24,
+ hide: true
+ },
+ {
+ label: "入职时间",
+ labelWidth: 100,
+ hide: true,
+ row: true,
+ prop: "resignationTime",
+ type: "datetime",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ // format: "yyyy-MM-dd hh:mm:ss",
+ // valueFormat: "yyyy-MM-dd hh:mm:ss",
+ rules: [{
+ required: false,
+ message: "请选择入职时间",
+ trigger: "blur",
+ }]
+ },
+ {
+ label: "离职时间",
+ labelWidth: 100,
+ hide: true,
+ row: true,
+ prop: "employmentTime",
+ type: "datetime",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ rules: [{
+ required: false,
+ message: "请选择离职时间",
+ trigger: "blur",
+ }]
+ },
{
labelWidth: 100,
label: "状态",
prop: "resignationFlag",
// hide: true
type: "select",
+ display: false,
dicData: [{
label: "在职",
value: 1
@@ -586,7 +667,6 @@
}
],
},
-
]
},
holdPage: {
@@ -618,7 +698,6 @@
slot: true,
overHidden: true,
rules: [{
- validator: validatorPhone,
trigger: "blur",
}, ],
},
@@ -635,30 +714,12 @@
trigger: "blur",
}, ],
},
- {
- width: 96,
- label: "微信号",
- prop: "legalTel",
- search: true,
- searchSpan: 4,
- slot: true,
- overHidden: true,
- rules: [{
- validator: validatorPhone,
- trigger: "blur",
- }, ],
- },
-
-
-
],
},
userOption: {
submitBtn: false,
emptyBtn: false,
- column: [
-
- {
+ column: [{
width: 96,
label: "电话",
prop: "legalTel",
@@ -684,11 +745,11 @@
trigger: "blur",
}, ],
},
-
-
-
],
},
+ standardAddressList: [], //标准地址数据
+ standardAddress: "",
+ standardAddressSearchKey: ""
}
},
@@ -757,6 +818,7 @@
this.roleBox = true
this.baseShow = false
this.restShow = false
+ this.schoolShow = false
this.form = {}
this.placeForm = {}
@@ -768,6 +830,7 @@
}), getPlaceList()])
.then(
that.$axios.spread(function(baseInfo, restInfo) {
+ console.log("houseCodeBinds===>", baseInfo.data.data.houseCodeBinds)
that.form = baseInfo.data.data
that.form.addressName = that.form.location;
that.form.location = [
@@ -775,6 +838,10 @@
that.form.lat,
that.form.location,
].join(",")
+ if (baseInfo.data.data.houseCodeBinds) {
+ that.standardAddressList = baseInfo.data.data.houseBindList;
+ that.form.houseCodeBinds = baseInfo.data.data.houseCodeBinds.split(",")
+ }
if (that.form.imageUrls && that.form.imageUrls.length) {
that.form.imageUrls = that.form.imageUrls
@@ -784,10 +851,7 @@
.join(",")
}
- if (
- that.form.placePoiLabelVOList &&
- that.form.placePoiLabelVOList.length
- ) {
+ if (that.form.placePoiLabelVOList && that.form.placePoiLabelVOList.length) {
let lebelTwo = that.form.placePoiLabelVOList.find((item) => {
return item.type == 2
})
@@ -828,12 +892,19 @@
...data,
imageUrls,
planImageUrls,
+
+
}
}
-
+ console.log("***********1**********", that.form)
+ if (that.form.label === '1601') {
+ that.schoolShow = true
+ }
that.restShow = true
})
)
+
+ that.getPlaceAddressListRequest()
},
locationDispose(data) {
@@ -959,7 +1030,7 @@
dataUpdate() {
const that = this
-
+ that.disabled = true;
let imageUrls = this.desposeImage(this.form.imageUrls)
let placeImages = this.desposeImage(this.placeForm.imageUrls)
let placePlanImageUrls = this.desposeImage(this.placeForm.planImageUrls)
@@ -975,7 +1046,7 @@
this.form.houseCodeBinds = this.form.houseCodeBinds.join(",")
}
-
+ this.form.placeExtEntity = null
this.$refs.baseForm.validate((valid, done, msg) => {
if (valid) {
that.$axios
@@ -1006,12 +1077,12 @@
that.placeElement.page,
that.placeElement.query
)
-
done()
})
)
} else {
console.log("error submit!!")
+ that.disabled = false;
return false
}
})
@@ -1020,13 +1091,35 @@
roleBoxClose() {
this.form = {}
this.placeForm = {}
-
+ this.disabled = false
this.$refs.baseForm && this.$refs.baseForm.resetForm()
this.$refs.restForm && this.$refs.restForm.resetForm()
this.baseShow = false
this.restShow = false
+ this.schoolShow = false
this.roleBox = false
},
+
+ getPlaceAddressListRequest(query) {
+ getPlaceAddressList({
+ addressName: query
+ }).then(res => {
+ this.standardAddressList = res.data.data;
+ })
+ },
+
+ onSelectChange(e) {
+ console.log("selectChange===>", e);
+ // this.getPlaceAddressListRequest()
+ },
+
+ onRemoteMethod(query) {
+ console.log("remote===>", query)
+ this.getPlaceAddressListRequest(query)
+ },
+
+
+
},
}
</script>
--
Gitblit v1.9.3