From d91fd1557ebed3e9bcb8c051c71b9d41c0e36eef Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 02 四月 2024 16:50:07 +0800 Subject: [PATCH] Default Changelist --- src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue | 209 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 190 insertions(+), 19 deletions(-) diff --git a/src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue b/src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue index 7798f8d..7cfecd0 100644 --- a/src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue +++ b/src/views/newSpecialWorkSystem/workTicket/wdsq/index.vue @@ -6,7 +6,7 @@ <el-row class="homeCard"> <div class="basic-line" style="display:flex;white-space:nowrap;line-height: 40px"> <span>时间筛选:</span> - <el-date-picker v-model="timeRange" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" @change="giveTime()" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" /> + <el-date-picker v-model="timeRange" value-format="YYYY-MM-DD" type="daterange" @change="giveTime" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" /> </div> <div class="basic-line" style="display:flex;white-space:nowrap;line-height: 40px"> <span>负责人:</span> @@ -44,6 +44,7 @@ <el-row class="cardTop"> <el-col :span="12" class="mainCardBtn"> <el-button type="primary" :icon="Plus" size="default" @click="toApply()">申请</el-button> + <el-button type="primary" :icon="Download" size="default" @click="exportSheet()">导出记录</el-button> </el-col> <el-button type="primary" :icon="Refresh" size="default" @click="reLoadData()" /> </el-row> @@ -92,13 +93,13 @@ <el-button v-else link type="primary" size="small" @click="openReport('查看', scope.row)">查看研判报告</el-button> </template> </el-table-column> - <el-table-column fixed="right" label="操作" align="center" width="300"> + <el-table-column fixed="right" label="操作" align="center" width="150"> <template #default="scope"> <span v-if="scope.row.status == -1">已废止</span> <el-button v-if="scope.row.status == 0 || scope.row.status == 1" link type="danger" size="small" :icon="Delete" @click="abortRecordBtn(scope.row)">作废</el-button> <el-button v-if="scope.row.status !== -1" link type="primary" size="small" :icon="View" @click="viewRecord(scope.row)">查看</el-button> -<!-- <el-button link type="success" size="small" :icon="Finished">修改</el-button>--> - <el-button v-if="scope.row.status == 1" link type="success" size="small" :icon="Download" @click="checkTicket(scope.row)">正式办票</el-button> + <el-button link type="primary" size="small" v-throttle :icon="Edit" @click="openEdit(scope.row)">修改</el-button> + <el-button link type="success" v-throttle v-if="scope.row.status == 0 || scope.row.status == 1" size="small" :icon="Download" @click="checkTicket(scope.row)">正式办票</el-button> <!-- <el-button :disabled="scope.row.status == 7 ? false : true" link type="primary" size="small" :icon="Download" @click="downLoadBtn(scope.row)">导出作业票</el-button>--> </template> </el-table-column> @@ -121,13 +122,19 @@ <detail-log :type=dialogType :statusList=statusList :details = details></detail-log> <template #footer> <span class="dialog-footer"> - <el-button type="primary" @click="dialogDetails = false" - >确认</el-button - > + <el-button type="primary" @click="dialogDetails = false">确认</el-button> </span> </template> </el-dialog> <report-log ref="reportDialogRef" @refresh="getListByPage"></report-log> + <fire-dialog ref="fireRef" :lists="lists" @refresh="getListByPage"></fire-dialog> + <plate-dialog ref="plateRef" :lists="lists" @refresh="getListByPage"></plate-dialog> + <space-dialog ref="spaceRef" :lists="lists" @refresh="getListByPage"></space-dialog> + <hoist-dialog ref="hoistRef" :lists="lists" @refresh="getListByPage"></hoist-dialog> + <ground-dialog ref="groundRef" :lists="lists" @refresh="getListByPage"></ground-dialog> + <broken-dialog ref="brokenRef" :lists="lists" @refresh="getListByPage"></broken-dialog> + <height-dialog ref="heightRef" :lists="lists" @refresh="getListByPage"></height-dialog> + <power-dialog ref="powerRef" :lists="lists" @refresh="getListByPage"></power-dialog> </div> </template> @@ -174,6 +181,7 @@ searPara: {} timeRange: Array<string>; dep4List: Array<type>; + lists: {} } interface type { id: number; @@ -187,13 +195,29 @@ name: 'myApply', components: { detailLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/detailLog.vue')), - reportLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/jsaReportDialog.vue')) + reportLog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/jsaReportDialog.vue')), + fireDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/fireDialog.vue')), + plateDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/plateDialog.vue')), + spaceDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/spaceDialog.vue')), + hoistDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/hoistDialog.vue')), + groundDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/groundDialog.vue')), + brokenDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/brokenDialog.vue')), + heightDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/heightDialog.vue')), + powerDialog: defineAsyncComponent(() => import('/@/views/newSpecialWorkSystem/workTicket/wdsq/components/powerDialog.vue')) }, setup() { const userInfo = useUserInfo(); const { userInfos } = storeToRefs(userInfo); const router = useRouter(); const reportDialogRef = ref(); + const fireRef = ref() + const plateRef = ref() + const spaceRef = ref() + const hoistRef = ref() + const groundRef = ref() + const brokenRef = ref() + const heightRef = ref() + const powerRef = ref() const state = reactive<stateType>({ pageIndex1: 1, pageSize1: 10, @@ -236,6 +260,15 @@ { id: 7, name: '临时用电作业' }, { id: 8, name: '盲板抽堵作业' } ], + lists: { + workerList: [], + departList: [], + departList2: [], + deviceList: [], + otherWorks: [], + spList: [], + riskList: [] + }, dep4List: [ {id:49,name:'电石事业部'}, {id:50,name:'电力事业部'}, @@ -289,10 +322,125 @@ } ] }); + + // 页面载入时执行方法 + onMounted(() => { + getListByPage(); + getAllDepartment() + spWorker() + getAll() + getAllDevice() + getAllRisks() + getOtherWork() + }); + + const openEdit = (row)=>{ + if(row.workType == 1){ + fireRef.value.openDialog(row) + } + if(row.workType == 2){ + spaceRef.value.openDialog(row) + } + if(row.workType == 3){ + hoistRef.value.openDialog(row) + } + if(row.workType == 4){ + groundRef.value.openDialog(row) + } + if(row.workType == 5){ + brokenRef.value.openDialog(row) + } + if(row.workType == 6){ + heightRef.value.openDialog(row) + } + if(row.workType == 7){ + powerRef.value.openDialog(row) + } + if(row.workType == 8){ + plateRef.value.openDialog(row) + } + } + + const spWorker = async ()=>{ + for(let id of ['17','18','19']){ + const res = await workApplyApi().getSpList({roleId: id}) + if(id == '17'){ + if (res.data.code === '200') { + state.lists.spList.opList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + if(id == '18'){ + if (res.data.code === '200') { + state.lists.spList.jhList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + if(id == '19'){ + if (res.data.code === '200') { + state.lists.spList.sfList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + } + } + + // 获取用户列表 + const getAll = async ()=>{ + const res = await workApplyApi().getAllUsers() + if (res.data.code === '200') { + state.lists.workerList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + }; + + // 获取设备列表 + const getAllDevice = async ()=>{ + const res = await workApplyApi().getAllDevices() + if (res.data.code === '200') { + state.lists.deviceList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + + // 获取设备列表 + const getAllRisks = async ()=>{ + const res = await workApplyApi().getAllRiskIdentity() + if (res.data.code === '200') { + // state.allDevices = JSON.parse(JSON.stringify(res.data.data)) + state.lists.riskList = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + const giveTime = () => { if (state.timeRange && state.timeRange !== null) { state.searPara.startTime = state.timeRange[0]; - state.searPara.endTime = state.timeRange[1]; + state.searPara.endTime = state.timeRange[1] } else { state.searPara.startTime = ''; state.searPara.endTime = ''; @@ -320,12 +468,25 @@ if (res.data.code === '200') { state.departmentList = JSON.parse(JSON.stringify(res.data.data)) recursion(state.departmentList); + state.lists.departList = JSON.parse(JSON.stringify(res.data.data)) + state.lists.departList2 = JSON.parse(JSON.stringify(res.data.data))[0].children[0].children.filter(i=>i.depId == 32 || i.depId == 48 || i.depId == 49 || i.depId == 50) } else { ElMessage({ type: 'warning', message: res.data.msg }); } + }; + const getOtherWork = async () => { + let res = await workApplyApi().getOtherWork({workPermitNo: '',workType: null}); + if (res.data.code === '200') { + state.lists.otherWorks = JSON.parse(JSON.stringify(res.data.data)) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } }; const recursion = (value: any) => { @@ -381,6 +542,7 @@ // 关键词查询记录 const searchRecord = async () => { + state.pageIndex1 = 1 getListByPage(); }; // 重置搜索 @@ -482,15 +644,19 @@ } // 导出方法 - const downLoadRecord = async (data: any) => { + const exportSheet = async () => { // let res = await workApplyApi().postPrinting(data); - axios.post(import.meta.env.VITE_API_URL + `/work/apply/printingPdf`,data,{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{ + axios.post(import.meta.env.VITE_API_URL + `/specialwork9step/work/export/excel`,{startTime: state.searPara.startTime,endTime: state.searPara.endTime,secondDepId: state.searPara.secondDepId},{headers:{'Content-Type': 'application/json','Authorization': `${Cookies.get('token')}`,'uid':`${Cookies.get('uid')}`},responseType: 'blob'}).then(res=>{ if (res) { const link = document.createElement('a') - let blob = new Blob([res.data],{type: 'application/pdf'}) + let blob = new Blob([res.data],{type: 'application/excel'}) link.style.display = "none"; link.href = URL.createObjectURL(blob); // 创建URL - link.setAttribute("download", state.downLoadName + "作业证.pdf"); + if(state.searPara.startTime !== '' && state.searPara.endTime !==''){ + link.setAttribute("download", state.searPara.startTime + '—' + state.searPara.endTime +"作业申报记录.xlsx") + }else{ + link.setAttribute("download", "作业申报记录.xlsx") + } document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -531,12 +697,6 @@ await initBackEndControlRoutes(); }; - // 页面载入时执行方法 - onMounted(() => { - getListByPage(); - getAllDepartment() - }); - return { View, Edit, @@ -546,6 +706,16 @@ Finished, Download, reportDialogRef, + fireRef, + plateRef, + spaceRef, + hoistRef, + groundRef, + brokenRef, + heightRef, + powerRef, + openEdit, + getAllDepartment, checkTicket, giveTime, reLoadData, @@ -559,6 +729,7 @@ viewStatus, abortRecordBtn, downLoadBtn, + exportSheet, getListByPage, handleSizeChange1, handleCurrentChange1, -- Gitblit v1.9.2