@@ -1,9 +1,9 @@ | |||
<template> | |||
<n-switch v-bind="getSwitchProps" v-model:value="switchVlue" @update:value="changeValue" /> | |||
<n-switch v-bind="getSwitchProps" v-model:value="getSwitchValue" @update:value="changeValue" /> | |||
</template> | |||
<script> | |||
import { defineComponent, ref, unref, computed } from 'vue' | |||
import { defineComponent, unref, computed } from 'vue' | |||
export default defineComponent({ | |||
name: 'TableSwitch', | |||
props: { | |||
@@ -18,10 +18,16 @@ export default defineComponent({ | |||
}, | |||
emits: ['change'], | |||
setup(props, { emit }) { | |||
const switchVlue = ref() | |||
const { data, rowKey } = unref(props) | |||
switchVlue.value = rowKey ? data[rowKey] : data | |||
// const switchValue = ref() | |||
// const { data, rowKey } = unref(props) | |||
// switchValue.value = rowKey ? data[rowKey] : data | |||
const getSwitchValue = computed(() => { | |||
const { data, rowKey } = unref(props) | |||
const value = rowKey ? data[rowKey] : data | |||
return value | |||
}) | |||
const getSwitchProps = computed(() => { | |||
console.log(111) | |||
return { | |||
...unref(props) | |||
} | |||
@@ -35,7 +41,8 @@ export default defineComponent({ | |||
emit('change', params) | |||
} | |||
return { | |||
switchVlue, | |||
// switchValue, | |||
getSwitchValue, | |||
getSwitchProps, | |||
changeValue | |||
} |
@@ -10,9 +10,11 @@ | |||
<!-- 基本信息 --> | |||
<div class="cont"> | |||
<n-descriptions label-placement="left" label-align="right" :column="4" title="任务基本信息"> | |||
<n-descriptions-item v-for="(it, i) in (basicInfo.slice(0, -1))" :key="i + it.label" :label="it.label"> | |||
{{ it.value }} | |||
</n-descriptions-item> | |||
<template v-for="(it, i) in (basicInfo.slice(0, -1))" :key="i + it.label"> | |||
<n-descriptions-item v-if="!it.isShow" :label="it.label"> | |||
{{ it.value }} | |||
</n-descriptions-item> | |||
</template> | |||
</n-descriptions> | |||
<!-- 为了格式,折腾 --> | |||
<n-descriptions label-placement="left" label-align="right" class="note"> |
@@ -1,6 +1,7 @@ | |||
import { customRef } from 'vue' | |||
export default function(data) { | |||
console.log(data) | |||
const list = [ | |||
{ | |||
label: '平台', | |||
@@ -10,6 +11,10 @@ export default function(data) { | |||
label: '客户名称', | |||
value: data.tenantName | |||
}, | |||
{ | |||
label: '任务名称', | |||
value: data.taskName | |||
}, | |||
{ | |||
label: '任务编号', | |||
value: data.taskCode | |||
@@ -36,7 +41,8 @@ export default function(data) { | |||
}, | |||
{ | |||
label: '是否直播', | |||
value: data.isLive === 2 ? '否' : '是' | |||
value: data.isLive === 2 ? '否' : '是', | |||
isShow: data.inspectionType === 1 | |||
}, | |||
{ | |||
label: '备注', |