更新
This commit is contained in:
@@ -11,44 +11,29 @@
|
|||||||
<div class="generalDetails_card_container">
|
<div class="generalDetails_card_container">
|
||||||
<div v-for="(item, index) in dataPage" :key="index">
|
<div v-for="(item, index) in dataPage" :key="index">
|
||||||
<el-card class="generalDetails_card">
|
<el-card class="generalDetails_card">
|
||||||
<div
|
<div @click="isShow(item)" class="generalDetails_card_header" slot="header">
|
||||||
@click="isShow(item)"
|
|
||||||
class="generalDetails_card_header"
|
|
||||||
slot="header"
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<span class="generalDetails-card-header-icon">
|
<span class="generalDetails-card-header-icon">
|
||||||
<svg-icon style="color: #118dde" :icon-class="item.iconClass" />
|
<svg-icon style="color: #118dde" :icon-class="item.iconClass" />
|
||||||
</span>
|
</span>
|
||||||
<span class="generalDetails-card-header-text">{{
|
<span class="generalDetails-card-header-text">{{ item.title }}</span>
|
||||||
item.title
|
|
||||||
}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="fold">
|
<div class="fold">
|
||||||
<i
|
<i
|
||||||
:style="{
|
:style="{
|
||||||
transform: `rotate(${item.isFold ? 0 : 180}deg)`,
|
transform: `rotate(${item.isFold ? 0 : 180}deg)`
|
||||||
}"
|
}"
|
||||||
class="el-icon-arrow-down generalDetails_card_arrow_down"
|
class="el-icon-arrow-down generalDetails_card_arrow_down"
|
||||||
></i>
|
></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div :style="{ maxHeight: item.isFold ? '100vh' : '0px' }" class="my-cell">
|
||||||
:style="{ maxHeight: item.isFold ? '100vh' : '0px' }"
|
<template v-if="item.listData.length && item.listData[0].field !== 'table'">
|
||||||
class="my-cell"
|
|
||||||
>
|
|
||||||
<template
|
|
||||||
v-if="item.listData.length && item.listData[0].field !== 'table'"
|
|
||||||
>
|
|
||||||
<div v-for="(i, x) in item.listData" :key="x" class="cell-item">
|
<div v-for="(i, x) in item.listData" :key="x" class="cell-item">
|
||||||
<span :title="i.remark" class="color-999 test-tst">
|
<span :title="i.remark" class="color-999 test-tst">
|
||||||
{{ i.label }}
|
{{ i.label }}
|
||||||
<i v-if="i.remark" class="header-icon el-icon-info"></i>
|
<i v-if="i.remark" class="header-icon el-icon-info"></i>
|
||||||
<i
|
<i @click="isCopy($event)" v-if="i.isCopy" class="el-icon-document-copy"></i>
|
||||||
@click="isCopy($event)"
|
|
||||||
v-if="i.isCopy"
|
|
||||||
class="el-icon-document-copy"
|
|
||||||
></i>
|
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<slot class="inner-data" :name="`${i.field}`">
|
<slot class="inner-data" :name="`${i.field}`">
|
||||||
@@ -74,98 +59,70 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import handleClipboard from "@/utils/clipboard.js";
|
import handleClipboard from '@/utils/clipboard.js'
|
||||||
export default {
|
export default {
|
||||||
name: "generalDetails",
|
name: 'generalDetails',
|
||||||
props: {
|
props: {
|
||||||
sourceData: {
|
sourceData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => []
|
||||||
},
|
},
|
||||||
mappingData: {
|
mappingData: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => []
|
||||||
},
|
},
|
||||||
isHeader: {
|
isHeader: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "默认详情头",
|
default: '默认详情头'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dataPage: [],
|
dataPage: []
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// return console.log("this.sourceData", this.sourceData);
|
this.sourceData && this.mappingData.length && this.init()
|
||||||
this.sourceData !== null && this.mappingData.length !== 0 && this.init();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isShow(item) {
|
isShow(item) {
|
||||||
item.isFold = !item.isFold;
|
item.isFold = !item.isFold
|
||||||
},
|
},
|
||||||
isCopy(event) {
|
isCopy(event) {
|
||||||
handleClipboard(event);
|
handleClipboard(event)
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.$emit("close");
|
this.$emit('close')
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
this.dataPage = this.mappingData.map(
|
this.dataPage = this.mappingData.map((mappingDataItem, mappingDataIndex) => {
|
||||||
(mappingDataItem, mappingDataIndex) => {
|
let shineData = this.sourceData[mappingDataIndex] || {}
|
||||||
let shineData = this.sourceData[mappingDataIndex] || {};
|
|
||||||
return {
|
return {
|
||||||
title: mappingDataItem.carTitle,
|
title: mappingDataItem.carTitle,
|
||||||
iconClass: mappingDataItem.iconClass || "iconjichuziliao",
|
iconClass: mappingDataItem.iconClass || 'iconjichuziliao',
|
||||||
isFold: mappingDataItem.isFold || true,
|
isFold: mappingDataItem.isFold || true,
|
||||||
listData: mappingDataItem.carItems.map((carItem) => {
|
listData: mappingDataItem.carItems.map(carItem => {
|
||||||
let value =
|
let value =
|
||||||
(typeof carItem.value == "function" &&
|
(typeof carItem.value == 'function' && carItem.value(shineData)) || shineData[carItem.value] == 0
|
||||||
carItem.value(shineData)) ||
|
|
||||||
shineData[carItem.value] == 0
|
|
||||||
? 0
|
? 0
|
||||||
: shineData[carItem.value] || carItem.fieldDefault || "";
|
: shineData[carItem.value] || carItem.fieldDefault || ''
|
||||||
return {
|
return {
|
||||||
label: carItem.label,
|
label: carItem.label,
|
||||||
value: value,
|
value: value,
|
||||||
field: carItem.value,
|
field: carItem.value,
|
||||||
remark: carItem.remark,
|
remark: carItem.remark,
|
||||||
isCopy: carItem.isCopy || false,
|
isCopy: carItem.isCopy || false
|
||||||
};
|
}
|
||||||
}),
|
})
|
||||||
};
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
console.log("this.dataPage", this.dataPage);
|
|
||||||
return;
|
|
||||||
this.dataPage = this.mappingData.map((item, index) => {
|
|
||||||
return {
|
|
||||||
title: item.carTitle,
|
|
||||||
iconClass: item.iconClass || "iconjichuziliao",
|
|
||||||
isFold: item.isFold || true,
|
|
||||||
listData: item.carItems.map((carItem) => {
|
|
||||||
return {
|
|
||||||
label: carItem.label,
|
|
||||||
value:
|
|
||||||
(typeof carItem.value == "function" &&
|
|
||||||
carItem.value(this.sourceData[index])) ||
|
|
||||||
this.sourceData[index][carItem.value] ||
|
|
||||||
carItem.fieldDefault ||
|
|
||||||
"暂无数据",
|
|
||||||
field: carItem.value,
|
|
||||||
remark: carItem.remark,
|
|
||||||
isCopy: carItem.isCopy || false,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user