功能变化: value值展示组件优化

pull/102/MERGE
李强 2023-07-10 10:43:30 +08:00
parent 9c8d057fe6
commit b98e2ac341
1 changed files with 15 additions and 7 deletions

View File

@ -18,10 +18,10 @@
{{ item[dict.label] }} {{ item[dict.label] }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-button type="primary" plain size="mini" slot="reference"><span> {{ value.length }} {{ elProps.unit }}</span> <el-button type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{ value.length }} {{ elProps.unit }}</span>
</el-button> </el-button>
</el-popover> </el-popover>
<el-button v-else type="primary" plain size="mini" slot="reference"><span> {{ <el-button v-else type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{
value.length value.length
}} {{ elProps.unit }}</span> }} {{ elProps.unit }}</span>
</el-button> </el-button>
@ -46,10 +46,10 @@
@show="showEvents" @show="showEvents"
@hide="show=false"> @hide="show=false">
<div v-html="value" v-if="show"></div> <div v-html="value" v-if="show"></div>
<el-button type="primary" plain size="mini" slot="reference"><span>预览</span> <el-button type="primary" plain size="mini" slot="reference" @click="previewClick"><span>预览</span>
</el-button> </el-button>
</el-popover> </el-popover>
<el-button v-else type="primary" plain size="mini" slot="reference"><span>预览</span> <el-button v-else type="primary" plain size="mini" slot="reference" @click="previewClick"><span>预览</span>
</el-button> </el-button>
</div> </div>
</div> </div>
@ -125,7 +125,9 @@ export default {
if (this.value.constructor === Array) { if (this.value.constructor === Array) {
const ids = [] const ids = []
this.value.map(res => { this.value.map(res => {
if (res) {
ids.push(res[this.dict.value]) ids.push(res[this.dict.value])
}
}) })
params[this.dict.value] = ids params[this.dict.value] = ids
} else { } else {
@ -135,12 +137,18 @@ export default {
request({ url: this.dict.url, params: params }).then(ret => { request({ url: this.dict.url, params: params }).then(ret => {
this.data = ret.data.data || ret.data this.data = ret.data.data || ret.data
}) })
},
previewClick () {
this.$emit('previewClick')
},
listClick () {
this.$emit('listClick')
} }
} }
} }
</script> </script>
<style > <style>
.userprjtreepop{ .userprjtreepop {
width: 80%; width: 80%;
overflow-x: auto; overflow-x: auto;
max-height: 80%; max-height: 80%;