实验室运维app端
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.
 
 
 
 

1091 lines
48 KiB

<template>
<view class="page-css">
<view class="repair_detail">
<view class="repair_title">提报信息</view>
<!-- <iframe src="http://111.34.85.148:9008/jeewms/loginController.do?login" frameborder="0" ref="refed" width="100%" height="500px"></iframe> -->
<u-form labelPosition="left" :rules="rules" ref="repairDetailsForm" :model="repairDetails"
:label-width="200" class="repair_form">
<u-form-item label="需求单号:" prop="requirementCode" :border-bottom="false">
<u-input v-model="repairDetails.requirementCode" :border="true" placeholder="" :disabled="true"
class="sp-new-input-diabled" />
</u-form-item>
<u-form-item label="提报单位:" prop="reportUnit" :border-bottom="false">
<u-input v-model="repairDetails.reportUnit" :border="true" placeholder="" :disabled="true"
class="sp-new-input-diabled" />
</u-form-item>
<u-form-item label="故障现象描述:" prop="faultDescribe" :border-bottom="false">
<u-input v-model="repairDetails.faultDescribe" :border="true" placeholder="请输入" :disabled="disabled"
:class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
<u-form-item label="故障位置:" prop="faultLocation" :border-bottom="false">
<u-input v-model="repairDetails.faultLocation" :border="true" placeholder="请输入" :disabled="disabled"
:class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
<u-form-item label="设备名称:" prop="deviceName" :border-bottom="false">
<u-input v-model="repairDetails.deviceName" :border="true" placeholder="请输入" :disabled="disabled"
:class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
<u-form-item label="设备专业类型:" prop="faultType" :border-bottom="false">
<u-input v-model="repairDetails.faultType" :border="true" placeholder="请输入" :disabled="disabled"
:class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
</u-form>
</view>
<!-- 维修人员 接单展示-->
<view class="repair_detail"
v-if="(dataTypes == 4 || dataTypes == 2) && (detailForm.status == 201 || detailForm.status == 101 || detailForm.status == 400)">
<view class="repair_title">派单信息</view>
<u-form labelPosition="left" :rules="sendRules" ref="sendOrderForm" :model="sendOrder" :label-width="200"
class="repair_form">
<u-form-item label="维修人员:" prop="name" :border-bottom="false" :required="true">
<u-input v-if="dataTypes == 2" v-model="sendOrder.name" type="select" :border="true"
@click="sendOrdersShow = true" :disabled="disabled" />
<u-input v-if="dataTypes == 4" v-model="sendOrder.name" :border="true" placeholder=""
:disabled="disabled" :class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
<u-form-item label="计划完成时间:" prop="planCompleteTime" :border-bottom="false">
<u-input v-if="dataTypes == 2" v-model="sendOrder.planCompleteTime" type="select"
@click="calendarShow = true" :border="true" placeholder="请选择时间" :disabled="disabled" />
<u-input v-if="dataTypes == 4" v-model="sendOrder.planCompleteTime" :border="true" placeholder=""
:disabled="disabled" :class="disabled ? 'sp-new-input-diabled' : ''" />
</u-form-item>
<u-form-item label="客服意见:" prop="reportPeople" :border-bottom="false">
<u-input v-if="dataTypes == 2" v-model="sendOrder.customerOpinion" type="textarea" :border="true"
:disabled="disabled" :height="120" />
<u-input v-if="dataTypes == 4" v-model="sendOrder.customerOpinion" :border="true" placeholder=""
type="textarea" :disabled="disabled" :class="disabled ? 'sp-new-input-diabled' : ''"
:height="120" />
</u-form-item>
</u-form>
</view>
<!-- 维修人员 待提交维修方案 -->
<view class="repair_detail" v-if="dataTypes == 4 && (detailForm.status == 201 || detailForm.status == 300)">
<view class="repair_title">处理情况</view>
<u-form labelPosition="left" ref="sendOrderForm" :model="detailForm" :label-width="200" class="repair_form">
<u-form-item label="接单时间:" prop="dispatchTime" :border-bottom="false">
<u-input v-model="detailForm.dispatchTime" :border="true" placeholder="" :disabled="true"
class="sp-new-input-diabled" />
</u-form-item>
<u-form-item label="计划完成时间:" prop="planCompleteTime" :border-bottom="false">
<u-input v-model="detailForm.planCompleteTime" :border="true" placeholder="" :disabled="true"
class="sp-new-input-diabled" />
</u-form-item>
<u-form-item label="客服意见:" prop="customerOpinion" :border-bottom="false">
<u-input v-model="detailForm.customerOpinion" type="textarea" :border="true" :disabled="disabled"
:height="120" class="sp-new-input-diabled" />
</u-form-item>
</u-form>
</view>
<view class="repair_detail" v-if="detailForm.status == 400 || detailForm.status == 300 || detailForm.status == 102">
<view class="repair_title" v-if="detailForm.status == 400">维修人员驳回</view>
<view class="repair_title" v-if="detailForm.status == 300">主管驳回</view>
<view class="repair_title" v-if="detailForm.status == 102">客户驳回</view>
<u-form labelPosition="left" ref="sendOrderForm" :model="detailForm" :label-width="200" class="repair_form">
<u-form-item v-if="detailForm.status == 400" label="驳回原因:" prop="customerOpinion" :border-bottom="false">
<view>{{ detailForm.repaiRejectReason }}</view>
</u-form-item>
<u-form-item v-else label="驳回原因:" prop="customerOpinion" :border-bottom="false">
<view>{{ detailForm.approveRemark }}</view>
</u-form-item>
<!-- repaiRejectReason -->
</u-form>
</view>
<!-- 维修详情 待提交维修方案 展示 -->
<view class="repair_detail"
v-if="(dataTypes == 4 && (detailForm.status == 401||detailForm.status == 300)) || (dataTypes == 3 && (detailForm.status == 402||detailForm.status == 102)) || (dataTypes == 1 && detailForm.status == 301)">
<view class="repair_title">维修详情</view>
<u-form labelPosition="left" :rules="repairInfoRules" ref="repairInfoForm" :model="repairInfo"
:label-width="140" class="repair_form">
<u-form-item label="维修人:" prop="reportPeople" :border-bottom="false">
<u-input v-model="detailForm.repairPersonName" :border="true" placeholder="" :disabled="true"
class="sp-new-input-diabled" />
</u-form-item>
<u-form-item label="设备名称:" prop="deviceName" :border-bottom="false" :required="true">
<u-input v-model="deviceData.name" :border="true" placeholder="" :disabled="optionDisabled" :class="optionDisabled ? 'sp-new-input-diabled' : ''" type="select" @click="deviceShow = true" />
</u-form-item>
<u-form-item label="故障原因:" prop="faultReason" :border-bottom="false" :required="true">
<u-input v-model="repairInfo.faultReason" :border="true" placeholder="请输入" type="textarea"
:disabled="optionDisabled" :class="optionDisabled ? 'sp-new-input-diabled' : ''"
:height="120" />
</u-form-item>
<u-form-item label="处理方法:" prop="dealMethods" :border-bottom="false" :required="true">
<u-input v-model="repairInfo.dealMethods" :border="true" placeholder="请输入" type="textarea"
:disabled="optionDisabled" :class="optionDisabled ? 'sp-new-input-diabled' : ''"
:height="120" />
</u-form-item>
<u-form-item label="是否申领物料:" prop="isMaterial" :border-bottom="false" :label-width="200"
:required="true">
<uni-data-checkbox :disabled="optionDisabled" v-model="repairInfo.isMaterial"
:localdata="isMaterialList"></uni-data-checkbox>
</u-form-item>
<view class="selectForm clearfix" v-if="repairInfo.isMaterial == 1">
<view class="form-item form-label">物料申领:</view>
<view class="form-item form-content">
<view class="select-box clearfix">
<view class="select-box-item clearfix" v-for="(item, index) in sendOrder.materialsData"
:key="index">
<view class="material-text">名称:{{ item.name }}</view>
<view class="material-text">规格:{{ item.rule }}</view>
<view class="material-text">型号:{{ item.xh }}</view>
<view class="material-text">数量:{{ item.goodsNum }}</view>
<view class="material-text">单位:{{ item.unit }}</view>
<view class="material-text">价格:{{ ((dataTypes == 3 && detailForm.status ==
3) || (dataTypes == 1 && detailForm.status ==
4)) ? item.materialPrice : (item.purchasePrice * item.goodsNum) }}</view>
</view>
</view>
<u-button v-if="!optionDisabled" size="medium" :plain="true"
style="margin-right: 32rpx;width:100%" type="primary" @click="goodsSelect()">{{
sendOrder.materialsData.length > 0 ? '修改' : '添加' }}</u-button>
</view>
</view>
<block
v-if="(dataTypes == 3 && (detailForm.status == 402||detailForm.status == 102)) || (dataTypes == 1 && detailForm.status == 301) && repairInfo.isMaterial == 1">
<u-form-item label="总价:" prop="reportPeople" :border-bottom="false">
<view>{{ approveInfo.totalPrice }}</view>
</u-form-item>
<u-form-item label="折扣:" prop="reportPeople" :border-bottom="false">
<!-- <betone-new-input label="" v-model="approveInfo.discount" placeholder="" type="number"
@changevalue="changDiscount" />折 -->
<u-input v-model="approveInfo.discount" :border="true" placeholder="" :disabled="optionPiceDisabled"
:class="optionPiceDisabled ? 'sp-new-input-diabled' : ''" @input="changDiscount" type="number"/>折
</u-form-item>
<u-form-item label="折扣后的金额:" prop="reportPeople" :border-bottom="false" :label-width="240">
<view>{{ approveInfo.discountPrice }}</view>
</u-form-item>
</block>
</u-form>
</view>
<!-- 维修负责人 审批 -->
<view class="repair_detail" v-if="dataTypes == 3 && (detailForm.status == 402||detailForm.status == 102)">
<view class="repair_title">主管审批</view>
<u-form labelPosition="left" ref="repairInfoForm" :model="approveInfo" :label-width="140"
class="repair_form">
<u-form-item label="审批结果:" prop="reportPeople" :border-bottom="false">
<betone-input-picker :label="''" :pickerData="approveType" :mode="'selector'" :keyName="'text'"
@changeSelect="changeApproveResult" v-model="approveInfo.approveText"></betone-input-picker>
</u-form-item>
<u-form-item label="审批意见:" prop="reportPeople" :border-bottom="false">
<u-input v-model="approveInfo.approveRemark" :border="true" placeholder="请输入" type="textarea"
:height="120" />
</u-form-item>
</u-form>
</view>
<!-- 维修人员接单确认-->
<view class="repair-4-btn" style="margin-right: 32rpx;width:100%"
v-if="dataTypes == 4 && detailForm.status == 201">
<u-button size="medium" @click="endOrderCancel()">取消</u-button>
<u-button size="medium" @click="turnShow = true">驳回</u-button>
<u-button size="medium" type="primary" @click="repairOrderSubmit()">确认接单</u-button>
</view>
<!-- 客户 审批 确认维修方案 -->
<view class="repair_detail" v-if="dataTypes == 1 && detailForm.status == 301">
<view class="repair_title">客户审批</view>
<u-form labelPosition="left" ref="repairInfoForm" :model="clientInfo" :label-width="140"
class="repair_form">
<u-form-item label="审批结果:" prop="reportPeople" :border-bottom="false">
<betone-input-picker :label="''" :pickerData="approveType" :mode="'selector'" :keyName="'text'"
@changeSelect="changeClientResult" v-model="clientInfo.approveText"></betone-input-picker>
</u-form-item>
<u-form-item label="审批意见:" prop="reportPeople" :border-bottom="false">
<u-input v-model="clientInfo.approveRemark" :border="true" placeholder="请输入" type="textarea"
:height="120" />
</u-form-item>
</u-form>
</view>
<!-- 客服派单-->
<view class="repair-btn" style="margin-right: 32rpx;width:100%"
v-if="dataTypes == 2 && (detailForm.status == 101 || detailForm.status == 400)">
<u-button size="medium" @click="endOrderCancel()">取消</u-button>
<u-button size="medium" type="primary" @click="sendOrderSubmit()">确定派单</u-button>
</view>
<!-- 维修人员 提交维修方案 -->
<view class="repair-btn" style="margin-right: 32rpx;width:100%" v-if="dataTypes == 4 && (detailForm.status == 401||detailForm.status == 300)">
<u-button size="medium" @click="endOrderCancel()">取消</u-button>
<u-button size="medium" type="primary" @click="servicemanSubmit()">提交</u-button>
</view>
<!-- 维修负责人 审批 -->
<view class="repair-btn" style="margin-right: 32rpx;width:100%" v-if="dataTypes == 3 && (detailForm.status == 102||detailForm.status == 402)">
<u-button size="medium" @click="endOrderCancel()">取消</u-button>
<u-button size="medium" type="primary" @click="approveSubmit()">提交</u-button>
</view>
<!-- 客户确认维修方案 -->
<view class="repair-btn" style="margin-right: 32rpx;width:100%" v-if="dataTypes == 1 && detailForm.status == 301">
<u-button size="medium" @click="endOrderCancel()">取消</u-button>
<u-button size="medium" type="primary" @click="customerSubmit()">提交</u-button>
</view>
<!-- 选择维修人员 -->
<u-select v-model="sendOrdersShow" :list="sendOrdersList" @confirm="sendOrdersConfirm" :isShowsearch="true"
value-name="id" title="选择维修人员"></u-select>
<!-- 选择 时间 -->
<u-calendar v-model="calendarShow" mode="date" @change="calendarChange" :min-date="minDate"
:max-date="maxDate"></u-calendar>
<!-- 维修人员物料选择 -->
<betone-dialog v-model="aterialShow" height="900rpx">
<view class="search-box">
<betone-new-input v-model="goodsearchInfo.goodsName" placeholder="搜索物品名称" icon="search"
style="margin-bottom: 32rpx" @changevalue="searchGoodsData()" />
</view>
<scroll-view class="scroll-Y" @scrolltolower="goodsLower" scroll-y="true"
style="max-height: 900rpx; width: auto; background-color: gainsboro;">
<view class="material-box">
<view class="material-item" v-for="(item, index) in goodsTableData" :key="index">
<view class="title-wrapper">
<u-checkbox v-model="item.checked" shape="circle"></u-checkbox>
</view>
<view class="item-right">
<view class="material-title">
<text class="material-title-name">{{ item.name }}</text>
<text class="material-title-code">{{ item.inventoryId }}</text>
<text>库存数:{{ item.num }}</text>
</view>
<view class="material-text">品牌:{{ item.brand }}</view>
<view class="material-text">型号:{{ item.xh }}</view>
<view class="material-num">
<text>参数:{{ item.rule }}</text><u-number-box v-model="item.goodsNum"
:step="1"></u-number-box>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="material-btn">
<u-button size="medium" @click="aterialShow = false">取消</u-button>
<u-button size="medium" type="primary" @click="goodsSubmit()">确认</u-button>
</view>
</betone-dialog>
<!-- 维修人员驳回 -->
<betone-modal v-model="turnShow" :title="'驳回原因'" @confirm="turnFn" @cancel="turnShow = false">
<view class="modal-text" style="margin-bottom: 32rpx">
<u-input v-model="repaiRejectReason" :border="true" placeholder="请输入" />
</view>
</betone-modal>
<betone-modal v-model="submitOrderShow" :title="'提示'" @confirm="submitOrderShowFn"
@cancel="submitOrderShow = false">
<view class="modal-text">
请确认是否进行接单确认?
</view>
</betone-modal>
<!-- 选择设备 -->
<u-select v-model="deviceShow" :list="deviceList" @confirm="deviceConfirm" :isShowsearch="true"
value-name="id" title="选择设备"></u-select>
<betone-loading ref="BetLoading" />
</view>
</template>
<script>
import { dateFormat } from '@/utils/util.js'
export default {
computed: {
dataTypes() {
return this.$store.state.dataType
},
disabled() {
return this.$store.state.dataType == 2 ? false : true
},
optionDisabled() {
return (this.$store.state.dataType == 3 && (this.detailForm.status == 402||this.detailForm.status == 102)) || (this.$store.state.dataType == 1 && this.detailForm.status == 301) ? true : false
},
optionPiceDisabled(){
return (this.$store.state.dataType == 3 && (this.detailForm.status == 402||this.detailForm.status == 102)) ? false : true
}
},
data() {
return {
minDate: null,
maxDate: null,
userInfo: {},//用户信息
orderId: '',//需求提报id
detailForm: {},//详情信息
rules: {},
repairDetails: {
requirementCode: '',//需求单号
reportUnit: '',//提报单位
faultDescribe: '',//故障现象描述
faultLocation: '',//故障位置
deviceName: '',//设备名称
faultType: '',//故障专业类型
},
sendOrder: {
repairPerson: '',//维修人员 id
name: '',//维修人员名字
planCompleteTime: '',//计划完成时间
customerOpinion: '',//客服意见
isNeedMaterials: null,//是否申领物料
materialsData: [],//物料列表
remark: '',//备注
},
sendRules: {
name: {
type: "string",
required: true,
message: "请选择维修人员",
trigger: ["blur", "change"],
}
},
sendOrdersShow: false,//派单弹框
sendOrdersList: [],
calendarShow: false,//时间选择框
isMaterialList: [
{
text: '是',
value: 1
},
{
text: '否',
value: 2
}
],
aterialShow: false,//物料选择弹框
goodsearchInfo: {
goodsName: '',
},
goodsTableData: [],
goodspage: {
current: 1,
size: 10,
},
isGoodsNomore: false,
turnShow: false,//驳回弹框
repaiRejectReason: '',//驳回弹框
repairInfo: {//维修人员 维修方案提交
reportPeople: '',//填报人
deviceName: '',//设备名称
faultReason: '',//故障原因
dealMethods: '',//处理方法
isMaterial: null,//是否申领物料
materialTable: [],//物料数据
},
repairInfoRules: {
faultReason: [
{
type: "string",
required: true,
message: "请输入",
trigger: ["blur", "change"],
}
],
dealMethods: [
{
type: "string",
required: true,
message: "请输入",
trigger: ["blur", "change"],
}
],
},
approveInfo: {//维修负责人审批
discount: null,//折扣
discountPrice: null,//折扣后的价格
totalPrice: null,//总价
approvePerson: '',//审批人 id
approveRemark: '',//审批备注
approveResult: null,//1通过 0驳回
approveText: '',//展示内容
approveTime: '',//当前时间
},
approveType: [
{
text: '通过',
value: 1
},
{
text: '驳回',
value: 0
},
],
clientInfo: {
approvePerson: '',//审批人 id
approveRemark: '',//审批备注
approveResult: null,//1通过 0驳回
approveText: '',//展示内容
approveTime: '',//当前时间
},
submitOrderShow: false,//维修人员接单确认
deviceShow:false,//选择设备
deviceData:{
repairPerson: '',//维修人员 id
name: '',//维修人员名字
},
deviceList:[],//设备列表
}
},
onReady() {
},
onShow() {
this.getRepairPersons()//获取维修人员列表
this.getDeviceList()
this.orderId = this.$route.query.id
this.getDtails()
this.userInfo = uni.getStorageSync("userinfo");
// 维修人员 获取物料选择
if (this.dataTypes == 4) {
this.getGoodsList()
}
this.initDate()
},
methods: {
getDtails() {
this.$u.api.getBreakdownInfo({ id: this.orderId }).then(res => {
if (res.code == 200) {
this.detailForm = res.data
this.repairDetails.requirementCode = this.detailForm.requirementCode
this.repairDetails.reportUnit = this.detailForm.reportUnit
this.repairDetails.faultDescribe = this.detailForm.faultDescribe
this.repairDetails.faultLocation = this.detailForm.faultLocation
this.repairDetails.deviceName = this.detailForm.deviceName
this.repairDetails.faultType = this.detailForm.faultType
this.sendOrder.name = this.detailForm.repairPersonName
this.sendOrder.repairPerson = this.detailForm.repairPerson
this.sendOrder.planCompleteTime = this.detailForm.planCompleteTime.split(' ')[0]
this.sendOrder.customerOpinion = this.detailForm.customerOpinion
this.sendOrder.remark = this.detailForm.remark
// 维修主管审批 填充字段
this.repairInfo.faultReason = this.detailForm.faultCause
this.repairInfo.dealMethods = this.detailForm.processMethod
this.repairInfo.isMaterial = this.detailForm.isNeedMaterial
this.sendOrder.materialsData = this.detailForm.materials
let data = 0
if (this.detailForm.materials.length > 0) {
this.detailForm.materials.forEach(item => {
data = data + item.materialPrice
item.goodsNum = item.materialCount
item.name = item.materialName
})
}
this.approveInfo.discount =
// 获取审批总价
this.approveInfo.totalPrice = data
this.approveInfo.discount = this.detailForm.discount<0?null:this.detailForm.discount
this.approveInfo.discountPrice = this.detailForm.discountPrice<0?null:this.detailForm.discountPrice
// 设备名称
if(this.detailForm.status != 201){
this.deviceData.repairPerson = this.detailForm.deviceId
this.deviceData.name = this.detailForm.deviceName
}
}
})
},
// 维修人员
getRepairPersons() {
this.$u.api.getRepairPersons().then(res => {
if (res.code == 200) {
let data_ = res.data
data_.forEach(i => {
this.sendOrdersList.push({ ...i, label: i.name })
})
}
})
},
// 选择维修人员
sendOrdersConfirm(e) {
// 获取维修人员
this.sendOrder.name = e[0].label
this.sendOrder.repairPerson = e[0].value
},
calendarChange(e) {
this.sendOrder.planCompleteTime = e.result
},
endOrderCancel() {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
},
// 客服接单 确认 先调用修改工单的接口 再调客服派单的接口
sendOrderSubmit() {
this.$refs.sendOrderForm.setRules(this.sendRules);
this.$refs.sendOrderForm.validate(valid => {
if (valid) {
let updayeQuery = {
id: this.orderId,
reportUnit: this.repairDetails.reportUnit,
faultDescribe: this.repairDetails.faultDescribe,
faultLocation: this.repairDetails.faultLocation,
faultType: this.repairDetails.faultType,
deviceName: this.repairDetails.deviceName,
dispatchTime: dateFormat("yyyy-MM-dd hh:mm:ss", new Date()),
remark: this.repairDetails.remark,
}
let sendOrderQuery_ = {
id: this.orderId,
repairPerson: this.sendOrder.repairPerson,
planCompleteTime: this.sendOrder.planCompleteTime ? this.sendOrder.planCompleteTime + ' 00:00:00' : '',
remark: this.repairDetails.remark,
customerOpinion: this.sendOrder.customerOpinion
}
this.$u.api.workOrderupdate(updayeQuery).then(res => {
// this.BetLoading.hide();
if (res.code == 200) {
this.$u.api.serviceman(sendOrderQuery_).then(res => {
if (res.code == 200) {
uni.showToast({ title: "派单成功", icon: "none" });
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}
})
}
}).catch(err => {
// this.BetLoading.hide();
})
} else {
console.log('验证失败');
}
});
},
// 物料搜索
searchGoodsData() {
// selectGoodsList
},
// 弹框滑到底部加载数据
goodsLower() {
if (this.isGoodsNomore) {
return;
}
this.goodspage.current++;
this.getGoodsList();
},
// 获取物料列表
getGoodsList() {
let query_ = {
...this.goodspage
}
this.$u.api.getGoodsList(query_).then(res => {
if (res.code == 200) {
var totalPage = res.data.total;
var newOrders = res.data.records;
newOrders.forEach(element => {
// element.rule = element.rule == '' ? 0 : Number(element.rule)
this.$set(element, 'goodsNum', 0)
this.$set(element, 'checked', false)
});
this.goodsTableData = [...this.goodsTableData, ...(res.data.records || [])];
if (newOrders.length == 0) {
// this.loadingState = "nomore";
this.isGoodsNomore = true;
}
if (totalPage == this.goodsTableData.length) {
// this.loadingState = "nomore";
this.isGoodsNomore = true;
}
}
})
},
// 物料选择确定
goodsSubmit() {
let selected = this.goodsTableData.filter(i => {
return i.checked
})
if (selected.find(item => item.goodsNum == 0)) {
uni.showToast({ title: "申领数量不能为0", icon: "none" });
return false
}
this.sendOrder.materialsData = JSON.parse(JSON.stringify(selected))
this.aterialShow = false
},
goodsSelect() {
this.aterialShow = true
// 判断之前是否有选中的
// 默认给列表全部赋值非选中状态
// 如果有则对比数组 加载选中状态 this.goodsTableData
this.goodsTableData.forEach(i => {
i.checked = false
})
if (this.sendOrder.materialsData.length > 0) {
this.goodsTableData.forEach(i => {
this.sendOrder.materialsData.forEach(v => {
if (i.id == v.id) {
i.checked = true
}
})
})
}
},
// 维修人员驳回
turnFn() {
if (this.repaiRejectReason == '') {
uni.showToast({ title: "请输入驳回原因", icon: "none" });
return false
}
let query = {
id: this.orderId,
repaiRejectReason: this.repaiRejectReason,
status: 7
}
this.$u.api.repairReject(query).then(res => {
if (res.code == 200) {
this.turnShow = false
uni.showToast({ title: "驳回成功", icon: "none" });
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}
})
},
// 维修人员提交方案
servicemanSubmit() {
this.$refs.repairInfoForm.setRules(this.repairInfoRules);
// 选择物料列表
// this.repairInfoForm
this.$refs.repairInfoForm.validate(valid => {
if (valid) {
if (this.repairInfo.isMaterial == null) {
uni.showToast({ title: "是否申领物料", icon: "none" });
return false
}
if (this.repairInfo.isMaterial == 1 && this.sendOrder.materialsData.length <= 0) {
uni.showToast({ title: "请选择需要申领的物料信息", icon: "none" });
return false
}
// 申领物料 数量的判断
if (this.sendOrder.materialsData.find(item => item.goodsNum == 0)) {
uni.showToast({ title: "申领数量不能为0", icon: "none" });
return false
}
if(this.deviceData.name==''){
uni.showToast({ title: "请选择设备", icon: "none" });
return false
}
let data = []
if (this.repairInfo.isMaterial == 1) {
this.sendOrder.materialsData.map(item => {
data.push({
inventoryId: item.inventoryId,//物资id
materialName: item.name, //物资名称
brand: item.brand,//品牌
xh: item.xh,//型号
rule: item.rule,//参数
materialPrice: item.goodsNum * item.unifiedQuotation,
materialCount: item.goodsNum,//领用数量
orderId: this.detailForm.id,
})
})
}
let query = {
id: this.detailForm.id,
faultCause: this.repairInfo.faultReason,
processMethod: this.repairInfo.dealMethods,
isNeedMaterial: this.repairInfo.isMaterial,
materials: data,
}
this.$u.api.workOrderupdate(query).then(res => {
if (res.code == 200) {
let query1 = {
id: this.detailForm.id,
deviceId:this.deviceData.repairPerson,
deviceName:this.deviceData.name
}
this.$u.api.servicemanSubmit(query1).then(res => {
if (res.code == 200) {
uni.showToast({ title: "提交成功", icon: "none" });
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
}
})
}
})
},
// 维修负责人审批 输入折扣
changDiscount(e) {
this.approveInfo.discountPrice = ((e / 10) * this.approveInfo.totalPrice).toFixed(2)
},
changeApproveResult(e) {
this.approveInfo.approveText = this.approveType[e].text
this.approveInfo.approveResult = this.approveType[e].value
},
// 维修负责人审批 先更新工单信息 再调用维修负责人审批按钮
approveSubmit() {
// 需要更新的工单信息
let query_ = {
discount: this.approveInfo.discount,
discountPrice: this.approveInfo.discountPrice,
id: this.detailForm.id,
totalPrice: this.approveInfo.totalPrice,
}
// 维修负责人审批
let query1 = {
id: this.detailForm.id,
approvePerson: this.userInfo.user_id,//审批人 id
approveRemark: this.approveInfo.approveRemark,//审批备注
approveResult: this.approveInfo.approveResult,//1通过 0驳回
approveTime: dateFormat("yyyy-MM-dd hh:mm:ss", new Date()),//当前时间
}
if (!this.approveInfo.discount && this.repairInfo.isMaterial == 1) {
uni.showToast({ title: "请填写折扣信息", icon: "none" });
return false
}
if (this.approveInfo.approveResult == null) {
uni.showToast({ title: "请选择审批结果", icon: "none" });
return false
}
if (!this.approveInfo.approveRemark) {
uni.showToast({ title: "请选择审批意见", icon: "none" });
return false
}
this.$u.api.workOrderupdate(query_).then(res => {
if (res.code == 200) {
if (this.approveInfo.approveResult == 1) {
this.$u.api.supervisorconfirm(query1).then(res => {
if (res.code == 200) {
uni.showToast({ title: "审核成功", icon: "none" });
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
} else {
this.$u.api.supervisorReject(query1).then(res => {
if (res.code == 200) {
uni.showToast({ title: "驳回成功", icon: "none" });
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
}
}
})
},
// 客户确认维修方案 类别
changeClientResult(e) {
this.clientInfo.approveText = this.approveType[e].text
this.clientInfo.approveResult = this.approveType[e].value
},
// 客户审核 提交
customerSubmit() {
if (this.clientInfo.approveResult == null) {
uni.showToast({ title: "请选择审批结果", icon: "none" });
return false
}
if (!this.clientInfo.approveRemark) {
uni.showToast({ title: "请选择审批意见", icon: "none" });
return false
}
// 客户审批
let query1 = {
id: this.detailForm.id,
approvePerson: this.userInfo.user_id,//审批人 id
approveRemark: this.clientInfo.approveRemark,//审批备注
approveResult: this.clientInfo.approveResult,//1通过 0驳回
approveTime: dateFormat("yyyy-MM-dd hh:mm:ss", new Date()),//当前时间
}
if (this.clientInfo.approveResult == 1) {//通过
this.$u.api.customerConfirm(query1).then(res => {
if (res.code == 200) {
uni.showToast({ title: "确认成功", icon: "none" });
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
} else {//驳回
this.$u.api.customerReject(query1).then(res => {
if (res.code == 200) {
uni.showToast({ title: "驳回成功", icon: "none" });
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
}
},
// 设置最大可选择时间
initDate() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
let minyear = year;
this.minDate = minyear + "-" + month + "-" + day;
//let maxyear = year + 1;
this.maxDate = year + 1 + "-" + month + "-" + day; // 最大日期可选到一年后
//this.maxDate = year  + '-'+ month +'-' + day; // 最大日期可选到今天
},
// 维修人员确认接单
submitOrderShowFn() {
let query_ = {
id: this.detailForm.id
}
this.$u.api.servicemanReceive(query_).then(res => {
if (res.code == 200) {
uni.showToast({ title: "确认成功", icon: "none" });
// this.getRecordsList()
setTimeout(() => {
uni.navigateBack({
delta: 1 // 默认值是1,表示回退一个页面
})
}, 500)
}
})
},
repairOrderSubmit() {
this.submitOrderShow = true
},
// 设备列表
getDeviceList() {
let query={
current:1,
size:9999,
}
this.$u.api.getDeviceList(query).then(res => {
if (res.code == 200) {
let data_ = res.data.records
data_.forEach(i => {
this.deviceList.push({ ...i, label: i.name })
})
}
})
},
// 选择设备
deviceConfirm(e){
this.deviceData.name = e[0].label
this.deviceData.repairPerson = e[0].value
}
}
}
</script>
<style lang="scss" scoped>
.page-css {
padding: 0;
height: 100%;
overflow: auto;
.repair_detail {
margin: 32rpx 24rpx 20rpx;
border-radius: 20rpx;
background-color: rgba(255, 255, 255, 1);
padding: 6rpx 0 34rpx;
.repair_title {
line-height: 60rpx;
color: rgba(0, 0, 0, 1);
font-size: 32rpx;
text-align: left;
font-family: SourceHanSansSC-bold;
margin: 18rpx 0 0rpx 20rpx;
font-weight: bold;
}
.repair_form {
padding: 0 18rpx;
}
}
.repair-btn {
width: 100%;
display: flex;
justify-content: space-around;
/* 水平均匀分布 */
margin-top: 32rpx;
padding: 0 32rpx;
margin-bottom: 32rpx;
/deep/.u-btn {
width: 47%;
}
}
.repair-4-btn {
width: 100%;
display: flex;
justify-content: space-around;
/* 水平均匀分布 */
margin-top: 32rpx;
padding: 0 32rpx;
margin-bottom: 32rpx;
/deep/.u-btn {
width: 32%;
}
}
.selectForm {
width: 100%;
padding: 26rpx;
line-height: 60rpx;
display: flex;
flex-direction: row;
.form-item {
float: left;
width: calc(100% - 26rpx - 26rpx - 200rpx);
.material-text {
width: 50%;
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.form-content {
flex: 1;
}
.form-label {
width: 200rpx;
text-align: center;
}
}
.material-box {
flex: 1;
background: #fff;
margin: 0;
overflow: auto;
// padding-bottom: 32rpx;
.material-item {
height: 300rpx;
border-radius: 20rpx;
background-color: rgba(249, 249, 249, 1);
margin: 32rpx 0 0;
padding: 32rpx;
display: flex;
flex-direction: row;
.title-wrapper {}
.item-right {
flex: 1;
.material-title {
display: flex;
flex-direction: row;
color: rgba(108, 108, 108, 1);
font-size: 28rpx;
line-height: 60rpx;
.material-title-name {
color: rgba(51, 51, 51, 1);
font-size: 36rpx;
font-weight: 550;
padding-right: 16rpx;
}
.material-title-code {
flex: 1;
}
}
.material-text {
line-height: 60rpx;
color: rgba(108, 108, 108, 1);
font-size: 28rpx;
}
.material-num {
display: flex;
flex-direction: row;
justify-content: space-between;
}
}
}
}
.material-btn {
width: 100%;
display: flex;
justify-content: space-between;
/* 水平均匀分布 */
margin-top: 32rpx;
padding: 0 32rpx;
/deep/.u-btn {
width: 48%;
}
}
.select-box {
width: 100%;
.select-box-item {
width: 100%;
border-radius: 20rpx;
background-color: rgba(249, 249, 249, 1);
margin-bottom: 32rpx;
line-height: 60rpx;
color: rgba(108, 108, 108, 1);
font-size: 28rpx;
padding: 24rpx;
}
}
/deep/.arrow {
top: 12rpx;
}
}
</style>