Files

596 lines
16 KiB
Vue
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<view class="detail-subtitle-class">工单信息</view>
<view class="head">
<view class="card-info-item" style="margin-top: 0;">
<text class="card-info-item-text">点检单号:</text>
<text class="card-info-item-text-detail">{{taskItem.FBILLNO}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">点检任务:</text>
<text class="card-info-item-text-detail">{{taskItem.FNAME}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">部门:</text>
<text class="card-info-item-text-detail">{{taskItem.FDEPTNAME}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">工单时间:</text>
<text class="card-info-item-text-detail">{{taskItem.FBegTime}}</text>
</view>
<view class="card-info-item" style="padding-bottom: 0;">
<text class="card-info-item-text">异动时间:</text>
<text class="card-info-item-text-detail">{{taskItem.FEndTime}}</text>
</view>
</view>
<view class="detail-subtitle-class">首检项目</view>
<view class="card-list" v-for="(item,index) in this.taskItem.SubItem" @tap="itemClick(index)">
<image class="card-img" src="../../../static/img/FCheckIteam.png" style="width: 70rpx;height: 70rpx;"></image>
<view class="card-info">
<!-- <view class="card-info-item" style="padding: 10rpx 0;">
<text class="card-info-title-text-left">项目序号:</text>
<text class="card-info-title-text-detail-left">{{item.FEntryID}}</text>
</view>
<view class="card-info-item" style="padding: 10rpx 0;">
<text class="card-info-title-text-left">项目名称:</text>
<text class="card-info-title-text-detail-left">{{item.FTestProjectName}}</text>
</view> -->
<view class="card-info-item">
<text class="card-info-item-text">部位:</text>
<text class="card-info-item-text-detail">{{item.FPARTNAME}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">设备:</text>
<text class="card-info-item-text-detail">{{item.FEQUIPNAME}}</text>
</view>
</view>
<view class="item-right">
<text class="detail-row-content-yellow-class" v-if="item.FTESTRESULT == 0">未完成</text>
<image class="my-image" src="../../../static/img/rightarrowyellow.png" v-if="item.FTESTRESULT == 0"></image>
<text class="detail-row-content-green-class" v-if="item.FTESTRESULT == 1">合格</text>
<image class="my-image" src="../../../static/img/rightarrowgreen.png" v-if="item.FTESTRESULT == 1"></image>
<text class="detail-row-content-red-class" v-if="item.FTESTRESULT == 2">不合格</text>
<image class="my-image" src="../../../static/img/rightarrowred.png" v-if="item.FTESTRESULT == 2"></image>
</view>
</view>
<view style="height: 80rpx; flex-shrink: 0; flex-grow: 0;"></view>
<view class="bottom-row-class">
<!-- <view @tap="saveBtnClick()" class="saveBtnClass" v-if="taskItem.FStatus!=40">保存</view> -->
<view @tap="saveBtnClick()" class="sumbitBtnClass" v-if="taskItem.isEditable">提交</view>
<!-- <view @tap="cancelBtnClick()" class="cancelBtnClass" v-if="taskItem.FStatus==40">取消提交</view> -->
</view>
<view class="gray-layer" v-show="showGrayLayer" @click="hiddenClick"></view>
<view class="alter-window-center" v-show="showAlterWin">
<view class="alter-title">提示</view>
<view class="alter-content">
<view class="alter-content-detail">点检完成,存在不良,是否创建维修单?</view>
<view class="alter-content-note" style="margin-top: 40rpx;">
<input class="alter-content-input" v-model="creatNote" placeholder="输入备注信息" placeholder-style="color:3D3D3D;font-size:26rpx" />
</view>
</view>
<view class="alter-btn">
<view class="alter-btn-cancel" @click="creatCancenClick">否</view>
<view class="alter-btn-cnfirm" @click="creatConfirmClick">是</view>
</view>
</view>
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
<opsoft-dialog
@dialogCancelClick="dialogCancelClick"
@dialogConfirmClick="dialogConfirmClick"
:dialogContent="dialogContent"
:dialogTitle="dialogTitle"
:dialogShow="dialogShow"
></opsoft-dialog>
</view>
</template>
<script>
import xflSelect from '../../../components/xfl-select/xfl-select.vue';
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import opsoftDialog from '@/components/opsoft-dialog/opsoft-dialog.vue'
import errorStrUntil from '@/common/errorStrUntil.js';
import Vue from 'vue';
import {
mapState,
mapMutations
} from 'vuex';
var commonUtil = require('../../../common/util.js');
var _self;
export default {
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
dialogShow:false,
dialogTitle:'',
dialogContent:'',
dialogType:'',
dialogParams:new Object,
showGrayLayer:false,
showAlterWin:false,
creatNote:'',
IsCreateRepair:0,
layerClick:false,
scrollTop: 0,
old: {
scrollTop: 0
},
taskItem: new Object(),
backFlag:true,
checkWayArray:[{value:"全检", key:1}, {value:"抽检", key:2}],
checkResultArray:[{value:"合格", key:0}, {value:"不合格", key:1}, {value:"点检中", key:1}],
nextPage:"EQUM01",
defaultKey:"defaultKey",
loadFlag: true
}
},
onBackPress() {
// uni.removeStorage({
// key:this.taskItem.FInterID
// });
if (!_self.taskItem.isEditable) {
return false;
}
if (!_self.backFlag) {
return false;
}
let checkFlag = false;
_self.taskItem.SubItem.forEach(
function(el){
if(el.updateFlag == "Y") {
checkFlag = true;
}
}
);
if (checkFlag) {
this.dialogProps("请确认是否上传数据","upLoadData",'none');
}
else {
_self.backFlag = false;
}
return _self.backFlag;
},
onLoad(options) {
_self = this;
if(options.item) {
this.taskItem = JSON.parse(options.item);
if(!this.taskItem.SubItem) {
this.getDetail(this.taskItem.FINTERID);
}
}
},
onShow() {
if(!this.loadFlag) {
let newItem = new Object();
if(this.taskItem.FINTERID) {
newItem = uni.getStorageSync(this.taskItem.FINTERID);
} else {
newItem = uni.getStorageSync(this.defaultKey);
}
if(newItem){
this.taskItem = newItem;
}
}
this.loadFlag = false;
if(this.taskItem.SubItem){
this.isCreateRepairOrderAlter();
}
},
computed: {
...mapState(['userInfo']),
},
methods: {
dialogProps(dialogContent,type,params){
this.dialogShow = true;
this.dialogTitle = '提示';
this.dialogContent = dialogContent;
this.dialogType = type
this.dialogParams.params = params
},
dialogConfirmClick:function() {
let _self = this;
console.log("dialogConfirmClick");
if(this.dialogType=='upLoadData'){
_self.backFlag = false;
_self.saveData();
}
if(this.dialogType=='checkRepair'){
uni.navigateTo({
url: '../EQUM03/EQUM03Item?FBillNO=' + data.FBillNO,
});
}
},
dialogCancelClick:function() {
console.log("dialogCancelClick");
this.dialogShow=false
if(this.dialogType=='upLoadData'){
_self.backFlag = false;
uni.navigateBack({
delta:1
});
}
},
dialogNoticeConfirmClick(){
this.showDialog = false;
},
dialogNoticeProps(err,type){
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
if(type=='success'){
this.dialogNoticeType = 'success';
this.dialogNoticeTitle = '执行成功';
}
this.dialogNoticeContent = err;
},
upper: function(e) {
console.log(e)
},
scroll: function(e) {
console.log(e)
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
// 解决view层不同步的问题
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
uni.showToast({
icon:"none",
title:"纵向滚动 scrollTop 值已被修改为 0"
})
},
// checkWayChange: function({
// newVal,
// oldVal,
// index,
// orignItem
// }) {
// this.taskItem.FTestTypeName = orignItem.value;
// this.taskItem.FTestType = orignItem.key;
// this.taskItem.updateFlag = "Y";
// this.$forceUpdate();
// },
itemClick: function(index){
this.taskItem.currentdIndex = index;
let itemString = JSON.stringify(this.taskItem);
uni.navigateTo({
// ? 后面加要传的参数, 多个参数用 & 隔开
url: '../../views/' + this.nextPage + '/' + 'EQUM01Detail?item=' + itemString,
});
},
hiddenClick(){
this.showGrayLayer = false;
this.showAlterWin = false;
this.layerClick = true;
console.log(">>>>>>>"+this.IsCreateRepair+this.creatNote)
},
creatCancenClick(){
this.showGrayLayer = false;
this.showAlterWin = false;
this.layerClick = false;
this.IsCreateRepair = 0;
console.log("------"+this.IsCreateRepair+this.creatNote)
},
creatConfirmClick(){
this.showGrayLayer = false;
this.showAlterWin = false;
this.layerClick = false;
this.IsCreateRepair = 1;
console.log("++++++"+this.IsCreateRepair+this.creatNote)
},
saveBtnClick: function(){
this.saveData();
},
isCreateRepairOrderAlter(){
let paramData = new Array();
_self.taskItem.SubItem.forEach(
function(el){
if (!el.FTESTRESULT) {
if(el.FTESTRESULT != 0) {
el.FTESTRESULT = '';
}
}
if (!el.FTESTVALUE) {
if(el.FTESTVALUE != 0) {
el.FTESTVALUE = '';
}
}
if (el.updateFlag == "Y") {
let data = {
FINTERID: el.FINTERID,
FDetailID: el.FDetailID,
FTESTRESULT: el.FTESTRESULT,
FNote: el.FNote? el.FNote: '',
FTESTVALUE: el.FTESTVALUE,
FPartID: el.FPartID,
FEquipID: el.FEquipmentID,
FPartID: el.FPartID,
FPicture: el.FPicture? el.FPicture: '',
FIsStopMachine:el.FIsStopMachine
}
paramData.push(data);
}
// el.updateFlag = "N";
}
);
if(paramData.length == _self.taskItem.SubItem.length){
let defultCount = 0;
_self.taskItem.SubItem.forEach(
function(el){
if(el.FTESTRESULT == 2){
defultCount = defultCount+1
}
}
)
if(defultCount>0 && _self.taskItem.FISCREATEREPAIR){
this.showGrayLayer = true;
this.showAlterWin = true;
}
}
},
saveData:function(count){
uni.showLoading({
title:"数据上传中",
mask:true
})
let paramData = new Array();
_self.taskItem.SubItem.forEach(
function(el){
if (!el.FTESTRESULT) {
if(el.FTESTRESULT != 0) {
el.FTESTRESULT = '';
}
}
if (!el.FTESTVALUE) {
if(el.FTESTVALUE != 0) {
el.FTESTVALUE = '';
}
}
if (el.updateFlag == "Y") {
let data = {
FInterID: el.FINTERID,
FDetailID: el.FDETAILID,
FTestResult: el.FTESTRESULT,
FNote: el.FNOTE? el.FNOTE: '',
FTestValue: el.FTESTVALUE,
FPartID: el.FPARTID,
FEquipID: el.FEQUIPMENTID,
FPartID: el.FPARTID,
FPicture: el.FPicture? el.FPicture: '',
FIsStopMachine:el.FISSTOPMACHINE
}
paramData.push(data);
}
el.updateFlag = "N";
}
);
if (paramData.length == 0) {
uni.hideLoading();
uni.showToast({
icon: 'none',
title: "页面无数据需要上传",
});
return;
}
let requestParams = {
"IsCreateRepair":this.IsCreateRepair,
"RepairNote":this.creatNote,
"SData": paramData
};
this.$request.post('/SpotCheck/SpotTaskSubmit',requestParams).then(res => {
uni.hideLoading();
uni.removeStorage({
key:_self.taskItem.FINTERID
});
_self.getDetail(_self.taskItem.FINTERID);
let data = res;
if (_self.taskItem.FISCREATEREPAIR && _self.FISCREATEREPAIR == 1) {
this.dialogProps("有检查项不合格,已创建维修工单,是否需要查看!","checkRepair",'none');
}
else {
_self.backFlag = false;
uni.showToast({
icon: 'none',
title: '上传数据成功'
});
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
getDetail(interID){
uni.showLoading({
title:"加载中",
mask:true
})
let requestParams = {
"finterid":interID
};
this.$request.get('/SpotCheck/SpotTaskSearchDetail',{params:requestParams}).then(res => {
res.length ?res.forEach(
function(el){
if (el.FEFFECTIVEDATE) {
let FBegTime = commonUtil.removeLetter(el.FEFFECTIVEDATE);
el.FBegTime = FBegTime.substr(0,10) + " " + FBegTime.substr(10 ,8);
}
if (el.M_YMD) {
let FEndTime = commonUtil.removeLetter(el.M_YMD);
el.FEndTime = FEndTime.substr(0,10) + " " + FEndTime.substr(10 ,8);
}
}
): ''
res[0].isHistory = _self.taskItem.isHistory;
res[0].isEditable = _self.taskItem.isEditable;
_self.taskItem = res[0];
uni.hideLoading();
_self.$forceUpdate();
});
}
// onKeyInput: function(){
// this.taskItem.updateFlag = "Y";
// }
},
components: {
xflSelect,
opsoftDialogNotice,
opsoftDialog
},
}
</script>
<style lang="scss">
.page{
width: 100%;
height: 100%;
display: flex;
flex-direction:column;
flex-wrap: nowrap;
background-color: #F9F9F9;
}
.head{margin: 0rpx 32rpx;background-color: #FFFFFF;padding: 32rpx 32rpx;border-radius: 10rpx;}
.card-info-item{}
.card-info-title-text-detail-left{color: #8F8F8F;}
.card-list{margin: 0rpx 32rpx 32rpx 32rpx;}
.card-img{height: 70rpx;width: 70rpx;flex-grow: 0;flex-shrink: 0;}
.item-right{flex-grow: 0;flex-shrink: 0;display: flex;flex-direction: row;align-items: center;}
.detail-row-content-green-class{
flex-shrink: 0;
flex-grow: 0;
font-size: 28rpx;
font-style: auto;
color: #32CD32;
}
.detail-row-content-red-class{
flex-shrink: 0;
flex-grow: 0;
font-size: 28rpx;
font-style: auto;
color: #FF0000;
}
.detail-row-content-yellow-class{
flex-shrink: 0;
flex-grow: 0;
font-size: 28rpx;
font-style: auto;
color: #FAAE12;
}
.my-image{
height: 20rpx;
width: 20rpx;
margin-left: 16rpx;
margin-top: 8rpx;
}
.bottom-row-class{
width: 100%;
bottom: 0px;
position: fixed;
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
margin-top: 5rpx;
}
.detail-subtitle-class {
opacity: 1;
font-size: 32rpx;
font-family: PingFangSC, PingFangSC-Semibold;
font-weight: 600;
text-align: left;
color: #000000;
padding: 32rpx 32rpx 24rpx 32rpx;
}
.saveBtnClass {
height: 80rpx;
line-height: 80rpx;
font-size: 35rpx;
text-align: center;
background: #F5F5F4;
flex-grow: 1;
flex-shrink: 1;
color: #666666;
}
.sumbitBtnClass {
height: 80rpx;
line-height: 80rpx;
font-size: 35rpx;
text-align: center;
background: #5778FF;
flex-grow: 1;
flex-shrink: 1;
color: #FFFFFF;
}
.cancelBtnClass {
height: 80rpx;
line-height: 80rpx;
font-size: 35rpx;
text-align: center;
background: #5778FF;
flex-grow: 1;
flex-shrink: 1;
color: #FFFFFF;
}
</style>