You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.3 KiB
114 lines
2.3 KiB
|
2 years ago
|
<!--
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2023-07-05 15:03:42
|
||
|
|
@ 备注: 设置字段值
|
||
|
|
-->
|
||
|
|
<script lang='ts' setup>
|
||
|
|
import { matrixTable,objectStruct } from '@/api/matrixapi/type'
|
||
|
|
import { getMatrixField } from '@/api/matrixapi';
|
||
|
|
|
||
|
|
const props = defineProps({
|
||
|
|
userShow:{
|
||
|
|
type:Boolean,
|
||
|
|
default:false
|
||
|
|
},
|
||
|
|
matrixcont:{
|
||
|
|
type:Object,
|
||
|
|
default(){
|
||
|
|
return {}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
const emits = defineEmits(["update:userShow"]); //父级元素
|
||
|
|
const addFieldLoading = ref(false)
|
||
|
|
const tabelColumn = reactive<matrixTable[]>([])
|
||
|
|
const tableList = reactive<any[]>([])
|
||
|
|
const loading = ref(false)
|
||
|
|
/**
|
||
|
|
* 弹窗显示控制
|
||
|
|
*/
|
||
|
|
const field_is_Show = computed({
|
||
|
|
get: () => props.userShow,
|
||
|
|
set: (val) => {
|
||
|
|
emits("update:userShow", val);
|
||
|
|
},
|
||
|
|
});
|
||
|
|
/**
|
||
|
|
* 关闭弹窗
|
||
|
|
*/
|
||
|
|
function handleCloseBox(){
|
||
|
|
emits("update:userShow", false);
|
||
|
|
initData()
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 初始化数据
|
||
|
|
*/
|
||
|
|
function initData(){
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 监听数据
|
||
|
|
*/
|
||
|
|
watch(() => props.userShow,() => {
|
||
|
|
if(props.userShow){
|
||
|
|
getMatrixField({id:props.matrixcont.id})
|
||
|
|
.then(({data})=>{
|
||
|
|
console.log("监听数据---->",data)
|
||
|
|
data.factor.forEach(item=>{
|
||
|
|
tabelColumn.push({
|
||
|
|
id:item.id,
|
||
|
|
label:item.name,
|
||
|
|
prop:item.pinyin
|
||
|
|
})
|
||
|
|
})
|
||
|
|
data.outcome.forEach(item=>{
|
||
|
|
tabelColumn.push({
|
||
|
|
id:item.id,
|
||
|
|
label:item.name,
|
||
|
|
prop:item.pinyin
|
||
|
|
})
|
||
|
|
})
|
||
|
|
})
|
||
|
|
.finally(()=>{
|
||
|
|
var jks:objectStruct = {}
|
||
|
|
tabelColumn.forEach(item=>{
|
||
|
|
jks[item.prop]=1
|
||
|
|
})
|
||
|
|
console.log("监听数据-->",jks)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
});
|
||
|
|
/**
|
||
|
|
* 提交使用人
|
||
|
|
*/
|
||
|
|
function submitAddMatrixUser(){
|
||
|
|
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<template>
|
||
|
|
<el-dialog v-model="field_is_Show" custom-class="dialog_box" title="矩阵数据维护" :before-close="handleCloseBox" width="80%">
|
||
|
|
<el-table
|
||
|
|
v-loading="loading"
|
||
|
|
highlight-current-row
|
||
|
|
:data="tableList"
|
||
|
|
border
|
||
|
|
>
|
||
|
|
<el-table-column type="selection" width="55" align="center" />
|
||
|
|
<el-table-column v-for="(item,index) in tabelColumn" :key="index" align="center">
|
||
|
|
<!-- 自定义表头 -->
|
||
|
|
<template #header>
|
||
|
|
{{item.label}}
|
||
|
|
</template>
|
||
|
|
</el-table-column>
|
||
|
|
</el-table>
|
||
|
|
<template #footer>
|
||
|
|
<div class="dialog-footer">
|
||
|
|
<el-button type="primary" :loading="addFieldLoading" @click="submitAddMatrixUser" >确 定</el-button>
|
||
|
|
<el-button @click="handleCloseBox">取 消</el-button>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
</el-dialog>
|
||
|
|
</template>
|
||
|
|
<style lang='scss' scoped>
|
||
|
|
|
||
|
|
</style>
|