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.
583 lines
21 KiB
583 lines
21 KiB
<template> |
|
<view class="page-css"> |
|
<u-navbar v-if="planOrderId" title="巡检任务" back-icon-color="rgb(0, 0, 0)" back-icon-size="54" :title-bold="true" |
|
:title-size="38" title-color="rgb(0, 0, 0)"></u-navbar> |
|
<view class="protocol-content"> |
|
<u-tabs-swiper ref="tabs" :list="subsectionList" :current="subsectionCurrent" :is-scroll="false" |
|
@change="subsectionChange" v-if="dataTypes != 2"></u-tabs-swiper> |
|
|
|
</view> |
|
<view class="page-search-top"> |
|
<betone-new-input v-model="searchInfo.requirementCode" placeholder="搜索巡检单单号" icon="search" |
|
style="margin-bottom: 32rpx" @changevalue="searchData()" /> |
|
<u-tabs v-if="subsectionCurrent == '0'" :list="tabList" :is-scroll="true" :current="current" |
|
@change="changeTab"></u-tabs> |
|
<u-tabs v-if="subsectionCurrent == '1'" :list="tasktabList" :is-scroll="true" :current="current" |
|
@change="subsectionChangeTab"></u-tabs> |
|
</view> |
|
<view class="order-box"> |
|
<view class="order-item" v-for="(item, index) in orderData" :key="index"> |
|
<view class="item-top"> |
|
<view class="item-left"> |
|
<text class="item-orderNo">单号: {{ item.taskCode }}</text> |
|
</view> |
|
<view class="item-right"> |
|
<u-tag v-if="subsectionCurrent == '0'" :text="statusName(item.taskStatus)" type="success" |
|
mode="dark" shape="circle" :bg-color="tagColor[statusName(item.taskStatus)]" /> |
|
<u-tag v-if="subsectionCurrent == '1'" :text="taskStatusName(item.repairStatus)" type="success" |
|
mode="dark" shape="circle" :bg-color="tagColor[taskStatusName(item.repairStatus)]" /> |
|
</view> |
|
</view> |
|
<view class="item-con"> |
|
<view class="con-right"> |
|
<text class="con-title">单位:{{ item.deptName }}</text> |
|
<text class="con-title">巡检说明:{{ item.taskContent }}</text> |
|
<text class="con-title">计划开始时间:{{ item.startTime }}</text> |
|
<!-- <text class="con-title">计划开始时间:{{ item.startTime }}</text> --> |
|
<view class="con-btn"> |
|
<u-button size="mini" plain style="margin-right:16rpx" |
|
@click="taskDetails(item)">查看</u-button> |
|
<u-button size="mini" plain style="margin-right:16rpx" |
|
@click="openModel(item, 'details')">下载</u-button> |
|
|
|
<!-- 巡检任务 客户 确认--> |
|
<block v-if="subsectionCurrent == '0' && dataTypes == 1 && item.taskStatus == 3"> |
|
<u-button size="mini" plain style="margin-right:16rpx" |
|
@click.stop="openWorkOrder(item, 'task')">确认</u-button> |
|
</block> |
|
<!--巡检任务 维修人员 接单 提交--> |
|
<block v-if="subsectionCurrent == '0' && dataTypes == 4"> |
|
<u-button v-if="item.taskStatus == 1" size="mini" plain style="margin-right:16rpx" |
|
@click="openWorkOrder(item, 'task')">接单</u-button> |
|
<u-button v-if="item.taskStatus == 2" size="mini" plain style="margin-right:16rpx" |
|
@click="openWorkOrder(item, 'task')">巡检</u-button> |
|
</block> |
|
<!--巡检任务 维修主管 指派 --> |
|
<block v-if="subsectionCurrent == '0' && dataTypes == 3"> |
|
<u-button v-if="item.taskStatus == 0" size="mini" plain style="margin-right:16rpx" |
|
@click="assign(item)">指派</u-button> |
|
</block> |
|
|
|
|
|
|
|
<!--巡检维修 客户 --> |
|
<block v-if="subsectionCurrent == '1' && dataTypes == 1"> |
|
<u-button v-if="item.repairStatus == 3" size="mini" plain style="margin-right:16rpx" |
|
@click="openWorkOrder(item, 'repair')">审批</u-button> |
|
<u-button v-if="item.repairStatus == 5" size="mini" plain style="margin-right:16rpx" |
|
@click="openEvaluate(item)">评价</u-button> |
|
</block> |
|
<!--巡检维修 客服 --> |
|
<block v-if="subsectionCurrent == '1' && dataTypes == 2"> |
|
<u-button v-if="item.repairStatus == 6" size="mini" plain style="margin-right:16rpx" |
|
@click.stop="openModel(item, 'paymentInfo')">确认付款</u-button> |
|
</block> |
|
<!--巡检维修 维修主管 --> |
|
<block v-if="subsectionCurrent == '1' && dataTypes == 3"> |
|
<u-button v-if="item.repairStatus == 2" size="mini" plain style="margin-right:16rpx" |
|
@click="openWorkOrder(item, 'repair')">审批</u-button> |
|
</block> |
|
<!--巡检维修 维修人员 --> |
|
<block v-if="subsectionCurrent == '1' && dataTypes == 4"> |
|
<u-button v-if="item.repairStatus == 1" size="mini" plain style="margin-right:16rpx" |
|
@click="openWorkOrder(item, 'repair')">提交</u-button> |
|
<u-button v-if="item.repairStatus == 4" size="mini" plain style="margin-right:16rpx" |
|
@click="openModel(item, 'repairComplete')">维修完成</u-button> |
|
</block> |
|
|
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
<u-loadmore margin-top="10" margin-bottom="40" :status="loadingState" /> |
|
|
|
|
|
<!-- 分派人员--> |
|
<u-select v-model="sendOrdersShow" :list="sendOrdersList" @confirm="sendOrdersConfirm" :isShowsearch="true" |
|
value-name="id" title="选择维修人员"></u-select> |
|
|
|
<!-- 维修人员 确认维修是否完成 --> |
|
<betone-modal v-model="repairCompleteShow" :title="'提示'" @confirm="repairCompleteFn" |
|
@cancel="repairCompleteShow = false"> |
|
维修是否完成? |
|
</betone-modal> |
|
|
|
<!-- 客服确认付款 --> |
|
<betone-modal v-model="paymentShow" :title="'提示'" @confirm="paymentFn" @cancel="paymentShow = false"> |
|
<view class="modal-text"> |
|
请确认付款是否已经完成? |
|
</view> |
|
</betone-modal> |
|
|
|
<betone-loading ref="BetLoading" /> |
|
<betone-tabbar ref="tabbarRef" v-if="!planOrderId" /> |
|
|
|
<betone-modal v-model="detailsShow" v-if="detailsShow" :title="'下载内容'" @confirm="detailsShowFn" @cancel="detailsShow = false"> |
|
<recordsdetails :data="rowInfo" :detailId="rowInfo.id" id="capture"></recordsdetails> |
|
</betone-modal> |
|
<sp-html2pdf-render domId="capture" ref="renderRef" @renderOver="renderOver" pdfFileName="这是一个pdf文件" |
|
@beforeSavePDF="beforeSavePDF" @successSavePDF="successSavePDF"></sp-html2pdf-render> |
|
|
|
</view> |
|
</template> |
|
|
|
<script> |
|
import recordsdetails from './components/details.vue' |
|
import { tabTaskList, tabTaskRepairList,tabTaskListColor } from '@/config/status.js' |
|
export default { |
|
components: { |
|
recordsdetails |
|
}, |
|
data() { |
|
return { |
|
type: '',//展示类型 |
|
searchInfo: { |
|
requirementCode: "", |
|
type: '',//状态 |
|
reportUnit: '',//提报单位 |
|
statusSearch: '',//巡检任务状态 |
|
}, |
|
userInfo: {},//用户信息 |
|
rowInfo: {},//选中行数据 |
|
|
|
tabList: [], |
|
tasktabList: [], |
|
current: 0, |
|
loadingState: "loadmore", |
|
isNomore: false, |
|
noDataFlag: false, |
|
|
|
orderData: [], |
|
page: { |
|
currentPage: 1, |
|
pageSize: 10, |
|
}, |
|
subsectionList: [ |
|
{ |
|
name: '巡检任务' |
|
}, |
|
{ |
|
name: '巡检维修' |
|
}, |
|
|
|
], |
|
subsectionCurrent: '0',// |
|
planOrderId: '',//巡检计划id |
|
|
|
sendOrdersShow: false,//派单弹框 |
|
sendOrdersList: [], |
|
rowInfo: {},//获取列表数据 |
|
|
|
repairCompleteShow: false,//维修完成 |
|
paymentShow: false,//确认付款是否完成 |
|
|
|
detailsShow: false,//导出pdf |
|
}; |
|
}, |
|
computed: { |
|
noData() { |
|
return this.orderData && this.orderData.length == 0; |
|
}, |
|
dataTypes() { |
|
// |
|
return this.$store.state.dataType |
|
}, |
|
tagColor(){ |
|
return tabTaskListColor |
|
}, |
|
}, |
|
onLoad(options) { |
|
if (options.id) { |
|
this.planOrderId = options.id |
|
} |
|
if (options.type) { |
|
this.type = options.type |
|
} |
|
|
|
}, |
|
onShow() { |
|
this.$nextTick(() => { |
|
// this.statusList() |
|
this.tabList = tabTaskList[this.$store.state.dataType + ''] |
|
// tabTaskRepairList |
|
this.tasktabList = tabTaskRepairList[this.$store.state.dataType + ''] |
|
// this.getTasktabList() |
|
this.getRepairPersons() |
|
if (this.dataTypes == 2) { |
|
this.subsectionCurrent = '1' |
|
} |
|
this.getRecordsList() |
|
|
|
// 实验室巡检 跳转进来 |
|
if (!this.planOrderId) { |
|
this.$refs.tabbarRef.getPermission(); |
|
} |
|
|
|
}); |
|
}, |
|
onReachBottom() { |
|
if (this.isNomore) { |
|
return; |
|
} |
|
this.page.currentPage++; |
|
this.getRecordsList(); |
|
}, |
|
onPullDownRefresh() { |
|
this.isNomore = false |
|
this.page.currentPage = 1; |
|
this.getRecordsList(); |
|
uni.stopPullDownRefresh(); |
|
}, |
|
|
|
methods: { |
|
// 获取列表 |
|
async getRecordsList() { |
|
this.BetLoading.show(); |
|
this.loadingState = "loading"; |
|
let query = { |
|
current: this.page.currentPage, //页数 |
|
size: this.page.pageSize, //条数 |
|
} |
|
if (this.planOrderId) { |
|
query.planId = this.planOrderId |
|
} |
|
let res = {} |
|
if (this.subsectionCurrent == '0') { |
|
query.statusSearch = this.searchInfo.statusSearch |
|
res = await this.$u.api.getTaskPage(query) |
|
} else { |
|
query.statusSearch = this.searchInfo.statusSearch |
|
res = await this.$u.api.getRepairPage(query) |
|
} |
|
if (res.code == 200) { |
|
var totalPage = res.data.total; |
|
var newOrders = res.data.records; |
|
if (this.page.currentPage == 1) { |
|
this.orderData = []; |
|
} |
|
|
|
this.orderData = [...this.orderData, ...(res.data.records || [])]; |
|
if (newOrders.length == 0) { |
|
this.loadingState = "nomore"; |
|
this.isNomore = true; |
|
} |
|
if (totalPage == this.orderData.length) { |
|
this.loadingState = "nomore"; |
|
this.isNomore = true; |
|
} |
|
this.BetLoading.hide(); |
|
} |
|
|
|
}, |
|
// 搜索 单号 |
|
searchData() { |
|
if (this.dataTypes != 1) { |
|
// 非管理员和客户 不传提报单位 |
|
this.searchInfo.reportUnit = this.searchInfo.requirementCode |
|
} else { |
|
this.searchInfo.reportUnit = '' |
|
} |
|
this.isNomore = false |
|
this.page.currentPage = 1; |
|
this.getRecordsList() |
|
}, |
|
// 巡检任务 tab切换 |
|
changeTab(index) { |
|
this.current = index; |
|
this.searchInfo.statusSearch = this.tabList[index].key == '9999' ? '' : this.tabList[index].key |
|
this.isNomore = false |
|
this.page.currentPage = 1; |
|
this.getRecordsList() |
|
}, |
|
// 巡检维修 tab切换 |
|
subsectionChangeTab(index) { |
|
this.current = index; |
|
this.searchInfo.statusSearch = this.tasktabList[index].key == '9999' ? '' : this.tasktabList[index].key |
|
this.isNomore = false |
|
this.page.currentPage = 1; |
|
this.getRecordsList() |
|
}, |
|
|
|
// 查看详情 |
|
taskDetails(item) { |
|
let param = { |
|
id: item.id, |
|
type: 'view' |
|
} |
|
uni.navigateTo({ |
|
url: `/pages/inspection/questDetails${this.$u.queryParams(param)}`, |
|
}); |
|
}, |
|
//跳转工单 |
|
openWorkOrder(item, type) { |
|
|
|
let param = { |
|
id: item.id, |
|
type: 'view', |
|
details: type |
|
} |
|
uni.navigateTo({ |
|
url: `/pages/inspection/questOrder${this.$u.queryParams(param)}`, |
|
}); |
|
}, |
|
subsectionChange(e) { |
|
this.subsectionCurrent = e; |
|
this.searchInfo.statusSearch = '' |
|
this.getRecordsList() |
|
}, |
|
// 指派 |
|
assign(item) { |
|
this.rowInfo = item |
|
this.sendOrdersShow = true |
|
}, |
|
// 维修人员 |
|
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) { |
|
let query = { |
|
servicemanId: e[0].value, |
|
id: this.rowInfo.id |
|
} |
|
this.$u.api.taskSupervisorconfirm(query).then(res => { |
|
if (res.code == 200) { |
|
uni.showToast({ title: "指派成功", icon: "none" }); |
|
this.sendOrdersShow = false |
|
// 指派成功 刷新列表 |
|
this.getRecordsList() |
|
} |
|
}) |
|
}, |
|
openModel(item, type) { |
|
if (type == 'repairComplete') { |
|
this.repairCompleteShow = true |
|
} |
|
if (type == 'paymentInfo') { |
|
this.paymentShow = true |
|
} |
|
if (type == 'details') { |
|
this.detailsShow = true |
|
} |
|
this.rowInfo = item |
|
}, |
|
// 维修完成 弹框 |
|
repairCompleteFn() { |
|
let query = { |
|
id: this.rowInfo.id |
|
} |
|
this.$u.api.repairServicemanSubmit(query).then(res => { |
|
if (res.code == 200) { |
|
uni.showToast({ title: "维修完成", icon: "none" }); |
|
this.repairCompleteShow = false |
|
// 指派成功 刷新列表 |
|
this.getRecordsList() |
|
} |
|
}) |
|
}, |
|
// 确认付款是否完成 |
|
paymentFn() { |
|
let query = { |
|
id: this.rowInfo.id, |
|
} |
|
this.BetLoading.show(); |
|
|
|
this.$u.api.confirmPayment(query).then(res => { |
|
this.paymentShow = false |
|
this.BetLoading.hide(); |
|
if (res.code == 200) { |
|
uni.showToast({ title: "确认成功", icon: "none" }); |
|
this.getRecordsList() |
|
} |
|
}) |
|
}, |
|
// 评价 |
|
openEvaluate(item) { |
|
let param = { |
|
id: item.id, |
|
istask: true |
|
} |
|
uni.navigateTo({ |
|
url: `/pages/submission/evaluate${this.$u.queryParams(param)}`, |
|
}); |
|
}, |
|
|
|
// 巡检任务 获取状态信息 |
|
statusName(item) { |
|
let newArr = this.tabList.filter(i => { |
|
let sta = i.key.split(',') |
|
return sta.includes(item + '') |
|
}) |
|
return newArr.length<=0?'':newArr[0].name |
|
}, |
|
// 巡检维修 |
|
taskStatusName(item) { |
|
let newArr = this.tasktabList.filter(i => { |
|
let sta = i.key.split(',') |
|
return sta.includes(item + '') |
|
}) |
|
return newArr.length<=0?'':newArr[0].name |
|
}, |
|
detailsShowFn() { |
|
// 调用组件实例中h2cRenderDom方法 |
|
this.$refs.renderRef.h2pRenderDom(); |
|
}, |
|
renderOver(e) { |
|
// e为导出截图的base64格式字符串 |
|
// this.imageSrc = e |
|
console.log("==== renderOver :", e); |
|
// 将canvas转换为图片 |
|
}, |
|
beforeSavePDF(e) { |
|
// e为导出的pdf(base64) |
|
console.log("==== beforeSavePDF :", e); |
|
}, |
|
successSavePDF(path) { |
|
// e为打开的pdf(临时路径) |
|
console.log("==== successSavePDF :", path); |
|
}, |
|
}, |
|
}; |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.page-css { |
|
padding: 0; |
|
|
|
.page-search-top { |
|
height: 220rpx; |
|
background-color: #fff; |
|
padding: 0 40rpx 0; |
|
} |
|
|
|
.protocol-content { |
|
padding: 40rpx 0rpx 0rpx 0rpx; |
|
background-color: #fff; |
|
} |
|
|
|
.order-box { |
|
margin-top: 20rpx; |
|
|
|
.order-item { |
|
min-height: 414rpx; |
|
margin: 0 24rpx 20rpx; |
|
border-radius: 20rpx; |
|
background: #fff; |
|
display: flex; |
|
flex-direction: column; |
|
|
|
.item-top { |
|
height: 114rpx; |
|
border-bottom: 1px solid rgba(239, 239, 239, 1); |
|
display: flex; |
|
flex-direction: row; |
|
width: 100%; |
|
|
|
.item-left { |
|
flex: 1; |
|
|
|
text { |
|
display: block; |
|
} |
|
|
|
.item-orderNo { |
|
color: rgba(51, 51, 51, 1); |
|
font-size: 28rpx; |
|
padding: 36rpx 0 0 26rpx; |
|
} |
|
|
|
.item-time { |
|
color: rgba(190, 190, 190, 1); |
|
font-size: 24rpx; |
|
padding: 12rpx 0 0 26rpx; |
|
} |
|
} |
|
|
|
.item-right { |
|
min-width: 132rpx; |
|
height: 48rpx; |
|
margin: 36rpx 24rpx 0 0; |
|
} |
|
} |
|
|
|
.item-con { |
|
flex: 1; |
|
display: flex; |
|
flex-direction: row; |
|
|
|
.con-left { |
|
width: 150rpx; |
|
height: 150rpx; |
|
margin: 24rpx 28rpx 0 28rpx; |
|
|
|
image { |
|
width: 100%; |
|
height: 100%; |
|
} |
|
} |
|
|
|
.con-right { |
|
flex: 1; |
|
margin-right: 24rpx; |
|
display: flex; |
|
flex-direction: column; |
|
margin-left: 32rpx; |
|
|
|
text { |
|
display: block; |
|
} |
|
|
|
.con-title { |
|
margin-top: 12rpx; |
|
line-height: 60rpx; |
|
color: rgba(0, 0, 0, 1); |
|
font-size: 28rpx; |
|
} |
|
|
|
.con-content { |
|
|
|
color: rgba(108, 108, 108, 1); |
|
font-size: 24rpx; |
|
// line-height: 36rpx; |
|
margin-top: 14rpx; |
|
flex: 1; |
|
|
|
text { |
|
display: -webkit-box; |
|
-webkit-box-orient: vertical; |
|
-webkit-line-clamp: 2; |
|
overflow: hidden; |
|
text-overflow: ellipsis; |
|
line-height: 1.5em; |
|
/* 这个值根据你的需求调整,这里假设为1.5倍行高 */ |
|
max-height: 3em; |
|
/* 3行的高度 */ |
|
width: 100%; |
|
/* 根据需要设置宽度 */ |
|
word-wrap: break-word; |
|
/* 允许在单词内换行 */ |
|
word-break: break-all; |
|
/* 允许在任意字符处换行 */ |
|
} |
|
} |
|
|
|
.con-btn { |
|
margin-top: 18rpx; |
|
margin-bottom: 32rpx; |
|
display: inline-block; |
|
text-align: right; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
</style> |