| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" title="新建考核标准设定" width="60%" draggable> |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form :model="form" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="标准标题" size="default"> |
| | | <el-input v-model="form.title"> </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> |
| | | <el-form-item label="适用范围" size="default"> |
| | | <el-select v-model="form.applyRange" style="width: 100%" placeholder="请选择"> |
| | | <el-option label="安全生产责任制考核1" value="1" /> |
| | | <el-option label="安全生产责任制考核2" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <div v-if="clickType"> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="设定人" size="default"> |
| | | <el-input v-model="form.setPersonId" disabled> |
| | | <template #append> <el-button :icon="Search" @click="daiInpt" /></template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> |
| | | <el-form-item label="设定人部门" size="default"> |
| | | <el-select v-model="form.setPersonDepartmentId" disabled 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-row> |
| | | </div> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="模板分类编码" size="default"> |
| | | <el-input v-model="form.templateCode" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> |
| | | <el-form-item label="合格分数" size="default"> |
| | | <el-input v-model="form.acceptanceNumber" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="备注信息"> |
| | | <el-input v-model="form.memo" type="textarea" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2" v-if="clickType"> |
| | | <el-form-item label="设定日期" size="default"> |
| | | <el-date-picker disabled v-model="form.setTimem" format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择" style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <el-tabs v-model="activeName" class="demo-tabs"> |
| | | <el-tab-pane label="考核项目" name="1"> |
| | | <el-button type="primary" size="default" @click="daiAdd('新增','')">新增</el-button> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <el-table :data="form.examineItemList" style="width: 100%"> |
| | | <el-table-column align="center" prop="itemType" label="类型" width="180" /> |
| | | <el-table-column align="center" prop="itemDetail" label="考核项目" width="180" /> |
| | | <el-table-column align="center" prop="content" label="考核内容" /> |
| | | <el-table-column align="center" prop="judgeStandard" label="评定标准" /> |
| | | <el-table-column align="center" prop="memo" label="考核说明" /> |
| | | <el-table-column align="center" label="操作"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="daiAdd('查看', scope.row)">查看</el-button> |
| | | <el-button link type="primary" @click="daiAdd('修改', scope.row)">修改</el-button> |
| | | <el-button link type="primary" @click="deleteA(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="resetForm" size="default">关闭</el-button> |
| | | <el-button type="primary" @click="submitForm" size="default">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <DailogKhS ref="Show" @onAdd="AddObj"></DailogKhS> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref, reactive } from 'vue'; |
| | | import { Search, FullScreen } from '@element-plus/icons-vue'; |
| | | import DailogKhS from './DailogKhS.vue'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import { goalManagementApi } from '/@/api/goalManagement'; |
| | | export default defineComponent({ |
| | | components: { DailogKhS }, |
| | | setup(props, { emit }) { |
| | | const dialogVisible = ref<boolean>(false); |
| | | const form = ref({ |
| | | examineItemList: [], //考核项目列表 |
| | | setTimem: 1658386392466, |
| | | memo: '', ////备注信息 |
| | | templateCode: '', ////模板分类编码 |
| | | title: '', ////标准标题 |
| | | setPersonId: 1, //设定人 |
| | | acceptanceNumber: '', ////合格分数 |
| | | setPersonDepartmentId: 2, //设定人部门 |
| | | applyRange: '', ////适用范围 |
| | | }); |
| | | const titles = ref(); |
| | | const titleT = ref(); |
| | | const disabled = ref(false); |
| | | const clickType = ref(false); |
| | | // 打开弹窗 |
| | | const openDailog = (title: string, value: any, id: number) => { |
| | | dialogVisible.value = true; |
| | | titles.value = `${title}安全考核管理`; |
| | | titleT.value=title |
| | | disabled.value = title == '查看' ? true : false; |
| | | if (title == '查看' || title == '修改') { |
| | | goalManagementApi() |
| | | .getexamineTemplateDetail(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | form.value = res.data.data; |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | } else { |
| | | clickType.value = false; |
| | | } |
| | | }; |
| | | // 接受传值 |
| | | const AddObj = (val: any) => { |
| | | if (index.value == -1) { |
| | | form.value.examineItemList.push(val); |
| | | } else { |
| | | form.value.examineItemList[index.value] = val; |
| | | } |
| | | }; |
| | | // 删除 |
| | | const deleteA = (tag: any) => { |
| | | form.value.examineItemList.splice(form.value.examineItemList.indexOf(tag), 1); |
| | | }; |
| | | // 提交 |
| | | const submitForm = () => { |
| | | if(titleT.value=='新建'){ |
| | | delete form.value.id |
| | | } |
| | | dialogVisible.value = false; |
| | | goalManagementApi() |
| | | .getexamineTemplateAddOrUpdate(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 = { |
| | | examineItemList: [], //考核项目列表 |
| | | setTimem: 1658386392466, |
| | | memo: '', ////备注信息 |
| | | templateCode: '', ////模板分类编码 |
| | | title: '', ////标准标题 |
| | | setPersonId: 1, //设定人 |
| | | acceptanceNumber: '', ////合格分数 |
| | | setPersonDepartmentId: 2, //设定人部门 |
| | | applyRange: '', ////适用范围 |
| | | }; |
| | | }; |
| | | // 取消 |
| | | const resetForm = () => { |
| | | dialogVisible.value = false; |
| | | form.value = { |
| | | examineItemList: [], //考核项目列表 |
| | | setTimem: 1658386392466, |
| | | memo: '', ////备注信息 |
| | | templateCode: '', ////模板分类编码 |
| | | title: '', ////标准标题 |
| | | setPersonId: 1, //设定人 |
| | | acceptanceNumber: '', ////合格分数 |
| | | setPersonDepartmentId: 2, //设定人部门 |
| | | applyRange: '', ////适用范围 |
| | | }; |
| | | }; |
| | | const activeName = ref('1'); |
| | | // 新增弹窗 |
| | | const index = ref<any>(); |
| | | const Show = ref(); |
| | | const daiAdd = (title: string, data: any) => { |
| | | index.value = form.value.examineItemList.indexOf(data); |
| | | Show.value.openDailog(title, data); |
| | | }; |
| | | // 安全目标指标弹窗 |
| | | const Shows = ref(); |
| | | const daiInpt = () => { |
| | | Shows.value.openDailog(); |
| | | }; |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | | if (full.value == false) { |
| | | full.value = true; |
| | | } else { |
| | | full.value = false; |
| | | } |
| | | }; |
| | | return { |
| | | titleT, |
| | | index, |
| | | form, |
| | | dialogVisible, |
| | | deleteA, |
| | | AddObj, |
| | | openDailog, |
| | | activeName, |
| | | titles, |
| | | disabled, |
| | | submitForm, |
| | | resetForm, |
| | | Show, |
| | | daiAdd, |
| | | Shows, |
| | | daiInpt, |
| | | Search, |
| | | full, |
| | | clickType, |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | .el-row { |
| | | padding: 0 0 20px 0; |
| | | } |
| | | </style> |