Commit 1e28171d by 张立顺

fix bug

1 parent 904090b3
// tabRepairOrder/components/relateGoodsPop/index.js // tabRepairOrder/components/relateGoodsPop/index.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -10,15 +9,18 @@ Component({ ...@@ -10,15 +9,18 @@ Component({
baseConfigData: Object, baseConfigData: Object,
show: { show: {
type: Boolean, type: Boolean,
observer: function(n) { observer: function (n) {
if (n) { if (n) {
let {goodsList, selected} = this.data let { goodsList, selected } = this.data
goodsList?.map(val => { goodsList?.map(val => {
val.active = false val.active = false
if (selected?.findIndex(v => v.upgradeGoodsId == val.upgradeGoodsId) > -1) val.active = true if (
selected?.findIndex(v => v.subOrderCode == val.subOrderCode) > -1
)
val.active = true
return val return val
}) })
this.setData({goodsList}) this.setData({ goodsList })
} }
} }
} }
...@@ -27,9 +29,7 @@ Component({ ...@@ -27,9 +29,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,7 +39,7 @@ Component({ ...@@ -39,7 +39,7 @@ Component({
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
let { goodsList } = this.data let { goodsList } = this.data
goodsList?.forEach(val => { goodsList?.forEach(val => {
if (val.upgradeGoodsId == item.upgradeGoodsId) val.active = !val.active if (val.subOrderCode == item.subOrderCode) val.active = !val.active
}) })
this.setData({ this.setData({
goodsList goodsList
......
...@@ -236,11 +236,15 @@ Page({ ...@@ -236,11 +236,15 @@ Page({
this.setTime() this.setTime()
if (code == 0) { if (code == 0) {
if (data.startTime) { if (data.startTime) {
data.startTime = new Date(data.startTime).format('yyyy-MM-dd hh:mm:ss') data.startTime = new Date(data.startTime).format(
'yyyy-MM-dd hh:mm:ss'
)
} }
_this.setData({ _this.setData({
'detailInfo.outboundStatus': data?.outboundStatus, 'detailInfo.outboundStatus': data?.outboundStatus,
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间) 'detailInfo.startTime': detailInfo.startTime
? detailInfo.startTime
: data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -254,7 +258,7 @@ Page({ ...@@ -254,7 +258,7 @@ Page({
let { queryOptions } = this.data let { queryOptions } = this.data
if (!queryOptions.id || !queryOptions.constructionCode) return if (!queryOptions.id || !queryOptions.constructionCode) return
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api api
.getConstructionDetail({ .getConstructionDetail({
...@@ -298,7 +302,9 @@ Page({ ...@@ -298,7 +302,9 @@ Page({
'detailInfo.pictureList': data?.pictureList?.map(val => { 'detailInfo.pictureList': data?.pictureList?.map(val => {
return val.pictureUrl return val.pictureUrl
}), }),
'detailInfo.startTime': detailInfo.startTime ? detailInfo.startTime : data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间) 'detailInfo.startTime': detailInfo.startTime
? detailInfo.startTime
: data.startTime // 页面操作选了开始施工时间不做更新,未选择取更新后的时间(出库时间)
}, },
() => { () => {
if (data?.startTime && data?.endTime) { if (data?.startTime && data?.endTime) {
...@@ -662,13 +668,17 @@ Page({ ...@@ -662,13 +668,17 @@ Page({
if (!detailInfo?.pictureList?.length) if (!detailInfo?.pictureList?.length)
return wx.$util.showToast('请在页面中提交上传施工图片') return wx.$util.showToast('请在页面中提交上传施工图片')
if (!detailInfo.endTime) { // 未选择施工结束时间取当前时间 if (!detailInfo.endTime) {
// 未选择施工结束时间取当前时间
this.setData({ this.setData(
{
'detailInfo.endTime': new Date().format('yyyy-MM-dd hh:mm:ss') 'detailInfo.endTime': new Date().format('yyyy-MM-dd hh:mm:ss')
}, () => { },
() => {
this.calculateTimeDifference() // 自动计算施工时长 this.calculateTimeDifference() // 自动计算施工时长
}) }
)
} }
const pictureList = detailInfo?.pictureList?.map(val => { const pictureList = detailInfo?.pictureList?.map(val => {
return { return {
...@@ -676,7 +686,7 @@ Page({ ...@@ -676,7 +686,7 @@ Page({
} }
}) })
if (this.data.submitFlag) return if (this.data.submitFlag) return
this.setData({ submitFlag: true }) this.setData({ submitFlag: true }) this.setData({ submitFlag: true })
let params = { let params = {
id: detailInfo.id, id: detailInfo.id,
constructionCode: detailInfo.constructionCode, constructionCode: detailInfo.constructionCode,
...@@ -688,7 +698,7 @@ Page({ ...@@ -688,7 +698,7 @@ Page({
pictureList: pictureList pictureList: pictureList
} }
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api api
.completeConstructionOrder(params) .completeConstructionOrder(params)
...@@ -734,13 +744,15 @@ Page({ ...@@ -734,13 +744,15 @@ Page({
reviewFlag: true reviewFlag: true
}) })
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中'
}) })
api.approvalRepairOrder({ api
.approvalRepairOrder({
id: detailInfo.id, id: detailInfo.id,
constructionCode: detailInfo.constructionCode, constructionCode: detailInfo.constructionCode,
approvalStatus: type approvalStatus: type
}).then(result => { })
.then(result => {
wx.hideLoading() wx.hideLoading()
this.reviewClose() this.reviewClose()
let { code, message } = result let { code, message } = result
...@@ -761,7 +773,8 @@ Page({ ...@@ -761,7 +773,8 @@ Page({
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
} }
}).catch(() => { })
.catch(() => {
wx.hideLoading() wx.hideLoading()
setTimeout(() => { setTimeout(() => {
this.setData({ this.setData({
......
// tabRepairOrder/components/relateGoodsPop/index.js // tabRepairOrder/components/relateGoodsPop/index.js
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -10,15 +9,18 @@ Component({ ...@@ -10,15 +9,18 @@ Component({
baseConfigData: Object, baseConfigData: Object,
show: { show: {
type: Boolean, type: Boolean,
observer: function(n) { observer: function (n) {
if (n) { if (n) {
let {goodsList, selected} = this.data let { goodsList, selected } = this.data
goodsList?.map(val => { goodsList?.map(val => {
val.active = false val.active = false
if (selected?.findIndex(v => v.upgradeGoodsId == val.upgradeGoodsId) > -1) val.active = true if (
selected?.findIndex(v => v.subOrderCode == val.subOrderCode) > -1
)
val.active = true
return val return val
}) })
this.setData({goodsList}) this.setData({ goodsList })
} }
} }
} }
...@@ -27,9 +29,7 @@ Component({ ...@@ -27,9 +29,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,7 +39,7 @@ Component({ ...@@ -39,7 +39,7 @@ Component({
let { item } = e.currentTarget.dataset let { item } = e.currentTarget.dataset
let { goodsList } = this.data let { goodsList } = this.data
goodsList?.forEach(val => { goodsList?.forEach(val => {
if (val.upgradeGoodsId == item.upgradeGoodsId) val.active = !val.active if (val.subOrderCode == item.subOrderCode) val.active = !val.active
}) })
this.setData({ this.setData({
goodsList goodsList
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!