|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div v-loading="!isAfterRender" class="hc-full" element-loading-text="加载中...">
|
|
|
+ <div v-loading="isLoading" class="hc-full" element-loading-text="加载中...">
|
|
|
<hc-table
|
|
|
:column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" is-check :check-style="{ fixed: true, width: 29 }"
|
|
|
class="hc-project-list-table" @selection-change="tableCheckChange"
|
|
@@ -117,13 +117,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onMounted, ref, watch } from 'vue'
|
|
|
+import { ref, watch } from 'vue'
|
|
|
|
|
|
const props = defineProps({
|
|
|
isAdmin: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
+ loading: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ datas: {
|
|
|
+ type: Array,
|
|
|
+ default: () => ([]),
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//事件
|
|
@@ -135,37 +143,30 @@ watch(() => props.isAdmin, (admin) => {
|
|
|
isAdminAuth.value = admin
|
|
|
})
|
|
|
|
|
|
-//渲染完成
|
|
|
-const isAfterRender = ref(false)
|
|
|
-onMounted(() => {
|
|
|
- //表格太复杂,渲染较慢,等页面先加载完成,再渲染表格,不然会卡住一下不动。
|
|
|
- //因为表头涉及到年份,如果年份很多,那么会更卡。
|
|
|
- setTimeout(() => {
|
|
|
- isAfterRender.value = true
|
|
|
- }, 200)
|
|
|
+//监听数据
|
|
|
+const tableData = ref(props.datas)
|
|
|
+watch(() => props.datas, (data) => {
|
|
|
+ tableData.value = data
|
|
|
+})
|
|
|
+
|
|
|
+//监听加载
|
|
|
+const isLoading = ref(props.loading)
|
|
|
+watch(() => props.loading, (res) => {
|
|
|
+ isLoading.value = res
|
|
|
})
|
|
|
|
|
|
//表头
|
|
|
const tableColumn = [
|
|
|
- { key: 'key1', name: '项目阶段', width: 100 },
|
|
|
- { key: 'key2', name: '目标任务', width: 140 },
|
|
|
- { key: 'key3', name: '工作内容' },
|
|
|
- { key: 'key4', name: '开始年份', width: 100 },
|
|
|
- { key: 'key5', name: '结束年份', width: 100 },
|
|
|
- { key: 'key6', name: '责任单位', width: 100 },
|
|
|
+ { key: 'workFocusStage', name: '项目阶段', width: 100 },
|
|
|
+ { key: 'targetPlan', name: '目标任务', width: 140 },
|
|
|
+ { key: 'workPlan', name: '工作内容' },
|
|
|
+ { key: 'startYear', name: '开始年份', width: 100 },
|
|
|
+ { key: 'endYear', name: '结束年份', width: 100 },
|
|
|
+ { key: 'dutyUnit', name: '责任单位', width: 100 },
|
|
|
{ key: 'key7', name: '完成情况填写比例(%)', width: 100 },
|
|
|
{ key: 'action', name: '操作', width: isAdminAuth.value ? 220 : 100, fixed:'right', align: 'center' },
|
|
|
]
|
|
|
|
|
|
-//表格数据
|
|
|
-const tableData = ref([
|
|
|
- { id: 1, key1: '-', key2: '名称1', key3: '-' },
|
|
|
- { id: 2, key1: '-', key2: '名称2', key3: '-' },
|
|
|
- { id: 3, key1: '-', key2: '名称3', key3: '-' },
|
|
|
- { id: 4, key1: '-', key2: '名称4', key3: '-' },
|
|
|
- { id: 5, key1: '-', key2: '名称5', key3: '-' },
|
|
|
-])
|
|
|
-
|
|
|
//表格被选择
|
|
|
const tableCheckKeys = ref([])
|
|
|
const tableCheckChange = (rows) => {
|