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

feat: 完成进度完善

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