Merge branch 'build' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into build
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="configItem">
|
<section class="configItem" :class="{topLabel}">
|
||||||
<label v-text="label"/>
|
<label v-text="label"/>
|
||||||
<div class="content fill">
|
<div class="content fill">
|
||||||
<slot v-if="$slots.default"/>
|
<slot v-if="$slots.default"/>
|
||||||
@@ -12,12 +12,9 @@ export default {
|
|||||||
name: "configItem",
|
name: "configItem",
|
||||||
props: {
|
props: {
|
||||||
label: String,
|
label: String,
|
||||||
value: {default: null}
|
value: {default: null},
|
||||||
|
topLabel: Boolean
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
methods: {},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -27,6 +24,7 @@ export default {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@@ -52,7 +50,7 @@ export default {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-select,.ai-select {
|
.el-select, .ai-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -82,5 +80,20 @@ export default {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.topLabel {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: normal;
|
||||||
|
|
||||||
|
& > label {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 100%;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,14 +11,7 @@
|
|||||||
</ai-dialog-btn>
|
</ai-dialog-btn>
|
||||||
</div>
|
</div>
|
||||||
<template v-else-if="source.dataType === 'staticData'">
|
<template v-else-if="source.dataType === 'staticData'">
|
||||||
<config-item label="设置列" class="tableStyle">
|
<table-editor label="设置数据" v-model="tableData" :configs.sync="colConfigs" @data="changeData"/>
|
||||||
<div class="fill">
|
|
||||||
<table-editor v-model="colConfigs" :configs="[{field:'field',headerName:'属性',width:100},{field:'headerName',headerName:'名称',width:100}]"/>
|
|
||||||
</div>
|
|
||||||
</config-item>
|
|
||||||
<config-item label="设置数据" class="tableStyle" v-if="colConfigs.length>0">
|
|
||||||
<table-editor v-model="content" :configs="colConfigs"/>
|
|
||||||
</config-item>
|
|
||||||
</template>
|
</template>
|
||||||
<config-item v-else-if="source.dataType === 'dynamicData'" label="数据源">
|
<config-item v-else-if="source.dataType === 'dynamicData'" label="数据源">
|
||||||
<ai-select v-model="source.sourceDataId" placeholder="请选择数据源" :instance="instance"
|
<ai-select v-model="source.sourceDataId" placeholder="请选择数据源" :instance="instance"
|
||||||
@@ -57,6 +50,7 @@ export default {
|
|||||||
dataTypes: Object.entries(DvCompData.types).map(e => ({id: e[0], label: e[1]})),
|
dataTypes: Object.entries(DvCompData.types).map(e => ({id: e[0], label: e[1]})),
|
||||||
content: "",
|
content: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
|
tableData: [],
|
||||||
colConfigs: []
|
colConfigs: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -78,8 +72,27 @@ export default {
|
|||||||
new DvCompData(this.source.dataType, this.source, this.instance).getData().then(data => {
|
new DvCompData(this.source.dataType, this.source, this.instance).getData().then(data => {
|
||||||
this.source[this.source.dataType] = data
|
this.source[this.source.dataType] = data
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
initStaticDataProps() {
|
||||||
|
const columnProp = "name"
|
||||||
|
this.options.staticData.map((row, i) => {
|
||||||
|
const prop = `c${i || ""}`
|
||||||
|
this.colConfigs.push({label: row[columnProp], prop})
|
||||||
|
Object.entries(row).map(([k, v]) => {
|
||||||
|
if (/^v/.test(k)) {
|
||||||
|
const item = this.tableData[k.substring(1) || 0] || {}
|
||||||
|
item[prop] = v
|
||||||
|
this.tableData[k.substring(1) || 0] = item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.tableData = this.tableData.map(e => ({...e, $cellEdit: false}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
//新版静态数据
|
||||||
|
this.initStaticDataProps()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -88,9 +101,5 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tableStyle {
|
|
||||||
align-items: normal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
console.log(window.AVUE)
|
|
||||||
export default {
|
export default {
|
||||||
name: "tableEditor",
|
name: "tableEditor",
|
||||||
model: {
|
model: {
|
||||||
@@ -9,34 +8,126 @@ export default {
|
|||||||
prop: "tableData"
|
prop: "tableData"
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
label: String,
|
||||||
tableData: {default: () => []},
|
tableData: {default: () => []},
|
||||||
configs: {default: () => []}
|
configs: {default: () => []}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
records: []
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
columns: v => v.configs
|
option() {
|
||||||
|
return {
|
||||||
|
size: 'mini',
|
||||||
|
filterDic: true,
|
||||||
|
cellBtn: true,
|
||||||
|
menuWidth: 120,
|
||||||
|
addBtn: false,
|
||||||
|
columnBtn: false,
|
||||||
|
refreshBtn: false,
|
||||||
|
border: true,
|
||||||
|
delBtnText: " ",
|
||||||
|
editBtnText: " ",
|
||||||
|
saveBtnText: " ",
|
||||||
|
saveBtnIcon: "el-icon-check",
|
||||||
|
cancelBtnText: " ",
|
||||||
|
cancelBtnIcon: "el-icon-close",
|
||||||
|
column: this.configs.map(e => {
|
||||||
|
const item = this.$copy(e)
|
||||||
|
delete item.$index
|
||||||
|
delete item.$cellEdit
|
||||||
|
return {...item, cell: true}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
rowSave(form, done) {
|
||||||
|
this.$emit("input", this.records)
|
||||||
|
this.$emit("data", this.getFormatData())
|
||||||
|
done()
|
||||||
|
},
|
||||||
|
getFormatData() {
|
||||||
|
return this.configs.map((c, i) => {
|
||||||
|
const item = {name: c.label}
|
||||||
|
this.records.map((row, j) => item[`v${j || ""}`] = row[`c${i || ""}`])
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
Vue.use(window.AVUE, {
|
Vue.use(window.AVUE, {
|
||||||
size: 'small',
|
size: 'mini',
|
||||||
tableSize: 'small',
|
tableSize: 'mini',
|
||||||
calcHeight: 48,
|
calcHeight: 36,
|
||||||
})
|
})
|
||||||
|
this.records = this.tableData.map(e => ({$cellEdit: true, ...e}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="tableEditor">
|
<section class="tableEditor">
|
||||||
<avue-crud/>
|
<avue-crud :option="option" :data="records" @row-save="rowSave" @row-cancel="rowSave">
|
||||||
|
<template v-if="label" v-slot:menuLeft>
|
||||||
|
<div class="label" v-text="label"/>
|
||||||
|
</template>
|
||||||
|
<template v-slot:menuRight>
|
||||||
|
<div class="el-icon-plus pointer" @click="records.push({$cellEdit: true})">增加数据</div>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.tableEditor {
|
.tableEditor {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
.ag-theme-balham {
|
:deep(.avue-crud__body) {
|
||||||
height: 300px;
|
background-color: transparent;
|
||||||
|
|
||||||
|
.avue-crud__header, .el-table, tr {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avue-crud__header {
|
||||||
|
min-height: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table__cell {
|
||||||
|
color: white;
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
|
input:disabled {
|
||||||
|
background-color: transparent;
|
||||||
|
border-color: transparent;
|
||||||
|
color: white;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 60px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon-plus {
|
||||||
|
font-size: 12px;
|
||||||
|
color: $primaryColor;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user