Commit e855aaf7 authored by jiaxu.yan's avatar jiaxu.yan

feat: 完成进度完善

parent 7ea4fce5
...@@ -14,6 +14,8 @@ enum Api { ...@@ -14,6 +14,8 @@ enum Api {
DeleteProject = '/pro/completion/delete', DeleteProject = '/pro/completion/delete',
engineeringList = '/pro/completion/getCanCompletion', engineeringList = '/pro/completion/getCanCompletion',
GetEngineProjectList = '/pro/completion/getCompletionPro', GetEngineProjectList = '/pro/completion/getCompletionPro',
audit = '/pro/completion/audit',
Itemdelete = '/pro/completion/delProject',
} }
export const getListByPage = (params?: ProjectParams) => export const getListByPage = (params?: ProjectParams) =>
defHttp.post<ProjectModel>({ url: Api.GetList, data: params }); defHttp.post<ProjectModel>({ url: Api.GetList, data: params });
...@@ -31,9 +33,9 @@ export const updateItem = (params?: any) => ...@@ -31,9 +33,9 @@ export const updateItem = (params?: any) =>
defHttp.post<ProjectModel>({ defHttp.post<ProjectModel>({
url: Api.UpdateProject, url: Api.UpdateProject,
data: params, data: params,
// headers: { headers: {
// 'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
// }, },
}); });
export const deleteItem = (params?: any) => export const deleteItem = (params?: any) =>
...@@ -51,3 +53,10 @@ export const GetEngineProjectList = (params?: any) => ...@@ -51,3 +53,10 @@ export const GetEngineProjectList = (params?: any) =>
'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/json;charset=UTF-8',
}, },
}); });
export const auditItem = (params?: any) =>
defHttp.post<ProjectModel>({
url: Api.audit,
data: params,
});
export const Itemdelete = (params?: any) =>
defHttp.delete<ProjectModel>({ url: Api.Itemdelete, params });
import { BasicColumn, FormSchema } from '@/components/Table'; import { BasicColumn, FormSchema } from '@/components/Table';
export const columns: ( export const columns: BasicColumn[] = [
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
| { dataIndex: string; width: number; title: string }
)[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'serialNumber', // 这个dataIndex仅作为标识,不对应实际数据字段 dataIndex: 'serialNumber', // 这个dataIndex仅作为标识,不对应实际数据字段
width: 50, // 可以自定义宽度 width: 50, // 可以自定义宽度 // 对应模板中的具名插槽
scopedSlots: { customRender: 'bodyCell' }, // 对应模板中的具名插槽
}, },
{ {
title: '填报周期', title: '填报周期',
...@@ -116,7 +107,6 @@ export const modelColumns: BasicColumn[] = [ ...@@ -116,7 +107,6 @@ export const modelColumns: BasicColumn[] = [
title: '序号', title: '序号',
dataIndex: 'serialNumber', // 这个dataIndex仅作为标识,不对应实际数据字段 dataIndex: 'serialNumber', // 这个dataIndex仅作为标识,不对应实际数据字段
width: 50, // 可以自定义宽度 width: 50, // 可以自定义宽度
scopedSlots: { customRender: 'bodyCell' }, // 对应模板中的具名插槽
}, },
{ {
title: '填报周期', title: '填报周期',
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
{{ record.completionResult == 1 ? '已审核' : '未审核' }} {{ record.completionResult == 1 ? '已审核' : '未审核' }}
</Tag> </Tag>
</template> </template>
<!-- 其他列正常显示 -->
<span v-else>{{ text }}</span>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction
:actions="[ :actions="[
...@@ -30,7 +27,7 @@ ...@@ -30,7 +27,7 @@
label: '修改', label: '修改',
onClick: handleEdit.bind(null, record, 0), onClick: handleEdit.bind(null, record, 0),
ifShow: (_action) => { ifShow: (_action) => {
return record.completionResult == null; return record.completionResult == 0;
}, },
}, },
{ {
...@@ -42,7 +39,7 @@ ...@@ -42,7 +39,7 @@
confirm: handleDelete.bind(null, record), confirm: handleDelete.bind(null, record),
}, },
ifShow: (_action) => { ifShow: (_action) => {
return record.completionResult == null; return record.completionResult == 0;
}, },
}, },
{ {
...@@ -54,7 +51,7 @@ ...@@ -54,7 +51,7 @@
confirm: examine.bind(null, record, true), confirm: examine.bind(null, record, true),
}, },
ifShow: (_action) => { ifShow: (_action) => {
return record.completionResult == null; return record.completionResult == 0;
}, },
}, },
]" ]"
...@@ -67,12 +64,13 @@ ...@@ -67,12 +64,13 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { BasicTable, useTable, TableAction } from '@/components/Table'; import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getListByPage } from '@/api/project/performance'; import { getListByPage, auditItem, deleteItem } from '@/api/project/performance';
import { columns, searchFormSchema } from './data'; import { columns, searchFormSchema } from './data';
import { useModal } from '@/components/Modal'; import { useModal } from '@/components/Modal';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const { push } = useRouter(); const { push } = useRouter();
import performanceModel from './performanceModel.vue'; import performanceModel from './performanceModel.vue';
import { Tag } from 'ant-design-vue';
const [register, { openModal: openModal }] = useModal(); const [register, { openModal: openModal }] = useModal();
defineOptions({ name: 'Performance' }); defineOptions({ name: 'Performance' });
const [registerTable, { reload }] = useTable({ const [registerTable, { reload }] = useTable({
...@@ -96,15 +94,19 @@ ...@@ -96,15 +94,19 @@
}, },
}); });
function handleEdit(record: Recordable) { function handleEdit(record: Recordable, disabled: number) {
openDrawer(true, { push({
record, path: '/performance/edit',
isUpdate: true, query: {
id: record.id,
disabled: String(disabled),
},
}); });
} }
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
console.log(record); deleteItem({ id: record.id });
reload();
} }
function handleSuccess() { function handleSuccess() {
...@@ -121,10 +123,16 @@ ...@@ -121,10 +123,16 @@
push({ push({
path: '/performance/edit', path: '/performance/edit',
query: { query: {
source: JSON.stringify(e) source: JSON.stringify(e),
}, },
}); });
} }
async function examine(record: Recordable) {
const id = record.id;
const res = await auditItem({ id });
console.log(res);
reload();
}
</script> </script>
<style scoped> <style scoped>
.btn { .btn {
......
...@@ -43,7 +43,13 @@ ...@@ -43,7 +43,13 @@
import { editModel } from '@/api/project/model/performance'; import { editModel } from '@/api/project/model/performance';
import { router } from '@/router'; import { router } from '@/router';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { addItem, updateItem, getItem, GetEngineProjectList } from '@/api/project/performance'; import {
addItem,
updateItem,
getItem,
GetEngineProjectList,
Itemdelete,
} from '@/api/project/performance';
const loadingRef = ref(false); const loadingRef = ref(false);
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const isUpdate = ref(false); const isUpdate = ref(false);
...@@ -70,6 +76,7 @@ ...@@ -70,6 +76,7 @@
handleNew(item); handleNew(item);
}); });
} else { } else {
isUpdate.value = true;
disabled.value = route.query.disabled == '0' ? false : true; disabled.value = route.query.disabled == '0' ? false : true;
if (disabled.value) { if (disabled.value) {
getTitle.value = '查看完成情况'; getTitle.value = '查看完成情况';
...@@ -77,6 +84,7 @@ ...@@ -77,6 +84,7 @@
getTitle.value = '编辑完成情况'; getTitle.value = '编辑完成情况';
} }
let res = await getItem({ id }); let res = await getItem({ id });
formData.value.id = id;
formData.value.planCompletion = []; formData.value.planCompletion = [];
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
const source = res[i]; const source = res[i];
...@@ -91,10 +99,11 @@ ...@@ -91,10 +99,11 @@
), ),
}; };
const { setFieldsValue, clearValidate } = item.Form[1]; const { setFieldsValue, clearValidate } = item.Form[1];
source.time = source.beginTime + '/' + source.endTime;
tabsFormSchema.push(item); tabsFormSchema.push(item);
formData.value.planCompletion.push({ formData.value.planCompletion.push({
id: source.id, id: source.id,
investmentld: source.investmentld, investmentld: source.investmentId,
}); });
nextTick(() => { nextTick(() => {
setFieldsValue({ setFieldsValue({
...@@ -137,18 +146,30 @@ ...@@ -137,18 +146,30 @@
const { setFieldsValue, clearValidate } = item.Form[1]; const { setFieldsValue, clearValidate } = item.Form[1];
tabsFormSchema.push(item); tabsFormSchema.push(item);
formData.value.planCompletion.push({ formData.value.planCompletion.push({
investmentId: info.id, id: info.id,
investmentId: info.investmentId,
}); });
nextTick(() => { nextTick(() => {
setFieldsValue(info); setFieldsValue(info);
clearValidate(); clearValidate();
}); });
} }
async function deleteItem(index: any) { async function deleteItem(index: any) {
loadingRef.value = true; loadingRef.value = true;
formData.value.planCompletion.splice(index, 1); const id = formData.value.planCompletion[index].id;
tabsFormSchema.splice(index, 1); if (id) {
loadingRef.value = false; await Itemdelete({
id,
});
formData.value.planCompletion.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
} else {
formData.value.planCompletion.splice(index, 1);
tabsFormSchema.splice(index, 1);
loadingRef.value = false;
}
} }
async function handleSubmit() { async function handleSubmit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment