From bb036407bcc0f26a9a0f246aca100d87db2f6e76 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期四, 20 十月 2022 14:54:30 +0800 Subject: [PATCH] 优化 --- src/views/operate/disposal/casepool/pool/createUser/vio/index.vue | 146 +++++++++++++++++------------------------------- 1 files changed, 51 insertions(+), 95 deletions(-) diff --git a/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue b/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue index 7c84c25..853168f 100644 --- a/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue +++ b/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue @@ -28,7 +28,7 @@ </div> <div class="user-item"> <!-- 灏忕被鍚嶇О --> - <el-form-item class="optionItems" label="灏忕被鍚嶇О:" prop="typeId" > + <el-form-item class="optionItems" label="灏忕被鍚嶇О:" prop="typeId"> <el-select v-model="vio.typeId" placeholder="璇烽�夋嫨灏忕被鍚嶇О" @change="handleSmallKindChange"> <el-option v-for="item in smallKindList" :key="item.id" :label="item.name" :value="item.id"> @@ -45,12 +45,11 @@ </el-form-item> </div> <!-- 妗堢敱 --> - <el-form-item class="optionItem" label="妗堢敱:" prop="actionCause"> - <el-select v-model="vio.actionCause" placeholder="璇疯緭鍏ユ鐢�"> - <el-option v-for="item in anYouList" :key="item.id" :label="item.name" - :value="item.id" > - </el-option> - </el-select> + <el-form-item class="optionItem anyou" label="妗堢敱:" prop="actionCause"> + <el-select v-model="vio.actionCause" placeholder="璇疯緭鍏ユ鐢�" filterable @blur="selectBlur"> + <el-option v-for="item in anYouList" :key="item.id" :label="item.name" :value="item.name" > + </el-option> + </el-select> <!-- <el-input v-model="vio.actionCause" placeholder="璇疯緭鍏ユ鐢�"></el-input> --> </el-form-item> <!-- 鎵�灞炲尯鍘� --> @@ -141,7 +140,9 @@ </template> <script> import MyMap from '@/components/map' -import { validateName, validatePhone, validateCarNum } from '@/utils/validate' +import { validateName, validatePhone, validateCarNum, validateCardId } from '@/utils/validate' +import {getTypeList} from '@/utils/helper' +import {parseTime} from "@/utils/index" export default { components: { MyMap @@ -223,21 +224,21 @@ } const checkName = (rule, value, callback) => { if (value) { - validateName(value) ? callback():callback(new Error('璇疯緭鍏ユ纭殑濮撳悕')) + validateName(value) ? callback() : callback(new Error('璇疯緭鍏ユ纭殑濮撳悕')) } else { callback() } } const checkCardId = (rule, value, callback) => { if (value) { - callback(); + validateCardId(value) ? callback() : callback(new Error('璇疯緭鍏ユ纭殑韬唤璇佸彿鐮�')) } else { callback() } } const checkPhone = (rule, value, callback) => { if (value) { - validatePhone(value) ? callback():callback(new Error('璇疯緭鍏ユ纭殑鎵嬫満鍙�')); + validatePhone(value) ? callback() : callback(new Error('璇疯緭鍏ユ纭殑鎵嬫満鍙�')); } else { callback() } @@ -246,9 +247,9 @@ if (value) { callback(); } else { - if(this.vio.linkShop===1){ + if (this.vio.linkShop === 1) { callback(new Error('鍏宠仈鍟嗛摵鍚嶅瓧涓嶈兘涓虹┖')); - }else{ + } else { callback(); } } @@ -303,23 +304,23 @@ required: true, trigger: 'blur', validator: checkDesc } ], - informant:[ + informant: [ { required: false, trigger: 'blur', validator: checkName } ], - informantIdCard:[ + informantIdCard: [ { required: false, trigger: 'blur', validator: checkCardId } ], - informantPhoneCode:[ + informantPhoneCode: [ { required: false, trigger: 'blur', validator: checkPhone } ], // linkShop:0,//鏄惁鍏宠仈鍟嗛摵(0鍚�1鏄�) - shopName:[ + shopName: [ { required: false, trigger: 'blur', validator: checkLink } @@ -370,11 +371,11 @@ ], streetList: [], communityList: [], - anYouList:[], + anYouList: [], } }, created() { - const { setBigKindList,getStreetList,getEventLevel } = this; + const { setBigKindList, getStreetList, getEventLevel } = this; console.log(this.mytype); this.vio.category = this.mytype + 1; setBigKindList(); @@ -386,23 +387,23 @@ this.refresh(); }, // 璁剧疆澶х被 - async setBigKindList(){ - this.bigKindList = await this.getBigKind(); + async setBigKindList() { + this.bigKindList = await this.getBigKind(); }, // 璁剧疆灏忕被 - async setSmallKindList(id){ + async setSmallKindList(id) { let arr = await this.getSmallKind(); - this.smallKindList = arr.filter(item=>{ - if(item.parentId===id){ + this.smallKindList = arr.filter(item => { + if (item.parentId === id) { return item; } }) }, // 璁剧疆妗堢敱 - async setAnYouList(id){ + async setAnYouList(id) { let arr = await this.getAnYouList(); - this.anYouList = arr.filter(item=>{ - if(item.parentId===id){ + this.anYouList = arr.filter(item => { + if (item.parentId === id) { return item; } }) @@ -433,14 +434,8 @@ return arr }, // 鑾峰彇妗堜欢绛夌骇鍒楄〃 - getEventLevel() { - this.$axios({ - method: 'get', - url: 'sccg/violations/query/event_type' - }) - .then(res => { - this.eventLevelList = res.data; - }) + async getEventLevel() { + this.eventLevelList = await getTypeList(1,'02'); }, // 鏌ヨ鎵�灞炴鐢� async getAnYouList() { @@ -460,13 +455,16 @@ this.$refs.user.validate((valid) => { if (valid) { const { vio } = this; - console.log(vio); this.$axios({ method: 'post', url: 'sccg/base_case/addition_violation', - data: vio + data: { + ...vio, + alarmTime:parseTime(vio.alarmTime), + } }) .then(res => { + console.log(res); if (res.code === 200) { this.$message({ type: 'success', @@ -491,19 +489,14 @@ this.$emit('changeDialog', { flag: false }) }, // 鑾峰彇琛楅亾淇℃伅 - getStreetList() { - this.$axios({ - method: 'get', - url: 'sccg/dict/query_Street_type' - }) - .then(res => { - this.streetList = res.data; - }) + async getStreetList() { + this.streetList = await getTypeList(1,'10'); }, // 琛楅亾鏇存敼 handleStreet(id) { console.log(id); this.vio.communityId = ''; + // this.communityList = getTypeList(1,'11') this.$axios({ method: 'get', url: 'sccg/dict/query_social_type?id=' + id @@ -517,16 +510,23 @@ value === 0 ? this.vio.shopName = '' : ''; }, // 澶х被閫変腑 - handleBigKindChange(id){ + handleBigKindChange(id) { this.vio.actionCause = ''; this.vio.typeId = ''; this.setSmallKindList(id); }, // 灏忕被閫変腑 - handleSmallKindChange(id){ + handleSmallKindChange(id) { this.vio.actionCause = ''; this.setAnYouList(id); - } + }, + // 妗堢敱杈撳叆 + selectBlur(e){ + if(e.target.value){ + this.vio.actionCause = e.target.value; + console.log(e.target.value); + } + } }, props: ['mytype', 'changeDialog', 'refresh'] } @@ -586,53 +586,9 @@ .map-area { flex: 1; } - - .not-need { - color: #4b9bb7; - - .not-need__header { - line-height: 40px; - } - - .my-sp-item { - display: flex; - - .not-item-left, - .not-item-right { - display: flex; - - .el-input { - flex: 1; - } - } - } - - .not-need-item { - line-height: 40px; - margin-bottom: 22px; - display: flex; - - label { - width: 100px; - padding-right: 12px; - text-align: right; - } - - .el-input { - flex: 1; - } - - .not-need__inner { - flex: 1; - line-height: 40px; - padding: 0 15px; - border-radius: 4px; - color: #fff; - // outline: #409eff solid 1px; - outline: none; - background-color: #09152f; - border: 1px solid #17324c; - } + .anyou{ + :deep(.el-select){ + display: block; } } -- Gitblit v1.8.0