|
@@ -4,12 +4,13 @@
|
|
|
<div class='flex item full-width'>
|
|
<div class='flex item full-width'>
|
|
|
<el-form-item class='full-width '>
|
|
<el-form-item class='full-width '>
|
|
|
<template v-slot:label>
|
|
<template v-slot:label>
|
|
|
- <div class='label white-bg full-width padding-left text-left bold'>
|
|
|
|
|
|
|
+ <div class='label light-red-bg full-width padding-left text-left bold' >
|
|
|
{{ item.label }}
|
|
{{ item.label }}
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width text-left flex full-width'>
|
|
<div class='full-width text-left flex full-width'>
|
|
|
- <input v-model='form[item.prop]' :disabled='disable' :placeholder='`请输入` + item.label'
|
|
|
|
|
|
|
+ <input v-model='editData[item.prop]' :disabled='disable' :placeholder='`请输入` + item.label'
|
|
|
|
|
+ @change='change($event,item)'
|
|
|
class='full-width'/>
|
|
class='full-width'/>
|
|
|
<el-icon v-if='!disable' class="padding-right">
|
|
<el-icon v-if='!disable' class="padding-right">
|
|
|
<edit/>
|
|
<edit/>
|
|
@@ -30,10 +31,11 @@
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
- <textarea v-model='form[item.prop]' :disabled='disable'
|
|
|
|
|
|
|
+ <textarea v-model='editData[item.prop]' :disabled='disable'
|
|
|
:placeholder='`请输入` + item.label'
|
|
:placeholder='`请输入` + item.label'
|
|
|
:style='`height:` + item.rows * 35 + `px`'
|
|
:style='`height:` + item.rows * 35 + `px`'
|
|
|
class='full-width padding-right full-height padding-top'
|
|
class='full-width padding-right full-height padding-top'
|
|
|
|
|
+ @change='change($event,item)'
|
|
|
style='line-height:20px;resize:none '/>
|
|
style='line-height:20px;resize:none '/>
|
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
|
<edit/>
|
|
<edit/>
|
|
@@ -54,7 +56,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
- <el-select v-model="item.data" class="m-2" :placeholder="`请选择${item.label}`" @change='change'>
|
|
|
|
|
|
|
+ <el-select v-model="editData[item.prop]" class="m-2" :placeholder="`请选择${item.label}`"
|
|
|
|
|
+ @change='change($event,item)'>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in item.dict"
|
|
v-for="item in item.dict"
|
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -80,7 +83,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
- <el-select v-model="item.data" class="m-2" :placeholder="`请选择${item.label}`" @change='change'>
|
|
|
|
|
|
|
+ <el-select class="m-2" :placeholder="`请选择${item.label}`" @change='change($event,item)'
|
|
|
|
|
+ :disabled='disable'>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in item.dict"
|
|
v-for="item in item.dict"
|
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -101,12 +105,13 @@
|
|
|
<template v-slot:label>
|
|
<template v-slot:label>
|
|
|
<div :style='`height:` + item.rows * 35 + `px`'
|
|
<div :style='`height:` + item.rows * 35 + `px`'
|
|
|
class='label white-bg full-width text-left padding-left bold'>
|
|
class='label white-bg full-width text-left padding-left bold'>
|
|
|
- {{ item.label }}{{item.type}}
|
|
|
|
|
|
|
+ {{ item.label }}{{ item.type }}
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
- <el-cascader :options="item.dict" class="m-2" :placeholder="`请选择${item.label}`" @change='change'>
|
|
|
|
|
|
|
+ <el-cascader ref='area' :options="item.dict" v-model="editData[item.prop]" :disabled='disable' class="m-2"
|
|
|
|
|
+ :placeholder="`请选择${item.label}`" @change='change($event,item)'>
|
|
|
</el-cascader>
|
|
</el-cascader>
|
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
|
<edit/>
|
|
<edit/>
|
|
@@ -115,20 +120,51 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
-<!-- -->
|
|
|
|
|
|
|
+ <!-- daterange -->
|
|
|
<el-col v-if='item.type ==="daterange" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
|
|
<el-col v-if='item.type ==="daterange" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
|
|
|
<div class='flex item full-width'>
|
|
<div class='flex item full-width'>
|
|
|
<el-form-item class='full-width '>
|
|
<el-form-item class='full-width '>
|
|
|
<template v-slot:label>
|
|
<template v-slot:label>
|
|
|
<div :style='`height:` + item.rows * 35 + `px`'
|
|
<div :style='`height:` + item.rows * 35 + `px`'
|
|
|
class='label white-bg full-width text-left padding-left bold'>
|
|
class='label white-bg full-width text-left padding-left bold'>
|
|
|
- {{ item.label }}{{item.type}}
|
|
|
|
|
|
|
+ {{ item.label }}{{ item.type }}
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
<div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
- <el-cascader :options="item.dict" class="m-2" :placeholder="`请选择${item.label}`" @change='change'>
|
|
|
|
|
- </el-cascader>
|
|
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="editData[item.prop]"
|
|
|
|
|
+ :disabled='disable'
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ @change='change($event,item)'
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder='结束日期'
|
|
|
|
|
+ value-format='YYYY-MM-DD'
|
|
|
|
|
+ format='YYYY-MM-DD'
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-icon v-if='!disable' class="padding-right padding-top">
|
|
|
|
|
+ <edit/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <!--number-->
|
|
|
|
|
+ <el-col v-if='item.type ==="number" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
|
|
|
|
|
+ <div class='flex item full-width'>
|
|
|
|
|
+ <el-form-item class='full-width '>
|
|
|
|
|
+ <template v-slot:label>
|
|
|
|
|
+ <div :style='`height:` + item.rows * 35 + `px`'
|
|
|
|
|
+ class='label white-bg full-width text-left padding-left bold'>
|
|
|
|
|
+ {{ item.label }}{{ item.type }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <div class='full-width flex flex-align-start full-height text-left full-width'
|
|
|
|
|
+ style='white-space: pre-wrap;text-overflow: ellipsis;'>
|
|
|
|
|
+ <el-input-number v-model='editData[item.prop]' :disabled='disable'
|
|
|
|
|
+ :placeholder='`请输入` + item.label' step='2'
|
|
|
|
|
+ @change='change($event,item)'></el-input-number>
|
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
<el-icon v-if='!disable' class="padding-right padding-top">
|
|
|
<edit/>
|
|
<edit/>
|
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -189,30 +225,68 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
immediate: true
|
|
immediate: true
|
|
|
|
|
+ },
|
|
|
|
|
+ form: {
|
|
|
|
|
+ handler (val) {
|
|
|
|
|
+ this.editData = val
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true
|
|
|
|
|
+ },
|
|
|
|
|
+ editData: {
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ immediate: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
data: {},
|
|
data: {},
|
|
|
- dic: []
|
|
|
|
|
|
|
+ dic: [],
|
|
|
|
|
+ editData: null
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
async getDic (expand) {
|
|
async getDic (expand) {
|
|
|
|
|
+ const local = localStorage.getItem('lazy-list')
|
|
|
|
|
+ if (local) {
|
|
|
|
|
+ return JSON.parse(local)
|
|
|
|
|
+ }
|
|
|
const tmp = await this.$api.common.basicFormRequest(expand.dict)
|
|
const tmp = await this.$api.common.basicFormRequest(expand.dict)
|
|
|
- return tmp.data.map(item => this.mapTree(item, expand))
|
|
|
|
|
|
|
+ const result = tmp.data.map(item => this.mapTree(item, expand))
|
|
|
|
|
+ localStorage.setItem('lazy-list', JSON.stringify(result))
|
|
|
|
|
+ return result
|
|
|
},
|
|
},
|
|
|
mapTree (item, expand) {
|
|
mapTree (item, expand) {
|
|
|
const haveChildren = Array.isArray(item.children) && item.children.length > 0
|
|
const haveChildren = Array.isArray(item.children) && item.children.length > 0
|
|
|
return {
|
|
return {
|
|
|
- key: item.id,
|
|
|
|
|
|
|
+ key: item.label,
|
|
|
value: item[expand.props.value],
|
|
value: item[expand.props.value],
|
|
|
label: item[expand.props.label],
|
|
label: item[expand.props.label],
|
|
|
children: haveChildren ? item.children.map(i => this.mapTree(i, expand)) : []
|
|
children: haveChildren ? item.children.map(i => this.mapTree(i, expand)) : []
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- change (res) {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
|
|
+ change (res, item) {
|
|
|
|
|
+ if (item.type === 'area') {
|
|
|
|
|
+ this.editData[item.prop] = res[0]
|
|
|
|
|
+ const tmp = this.$refs.area.getCheckedNodes()[0].pathLabels
|
|
|
|
|
+ const keys = Object.keys(res)
|
|
|
|
|
+ if (keys.length === 3) {
|
|
|
|
|
+ this.editData.provinceCode = res[0]
|
|
|
|
|
+ this.editData.province = tmp[0]
|
|
|
|
|
+ this.editData.cityCode = res[1]
|
|
|
|
|
+ this.editData.city = tmp[1]
|
|
|
|
|
+ this.editData.districtCode = res[2]
|
|
|
|
|
+ this.editData.district = tmp[2]
|
|
|
|
|
+ } else if (keys.length === 2) {
|
|
|
|
|
+ this.editData.provinceCode = res[0]
|
|
|
|
|
+ this.editData.province = tmp[0]
|
|
|
|
|
+ this.editData.cityCode = res[1]
|
|
|
|
|
+ this.editData.city = res[1]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.editData.provinceCode = res[0]
|
|
|
|
|
+ this.editData.province = res[0]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$emit('change', this.editData)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -220,6 +294,35 @@ export default {
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style scoped>
|
|
|
|
|
|
|
+<style lang='scss' scoped>
|
|
|
|
|
+.form {
|
|
|
|
|
+ border-right: #CCCFCE solid 1px;
|
|
|
|
|
+ border-left: #CCCFCE solid 1px;
|
|
|
|
|
+ border-bottom: #CCCFCE solid 1px;
|
|
|
|
|
+
|
|
|
|
|
+ .item {
|
|
|
|
|
+ :deep(.el-form-item--default) {
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .label {
|
|
|
|
|
+ padding-right: 10px;
|
|
|
|
|
+ border-right: #CCCFCE solid 1px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .sub-item {
|
|
|
|
|
+ border-left: #CCCFCE solid 1px;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ .sub-item:first-child {
|
|
|
|
|
+ border-left: none;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.form:first-child {
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ border: #CCCFCE solid 1px;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|