实验室运维前端-web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1345 lines
54 KiB

<template>
<basic-container style="max-height: 800px;overflow: hidden;">
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="form"
:permission="permissionList" :before-open="beforeOpen" :before-close="beforeClose"
@selection-change="selectionChange" @search-change="searchChange" @search-reset="searchReset"
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
<template slot-scope="{ row }" slot="repairStatus">
<el-tag :type="getStatus('inspectionMaintenance', userInfo.role_id, row.repairStatus).type">{{
getStatus('inspectionMaintenance', userInfo.role_id, row.repairStatus).name }}</el-tag>
</template>
<template slot-scope="scope" slot="menuLeft">
<!-- <el-button size="small" type="primary" @click="handleAdd">确认</el-button> -->
<!-- <el-button size="small" @click="clickInvoice">开具发票</el-button> -->
</template>
<template slot-scope="{ row }" slot="menu">
<el-button @click="handleView(row)" v-show="permission.repairDetails">查看</el-button>
<el-button @click="handleSubmit(row)"
v-show="permission.repairsubmit && (row.repairStatus == 1 || row.repairStatus == 101)">提交</el-button>
<el-button @click="handleCheck(row)"
v-show="permission.repairapprove && (row.repairStatus == 2 || row.repairStatus == 102)">审核</el-button>
<el-button v-show="permission.repairconfirm && row.repairStatus == 3" @click="handleAccept(row)">确认</el-button>
<el-button v-show="permission.repaircomplete && row.repairStatus == 4"
@click="handleRepairFinishUpload(row)">维修完成</el-button>
<el-button v-show="permission.repairevaluate && row.repairStatus == 5"
@click="handleEvaluate(row)">评价</el-button>
<el-button v-show="permission.confirmpayment && row.repairStatus == 6"
@click="paymentFinish(row)">确认付款</el-button>
<el-button @click="handleExport(row)"
v-show="row.repairStatus == 6 || row.repairStatus == 7 || row.repairStatus == 8">报告</el-button>
</template>
</avue-crud>
<el-dialog title="巡检异常维修" :visible.sync="dialogerror" :append-to-body="true" width="70%"
:close-on-click-modal="false">
<div style="height: 500px; overflow: auto">
<el-form ref="errorForm" :model="errorForm" :rules="addRules" label-width="120px" label-position="left">
<div>
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
基本信息
</div>
<el-form-item label="单位名称" prop="deptName">
<el-input placeholder="请输入单位名称" readonly v-model="errorForm.deptName" disabled
style="width: 98%;"></el-input>
</el-form-item>
</div>
<div>
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
巡检异常清单
</div>
<el-form-item label="异常清单">
<el-table :span-method="errorSpanMethod" :data="errorForm.tableData" border style="width: 98%"
:summary-method="getSummaries" show-summary :row-class-name="tableRowClassName">
<el-table-column label="楼层" prop="floorName"></el-table-column>
<el-table-column label="房间名称" prop="deptName"></el-table-column>
<el-table-column label="专业/设备" prop="deviceName"></el-table-column>
<el-table-column label="巡检内容" prop="checkContent"></el-table-column>
<el-table-column label="工艺要求" prop="craft"></el-table-column>
<el-table-column label="状态" prop="status" v-if="errorForm.repairStatus != 1">
<template slot-scope="scope">
{{ scope.row.status == 1 ? '异常' : '正常' }}
</template>
</el-table-column>
<!-- <el-table-column label="价格" prop="price" v-if="errorForm.repairStatus != 1"></el-table-column>
<el-table-column label="价格" prop="price" v-if="errorForm.repairStatus == 1">
<template slot-scope="scope">
<el-input v-model="scope.row.price"
:disabled="viewType == 'view' || viewType == 'evaluate' || viewType == 'confirm'"></el-input>
</template>
</el-table-column> -->
<el-table-column prop="isRepair" align="center" label="是否维修" v-if="errorForm.repairStatus >= 3">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.isRepair" fill="red">
<el-radio :disabled="viewType == 'view' || viewType == 'evaluate'" :label="1">是</el-radio>
<el-radio :disabled="viewType == 'view' || viewType == 'evaluate'" class="error_radio"
:label="0">否</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column prop="isNeed" align="center" label="是否需要物料">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.isNeed" fill="red">
<!-- || errorForm.repairStatus != 1 -->
<el-radio :disabled="viewType == 'view' || errorForm.repairStatus != 1" :label="'1'">是</el-radio>
<el-radio :disabled="viewType == 'view' || errorForm.repairStatus != 1" class="error_radio"
:label="'0'">否</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column align="center" label="物料配置">
<template slot-scope="scope">
<el-button @click="setMaterial(scope.row)" :disabled="scope.row.isNeed == 0">物料配置</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="故障现象">
<el-input placeholder="请输入故障现象描述" type="textarea" v-model="errorForm.faultDescribe" style="width:98%;"
:disabled="viewType == 'view' || errorForm.repairStatus != 1"></el-input>
</el-form-item>
<el-form-item label="故障产生原因">
<el-input placeholder="请输入故障产生原因" type="textarea" v-model="errorForm.faultCause" style="width:98%;"
:disabled="viewType == 'view' || errorForm.repairStatus != 1"></el-input>
</el-form-item>
<el-form-item label="处理结果">
<el-input placeholder="请输入处理结果" type="textarea" v-model="errorForm.processingResult" style="width:98%;"
:disabled="viewType == 'view' || errorForm.repairStatus != 1"></el-input>
</el-form-item>
<el-form-item label="差旅费">
<el-input placeholder="请输入差旅费" v-model="errorForm.travelExpense" style="width:98%;"
:disabled="viewType == 'view' || errorForm.repairStatus != 1"><template
slot="append">元</template></el-input>
</el-form-item>
<el-form-item label="巡检结论">
<el-input placeholder="请输入巡检结论" type="textarea" v-model="errorForm.inspectionConclusion"
style="width:98%;" :disabled="viewType == 'view' || errorForm.repairStatus != 1"></el-input>
</el-form-item>
</div>
<div
v-show="((errorForm.repairStatus == 2 || errorForm.repairStatus == 102) || ((errorForm.repairStatus == 1 || errorForm.repairStatus == 101) && errorForm.approvePoint == '主管审核维修方案')) && viewType != 'view'">
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
主管审核
</div>
<el-form-item label="审核结果">
<el-select placeholder="请选择审核结果" v-model="errorForm.approveResult" style="width: 98%;"
:disabled="(errorForm.repairStatus == 1 || errorForm.repairStatus == 101) && errorForm.approvePoint == '主管审核维修方案'">
<el-option label="通过" :value="1"></el-option>
<el-option label="驳回" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="errorForm.approveResult === 0" label="驳回意见">
<el-input type="textarea" v-model="errorForm.approveRemark" style="width: 98%;"
:disabled="(errorForm.repairStatus == 1 || errorForm.repairStatus == 101) && errorForm.approvePoint == '主管审核维修方案'"></el-input>
</el-form-item>
<el-form-item
v-if="(errorForm.repairStatus == 1 || errorForm.repairStatus == 101) && errorForm.approvePoint == '主管审核维修方案'"
label="审批时间">
<el-input v-model="errorForm.approveTime" style="width: 98%;"
:disabled="(errorForm.repairStatus == 1 || errorForm.repairStatus == 101) && errorForm.approvePoint == '主管审核维修方案'"></el-input>
</el-form-item>
</div>
<!-- 维修完成 -->
<div v-show="errorForm.repairStatus == 4 || errorForm.repairStatus == 5 || errorForm.repairStatus == 6 || errorForm.repairStatus == 7 || errorForm.repairStatus == 8">
<el-form-item label="维修完成图片" prop="signaturePerson" v-if="errorForm.repairStatus == 4">
<el-upload action="/api/blade-resource/oss/endpoint/put-file" list-type="picture-card" :headers="headers"
accept=".jpeg,.jpg,.png,.pdf" :file-list="completeImgList" :on-success="handleSuccess"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="维修完成图片" prop="signaturePerson" v-else>
<img v-for="item in completeImgList" :key="item" :src="item.url" alt=""
style="width: 148px; height: 148px;margin-right:10px;">
</el-form-item>
</div>
<div v-show="dataTypes == 1 && errorForm.repairStatus == 3 && viewType != 'view'">
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
客户确认
</div>
<el-form-item label="审核结果">
<el-select placeholder="请选择审核结果" v-model="errorForm.approveResult" style="width: 98%;"
:disabled="viewType == 'view'">
<el-option label="通过" :value="1"></el-option>
<el-option label="驳回" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="errorForm.approveResult === 0" label="驳回意见">
<el-input type="textarea" v-model="errorForm.approveRemark" style="width: 98%;"
:disabled="viewType == 'view'"></el-input>
</el-form-item>
</div>
<div
v-show="(errorForm.repairStatus == 5 || errorForm.repairStatus == 6 || errorForm.repairStatus == 7 || errorForm.repairStatus == 8)">
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
维修效果确认
</div>
<el-form-item label="是否维修完成">
<el-select placeholder="请确认是否维修完成" style="width: 98%;" v-model="errorForm.approveResult1"
@change="changeResult" :disabled="viewType == 'view'">
<el-option label="是" :value="1"></el-option>
<el-option label="否" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="维修未完成原因" v-show="rowStatus == 5 && errorForm.approveResult1 == 0">
<el-input type="textarea" v-model="errorForm.approveRemark" placeholder="请输入维修未完成原因"
style="width: 98%;"></el-input>
</el-form-item>
<div v-show="errorForm.approveResult1 == 1">
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
评价
</div>
<div>
<p>1.您对本次维修的质量方面满意吗?</p>
<div style="display:flex;">
<div style="width: 150px;
border-radius: 5px;
height: 30px;
text-align: center;
line-height: 30px;
margin-right: 20px;
cursor:pointer;"
:style="{ background: errorForm.isOkQuality == '1' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkQuality == '1' ? '#3a62d7' : '#4f4f4f' }"
@click="clickQualityYes">满意</div>
<div style="width: 150px;
border-radius: 5px;
height: 30px;
background: rgb(239, 239, 239);
text-align: center;
line-height: 30px;
margin-right: 20px;cursor:pointer;"
:style="{ background: errorForm.isOkQuality == '0' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkQuality == '0' ? '#3a62d7' : '#4f4f4f' }"
@click="clickQualityNo">不满意</div>
</div>
</div>
<div>
<p>2.您对本次维修的安全方面满意吗?</p>
<div style="display:flex;">
<div style="width: 150px;
border-radius: 5px;
height: 30px;
background: rgb(239, 239, 239);
text-align: center;
line-height: 30px;
margin-right: 20px;cursor:pointer;"
:style="{ background: errorForm.isOkSecure == '1' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkSecure == '1' ? '#3a62d7' : '#4f4f4f' }"
@click="clickSafeYes">满意</div>
<div style="width: 150px;
border-radius: 5px;
height: 30px;
background: rgb(239, 239, 239);
text-align: center;
line-height: 30px;
margin-right: 20px;cursor:pointer;"
:style="{ background: errorForm.isOkSecure == '0' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkSecure == '0' ? '#3a62d7' : '#4f4f4f' }"
@click="clickSafeNo">不满意</div>
</div>
</div>
<div>
<p>3.您对本次维修的时效方面满意吗?</p>
<div style="display:flex;margin-bottom:30px;">
<div style="width: 150px;
border-radius: 5px;
height: 30px;
background: rgb(239, 239, 239);
text-align: center;
line-height: 30px;
margin-right: 20px;cursor:pointer;"
:style="{ background: errorForm.isOkValidity == '1' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkValidity == '1' ? '#3a62d7' : '#4f4f4f' }"
@click="clickTimeYes">满意</div>
<div style="width: 150px;
border-radius: 5px;
height: 30px;
background: rgb(239, 239, 239);
text-align: center;
line-height: 30px;
margin-right: 20px;cursor:pointer;"
:style="{ background: errorForm.isOkValidity == '0' ? '#3a62d733' : 'rgb(239, 239, 239)', color: errorForm.isOkValidity == '0' ? '#3a62d7' : '#4f4f4f' }"
@click="clickTimeNo">不满意</div>
</div>
</div>
</div>
<div v-show=" (rowStatus == 5 || errorForm.repairStatus == 6||errorForm.repairStatus == 7||errorForm.repairStatus == 8||isEvalute) && errorForm.approveResult1 == 1">
<div style="
color: #101010;
font-size: 20px;
font-weight: 550;
margin-bottom: 20px;
">
签名
</div>
<div style="margin-bottom: 10px;cursor: pointer;" @click="clickAssign"
v-show="nameImg == ''&& ( errorForm.repairStatus == 5)">
<img src="@/assets/images/assign.png" alt="">
</div>
<div v-show="nameImg != ''&& ( errorForm.repairStatus == 5)" @click="clickAssign">
<img :src="nameImg" alt="">
</div>
<div v-show="errorForm.signatureUrl != '' && ( errorForm.repairStatus == 6||errorForm.repairStatus == 7||errorForm.repairStatus == 8 )">
<img :src="errorForm.signatureUrl" alt="">
</div>
</div>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">关 闭</el-button>
<!-- <el-button v-show="viewType != 'view'" @click="handleSaveError">保 存</el-button> -->
<el-button v-show="viewType != 'view'" type="primary" @click="handleConfirmError">提 交</el-button>
</span>
</el-dialog>
<el-dialog title="签名" :visible.sync="assignVisible" :append-to-body="true" width="50%"
:close-on-click-modal="false">
<div v-show="isEvalute">
<avue-sign ref="sign"></avue-sign>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeName">关闭</el-button>
<el-button @click="clearName">清空</el-button>
<el-button @click="confirmName" type="primary">确定</el-button>
</span>
</el-dialog>
<el-dialog :close-on-click-modal="false" title="物料配置" :visible.sync="materialVisible" :append-to-body="true"
width="70%" :key="Math.random()">
<el-table :data="materialData" border style="width: 98%">
<el-table-column width="50" align="center" v-if="viewType == 'submit'">
<template slot="header" slot-scope="scope">
<div @click="addColumn()"
style="width:30px;height: 30px;background: #409eff;border-radius: 50%;cursor: pointer;display: flex;align-items: center;justify-content: center;">
<i style="color:#fff;font-size: 20px;" class="el-icon-plus"></i>
</div>
</template>
<template slot-scope="scope">
<div @click="deleteColumn(scope.row, scope.$index)"
style="width:30px;height: 30px;background: #f56c6c;border-radius: 50%;cursor: pointer;display: flex;align-items: center;justify-content: center;">
<i style="color:#fff;font-size: 20px;" class="el-icon-delete"></i>
</div>
</template>
</el-table-column>
<el-table-column prop="productId" align="center" label="物料名称">
<template slot-scope="scope">
<el-select @change="((val) => { changeProduct(val, scope.$index) })"
@blur="((val) => { changeProduct(val, scope.$index) })" v-loadmore="loadmoreProduct"
v-model="scope.row.productId" filterable remote :remote-method="remoteMethodProduct" placeholder="请选择物品"
:disabled="viewType != 'submit'">
<el-option v-for="item in productLists" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="warehouseId" label="库存ID" align="center">
<!-- <template slot-scope="scope">
<el-input @change="clickInventoryId" placeholder="请输入库存ID" v-model="scope.row.inventoryId"></el-input>
</template> -->
</el-table-column>
<el-table-column prop="rule" align="center" label="规格" width="80">
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.rule" placeholder="请输入规格" style="width:98%;"></el-input>
</template> -->
</el-table-column>
<el-table-column prop="xh" align="center" label="型号" width="80">
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.model" placeholder="请输入型号" style="width:98%;"></el-input>
</template> -->
</el-table-column>
<el-table-column prop="number" align="center" label="数量">
<template slot-scope="scope">
<el-input-number style="width: 100%;" @change="((val) => { changeNumber(val, scope.row) })"
v-model="scope.row.number" placeholder="请输入数量" :min="1"
:disabled="viewType != 'submit'"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="unit" align="center" label="单位" width="80">
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.unit" placeholder="请输入单位" style="width:98%;"></el-input>
</template> -->
</el-table-column>
<el-table-column prop="price" align="center" label="价格" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.price" disabled placeholder="请输入价格" style="width:98%;">
<template slot="append">元</template>
</el-input>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="materialVisible = false">取 消</el-button>
<el-button @click="handleCloneSub" type="primary">确 定</el-button>
</span>
</el-dialog>
<div id="pdfDom" style="padding: 20px;">
<!-- <routing-inspection :detailForm="routingForm" detailType="repair"></routing-inspection> -->
</div>
</basic-container>
</template>
<script>
import website from '@/config/website';
import { getToken, removeToken, removeRefreshToken } from '@/util/auth';
import statusData from "@/assets/json/status.json"; // 引入状态数据
import { getRepairPage, solutionSave, solutionSubmit, supervisorConfirm, supervisorRefuse, customerConfirm, customerRefuse, servicemanSubmit, repairServiceConfirm, customerConfirmFinish, customerRefuseFinish, repairConfirmConfirm } from '@/api/labManagement/repair'
import { addFile } from '@/api/operation/hand'
import { getRepairDetail } from '@/api/labManagement/task'
import { mapGetters } from "vuex";
import routingInspection from '@/views/components/routingInspection.vue'
import { getGoodsList } from '@/api/goodsManagement/goods'
import { exportBlob1, zipDownload } from "@/api/common";
import { downloadXls } from "@/util/util";
import moment from "moment";
export default {
components: {
routingInspection
},
data() {
return {
isClear: false,
materialVisible: false,
assignVisible: false,
routingForm: {},
htmlTitle: '巡检维修报告',
option: {
selection: true,
height: "auto",
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
dialogType: "dialog",
dialogClickModal: false,
addBtn: false,
viewBtn: false,
editBtn: false,
delBtn: false,
searchShowBtn: false,
refreshBtn: false,
columnBtn: false,
menuWidth: 300,
searchShowBtn: false,   // 栏目折叠显隐
refreshBtn: false,      // 刷新
columnBtn: false,       // 操作列显隐
gridBtn: false,
excelBtn: false,       // 导出Excel
printBtn: false,       // 表格打印导出
filterBtn: false,      // 筛选
column: [
{
label: "任务单号",
labelWidth: 120,
prop: "taskCode",
overHidden: true,
},
{
label: "单位名称",
labelWidth: 120,
prop: "deptName",
search: true,
overHidden: true,
},
{
label: "巡检说明",
labelWidth: 120,
prop: "taskContent",
overHidden: true,
},
{
label: "巡检完成时间",
labelWidth: 120,
prop: "finishTime",
overHidden: true,
},
// {
// label: "项目地址",
// labelWidth: 120,
// prop: "projectAddr",
// overHidden: true,
// },
// {
// label: "巡检楼层",
// labelWidth: 120,
// prop: "inspectionFloor",
// overHidden: true,
// },
{
label: "状态",
labelWidth: 120,
prop: "repairStatus",
slot: true,
},
],
},
data: [],
errorForm: {
tableData: [
{ id: '001', floorName: "一层", deptName: '101', deviceName: "设备一", checkContent: '', status: '1', price: '' },
{ id: '002', floorName: "一层", deptName: '101', deviceName: "设备二", checkContent: '', status: '1', price: '' },
{ id: '003', floorName: "一层", deptName: '101', deviceName: "设备三", checkContent: '', status: '1', price: '' },
{ id: '004', floorName: "一层", deptName: '101', deviceName: "设备四", checkContent: '', status: '1', price: '' },
]
},
dialogerror: false,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
selectedList: [],
viewType: '',
isEvalute: false,
rowStatus: '',
nameImg: '',
spanArr: [],
pos: '',
spanArr1: [],
pos1: '',
materialData: [],
materialId: '',
productCurrent: 1,
productSize: 100,
productTotals: 0,
productLists: [],
totalPrice: null,//物料金额总计
dataTypes: '',//数据
headers: {},
completeImgList: [],//维修完成上传图片
}
},
computed: {
...mapGetters(["userInfo", "permission"]),
getStatus() {
return (type, id, status) => {
for (let i in statusData[type]) {
let val
statusData[type][id].map(item => {
if (item.status == status) {
val = item
}
})
return val ? val : ''
}
}
},
},
mounted() {
this.dataTypes = this.userInfo.dataType
this.headers = {
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest'
}
},
methods: {
tableRowClassName({ row, rowIndex }) {
if (row.isRepair == 0 && this.dataTypes == 1) { // 假设你想要特殊颜色的行是第二行
return 'highlight-row';
}
return '';
},
// 物料总价
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => {
let price = null
if (item.detailGoodsList.length > 0) {
price = item.detailGoodsList.reduce((sum, items) => sum + items.price, 0)
return price
}
});
if (!values.every(value => isNaN(value))) {
sums[columns.length - 1] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[columns.length - 1] = sums[columns.length - 1] > 0 ? sums[columns.length - 1].toFixed(2) : 0
this.totalPrice = sums[columns.length - 1]
sums[columns.length - 1] += ' 元';
}
});
return sums;
},
closeName() {
if (this.nameImg == '') {
this.$refs.sign.clear()
}
this.assignVisible = false
},
clearName() {
this.$refs.sign.clear()
this.nameImg = ''
this.isClear = true
},
confirmName() {
if (this.isClear) {
this.nameImg = ''
} else {
this.nameImg = this.$refs.sign.submit(80, 50);
}
this.assignVisible = false
},
// 点击签名
clickAssign() {
this.assignVisible = true
},
setMaterial(row) {
this.materialId = row.id
this.getProductLists()
this.materialData = row.detailGoodsList
this.materialVisible = true
},
addColumn() {
let arr = JSON.parse(JSON.stringify(this.materialData))
arr.push({ materialId: this.materialId, warehouseId: '', productId: '', goodsName: '', rule: '', xh: '', number: '', unit: '', price: '', productList: [] })
this.materialData = arr
},
handleCloneSub() {
let data = []
this.materialData.forEach(item => {
data.push({
warehouseId: item.warehouseId,//物资id
goodsName: item.goodsName, //物资名称
unit: item.unit,//单位
xh: item.xh,//型号
rule: item.rule,//规格
price: item.price,
number: item.number,//领用数量
productId: item.productId,//物料id
})
})
// 确定之后给每一条数据加上物料列表
this.errorForm.tableData.forEach(item => {
if (item.id == this.materialId) {
item.detailGoodsList = []
item.detailGoodsList = data
}
})
this.materialVisible = false
},
changeProduct(value, index) {
let newArr = this.productLists.find(item => item.id == value)
if (typeof value == 'string') {
if (newArr.length <= 0) {
return false
}
newArr.unifiedQuotation = newArr.unifiedQuotation == -1 ? 0 : newArr.unifiedQuotation
this.materialData[index].price = newArr.unifiedQuotation * 1
// this.materialData[index].productId = newArr.productId
this.materialData[index].number = 1
this.materialData[index].rule = newArr.rule
this.materialData[index].xh = newArr.xh
this.materialData[index].unit = newArr.unit
this.materialData[index].goodsName = newArr.name
this.materialData[index].unifiedQuotation = newArr.unifiedQuotation
this.materialData[index].warehouseId = newArr.inventoryId
} else if (typeof value == 'object' && value.target.value != '') {
this.productLists.find(item => item.id == value).unifiedQuotation = this.productLists.find(item => item.id == value).unifiedQuotation == -1 ? 0 : this.productLists.find(item => item.id == value).unifiedQuotation
this.materialData[index].price = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).unifiedQuotation * 1 : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].number = 1
this.materialData.filter(item => item.materialId == this.materialId)[index].rule = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).rule : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].xh = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).xh : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].unit = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).unit : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].goodsName = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).name : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].unifiedQuotation = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).unifiedQuotation : ''
this.materialData.filter(item => item.materialId == this.materialId)[index].warehouseId = this.productLists.find(item => item.id == value.target.value) ? this.productLists.find(item => item.id == value.target.value).inventoryId : ''
}
},
changeNumber(val, row) {
// row.price = row.price * val
// row.price = row.unifiedQuotation * val
if (row.unifiedQuotation) {
row.price = (row.unifiedQuotation * val).toFixed(2)
} else {
}
},
loadmoreProduct() {
if (this.productCurrent * this.productSize >= this.productTotals) return
this.productCurrent++
this.getProductLists('more')
},
getProductLists(type, val, inventoryId) {
getGoodsList({ current: this.productCurrent, size: this.productSize, name: val ? val : null }).then(res => {
if (type == 'more') {
this.productLists = this.productLists.concat(res.data.data.records)
this.productTotals = res.data.data.total
} else {
this.productLists = res.data.data.records
this.productTotals = res.data.data.total
}
})
},
getSpanArr(data) {
for (var i = 0; i < data.length; i++) {
if (i === 0) {
this.spanArr.push(1);
this.pos = 0
} else {
// 判断当前元素与上一个元素是否相同
if (data[i].floorName === data[i - 1].floorName) {
this.spanArr[this.pos] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.pos = i;
}
}
}
},
errorSpanMethod({ row, column, rowIndex, columnIndex }) {
// if (columnIndex === 0 && row.floorName != '') {
// if (this.spanArr.length != 0) {
// const _row = this.spanArr[rowIndex];
// const _col = _row > 0 ? 1 : 0;
// return {
// rowspan: _row,
// colspan: _col
// }
// }
// }
},
handleExport(row) {
let query = JSON.parse(JSON.stringify(row))
exportBlob1(`/api/lab-ops/maintenance/repair-output-service`, query).then(res => {
downloadXls(res.data, "巡检维修报告.xlsx");
})
},
beforeOpen(done, type) {
done();
},
beforeClose(done) {
done();
},
searchReset(params, done) {
// params.releaseTimeRange = dateFormat(new Date(), 'yyyy-MM-dd');
this.query = params;
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectedList = list
},
// 点击确认按钮
handleAdd() {
if (this.selectedList.length != 1) {
this.$message.warning('只能选择一条数据')
} else {
if (this.selectedList[0].status == 1) {
this.$message.warning('请选择状态为待确认的数据')
} else {
this.errorForm = this.selectedList[0]
this.dialogerror = true
}
}
},
// 点击查看按钮
handleView(row) {
this.viewType = 'view'
getRepairDetail({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.errorForm = res.data.data
this.dialogerror = true
let data = this.checkDeepData(res.data.data.details)
if (this.errorForm.repairStatus > 1) {
data.forEach(item => {
if (item.detailGoodsList.length > 0) {
item.isNeed = '1'
} else {
item.isNeed = '0'
}
})
}
this.errorForm.tableData = []
this.errorForm.tableData = data
this.errorForm.tableData.map(item => {
item.price = item.price == -1 ? '' : item.price
})
// completeImgList
this.completeImgList = JSON.parse(this.errorForm.completeImgList)
this.errorForm.approveResult1 = this.errorForm.approveResult
this.nameImg = ''
this.getSpanArr(this.errorForm.tableData)
}
})
// this.errorForm = row
// this.dialogerror = true
},
// 点击行内的评价并签字按钮
handleEvaluate(row) {
getRepairDetail({ id: row.id }).then(res => {
this.rowStatus = res.data.data.repairStatus
this.viewType = 'evaluate'
this.errorForm = res.data.data
this.dialogerror = true
this.isEvalute = true
this.errorForm.isOkValidity = ''
this.errorForm.isOkQuality = ''
this.errorForm.isOkSecure = ''
let data = this.checkDeepData(res.data.data.details)
this.completeImgList = this.errorForm.completeImgList==''?[]:JSON.parse(this.errorForm.completeImgList)
if (this.errorForm.repairStatus > 1) {
data.forEach(item => {
if (item.detailGoodsList.length > 0) {
item.isNeed = '1'
} else {
item.isNeed = '0'
}
})
}
this.errorForm.tableData = data
})
},
// 客户选择是否维修完成
changeResult(val) {
this.isFinish = val
},
clickQualityYes() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkQuality = 1
}
},
clickQualityNo() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkQuality = 0
}
},
clickSafeYes() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkSecure = 1
}
},
clickSafeNo() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkSecure = 0
}
},
clickTimeYes() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkValidity = 1
}
},
clickTimeNo() {
if (this.viewType == 'evaluate') {
this.errorForm.isOkValidity = 0
}
},
clearName() {
this.$refs.sign.clear()
this.nameImg = ''
},
// confirmName() {
// this.nameImg = this.$refs.sign.submit(80, 50);
// },
//维修人员提交方案
handleSubmit(row) {
this.viewType = 'submit'
getRepairDetail({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.errorForm = res.data.data
this.dialogerror = true
let data = this.checkDeepData(res.data.data.details)
this.errorForm.tableData = data
this.errorForm.tableData.map(item => {
item.price = item.price == -1 ? '' : item.price
})
}
})
},
// 主管审批
handleCheck(row) {
this.viewType = 'check'
getRepairDetail({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.errorForm = res.data.data
this.dialogerror = true
let data = this.checkDeepData(res.data.data.details)
if (this.errorForm.repairStatus > 1) {
data.forEach(item => {
if (item.detailGoodsList.length > 0) {
item.isNeed = '1'
} else {
item.isNeed = '0'
}
})
}
this.errorForm.tableData = data
this.errorForm.approveResult = ''
this.errorForm.approveRemark = ''
}
})
},
// 客户确认
handleAccept(row) {
this.viewType = 'confirm'
getRepairDetail({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.errorForm = res.data.data
this.dialogerror = true
let data = this.checkDeepData(res.data.data.details)
this.errorForm.tableData = data
this.errorForm.tableData.map(item => {
item.isRepair = 1
})
this.errorForm.approveResult = ''
this.errorForm.approveRemark = ''
}
})
// this.errorForm = row
// this.dialogerror = true
},
// 评价并签字提交
handleConfirm() {
if (this.errorForm.approveResult1 == 0) {//否
if(this.errorForm.approveRemark ==''){
this.$message.success('请输入原因!')
return false
}
let query = {
id: this.errorForm.id,
approveResult: this.errorForm.approveResult1,
approvePerson: this.userInfo.user_id,
approveTime: moment().format('YYYY-MM-DD HH:mm:ss'),
approveRemark: this.errorForm.approveRemark
}
customerRefuseFinish(query).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
} else {//是
if (this.nameImg != '') {
const formData = new FormData();
formData.append('file', this.base64toFile(this.nameImg));
if(this.errorForm.isOkValidity==''||this.errorForm.isOkQuality==''||this.errorForm.isOkSecure==''){
this.$message.error('请填写满意度')
return false
}
addFile(formData).then(res => {
let query = {
id: this.errorForm.id,
isOkValidity: this.errorForm.isOkValidity,
isOkQuality: this.errorForm.isOkQuality,
isOkSecure: this.errorForm.isOkSecure,
signatureUrl: res.data.data.link,
signaturePerson: this.errorForm.signaturePerson,
signatureTime: this.errorForm.signatureTime,
approveResult: this.errorForm.approveResult1,
}
customerConfirmFinish(query).then(res => {
if (res.data.code == 200) {
this.$message.success('评价成功')
this.dialogerror = false
this.onLoad()
}
})
})
} else {
this.$message.warning("请进行手写签名并点击确定按钮")
}
}
},
handleFinish(row) {
this.$confirm('请确认是否维修完成?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
servicemanSubmit({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('维修完成')
this.onLoad()
}
})
})
},
base64toFile(dataurl, filename = 'file') {
let arr = dataurl.split(',')
let mime = arr[0].match(/:(.*?);/)[1]
let suffix = mime.split('/')[1]
let bstr = atob(arr[1])
let n = bstr.length
let u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
let file = new File([u8arr], `${filename}.${suffix}`, {
type: mime
})
return file
},
// 确认付款是否完成
paymentFinish(row) {
this.$confirm('请确认付款是否完成?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
repairServiceConfirm({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('维修完成')
this.onLoad()
}
})
})
},
//用于回调的函数
checkData(data, list) {
data.forEach((item) => {
if (item.details && item.details.length > 0) {
this.checkData(item.details, list);
} else {
list.push(item);
}
});
return list;
},
//调用此函数 返回的就是最底层的数据
checkDeepData(data) {
const list = [];
return this.checkData(data, list);
},
handleClose() {
this.viewType = ''
this.dialogerror = false
},
// 巡检维修单保存按钮
handleSaveError() {
this.$refs['errorForm'].validate((valid) => {
if (valid) {
this.$confirm('请确认是否保存当前数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message.success('保存成功')
this.viewType = ''
this.dialogerror = false
})
}
})
},
// 巡检维修单确定按钮
handleConfirmError() {
this.$refs['errorForm'].validate((valid) => {
if (valid) {
if (this.viewType == 'submit') {
// if (this.errorForm.tableData.find(item => item.price === '')) {
// this.$message.error("请对异常的数据填写价格")
// } else {
let query = []
this.errorForm.tableData.map(item => {
query.push({
id: item.id, // 明细id
status: item.status, //状态,0:正常,1:异常
taskId: this.errorForm.id, // 任务ID
floorName: item.floorName, //楼层
deptId: item.deptId, //房间
majorName: item.majorName, //专业名称
checkContent: item.checkContent, //巡检内容
craft: item.craft, //工艺要求
period: item.period, //巡检周期 1:月, 2:季, 3:半年
picUrl: item.picUrl, //现场图片地址
signUrl: item.signUrl, //签字图片地址
remark: item.remark, //备注
price: item.price, //价格
// isRepair 客户确认是否维修, 0:不维修, 1维修
startTime: item.startTime, //计划开始时间
isNeed: item.isNeed,//是否需要物料 0,1
detailGoodsList: item.detailGoodsList,//物料列表
})
})
let params = {
task: {
id: this.errorForm.id,
},
detailList: query,
faultDescribe: this.errorForm.faultDescribe,//故障现象
faultCause: this.errorForm.faultCause,//故障产生原因
processingResult: this.errorForm.processingResult,//处理结果
travelExpense: this.errorForm.travelExpense,// 差旅费
inspectionConclusion: this.errorForm.inspectionConclusion,//巡检结论
totalPrice: this.totalPrice,//总价
}
solutionSave(params).then(res => {
if (res.data.code == 200) {
solutionSubmit({ id: this.errorForm.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
}
})
// }
} else if (this.viewType == 'check') {
if (this.errorForm.approveResult == 1) {
supervisorConfirm({ id: this.errorForm.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
} else {
let query = {
id: this.errorForm.id, //任务id
approvePerson: this.userInfo.user_id, //审核人
approveResult: this.errorForm.approveResult, //审核结果
approveRemark: this.errorForm.approveRemark //备注
}
supervisorRefuse(query).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
}
} else if (this.viewType == 'confirm') {
if (this.errorForm.approveResult == 1) {
let query = []
this.errorForm.tableData.map(item => {
query.push({
id: item.id, // 明细id
status: item.status, //状态,0:正常,1:异常
taskId: this.errorForm.id, // 任务ID
floorName: item.floorName, //楼层
deptId: item.deptId, //房间
majorName: item.majorName, //专业名称
checkContent: item.checkContent, //巡检内容
craft: item.craft, //工艺要求
period: item.period, //巡检周期 1:月, 2:季, 3:半年
picUrl: item.picUrl, //现场图片地址
signUrl: item.signUrl, //签字图片地址
remark: item.remark, //备注
price: item.price, //价格
isRepair: item.isRepair, //客户确认是否维修, 0:不维修, 1维修
startTime: item.startTime, //计划开始时间
})
})
let params = {
task: {
id: this.errorForm.id,
},
detailList: query //维修明细列表
}
customerConfirm(params).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
} else {
let query = {
id: this.errorForm.id, //任务id
approvePerson: this.userInfo.user_id, //审核人
approveResult: this.errorForm.approveResult, //审核结果
approveRemark: this.errorForm.approveRemark //备注
}
customerRefuse(query).then(res => {
if (res.data.code == 200) {
this.$message.success('提交成功')
this.dialogerror = false
this.onLoad()
}
})
}
} else if (this.viewType == 'evaluate') {
this.handleConfirm()
}
else if (this.viewType == 'repairupload') {
// 维修完成
servicemanSubmit({ id: this.errorForm.id, completeImgList: JSON.stringify(this.completeImgList) }).then(res => {
if (res.data.code == 200) {
this.$message.success('维修完成')
this.dialogerror = false
this.onLoad()
}
})
}
// this.$confirm('请确认提交保存当前数据?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.$message.success('提交成功')
// this.viewType = ''
// this.dialogerror = false
// })
}
})
},
onLoad(page, params = {}) {
getRepairPage({ current: this.page.currentPage, size: this.page.pageSize, deptName: params.deptName, taskStatus: 4 }).then(res => {
this.data = res.data.data.records
this.page.total = res.data.data.total
})
},
// 开具发票
clickInvoice() {
if (this.selectedList.length == 0) {
this.$message.warning('请至少选择一条数据')
} else {
let tmp = this.selectedList.find(item => item.repairStatus != 7)
if (tmp) {
this.$message.warning('请选择状态为待开发票的数据')
} else {
this.$confirm('请确认是否为已选择数据开具发票?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let queryData = []
this.selectedList.forEach(item => {
queryData.push({
id: item.id
})
})
repairConfirmConfirm(queryData).then(res => {
this.$message.success('发票开具成功')
this.onLoad()
})
}).catch(() => {
})
}
}
},
// 维修人员上传维修完成图片
handleRepairFinishUpload(row) {
this.viewType = 'repairupload'
getRepairDetail({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.errorForm = res.data.data
this.dialogerror = true
let data = this.checkDeepData(res.data.data.details)
if (this.errorForm.repairStatus > 1) {
data.forEach(item => {
if (item.detailGoodsList.length > 0) {
item.isNeed = '1'
} else {
item.isNeed = '0'
}
})
}
this.errorForm.tableData = data
// this.errorForm.approveResult = ''
// this.errorForm.approveRemark = ''
}
})
},
// 附件上传成功
handleSuccess(response, file, fileList) {
this.completeImgList.push(
{
url: response.data.link, //--文件url
name: response.data.originalName //--文件名称
}
)
},
// 附件删除
handleRemove(file, fileList) {
return (file, fileList) => {
this.completeImgList = []
fileList.map(item => {
this.completeImgList.push({ name: item.name, url: item.response ? item.response.data.link : item.url })
})
}
},
}
}
</script>
<style>
.highlight-row {
background-color: red !important;
/* 例如黄色背景 */
}
</style>