测试优化
This commit is contained in:
@ -1,60 +1,26 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
||||
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<!-- <el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model="queryParams.projectId" placeholder="请输入项目ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="合同编号" prop="contractCode">
|
||||
<el-input v-model="queryParams.contractCode" placeholder="请输入合同编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="业主单位" prop="contractOwner">
|
||||
<el-input v-model="queryParams.contractOwner" placeholder="请输入业主单位" clearable
|
||||
@keyup.enter="handleQuery" />
|
||||
<el-input v-model="queryParams.contractOwner" placeholder="请输入业主单位" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="合同金额" prop="amount">
|
||||
<el-input v-model="queryParams.amount" placeholder="请输入合同金额" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['ctr:incomeContract:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
|
||||
v-hasPermi="['ctr:incomeContract:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
|
||||
v-hasPermi="['ctr:incomeContract:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['ctr:incomeContract:export']">导出</el-button>
|
||||
</el-col>-->
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="incomeContractList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> -->
|
||||
<el-table-column type="index" width="50" label="序号" />
|
||||
<!-- <el-table-column label="项目ID" align="center" prop="projectId" /> -->
|
||||
<el-table-column label="合同编号" align="center" prop="contractCode" />
|
||||
<el-table-column label="合同类型" align="center" prop="contractType">
|
||||
<template #default="scope">
|
||||
@ -68,7 +34,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="业主单位" align="center" prop="contractOwner" />
|
||||
<!-- <el-table-column label="承包内容" align="center" prop="contractedContent" /> -->
|
||||
<el-table-column label="合同金额" align="center" prop="amount" />
|
||||
<el-table-column label="预付款比例(%)" align="center" prop="advancePayRatio" />
|
||||
<el-table-column label="尾款比例(%)" align="center" prop="balancePayRatio" />
|
||||
@ -77,34 +42,24 @@
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template #default="scope">
|
||||
<!-- <el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ctr:incomeContract:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ctr:incomeContract:remove']"></el-button>
|
||||
</el-tooltip> -->
|
||||
<!-- <el-tooltip content="查看承包内容" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)">详情</el-button>
|
||||
</el-tooltip> -->
|
||||
<div>
|
||||
<el-button link type="primary" icon="edit" @click="handleEdit(scope.row)"
|
||||
v-if="scope.row.isUpdate">修改合同</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button link type="success" icon="View" @click="handleShowDetail(scope.row)">查看合同内容</el-button>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<el-button link type="primary" icon="View" @click="handleShowFileList(scope.row)">查看附件列表</el-button>
|
||||
</div>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-hasPermi="['ctr:incomeContract:edit']"
|
||||
icon="edit"
|
||||
@click="handleEdit(scope.row)"
|
||||
v-if="scope.row.isUpdate"
|
||||
>修改合同</el-button
|
||||
>
|
||||
<el-button link type="success" icon="View" @click="handleShowDetail(scope.row)">查看合同内容</el-button>
|
||||
<el-button link type="primary" v-hasPermi="['ctr:incomeContract:query']" icon="View" @click="handleShowFileList(scope.row)"
|
||||
>查看附件列表</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改收入合同对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
@ -141,9 +96,7 @@
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="detailVisible = false">
|
||||
关闭
|
||||
</el-button>
|
||||
<el-button type="primary" @click="detailVisible = false"> 关闭 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -151,20 +104,26 @@
|
||||
</template>
|
||||
|
||||
<script setup name="IncomeContract" lang="ts">
|
||||
import { listIncomeContract, getIncomeContract, delIncomeContract, addIncomeContract, updateIncomeContract, getFileList, getInfoByProjectId } from '@/api/ctr/incomeContract';
|
||||
import {
|
||||
listIncomeContract,
|
||||
getIncomeContract,
|
||||
delIncomeContract,
|
||||
addIncomeContract,
|
||||
updateIncomeContract,
|
||||
getFileList,
|
||||
getInfoByProjectId
|
||||
} from '@/api/ctr/incomeContract';
|
||||
import { IncomeContractVO, IncomeContractQuery, IncomeContractForm } from '@/api/ctr/incomeContract/types';
|
||||
import FileList from '@/components/FileList/index.vue';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const userStore = useUserStore();
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const router = useRouter();
|
||||
|
||||
const { expenses_contract_type, income_contract_type } = toRefs(
|
||||
proxy?.useDict('income_contract_type', 'expenses_contract_type')
|
||||
);
|
||||
const { expenses_contract_type, income_contract_type } = toRefs(proxy?.useDict('income_contract_type', 'expenses_contract_type'));
|
||||
const incomeContractList = ref<IncomeContractVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
@ -191,8 +150,8 @@ const initFormData: IncomeContractForm = {
|
||||
contractOwner: undefined,
|
||||
contractedContent: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<IncomeContractForm, IncomeContractQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
@ -204,16 +163,11 @@ const data = reactive<PageData<IncomeContractForm, IncomeContractQuery>>({
|
||||
contractOwner: undefined,
|
||||
contractedContent: undefined,
|
||||
amount: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键ID不能为空", trigger: "blur" }
|
||||
],
|
||||
projectId: [
|
||||
{ required: true, message: "项目ID不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -226,55 +180,55 @@ const getList = async () => {
|
||||
incomeContractList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
incomeContractFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: IncomeContractVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加收入合同";
|
||||
}
|
||||
dialog.title = '添加收入合同';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: IncomeContractVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getIncomeContract(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改收入合同";
|
||||
}
|
||||
dialog.title = '修改收入合同';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -282,58 +236,63 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateIncomeContract(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateIncomeContract(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addIncomeContract(form.value).finally(() => buttonLoading.value = false);
|
||||
await addIncomeContract(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: IncomeContractVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除收入合同编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除收入合同编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delIncomeContract(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('ctr/incomeContract/export', {
|
||||
...queryParams.value
|
||||
}, `incomeContract_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'ctr/incomeContract/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`incomeContract_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
// 查看附件列表操作
|
||||
const handleShowFileList = async (row: IncomeContractVO) => {
|
||||
console.log(row.id);
|
||||
|
||||
await getFileList({ contractId: row.id }).then(res => {
|
||||
fileList.value = res.rows
|
||||
fileListVisible.value = true;
|
||||
}).catch(() => {
|
||||
proxy?.$modal.error("获取文件列表失败");
|
||||
});
|
||||
|
||||
}
|
||||
await getFileList({ contractId: row.id })
|
||||
.then((res) => {
|
||||
fileList.value = res.rows;
|
||||
fileListVisible.value = true;
|
||||
})
|
||||
.catch(() => {
|
||||
proxy?.$modal.error('获取文件列表失败');
|
||||
});
|
||||
};
|
||||
const handleEdit = (row: IncomeContractVO) => {
|
||||
// console.log(router);
|
||||
|
||||
router.push({
|
||||
path: "/ctr/update",
|
||||
path: '/ctr/update',
|
||||
query: {
|
||||
id: row.id,
|
||||
id: row.id
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleShowDetail = (data) => {
|
||||
detailContent.value = data.contractedContent
|
||||
detailContent.value = data.contractedContent;
|
||||
detailVisible.value = true;
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user