From 09a7d782235db3192db6cd0013e96a3a9265a3fd Mon Sep 17 00:00:00 2001 From: shj <1790240199@qq.com> Date: 星期三, 27 七月 2022 17:49:33 +0800 Subject: [PATCH] 对接 --- src/components/DailogSearch/DailogSearch.vue | 2 src/views/goalManagement/IncentiveRecording/component/DailogSearch.vue | 9 src/views/goalManagement/targetDecompositionYear/component/Dailog.vue | 69 + src/views/goalManagement/TargetBook/component/DailogSearch.vue | 46 + src/views/goalManagement/TargetBook/index.vue | 336 ++++++++----- src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue | 79 ++ src/views/goalManagement/Goalsummary/index.vue | 2 src/views/goalManagement/Incentivestandard/component/DailogAdd.vue | 101 +++- src/views/goalManagement/IncentiveRecording/index.vue | 347 ++++++++----- src/views/goalManagement/Incentivestandard/index.vue | 343 ++++++++----- src/api/goalManagement/index.ts | 4 src/views/goalManagement/TargetBook/component/DailogAdd.vue | 103 +++- src/views/goalManagement/targetSettings/component/dailogAdd.vue | 12 13 files changed, 929 insertions(+), 524 deletions(-) diff --git a/src/api/goalManagement/index.ts b/src/api/goalManagement/index.ts index 0daab7a..f0b8aab 100644 --- a/src/api/goalManagement/index.ts +++ b/src/api/goalManagement/index.ts @@ -56,14 +56,14 @@ }) }, // 目标责任书 查询单条数据 - gettargetDutyfileInfoDetail: (params: any) => { + gettargetDutyfileInfoDetail: (params: number) => { return request({ url: `/targetDutyfileInfo/selectOne/${params}`, method: "get" }) }, // 目标责任书 新增或者修改数据 - gettargetDutyfileInfoAddorUpdata: (params: object) => { + gettargetDutyfileInfoAddorUpdata: (params: any) => { return request({ url: `/targetDutyfileInfo/addOrUpdate`, method: "post", diff --git a/src/components/DailogSearch/DailogSearch.vue b/src/components/DailogSearch/DailogSearch.vue index b1fa129..b2c186a 100644 --- a/src/components/DailogSearch/DailogSearch.vue +++ b/src/components/DailogSearch/DailogSearch.vue @@ -93,7 +93,7 @@ qName: '', ////安全目标指标 indexNum: '', ////目标指标编号 targetType: '', ////指标类型 1:年指标 2:月指标 - divideStatus: '', ////分解状态 1:已分解 2:未分解 + divideStatus: '2', ////分解状态 1:已分解 2:未分解 }, }); // 下方导航与表格 diff --git a/src/views/goalManagement/Goalsummary/index.vue b/src/views/goalManagement/Goalsummary/index.vue index 2104dfd..f0c1a6f 100644 --- a/src/views/goalManagement/Goalsummary/index.vue +++ b/src/views/goalManagement/Goalsummary/index.vue @@ -9,7 +9,7 @@ </el-col> <el-col :span="4"> <el-form-item> - <el-tree-select v-model="form.searchParams.departmentId" :data="data" class="w100" placeholder="请选择" /> + <el-tree-select v-model="ruleForm.searchParams.departmentId" :data="data" class="w100" placeholder="请选择" /> </el-form-item> </el-col> <el-col :span="4"> diff --git a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue index f47e4ef..cb66dc1 100644 --- a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue +++ b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue @@ -1,7 +1,7 @@ <template> - <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建奖惩记录" width="50%" draggable> + <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" :title="titles" width="50%" draggable> <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> - <el-form :model="form" label-width="120px"> + <el-form :model="form" :disabled="disabled" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="员工姓名" size="default"> @@ -49,8 +49,8 @@ </el-form> <template #footer> <span class="dialog-footer"> - <el-button @click="dialogVisible = false" size="default">关闭</el-button> - <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button> + <el-button @click="resetForm" size="default">关闭</el-button> + <el-button type="primary" @click="submitForm" size="default">确定</el-button> </span> </template> </el-dialog> @@ -61,27 +61,59 @@ import { defineComponent, ref, reactive } from 'vue'; import { Search, FullScreen } from '@element-plus/icons-vue'; import DailogSearch from './DailogSearch.vue'; +import { goalManagementApi } from '/@/api/goalManagement'; import DailogSearchUser from '/@/components/DailogSearchUser/index.vue'; +import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus'; export default defineComponent({ components: { DailogSearch, DailogSearchUser }, - setup() { + setup(props,{emit}) { const dialogVisible = ref<boolean>(false); - const form = reactive({ - name: '', - region: '', - date1: '', - date2: '', - delivery: false, - type: [], - resource: '', - desc: '', - }); - const openDailog = (type: string, value: any, projectList: any, projectId: string) => { + const form = ref({}); + const titles = ref(); + const disabled = ref(false); + // 打开弹窗 + const openDailog = (title: string, value: any, id: number) => { dialogVisible.value = true; + titles.value = `${title}奖惩标准设定`; + disabled.value = title == '查看' ? true : false; + if (title == '查看' || title == '修改') + goalManagementApi() + .getrewardPunishmentDetail(id) + .then((res) => { + if (res.data.code == 200) { + form.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); }; - // 导航 - const activeName = ref('1'); - // 表格 + // 提交 + const submitForm = () => { + dialogVisible.value = false; + goalManagementApi() + .getrewardPunishmentAddOrUpdate(form.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + emit('navAddorUpdata'); + } else { + ElMessage.error(res.data.msg); + } + }); + form.value = { + + } + }; + // 取消 + const resetForm = () => { + dialogVisible.value = false; + form.value = { + + }; + }; // 安全目标指标弹窗 const Shows = ref(); @@ -102,17 +134,20 @@ } }; return { - form, dialogVisible, + form, + titles, + disabled, openDailog, - activeName, + submitForm, + resetForm, Shows, daiInpt, Show, daiInpts, - Search, full, toggleFullscreen, + Search, FullScreen, }; }, diff --git a/src/views/goalManagement/IncentiveRecording/component/DailogSearch.vue b/src/views/goalManagement/IncentiveRecording/component/DailogSearch.vue index 3a991f5..a5750f3 100644 --- a/src/views/goalManagement/IncentiveRecording/component/DailogSearch.vue +++ b/src/views/goalManagement/IncentiveRecording/component/DailogSearch.vue @@ -17,8 +17,8 @@ </el-col> --> <el-col :span="11" :offset="1"> <el-form-item> - <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button> - <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button> + <el-button size="default" type="primary" @click="submitForm">查询</el-button> + <el-button size="default" @click="resetForm">重置</el-button> </el-form-item> </el-col> </el-row> @@ -35,11 +35,8 @@ v-model:currentPage="currentPage4" v-model:page-size="pageSize4" :page-sizes="[100, 200, 300, 400]" - :small="small" - :disabled="disabled" - :background="background" layout="total, sizes, prev, pager, next, jumper" - :total="400" + :total="1" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> diff --git a/src/views/goalManagement/IncentiveRecording/index.vue b/src/views/goalManagement/IncentiveRecording/index.vue index 97e2a85..13a4b2c 100644 --- a/src/views/goalManagement/IncentiveRecording/index.vue +++ b/src/views/goalManagement/IncentiveRecording/index.vue @@ -1,184 +1,262 @@ <template> -<div> - <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> - <el-row> - <el-col :span="4"> - <el-form-item size="default"> - <el-input v-model="ruleForm.name" placeholder="请选择被奖惩者"> - <template #append> <el-button :icon="Search" @click="openSearch" /> </template - ></el-input> - </el-form-item> - </el-col> - <!-- <el-col :span="4"> + <div> + <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> + <el-row> + <el-col :span="4"> + <el-form-item size="default"> + <el-input v-model="ruleForm.searchParams.personId" placeholder="请选择被奖惩者"> + <template #append> + <el-button :icon="Search" @click="openSearch" /> + </template> + </el-input> + </el-form-item> + </el-col> + <!-- <el-col :span="4"> <el-form-item> <el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" /> </el-form-item> </el-col> --> - <el-col :span="4"> - <el-form-item> - <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button> - <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div class="minCenter"> + <el-col :span="4"> + <el-form-item> + <el-button size="default" type="primary" @click="listApi">查询</el-button> + <el-button size="default" @click="resetForm">重置</el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div class="minCenter"> <div class="btns"> <div> - <el-button size="default" type="primary" :icon="Plus" @click="openD">新建</el-button> - <el-button size="default" type="warning" plain :icon="EditPen">修改</el-button> - <el-button size="default" type="danger" :icon="Delete" plain>删除</el-button> + <el-button size="default" type="primary" :icon="Plus" @click="openD('新建')">新建</el-button> + <el-button size="default" type="warning" plain :icon="EditPen">修改</el-button> + <el-button size="default" type="danger" :icon="Delete" plain @click="handleSelectionChange">删除 </el-button> </div> <div> <!-- <el-button size="default" :icon="Download"></el-button> <el-button size="default" :icon="Refresh"></el-button> --> </div> </div> - <el-table ref="multipleTableRef" :data="tableData" style="width: 100%"> - <el-table-column type="selection" align="center" width="55" /> - <el-table-column label="奖惩日期" align="center" sortable> - <template #default="scope">{{ scope.row.date }}</template> - </el-table-column> - <el-table-column property="name" align="center" label="奖惩类型" sortable /> - <el-table-column property="name" align="center" label="被奖惩者" sortable /> - <el-table-column property="address" label="奖惩内容" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="奖惩依据" align="center" sortable show-overflow-tooltip /> - <!-- <el-table-column property="address" label="指标级别" align="center" sortable show-overflow-tooltip /> + <el-table ref="multipleTableRef" :data="tableData" style="width: 100%"> + <el-table-column type="selection" align="center" width="55" /> + <el-table-column property="createTime" align="center" label="奖惩日期" sortable /> + <el-table-column label="奖惩类型" align="center" sortable> + <template #default="scope"> + <span v-if="scope.row.standardType==1">奖励</span> + <span v-if="scope.row.standardType==2">惩罚</span> + </template> + </el-table-column> + <el-table-column property="personName" align="center" label="被奖惩者" sortable /> + <el-table-column property="content" label="奖惩内容" align="center" sortable show-overflow-tooltip /> + <el-table-column property="reason" label="奖惩依据" align="center" sortable show-overflow-tooltip /> + <!-- <el-table-column property="address" label="指标级别" align="center" sortable show-overflow-tooltip /> <el-table-column property="address" label="完成期限" align="center" sortable show-overflow-tooltip /> <el-table-column property="address" label="状态" align="center" sortable show-overflow-tooltip /> --> - <el-table-column label="操作" align="center" style="width:300px"> - <template #default> - <el-button link type="primary" size="default" :icon="View">查看</el-button> - <el-button link type="primary" size="default" :icon="EditPen">修改</el-button> - <el-button link type="primary" size="default" :icon="Delete">删除</el-button> - </template> - </el-table-column> - </el-table> - <div class="pages"> - <el-pagination - v-model:currentPage="currentPage4" - v-model:page-size="pageSize4" - :page-sizes="[100, 200, 300, 400]" - :small="small" - :disabled="disabled" - :background="background" - layout="total, sizes, prev, pager, next, jumper" - :total="400" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - /> + <el-table-column label="操作" align="center" style="width: 300px"> + <template #defaultt="scope"> + <el-button link type="primary" size="default" :icon="View" @click="openD('查看', scope.row.id)">查看</el-button> + <el-button link type="primary" size="default" :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button> + <el-button link type="primary" size="default" :icon="Delete" @click="onDelete(scope.row.id)">删除</el-button> + </template> + </el-table-column> + </el-table> + <div class="pages"> + <el-pagination + v-model:currentPage="currentPage4" + v-model:page-size="pageSize4" + :page-sizes="[10, 20, 30, 40]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + <DailogAdd ref="openAdd"></DailogAdd> + <DailogSearchUser ref="openUser"></DailogSearchUser> </div> - <DailogAdd ref="openAdd"></DailogAdd> - <DailogSearchUser ref="openUser"></DailogSearchUser> - </div> </div> </template> <script lang="ts"> -import DailogAdd from './component/DailogAdd.vue' -import DailogSearchUser from '/@/components/DailogSearchUser/index.vue' +import DailogAdd from './component/DailogAdd.vue'; +import DailogSearchUser from '/@/components/DailogSearchUser/index.vue'; import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue'; import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus'; -import { Plus, Delete, Upload, Download, Refresh, View,EditPen,Search} from '@element-plus/icons-vue'; -interface User { - date: string; - name: string; - address: string; -} -import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'; +import { Plus, Delete, Upload, Download, Refresh, View, EditPen, Search } from '@element-plus/icons-vue'; +import { goalManagementApi } from '/@/api/goalManagement'; export default defineComponent({ - components: { ElButton, ElInput,DailogAdd,DailogSearchUser }, + components: { ElButton, ElInput, DailogAdd, DailogSearchUser }, setup() { // 搜索条件 const ruleForm = reactive({ - pass: '', - checkPass: '', + pageSize: 10, + pageIndex: 1, + searchParams: { + personId: '1', ////员工 + }, }); - - const formatter = (row: User, column: TableColumnCtx<User>) => { - return row.address; + // 重置 + const resetForm = () => { + ruleForm.searchParams.personId = ''; + listApi(); }; - - const tableData: User[] = [ - { - date: '2016-05-03', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-02', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-04', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-01', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-08', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-06', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-07', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - ]; - const currentPage4 = ref(4); - const pageSize4 = ref(100); - const small = ref(false); - const disabled = ref(false); - const background = ref(false); + const listApi = () => { + goalManagementApi() + .getrewardPunishmentList(ruleForm) + .then((res) => { + if (res.data.code == 200) { + tableData.value = res.data.data; + currentPage4.value = res.data.pageIndex; + pageSize4.value = res.data.pageSize; + total.value = res.data.total; + } else { + ElMessage.error(res.data.msg); + } + }); + }; + // + const handleClick = (val: any) => { + let targetType = JSON.parse(JSON.stringify(val)); + ruleForm.searchParams.personId = targetType.paneName; + listApi(); + }; + onMounted(() => { + listApi(); + }); + const onAddorUpdata = () => { + listApi(); + }; + // 表格 + const tableData = ref(); + const currentPage4 = ref(); + const pageSize4 = ref(); + const total = ref(); const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); + // console.log(`${val} items per page`); + ruleForm.pageSize = val; + listApi(); }; const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); + // console.log(`current page: ${val}`); + ruleForm.pageIndex = val; + listApi(); }; // 弹窗 const openAdd = ref(); - const openD = () => { - openAdd.value.openDailog(); + const openD = (title: String, id: number) => { + openAdd.value.openDailog(title, ruleForm.searchParams.personId, id); }; - const openUser =ref(); + // 删除 + const onDelete = (id: number) => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .getrewardPunishmentDelete(id) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + ElMessage({ + type: 'info', + message: 'Delete canceled', + }); + }); + }; + // 批量删除 + const warning = ref(true); + const danger = ref(true); + const deletAll = ref(); + const handleSelectionChange = (val: any) => { + let valId = JSON.parse(JSON.stringify(val)); + let arr = []; + for (let i = 0; i < valId.length; i++) { + arr.push(valId[i].id); + } + deletAll.value = arr.toString(); + if (val.length == 1) { + warning.value = false; + danger.value = false; + } else if (val.length == 0) { + warning.value = true; + danger.value = true; + } else { + warning.value = true; + danger.value = false; + } + }; + const onDeleteAll = () => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .getrewardPunishmentDelete(deletAll.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + // ElMessage({ + // type: 'info', + // message: 'Delete canceled', + // }); + }); + }; + const openUser=ref() const openSearch=()=>{ openUser.value.openDailog() } return { - + ruleForm, + resetForm, + listApi, + handleClick, + onAddorUpdata, tableData, - formatter, currentPage4, pageSize4, + total, handleSizeChange, handleCurrentChange, - openAdd, openD, - small, - disabled, - background, - ruleForm, - openUser, + onDelete, + openAdd, + warning, + danger, + deletAll, openSearch, + handleSelectionChange, + onDeleteAll, + openUser, Plus, Delete, Upload, Download, Refresh, View, - EditPen, - Search + EditPen, + Search, }; }, }); @@ -190,16 +268,19 @@ margin-top: 10px; padding: 0 20px; } + .topTitle { - background-color: #fff; - padding: 20px 0px 20px 0px; - margin-bottom:10px ; + background-color: #fff; + padding: 20px 0px 20px 0px; + margin-bottom: 10px; } + .btns { padding: 10px 0px 10px 0px; display: flex; justify-content: space-between; } + .pages { padding: 20px 0; display: flex; diff --git a/src/views/goalManagement/Incentivestandard/component/DailogAdd.vue b/src/views/goalManagement/Incentivestandard/component/DailogAdd.vue index b0538d8..3d5abeb 100644 --- a/src/views/goalManagement/Incentivestandard/component/DailogAdd.vue +++ b/src/views/goalManagement/Incentivestandard/component/DailogAdd.vue @@ -1,46 +1,46 @@ <template> - <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建奖惩标准设定" width="50%" draggable> + <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" :title="titles" width="50%" draggable> <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> - <el-form :model="form" label-width="120px"> + <el-form :model="form" :disabled="disabled" label-width="120px"> <el-row> <el-col :span="11"> <el-form-item label="奖惩类型" size="default"> - <el-select v-model="form.region" style="width: 100%" placeholder=""> - <el-option label="Zone one" value="shanghai" /> - <el-option label="Zone two" value="beijing" /> + <el-select v-model="form.standardType" style="width: 100%" placeholder="请选择"> + <el-option label="奖励" value="1" /> + <el-option label="惩罚" value="2" /> </el-select> </el-form-item> </el-col> <el-col :span="11" :offset="2"> <el-form-item label="奖惩内容" size="default"> - <el-input v-model="form.name" /> + <el-input v-model="form.content" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="11"> <el-form-item label="奖惩名称" size="default"> - <el-input v-model="form.name" /> + <el-input v-model="form.qName" /> </el-form-item> </el-col> <el-col :span="11" :offset="2"> <el-form-item label="依据" size="default"> - <el-input v-model="form.name" /> + <el-input v-model="form.reason" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="备注信息"> - <el-input v-model="form.name" type="textarea" /> + <el-input v-model="form.memo" type="textarea" /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <span class="dialog-footer"> - <el-button @click="dialogVisible = false" size="default">关闭</el-button> - <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button> + <el-button @click="resetForm" size="default">关闭</el-button> + <el-button type="primary" @click="submitForm" size="default">确定</el-button> </span> </template> </el-dialog> @@ -48,24 +48,72 @@ <script lang="ts"> import { defineComponent, ref, reactive } from 'vue'; import { Search, FullScreen } from '@element-plus/icons-vue'; +import { goalManagementApi } from '/@/api/goalManagement'; +import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus'; export default defineComponent({ - setup() { + setup(props, { emit }) { + let Shows = ref(false); const dialogVisible = ref<boolean>(false); - const form = reactive({ - name: '', - region: '', - date1: '', - date2: '', - delivery: false, - type: [], - resource: '', - desc: '', + const form = ref({ + qName: "", ////奖惩名称 + reason: "", ////依据 + memo: "", ////备注信息 + content: "", ////奖惩内容 + standardType: null ////奖惩类型 1:奖励 2:惩罚 }); - const openDailog = (type: string, value: any, projectList: any, projectId: string) => { + const titles = ref(); + const disabled = ref(false); + // 打开弹窗 + const openDailog = (title: string, value: any, id: number) => { dialogVisible.value = true; + titles.value = `${title}奖惩标准设定`; + disabled.value = title == '查看' ? true : false; + if (title == '查看' || title == '修改') + goalManagementApi() + .getrewardPunishmentStandardDetail(id) + .then((res) => { + if (res.data.code == 200) { + form.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); }; - // 导航 - const activeName = ref('1'); + // 提交 + const submitForm = () => { + dialogVisible.value = false; + goalManagementApi() + .getrewardPunishmentStandardaddOrUpdate(form.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + emit('navAddorUpdata'); + } else { + ElMessage.error(res.data.msg); + } + }); + form.value = { + qName: "", ////奖惩名称 + reason: "", ////依据 + memo: "", ////备注信息 + content: "", ////奖惩内容 + standardType: null, ////奖惩类型 1:奖励 2:惩罚 + } + }; + // 取消 + const resetForm = () => { + dialogVisible.value = false; + form.value = { + qName: "", ////奖惩名称 + reason: "", ////依据 + memo: "", ////备注信息 + content: "", ////奖惩内容 + standardType: null, ////奖惩类型 1:奖励 2:惩罚 + }; + }; //全屏 const full = ref(false); const toggleFullscreen = () => { @@ -78,10 +126,13 @@ return { form, + titles, dialogVisible, openDailog, - activeName, + disabled, Search, + submitForm, + resetForm, full, toggleFullscreen, FullScreen, diff --git a/src/views/goalManagement/Incentivestandard/index.vue b/src/views/goalManagement/Incentivestandard/index.vue index b1d0547..0629074 100644 --- a/src/views/goalManagement/Incentivestandard/index.vue +++ b/src/views/goalManagement/Incentivestandard/index.vue @@ -1,34 +1,34 @@ <template> -<div> - <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> - <el-row> - <el-col :span="4"> - <el-form-item> - <el-select v-model="ruleForm.region" size="default" style="width:100%" placeholder=""> - <el-option label="Zone one" value="shanghai" /> - <el-option label="Zone two" value="beijing" /> - </el-select> - </el-form-item> - </el-col> - <!-- <el-col :span="4"> + <div> + <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> + <el-row> + <el-col :span="4"> + <el-form-item> + <el-select v-model="ruleForm.searchParams.standardType" size="default" style="width: 100%" placeholder="请选择"> + <el-option label="奖励" value="1" /> + <el-option label="惩罚" value="2" /> + </el-select> + </el-form-item> + </el-col> + <!-- <el-col :span="4"> <el-form-item> <el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" /> </el-form-item> </el-col> --> - <el-col :span="4"> - <el-form-item> - <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button> - <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div class="minCenter"> + <el-col :span="4"> + <el-form-item> + <el-button size="default" type="primary" @click="listApi">查询</el-button> + <el-button size="default" @click="resetForm">重置</el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div class="minCenter"> <div class="btns"> <div> - <el-button size="default" type="primary" :icon="Plus" @click="openD">新建</el-button> - <el-button size="default" type="warning" plain :icon="EditPen">修改</el-button> - <el-button size="default" type="danger" :icon="Delete" plain>删除</el-button> + <el-button size="default" type="primary" :icon="Plus" @click="openD('新建')" >新建</el-button> + <el-button size="default" type="warning" :disabled="warning" plain :icon="EditPen" @click="openD">修改 </el-button> + <el-button size="default" type="danger" :disabled="danger" :icon="Delete" plain @click="handleSelectionChange">删除</el-button> </div> <div> <!-- <el-button size="default" :icon="Upload" @click="upButton"></el-button> @@ -36,152 +36,218 @@ <el-button size="default" :icon="Refresh"></el-button> --> </div> </div> - <el-table ref="multipleTableRef" :data="tableData" style="width: 100%"> - <el-table-column type="selection" align="center" width="55" /> - <el-table-column label="奖惩名称" align="center" sortable> - <template #default="scope">{{ scope.row.date }}</template> - </el-table-column> - <el-table-column property="name" align="center" label="奖惩类型" sortable /> - <el-table-column property="address" label="奖惩内容" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="依据" align="center" sortable show-overflow-tooltip /> - <!-- <el-table-column property="address" label="指标级别" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="完成期限" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="状态" align="center" sortable show-overflow-tooltip /> --> - <el-table-column property="address" label="备注信息" align="center" sortable show-overflow-tooltip /> - <el-table-column label="操作" align="center" sortable show-overflow-tooltip> - <template #default> - <el-button link type="primary" size="default" :icon="View">查看</el-button> - <el-button link type="primary" size="default" :icon="EditPen">修改</el-button> - <el-button link type="primary" size="default" :icon="Delete">删除</el-button> - </template> - </el-table-column> - </el-table> - <div class="pages"> - <el-pagination - v-model:currentPage="currentPage4" - v-model:page-size="pageSize4" - :page-sizes="[100, 200, 300, 400]" - :small="small" - :disabled="disabled" - :background="background" - layout="total, sizes, prev, pager, next, jumper" - :total="400" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - /> + <el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%"> + <el-table-column type="selection" align="center" width="55" /> + <el-table-column property="qname" align="center" label="奖惩名称" sortable /> + <el-table-column property="name" align="center" label="奖惩类型" sortable> + <template #default="scope"> + <span v-if="scope.row.standardType == 1">奖励</span> + <span v-if="scope.row.standardType == 2">惩罚</span> + </template> + </el-table-column> + <el-table-column property="content" label="奖惩内容" align="center" sortable show-overflow-tooltip /> + <el-table-column property="reason" label="依据" align="center" sortable show-overflow-tooltip /> + <el-table-column property="memo" label="备注信息" align="center" sortable show-overflow-tooltip /> + <el-table-column label="操作" align="center" sortable show-overflow-tooltip> + <template #default="scope"> + <el-button link type="primary" size="default" :icon="View" @click="openD('查看', scope.row.id)">查看 </el-button> + <el-button link type="primary" size="default" :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button> + <el-button link type="primary" size="default" :icon="Delete" @click="onDelete(scope.row.id)">删除 </el-button> + </template> + </el-table-column> + </el-table> + <div class="pages"> + <el-pagination + v-model:currentPage="currentPage4" + v-model:page-size="pageSize4" + :page-sizes="[10, 20, 30, 40]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + <DailogAdd ref="openAdd" @navAddorUpdata="onAddorUpdata"></DailogAdd> + <!-- <upData ref="upShow"></upData> --> </div> - <DailogAdd ref="openAdd"></DailogAdd> - <upData ref="upShow"></upData> - </div> </div> </template> <script lang="ts"> -import DailogAdd from './component/DailogAdd.vue' +import DailogAdd from './component/DailogAdd.vue'; import upData from '../../../components/updata/updata.vue'; import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue'; import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus'; -import { Plus, Delete, Upload, Download, Refresh, View,EditPen } from '@element-plus/icons-vue'; -interface User { - date: string; - name: string; - address: string; -} +import { Plus, Delete, Upload, Download, Refresh, View, EditPen } from '@element-plus/icons-vue'; import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'; +import { goalManagementApi } from '/@/api/goalManagement'; export default defineComponent({ - components: { ElButton, ElInput, upData,DailogAdd }, + components: { ElButton, ElInput, upData, DailogAdd }, setup() { // 搜索条件 const ruleForm = reactive({ - pass: '', - checkPass: '', + pageSize: 10, + pageIndex: 1, + searchParams: { + standardType: '', ////奖惩类型 1:奖励 2:惩罚 + }, }); - - const formatter = (row: User, column: TableColumnCtx<User>) => { - return row.address; + // 重置 + const resetForm = () => { + ruleForm.searchParams.standardType = ''; + listApi(); }; - - const tableData: User[] = [ - { - date: '2016-05-03', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-02', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-04', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-01', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-08', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-06', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-07', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - ]; - const currentPage4 = ref(4); - const pageSize4 = ref(100); - const small = ref(false); - const disabled = ref(false); - const background = ref(false); + const listApi = () => { + goalManagementApi() + .getrewardPunishmentStandardList(ruleForm) + .then((res) => { + if (res.data.code == 200) { + tableData.value = res.data.data; + currentPage4.value = res.data.pageIndex; + pageSize4.value = res.data.pageSize; + total.value = res.data.total; + } else { + ElMessage.error(res.data.msg); + } + }); + }; + // + const handleClick = (val: any) => { + let targetType = JSON.parse(JSON.stringify(val)); + ruleForm.searchParams.standardType = targetType.paneName; + listApi(); + }; + onMounted(() => { + listApi(); + }); + const onAddorUpdata = () => { + listApi(); + }; + // 表格 + const tableData = ref(); + const currentPage4 = ref(); + const pageSize4 = ref(); + const total = ref(); const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); + // console.log(`${val} items per page`); + ruleForm.pageSize = val; + listApi(); }; const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); + // console.log(`current page: ${val}`); + ruleForm.pageIndex = val; + listApi(); }; // 弹窗 const openAdd = ref(); - const openD = () => { - openAdd.value.openDailog(); + const openD = (title: String, id: number) => { + openAdd.value.openDailog(title, ruleForm.searchParams.standardType, id); }; - - // 上传 - const upShow = ref(); - const upButton = () => { - upShow.value.openDialog(); + // 删除 + const onDelete = (id: number) => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .getrewardPunishmentStandardDelete(id) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + ElMessage({ + type: 'info', + message: 'Delete canceled', + }); + }); + }; + // 批量删除 + const warning = ref(true); + const danger = ref(true); + const deletAll = ref(); + const handleSelectionChange = (val: any) => { + let valId = JSON.parse(JSON.stringify(val)); + let arr = []; + for (let i = 0; i < valId.length; i++) { + arr.push(valId[i].id); + } + deletAll.value = arr.toString(); + if (val.length == 1) { + warning.value = false; + danger.value = false; + } else if (val.length == 0) { + warning.value = true; + danger.value = true; + } else { + warning.value = true; + danger.value = false; + } + }; + const onDeleteAll = () => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .getrewardPunishmentStandardDelete(deletAll.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + // ElMessage({ + // type: 'info', + // message: 'Delete canceled', + // }); + }); }; return { - + ruleForm, + resetForm, + listApi, + handleClick, + onAddorUpdata, tableData, - formatter, currentPage4, pageSize4, + total, handleSizeChange, handleCurrentChange, openAdd, openD, - upShow, - upButton, - small, - disabled, - background, - ruleForm, + onDelete, + warning, + danger, + deletAll, + handleSelectionChange, + onDeleteAll, Plus, Delete, Upload, Download, Refresh, View, - EditPen + EditPen, }; }, }); @@ -193,16 +259,19 @@ margin-top: 10px; padding: 0 20px; } + .topTitle { - background-color: #fff; - padding: 20px 0px 20px 0px; - margin-bottom:10px ; + background-color: #fff; + padding: 20px 0px 20px 0px; + margin-bottom: 10px; } + .btns { padding: 10px 0px 10px 0px; display: flex; justify-content: space-between; } + .pages { padding: 20px 0; display: flex; diff --git a/src/views/goalManagement/TargetBook/component/DailogAdd.vue b/src/views/goalManagement/TargetBook/component/DailogAdd.vue index 246d5be..3f572d3 100644 --- a/src/views/goalManagement/TargetBook/component/DailogAdd.vue +++ b/src/views/goalManagement/TargetBook/component/DailogAdd.vue @@ -1,11 +1,11 @@ <template> - <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建目标责任书" width="50%" draggable> + <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" :title="titles" width="50%" draggable> <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> - <el-form :model="form" label-width="120px"> + <el-form :model="form" :disabled="disabled" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="岗位" size="default"> - <el-input v-model="form.name" placeholder="请选择"> + <el-input v-model="form.jobId" placeholder="请选择"> <template #append> <el-button :icon="Search" @click="daiInpt" /> </template ></el-input> </el-form-item> @@ -14,14 +14,14 @@ <el-row> <el-col :span="24"> <el-form-item label="责任书签订日期" size="default"> - <el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" /> + <el-date-picker v-model="form.signDate" style="width:100%" format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择日期时间" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="备注信息"> - <el-input v-model="form.name" type="textarea" /> + <el-input v-model="form.memo" type="textarea" /> </el-form-item> </el-col> </el-row> @@ -50,12 +50,12 @@ </el-form> <template #footer> <span class="dialog-footer"> - <el-button @click="dialogVisible = false" size="default">关闭</el-button> - <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button> + <el-button @click="resetForm" size="default">关闭</el-button> + <el-button type="primary" @click="submitForm" size="default">确定</el-button> </span> </template> </el-dialog> - <DailogSearch ref="Shows"></DailogSearch> + <DailogSearch ref="Shows" @backNum="IdNumber"></DailogSearch> </template> <script lang="ts"> import { defineComponent, ref, reactive } from 'vue'; @@ -63,32 +63,79 @@ import DailogSearch from './DailogSearch.vue'; import { ElMessage, ElMessageBox } from 'element-plus'; import type { UploadProps, UploadUserFile } from 'element-plus'; +import { goalManagementApi } from '/@/api/goalManagement'; export default defineComponent({ components: { DailogSearch }, - setup() { + setup(props, { emit }) { const dialogVisible = ref<boolean>(false); - const form = reactive({ - name: '', - region: '', - date1: '', - date2: '', - delivery: false, - type: [], - resource: '', - desc: '', + const form = ref({ + indexNum: '', //目标指标编号 + memo: '', ////备注信息 + signDate: '', //责任书签订日期 + extraFile: '666', //责任书附件 + jobId: '', //岗位 }); - const openDailog = (type: string, value: any, projectList: any, projectId: string) => { + const titles = ref(); + const disabled = ref(false); + // 打开弹窗 + const openDailog = (title: string, value: any, id: number) => { dialogVisible.value = true; + titles.value =`${title}目标责任书`; + disabled.value = title == '查看' ? true : false; + if (title == '查看' || title == '修改') + goalManagementApi() + .gettargetDutyfileInfoDetail(id) + .then((res) => { + if (res.data.code == 200) { + form.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); }; - // 导航 - const activeName = ref('1'); - // 表格 - + // 提交 + const submitForm = () => { + dialogVisible.value = false; + goalManagementApi() + .gettargetDutyfileInfoAddorUpdata(form.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + emit('navAddorUpdata'); + } else { + ElMessage.error(res.data.msg); + } + }); + form.value = { + indexNum: '', //目标指标编号 + memo: '', ////备注信息 + signDate: '', //责任书签订日期 + extraFile: '666', //责任书附件 + jobId: '', //岗位 + }; + }; + // 取消 + const resetForm = () => { + dialogVisible.value = false; + form.value = { + indexNum: '', //目标指标编号 + memo: '', ////备注信息 + signDate: '', //责任书签订日期 + extraFile: '666', //责任书附件 + jobId: '', //岗位 + }; + }; // 安全目标指标弹窗 const Shows = ref(); const daiInpt = () => { Shows.value.openDailog(); }; + const IdNumber=(val:any)=>{ + form.value.jobId=val.id + } // 点击上传 const fileList = ref<UploadUserFile[]>([ { @@ -129,12 +176,16 @@ } }; return { - form, + IdNumber, dialogVisible, + form, + disabled, + titles, openDailog, - activeName, - Shows, daiInpt, + submitForm, + resetForm, + Shows, Search, fileList, handleRemove, diff --git a/src/views/goalManagement/TargetBook/component/DailogSearch.vue b/src/views/goalManagement/TargetBook/component/DailogSearch.vue index b8f225d..1801078 100644 --- a/src/views/goalManagement/TargetBook/component/DailogSearch.vue +++ b/src/views/goalManagement/TargetBook/component/DailogSearch.vue @@ -24,8 +24,14 @@ </el-row> </el-form> <el-button size="default" :icon="Delete">清除选择</el-button> - <el-table :data="tableData" style="width: 100%; margin-top: 20px"> - <el-table-column align="center" type="selection" /> + <el-table :data="tableData" style="width: 100%; margin-top: 20px" @cell-click="radio"> + <el-table-column align="center"> + <template #default="scope"> + <el-radio-group v-model="radio1"> + <el-radio :label="scope.row.id" size="large">{{ null }}</el-radio> + </el-radio-group> + </template> + </el-table-column> <el-table-column align="center" prop="date" label="岗位名称" /> </el-table> <el-pagination @@ -43,6 +49,7 @@ /> </el-col> <el-col :span="7"> + <div v-if="dynamicTags[0]==''?false:true"> <el-tag v-for="tag in dynamicTags" :key="tag" @@ -52,14 +59,15 @@ :disable-transitions="false" @close="handleClose(tag)" > - {{ tag }} + {{ tag.id }} </el-tag> + </div> </el-col> </el-row> <template #footer> <span class="dialog-footer"> <el-button @click="dialogVisible = false" size="default">关闭</el-button> - <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button> + <el-button type="primary" @click="submitForm" size="default">确定</el-button> </span> </template> </el-dialog> @@ -68,7 +76,7 @@ import { defineComponent, reactive, ref } from 'vue'; import { Delete, FullScreen } from '@element-plus/icons-vue'; export default defineComponent({ - setup() { + setup(props,{emit}) { const dialogVisible = ref<boolean>(false); const openDailog = () => { dialogVisible.value = true; @@ -80,22 +88,24 @@ }); // 表格 const tableData = [ - { + { id:1, date: '2016-05-03', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { + id:2, date: '2016-05-02', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, - { + { + id:3, date: '2016-05-04', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, - { + { id:4, date: '2016-05-01', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', @@ -109,10 +119,24 @@ console.log(`current page: ${val}`); }; // 右方点击添加后显示标签 - const dynamicTags = ref(['Tag 1', 'Tag 2', 'Tag 3']); + const dynamicTags = ref(['']); const handleClose = (tag: string) => { dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1); + radio1.value = ''; }; + const radio1 = ref(''); + const radio = (event: any) => { + dynamicTags.value[0] = event; + }; + const clear=()=>{ + dynamicTags.value=[''] + radio1.value="" + } + const submitForm=()=>{ + let obj=JSON.parse(JSON.stringify(dynamicTags.value)) + emit("backNum",obj[0]) + dialogVisible.value = false + } //全屏 const full = ref(false); const toggleFullscreen = () => { @@ -123,6 +147,9 @@ } }; return { + radio1, + radio, + clear, dialogVisible, openDailog, ruleForm, @@ -132,6 +159,7 @@ handleCurrentChange, dynamicTags, handleClose, + submitForm, Delete, full, toggleFullscreen, diff --git a/src/views/goalManagement/TargetBook/index.vue b/src/views/goalManagement/TargetBook/index.vue index 5025fac..96cb180 100644 --- a/src/views/goalManagement/TargetBook/index.vue +++ b/src/views/goalManagement/TargetBook/index.vue @@ -1,175 +1,243 @@ <template> - <div> - <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> - <el-row> - <el-col :span="4"> - <el-form-item size="default"> - <el-input v-model="ruleForm.name" placeholder="请选择岗位"> + <div> + <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle"> + <el-row> + <el-col :span="4"> + <el-form-item size="default"> + <el-input v-model="ruleForm.searchParams.jobId" placeholder="请选择岗位"> <template #append> <el-button :icon="Search" @click="openSearch" /> </template ></el-input> - </el-form-item> - </el-col> - <!-- <el-col :span="4"> + </el-form-item> + </el-col> + <!-- <el-col :span="4"> <el-form-item> <el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" /> </el-form-item> </el-col> --> - <el-col :span="4"> - <el-form-item> - <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button> - <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div class="minCenter"> + <el-col :span="4"> + <el-form-item> + <el-button size="default" type="primary" @click="listApi">查询</el-button> + <el-button size="default" @click="resetForm">重置</el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div class="minCenter"> <div class="btns"> <div> - <el-button size="default" type="primary" :icon="Plus" @click="openD">新建</el-button> - <el-button size="default" type="warning" plain :icon="EditPen">修改</el-button> - <el-button size="default" type="danger" :icon="Delete" plain>删除</el-button> + <el-button size="default" type="primary" :icon="Plus" @click="openD('新建')">新建</el-button> + <el-button size="default" :disabled="warning" type="warning" plain :icon="EditPen">修改</el-button> + <el-button size="default" :disabled="danger" type="danger" :icon="Delete" plain @click="onDeleteAll">删除</el-button> </div> <div> <!-- <el-button size="default" :icon="Download"></el-button> <el-button size="default" :icon="Refresh"></el-button> --> </div> </div> - <el-table ref="multipleTableRef" :data="tableData" style="width: 100%"> - <el-table-column type="selection" align="center" width="55" /> - <el-table-column type="index" label="序号" align="center" width="70" /> - <el-table-column label="岗位" align="center" sortable> - <template #default="scope">{{ scope.row.date }}</template> - </el-table-column> - <el-table-column property="name" align="center" label="责任书签订日期" sortable /> - <el-table-column property="name" align="center" label="附件" sortable /> - <el-table-column property="address" label="备注信息" align="center" sortable show-overflow-tooltip /> - <!-- <el-table-column property="address" label="奖惩依据" align="center" sortable show-overflow-tooltip /> --> - <!-- <el-table-column property="address" label="指标级别" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="完成期限" align="center" sortable show-overflow-tooltip /> - <el-table-column property="address" label="状态" align="center" sortable show-overflow-tooltip /> --> - <el-table-column label="操作" align="center" style="width:300px"> - <template #default> - <el-button link type="primary" size="default" :icon="View">查看</el-button> - <el-button link type="primary" size="default" :icon="EditPen">修改</el-button> - <el-button link type="primary" size="default" :icon="Delete">删除</el-button> - </template> - </el-table-column> - </el-table> - <div class="pages"> - <el-pagination - v-model:currentPage="currentPage4" - v-model:page-size="pageSize4" - :page-sizes="[100, 200, 300, 400]" - :small="small" - :disabled="disabled" - :background="background" - layout="total, sizes, prev, pager, next, jumper" - :total="400" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - /> + <el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%"> + <el-table-column type="selection" align="center" width="55" /> + <el-table-column type="index" label="序号" align="center" width="70" /> + <el-table-column property="jobId" align="center" label="岗位" sortable /> + <el-table-column property="signDate" align="center" label="责任书签订日期" sortable /> + <el-table-column property="extraFile" align="center" label="附件" sortable /> + <el-table-column property="memo" label="备注信息" align="center" sortable show-overflow-tooltip /> + <el-table-column label="操作" align="center" style="width: 300px"> + <template #default="scope"> + <el-button link type="primary" size="default" :icon="View" @click="openD('查看', scope.row.id)">查看</el-button> + <el-button link type="primary" size="default" :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button> + <el-button link type="primary" size="default" :icon="Delete" @click="onDelete(scope.row.id)">删除</el-button> + </template> + </el-table-column> + </el-table> + <div class="pages"> + <el-pagination + v-model:currentPage="currentPage4" + v-model:page-size="pageSize4" + :page-sizes="[10, 20, 30, 40]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + <DailogAdd ref="openAdd" @navAddorUpdata="onAddorUpdata"></DailogAdd> + <DailogSearch ref="openUser"></DailogSearch> </div> - <DailogAdd ref="openAdd"></DailogAdd> - <DailogSearch ref="openUser"></DailogSearch> - </div> </div> </template> <script lang="ts"> -import DailogAdd from './component/DailogAdd.vue' -import DailogSearch from './component/DailogSearch.vue' +import DailogAdd from './component/DailogAdd.vue'; +import DailogSearch from './component/DailogSearch.vue'; import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue'; import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus'; -import { Plus, Delete, Upload, Download, Refresh, View,EditPen,Search} from '@element-plus/icons-vue'; -interface User { - date: string; - name: string; - address: string; -} +import { Plus, Delete, Upload, Download, Refresh, View, EditPen, Search } from '@element-plus/icons-vue'; +import { goalManagementApi } from '/@/api/goalManagement'; import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'; export default defineComponent({ - components: { ElButton, ElInput,DailogAdd,DailogSearch }, + components: { ElButton, ElInput, DailogAdd, DailogSearch }, setup() { // 搜索条件 const ruleForm = reactive({ - pass: '', - checkPass: '', + pageSize: 10, + pageIndex: 1, + searchParams: { + jobId: '', ////岗位号/外键 + }, }); - - const formatter = (row: User, column: TableColumnCtx<User>) => { - return row.address; + // 重置 + const resetForm = () => { + ruleForm.searchParams.jobId = ''; + listApi(); }; - - const tableData: User[] = [ - { - date: '2016-05-03', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-02', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-04', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-01', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-08', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-06', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-07', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - ]; - const currentPage4 = ref(4); - const pageSize4 = ref(100); - const small = ref(false); - const disabled = ref(false); - const background = ref(false); + const listApi = () => { + goalManagementApi() + .gettargetDutyfileInfoList(ruleForm) + .then((res) => { + if (res.data.code == 200) { + tableData.value = res.data.data; + currentPage4.value = res.data.pageIndex; + pageSize4.value = res.data.pageSize; + total.value = res.data.total; + } else { + ElMessage.error(res.data.msg); + } + }); + }; + // + const handleClick = (val: any) => { + let targetType = JSON.parse(JSON.stringify(val)); + ruleForm.searchParams.jobId = targetType.paneName; + listApi(); + }; + onMounted(() => { + listApi(); + }); + const onAddorUpdata = () => { + listApi(); + }; + // 表格 + const tableData = ref(); + const currentPage4 = ref(); + const pageSize4 = ref(); + const total = ref(); const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); + // console.log(`${val} items per page`); + ruleForm.pageSize = val; + listApi(); }; const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); + // console.log(`current page: ${val}`); + ruleForm.pageIndex = val; + listApi(); }; // 弹窗 const openAdd = ref(); - const openD = () => { - openAdd.value.openDailog(); + const openD = (title: String, id: number) => { + openAdd.value.openDailog(title, ruleForm.searchParams.jobId, id); }; - const openUser =ref(); - const openSearch=()=>{ - openUser.value.openDailog() - } + // 删除 + const onDelete = (id: number) => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .gettargetDutyfileInfoDelete(id) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + ElMessage({ + type: 'info', + message: 'Delete canceled', + }); + }); + }; + // 批量删除 + const warning = ref(true); + const danger = ref(true); + const deletAll = ref(); + const handleSelectionChange = (val: any) => { + let valId = JSON.parse(JSON.stringify(val)); + let arr = []; + for (let i = 0; i < valId.length; i++) { + arr.push(valId[i].id); + } + deletAll.value = arr.toString(); + if (val.length == 1) { + warning.value = false; + danger.value = false; + } else if (val.length == 0) { + warning.value = true; + danger.value = true; + } else { + warning.value = true; + danger.value = false; + } + }; + const onDeleteAll = () => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + goalManagementApi() + .gettargetDutyfileInfoDelete(deletAll.value) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + listApi(); + } else { + ElMessage.error(res.data.msg); + } + }); + }) + .catch(() => { + // ElMessage({ + // type: 'info', + // message: 'Delete canceled', + // }); + }); + }; + const openUser = ref(); + const openSearch = () => { + openUser.value.openDailog(); + }; return { - + ruleForm, + resetForm, + listApi, + handleClick, + onAddorUpdata, tableData, - formatter, currentPage4, pageSize4, + total, handleSizeChange, handleCurrentChange, openAdd, openD, - small, - disabled, - background, - ruleForm, + onDelete, + warning, + danger, + deletAll, + handleSelectionChange, + onDeleteAll, openUser, openSearch, Plus, @@ -178,8 +246,8 @@ Download, Refresh, View, - EditPen, - Search + EditPen, + Search, }; }, }); @@ -192,9 +260,9 @@ padding: 0 20px; } .topTitle { - background-color: #fff; - padding: 20px 0px 20px 0px; - margin-bottom:10px ; + background-color: #fff; + padding: 20px 0px 20px 0px; + margin-bottom: 10px; } .btns { padding: 10px 0px 10px 0px; diff --git a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue index a9bc880..915883e 100644 --- a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue +++ b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue @@ -34,17 +34,17 @@ <el-button type="primary" size="default" @click="daiAdd" :disabled="disabled">新增</el-button> </el-tab-pane> </el-tabs> - <el-table :data="tableData" style="width: 100%"> - <el-table-column align="center" prop="dutyDepartmentId" label="责任部门" width="180" /> - <el-table-column align="center" prop="value" label="考核指标" width="180" /> - <el-table-column align="center" prop="makerDepartmentId" label="制定人部门" /> - <el-table-column align="center" prop="makeDate" label="制定日期" /> - <el-table-column align="center" prop="commitPersonId" label="上报人" /> - <el-table-column align="center" label="操作"> - <template #default> - <el-button link type="primary">查看</el-button> - <el-button link :disabled="disabled" type="primary">修改</el-button> - <el-button link :disabled="disabled" type="primary">删除</el-button> + <el-table :data="form.targetDivideDetailList" style="width: 100%"> + <el-table-column align="center" property="dutyDepartmentId" label="责任部门" width="180" /> + <el-table-column align="center" property="value" label="考核指标" width="180" /> + <el-table-column align="center" property="makerDepartmentId" label="制定人部门" /> + <el-table-column align="center" property="makeDate" label="制定日期" /> + <el-table-column align="center" property="commitPersonId" label="上报人" /> + <el-table-column align="center" property="操作"> + <template #default="scope"> + <el-button link type="primary" @click="daiAdd('查看', scope.row)">查看</el-button> + <el-button link :disabled="disabled" type="primary" @click="daiAdd('修改', scope.row)">修改</el-button> + <el-button link :disabled="disabled" type="primary" @click="Delete(scope.row)">删除</el-button> </template> </el-table-column> </el-table> @@ -103,23 +103,43 @@ Show.value.openDailog(); }; const formUp = reactive({ - targetId:"", //关联的目标指标/外键 + targetId: '', //关联的目标指标/外键 delTargetDivideDetails: '', //要删除的目标指标分解ID,多个用逗号隔开 targetDivideDetailList: [], //目标指标分解列表 }); - const add = (e:any) => { - formUp.targetDivideDetailList.push(e) + const add = (e: any) => { + formUp.targetDivideDetailList.push(e); // let obj=JSON.parse(JSON.stringify(form.value)) - formUp.targetId=form.value.id - goalManagementApi().gettargetDivideDetail(formUp).then(res=>{ - if(res.data.code==200){ - - } - }) + formUp.targetId = form.value.id; + goalManagementApi() + .gettargetDivideDetail(formUp) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + }else{ + ElMessage.error(res.data.msg); + } + }); }; - const submitForm=()=>{ - - } + const submitForm = () => {}; + // 删除 + const Delete = (data: any) => { + formUp.delTargetDivideDetails=data.id + goalManagementApi() + .gettargetDivideDetail(formUp).then(res=>{ + if(res.data.code==200){ + ElMessage({ + message: res.data.msg, + type: 'success', + }); + }else{ + ElMessage.error(res.data.msg); + } + }) + }; // 安全目标指标弹窗 const Shows = ref(); const daiInpt = () => { @@ -161,7 +181,8 @@ titles, add, formUp, - submitForm + submitForm, + Delete }; }, }); diff --git a/src/views/goalManagement/targetSettings/component/dailogAdd.vue b/src/views/goalManagement/targetSettings/component/dailogAdd.vue index cd28085..e6d69db 100644 --- a/src/views/goalManagement/targetSettings/component/dailogAdd.vue +++ b/src/views/goalManagement/targetSettings/component/dailogAdd.vue @@ -38,7 +38,8 @@ </el-col> <el-col :span="11" :offset="2"> <el-form-item label="完成期限" size="default"> - <el-date-picker v-model="form.completeDate" format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择" style="width: 100%" /> + <el-date-picker v-model="form.completeDate" format="YYYY-MM-DD HH:mm:ss" type="datetime" + placeholder="请选择" style="width: 100%" /> </el-form-item> </el-col> </el-row> @@ -49,7 +50,8 @@ <template #footer> <span class="dialog-footer"> <el-button @click="resetForm(ruleFormRef)" size="default">关闭</el-button> - <el-button type="primary" v-if="titles == '查看目标设定' ? false : true" @click="submitForm(ruleFormRef)" size="default">确定</el-button> + <el-button type="primary" v-if="titles == '查看目标设定' ? false : true" @click="submitForm(ruleFormRef)" + size="default">确定</el-button> </span> </template> </el-dialog> @@ -73,7 +75,7 @@ memo: '', ////备注信息 targetType: '', ////指标类型 1:年指标 2:月指标 completeDate: '', ////完成期限 - divideStatus: '1', ////分解状态 1:已分解 2:未分解 + divideStatus: '2', ////分解状态 1:已分解 2:未分解 value: '', ////指标值 }); const titles = ref(); @@ -134,6 +136,7 @@ }, ], }); + // 提交 const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid, fields) => { @@ -169,7 +172,7 @@ value: '', ////指标值 }; }; - + // 取消 const resetForm = (formEl: FormInstance | undefined) => { if (!formEl) return; formEl.resetFields(); @@ -192,6 +195,7 @@ Shows, form, full, + disabled, toggleFullscreen, rules, ruleFormRef, -- Gitblit v1.9.2