落地陆运私聊文字询价:选项核对后再建单查价,并按线路拉产品进群。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 员工管理:对接主账 /inquiry/staffRole。
|
||||
* 企微 userid 可手工维护,也可点「同步企业微信」由主账 upsert(姓名/手机/部门)。
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import ProtoIcon from "/@/views/inquiry/components/ProtoIcon.vue";
|
||||
import AdminModal from "/@/views/inquiry/components/AdminModal.vue";
|
||||
import AdminPagination from "/@/views/inquiry/components/AdminPagination.vue";
|
||||
import { joinRoutes, parseRouteList } from "/@/views/inquiry/staffRole/staffRoutes";
|
||||
|
||||
type StaffRole = "sales" | "air" | "sea" | "land";
|
||||
|
||||
@@ -81,18 +82,6 @@ function isProductOrAir(role: StaffRole) {
|
||||
return role === "air" || role === "sea" || role === "land";
|
||||
}
|
||||
|
||||
function parseRouteList(raw: string): string[] {
|
||||
if (!raw || raw === "-") return [];
|
||||
return raw
|
||||
.split(/[/·,、]/)
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function joinRoutes(list: string[]) {
|
||||
return list.map((s) => s.trim()).filter(Boolean).join(",");
|
||||
}
|
||||
|
||||
const rows = ref<StaffRow[]>([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 员工管理「负责线路」拆合。
|
||||
*
|
||||
* 只按逗号/中文逗号/顿号拆整词,禁止把「中港/中亚/中欧」「国内长途/零担」按斜杠切开。
|
||||
* 陆运没有「陆运全线」快捷项。
|
||||
*/
|
||||
|
||||
/** 把库里的逗号串还原成多选项。空或占位「-」当没有。 */
|
||||
export function parseRouteList(raw: string): string[] {
|
||||
if (!raw || raw === "-") {
|
||||
return [];
|
||||
}
|
||||
return raw
|
||||
.split(/[,,、]+/)
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
/** 多选结果写回库:英文逗号拼接,与主账匹配规则一致。 */
|
||||
export function joinRoutes(list: string[]): string {
|
||||
return list.map((s) => s.trim()).filter(Boolean).join(",");
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { parseRouteList, joinRoutes } from "/@/views/inquiry/staffRole/staffRoutes";
|
||||
|
||||
test("keeps hongkong token", () => {
|
||||
expect(parseRouteList("中港/中亚/中欧,东南亚")).toEqual([
|
||||
"中港/中亚/中欧",
|
||||
"东南亚",
|
||||
]);
|
||||
});
|
||||
|
||||
test("join roundtrip", () => {
|
||||
const list = ["中港/中亚/中欧", "国内长途/零担"];
|
||||
expect(parseRouteList(joinRoutes(list))).toEqual(list);
|
||||
});
|
||||
Reference in New Issue
Block a user