| | |
| | | method:"get", |
| | | }) |
| | | }, |
| | | // 事故案例 一览 |
| | | getaccidentCaseList:(params:object)=>{ |
| | | return request({ |
| | | url:`/accidentCase/page/list`, |
| | | method:"post", |
| | | data:params |
| | | }) |
| | | }, |
| | | //事故案例 新增 |
| | | getaccidentCaseAdd:(params:object)=>{ |
| | | return request({ |
| | | url:`/accidentCase/add`, |
| | | method:"post", |
| | | data:params |
| | | }) |
| | | }, |
| | | //事故案例 新增 |
| | | getaccidentCaseUpdata:(params:object)=>{ |
| | | return request({ |
| | | url:`/accidentCase/update`, |
| | | method:"post", |
| | | data:params |
| | | }) |
| | | }, |
| | | //事故案例 详情 |
| | | getaccidentCaseDetail:(id:number)=>{ |
| | | return request({ |
| | | url:`/accidentCase/info/${id}`, |
| | | method:"get", |
| | | }) |
| | | }, |
| | | //事故案例 删除 |
| | | getaccidentCaseDelete:(params:object)=>{ |
| | | return request({ |
| | | url:`/accidentCase/batchDelete`, |
| | | method:"post", |
| | | data:params |
| | | }) |
| | | }, |
| | | } |
| | | } |
对比新文件 |
| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" @close="resetForm(ruleFormRef)" :fullscreen="full" :title="titles" width="50%" draggable> |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form :model="form" ref="ruleFormRef" :rules="rules" :disabled="disabled" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="标题" size="default" prop="caseTitle"> |
| | | <el-input v-model="form.caseTitle" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" offset="2"> |
| | | <el-form-item label="发布时间" size="default" prop="caseTime"> |
| | | <el-date-picker |
| | | v-model="form.caseTime" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="datetime" |
| | | placeholder="请选择" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="resetForm(ruleFormRef)" size="default">关闭</el-button> |
| | | <el-button type="primary" v-if="disabled == false" @click="submitForm(ruleFormRef)" size="default">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref, reactive } from 'vue'; |
| | | import { timeDate } from '/@/assets/index.ts'; |
| | | import type { FormInstance, FormRules } from 'element-plus'; |
| | | import { Search, FullScreen } from '@element-plus/icons-vue'; |
| | | import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus'; |
| | | import { accidentManagementSystemApi } from '/@/api/accidentManagementSystem'; |
| | | export default defineComponent({ |
| | | components: {}, |
| | | setup(props, { emit }) { |
| | | const ruleFormRef = ref<FormInstance>(); |
| | | const dialogVisible = ref<boolean>(false); |
| | | const form = ref({ |
| | | caseTitle: '',///案例标题 |
| | | caseContent: '案例内容',///案例内容 |
| | | caseTime: '', |
| | | }); |
| | | const targetType = ref(); |
| | | const disabled = ref(false); |
| | | const titles = ref(); |
| | | const titleT = ref(); |
| | | const openDailog = (title: string, id: number) => { |
| | | dialogVisible.value = true; |
| | | titles.value = `${title}目标分解`; |
| | | titleT.value = title; |
| | | // targetType.value = type; |
| | | disabled.value = title == '查看' ? true : false; |
| | | if (title == '查看' || title == '修改') { |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseDetail(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | form.value = res.data.data; |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | const rules = reactive<FormRules>({ |
| | | caseTitle: [ |
| | | { |
| | | required: true, |
| | | message: '案例标题不能为空', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | caseTime: [ |
| | | { |
| | | required: true, |
| | | message: '发布时间不能为空', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }); |
| | | const submitForm = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | if (titleT.value == '新建') { |
| | | delete form.value.id; |
| | | dialogVisible.value = false; |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseAdd(form.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('onAdd'); |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | }else{ |
| | | dialogVisible.value = false; |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseUpdata(form.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('onAdd'); |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | | }); |
| | | }; |
| | | const resetForm = (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | dialogVisible.value = false; |
| | | }; |
| | | //全屏 |
| | | const full = ref(false); |
| | | const toggleFullscreen = () => { |
| | | if (full.value == false) { |
| | | full.value = true; |
| | | } else { |
| | | full.value = false; |
| | | } |
| | | }; |
| | | return { |
| | | timeDate, |
| | | ruleFormRef, |
| | | titleT, |
| | | rules, |
| | | submitForm, |
| | | resetForm, |
| | | form, |
| | | dialogVisible, |
| | | openDailog, |
| | | Search, |
| | | full, |
| | | toggleFullscreen, |
| | | FullScreen, |
| | | targetType, |
| | | disabled, |
| | | titles, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | .el-row { |
| | | padding: 0 0 20px 0; |
| | | } |
| | | </style> |
对比新文件 |
| | |
| | | <template> |
| | | <div> |
| | | <el-form :model="ruleForm" status-icon label-width="20px" class="topTitle"> |
| | | <el-row> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="ruleForm.searchParams.caseTitle" size="default" placeholder="请输入关键词" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="ruleForm.searchParams.indexNum" size="default" placeholder="目标指标编号" /> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <el-col :span="16"> |
| | | <el-form-item> |
| | | <el-button type="primary" size="default" @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" :disabled="warning" :icon="EditPen" plain @click="openD('修改', deletAll[0])">修改</el-button> --> |
| | | <el-button size="default" type="danger" :disabled="danger" :icon="Delete" plain @click="onDeleteAll">删除</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%"> |
| | | <el-table-column label="序号" align="center" type="index" width="70" /> |
| | | <el-table-column type="selection" align="center" width="55" /> |
| | | <el-table-column label="标题" align="center" property="caseTitle" sortable /> |
| | | <el-table-column property="caseTime" align="center" label="发布时间" sortable /> |
| | | <!-- <el-table-column property="year" label="年度" align="center" sortable show-overflow-tooltip /> |
| | | <el-table-column property="value" 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="small" :icon="View" @click="openD('查看', scope.row.id)">查看</el-button> --> |
| | | <el-button link type="primary" size="small" :icon="EditPen" @click="openD('修改', scope.row.id)">编辑</el-button> |
| | | <el-button link type="primary" size="small" :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> |
| | | </div> |
| | | <DailogCases ref="Show" @onAdd="add"></DailogCases> |
| | | </div> |
| | | </template> |
| | | <script lang="ts"> |
| | | import DailogCases from './component/DailogCases.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'; |
| | | import { accidentManagementSystemApi } from '/@/api/accidentManagementSystem'; |
| | | export default defineComponent({ |
| | | components: { ElButton, ElInput,DailogCases }, |
| | | setup() { |
| | | // 搜索条件 |
| | | const ruleForm = reactive({ |
| | | pageSize: 10, |
| | | pageIndex: 1, |
| | | searchParams: { |
| | | caseTitle: '', |
| | | }, |
| | | }); |
| | | // 下方导航与表格 |
| | | const tableData = ref([]); |
| | | const currentPage4 = ref(); |
| | | const pageSize4 = ref(); |
| | | const total = ref(); |
| | | const resetForm = () => { |
| | | ruleForm.searchParams.caseTitle = ''; |
| | | listApi(); |
| | | }; |
| | | const listApi = () => { |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseList(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); |
| | | } |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | listApi(); |
| | | }); |
| | | |
| | | const handleSizeChange = (val: number) => { |
| | | // console.log(`${val} items per page`); |
| | | ruleForm.pageSize = val; |
| | | listApi(); |
| | | }; |
| | | const handleCurrentChange = (val: number) => { |
| | | // console.log(`current page: ${val}`); |
| | | ruleForm.pageIndex = val; |
| | | listApi(); |
| | | }; |
| | | const activeNames = ref('1'); |
| | | // 打开弹窗 |
| | | const Show = ref(); |
| | | const openD = (title: String, id: number) => { |
| | | Show.value.openDailog(title,id); |
| | | }; |
| | | // 删除 |
| | | const onDelete = (id: number) => { |
| | | let arr = []; |
| | | arr.push(id); |
| | | ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | console.log(arr) |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseDelete(arr) |
| | | .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; |
| | | 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(() => { |
| | | accidentManagementSystemApi() |
| | | .getaccidentCaseDelete(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 add = () => { |
| | | listApi(); |
| | | }; |
| | | return { |
| | | listApi, |
| | | add, |
| | | resetForm, |
| | | tableData, |
| | | currentPage4, |
| | | pageSize4, |
| | | total, |
| | | ruleForm, |
| | | handleSizeChange, |
| | | handleCurrentChange, |
| | | Show, |
| | | openD, |
| | | activeNames, |
| | | onDelete, |
| | | warning, |
| | | danger, |
| | | deletAll, |
| | | handleSelectionChange, |
| | | onDeleteAll, |
| | | Plus, |
| | | Delete, |
| | | Upload, |
| | | Download, |
| | | Refresh, |
| | | View, |
| | | EditPen, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | .topTitle { |
| | | background-color: #fff; |
| | | padding: 20px 0px 20px 0px; |
| | | } |
| | | .minCenter { |
| | | width: 100%; |
| | | background-color: #fff; |
| | | margin-top: 10px; |
| | | padding: 0 20px; |
| | | } |
| | | .btns { |
| | | padding: 20px 0px 10px 0px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | .pages { |
| | | padding: 20px 0; |
| | | display: flex; |
| | | justify-content: right; |
| | | } |
| | | .tableC { |
| | | margin: 0 10%; |
| | | } |
| | | </style> |
| | |
| | | <el-form :model="form" :disabled="disabled" ref="ruleFormRef" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="安全目标指标" prop="qName" size="default"> |
| | | <el-input v-model="form.qName" placeholder="请填写安全目标指标" /> |
| | | <el-form-item label="安全目标项" prop="qName" size="default"> |
| | | <el-input v-model="form.qName" placeholder="请填写安全目标项" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> |
| | | <el-form-item label="目标指标编号" prop="indexNum" size="default"> |
| | | <el-input v-model="form.indexNum" placeholder="请填写目标指标编号" /> |
| | | <el-form-item label="目标编号" prop="indexNum" size="default"> |
| | | <el-input v-model="form.indexNum" placeholder="请填写目标编号" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> |
| | | <el-form-item label="指标值" prop="value" size="default"> |
| | | <el-input v-model.number="form.value" placeholder="请填写指标值" /> |
| | | <el-input v-model.number="form.value" placeholder="请填写指标值"> |
| | | <template #prepend> |
| | | <el-select v-model="form.valueSign " placeholder="请选择" style="width: 115px"> |
| | | <el-option label="大于" :value="1" /> |
| | | <el-option label="等于" :value="2" /> |
| | | <el-option label="小于" :value="3" /> |
| | | </el-select> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="11"> |
| | | <el-form-item label="目标制定部门" size="default" prop=""> |
| | | <el-tree-select |
| | | v-model="form.makerDepartmentId" |
| | | :data="data" |
| | | @current-change="makerName" |
| | | check-strictly="true" |
| | | class="w100" |
| | | :props="propse" |
| | | placeholder="请选择" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="11" :offset="2"> </el-col> |
| | | </el-row> |
| | | <el-form-item label="备注信息" prop="memo"> |
| | | <el-input v-model="form.memo" size="default" type="textarea" /> |
| | |
| | | completeDate: '', ////完成期限 |
| | | divideStatus: '2', ////分解状态 1:已分解 2:未分解 |
| | | value: '', ////指标值 |
| | | makerDepartmentId: '', |
| | | valueSign:"" |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(false); |
| | | const titleT=ref() |
| | | const titleT = ref(); |
| | | // 打开弹窗 |
| | | const openDialog = (title: string, value: any, id: number) => { |
| | | department(); |
| | | Shows.value = true; |
| | | titleT.value=title |
| | | titleT.value = title; |
| | | titles.value = `${title}目标设定`; |
| | | form.value.targetType = value; |
| | | disabled.value = title == '查看' ? true : false; |
| | |
| | | const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'; |
| | | const m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(); |
| | | const s = date.getSeconds(); // 秒 |
| | | const dateString = Y + M + D + h + m +`:${s}`; |
| | | const dateString = Y + M + D + h + m + `:${s}`; |
| | | // console.log('dateString', dateString); // > dateString 2021-07-06 14:23 |
| | | return dateString; |
| | | }; |
| | |
| | | qName: [ |
| | | { |
| | | required: true, |
| | | message: '安全目标指标不能为空', |
| | | message: '安全目标项不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | indexNum: [ |
| | | { |
| | | required: true, |
| | | message: '目标指标编号不能为空', |
| | | message: '目标编号不能为空', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | |
| | | trigger: 'change', |
| | | }, |
| | | { |
| | | type:"number", |
| | | type: 'number', |
| | | message: '指标值只能为数字类型', |
| | | trigger: 'change', |
| | | }, |
| | |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | if(titleT.value=='新建'){ |
| | | delete form.value.id |
| | | } |
| | | if (titleT.value == '新建') { |
| | | delete form.value.id; |
| | | } |
| | | Shows.value = false; |
| | | goalManagementApi() |
| | | .getTargetMngAddOrupdata(form.value) |
| | |
| | | const handleClose = (formEl: FormInstance | undefined) => { |
| | | formEl.resetFields(); |
| | | }; |
| | | //部门 |
| | | const department = () => { |
| | | goalManagementApi() |
| | | .getTreedepartment() |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | data.value = res.data.data; |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | }; |
| | | const propse = { |
| | | label: 'depName', |
| | | children: 'children', |
| | | value: 'depId', |
| | | }; |
| | | const data = ref(); |
| | | const makerName = (data: any) => { |
| | | form.value.makerDepartmentName = data.depName; |
| | | }; |
| | | return { |
| | | department, |
| | | propse, |
| | | data, |
| | | makerName, |
| | | timeC, |
| | | openDialog, |
| | | handleClose, |