|
@@ -2,7 +2,7 @@
|
|
|
<div class="w-[100vw] bg-white page-shipping-tracking2">
|
|
|
<div
|
|
|
v-loading="loading"
|
|
|
- class="pt-2 w-[100%] min-h-[100vh]"
|
|
|
+ class="pt-2 px-4 w-[100%] min-h-[100vh]"
|
|
|
>
|
|
|
<el-form inline>
|
|
|
<el-form-item label="Container Num">
|
|
@@ -42,6 +42,8 @@
|
|
|
搜索所有未处理申请
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
+ type="primary"
|
|
|
+ class="custom-button"
|
|
|
size="small"
|
|
|
:loading="loading"
|
|
|
@click="exportFunc"
|
|
@@ -49,6 +51,7 @@
|
|
|
导出Excel
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
+ disabled
|
|
|
class="custom-button"
|
|
|
type="primary"
|
|
|
size="small"
|
|
@@ -84,7 +87,6 @@
|
|
|
<el-table
|
|
|
:data="computedList"
|
|
|
max-height="550"
|
|
|
- stripe
|
|
|
size="small"
|
|
|
:row-style="calcRowStyle"
|
|
|
:row-class-name="
|
|
@@ -108,8 +110,14 @@
|
|
|
:prop="col.prop"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
+ <div v-if="col.prop === 'Urgent' && scope.row.Urgent !== null">
|
|
|
+ <el-checkbox
|
|
|
+ v-model="scope.row.Urgent"
|
|
|
+ disabled
|
|
|
+ ></el-checkbox>
|
|
|
+ </div>
|
|
|
<div v-if="col.prop === 'Owner'">
|
|
|
- {{ getName(scope.row.Owner.id) }}
|
|
|
+ {{ scope.row.Owner.name }}
|
|
|
</div>
|
|
|
|
|
|
<div v-if="col.prop === 'Client_Label_Links'">
|
|
@@ -141,11 +149,22 @@
|
|
|
</div>
|
|
|
|
|
|
<div v-if="col.prop === 'Courier'">
|
|
|
- <el-input
|
|
|
+ <el-select
|
|
|
v-model="scope.row.Courier"
|
|
|
@change="scope.row.editFlag = true"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
+ allow-create
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ label="SGL Transportation"
|
|
|
+ value="SGL Transportation"
|
|
|
+ ></el-option>
|
|
|
+ <el-option
|
|
|
+ label="Direct Freight"
|
|
|
+ value="Direct Freight"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</div>
|
|
|
<div v-if="col.prop === 'Tracking_No'">
|
|
|
<el-input
|
|
@@ -173,29 +192,19 @@ import {
|
|
|
ElTooltip,
|
|
|
ElButtonGroup,
|
|
|
ElMessage,
|
|
|
+ ElSelect,
|
|
|
+ ElOption,
|
|
|
+ ElCheckbox,
|
|
|
} from 'element-plus'
|
|
|
import cloneDeep from 'lodash.clonedeep'
|
|
|
import * as XLSX from 'xlsx'
|
|
|
+import request from '@/utils/axios'
|
|
|
|
|
|
defineComponent({
|
|
|
name: 'ComponentShippingTracking2',
|
|
|
})
|
|
|
let loading = ref(false)
|
|
|
let list = ref([] as any[])
|
|
|
-// @ts-ignore
|
|
|
-const zoho = window.ZOHO
|
|
|
-zoho.embeddedApp.on('PageLoad', function () {
|
|
|
- zoho.CRM.CONFIG.getCurrentUser().then(function (data: any) {
|
|
|
- if (Array.isArray(data.users) && data.users.length) {
|
|
|
- // const user = data.users[0]
|
|
|
- // console.log(user, 'user')
|
|
|
- // currentUser.value = user.id
|
|
|
- // currentUserName.value = user.full_name || ''
|
|
|
- // currentUserRawData.value = cloneDeep(user)
|
|
|
- getUserList()
|
|
|
- }
|
|
|
- })
|
|
|
-})
|
|
|
let containerNumber = ref('')
|
|
|
let soRef = ref('')
|
|
|
let tabList = ref([] as any)
|
|
@@ -205,27 +214,7 @@ let resetData = () => {
|
|
|
tabList.value = []
|
|
|
currentTab.value = ''
|
|
|
}
|
|
|
-let userList = ref(new Map())
|
|
|
-let getUserList = () => {
|
|
|
- return zoho.CRM.API.coql({
|
|
|
- select_query:
|
|
|
- 'select id,first_name,last_name,state from users where first_name is not null',
|
|
|
- }).then((res: any) => {
|
|
|
- if (Array.isArray(res.data) && res.data.length) {
|
|
|
- // userList.value = res.data
|
|
|
- res.data.forEach((i: any) => {
|
|
|
- userList.value.set(i.id, i)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
|
|
|
-let getName = (id: string) => {
|
|
|
- const temp = userList.value.get(id) || {}
|
|
|
- let firstName = temp.first_name || ''
|
|
|
- let lastName = temp.last_name || ''
|
|
|
- return firstName + ' ' + lastName
|
|
|
-}
|
|
|
const columnList = [
|
|
|
{ label: 'Urgent', prop: 'Urgent' },
|
|
|
{ label: 'REF', prop: 'SO_Reference', width: 140 },
|
|
@@ -278,6 +267,18 @@ const columnList = [
|
|
|
},
|
|
|
{ label: 'Courier', prop: 'Courier', width: 180, fixed: 'right' },
|
|
|
{ label: 'Tracking No', prop: 'Tracking_No', width: 180, fixed: 'right' },
|
|
|
+ { label: 'Receiver', prop: 'Receiver', width: 120 },
|
|
|
+ { label: 'Phone', prop: 'Phone', width: 120 },
|
|
|
+ {
|
|
|
+ label: 'Shipping Unit Building Name',
|
|
|
+ prop: 'Shipping_Unit_Building_Name',
|
|
|
+ width: 200,
|
|
|
+ },
|
|
|
+ { label: 'Shipping Street', prop: 'Shipping_Street', width: 180 },
|
|
|
+ { label: 'Shipping City', prop: 'Shipping_City', width: 180 },
|
|
|
+ { label: 'Shipping State', prop: 'Shipping_State', width: 120 },
|
|
|
+ { label: 'Shipping Code', prop: 'Shipping_Code', width: 120 },
|
|
|
+ { label: 'Shipping Country', prop: 'Shipping_Country', width: 120 },
|
|
|
]
|
|
|
|
|
|
// 这两个变量是用来记录 当前筛选tab的, 在保存成功之后刷新数据时重新选上这个tab.
|
|
@@ -301,30 +302,117 @@ let getList = (type = 1) => {
|
|
|
return
|
|
|
}
|
|
|
loading.value = true
|
|
|
- let sql =
|
|
|
- 'select ' +
|
|
|
- columnList.map((i: any) => `Shipping_Tracking.${i.prop}`).join(',') +
|
|
|
- ' from Shipping_Tracking '
|
|
|
|
|
|
- let whereSQL =
|
|
|
- " (Package_Type='SGL Package' and Confirm_send_to_Starshipit=true) "
|
|
|
+ let conditions: any = {
|
|
|
+ title: 'Shipping_Tracking',
|
|
|
+ comm: {},
|
|
|
+ }
|
|
|
|
|
|
if (type === 2) {
|
|
|
- sql += ' where (Tracking_No is null or Courier is null) and' + whereSQL
|
|
|
+ conditions.comm = {
|
|
|
+ group_operator: 'and',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ group_operator: 'or',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ group_operator: 'and',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ field: { api_name: 'Tracking_No' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: '${EMPTY}',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Courier' },
|
|
|
+ comparator: 'not_equal',
|
|
|
+ value: 'SGL Transportation',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Package_Status' },
|
|
|
+ comparator: 'not_equal',
|
|
|
+ value: 'Delivered',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group_operator: 'and',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ field: { api_name: 'Courier' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: '${EMPTY}',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Package_Status' },
|
|
|
+ comparator: 'not_equal',
|
|
|
+ value: 'Delivered',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Package_Type' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: ['SGL Package'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Confirm_send_to_Starshipit' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
} else if (soRef.value) {
|
|
|
- sql = sql + ` where (SO_Reference like '%${soRef.value}%') and` + whereSQL
|
|
|
+ conditions.comm = {
|
|
|
+ group_operator: 'and',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ field: { api_name: 'SO_Reference' },
|
|
|
+ comparator: 'contains',
|
|
|
+ value: soRef.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Package_Type' },
|
|
|
+ comparator: 'contains',
|
|
|
+ value: ['SGL Package'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Confirm_send_to_Starshipit' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
} else if (containerNumber.value) {
|
|
|
- sql +=
|
|
|
- ` where (Container_Number like '%${containerNumber.value}%') and` +
|
|
|
- whereSQL
|
|
|
- } else {
|
|
|
- sql += ' where ' + whereSQL
|
|
|
+ conditions.comm = {
|
|
|
+ group_operator: 'and',
|
|
|
+ group: [
|
|
|
+ {
|
|
|
+ field: { api_name: 'Container_Number' },
|
|
|
+ comparator: 'contains',
|
|
|
+ value: containerNumber.value, // 替换为 containerNumber.value
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Package_Type' },
|
|
|
+ comparator: 'contains',
|
|
|
+ value: ['SGL Package'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: { api_name: 'Confirm_send_to_Starshipit' },
|
|
|
+ comparator: 'equal',
|
|
|
+ value: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- return zoho.CRM.API.coql({
|
|
|
- select_query: sql,
|
|
|
- })
|
|
|
- .then((res: any) => {
|
|
|
+ request
|
|
|
+ .post('/common/getPublicListsAll', conditions)
|
|
|
+ .then((resp: any) => {
|
|
|
+ console.log(resp, 'resp')
|
|
|
+ const res = resp.data.result || {}
|
|
|
if (Array.isArray(res.data) && res.data.length) {
|
|
|
list.value = res.data.map((i: any) => {
|
|
|
return {
|
|
@@ -370,14 +458,13 @@ let getList = (type = 1) => {
|
|
|
loading.value = false
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
let computedList = computed(() =>
|
|
|
currentTab.value
|
|
|
? list.value.filter((i) => i.Container_Number === currentTab.value)
|
|
|
: list.value.filter((i) => ['', 'null', null].includes(i.Container_Number)),
|
|
|
)
|
|
|
-zoho.embeddedApp.init()
|
|
|
-// 给表格加红绿背景. 颜色用的tailwind的 red green
|
|
|
+
|
|
|
+// 给表格加背景. 颜色用的tailwind的 green
|
|
|
const calcRowStyle = ($e: any) => {
|
|
|
const result = {} as any
|
|
|
if ($e.row.editFlag) result['background-color'] = 'rgb(187, 247, 208)'
|
|
@@ -398,7 +485,7 @@ let exportFunc = () => {
|
|
|
let result = {
|
|
|
...cloneDeep(i),
|
|
|
Urgent: `${i.Urgent}`,
|
|
|
- Owner: getName(i.Owner.id),
|
|
|
+ Owner: i.Owner.name,
|
|
|
}
|
|
|
delete result.id
|
|
|
delete result.editFlag
|
|
@@ -437,14 +524,14 @@ const commit = () => {
|
|
|
editFlag: i.editFlag,
|
|
|
index,
|
|
|
id: i.id,
|
|
|
- Courier: i.Courier.trim(),
|
|
|
- Tracking_No: i.Tracking_No.trim(),
|
|
|
+ Courier: i.Courier?.trim() || '',
|
|
|
+ Tracking_No: i.Tracking_No?.trim() || '',
|
|
|
}
|
|
|
})
|
|
|
// console.log(data, 'data')
|
|
|
let data2 = data.filter((i) => i.editFlag)
|
|
|
// console.log(data2, 'data2')
|
|
|
- loading.value = true
|
|
|
+ /*loading.value = true
|
|
|
zoho.CRM.API.updateRecord({
|
|
|
Entity: 'Shipping_Tracking',
|
|
|
Trigger: ['workflow'],
|
|
@@ -510,7 +597,7 @@ const commit = () => {
|
|
|
})
|
|
|
.finally(() => {
|
|
|
loading.value = false
|
|
|
- })
|
|
|
+ })*/
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|