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

桩到家界面交互

parent e3f10488
......@@ -5,10 +5,8 @@
<div class="input-box img-box">
<div :key="index" class="img-item" v-for="(item, index) in imgList">
<img :src="item.url" />
<!-- <p>{{item.title}}</p> -->
<div class="close" @click="deleteImg(index)">
x
<!-- <img src="@/assets/img/close.png" alt /> -->
</div>
</div>
<img-uploader
......@@ -25,6 +23,7 @@ import ImgUploader from '@/components/uploader/img-uploader'
import {
uploadFile
} from '@/api/shzhida/order/service'
import { Toast } from 'mint-ui'
export default {
name: 'XhFiles',
components: {
......@@ -61,15 +60,34 @@ export default {
},
watch: {
},
mounted() {
if (this.item.value && this.item.value.length > 0) {
this.item.value.map(item => {
this.imgList.push({ src: item })
})
}
},
methods: {
async uploadFile(item) {
const data = {
file: item.file
console.log(item)
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) {
this.imgList.push(item)
......
......@@ -52,6 +52,9 @@ export default {
},
watch: {
},
mounted() {
if (this.item.value) { this.value = this.item.value }
},
methods: {
getName(value) {
......@@ -60,12 +63,10 @@ export default {
return ''
}
const settings = this.item.settings || []
console.log(settings, 'settings')
const resultArr = settings.filter(item => {
return item.value === value
})
result = resultArr.length > 0 && resultArr[0].label
console.log(result, 'result')
return result
},
cancel() {
......
......@@ -3,7 +3,7 @@
<div class="label">{{item.label}}</div>
<div class="required" v-if="item.required">*</div>
<div class="input-box">
<mt-switch v-model="value"></mt-switch>
<mt-switch v-model="item.value"></mt-switch>
</div>
</div>
......
<template>
<div class="input-item">
<div class="label">数值<span class="required">*</span></div>
<div class="label"><span class="required">*</span></div>
<div class="input-box">
<textarea
v-model="value"
......
......@@ -55,109 +55,109 @@ const installData = [{
}, {
title: '安装照片',
content: [{
fieldName: 'grassRoadLen',
fieldName: '09',
label: '电缆',
inputType: 'file',
maxCount: 5,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '10',
label: '管材',
inputType: 'file',
maxCount: 1,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '11',
label: '安全施工标识',
inputType: 'file',
maxCount: 1,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '12',
label: '充电桩配件',
inputType: 'file',
maxCount: 2,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '18',
label: '充电桩编号',
inputType: 'file',
maxCount: 10,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '19',
label: '电源点照片',
inputType: 'file',
maxCount: 10,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '17',
label: '敷设路径',
inputType: 'file',
maxCount: 15,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '13',
label: '充电桩上端电源接线',
inputType: 'file',
maxCount: 10,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '20',
label: '内部接线',
inputType: 'file',
maxCount: 5,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '21',
label: '充电桩上电',
inputType: 'file',
maxCount: 15,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '16',
label: '充电测试',
inputType: 'file',
maxCount: 10,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '23',
label: '人桩合影',
inputType: 'file',
maxCount: 5,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '22',
label: '安装确认',
inputType: 'file',
maxCount: 8,
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '15',
label: '安装承诺书',
inputType: 'file',
maxCount1: 8,
required: false
}, {
fieldName: 'grassRoadLen',
fieldName: '14',
label: '开挖尺寸测量',
inputType: 'file',
maxCount: 1,
required: false
}, {
fieldName: 'grassRoadLen',
fieldName: '24',
label: '车架号',
inputType: 'file',
maxCount: 1,
required: false
}, {
fieldName: 'grassRoadLen',
fieldName: '25',
label: '拨码图',
inputType: 'file',
maxCount: 1,
required: false
}, {
fieldName: 'grassRoadLen',
fieldName: '26',
label: 'WALL DOCK设备编号',
inputType: 'file',
maxCount: 1,
......@@ -306,11 +306,11 @@ const inspectData = [{
title: '社区信息',
content: [{
fieldName: 'powerRoomPropertyRightType',
otherField: [{
fieldName: 'powerRoomPropertyRightRemark',
selectType: '03',
showType: 'tips'
}],
// otherField: [{
// fieldName: 'powerRoomPropertyRightRemark',
// selectType: '03',
// showType: 'tips'
// }],
label: '配电间产权',
inputType: 'select',
required: true,
......@@ -404,37 +404,37 @@ const inspectData = [{
}, {
title: '勘察照片',
content: [{
fieldName: 'grassRoadLen',
fieldName: '07',
label: '不需要报装声明(不需要报装必填)',
inputType: 'file',
required: false
}, {
fieldName: 'grassRoadLen',
fieldName: '01',
label: '电源点照片',
inputType: 'file',
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '02',
label: '车位照片',
inputType: 'file',
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '03',
label: '走线示意照片',
inputType: 'file',
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '04',
label: '施工方案照片',
inputType: 'file',
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '06',
label: '纸质勘察单',
inputType: 'file',
required: true
}, {
fieldName: 'grassRoadLen',
fieldName: '08',
label: '安装收费标准',
inputType: 'file',
required: true
......@@ -472,13 +472,13 @@ const inspectData = [{
}, {
fieldName: 'fireEnvFlg',
label: '环境保护和防火安全的要求',
inputType: 'switch',
inputType: 'select',
required: true,
settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }]
}, {
fieldName: 'elecRequireFlg',
label: '电气安全要求',
inputType: 'switch',
inputType: 'select',
required: true,
settings: [{ value: 'Y', label: '符合' }, { value: 'N', label: '不符合' }]
}, {
......
......@@ -157,39 +157,52 @@ export default {
this.orderId = orderId || '6099514'
this.getList()
},
formatlist(list) {
formatlist(data) {
// 初始化数据
const formList = this.formatlist
const dataList = list
const fieldNameArr = []
dataList.map(item => {
fieldNameArr.push(item.fieldName)
let allFormList = []
this.formList.map(item => {
item.content.map(element => {
if (element.otherField && element.otherField.length > 0) {
allFormList = allFormList.concat(element.otherField)
} else {
allFormList.push(element)
}
})
})
this.fieldNameArr = fieldNameArr
formList.map(item => {
const idx = fieldNameArr.indexOf(item.fieldName)
allFormList.map(item => {
if (item.otherField && item.otherField.length > 0) {
item.otherField.map(otherItem => {
const idx1 = fieldNameArr.indexOf(otherItem.fieldName)
if (idx1 >= 0) {
item.value = dataList[idx1].value
if (data[item.fieldName]) {
item.value = data[item.fieldName]
}
})
}
if (idx >= 0) {
item.value = dataList[idx].value
if (item.inputType === 'file') {
item.value = data.imageUrl[item.fieldName]
}
if (data[item.fieldName]) {
item.value = data[item.fieldName]
}
})
},
async getList() {
let txt = ''
const res = await getOrderCustomizeInfo(this.orderId, this.type)
if (res.data.code !== 200) {
txt = res.data.message
// boolean 值 Y N值 互转
booleanTrans(value) {
if (typeof value === 'boolean') {
return value ? 'Y' : 'N'
} 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
Indicator.close()
if (txt !== '') {
......@@ -201,10 +214,18 @@ export default {
}
},
submitInfo() {
const data = {}
const data = { imageUrl: {}}
this.formList.map(item => {
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))
......
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