|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
<el-tabs v-model="currentTab">
|
|
|
<el-tab-pane
|
|
|
- v-for="tab in tabs"
|
|
|
+ v-for="tab in finalTabs"
|
|
|
:key="tab.value"
|
|
|
:label="tab.label"
|
|
|
:name="tab.value"
|
|
@@ -138,7 +138,30 @@
|
|
|
{{ currentRow.Name }}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex flex-wrap min-w-[800px]">
|
|
|
+ <div class="flex flex-wrap min-w-[800px] mr-2">
|
|
|
+ <el-input
|
|
|
+ v-if="
|
|
|
+ currentTab === 'Arrangement' &&
|
|
|
+ ['可用', '已截仓'].includes(currentRow.Status) &&
|
|
|
+ [
|
|
|
+ '4791186000259693001',
|
|
|
+ '4791186000022965001',
|
|
|
+ '4791186000052269001',
|
|
|
+ ].includes(currentUser)
|
|
|
+ "
|
|
|
+ style="width: 200px; height: 24px; margin-right: 10px"
|
|
|
+ size="small"
|
|
|
+ v-model="bookingNumber"
|
|
|
+ >
|
|
|
+ <template #append>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ @click="updateBookingNumber"
|
|
|
+ >
|
|
|
+ 更新订舱号
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
<el-button
|
|
|
v-if="
|
|
|
['可用', '已截仓'].includes(currentRow.Status) &&
|
|
@@ -155,21 +178,21 @@
|
|
|
确认集货
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="currentTab === 'my_request'"
|
|
|
+ v-if="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
size="small"
|
|
|
@click="addBulkProduct"
|
|
|
>
|
|
|
- Submit Bulk Production Request
|
|
|
+ 提交大货集货申请
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="currentTab === 'my_request'"
|
|
|
+ v-if="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
size="small"
|
|
|
@click="addSample"
|
|
|
>
|
|
|
- Submit Sample Request
|
|
|
+ 提交样品集货申请
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="currentTab === 'my_request'"
|
|
|
+ v-if="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
:disabled="subList.length < 1"
|
|
|
size="small"
|
|
|
type="danger"
|
|
@@ -182,21 +205,21 @@
|
|
|
:disabled="subList.length < 1"
|
|
|
@click="exportSubTable"
|
|
|
>
|
|
|
- Export Excel File
|
|
|
+ 导出Excel文档
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="currentTab === 'my_request'"
|
|
|
+ v-if="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
:disabled="subList.length < 1"
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
class="custom-button small"
|
|
|
@click="commit"
|
|
|
>
|
|
|
- Commit
|
|
|
+ 保存更改
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex justify-between min-w-[350px]">
|
|
|
+ <div class="flex flex-wrap min-w-[380px] gap-2">
|
|
|
<div class="flex">总重量: {{ computedWeight }}</div>
|
|
|
<div class="flex">总体积: {{ computedCube }}</div>
|
|
|
<div class="flex">总离岸价: {{ computedTotalFOB }}</div>
|
|
@@ -351,10 +374,11 @@
|
|
|
label="负责人"
|
|
|
fixed="right"
|
|
|
width="120"
|
|
|
+ prop="Sales_Person"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.Requester.name"
|
|
|
+ v-model="scope.row.Sales_Person"
|
|
|
size="small"
|
|
|
disabled
|
|
|
></el-input>
|
|
@@ -364,18 +388,17 @@
|
|
|
label="申请人"
|
|
|
fixed="right"
|
|
|
width="120"
|
|
|
- prop="Sales_Person"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.Sales_Person"
|
|
|
+ v-model="scope.row.Requester.name"
|
|
|
size="small"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-show="currentTab === 'my_request'"
|
|
|
+ v-show="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
fixed="right"
|
|
|
label="更新时间"
|
|
|
width="90"
|
|
@@ -400,14 +423,14 @@
|
|
|
"
|
|
|
fixed="right"
|
|
|
label="操作"
|
|
|
- width="85"
|
|
|
+ width="90"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
<el-tooltip
|
|
|
content="新增未commit的行会被直接移除; 已commit的行只会标记, 正式commit后才会删除"
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="currentTab === 'my_request'"
|
|
|
+ v-if="['Arrangement', 'my_request'].includes(currentTab)"
|
|
|
type="danger"
|
|
|
size="small"
|
|
|
link
|
|
@@ -540,6 +563,7 @@ defineComponent({
|
|
|
|
|
|
const currentUser = ref('')
|
|
|
const currentUserName = ref('')
|
|
|
+const currentUserRawData = ref({} as any)
|
|
|
let loading = ref(false)
|
|
|
let list = ref([] as any[])
|
|
|
let currentTab = ref('all')
|
|
@@ -562,6 +586,10 @@ let tabs = [
|
|
|
value: 'my_request',
|
|
|
},
|
|
|
]
|
|
|
+
|
|
|
+let finalTabs = ref([] as any[])
|
|
|
+finalTabs.value = cloneDeep(tabs)
|
|
|
+
|
|
|
let computedList = computed(() => {
|
|
|
return list.value.filter((i: any) => {
|
|
|
let condition = true
|
|
@@ -679,7 +707,7 @@ const generateSubList = () => {
|
|
|
(i: any) =>
|
|
|
i.Parent_Id.id === currentRow.value.id &&
|
|
|
(currentTab.value === 'my_request'
|
|
|
- ? i.Sales_Person === currentUserName.value
|
|
|
+ ? i.Requester.id === currentUser.value
|
|
|
: true),
|
|
|
)
|
|
|
.map((i: any) => ({
|
|
@@ -794,6 +822,10 @@ const goodMaterialOption = ref([
|
|
|
'PVC 聚氯乙烯',
|
|
|
'Velvet 天鹅绒',
|
|
|
'Zinc alloy 锌合金',
|
|
|
+ 'Aluminum alloy 铝合金',
|
|
|
+ 'Glass 玻璃',
|
|
|
+ 'Rubber 橡胶',
|
|
|
+ 'Stainless Steel 不锈钢',
|
|
|
])
|
|
|
|
|
|
const addBulkProduct = () => {
|
|
@@ -1080,6 +1112,47 @@ const ensure = () => {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
+let bookingNumber = ref('')
|
|
|
+const updateBookingNumber = () => {
|
|
|
+ bookingNumber.value = bookingNumber.value.trim()
|
|
|
+ if (!bookingNumber.value || !currentRow.value.id) {
|
|
|
+ ElMessage.error('请填写订舱号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ loading.value = true
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ `确定要把该记录的订舱号更新为"${bookingNumber.value}"吗?`,
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ },
|
|
|
+ ).then(() => {
|
|
|
+ zoho.CRM.API.updateRecord({
|
|
|
+ Entity: 'Sea_Freight_Table',
|
|
|
+ Trigger: ['workflow'],
|
|
|
+ APIData: {
|
|
|
+ id: currentRow.value.id,
|
|
|
+ Booking_Number: bookingNumber.value,
|
|
|
+ },
|
|
|
+ }).then((res: any) => {
|
|
|
+ if (
|
|
|
+ Array.isArray(res.data) &&
|
|
|
+ res.data.length &&
|
|
|
+ res.data[0].code === 'SUCCESS'
|
|
|
+ ) {
|
|
|
+ ElMessage.success('操作成功, 正在刷新数据')
|
|
|
+ loading.value = false
|
|
|
+ getList()
|
|
|
+ clearSubList()
|
|
|
+ } else {
|
|
|
+ loading.value = false
|
|
|
+ ElMessage.error('操作失败, 请稍后再试或者联系管理员')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// @ts-ignore
|
|
|
const zoho = window.ZOHO
|
|
|
zoho.embeddedApp.on('PageLoad', function () {
|
|
@@ -1089,30 +1162,50 @@ zoho.embeddedApp.on('PageLoad', function () {
|
|
|
// console.log(user, 'user')
|
|
|
currentUser.value = user.id
|
|
|
currentUserName.value = user.full_name || ''
|
|
|
+ currentUserRawData.value = cloneDeep(user)
|
|
|
getList()
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
|
|
|
zoho.embeddedApp.init()
|
|
|
+watch(currentUserRawData, () => {
|
|
|
+ if (!currentUserRawData.value.role) return false
|
|
|
+
|
|
|
+ let result = currentUserRawData.value.role.name.indexOf('Logistics') === -1
|
|
|
+
|
|
|
+ if (result) {
|
|
|
+ finalTabs.value = cloneDeep(tabs)
|
|
|
+ finalTabs.value.push({
|
|
|
+ label: 'Arrangement',
|
|
|
+ value: 'Arrangement',
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
let computedWeight = computed(() => {
|
|
|
- return subList.value.reduce((t, c) => {
|
|
|
- t = t + Number(c.Weight)
|
|
|
- return t
|
|
|
- }, 0)
|
|
|
+ return subList.value
|
|
|
+ .reduce((t, c) => {
|
|
|
+ t = t + Number(c.Weight)
|
|
|
+ return t
|
|
|
+ }, 0)
|
|
|
+ .toFixed(2)
|
|
|
})
|
|
|
let computedCube = computed(() => {
|
|
|
- return subList.value.reduce((t, c) => {
|
|
|
- t = t + Number(c.Cube)
|
|
|
- return t
|
|
|
- }, 0)
|
|
|
+ return subList.value
|
|
|
+ .reduce((t, c) => {
|
|
|
+ t = t + Number(c.Cube)
|
|
|
+ return t
|
|
|
+ }, 0)
|
|
|
+ .toFixed(2)
|
|
|
})
|
|
|
let computedTotalFOB = computed(() => {
|
|
|
- return subList.value.reduce((t, c) => {
|
|
|
- t = t + Number(c.Total_FOB)
|
|
|
- return t
|
|
|
- }, 0)
|
|
|
+ return subList.value
|
|
|
+ .reduce((t, c) => {
|
|
|
+ t = t + Number(c.Total_FOB)
|
|
|
+ return t
|
|
|
+ }, 0)
|
|
|
+ .toFixed(2)
|
|
|
})
|
|
|
|
|
|
// 订单轨迹地图插件
|