From 1f772a6c7834eef35ff4c9f2c8ed734a4c2be76a Mon Sep 17 00:00:00 2001 From: 13937891274 <kxc0822> Date: 星期二, 02 八月 2022 11:09:16 +0800 Subject: [PATCH] 数据对接 --- src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue | 85 +- src/views/facilityManagement/keyEquipment/index.vue | 503 ++++++++---------- src/views/contingencyManagement/panManagement/component/openAdd.vue | 226 ++++---- src/components/equipmentDailog/DailogS.vue | 366 ++++++++----- src/views/contingencyManagement/contingency/index.vue | 58 +- src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue | 156 +---- src/views/contingencyManagement/emergencyResources/maintenanceOfEmergencyMaterials/component/openAdd.vue | 12 src/views/contingencyManagement/contingency/component/openAdd.vue | 121 ++- 8 files changed, 749 insertions(+), 778 deletions(-) diff --git a/src/components/equipmentDailog/DailogS.vue b/src/components/equipmentDailog/DailogS.vue index 6da1e53..5e33533 100644 --- a/src/components/equipmentDailog/DailogS.vue +++ b/src/components/equipmentDailog/DailogS.vue @@ -1,6 +1,6 @@ <template> - <el-dialog :fullscreen="full" v-model="isShowDialog" :title="titles" width="60%"> - <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> + <el-dialog :fullscreen="full" v-model="dialogVisible" draggable :title="titles" width="60%"> + <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> <el-form :model="form" label-width="130px" :disabled="disabled"> <el-row> <el-col :span="11"> @@ -120,7 +120,7 @@ <el-col :span="24"> <el-form-item label="现场图片"> <el-upload - v-model="form.scenePic" + v-model="form.scenePic" class="avatar-uploader" action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :show-file-list="false" @@ -141,22 +141,22 @@ </el-form> <el-tabs v-model="activeName" class="demo-tabs"> <el-tab-pane label="设备保养" name="first"> - <el-button type="primary" size="default" @click="openMaintenance">新增</el-button> - <el-table :data="tableData" style="width: 100%"> + <el-button type="primary" size="default" @click="openMaintenance('新增', '')">新增</el-button> + <el-table :data="form.takecareDetailList" style="width: 100%"> <el-table-column align="center" prop="takecareMemo" label="保养情况" /> <el-table-column align="center" prop="leadingPersonId" label="保养负责人" /> <el-table-column align="center" prop="takecareDate" label="保养日期" /> <el-table-column align="center" prop="leadingPersonDepartmentId" label="保养负责人单位" /> <el-table-column align="center" label="操作"> - <template #default> - <el-button link type="primary" size="small">查看</el-button> + <template #default="scope"> + <el-button link type="primary" @click="openMaintenance('查看', scope.row)" size="small">查看</el-button> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="设备检测" name="second"> <el-button type="primary" size="default" @click="openDetect">新增</el-button> - <el-table :data="tableData" style="width: 100%"> + <el-table :data="form.testDetailList" style="width: 100%"> <el-table-column align="center" prop="testPersonId" label="检测人" /> <el-table-column align="center" prop="testDate" label="检测日期" /> <el-table-column align="center" prop="testPersonDepartmentId" label="检测人单位" /> @@ -165,14 +165,14 @@ <el-table-column align="center" prop="testStatus" label="检测状态" /> <el-table-column align="center" label="操作"> <template #default> - <el-button link type="primary" size="small">查看</el-button> + <el-button link type="primary" @click="openDetect('查看', scope.row)" size="small">查看</el-button> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="设备维修" name="third"> <el-button type="primary" size="default" @click="openRepair">新增</el-button> - <el-table :data="tableData" style="width: 100%"> + <el-table :data="form.repaireDetailList" style="width: 100%"> <el-table-column align="center" prop="exceptionInfo" label="设施异常项" /> <el-table-column align="center" prop="repairStatus" label="维修状态" /> <el-table-column align="center" prop="repairMemo" label="维修情况" /> @@ -181,15 +181,16 @@ <el-table-column align="center" prop="repairStartDate" label="维修开始日期" /> <el-table-column align="center" prop="repairEndDate" label="维修结束日期" /> <el-table-column align="center" label="操作"> - <template #default> - <el-button link type="primary" size="small">查看</el-button> + <template #default="scope"> + <el-button link type="primary" @click="openRepair('查看', scope.row)" size="small">查看</el-button> </template> </el-table-column> </el-table> </el-tab-pane> - <el-tab-pane label="检查标准设置" name="fourth">checkContent + <el-tab-pane label="检查标准设置" name="fourth" + >checkContent <el-button type="primary" size="default" @click="openStandard">新增</el-button> - <el-table :data="tableData" style="width: 100%"> + <el-table :data="form.checkStandardeDetailList" style="width: 100%"> <el-table-column align="center" type="indexNum" label="序号" width="75" /> <el-table-column align="center" prop="checkContent" label="检查内容" /> <el-table-column align="center" prop="checkTarget" label="检查指标" /> @@ -197,14 +198,14 @@ <el-table-column align="center" prop="checkPart" label="巡检部位" /> <el-table-column align="center" prop="rate" label="频次" /> <el-table-column align="center" label="操作"> - <template #default> - <el-button link type="primary" size="small">查看</el-button> + <template #default="scope"> + <el-button link type="primary" @click="openStandard('查看', scope.row)" size="small">查看</el-button> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="巡检记录" name="five"> - <el-table :data="tableData" style="width: 100%"> + <el-table :data="name" style="width: 100%"> <el-table-column align="center" type="selection" width="75" /> <el-table-column align="center" sortable prop="name" label="任务编号" /> <el-table-column align="center" sortable prop="address" label="任务名称" /> @@ -235,22 +236,22 @@ </el-tabs> <template #footer> <span class="dialog-footer"> - <el-button @click="resetForm(ruleFormRef)">关闭</el-button> - <el-button type="primary" v-if="disabled == true ? false : true" @click="submitForm(titles, ruleFormRef)">确定</el-button> + <el-button @click="resetForm">关闭</el-button> + <el-button type="primary" @click="submitForm">确定</el-button> </span> </template> </el-dialog> <categoryDailog ref="categoryShow"></categoryDailog> <planDailog ref="planShow"></planDailog> <DailogSearchUser ref="UserShow"></DailogSearchUser> - <maintenanceDailog ref="maintenanceShow"></maintenanceDailog> - <detectDailog ref="detectShow"></detectDailog> - <repairDailog ref="repairShow"></repairDailog> - <standardDailog ref="standardShow"></standardDailog> + <maintenanceDailog ref="maintenanceShow" @onMain="main"></maintenanceDailog> + <detectDailog ref="detectShow" @onDelect="delect"></detectDailog> + <repairDailog ref="repairShow" @onRepair="Repair"></repairDailog> + <standardDailog ref="standardShow" @onStand="Stand"></standardDailog> </template> <script lang="ts"> -import { defineComponent, ref, reactive } from 'vue'; -import { Search,Plus,FullScreen, FormInstance, } from '@element-plus/icons-vue'; +import { defineComponent, ref } from 'vue'; +import { Search, Plus, FullScreen } from '@element-plus/icons-vue'; import categoryDailog from './categoryDailog.vue'; import planDailog from './planDailog.vue'; import maintenanceDailog from './maintenanceDailog.vue'; @@ -260,101 +261,176 @@ import DailogSearchUser from '/@/components/DailogSearchUser/index.vue'; import { ElMessage, ElMessageBox } from 'element-plus'; import type { UploadProps, UploadUserFile } from 'element-plus'; -import {releaseDrillPlanApi} from "/@/api/emergencyDrillPlan"; -import {facilityManagementApi} from "/@/api/facilityManagement"; +import { facilityManagementApi } from '/@/api/facilityManagement'; export default defineComponent({ components: { categoryDailog, planDailog, DailogSearchUser, maintenanceDailog, detectDailog, repairDailog, standardDailog }, - setup() { - const isShowDialog = ref(false); - const form = reactive({ - equipmentTypeId: '', - treatment: '', - inputPersonId: '', - departmentId: '', - delRepaireDetailList: [], - delTestDetailList: [], - takecareDetailList: [{ - leadingPersonId:'', - takecareDate:'', - leadingPersonDepartmentId:'', - equipmentId: '', - takecareMemo: '', - }], - checkDetailList:[], - responsibilityPersonId: '', + setup(props, { emit }) { + const dialogVisible = ref(false); + const form = ref({ + equipmentTypeId: '3', + + treatment: '发生的', + + inputPersonId: 0, + + departmentId: 0, + + delRepaireDetailList: [], + + delTestDetailList: [], + + takecareDetailList: [ + { + leadingPersonDepartmentId: '', + + takecareDate: '', + + equipmentId: '', + + leadingPersonId: '', + + takecareMemo: '', + }, + ], + checkDetailList: [], + + responsibilityPersonId: 0, + delTakecareStardardeDetailList: [], - connectPersonId:'', - scenePic:'', - partType:'', - toDangerous:'', - dangerousElement:'', + + connectPersonId: 0, + + scenePic: '', + + partType: 0, + + toDangerous: '份12', + + dangerousElement: '', + takecareStardardeDetailList: [ - { - filePath: '', - } - ], - testDetailList:[{ - testMemo:'', - testPersonDepartmentId:'', - testPersonId:'', - testStatus:'', - testResult:'', - testDate:'', - }], + { + filePath: '123', + }, + ], + testDetailList: [ + { + testMemo: '', + + testPersonDepartmentId: 0, + + testStatus: '', + + testPersonId: 0, + + testResult: 0, + + testDate: 1658284314185 , + }, + ], checkCycle: '', - repaireDetailList:[{ - repairStatus:'', - repairPersonDepartmentId:'', - repairMemo:'', - infoTpe:'', - repairPersonId:'', - repairEndDate:'', - repairStartDate:'', - exceptionInfo:'', - }], - delCheckStandardeDetailList:[], - leadingPersonName: '', - name: '', - delTakecareDetailList:[], - position:'', - emergencePlanId: '', - checkStandardeDetailList: [{ - checkContent:'', - checkTarget:'', - unit:'', - checkPart:'', - rate:'', - indexNum:'', - }], - delCheckStandardeDetails: '', - delTakecareStardardeDetails: '', - delTakecareDetails: '', - delRepaireDetails: '', - delTestDetails: '', + repaireDetailList: [ + { + repairStatus: 0, + repairPersonDepartmentId: 0, + repairMemo: '', + infoTpe: 0, + repairPersonId: 0, + repairEndDate: 1658284314184, + repairStartDate: 1658284314184, + exceptionInfo: '', + }, + ], + delCheckStandardeDetailList: [], + + leadingPersonName: '312', + + name: '3123', + + delTakecareDetailList: [], + + position: '312', + + emergencePlanId: 0, + + checkStandardeDetailList: [ + { + indexNum: '1', + + checkTarget: '3', + + checkPart: '5', + + checkContent: '2', + + unit: '4', + + rate: '6', + }, + ], + delCheckStandardeDetails: '1,2', + + delTakecareStardardeDetails: '1,2', + + delTakecareDetails: '1,2', + + delRepaireDetails: '1,2', + + delTestDetails: '1,2', }); - const Dailogtype = ref(false); - const openDailog = (type: boolean) => { - isShowDialog.value = true; - Dailogtype.value = type; - }; - const ruleFormRef = ref<FormInstance>() - const activeName = ref('first'); const titles = ref(); - const disabled = ref(); - // 打开弹窗 - const openDialog = (title: string, id: number, type: boolean) => { - isShowDialog.value = true; - titles.value = title; - disabled.value = type; - if (title == '查看仪器仪表' || title == '修改仪器仪表') { - facilityManagementApi() - .getkeypointEquipmentInfoDetail(id) - .then((res) => { - if (res.data.code == 200) { - form.value = res.data.data; - } - }); + const disabled = ref(false); + const Dailogtype = ref(false); + const openDailog = (title: string, type: boolean, id: number, num: any) => { + dialogVisible.value = true; + Dailogtype.value = type; + if (num == 0) { + titles.value = `${title}仪表信息`; + } else if (num == 1) { + titles.value = `${title}设备设施`; + } else if (num == 2) { + titles.value = `${title}设备设施`; } + + disabled.value = title == '查看' ? true : false; + if (title == '查看' || title == '修改') + facilityManagementApi() + .getkeypointEquipmentInfoDetail(id) + .then((res) => { + if (res.data.code == 200) { + form.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; + // 提交 + const submitForm = () => { + dialogVisible.value = false; + facilityManagementApi() + .getkeypointEquipmentInfoAddOrUpdate(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 = null; + }; + // 取消 + const resetForm = () => { + dialogVisible.value = false; + }; + const activeName = ref('first'); + + const categoryShow = ref(); + const opencategory = () => { + categoryShow.value.openDailog(); }; const tableData = [ @@ -379,10 +455,7 @@ address: 'No. 189, Grove St, Los Angeles', }, ]; - const categoryShow = ref(); - const opencategory = () => { - categoryShow.value.openDailog(); - }; + const planShow = ref(); const openPlan = () => { planShow.value.openDailog(); @@ -392,20 +465,20 @@ UserShow.value.openDailog(); }; const maintenanceShow = ref(); - const openMaintenance = () => { - maintenanceShow.value.openDailog(); + const openMaintenance = (title: string, data: any) => { + maintenanceShow.value.openDailog(title, data); }; const detectShow = ref(); - const openDetect = () => { - detectShow.value.openDailog(); + const openDetect = (title: string, data: any) => { + detectShow.value.openDailog(title, data); }; const repairShow = ref(); - const openRepair = () => { - repairShow.value.openDailog(); + const openRepair = (title: string, data: any) => { + repairShow.value.openDailog(title, data); }; const standardShow = ref(); - const openStandard = () => { - standardShow.value.openDailog(); + const openStandard = (title: string, data: any) => { + standardShow.value.openDailog(title, data); }; // 上传 const fileList = ref<UploadUserFile[]>([ @@ -437,6 +510,20 @@ () => false ); }; + // 回传 + const main = (val: any) => { + form.value.takecareDetailList.push(val); + }; + const delect = (val: any) => { + form.value.testDetailList.push(val); + }; + const Repair= (val:any)=>{ + form.value.repaireDetailList.push(val); + } + const Stand=(val:any)=>{ + form.value.checkStandardeDetailList.push(val); + } + //图片提交 const imageUrl = ref(''); @@ -454,21 +541,27 @@ } return true; }; - //全屏 + + //全屏 const full = ref(false); const toggleFullscreen = () => { if (full.value == false) { full.value = true; - }else{ - full.value = false; - } + } else { + full.value = false; + } }; return { - isShowDialog, + submitForm, + dialogVisible, Dailogtype, form, openDailog, Search, + main, + delect, + Repair, + Stand, activeName, tableData, categoryShow, @@ -489,24 +582,25 @@ handleRemove, handlePreview, handleExceed, + disabled, + titles, beforeRemove, imageUrl, handleAvatarSuccess, beforeAvatarUpload, Plus, - full, + full, toggleFullscreen, FullScreen, - ruleFormRef, - openDialog, + resetForm, }; }, }); </script> <style scoped> - .el-row{ - padding: 0 0 20px 0; - } +.el-row { + padding: 0 0 20px 0; +} .avatar-uploader .avatar { width: 178px; height: 178px; @@ -514,7 +608,7 @@ } </style> <style> - .avatar-uploader .el-upload { +.avatar-uploader .el-upload { border: 1px dashed var(--el-border-color); border-radius: 6px; cursor: pointer; diff --git a/src/views/contingencyManagement/contingency/component/openAdd.vue b/src/views/contingencyManagement/contingency/component/openAdd.vue index 44361d3..af81142 100644 --- a/src/views/contingencyManagement/contingency/component/openAdd.vue +++ b/src/views/contingencyManagement/contingency/component/openAdd.vue @@ -29,7 +29,7 @@ </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="负责人部门" prop="principalDepartmentId"> - <el-tree-select v-model="ruleForm.principalDepartmentId" :data="data" class="w100" placeholder="请选择" /> + <el-tree-select v-model="ruleForm.principalDepartmentId" :data="data" class="w100" :props="propse" clearable placeholder="请选择" /> </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> @@ -109,6 +109,7 @@ reactive, ref, defineComponent, + onMounted, // toRefs, } from 'vue'; import { @@ -130,6 +131,7 @@ import AddEmergencyPersonnel from "/@/views/contingencyManagement/contingency/component/addEmergencyPersonnel.vue"; import DailogSearchUser from "/@/components/DailogSearchUser/index.vue" import {contingencyApi} from "/@/api/contingency"; +import {goalManagementApi} from "/@/api/goalManagement"; // import {releaseDrillPlanApi} from "/@/api/releaseDrillPlan"; @@ -145,7 +147,7 @@ const ruleForm =ref({ teamName: '', // 队伍名称 teamLevel: '', // 队伍级别 - principalUid: 1, // 队伍负责人 + principalUid: '', // 队伍负责人 principalDepartmentId: '', //负责人部门 principalPhone: '', // 负责人手机 telephoneNumber: '', // 固定电话 @@ -187,53 +189,74 @@ // 上传附件 const fileList = ref<UploadUserFile[]>([]) + //部门树 + const department = () => { + goalManagementApi() + .getTreedepartment() + .then((res) => { + if (res.data.code == 200) { + data.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; //定义树形下拉框 const principalDepartmentId = ref() - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: '11', - label: '经营班子', - children: [], - }, - ], - }, - { - value: '2', - label: '生产运行部', - children: [ - { - value: '21', - label: '灌装一班', - children: [] - }, - { - value: '22', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '31', - label: '仪表班', - children: [], - }, - { - value: '32', - label: '机修班', - children: [], - }, - ], - }, - ] + const propse = { + label: 'depName', + children: 'children', + value: 'depId', + }; + const data=ref() + onMounted(() => { + department(); + }); + // const data = [ + // { + // value: '1', + // label: '广汇能源综合物流发展有限责任公司', + // children: [ + // { + // value: '11', + // label: '经营班子', + // children: [], + // }, + // ], + // }, + // { + // value: '2', + // label: '生产运行部', + // children: [ + // { + // value: '21', + // label: '灌装一班', + // children: [] + // }, + // { + // value: '22', + // label: '工艺四班', + // children: [], + // }, + // ], + // }, + // { + // value: '3', + // label: '设备部', + // children: [ + // { + // value: '31', + // label: '仪表班', + // children: [], + // }, + // { + // value: '32', + // label: '机修班', + // children: [], + // }, + // ], + // }, + // ] // 打开用户选择弹窗 const userRef = ref(); const openUser = () => { @@ -371,7 +394,7 @@ ruleForm.value = { teamName: '', // 队伍名称 teamLevel: '', // 队伍级别 - principalUid: 1, // 队伍负责人 + principalUid: '', // 队伍负责人 principalDepartmentId: '', //负责人部门 principalPhone: '', // 负责人手机 telephoneNumber: '', // 固定电话 @@ -507,6 +530,7 @@ userRef, titles, disabled, + propse, emit, onSubmit, openUser, @@ -520,6 +544,7 @@ // listApi, onEdit, onRowDel, + department, }; }, }); diff --git a/src/views/contingencyManagement/contingency/index.vue b/src/views/contingencyManagement/contingency/index.vue index 6389556..9ab65d9 100644 --- a/src/views/contingencyManagement/contingency/index.vue +++ b/src/views/contingencyManagement/contingency/index.vue @@ -41,23 +41,23 @@ </el-icon>删除 </el-button> </div> - <div class="button_Right"> - <el-button size="default" @click="upButton"> - <el-icon> - <Upload /> - </el-icon> - </el-button> - <el-button size="default"> - <el-icon> - <Download /> - </el-icon> - </el-button> - <el-button size="default"> - <el-icon> - <Refresh /> - </el-icon> - </el-button> - </div> +<!-- <div class="button_Right">--> +<!-- <el-button size="default" @click="upButton">--> +<!-- <el-icon>--> +<!-- <Upload />--> +<!-- </el-icon>--> +<!-- </el-button>--> +<!-- <el-button size="default">--> +<!-- <el-icon>--> +<!-- <Download />--> +<!-- </el-icon>--> +<!-- </el-button>--> +<!-- <el-button size="default">--> +<!-- <el-icon>--> +<!-- <Refresh />--> +<!-- </el-icon>--> +<!-- </el-button>--> +<!-- </div>--> </div> <el-table :data="tableData" @@ -131,9 +131,9 @@ import { Plus, Edit, Delete, - Upload, - Download, - Refresh, + // Upload, + // Download, + // Refresh, View, EditPen, } from '@element-plus/icons-vue' @@ -153,9 +153,9 @@ Plus, Edit, Delete, - Upload, - Download, - Refresh, + // Upload, + // Download, + // Refresh, UpData, contingencyApi }, @@ -217,10 +217,10 @@ }; // 上传 - const upShow=ref() - const upButton=()=>{ - upShow.value.openDialog() - } + // const upShow=ref() + // const upButton=()=>{ + // upShow.value.openDialog() + // } // 打开新增应急队伍弹窗 const addRef = ref(); const onOpenAdd = () => { @@ -320,8 +320,8 @@ return { listQuery, onSubmit, - upButton, - upShow, + // upButton, + // upShow, onOpenAdd, //新增 addRef, pageIndex, diff --git a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue index 4a838b0..fdf1a0f 100644 --- a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue +++ b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue @@ -30,7 +30,11 @@ <el-form-item label="主办部门" placeholder="请选择" prop="departmentId"> <el-tree-select v-model="ruleForm.departmentId" - :data="data" class="w100" + :data="data" + check-strictly + class="w100" + :props="propse" + clearable placeholder="请选择"/> </el-form-item> </el-col> @@ -89,7 +93,11 @@ <el-form-item label="制定部门" prop="makingDepartmentId"> <el-tree-select v-model="ruleForm.makingDepartmentId" - :data="data" class="w100" + check-strictly + :data="data" + class="w100" + :props="propse" + clearable placeholder="请选择"/> </el-form-item> </el-col> @@ -187,7 +195,8 @@ import { // reactive, ref, - defineComponent + defineComponent, + onMounted, } from 'vue'; import type { @@ -202,6 +211,7 @@ import UserCheckbox from "/@/components/userCheckbox/index.vue" import RegionsDialog from "/@/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue" import {releaseDrillPlanApi} from "/@/api/emergencyDrillPlan"; +import {goalManagementApi} from "/@/api/goalManagement"; export default defineComponent({ name: 'openAdd', @@ -339,54 +349,29 @@ ], }, ] + //部门树 + const department = () => { + goalManagementApi() + .getTreedepartment() + .then((res) => { + if (res.data.code == 200) { + data.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; //定义树形下拉框 const responsibleDepartment = ref() - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: '11', - label: '经营班子', - children: [], - }, - ], - }, - { - value: '12', - label: '生产运行部', - children: [ - { - value: '21', - label: '灌装一班', - children: [] - }, - { - value: '22', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '31', - label: '仪表班', - children: [], - }, - { - value: '32', - label: '机修班', - children: [], - }, - ], - }, - ] - + const data = ref() + const propse = { + label: 'depName', + children: 'children', + value: 'depId', + }; + onMounted(() => { + department(); + }); // 表单提交验证必填项 const submitForm = async (title: string, formEl: FormInstance | undefined) => { if (title == '新建应急演练计划发布') { @@ -518,6 +503,8 @@ fileList, responsibleDepartment, data, + department, + propse, Search, ruleForm, value1, diff --git a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue index 60006cf..aa00d4b 100644 --- a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue +++ b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue @@ -48,7 +48,16 @@ </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="负责部门" prop="departmentId"> - <el-tree-select v-model="ruleForm.departmentId" :data="data" class="w100" placeholder="请选择" /> + <el-tree-select + v-model="ruleForm.departmentId" + check-strictly + :data="data" + :props="propse" + class="w100" + clearable + :render-after-expand="false" + placeholder="请选择" + /> </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> @@ -180,7 +189,7 @@ </template> <script lang="ts"> -import { reactive, ref, defineComponent } from 'vue'; +import { reactive, ref, defineComponent,onMounted, } from 'vue'; import type { FormInstance, FormRules } from 'element-plus'; import { ElMessage } from 'element-plus'; @@ -190,6 +199,7 @@ import PersonInCharge from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/personInCharge.vue'; import RegionsCheckbox from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/regionsCheckbox.vue'; import {emergencySuppliesApi} from "/@/api/emergencyResources"; +import {goalManagementApi} from "/@/api/goalManagement"; export default defineComponent({ name: 'openAdd', @@ -244,125 +254,29 @@ }; //日期选择器 const value1 = ref(''); - // 可选择树 - const treeSelect = ref(); - const tree = [ - { - value: '1', - label: 'Level one 1', - children: [ - { - value: '11', - label: 'Level two 1-1', - children: [ - { - value: '111', - label: 'Level three 1-1-1', - }, - ], - }, - ], - }, - { - value: '2', - label: 'Level one 2', - children: [ - { - value: '21', - label: 'Level two 2-1', - children: [ - { - value: '211', - label: 'Level three 2-1-1', - }, - ], - }, - { - value: '22', - label: 'Level two 2-2', - children: [ - { - value: '221', - label: 'Level three 2-2-1', - }, - ], - }, - ], - }, - { - value: '3', - label: 'Level one 3', - children: [ - { - value: '31', - label: 'Level two 3-1', - children: [ - { - value: '311', - label: 'Level three 3-1-1', - }, - ], - }, - { - value: '32', - label: 'Level two 3-2', - children: [ - { - value: '321', - label: 'Level three 3-2-1', - }, - ], - }, - ], - }, - ]; + //部门树 + const department = () => { + goalManagementApi() + .getTreedepartment() + .then((res) => { + if (res.data.code == 200) { + data.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; //定义树形下拉框 const responsibleDepartment = ref(); - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: 11, - label: '经营班子', - children: [], - }, - ], - }, - { - value: '2', - label: '生产运行部', - children: [ - { - value: '21', - label: '灌装一班', - children: [], - }, - { - value: '22', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '31', - label: '仪表班', - children: [], - }, - { - value: '32', - label: '机修班', - children: [], - }, - ], - }, - ]; + const data = ref() + const propse = { + label: 'depName', + children: 'children', + value: 'depId', + }; + onMounted(() => { + department(); + }); // 必填项提示 const rules = reactive<FormRules>({ name: [ @@ -616,11 +530,11 @@ isShowDialog, responsibleDepartment, data, + propse, + department, Search, ruleForm, value1, - treeSelect, - tree, daiInpt, Shows, ruleFormRef, diff --git a/src/views/contingencyManagement/emergencyResources/maintenanceOfEmergencyMaterials/component/openAdd.vue b/src/views/contingencyManagement/emergencyResources/maintenanceOfEmergencyMaterials/component/openAdd.vue index 20b8938..b8522f2 100644 --- a/src/views/contingencyManagement/emergencyResources/maintenanceOfEmergencyMaterials/component/openAdd.vue +++ b/src/views/contingencyManagement/emergencyResources/maintenanceOfEmergencyMaterials/component/openAdd.vue @@ -71,7 +71,7 @@ </template> </el-dialog> <EmergencySupplies ref="showRef" @SearchUser="onUser"/> - <userSelections ref="userRef"/> + <userSelections ref="userRef" @SearchUser="onUsers"/> </div> </template> @@ -90,9 +90,9 @@ Search, FullScreen } from '@element-plus/icons-vue' -import EmergencySupplies from '/@/components/emergencySupplies/index.vue' -import UserSelections from "/@/components/userSelections/index.vue" -import {maintenanceEmergencyMaterialsApi} from "/@/api/maintenanceEmergencyMaterials"; +import EmergencySupplies from '../../../../../components/emergencySupplies/index.vue' +import UserSelections from "../../../../../components/userSelections/index.vue" +import {maintenanceEmergencyMaterialsApi} from "../../../../../api/maintenanceEmergencyMaterials"; export default defineComponent({ name: 'openAdd', @@ -232,6 +232,9 @@ const openUser = () => { userRef.value.openDialog(); }; + const onUsers = (e:any) => { + ruleForm.value.userUid=e.id + }; //全屏 const full = ref(false); const toggleFullscreen = () => { @@ -249,6 +252,7 @@ maintainTime, daiInpt, onUser, + onUsers, showRef, ruleFormRef, submitForm, diff --git a/src/views/contingencyManagement/panManagement/component/openAdd.vue b/src/views/contingencyManagement/panManagement/component/openAdd.vue index 92db42c..550d6b5 100644 --- a/src/views/contingencyManagement/panManagement/component/openAdd.vue +++ b/src/views/contingencyManagement/panManagement/component/openAdd.vue @@ -3,7 +3,7 @@ <el-dialog :title="titles" v-model="isShowDialog" - width="769px" + width="40%" draggable :fullscreen="full" > @@ -25,10 +25,12 @@ <el-form-item label="适用部门" prop="responsibleDepartment"> <el-tree-select v-model="ruleForm.treeSelect" - :data="tree" + :data="data" multiple :render-after-expand="true" + :props="propse" show-checkbox + clearable /> <el-divider /> </el-form-item> @@ -77,8 +79,12 @@ <el-form-item label="编写部门" prop="authorDeptId"> <el-tree-select v-model="ruleForm.authorDeptId" + check-strictly :data="data" class="w100" + :props="propse" + clearable + :render-after-expand="false" placeholder="请选择"/> </el-form-item> </el-col> @@ -155,7 +161,8 @@ <script lang="ts"> import { ref, - defineComponent + defineComponent, + onMounted, } from 'vue'; import type { @@ -171,6 +178,7 @@ import CheckTemplate from '/@/components/checkTemplate/index.vue' import RegionsDialog from '/@/components/regionsDialog/index.vue' import {emergencyPlanApi} from "/@/api/emergencyPlan"; +import {goalManagementApi} from "/@/api/goalManagement"; export default defineComponent({ name: 'openAdd', @@ -227,125 +235,101 @@ const releaseDate = ref('') // 上传附件 const fileList = ref<UploadUserFile[]>([]) - // 可选择树 + //部门树 + const department = () => { + goalManagementApi() + .getTreedepartment() + .then((res) => { + if (res.data.code == 200) { + data.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; const treeSelect = ref() - const tree = [ - { - value: '1', - label: 'Level one 1', - children: [ - { - value: '11', - label: 'Level two 1-1', - children: [ - { - value: '111', - label: 'Level three 1-1-1', - }, - ], - }, - ], - }, - { - value: '2', - label: 'Level one 2', - children: [ - { - value: '21', - label: 'Level two 2-1', - children: [ - { - value: '211', - label: 'Level three 2-1-1', - }, - ], - }, - { - value: '22', - label: 'Level two 2-2', - children: [ - { - value: '221', - label: 'Level three 2-2-1', - }, - ], - }, - ], - }, - { - value: '3', - label: 'Level one 3', - children: [ - { - value: '31', - label: 'Level two 3-1', - children: [ - { - value: '311', - label: 'Level three 3-1-1', - }, - ], - }, - { - value: '32', - label: 'Level two 3-2', - children: [ - { - value: '321', - label: 'Level three 3-2-1', - }, - ], - }, - ], - }, - ] + // const trees = ref(); + const propse = { + label: 'depName', + children: 'children', + value: 'depId', + }; + onMounted(() => { + department(); + }); + // const tree = [ + // { + // value: '1', + // label: 'Level one 1', + // children: [ + // { + // value: '11', + // label: 'Level two 1-1', + // children: [ + // { + // value: '111', + // label: 'Level three 1-1-1', + // }, + // ], + // }, + // ], + // }, + // { + // value: '2', + // label: 'Level one 2', + // children: [ + // { + // value: '21', + // label: 'Level two 2-1', + // children: [ + // { + // value: '211', + // label: 'Level three 2-1-1', + // }, + // ], + // }, + // { + // value: '22', + // label: 'Level two 2-2', + // children: [ + // { + // value: '221', + // label: 'Level three 2-2-1', + // }, + // ], + // }, + // ], + // }, + // { + // value: '3', + // label: 'Level one 3', + // children: [ + // { + // value: '31', + // label: 'Level two 3-1', + // children: [ + // { + // value: '311', + // label: 'Level three 3-1-1', + // }, + // ], + // }, + // { + // value: '32', + // label: 'Level two 3-2', + // children: [ + // { + // value: '321', + // label: 'Level three 3-2-1', + // }, + // ], + // }, + // ], + // }, + // ] //定义树形下拉框 const responsibleDepartment = ref() - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: '11', - label: '经营班子', - children: [], - }, - ], - }, - { - value: '2', - label: '生产运行部', - children: [ - { - value: '21', - label: '灌装一班', - children: [] - }, - { - value: '22', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '31', - label: '仪表班', - children: [], - }, - { - value: '32', - label: '机修班', - children: [], - }, - ], - }, - ] + const data = ref(); const submitForm = async (title: string, formEl: FormInstance | undefined) => { if (title == '新建应急预案管理') { @@ -419,7 +403,9 @@ Search, releaseDate, treeSelect, - tree, + // trees, + propse, + department, daiInpt, Shows, submitForm, diff --git a/src/views/facilityManagement/keyEquipment/index.vue b/src/views/facilityManagement/keyEquipment/index.vue index f1d3218..f8fae6e 100644 --- a/src/views/facilityManagement/keyEquipment/index.vue +++ b/src/views/facilityManagement/keyEquipment/index.vue @@ -4,7 +4,7 @@ <el-row> <el-col :span="4"> <el-form-item size="default"> - <el-input v-model="ruleForm.searchParams.equipmentTypeId" placeholder="装置/部位名称" /> + <el-input v-model="ruleForm.searchParams.qName" placeholder="装置/部位名称" /> </el-form-item> </el-col> <el-col :span="4"> @@ -17,9 +17,10 @@ </el-form> <el-row> <el-col :span="4"> + <el-input v-model="filterText" style="height: 30px" placeholder="请输入关键字" /> <div class="tree"> -<!-- <el-input v-model="filterText" style="height: 30px" placeholder="Filter keyword" />--> - <el-tree ref="treeRef" :data="data" :props="defaultProps" :filter-node-method="filterNode" /> + <!-- <el-input v-model="filterText" style="height: 30px" placeholder="Filter keyword" />--> + <el-tree ref="treeRef" :data="data" :props="props" @node-click="handleNodeClick" :filter-node-method="filterNode" /> </div> </el-col> <el-col :span="20"> @@ -36,64 +37,61 @@ </div> </div> <div style="padding-left: 10px"> - <el-table ref="multipleTableRef" :data="tableData" style="width: 100%"> + <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="expand"> - <template #default> + <template #default="scope"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" style="margin: 0 5%"> <el-tab-pane label="设备保养" name="first"> <el-table ref="multipleTableRef" :data="scope.row.takecareDetailList" style="width: 100%"> - <el-table-column property="name" align="center" label="保养情况" sortable /> - <el-table-column property="name" align="center" label="保养负责人" sortable /> - <el-table-column property="name" align="center" label="保养日期" sortable /> - <el-table-column property="name" align="center" label="保养负责人单位" sortable /> + <el-table-column property="takecareMemo" align="center" label="保养情况" sortable /> + <el-table-column property="leadingPersonId" align="center" label="保养负责人" sortable /> + <el-table-column property="takecareDate" align="center" label="保养日期" sortable /> + <el-table-column property="leadingPersonDepartmentId" align="center" label="保养负责人单位" sortable /> </el-table> </el-tab-pane> <el-tab-pane label="设备检查" name="second" ><el-table ref="multipleTableRef" :data="scope.row.checkDetailList" style="width: 100%"> - <el-table-column property="name" align="center" label="检查人" sortable /> - <el-table-column property="name" align="center" label="检查日期" sortable /> + <el-table-column property="leadingPersonId" align="center" label="检查人" sortable /> + <el-table-column property="createTime" align="center" label="检查日期" sortable /> <el-table-column property="name" align="center" label="检查人部门" sortable /> - <el-table-column property="name" align="center" label="检查结果" sortable /> + <el-table-column property="takecareMemo" align="center" label="检查结果" sortable /> <el-table-column property="name" align="center" label="检查状态" sortable /> </el-table ></el-tab-pane> <el-tab-pane label="设备检测" name="third"> - <el-table ref="multipleTableRef" :data="scope.row.testDetailList" style="width: 100%"> - <el-table-column property="name" align="center" label="检测人" sortable /> - <el-table-column property="name" align="center" label="检测日期" sortable /> - <el-table-column property="name" align="center" label="检测人单位" sortable /> - <el-table-column property="name" align="center" label="检测内容" sortable /> - <el-table-column property="name" align="center" label="检测结果" sortable /> - <el-table-column property="name" align="center" label="检测状态" sortable /> + <el-table ref="multipleTableRef" :data="scope.row.testDetailList" style="width: 100%"> + <el-table-column property="testPersonId" align="center" label="检测人" sortable /> + <el-table-column property="testDate" align="center" label="检测日期" sortable /> + <el-table-column property="testPersonDepartmentId" align="center" label="检测人单位" sortable /> + <el-table-column property="testMemo" align="center" label="检测内容" sortable /> + <el-table-column property="testResult" align="center" label="检测结果" sortable /> + <el-table-column property="testStatus" align="center" label="检测状态" sortable /> </el-table> - </el-tab-pane> + </el-tab-pane> <el-tab-pane label="设备维修" name="fourth"> <el-table ref="multipleTableRef" :data="scope.row.repaireDetailList" style="width: 100%"> - <el-table-column property="name" align="center" label="设施异常项" sortable /> - <el-table-column property="departmentId" align="center" label="维修状态" sortable /> - <el-table-column property="name" align="center" label="维修情况" sortable /> - <el-table-column property="name" align="center" label="维修负责人" sortable /> - <el-table-column property="name" align="center" label="维修负责人单位" sortable /> - <el-table-column property="name" align="center" label="维修开始日期" sortable /> - <el-table-column property="name" align="center" label="维修结束日期" sortable /> + <el-table-column property="exceptionInfo" align="center" label="设施异常项" sortable /> + <el-table-column property="repairStatus" align="center" label="维修状态" sortable /> + <el-table-column property="repairMemo" align="center" label="维修情况" sortable /> + <el-table-column property="repairPersonId" align="center" label="维修负责人" sortable /> + <el-table-column property="repairPersonDepartmentId" align="center" label="维修负责人单位" sortable /> + <el-table-column property="repairStartDate" align="center" label="维修开始日期" sortable /> + <el-table-column property="repairEndDate" align="center" label="维修结束日期" sortable /> </el-table> </el-tab-pane> </el-tabs> </template> </el-table-column> - <el-table-column label="id" align="center" sortable> - <template #default="scope">{{ scope.row.date }}</template> - </el-table-column> <el-table-column property="equipmentTypeId" align="center" label="类型/类别外键" sortable /> - <el-table-column property="name" align="center" label="装置/部位名称" sortable /> + <el-table-column property="qName" align="center" label="装置/部位名称" sortable /> <el-table-column property="departmentId" label="所属部门" align="center" sortable show-overflow-tooltip /> <el-table-column property="position" label="具体位置" align="center" sortable show-overflow-tooltip /> <el-table-column property="leadingPersonName" label="负责人姓名" align="center" sortable show-overflow-tooltip /> - <el-table-column property="connectPersonId" label="装置部位分类" align="center" sortable show-overflow-tooltip /> + <el-table-column property="connectPersonId" label="装置部位分类" align="center" sortable show-overflow-tooltip /> <el-table-column label="操作" align="center" width="250"> <template #default="scope"> - <el-button link type="primary" size="default" :icon="View" @click="openEdit('查看', scope.row.id)">查看</el-button> - <el-button link type="primary" size="default" :icon="EditPen" @click="openEdit('修改', scope.row.id)">修改</el-button> + <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> @@ -112,288 +110,251 @@ </div> </el-col> </el-row> - <updata ref="Show"></updata> - <DailogS ref="ShowD" @myAdd="onMyAdd"></DailogS> + <!-- <updata ref="Show"></updata>--> + <DailogS ref="ShowD" @navAddorUpdata="onAddorUpdata"></DailogS> </div> </template> <script lang="ts"> import { defineComponent, ref, reactive, watch, onMounted } from 'vue'; -import updata from '/@/components/updata/updata.vue' -import DailogS from '/@/components/equipmentDailog/DailogS.vue' -import { ElTree, TabsPaneContext ,ElMessage, ElMessageBox} from 'element-plus'; -import { EditPen, Plus, Delete, Download, Refresh, Upload ,View} from '@element-plus/icons-vue'; -import {facilityManagementApi} from "/@/api/facilityManagement"; +// import updata from '/@/components/updata/updata.vue' +import DailogS from '/@/components/equipmentDailog/DailogS.vue'; +import { ElTree, TabsPaneContext, ElMessage, ElMessageBox } from 'element-plus'; +import { EditPen, Plus, Delete, Download, Refresh, Upload, View } from '@element-plus/icons-vue'; +import { facilityManagementApi } from '/@/api/facilityManagement'; interface Tree { - id: number; label: string; children?: Tree[]; } export default defineComponent({ - components:{updata,DailogS}, + components: { + // updata, + DailogS, + }, setup() { const ruleForm = reactive({ - pageSize: 10, - pageIndex: 1, - searchParams: { - equipmentTypeId: '', ////类型/类别外键 - name: '', ////装置/部位名称 - departmentId: '',////所属部门 - position: '', ////具体位置 - leadingPersonName: '', ////负责人姓名 - connectPersonId: '',////装置部位分类 - }, + pageSize: 10, + pageIndex: 1, + searchParams: { + equipmentTypeId: '', ////类型/类别外键 + qName: '', ////装置/部位名称 + // departmentId: '',////所属部门 + // position: '', ////具体位置 + // leadingPersonName: '', ////负责人姓名 + // connectPersonId: '',////装置部位分类 + infoTpe: 0, ////具体类型(页面左侧的导航栏使用) 0:仪器仪表信息 1:生产设备设施 2:安全设备设施 3:重点监管装置/设备 + }, }); - // 重置 - const resetForm = () => { - ruleForm.searchParams.equipmentTypeId = ''; - listApi(); - }; - const listApi = () => { - facilityManagementApi() - .getkeypointEquipmentInfoAddOrList(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 onAddorUpdata = () => { - listApi(); - }; - const tableData = ref(); - const currentPage4 = ref(); - const pageSize4 = ref(); - const total = ref(); - 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 resetForm = () => { + ruleForm.searchParams.qName = ''; + listApi(); + }; + const listApi = () => { + facilityManagementApi() + .getkeypointEquipmentInfoAddOrList(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 onAddorUpdata = () => { + listApi(); + }; + const tableData = ref(); + const currentPage4 = ref(); + const pageSize4 = ref(); + const total = ref(); + 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 filterText = ref(''); const treeRef = ref<InstanceType<typeof ElTree>>(); - - const defaultProps = { - children: 'children', - label: 'typeName', - value: 'id', + // 树形 + const listApiTree = () => { + facilityManagementApi() + .getequipmentTypeMngTreeData() + .then((res) => { + if (res.data.code == 200) { + console.log(res.data.data); + data.value = res.data.data; + } else { + ElMessage({ + showClose: true, + message: res.data.msg, + type: 'error', + }); + } + }); }; - + const props = { + label: 'typeName', + children: 'childList', + value: 'id', + } watch(filterText, (val) => { treeRef.value!.filter(val); }); - const filterNode = (value: string, data: Tree) => { if (!value) return true; return data.typeName.includes(value); }; + const handleNodeClick = (data: Tree) => { + console.log(data) + ruleForm.searchParams.qName = data.typeName; - // 删除 - const onDelete = (id: number) => { - ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }) - .then(() => { - facilityManagementApi() - .getkeypointEquipmentInfoDetele(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(() => { - facilityManagementApi() - .getkeypointEquipmentInfoDetele(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 data: Tree[] = [ - { - id: 1, - label: 'Level one 1', - children: [ - { - id: 4, - label: 'Level two 1-1', - children: [ - { - id: 9, - label: 'Level three 1-1-1', - }, - { - id: 10, - label: 'Level three 1-1-2', - }, - ], - }, - ], - }, - { - id: 2, - label: 'Level one 2', - children: [ - { - id: 5, - label: 'Level two 2-1', - }, - { - id: 6, - label: 'Level two 2-2', - }, - ], - }, - { - id: 3, - label: 'Level one 3', - children: [ - { - id: 7, - label: 'Level two 3-1', - }, - { - id: 8, - label: 'Level two 3-2', - }, - ], - }, - ]; + listApi(); + }; + const data = ref([]); + onMounted(() => { + listApiTree(); + }); + // 删除 + const onDelete = (id: number) => { + ElMessageBox.confirm('确定删除所选项吗?', 'Warning', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + facilityManagementApi() + .getkeypointEquipmentInfoDetele(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(() => { + facilityManagementApi() + .getkeypointEquipmentInfoDetele(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 activeName = ref('first'); const handleClick = (tab: TabsPaneContext, event: Event) => { console.log(tab, event); }; - const Show=ref() - const openUp=()=>{ - Show.value.openDialog() - } - // 新增弹窗 - const ShowD=ref() - const openD=()=>{ - ShowD.value.openDailog('新建仪器仪表',false) - } - // 新增后刷新 - const onMyAdd = (e: boolean) => { - if (e) { - listApi(); - } else { - listApi(); - } - }; - // 打开修改用户弹窗 - const openEdit = (val: string, row: object) => { - if (val == '查看') { - ShowD.value.openDailog('查看仪器仪表',row,true); - } else { - ShowD.value.openDailog('修改仪器仪表',row,false); - } - }; + // const Show=ref() + // const openUp=()=>{ + // Show.value.openDialog() + // } + // 新增弹窗 + const ShowD = ref(); + const openD = (title: String, id: number) => { + ShowD.value.openDailog(title, false, id, 2); + }; return { activeName, handleClick, ruleForm, filterText, treeRef, - defaultProps, + props, filterNode, data, tableData, - Show, - openUp, + // Show, + // openUp, ShowD, + danger, openD, - openEdit, + // openEdit, Plus, EditPen, + listApiTree, Delete, - View, + View, Download, Refresh, Upload, - resetForm, - listApi, - onMyAdd, - handleCurrentChange, - handleSizeChange, - onAddorUpdata, - total, - currentPage4, - pageSize4, - onDelete, - warning, - handleSelectionChange, - onDeleteAll, + resetForm, + listApi, + handleCurrentChange, + handleSizeChange, + onAddorUpdata, + total, + currentPage4, + pageSize4, + onDelete, + warning, + handleSelectionChange, + onDeleteAll, + handleNodeClick, }; }, }); -- Gitblit v1.9.2