szh_zidingyibiaoti
lilu 2 years ago
commit d63416ec0e

@ -44,16 +44,20 @@
<a-card :bodyStyle="tstyle" :bordered="false">
<div class="title"><i class="iconfont icon-fuwu"></i><span>货物状态</span></div>
<div class="content">
<div
class="items"
v-for="serive in booGoodsStatusItem"
:key="serive.systemCode"
:class="{ active: locaGoodsStatus.includes(serive.systemCode) }"
@click="saveGoodsStatus(serive)"
>
{{ serive.statusName }}
<div class="edit" @click.stop="FnOpenEdit(serive)"><a-icon type="edit" /></div>
</div>
<a-tooltip v-for="(serive, sindex) in booGoodsStatusItem" :key="`${serive.systemCode}_${sindex}`">
<template v-if="serive.finishTime" #title>
<p>时间{{ serive.finishTime }}</p>
<p v-if="serive.remark">{{ serive.remark }}</p>
</template>
<div
class="items"
:class="{ active: locaGoodsStatus.includes(serive.systemCode) }"
@click="saveGoodsStatus(serive)"
>
{{ serive.statusName }}
<div class="edit" @click.stop="FnOpenEdit(serive)"><a-icon type="edit" /></div>
</div>
</a-tooltip>
</div>
</a-card>
<a-modal v-model="GoodsStatusVisible" width="600px" title="编辑" @ok="GoodsStatusHandleOk">
@ -68,6 +72,11 @@
/>
</a-form-item>
</a-col>
<a-col :span="12" v-if="GoodsStatusEditData.systemCode == 'SQXS'">
<a-form-item label="显示天数" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入显示天数" v-decorator="['extData']" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入备注" v-decorator="['remark']" />
@ -370,6 +379,10 @@ export default {
'$route.query': {
immediate: true,
handler(nD, oD) {
console.log(nD)
BookingOrderGetGoodsStatusList({ bookingId: nD.id }).then(res => {
this.booGoodsStatusItem = res.data
})
this.id = this.$route.query.id
if (!nD.id) {
//
@ -448,7 +461,6 @@ export default {
this.editRemarkVal = data
},
deleteRemark(data) {
console.log(data)
BookingOrderDeleteRemark(data.id).then(res => {
this.$message.success('成功删除')
this.$emit('upDateRight')
@ -489,7 +501,6 @@ export default {
},
beforeUpload(file) {
if (this.upFileList.length > 1) {
console.log('== 仅上传一条 ==')
return false
}
this.upFileList = [...this.upFileList, file]
@ -531,7 +542,6 @@ export default {
this.fileModelCancel()
})
.catch(err => {
console.log(err)
this.$message.error(err.message)
})
},
@ -577,7 +587,7 @@ export default {
this.locaService.splice(index, 1)
this.details.item.splice(index, 1)
}
console.log('== 修改服务 ==', this.locaService, this.details.item)
this.saveServiceItem()
},
saveServiceItem() {
@ -602,63 +612,73 @@ export default {
validateFields((errors, values) => {
if (!errors) {
for (const key in values) {
console.log(key, 1)
if (typeof values[key] === 'object' && !(values[key] === null)) {
values[key] = JSON.stringify(values[key])
}
}
console.log('计算时间')
console.log(values.finishTime)
let date = ''
if (values.finishTime._d) {
date = new Date(+new Date(values.finishTime._d) + 8 * 3600 * 1000)
} else {
console.log(values.finishTime.split('"'))
if (values.finishTime.split('"').length == 3) {
date = new Date(+new Date(values.finishTime.split('"')[1]))
} else {
date = new Date(+new Date(values.finishTime) + 8 * 3600 * 1000)
}
}
console.log(date)
let data = {
finishTime: date.toISOString(),
remark: values.remark
remark: values.remark,
extData: values.remark
}
console.log(this.GoodsStatusEditData, data)
let AData = { ...this.GoodsStatusEditData, ...data }
console.log(AData)
console.log('改变样式及数据')
if (!this.id) {
this.$message.error('请先保存主单')
return false
}
if (!this.locaGoodsStatus.includes(this.GoodsStatusEditData.systemCode)) {
this.locaGoodsStatus.push(this.GoodsStatusEditData.systemCode)
this.details.goodsStatus.push({ ...this.GoodsStatusEditData })
this.details.goodsStatus.push({ ...AData })
}
console.log('编辑请求数据')
let ApiData = {
bookingId: this.id,
item: []
}
this.details.goodsStatus.forEach(item => {
if (item.systemCode == AData.systemCode) {
console.log(true)
ApiData.item.push(AData)
} else {
console.log(false)
ApiData.item.push(item)
if (item.finishTime) {
if (item.systemCode == this.GoodsStatusEditData.systemCode) {
ApiData.item.push(AData)
} else {
ApiData.item.push(item)
}
}
})
console.log('走接口')
BookingOrderSaveGoodsStatus(ApiData)
.then(res => {
if (res.success) {
this.booGoodsStatusItem = ApiData.item
// this.$emit('upDateRight')
console.log('== 货物状态设置成功 ==')
let data = []
this.booGoodsStatusItem.forEach(item => {
let type = true
ApiData.item.forEach(item2 => {
if (item.systemCode == item2.systemCode) {
type = false
data.push(item2)
}
})
if (type) {
data.push(item)
}
})
this.$nextTick(() => {
this.booGoodsStatusItem = data
})
this.$message.success('货物状态设置成功')
this.GoodsStatusVisible = false
}
@ -675,24 +695,25 @@ export default {
FnOpenEdit(data) {
console.log(data)
setTimeout(() => {
console.log(data)
this.StatusVisibleForm.setFieldsValue({
finishTime: data.finishTime ? data.finishTime : '',
remark: data.remark ? data.remark : ''
})
this.GoodsStatusEditData = data
this.GoodsStatusVisible = true
this.$nextTick(() => {
this.StatusVisibleForm.setFieldsValue({
finishTime: data.finishTime ? data.finishTime : '',
remark: data.remark ? data.remark : '',
extData: data.extData ? data.extData : ''
})
})
}, 100)
},
saveGoodsStatus(data) {
console.log(data)
if (!this.id) {
this.$message.error('请先保存主单')
return false
}
if (!this.locaGoodsStatus.includes(data.systemCode)) {
this.locaGoodsStatus.push(data.systemCode)
this.details.goodsStatus.push({ ...data })
// this.details.goodsStatus.push({ ...data })
this.savegoodsStatusItem(data, 'push')
} else {
let that = this
@ -703,48 +724,47 @@ export default {
cancelText: '否',
onOk() {
const index = that.locaGoodsStatus.indexOf(data.systemCode)
that.locaGoodsStatus.splice(index, 1)
that.details.goodsStatus.splice(index, 1)
that.details.goodsStatus.forEach((item, index2) => {
if (item.systemCode == data.systemCode) {
that.details.goodsStatus.splice(index2, 1)
}
})
that.savegoodsStatusItem(data, 'splice')
},
onCancel() {
console.log('Cancel')
return false
}
})
// this.$Modal.confirm({
// title: () => '?',
// icon: () => createVNode(ExclamationCircleOutlined),
// okText: () => '',
// okType: 'danger',
// cancelText: () => '',
// onOk() {
// },
// onCancel() {
// console.log('Cancel')
// return false
// }
// })
}
console.log('== 修改货物状态 ==', this.locaGoodsStatus, this.details.goodsStatus)
},
savegoodsStatusItem(data, type) {
let ApiData = {
bookingId: this.id,
item: this.details.goodsStatus
item: []
}
this.details.goodsStatus.forEach(item => {
if (item.finishTime) {
ApiData.item.push(item)
}
})
if (type == 'push') {
let date = new Date(+new Date() + 8 * 3600 * 1000)
ApiData.item[ApiData.item.length - 1].finishTime = date.toISOString()
ApiData.item.push({ ...data, finishTime: date.toISOString() })
}
console.log(ApiData)
BookingOrderSaveGoodsStatus(ApiData)
.then(res => {
if (res.success) {
// this.booGoodsStatusItem = ApiData.item
// this.$emit('upDateRight')
console.log('== 货物状态设置成功 ==')
if (type == 'push') {
this.details.goodsStatus.push({
...data,
finishTime: new Date(+new Date() + 8 * 3600 * 1000).toISOString()
})
}
}
})
.catch(err => {

@ -293,11 +293,11 @@ export default {
},
created() {},
watch: {
$route(to, form) {
if (to.path == '/CustomerInformationManagement') {
this.init()
}
}
// $route(to, form) {
// if (to.path == '/CustomerInformationManagement') {
// this.init()
// }
// }
},
mounted() {
this.init()

Loading…
Cancel
Save