|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()"> <div> <span @click="favoriteFunction()"> <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg> </span> </div> <el-form-item :label="'计划编码'"> <el-input v-model="searchData.planID" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'设备编码'"> <el-input v-model="searchData.objectID" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'计划执行人员'"> <el-input v-model="searchData.planOperator" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'状态'"> <el-select v-model="searchData.status" style="width: 130px"> <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-button @click="searchClick()">查询</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 v-loading="dataListLoading" @selection-change="selectionChangeHandle" 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="60"> <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>--> <a type="text" size="small" v-if="scope.row.status==='未开工'" @click="cancelOrder(scope.row)">取消工单</a> <a type="text" size="small" v-if="scope.row.status==='已完工' || scope.row.status==='待审核'" @click="reportModal(scope.row)">详情</a> </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.site" disabled style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'工单号'"> <el-input v-model="saveData.orderNo" disabled style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'计划执行人员'"> <el-input v-model="saveData.planOperatorName" disabled style="width: 120px"></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"><a>协同人员</a></span> <span v-if="saveData.status === '待审核'" slot="label" @click="getOperatorList()"><a>协同人员</a></span> <el-input v-model="saveData.operator" readonly style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'维保结论'"> <el-select v-if="saveData.status === '待审核'" v-model="saveData.checkResult" style="width: 120px"> <el-option label="合格" value="合格"></el-option> <el-option label="异常" value="异常"></el-option> </el-select> <el-select v-if="saveData.status === '已完工'" v-model="saveData.checkResult" disabled 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 v-if="saveData.status === '已完工'" disabled 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-select v-if="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-input v-if="saveData.status === '已完工'" v-model="saveData.disposalMeasures" disabled style="width: 120px"></el-input>--><!-- <el-input v-if="saveData.status === '待审核'" v-model="saveData.disposalMeasures" style="width: 120px"></el-input>--> </el-form-item> </el-form> <el-form :inline="true" label-position="top" > <el-form-item :label="'工作时间'"> <el-input v-if="saveData.status === '已完工'" v-model="saveData.workTime" type="number" :min="0" disabled style="width: 120px"></el-input> <el-input v-if="saveData.status === '待审核'" v-model="saveData.workTime" type="number" :min="0" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'执行结果备注'"> <el-input v-if="saveData.status === '已完工'" v-model="saveData.remark" disabled style="width: 523px"></el-input> <el-input v-if="saveData.status === '待审核'" v-model="saveData.remark" style="width: 523px"></el-input> </el-form-item> <el-form-item :label="' '"> <el-button v-if="saveData.status === '已完工'" type="primary" @click="checkModal()">取消审核</el-button> <el-button v-if="saveData.status === '待审核'" type="primary" @click="checkModal()">审核</el-button> </el-form-item> </el-form> <div class="rq "> <el-table :height="400" :data="detailList" border v-loading="dataListLoading" style="width: 100%;"> <el-table-column prop="" header-align="center" align="center" min-width="40" 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="center"--><!-- min-width="80"--><!-- label="是否完成">--><!-- <template slot-scope="scope">--><!-- {{scope.row.finishFlag=='Y'?"是":"否"}}--><!-- </template>--><!-- </el-table-column>--> <el-table-column prop="" header-align="center" align="right" min-width="80" label="检验结论"> <template slot-scope="scope"> <el-select v-if="saveData.status === '已完工'" v-model="scope.row.itemResult" disabled style="height: 11px;padding: 0px"> <el-option label="合格" value="合格"></el-option> <el-option label="不合格" value="不合格"></el-option> </el-select> <el-select v-if="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 v-if="saveData.status === '待审核'" 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-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-input v-model="operatorData.adminID" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'人员名称'"> <el-input v-model="operatorData.adminName" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="' '"> <el-button type="primary" @click="getOperatorList()">查询</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 v-loading="dataListLoading" 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 } from "@/api/eam/eam.js" import Chooselist from '@/views/modules/common/Chooselist_eam' import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' export default { components: { Chooselist }, watch: { searchData: { deep: true, handler: function (newV, oldV) { this.searchData.groupID = this.searchData.groupID.toUpperCase() } },
modalData: { deep: true, handler: function (newV, oldV) { this.modalData.groupID = this.modalData.groupID.toUpperCase() } } }, data () { return { // 是否收藏
favorite: false, // 导出 start
exportData: [], exportName: "维保工单" + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["维保工单"], exportFooter: [], exportList:[], // 导出 end
tagNo:'', searchData: { site: this.$store.state.user.site, orderNo: '', planID: '', objectID: '', planOperator: '', functionType: 'B', status: '', startDate:'', endDate:'', page: 1, planDate: new Date(), limit: 10, }, height: 200, pageIndex: 1, pageSize: 50, totalPage: 0, dataList: [], dataListLoading: false, dataListSelections: [], modalFlag:false, modalDisableFlag:false, modalData:{ flag:'', site: this.$store.state.user.site, groupID:'', groupDesc:'', active:'', }, departmentList:[], // 展示列集
columnList: [ { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableOrderNo', tableId: "101018Table", tableName: "common", columnProp: 'disposalMeasures', headerAlign: "center", align: "center", columnLabel: '异常原因', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TablePlanID', tableId: "101018Table", tableName: "common", columnProp: 'planID', headerAlign: "center", align: "center", columnLabel: '计划编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableOrderNo', tableId: "101018Table", tableName: "common", columnProp: 'orderNo', headerAlign: "center", align: "center", columnLabel: '工单编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TablePropertiesCode', tableId: "101018Table", tableName: "common", columnProp: 'propertiesCode', headerAlign: "center", align: "center", columnLabel: '模板编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101014, serialNumber: '101014TablePropertiesCodeDesc', tableId: "101014Table", tableName: "common", columnProp: 'codeDesc', headerAlign: "center", align: "center", columnLabel: '模板名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableObjectID', tableId: "101018Table", tableName: "common", columnProp: 'objectID', headerAlign: "center", align: "center", columnLabel: '设备编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101014, serialNumber: '101014TableObjectDesc', tableId: "101014Table", tableName: "common", columnProp: 'objectDesc', headerAlign: "center", align: "center", columnLabel: '设备名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableStatus', tableId: "101018Table", tableName: "common", columnProp: 'status', headerAlign: "center", align: "center", columnLabel: '状态', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TablePlanOperatorName', tableId: "101018Table", tableName: "common", columnProp: 'planOperatorName', headerAlign: "center", align: "center", columnLabel: '计划机修人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualOperatorName', tableId: "101018Table", tableName: "common", columnProp: 'actualOperatorName', headerAlign: "center", align: "center", columnLabel: '实际机修人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualOperatorName', tableId: "101018Table", tableName: "common", columnProp: 'operator', headerAlign: "center", align: "center", columnLabel: '协同人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualOperatorName', tableId: "101018Table", tableName: "common", columnProp: 'checkerName', headerAlign: "center", align: "center", columnLabel: '审核人员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualPlanDate', tableId: "101018Table", tableName: "common", columnProp: 'planDate', headerAlign: "center", align: "center", columnLabel: '计划执行日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualActualDate', tableId: "101018Table", tableName: "common", columnProp: 'actualDate', headerAlign: "center", align: "center", columnLabel: '实际执行日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableWorkTime', tableId: "101018Table", tableName: "common", columnProp: 'workTime', headerAlign: "center", align: "center", columnLabel: '工作时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, { userId: this.$store.state.user.name, functionId: 101018, serialNumber: '101018TableActualRemark', tableId: "101018Table", tableName: "common", columnProp: 'remark', headerAlign: "center", align: "center", columnLabel: '工单备注', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', }, ], 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' }, columnDetailList: [ { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2EamPropertiesItemID', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'itemNo', headerAlign: "center", align: "center", columnLabel: '维保项目编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 90, }, { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2EamPropertiesItemDesc', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'itemDesc', headerAlign: "center", align: "center", columnLabel: '维保项目名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 90, }, { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2EamPropertiesItemRemark', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'itemRemark', 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: 101020, serialNumber: '101020Table2ValueType', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'valueType', headerAlign: "center", align: "center", columnLabel: '检测值类型', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 70, }, { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2DefaultValue', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'defaultValue', headerAlign: "center", align: "center", columnLabel: '参照值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 70, }, { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2MaxValue', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'maxValue', headerAlign: "center", align: "center", columnLabel: '最大值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 70, }, { userId: this.$store.state.user.name, functionId: 101020, serialNumber: '101020Table2MinValue', tableId: "101020Table2", tableName: "维保项目表", columnProp: 'minValue', headerAlign: "center", align: "center", columnLabel: '最小值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 70, }, ], submitData:{ site: this.$store.state.user.site, orderNo: '', planID: '', objectID: '', checker: '', checkerName: '', difficultyLevel: '', difficultyRemark: '' }, submitModelFlag: false, // 日期限制
pickerOptions: { disabledDate(time) { return time.getTime() > Date.now(); }, }, cancelModelFlag: false, cancelData: { site: '', orderNo: '', objectID: '', functionType: '', cancelAll: '', planID: '', status: '' }, descImages: [], imageModalFlag: false, operatorModelFlag: false, operatorData: { site: this.$store.state.user.site, adminID: '', adminName: '' }, 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: '', }, ], } }, mounted () { this.$nextTick(() => { this.height = window.innerHeight - 210 }) }, created () { this.getDataList() this.favoriteIsOk() }, methods: { /** * 查看项目图片 */ checkItemImageModal (row){ this.descImages = []; let tempData = { site: this.$store.state.user.site, orderNo: row.orderNo, folder: row.itemNo, }; 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.AdminID this.planOperatorName = val.AdminName } }, //导出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 }, // 导出 end
// 重置查询时间
searchClick(){ this.searchData.planDate = '' this.getDataList() }, // 获取数据列表
getDataList () { 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.dataListLoading = 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, 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, itemNo: row.itemNo, planID: row.planID, orderNo: row.orderNo, itemType: row.functionType, } eamWorkOrderReportSearch(inData).then(({data}) => { this.detailList = data.rows }) this.saveData = { site: row.site, 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' } this.detailModelFlag = true; }, // 审核按钮
checkModal(){ this.submitData.site = this.saveData.site 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 let tempData = { site: this.$store.state.user.site, mesUser: this.$store.state.user.name } 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: '确定' }) } }) }).catch(() => { }) }else if (this.submitData.status === '待审核'){ if (!this.submitData.checker.split(';').includes(tempData.mesUser)){ this.$alert('审核人员与计划不符!', '错误', { confirmButtonText: '确定', type: 'warning' }) return false } 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: '确定' }) } }) }).catch(() => { }) // selectNameByMes(tempData).then(({data}) => {
// if (data.rows[0].adminName != this.submitData.checkerName){
// this.$alert('审核人员与计划不符!', '错误', {
// confirmButtonText: '确定',
// type: 'warning'
// })
// return false
// }else {
// this.$confirm(`是否确认审核?`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// checkWorkOrder(this.submitData).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: '确定'
// })
// }
// })
// }).catch(() => {
// })
// }
// })
} },
// 获取人员列表
getOperatorList(){ // 先清空缓存选中
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) // 拿到选中的人员编号
let tempDataList = 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: '确定' }) } }) },
// 部门
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 (){ let tempFlag = 'N' if (this.saveData.checkResult === '' || this.saveData.checkResult == null) { this.$message.warning('请选择维保结论!') return } if(this.saveData.workTime === 0){ this.$message.warning('工作时长不能为0!') return } if(this.saveData.workTime < 0){ this.$message.warning('工作时长不能小于0!') return } if (this.saveData.checkResult === '不合格') { this.detailList.forEach(val => { if (val.itemResult === '不合格') { tempFlag = 'Y' } }) if (tempFlag != 'Y') { 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: '确定' }) } }) },
} }</script>
|