|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item label="BU"> <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px"> <el-option v-for = "i in userBuList" :key = "i.buNo" :label = "i.buDesc" :value = "i.buDesc"> </el-option> </el-select> </el-form-item> <el-form-item label="计划编码"> <el-input v-model="searchData.planID" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item label="工单编码"> <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item label="设备编码"> <el-input v-model="searchData.objectID" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item label="计划执行人员"> <el-input v-model="searchData.planOperator" clearable style="width: 120px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item label="状态"> <el-select v-model="searchData.status" clearable style="width: 80px"> <el-option label="未开工" value="未开工"></el-option> <el-option label="待审核" value="待审核"></el-option> <el-option label="已完工" value="已完工"></el-option> <el-option label="已取消" value="已取消"></el-option> </el-select> </el-form-item> <el-form-item label="计划执行日期"> <el-date-picker style="width: 120px" v-model="searchData.startDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item style="margin-top: 23px;"> <laber style="margin-left: -9px;font-size: 19px">➞</laber> </el-form-item> <el-form-item label=" "> <el-date-picker style="width: 120px" v-model="searchData.endDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label="部门"> <el-select v-model="searchData.checkType" clearable style="width: 80px"> <el-option label="生产" value="R022"></el-option> <el-option label="设备" value="R023"></el-option> <el-option label="质量" value="R024"></el-option> </el-select> </el-form-item> <el-form-item label=" "> <el-button v-if="!authSearch" :loading="searchLoading" @click="searchClick()">查询</el-button> <el-button type="primary" :loading="checkLoading" @click="checkModals()">批量审核</el-button> <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button> <!-- <el-button type="primary" @click="changeModel()">更改机修人员</el-button>--><!-- <download-excel--><!-- :fields="fields()"--><!-- :data="exportData"--><!-- type="xls"--><!-- :name="exportName"--><!-- :header="exportHeader"--><!-- :footer="exportFooter"--><!-- :fetch="createExportData"--><!-- :before-generate="startDownload"--><!-- :before-finish="finishDownload"--><!-- worksheet="导出信息"--><!-- class="el-button el-button--primary el-button--medium">--><!-- {{ "导出" }}--><!-- </download-excel>--> </el-form-item> </el-form>
<el-table :height="height" :data="dataList" border @selection-change="selectionChangeHandle" :row-style="controlRowStyle" style="width: 100%;"> <el-table-column type="selection" header-align="center" align="center" :selectable="selectFlag" width="50"> </el-table-column> <el-table-column prop="checkResult" header-align="center" align="center" label="维保结论" width="80"> <template slot-scope="scope"> <div :style="{ color: scope.row.checkResult =='合格' ? 'green' : scope.row.checkResult =='异常' ? 'red' : ''}"> {{ scope.row.checkResult }} </div> </template> </el-table-column> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作"> <template slot-scope="scope"><!-- <a type="text" size="small" v-if="scope.row.status=='待审核'" @click="checkModal(scope.row)">审核</a>--> <el-link style="cursor: pointer" v-if="scope.row.status==='未开工' && !authCancel" @click="cancelOrder(scope.row)">取消工单</el-link> <el-link style="cursor: pointer" v-if="(scope.row.status==='已完工' || scope.row.status==='待审核') && !authDetail" @click="reportModal(scope.row)">详情</el-link> </template> </el-table-column> </el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination>
<el-dialog title="执行结果" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1200px"> <el-form :inline="true" label-position="top"> <el-form-item :label="'工单号'"> <el-input v-model="saveData.orderNo" disabled style="width: 221px"></el-input> </el-form-item> <el-form-item :label="'计划执行人员'"> <el-input v-model="saveData.planOperatorName" disabled style="width: 221px"></el-input> </el-form-item> <el-form-item :label="'实际执行人员'"> <el-input v-model="saveData.actualOperatorName" disabled style="width: 120px"></el-input> </el-form-item> <el-form-item> <span v-if="saveData.status === '待审核'" slot="label" @click="getOperatorList()"><a>协同人员</a></span> <span v-else slot="label">协同人员</span> <el-input v-model="saveData.operator" readonly style="width: 221px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top"> <el-form-item :label="'到达时间'"> <el-date-picker :disabled="saveData.status === '已完工'" v-model="saveData.reachDate" style="width: 221px" type="datetime" value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss'></el-date-picker> </el-form-item> <el-form-item :label="'实际执行时间'"> <el-date-picker :disabled="saveData.status === '已完工'" v-model="saveData.actualDate" style="width: 221px" type="datetime" value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss'></el-date-picker> </el-form-item> <el-form-item :label="'工作时长(m)'"> <el-input v-model="saveData.workTime" type="number" :min="0" disabled style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'维保结论'"> <el-select :disabled="saveData.status === '已完工'" v-model="saveData.checkResult" style="width: 120px"> <el-option label="合格" value="合格"></el-option> <el-option label="不合格" value="异常"></el-option> </el-select> </el-form-item> <el-form-item v-if="this.saveData.checkResult === '异常'" :label="'异常原因'"> <el-select :disabled="saveData.status === '已完工'" v-model="saveData.disposalMeasures" style="width: 120px"> <el-option label="缺少备件" value="缺少备件"></el-option> <el-option label="等待售后" value="等待售后"></el-option> <el-option label="远程协助" value="远程协助"></el-option> <el-option label="换班换人" value="换班换人"></el-option> </el-select> </el-form-item> <el-form-item :label="' '"> <el-button v-if="saveData.status === '已完工'" type="primary" @click="checkModal()">取消审核</el-button> <el-button v-else type="primary" @click="checkModal()">审核</el-button> <el-button v-if="this.saveData.checkResult === '异常'" type="primary" @click="returnModal()">退回</el-button> </el-form-item> </el-form> <el-form :inline="true" label-position="top"> <el-form-item :label="'执行结果备注'"> <el-input type="textarea" :readonly="saveData.status === '已完工'" v-model="saveData.remark" :rows="3" resize='none' show-word-limit style="width: 1177px;height: 20px"></el-input> </el-form-item> </el-form> <div class="rq "> <el-table :height="400" :data="detailList" border v-loading="detailLoading" style="width: 100%;margin-top: 50px"> <el-table-column prop="" header-align="center" align="center" min-width="50" label="操作"> <template slot-scope="scope"> <el-button class="el-icon-picture-outline" type="primary" @click="checkItemImageModal(scope.row)"></el-button> </template> </el-table-column> <el-table-column v-for="(item,index) in columnDetailList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed === '' ? false : item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column prop="" header-align="center" align="right" min-width="80" label="实测值"> <template slot-scope="scope"> <el-input v-if="scope.row.valueTypeDb === 'T' && saveData.status === '待审核'" v-model="scope.row.textValue" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input> <el-input v-if="scope.row.valueTypeDb === 'T' && saveData.status === '已完工'" v-model="scope.row.textValue" readonly style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input> <el-input v-if="scope.row.valueTypeDb === 'N' && saveData.status === '待审核'" v-model="scope.row.numberValue" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input> <el-input v-if="scope.row.valueTypeDb === 'N' && saveData.status === '已完工'" v-model="scope.row.numberValue" readonly style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input> </template> </el-table-column> <el-table-column prop="" header-align="center" align="right" min-width="80" label="检验结论"> <template slot-scope="scope"> <el-select :disabled="saveData.status === '已完工'" v-model="scope.row.itemResult" style="height: 11px;padding: 0px"> <el-option label="合格" value="合格"></el-option> <el-option label="不合格" value="不合格"></el-option> </el-select> </template> </el-table-column> </el-table> </div> <el-footer style="height:40px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="updateWorkOrder()">确定</el-button> <el-button type="primary" @click="detailModelFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="批量修改计划人员" :close-on-click-modal="false" v-drag :visible.sync="changeModelFlag" width="300px"> <el-form :inline="true" label-position="top"> <el-form-item style="margin-left: 10px"> <span slot="label" style="" @click="getBaseList(201)"><a herf="#">计划执行人员</a></span> <el-input v-model="planOperator" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'人员名称'"> <el-input v-model="planOperatorName" disabled style="width: 120px"></el-input> </el-form-item> </el-form> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="changeOrderOperator()">保存</el-button> <el-button type="primary" @click="changeModelFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="取消工单" :close-on-click-modal="false" v-drag :visible.sync="cancelModelFlag" width="375px"> <el-form :inline="true" label-position="top"> <el-form-item :label="' '"> <h>是否取消选定工单?</h> </el-form-item> </el-form> <el-form :inline="true" label-position="top"> <el-form-item :label="' '"><!-- <input type="checkbox" value="Y" name="addWorkOrderRule" v-model="cancelData.cancelAll"/> 删除该计划下当前设备的所有工单--> <el-checkbox v-model="cancelData.cancelAll" true-label="Y">删除该计划下当前设备的所有工单</el-checkbox><br> </el-form-item> </el-form> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="cancelOrder2()">确定</el-button> <el-button type="primary" @click="cancelModelFlag = false">取消</el-button> </el-footer> </el-dialog>
<el-dialog title="图片查看" :close-on-click-modal="false" v-drag :visible.sync="imageModalFlag" width="390px" style="height: 550px;"> <div v-viewer> <img v-for="(item, index) in descImages" :src="item" :key="index" style="width: 100px;height: 100px"/> </div> <el-footer style="height:40px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="imageModalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<!-- 人员 --> <el-dialog title="人员清单" :close-on-click-modal="false" v-drag :visible.sync="operatorModelFlag" width="520px"> <div class="rq"> <el-form :inline="true" label-position="top" :model="operatorData"> <el-form-item :label="'所属角色'"> <el-select v-model="operatorData.roleId" placeholder="请选择" style="width: 120px"> <el-option v-for = "i in roleList" :key = "i.roleId" :label = "i.roleName" :value = "i.roleId"> </el-option> </el-select> </el-form-item> <el-form-item :label="'用户账号'"> <el-input v-model="operatorData.adminID" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'用户名称'"> <el-input v-model="operatorData.adminName" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="' '"> <el-button type="primary" @click="getOperatorList2">查询</el-button> </el-form-item> </el-form> <el-table :height="300" :data="operatorList" ref="operatorTable" @row-click="operatorClickRow" @selection-change="selectionOperator" :row-key="getRowKeys" border style="width: 100%;"> <el-table-column type="selection" header-align="center" align="center" :reserve-selection="true" width="50"> </el-table-column> <el-table-column v-for="(item,index) in operatorDetailList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> </div> <el-footer style="height:40px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="confirmOperator()">确认</el-button> <el-button type="primary" @click="operatorModelFlag = false">关闭</el-button> </el-footer> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div></template>
<script> import { eamWorkOrderSearch, cancelOrder, changeOrderOperator, eamWorkOrderReportSearch, getOperatorList, checkWorkOrder, searchFileUrl, updateWorkOrder, getSiteAndBuByUserName, getUserRoleList, getRoleByUserName, checkWorkOrders, // 批量审核
} from "@/api/eam/eam.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import Chooselist from '@/views/modules/common/Chooselist_eam' import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' import excel from "@/utils/excel-util.js"; import {returnWorkOrder} from "../../../api/eam/eam"; export default { components: { Chooselist }, watch: { saveData: { deep: true, handler: function (newV, oldV) { this.saveData.workTime = Math.ceil(Math.floor(this.dayjs(this.saveData.actualDate).diff(this.saveData.reachDate, 'seconds') / 30) / 2) } } }, data () { return { // 是否收藏
favorite: false, // 导出 start
exportData: [], exportName: "维保工单" + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["维保工单"], exportFooter: [], exportList: [], // 导出 end
tagNo: '', searchData: { site: this.$store.state.user.site, userName: this.$store.state.user.name, orderNo: '', planID: '', objectID: '', planOperator: '', buDesc: '', functionType: 'B', status: '', startDate:'', endDate:'', page: 1, planDate: new Date(), limit: 10, searchType: 'maintenanceOrder', checkType: '' }, height: 200, pageIndex: 1, pageSize: 20, totalPage: 0, dataList: [], dataListSelections: [], modalFlag: false, modalDisableFlag: false, modalData: { flag: '', bu: '', site: '', groupID: '', groupDesc: '', active: '', }, departmentList: [], // 展示列集
columnList: [ { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1BuDesc', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'buDesc', headerAlign: "center", align: "center", columnLabel: 'BU', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1DisposalMeasures', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'disposalMeasures', headerAlign: "center", align: "center", columnLabel: '异常原因', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1PlanID', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'planID', headerAlign: "center", align: "center", columnLabel: '计划编码', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1OrderNo', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'orderNo', headerAlign: "center", align: "center", columnLabel: '工单编码', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1PropertiesCode', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'propertiesCode', headerAlign: "center", align: "center", columnLabel: '模板编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101014, serialNumber: '101014Table1CodeDesc', tableId: "101014Table1", tableName: "维保工单表", columnProp: 'codeDesc', headerAlign: "center", align: "left", columnLabel: '模板名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1ObjectID', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'objectID', headerAlign: "center", align: "center", columnLabel: '设备编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101014, serialNumber: '101014Table1ObjectDesc', tableId: "101014Table1", tableName: "维保工单表", columnProp: 'objectDesc', headerAlign: "center", align: "left", columnLabel: '设备名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1Status', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'status', headerAlign: "center", align: "center", columnLabel: '状态', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1PlanOperatorName', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'planOperatorName', headerAlign: "center", align: "left", columnLabel: '计划执行人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1ActualOperatorName', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'actualOperatorName', headerAlign: "center", align: "center", columnLabel: '实际执行人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1Operator', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'operator', headerAlign: "center", align: "left", columnLabel: '协同人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1CheckerName', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'checkerName', headerAlign: "center", align: "center", columnLabel: '审核人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1ActualPlanDate', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'planDate', headerAlign: "center", align: "center", columnLabel: '计划执行日期', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1LastExecutionDate', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'lastExecutionDate', headerAlign: "center", align: "center", columnLabel: '最晚执行日期', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1ReachDate', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'reachDate', headerAlign: "center", align: "center", columnLabel: '到达时间', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 170, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1ActualDate', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'actualDate', headerAlign: "center", align: "center", columnLabel: '实际执行时间', columnHidden: false, columnImage: false, columnSortable: true, sortLv: 0, status: true, fixed: '', columnWidth: 170, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1WorkTime', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'workTime', headerAlign: "center", align: "right", columnLabel: '工作时长(m)', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table1Remark', tableId: "101003004Table1", tableName: "维保工单表", columnProp: 'remark', headerAlign: "center", align: "left", columnLabel: '工单备注', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, ], changeModelFlag: false, planOperator: '', planOperatorName: '', //执行结果
detailList: [], detailModelFlag: false, saveData: { site:'', orderNo:'', planOperatorName:'', workTime:'', remark:'', actualOperatorName: '', checkResult: '', disposalMeasures: '', planID: '', objectID: '', checker: '', checkerName: '', status: '', operator: '', adminID: '', itemList: [], mesUser: '', functionType: 'B', reachDate: '', actualDate: '' }, columnDetailList: [ { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2ItemNo', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'itemNo', headerAlign: "center", align: "center", columnLabel: '维保项目编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2ItemDesc', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'itemDesc', headerAlign: "center", align: "left", columnLabel: '维保项目名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2ItemRemark', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'itemRemark', headerAlign: "center", align: "left", columnLabel: '维保方法说明', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 400, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2ValueType', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'valueType', headerAlign: "center", align: "center", columnLabel: '检测值类型', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2DefaultValue', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'defaultValue', headerAlign: "center", align: "right", columnLabel: '参照值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2MaxValue', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'maxValue', headerAlign: "center", align: "right", columnLabel: '最大值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 101003004, serialNumber: '101003004Table2MinValue', tableId: "101003004Table2", tableName: "维保项目表", columnProp: 'minValue', headerAlign: "center", align: "right", columnLabel: '最小值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, ], submitData: { site: '', buNo: '', orderNo: '', planID: '', objectID: '', checker: '', checkerName: '', difficultyLevel: '', difficultyRemark: '' }, submitModelFlag: false, // 日期限制
pickerOptions: { disabledDate(time) { return time.getTime() > Date.now(); }, }, cancelModelFlag: false, cancelData: { site: '', buNo: '', orderNo: '', objectID: '', functionType: '', cancelAll: '', planID: '', status: '' }, descImages: [], imageModalFlag: false, operatorModelFlag: false, operatorData: { site: '', bu: '', adminID: '', adminName: '', roleId: '', roleName: '', }, roleList: [], operatorList: [], operatorListSelections: [], operatorDetailList: [ { columnProp: 'adminID', headerAlign: "center", align: "center", columnLabel: '用户账号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { columnProp: 'adminName', headerAlign: "center", align: "center", columnLabel: '用户名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { columnProp: 'email', headerAlign: "center", align: "center", columnLabel: '邮箱', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { columnProp: 'phone', headerAlign: "center", align: "center", columnLabel: '手机号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, ], userBuList: [], userRoleList: [], authSearch: false, authDetail: false, authCancel: false, menuId: this.$route.meta.menuId, detailLoading: false, searchLoading: false, checkLoading: false } },
mounted () { this.$nextTick(() => { this.height = window.innerHeight - 212 }) },
created () { // 按钮控制
this.getButtonAuthData() // 获取用户的 site 和 bu
this.getSiteAndBuByUserName() // 校验用户是否收藏
this.favoriteIsOk() // 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) this.getTableUserColumn(this.$route.meta.menuId+'table2',2) if (!this.authSearch) { // 获取数据列表
this.getDataList() } // 获取用户角色
this.getUserRoleList() },
methods: { // 获取用户的bu
getSiteAndBuByUserName () { let tempData = { username: this.$store.state.user.name, } getSiteAndBuByUserName(tempData).then(({data}) => { if (data.code === 0) { this.userBuList = data.rows } }) },
// 获取用户的 role
getRoleByUserName () { let tempData = { username: this.$store.state.user.name, } getRoleByUserName(tempData).then(({data}) => { if (data.code === 0) { this.userRoleList = data.rows } }) },
// 控制单行的背景颜色
controlRowStyle({row, rowIndex}) { // 区分不同的样式对应不同的颜色
if (row.status === '待审核') { return "background-color: #D8ECF1" } },
/** * 查看项目图片 */ checkItemImageModal (row){ this.descImages = []; let tempData = { site: row.site, orderNo: row.orderNo, folder: row.itemNo, buNo: row.buNo } searchFileUrl(tempData).then(({data}) => { if (data.code === 0) { for (let i = 0; i < data.rows.length; i++) { this.descImages.push(data.rows[i].url) } }else { this.$message.warning(data.msg) } }) this.imageModalFlag = true },
// 校验用户是否收藏
favoriteIsOk () { let userFavorite = { userId: this.$store.state.user.id, languageCode: this.$i18n.locale } userFavoriteList(userFavorite).then(({data}) => { for (let i = 0; i < data.list.length; i++) { if(this.$route.meta.menuId == data.list[i].menuId){ this.favorite = true } } }) },
// 收藏 OR 取消收藏
favoriteFunction () { let userFavorite = { userId: this.$store.state.user.id, functionId: this.$route.meta.menuId, } if (this.favorite) { removeUserFavorite(userFavorite).then(({data}) => { this.$message.success(data.msg) this.favorite = false }) } else { // 收藏
saveUserFavorite(userFavorite).then(({data}) => { this.$message.success(data.msg) this.favorite = true }) } },
// 获取基础数据列表S
getBaseList (val,type) { this.tagNo = val this.$nextTick(() => { let strVal = '' if (val === 201) { strVal = this.planOperator this.$refs.baseList.init(val, strVal) } }) },
/* 列表方法的回调 */ getBaseData (val) { if (this.tagNo === 201) { this.planOperator = val.username this.planOperatorName = val.user_display } },
async exportExcel() { // this.searchData.limit = this.pageSize
// this.searchData.page = this.pageIndex
this.searchData.limit = -1 this.searchData.page = 1 excel.exportTable({ url: "/pms/eam/eamWorkOrderSearch", columnMapping: this.columnList,//可以直接用table,不需要的列就剔除
mergeSetting: [],//需要合并的列
params: this.searchData, fileName: this.exportName+".xlsx", rowFetcher: res => res.data, columnFormatter: [], dropColumns: [],//需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
}); },
//导出excel
// async createExportData () {
// this.searchData.limit = -1
// this.searchData.page = 1
// await eamWorkOrderSearch(this.searchData).then(({data}) => {
// this.exportList= data.page.list
// })
// return this.exportList
// },
// startDownload () {},
//
// finishDownload () {},
//
// fields () {
// let json = "{"
// this.columnList.forEach((item, index) => {
// if (index === this.columnList.length - 1) {
// json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
// } else {
// json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
// }
// })
// json += "}"
// let s = eval("(" + json + ")")
// return s
// },
// 重置查询时间
searchClick(){ this.searchData.planDate = '' this.getDataList() },
// 获取数据列表
getDataList () { this.searchLoading = true this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex eamWorkOrderSearch(this.searchData).then(({data}) => { if (data.code === 0) { this.dataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount this.searchLoading = false } else { this.searchLoading = false } }).catch(() => { this.searchLoading = false }) },
// 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() },
// 当前页
currentChangeHandle (val) { this.pageIndex = val this.getDataList() },
// 多选
selectionChangeHandle (val) { this.dataListSelections = val },
cancelOrder (row) { this.cancelData = { site: row.site, buNo: row.buNo, orderNo: row.orderNo, objectID: row.objectID, functionType: row.functionType, planID: row.planID, status: row.status, cancelAll: '' } this.cancelModelFlag = true },
cancelOrder2 () { // let obj = document.getElementsByName('addWorkOrderRule');
// let s = '';
// for (let i = 0; i < obj.length; i++) {
// if (obj[i].checked) {
// s += obj[i].value + ',';
// }
// }
// s = s.substring(0,s.length-1)
// this.cancelData.cancelAll = s
if (this.cancelData.cancelAll === 'Y') { this.$confirm(`是否取消该计划设备的所有工单?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.cancelOrder3() }).catch(() => { }) }else { this.cancelOrder3() } },
cancelOrder3 () { cancelOrder(this.cancelData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.cancelModelFlag = false this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
selectFlag (row,index) { // if (row.status !== '未开工') {
// return false
// } else {
return true // }
},
changeModel () { if (this.dataListSelections.length === 0) { this.$alert('请勾选工单!', '错误', { confirmButtonText: '确定' }) return false } this.planOperator = '' this.planOperatorName = '' this.changeModelFlag = true },
changeOrderOperator () { let inList = JSON.parse(JSON.stringify(this.dataListSelections)); for (let i = 0; i <inList.length ; i++) { inList[i].planOperator = this.planOperator } changeOrderOperator(inList).then(({data}) => { if (data && data.code === 0) { this.changeModelFlag = false this.getDataList() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
// 详情
reportModal (row) { let inData = { site: row.site, buNo: row.buNo, itemNo: row.itemNo, planID: row.planID, orderNo: row.orderNo, itemType: row.functionType, } this.detailLoading = true eamWorkOrderReportSearch(inData).then(({data}) => { this.detailList = data.rows this.detailLoading = false }) this.saveData = { site: row.site, buNo: row.buNo, orderNo: row.orderNo, planID: row.planID, planOperatorName: row.planOperatorName, workTime: row.workTime, remark: row.remark, actualOperatorName: row.actualOperatorName, checkResult: row.checkResult, disposalMeasures: row.disposalMeasures, objectID: row.objectID, checker: row.checker, checkerName: row.checkerName, status: row.status, operator: row.operator, adminID: row.adminID, itemList: [], mesUser: this.$store.state.user.name, functionType: 'B', reachDate: row.reachDate, actualDate: row.actualDate } this.detailModelFlag = true },
// 审核按钮
checkModal () { let mesUser = this.$store.state.user.name this.submitData.site = this.saveData.site this.submitData.buNo = this.saveData.buNo this.submitData.orderNo = this.saveData.orderNo this.submitData.planID = this.saveData.planID this.submitData.objectID = this.saveData.objectID this.submitData.checker = this.saveData.checker this.submitData.checkerName = this.saveData.checkerName this.submitData.status = this.saveData.status if (!this.submitData.checker.split(';').includes(mesUser)){ this.$message.warning('审核人员与计划不符!') return } if (this.submitData.status === '已完工') { this.$confirm(`是否取消审核?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { checkWorkOrder(this.submitData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.saveData.status = '待审核' this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) } else if (this.submitData.status === '待审核') { this.$confirm(`是否确认审核?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { checkWorkOrder(this.submitData).then(({data}) => { if (data && data.code === 0) { this.getDataList(); this.saveData.status = '已完工' this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) } }, returnModal(){ let mesUser = this.$store.state.user.name this.submitData.site = this.saveData.site this.submitData.buNo = this.saveData.buNo this.submitData.orderNo = this.saveData.orderNo this.submitData.planID = this.saveData.planID this.submitData.objectID = this.saveData.objectID this.submitData.checker = this.saveData.checker this.submitData.checkerName = this.saveData.checkerName this.submitData.status = this.saveData.status if (!this.submitData.checker.split(';').includes(mesUser)){ this.$message.warning('审核人员与计划不符!') return } //先保存
this.updateWorkOrder() //退回操作
returnWorkOrder(this.submitData).then(({data})=>{ if (data && data.code === 0) { this.getDataList() } }) },
// 批量审核按钮
checkModals () { let tempData1 = '' // 记录不是待审核的单号
let tempData2 = '' // 记录审核人员不符的单号
let mesUser = this.$store.state.user.name if (this.dataListSelections.length === 0) { this.$message.warning('请勾选要审核的工单!') return } for (let i = 0; i < this.dataListSelections.length; i++) { if (this.dataListSelections[i].status !== '待审核') { tempData1 = tempData1 + this.dataListSelections[i].orderNo + '、' } if (!this.dataListSelections[i].checker.split(';').includes(mesUser)) { tempData2 = tempData2 + this.dataListSelections[i].orderNo + '、' } } if (tempData1 !== '') { tempData1 = tempData1.substring(0, tempData1.length - 1) this.$message.warning('工单编码 [' + tempData1 + '] 不是待审核状态!') return } if (tempData2 !== '') { tempData2 = tempData2.substring(0, tempData2.length - 1) this.$message.warning('工单编码 [' + tempData2 + '] 审核人员与计划不符!') return } this.$confirm(`是否确认审核?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.checkLoading = true let tempData = { informationList: this.dataListSelections } checkWorkOrders(tempData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.checkLoading = false } else { this.checkLoading = false this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }).catch(() => { this.checkLoading = false }) }) },
// 获取用户角色
getUserRoleList () { getUserRoleList().then(({data}) => { if (data.code === 0) { this.roleList = data.rows } else { this.roleList = [] } }) },
// 获取人员列表
getOperatorList () { this.operatorData.bu = this.saveData.site + '_' + this.saveData.buNo if (this.roleList.length > 0) { let filterList = this.roleList.filter(item => item.roleName === '机修人员') if (filterList.length > 0) { this.operatorData.roleId = filterList[0].roleId } else { this.operatorData.roleId = this.roleList[0].roleId } } else { this.operatorData.roleId = '' } // 先清空缓存选中
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) // 拿到选中的人员编号
let tempDataList = (this.saveData.adminID == null ? '' : this.saveData.adminID).split(';') // 查询所有部门
getOperatorList(this.operatorData).then(({data}) => { if (data && data.code === 0) { this.operatorList = data.rows this.operatorList.forEach(val => { // 回显选中的部门
if (tempDataList.includes(val.adminID)) { this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true)) } }) this.operatorModelFlag = true } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
// 查询机修人员列表
getOperatorList2 () { // 拿到选中的人员编号
let tempDataList = (this.saveData.adminID == null ? '' : this.saveData.adminID).split(';') getOperatorList(this.operatorData).then(({data}) => { if (data && data.code === 0) { this.operatorList = data.rows this.operatorList.forEach(val => { // 回显选中的部门
if (tempDataList.includes(val.adminID)) { this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true)) } }) } else { this.operatorList = [] } }) },
// 部门
operatorClickRow (row) { this.$refs.operatorTable.toggleRowSelection(row) },
// 多选
selectionOperator (val) { this.operatorListSelections = val },
getRowKeys (row) { // 唯一值,一般都为id
return row.adminID },
// 确认多选部门
confirmOperator () { this.saveData.adminID = '' this.saveData.operator = '' for (let i = 0; i < this.operatorListSelections.length; i++) { this.saveData.adminID = this.saveData.adminID + ";" + this.operatorListSelections[i].adminID this.saveData.operator = this.saveData.operator + ";" + this.operatorListSelections[i].adminName } this.saveData.adminID = this.saveData.adminID.substring(1) this.saveData.operator = this.saveData.operator.substring(1) this.operatorModelFlag = false },
updateWorkOrder () { if (this.saveData.checkResult === '' || this.saveData.checkResult == null) { this.$message.warning('请选择维保结论!') return } if (this.saveData.checkResult === '异常' && (this.saveData.disposalMeasures == null || this.saveData.disposalMeasures === '')) { this.$message.warning('请选择异常原因!') return } if (this.saveData.reachDate > this.saveData.actualDate) { this.$message.warning('到达时间不能小于实际执行时间!') return } if (this.saveData.checkResult === '不合格') { const flag = this.detailList.some(item => item.itemResult === '不合格') if (!flag) { this.$message.warning('请选择不合格项目!') return } } this.saveData.itemList = JSON.parse(JSON.stringify(this.detailList)) updateWorkOrder(this.saveData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.detailModelFlag = false this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn (tableId, columnId) { let queryTableUser = { userId: this.$store.state.user.name, functionId: this.$route.meta.menuId, tableId: tableId, status: true, languageCode: this.$i18n.locale } await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { //this.columnList1 = []
switch (columnId) { case 1: this.columnList = data.rows break; case 2: this.columnDetailList = data.rows break; // case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
} } else { this.getColumnList(tableId, columnId) } }) },
// 获取 tableDefault 列
async getColumnList (tableId, columnId) { let queryTable = { functionId: this.$route.meta.menuId, tableId: tableId, languageCode: this.$i18n.locale } await getTableDefaultListLanguage(queryTable).then(({data}) => { if (!data.rows.length == 0) { switch (columnId) { case 1: this.columnList = data.rows break; case 2: this.columnDetailList = data.rows break; // case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
} } else { // this.showDefault = true.
} }) },
//获取按钮的权限数据
getButtonAuthData () { let searchFlag = this.isAuth(this.menuId+":search") let detailFlag = this.isAuth(this.menuId+":detail") let cancelFlag = this.isAuth(this.menuId+":cancel") //处理页面的权限数据
this.authSearch = !searchFlag this.authDetail = !detailFlag this.authCancel = !cancelFlag }, } }</script><style scoped>.el-table /deep/ .cell{ height: auto; line-height: 1.5;}</style>
|