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.
121 lines
3.6 KiB
121 lines
3.6 KiB
<template>
|
|
<BasicTable @register="registerTable" @edit-change="onEditChange">
|
|
<template #action="{ record }">
|
|
<TableAction :actions="getTableAction(record)" />
|
|
</template>
|
|
<template #tableTitle>
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增计划</a-button>
|
|
</template>
|
|
</BasicTable>
|
|
<div style="display: flex; justify-content: center; align-items: center; height: 100px;">
|
|
<el-button type="primary" @click="onSubmit">修改</el-button>
|
|
<el-button @click="handlecancle">取消</el-button>
|
|
|
|
<!-- <el-button>取消</el-button> -->
|
|
</div>
|
|
</template>
|
|
<script lang="ts" name="addPage" setup>
|
|
import { ref, defineProps, onMounted } from 'vue'
|
|
import { moduleDetailColumns } from './projectPlanModule.data';
|
|
import { queryPlanModuleDetailPage, savePlanModuleDatail } from './projectPlanModule.api'
|
|
import { ActionItem, BasicTable, TableAction, EditRecordRow } from '/@/components/Table';
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
import { downloadFile } from "../../../api/common/api"
|
|
let dataTo = defineProps(["moduleId"])
|
|
let emit = defineEmits(["close"])
|
|
|
|
onMounted(async () => {
|
|
setShowPagination(false)//不显示分页
|
|
console.log("moduleId.value=record.moduleId", dataTo.moduleId)
|
|
if (dataTo.moduleId) {
|
|
let param: any = {
|
|
projectid: dataTo.moduleId
|
|
}
|
|
// let res = await queryProjectInfoById(param)
|
|
//刷新表格
|
|
} else {
|
|
let tableData = await getDataSource();
|
|
|
|
}
|
|
console.log("dataTo.moduleId", dataTo.moduleId)
|
|
})
|
|
|
|
function getTableAction(record): ActionItem[] {
|
|
return [
|
|
{
|
|
label: '删除',
|
|
ifShow: true,
|
|
onClick: handleRemoveDetail.bind(null, record),
|
|
}
|
|
];
|
|
}
|
|
|
|
|
|
//项目资料table
|
|
const { tableContext } = useListPage({
|
|
tableProps: {
|
|
size: 'small',//紧凑型表格
|
|
title: '项目计划模板详情',
|
|
api: queryPlanModuleDetailPage,
|
|
columns: moduleDetailColumns,
|
|
useSearchForm: false,
|
|
showTableSetting: true,
|
|
actionColumn: {
|
|
width: 120,
|
|
fixed: "right",
|
|
},
|
|
beforeFetch(params) {
|
|
params.moduleId = dataTo.moduleId
|
|
},
|
|
},
|
|
});
|
|
const [registerTable, { getDataSource, setTableData, setShowPagination }] = tableContext;
|
|
|
|
|
|
function handleDetailpage(record) {
|
|
console.log("我这一行的数据是", record)
|
|
let param = {
|
|
path: record.documentPath,
|
|
fileName: record.documentName
|
|
}
|
|
//
|
|
console.log("我这一行的数据是", param)
|
|
|
|
downloadFile("/huzhouProject/downloadfile", record.documentName, param)
|
|
}
|
|
async function handleCreate() {
|
|
//await setShowPagination(false);
|
|
let tableData = await getDataSource();
|
|
tableData.push({ taskName: "aaa" })
|
|
setTableData(tableData)
|
|
}
|
|
function onEditChange({ column, value, record }) {
|
|
// 本例
|
|
if (column.dataIndex === 'id') {
|
|
record.editValueRefs.name4.value = `${value}`;
|
|
}
|
|
console.log(column, value, record);
|
|
}
|
|
function handlecancle() {
|
|
emit("close")
|
|
}
|
|
async function onSubmit() {
|
|
let tableData = await getDataSource();
|
|
console.log("dddddddddddd", tableData)
|
|
let param = {
|
|
moduleId: dataTo.moduleId,
|
|
tableData: tableData,
|
|
}
|
|
tableData.forEach(item => {
|
|
item.moduleId = dataTo.moduleId
|
|
})
|
|
await savePlanModuleDatail(tableData)
|
|
emit("close")
|
|
}
|
|
async function handleRemoveDetail(record){
|
|
let tableData = await getDataSource();
|
|
|
|
}
|
|
</script>
|
|
<style></style>
|
|
|