From a7a8f4b0f651e195358c7fce120b9e3a2a02f211 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Tue, 4 Jun 2024 17:50:05 +0800 Subject: [PATCH] update --- src/api/oa_examine_temp_item.ts | 26 +++++--- .../{jxgl_temp => oa_examine_temp}/edit.vue | 63 ++++++++++++------- .../{jxgl_temp => oa_examine_temp}/index.vue | 46 ++++++-------- 3 files changed, 75 insertions(+), 60 deletions(-) rename src/views/{jxgl_temp => oa_examine_temp}/edit.vue (77%) rename src/views/{jxgl_temp => oa_examine_temp}/index.vue (72%) diff --git a/src/api/oa_examine_temp_item.ts b/src/api/oa_examine_temp_item.ts index 0c8dbad..c664dac 100644 --- a/src/api/oa_examine_temp_item.ts +++ b/src/api/oa_examine_temp_item.ts @@ -1,26 +1,34 @@ import request from "@/utils/request"; // 考核模板-考核项列表 -export function apiOaExamineTempItemLists(params: any) { - return request.get({ url: "/jxgl.oa_examine_temp_item/lists", params }); +export function apiOaExamineTempLists(params: any) { + return request.get({ url: "/jxgl.oa_examine_temp/lists", params }); } // 添加考核模板-考核项 -export function apiOaExamineTempItemAdd(params: any) { - return request.post({ url: "/jxgl.oa_examine_temp_item/add", params }); +export function apiOaExamineTempAdd(params: any) { + return request.post({ url: "/jxgl.oa_examine_temp/add", params }); } // 编辑考核模板-考核项 -export function apiOaExamineTempItemEdit(params: any) { - return request.post({ url: "/jxgl.oa_examine_temp_item/edit", params }); +export function apiOaExamineTempEdit(params: any) { + return request.post({ url: "/jxgl.oa_examine_temp/edit", params }); } // 删除考核模板-考核项 -export function apiOaExamineTempItemDelete(params: any) { - return request.post({ url: "/jxgl.oa_examine_temp_item/delete", params }); +export function apiOaExamineTempDelete(params: any) { + return request.post({ url: "/jxgl.oa_examine_temp/delete", params }); +} + +// 考核模板-考核项详情 +export function apiOaExamineTempDetail(params: any) { + return request.get({ url: "/jxgl.oa_examine_temp/detail", params }); } // 考核模板-考核项详情 export function apiOaExamineTempItemDetail(params: any) { - return request.get({ url: "/jxgl.oa_examine_temp_item/detail", params }); + return request.post({ + url: "/jxgl.oa_examine_temp/delete_item", + params, + }); } diff --git a/src/views/jxgl_temp/edit.vue b/src/views/oa_examine_temp/edit.vue similarity index 77% rename from src/views/jxgl_temp/edit.vue rename to src/views/oa_examine_temp/edit.vue index eb2a5fd..a1faeb5 100644 --- a/src/views/jxgl_temp/edit.vue +++ b/src/views/oa_examine_temp/edit.vue @@ -1,12 +1,14 @@ <template> <div class="edit-popup"> - <popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit" @close="handleClose"> + <popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit" + @close="handleClose"> <el-card> <el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules"> <el-row> <el-col :span="8"> <el-form-item label="考核类别" prop="examine_type"> - <el-select class="flex-1" v-model="formData.examine_type" clearable placeholder="请选择考核类别"> + <el-select class="flex-1" v-model="formData.examine_type" clearable + placeholder="请选择考核类别"> <el-option v-for="(item, index) in dictData.jxgl_check_type" :key="index" :label="item.name" :value="parseInt(item.value)" /> </el-select> @@ -28,25 +30,25 @@ <template #empty> 暂无数据,点击 <el-button @click="handleAdd" size="small">添加</el-button> </template> - <el-table-column label="考核项" prop="progress" show-overflow-tooltip> + <el-table-column label="考核项" prop="examine_item" show-overflow-tooltip> <template #default="{ row }"> <el-input v-model="row.examine_item" placeholder="请输入考核项" /> </template> </el-table-column> - <el-table-column label="分数" prop="progress" show-overflow-tooltip> + <el-table-column label="分数" prop="score" show-overflow-tooltip> <template #default="{ row }"> - <el-input v-model="row.score" placeholder="请输入分数" /> + <el-input v-model="row.score" placeholder="请输入分数" @change="updateScore" type="number" /> </template> </el-table-column> - <el-table-column label="考核说明" prop="progress" show-overflow-tooltip> + <el-table-column label="考核说明" prop="examine_desc" show-overflow-tooltip> <template #default="{ row }"> <el-input v-model="row.examine_desc" placeholder="请输入考核说明" /> </template> </el-table-column> <el-table-column label="操作" prop="progress" show-overflow-tooltip> - <template #default="{ row }"> + <template #default="{ row, $index }"> <el-button @click="handleAdd" size="small">+</el-button> - <el-button @click="handleAdd" size="small">-</el-button> + <el-button @click="handleDel(row, $index)" size="small">-</el-button> </template> </el-table-column> </el-table> @@ -55,20 +57,21 @@ <el-card> <el-descriptions :column="3" border> <el-descriptions-item label="考核总分" label-align="left" align="left"> - { formData.org_name } + {{ formData.total_score }} </el-descriptions-item> </el-descriptions> </el-card> </popup> </div> </template> - + <script lang="ts" setup name="manageProjectEdit"> import type { FormInstance } from 'element-plus' import Popup from '@/components/popup/index.vue' -import { apiOaExamineTempItemAdd, apiOaExamineTempItemEdit } from '@/api/oa_examine_temp_item.ts' +import { apiOaExamineTempAdd, apiOaExamineTempEdit, apiOaExamineTempItemDetail } from '@/api/oa_examine_temp_item.ts' import type { PropType } from 'vue' import { timeFormat } from '@/utils/util' +import { number } from 'echarts' defineProps({ @@ -95,23 +98,38 @@ const formData = reactive({ temp_name: '', create_user: '', cretate_time: '', + total_score: 0, detail: [] }) const handleAdd = () => { - formData.detail.push({}) + formData.detail.push({ + "examine_item": '', + "score": '', + "examine_desc": '' + }) } +const handleDel = async (row, index) => { + if (row.id) { + await apiOaExamineTempItemDetail({ "id": row.id }) + } + formData.detail.splice(index, 1); + updateScore(); + + +} + +const updateScore = () => { + formData.total_score = 0; + formData.detail.forEach((item) => { + formData.total_score += Number(item.score); + }); +} // 表单验证 -const formRules = reactive<any>({ - project_name: [{ - required: true, - message: '请输入项目名称', - trigger: ['blur'] - }] -}) +const formRules = reactive<any>({}) const setRules = () => { let lists = ['examine_type', 'temp_name', 'create_user', 'cretate_time'] @@ -143,8 +161,8 @@ const handleSubmit = async () => { await formRef.value?.validate() const data = { ...formData, } mode.value == 'edit' - ? await apiOaExamineTempItemEdit(data) - : await apiOaExamineTempItemAdd(data) + ? await apiOaExamineTempEdit(data) + : await apiOaExamineTempAdd(data) popupRef.value?.close() emit('success') } @@ -165,5 +183,4 @@ defineExpose({ open, setFormData, }) -</script> - \ No newline at end of file +</script> \ No newline at end of file diff --git a/src/views/jxgl_temp/index.vue b/src/views/oa_examine_temp/index.vue similarity index 72% rename from src/views/jxgl_temp/index.vue rename to src/views/oa_examine_temp/index.vue index 5a278e2..b8e3786 100644 --- a/src/views/jxgl_temp/index.vue +++ b/src/views/oa_examine_temp/index.vue @@ -4,19 +4,15 @@ <el-form class="mb-[-16px]" :model="queryParams" label-width="80px"> <el-row> <el-col :span="6"> - <el-form-item label="项目名称" prop="project_name"> - <el-input v-model="queryParams.project_name" clearable placeholder="请输入项目名称" /> + <el-form-item label="模板名称" prop="temp_name"> + <el-input v-model="queryParams.temp_name" clearable placeholder="请输入模板名称" /> </el-form-item> </el-col> <el-col :span="6"> - <el-form-item label="项目编号" prop="project_code"> - <el-input v-model="queryParams.project_code" clearable placeholder="请输入项目编号" /> - </el-form-item> - </el-col> - <el-col :span="6"> - <el-form-item label="性质" prop="nature"> - <el-select class="flex-1" v-model="queryParams.nature" clearable placeholder="请选择性质"> - <el-option v-for="(item, index) in dictData.cost_consultation_industry_nature" :key="index" + <el-form-item label="考核类别" prop="examine_type"> + <el-select class="flex-1" v-model="queryParams.examine_type" clearable + placeholder="请选择考核类别"> + <el-option v-for="(item, index) in dictData.jxgl_check_type" :key="index" :label="item.name" :value="parseInt(item.value)" /> </el-select> </el-form-item> @@ -42,11 +38,11 @@ </el-button> <div class="mt-4"> <el-table border :data="pager.lists" @selection-change="handleSelectionChange"> - <el-table-column label="考核类别" prop="progress" show-overflow-tooltip /> - <el-table-column label="模版名称" prop="build_area_text" show-overflow-tooltip /> - <el-table-column label="考核总分" prop="project_level_text" show-overflow-tooltip /> - <el-table-column label="创建人" prop="total_investment" show-overflow-tooltip width="120" /> - <el-table-column label="创建时间" prop="engineering_status_text" show-overflow-tooltip /> + <el-table-column label="考核类别" prop="examine_type_text" show-overflow-tooltip /> + <el-table-column label="模版名称" prop="temp_name" show-overflow-tooltip /> + <el-table-column label="考核总分" prop="total_score" show-overflow-tooltip /> + <el-table-column label="创建人" prop="create_user" show-overflow-tooltip width="120" /> + <el-table-column label="创建时间" prop="create_time" show-overflow-tooltip /> <el-table-column label="操作" width="170" fixed="right"> <template #default="{ row }"> <el-button type="primary" link @click="handleEdit(row)"> @@ -63,8 +59,7 @@ <pagination v-model="pager" @change="getLists" /> </div> </el-card> - <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="success()" @close="showEdit = false" - :deptList="deptList" /> + <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists()" @close="showEdit = false" /> </div> </template> @@ -72,7 +67,7 @@ <script lang="ts" setup name="manageProjectLists"> import { usePaging } from '@/hooks/usePaging' import { useDictData } from '@/hooks/useDictOptions' -import { apiOaExamineTempItemLists, apiOaExamineTempItemAdd, apiOaExamineTempItemDetail } from '@/api/oa_examine_temp_item.ts' +import { apiOaExamineTempLists, apiOaExamineTempDetail, apiOaExamineTempDelete } from '@/api/oa_examine_temp_item.ts' import feedback from '@/utils/feedback' import EditPopup from './edit.vue' @@ -87,13 +82,8 @@ const showDetail = ref(false) // 查询条件 const queryParams = reactive({ - project_name: '', - project_code: '', - nature: '', - industry: '', - build_area: '', - project_level: '', - engineering_status: '' + examine_type: '', + temp_name: '', }) // 选中数据 @@ -109,7 +99,7 @@ const { dictData } = useDictData('jxgl_check_type') // 分页相关 const { pager, getLists, resetParams, resetPage } = usePaging({ - fetchFun: apiOaExamineTempItemLists, + fetchFun: apiOaExamineTempLists, params: queryParams }) @@ -122,7 +112,7 @@ const handleAdd = async () => { // 编辑 const handleEdit = async (data: any) => { - let res = await apiOaExamineTempItemDetail({ id: data.id }) + let res = await apiOaExamineTempDetail({ id: data.id }) showEdit.value = true await nextTick() editRef.value?.open('edit') @@ -132,7 +122,7 @@ const handleEdit = async (data: any) => { // 删除 const handleDelete = async (id: number | any[]) => { await feedback.confirm('确定要删除?') - await apiManageProjectDelete({ id }) + await apiOaExamineTempDelete({ id }) getLists() }