Commit fc72eac8 authored by 李超鹏's avatar 李超鹏

桩到家界面交互

parent e3f10488
...@@ -5,10 +5,8 @@ ...@@ -5,10 +5,8 @@
<div class="input-box img-box"> <div class="input-box img-box">
<div :key="index" class="img-item" v-for="(item, index) in imgList"> <div :key="index" class="img-item" v-for="(item, index) in imgList">
<img :src="item.url" /> <img :src="item.url" />
<!-- <p>{{item.title}}</p> -->
<div class="close" @click="deleteImg(index)"> <div class="close" @click="deleteImg(index)">
x x
<!-- <img src="@/assets/img/close.png" alt /> -->
</div> </div>
</div> </div>
<img-uploader <img-uploader
...@@ -25,6 +23,7 @@ import ImgUploader from '@/components/uploader/img-uploader' ...@@ -25,6 +23,7 @@ import ImgUploader from '@/components/uploader/img-uploader'
import { import {
uploadFile uploadFile
} from '@/api/shzhida/order/service' } from '@/api/shzhida/order/service'
import { Toast } from 'mint-ui'
export default { export default {
name: 'XhFiles', name: 'XhFiles',
components: { components: {
...@@ -61,15 +60,34 @@ export default { ...@@ -61,15 +60,34 @@ export default {
}, },
watch: { watch: {
},
mounted() {
if (this.item.value && this.item.value.length > 0) {
this.item.value.map(item => {
this.imgList.push({ src: item })
})
}
}, },
methods: { methods: {
async uploadFile(item) { async uploadFile(item) {
const data = { console.log(item)
file: item.file const fromData = new FormData()
fromData.append('file', item.file)
const result = await uploadFile(this.orderId, fromData)
if (result.data.code === 200) {
if (this.item.value) {
this.item.value.push(result.data.data)
} else {
this.item.value = [result.data.data]
}
} else {
if (result.data.message) {
Toast({
message: result.data.message,
duration: 3000
})
}
} }
const result = await uploadFile(this.orderId, data)
// item.url = result
console.log(result, 'result')
}, },
addFile(item) { addFile(item) {
this.imgList.push(item) this.imgList.push(item)
......
...@@ -52,6 +52,9 @@ export default { ...@@ -52,6 +52,9 @@ export default {
}, },
watch: { watch: {
},
mounted() {
if (this.item.value) { this.value = this.item.value }
}, },
methods: { methods: {
getName(value) { getName(value) {
...@@ -60,12 +63,10 @@ export default { ...@@ -60,12 +63,10 @@ export default {
return '' return ''
} }
const settings = this.item.settings || [] const settings = this.item.settings || []
console.log(settings, 'settings')
const resultArr = settings.filter(item => { const resultArr = settings.filter(item => {
return item.value === value return item.value === value
}) })
result = resultArr.length > 0 && resultArr[0].label result = resultArr.length > 0 && resultArr[0].label
console.log(result, 'result')
return result return result
}, },
cancel() { cancel() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="label">{{item.label}}</div> <div class="label">{{item.label}}</div>
<div class="required" v-if="item.required">*</div> <div class="required" v-if="item.required">*</div>
<div class="input-box"> <div class="input-box">
<mt-switch v-model="value"></mt-switch> <mt-switch v-model="item.value"></mt-switch>
</div> </div>
</div> </div>
......
<template> <template>
<div class="input-item"> <div class="input-item">
<div class="label">数值<span class="required">*</span></div> <div class="label"><span class="required">*</span></div>
<div class="input-box"> <div class="input-box">
<textarea <textarea
v-model="value" v-model="value"
......
...@@ -55,109 +55,109 @@ const installData = [{ ...@@ -55,109 +55,109 @@ const installData = [{
}, { }, {
title: '安装照片', title: '安装照片',
content: [{ content: [{
fieldName: 'grassRoadLen', fieldName: '09',
label: '电缆', label: '电缆',
inputType: 'file', inputType: 'file',
maxCount: 5, maxCount: 5,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '10',
label: '管材', label: '管材',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '11',
label: '安全施工标识', label: '安全施工标识',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '12',
label: '充电桩配件', label: '充电桩配件',
inputType: 'file', inputType: 'file',
maxCount: 2, maxCount: 2,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '18',
label: '充电桩编号', label: '充电桩编号',
inputType: 'file', inputType: 'file',
maxCount: 10, maxCount: 10,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '19',
label: '电源点照片', label: '电源点照片',
inputType: 'file', inputType: 'file',
maxCount: 10, maxCount: 10,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '17',
label: '敷设路径', label: '敷设路径',
inputType: 'file', inputType: 'file',
maxCount: 15, maxCount: 15,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '13',
label: '充电桩上端电源接线', label: '充电桩上端电源接线',
inputType: 'file', inputType: 'file',
maxCount: 10, maxCount: 10,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '20',
label: '内部接线', label: '内部接线',
inputType: 'file', inputType: 'file',
maxCount: 5, maxCount: 5,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '21',
label: '充电桩上电', label: '充电桩上电',
inputType: 'file', inputType: 'file',
maxCount: 15, maxCount: 15,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '16',
label: '充电测试', label: '充电测试',
inputType: 'file', inputType: 'file',
maxCount: 10, maxCount: 10,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '23',
label: '人桩合影', label: '人桩合影',
inputType: 'file', inputType: 'file',
maxCount: 5, maxCount: 5,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '22',
label: '安装确认', label: '安装确认',
inputType: 'file', inputType: 'file',
maxCount: 8, maxCount: 8,
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '15',
label: '安装承诺书', label: '安装承诺书',
inputType: 'file', inputType: 'file',
maxCount1: 8, maxCount1: 8,
required: false required: false
}, { }, {
fieldName: 'grassRoadLen', fieldName: '14',
label: '开挖尺寸测量', label: '开挖尺寸测量',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
required: false required: false
}, { }, {
fieldName: 'grassRoadLen', fieldName: '24',
label: '车架号', label: '车架号',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
required: false required: false
}, { }, {
fieldName: 'grassRoadLen', fieldName: '25',
label: '拨码图', label: '拨码图',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
required: false required: false
}, { }, {
fieldName: 'grassRoadLen', fieldName: '26',
label: 'WALL DOCK设备编号', label: 'WALL DOCK设备编号',
inputType: 'file', inputType: 'file',
maxCount: 1, maxCount: 1,
...@@ -306,11 +306,11 @@ const inspectData = [{ ...@@ -306,11 +306,11 @@ const inspectData = [{
title: '社区信息', title: '社区信息',
content: [{ content: [{
fieldName: 'powerRoomPropertyRightType', fieldName: 'powerRoomPropertyRightType',
otherField: [{ // otherField: [{
fieldName: 'powerRoomPropertyRightRemark', // fieldName: 'powerRoomPropertyRightRemark',
selectType: '03', // selectType: '03',
showType: 'tips' // showType: 'tips'
}], // }],
label: '配电间产权', label: '配电间产权',
inputType: 'select', inputType: 'select',
required: true, required: true,
...@@ -404,37 +404,37 @@ const inspectData = [{ ...@@ -404,37 +404,37 @@ const inspectData = [{
}, { }, {
title: '勘察照片', title: '勘察照片',
content: [{ content: [{
fieldName: 'grassRoadLen', fieldName: '07',
label: '不需要报装声明(不需要报装必填)', label: '不需要报装声明(不需要报装必填)',
inputType: 'file', inputType: 'file',
required: false required: false
}, { }, {
fieldName: 'grassRoadLen', fieldName: '01',
label: '电源点照片', label: '电源点照片',
inputType: 'file', inputType: 'file',
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '02',
label: '车位照片', label: '车位照片',
inputType: 'file', inputType: 'file',
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '03',
label: '走线示意照片', label: '走线示意照片',
inputType: 'file', inputType: 'file',
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '04',
label: '施工方案照片', label: '施工方案照片',
inputType: 'file', inputType: 'file',
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '06',
label: '纸质勘察单', label: '纸质勘察单',
inputType: 'file', inputType: 'file',
required: true required: true
}, { }, {
fieldName: 'grassRoadLen', fieldName: '08',
label: '安装收费标准', label: '安装收费标准',
inputType: 'file', inputType: 'file',
required: true required: true
...@@ -472,13 +472,13 @@ const inspectData = [{ ...@@ -472,13 +472,13 @@ const inspectData = [{
}, { }, {
fieldName: 'fireEnvFlg', fieldName: 'fireEnvFlg',
label: '环境保护和防火安全的要求', label: '环境保护和防火安全的要求',
inputType: 'switch', inputType: 'select',
required: true, required: true,
settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }] settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }]
}, { }, {
fieldName: 'elecRequireFlg', fieldName: 'elecRequireFlg',
label: '电气安全要求', label: '电气安全要求',
inputType: 'switch', inputType: 'select',
required: true, required: true,
settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }] settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }]
}, { }, {
......
...@@ -157,39 +157,52 @@ export default { ...@@ -157,39 +157,52 @@ export default {
this.orderId = orderId || '6099514' this.orderId = orderId || '6099514'
this.getList() this.getList()
}, },
formatlist(list) { formatlist(data) {
// 初始化数据 // 初始化数据
const formList = this.formatlist let allFormList = []
const dataList = list this.formList.map(item => {
const fieldNameArr = [] item.content.map(element => {
dataList.map(item => { if (element.otherField && element.otherField.length > 0) {
fieldNameArr.push(item.fieldName) allFormList = allFormList.concat(element.otherField)
} else {
allFormList.push(element)
}
})
}) })
this.fieldNameArr = fieldNameArr allFormList.map(item => {
formList.map(item => {
const idx = fieldNameArr.indexOf(item.fieldName)
if (item.otherField && item.otherField.length > 0) { if (item.otherField && item.otherField.length > 0) {
item.otherField.map(otherItem => { item.otherField.map(otherItem => {
const idx1 = fieldNameArr.indexOf(otherItem.fieldName) if (data[item.fieldName]) {
if (idx1 >= 0) { item.value = data[item.fieldName]
item.value = dataList[idx1].value
} }
}) })
} }
if (idx >= 0) { if (item.inputType === 'file') {
item.value = dataList[idx].value item.value = data.imageUrl[item.fieldName]
}
if (data[item.fieldName]) {
item.value = data[item.fieldName]
} }
}) })
}, },
async getList() { // boolean 值 Y N值 互转
let txt = '' booleanTrans(value) {
const res = await getOrderCustomizeInfo(this.orderId, this.type) if (typeof value === 'boolean') {
if (res.data.code !== 200) { return value ? 'Y' : 'N'
txt = res.data.message
} else { } else {
this.formatlist(res.data.data) if (value === 'Y') {
return true
} else if (value === 'N') {
return false
} else {
return value
}
} }
this.formatlist({ powerType: '01', highPowerFlg: 'N', reportInstallFlg: 'Y', elecGroundType: '01', circuitBreakerWireSize: '10', circuitBreakerCapacity: '10', powerPointWireSize: '10', installableBreaker: '10', installableWireSize: '01', actualVoltage: '10', actualCurrent: '10', resistanceGround: '10', cableLen: '10', powerRoomPropertyRightType: '01', powerRoomChargingType: '01', propertyAgreementFlg: 'Y', openSlotLen: '10', highLen: '5', highWorkLen: '', installType: '01', portType: '01', signalType: ['01', '02', '03', '04'], inspectConclusionType: '01' }) },
async getList() {
const txt = ''
this.formatlist({ imageUrl: { '07': ['http://localhost:8182/wxh-cloud-rest/rest/file/image/common/6099514/invoice_1615028604596613.png', 'http://localhost:8182/wxh-cloud-rest/rest/file/image/common/6099514/invoice_1615028617807600.png'], '01': ['http://localhost:8182/wxh-cloud-rest/rest/file/image/common/6099514/invoice_1615028606706945.png'] }, powerType: '01', highPowerFlg: 'N', reportInstallFlg: 'Y', elecGroundType: '01', circuitBreakerWireSize: '10', circuitBreakerCapacity: '10', powerPointWireSize: '10', installableBreaker: '10', installableWireSize: '01', actualVoltage: '10', actualCurrent: '10', resistanceGround: '10', cableLen: '10', powerRoomPropertyRightType: '03', powerRoomChargingType: '01', propertyAgreementFlg: 'Y', grassRoadLen: '111', cementRoadLen: '222', pitchRoadLen: '333', otherRoadLen: '555', openPoreLen: '20', openPoreNum: '4', openSlotLen: '10', highLen: '5', highWorkLen: '666', botenL: '11', botenW: '12', botenH: '13', otherWorkRemark: '777', installType: '01', portType: '01', fireEnvFlg: 'Y', elecRequireFlg: 'Y', signalType: ['03', '02', '01'], inspectConclusionType: '01' })
this.loading = false this.loading = false
Indicator.close() Indicator.close()
if (txt !== '') { if (txt !== '') {
...@@ -201,10 +214,18 @@ export default { ...@@ -201,10 +214,18 @@ export default {
} }
}, },
submitInfo() { submitInfo() {
const data = {} const data = { imageUrl: {}}
this.formList.map(item => { this.formList.map(item => {
item.content.map(element => { item.content.map(element => {
data[element.fieldName] = element.value if (element.otherField && element.otherField.length > 0) {
element.otherField.map(otherElement => {
data[otherElement.fieldName] = otherElement.value
})
} else if (element.inputType === 'file') { // 图片路径到 imageUrl中
data.imageUrl[element.fieldName] = element.value
} else {
data[element.fieldName] = element.value
}
}) })
}) })
console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment