feat: default properties type
This commit is contained in:
parent
ee5717c609
commit
8a49fcf76a
3 changed files with 107 additions and 49 deletions
|
|
@ -1179,178 +1179,221 @@
|
||||||
"servicePropertiesField": [
|
"servicePropertiesField": [
|
||||||
{
|
{
|
||||||
"label": "บันทึกบริการ_Name",
|
"label": "บันทึกบริการ_Name",
|
||||||
"value": "serviceRecordName"
|
"value": "serviceRecordName",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "RN_บันทึกบริการ",
|
"label": "RN_บันทึกบริการ",
|
||||||
"value": "serviceRecordRN"
|
"value": "serviceRecordRN",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานะคนงาน",
|
"label": "สถานะคนงาน",
|
||||||
"value": "workerStatus"
|
"value": "workerStatus",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ช่องทางการการติดต่อ",
|
"label": "ช่องทางการการติดต่อ",
|
||||||
"value": "contactChannel"
|
"value": "contactChannel",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Quotation No.",
|
"label": "Quotation No.",
|
||||||
"value": "quotationNo"
|
"value": "quotationNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "วันที่รับงาน",
|
"label": "วันที่รับงาน",
|
||||||
"value": "startDate"
|
"value": "startDate",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "โปรเจ็ค",
|
"label": "โปรเจ็ค",
|
||||||
"value": "project"
|
"value": "project",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ลูกจ้าง",
|
"label": "ลูกจ้าง",
|
||||||
"value": "employee"
|
"value": "employee",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "นายจ้าง",
|
"label": "นายจ้าง",
|
||||||
"value": "employer"
|
"value": "employer",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "เขตพื้นที่จัดหางาน",
|
"label": "เขตพื้นที่จัดหางาน",
|
||||||
"value": "area"
|
"value": "area",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ลงชื่อผู้ขาย",
|
"label": "ลงชื่อผู้ขาย",
|
||||||
"value": "sellerSignature"
|
"value": "sellerSignature",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "นายหน้า",
|
"label": "นายหน้า",
|
||||||
"value": "agent"
|
"value": "agent",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ผู้ติดต่อ",
|
"label": "ผู้ติดต่อ",
|
||||||
"value": "contactPerson"
|
"value": "contactPerson",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "อีเมล์ผู้ติดต่อ",
|
"label": "อีเมล์ผู้ติดต่อ",
|
||||||
"value": "email"
|
"value": "email",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "เบอร์โทรผู้ติดต่อ",
|
"label": "เบอร์โทรผู้ติดต่อ",
|
||||||
"value": "telephone"
|
"value": "telephone",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "เอเจนซี่",
|
"label": "เอเจนซี่",
|
||||||
"value": "agency"
|
"value": "agency",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "หมายเหตุ",
|
"label": "หมายเหตุ",
|
||||||
"value": "remark"
|
"value": "remark",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ลงชื่อผู้บันทึกข้อมูล",
|
"label": "ลงชื่อผู้บันทึกข้อมูล",
|
||||||
"value": "recordBy"
|
"value": "recordBy",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"workPropertiesField": [
|
"workPropertiesField": [
|
||||||
{
|
{
|
||||||
"label": "Ref No:",
|
"label": "Ref No:",
|
||||||
"value": "refNo"
|
"value": "refNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ใบสั่งงานเลขที่ (TO)",
|
"label": "ใบสั่งงานเลขที่ (TO)",
|
||||||
"value": "workOrderNo"
|
"value": "workOrderNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "วันที่สั่งซื้อ (TO)",
|
"label": "วันที่สั่งซื้อ (TO)",
|
||||||
"value": "orderDate"
|
"value": "orderDate",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ใบรับสินค้าเลขที่ (TR)",
|
"label": "ใบรับสินค้าเลขที่ (TR)",
|
||||||
"value": "productReceiptNo"
|
"value": "productReceiptNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "วันที่รับสินค้า (TR)",
|
"label": "วันที่รับสินค้า (TR)",
|
||||||
"value": "productReceiptDate"
|
"value": "productReceiptDate",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานะงาน",
|
"label": "สถานะงาน",
|
||||||
"value": "workStatus"
|
"value": "workStatus",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "หมายเหตุ",
|
"label": "หมายเหตุ",
|
||||||
"value": "remark"
|
"value": "remark",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "เลขที่ รง.",
|
"label": "เลขที่ รง.",
|
||||||
"value": "factoryNo"
|
"value": "factoryNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ลงวันที่",
|
"label": "ลงวันที่",
|
||||||
"value": "dateIssued"
|
"value": "dateIssued",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ประเภท (การดำเนินการของประเทศต้นทาง)",
|
"label": "ประเภท (การดำเนินการของประเทศต้นทาง)",
|
||||||
"value": "typeOriginCountryOperation"
|
"value": "typeOriginCountryOperation",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ช่องทางการจัดส่ง",
|
"label": "ช่องทางการจัดส่ง",
|
||||||
"value": "deliveryChannel"
|
"value": "deliveryChannel",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Name list No.",
|
"label": "Name list No.",
|
||||||
"value": "nameListNo"
|
"value": "nameListNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานที่ประกันสุขภาพ",
|
"label": "สถานที่ประกันสุขภาพ",
|
||||||
"value": "insuranceLocation"
|
"value": "insuranceLocation",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ประเภท (ยื่นขอประกันสุขภาพคนต่างด้าว)",
|
"label": "ประเภท (ยื่นขอประกันสุขภาพคนต่างด้าว)",
|
||||||
"value": "typeForeignInsurance"
|
"value": "typeForeignInsurance",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ประเภท (ยื่นขอใบอนุญาตทำงานแทนคนต่างด้าว)",
|
"label": "ประเภท (ยื่นขอใบอนุญาตทำงานแทนคนต่างด้าว)",
|
||||||
"value": "typePermitWorkBehalf"
|
"value": "typePermitWorkBehalf",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "วันที่นัดรับเอกสาร",
|
"label": "วันที่นัดรับเอกสาร",
|
||||||
"value": "docPickupDate"
|
"value": "docPickupDate",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Calling Visa No.",
|
"label": "Calling Visa No.",
|
||||||
"value": "callVisaNo"
|
"value": "callVisaNo",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ด่านที่คนงานเดินทาง",
|
"label": "ด่านที่คนงานเดินทาง",
|
||||||
"value": "checkpoint"
|
"value": "checkpoint",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "วันที่เดินทาง",
|
"label": "วันที่เดินทาง",
|
||||||
"value": "travelDate"
|
"value": "travelDate",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานที่ตรวจสุขภาพ",
|
"label": "สถานที่ตรวจสุขภาพ",
|
||||||
"value": "healthCheckupLocation"
|
"value": "healthCheckupLocation",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานที่แจ้งที่พักอาศัย",
|
"label": "สถานที่แจ้งที่พักอาศัย",
|
||||||
"value": "residenceLocation"
|
"value": "residenceLocation",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "รายงานตัว 90 วัน ครั้งต่อไป",
|
"label": "รายงานตัว 90 วัน ครั้งต่อไป",
|
||||||
"value": "next90Days"
|
"value": "next90Days",
|
||||||
|
"type": "date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ช่องทางในการจัดส่งเอกสาร",
|
"label": "ช่องทางในการจัดส่งเอกสาร",
|
||||||
"value": "docDeliveryChannel"
|
"value": "docDeliveryChannel",
|
||||||
|
"type": "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "สถานะส่งมอบ",
|
"label": "สถานะส่งมอบ",
|
||||||
"value": "deliveryStatus"
|
"value": "deliveryStatus",
|
||||||
|
"type": "array"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "ประเภท 90 วัน",
|
"label": "ประเภท 90 วัน",
|
||||||
"value": "type90Days"
|
"value": "type90Days",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Option } from 'src/stores/options/types';
|
import { Option } from 'src/stores/options/types';
|
||||||
import { Attributes } from 'src/stores/product-service/types';
|
import { AdditionalType, Attributes } from 'src/stores/product-service/types';
|
||||||
import { moveItemUp, moveItemDown, deleteItem, dialog } from 'src/stores/utils';
|
import { moveItemUp, moveItemDown, deleteItem, dialog } from 'src/stores/utils';
|
||||||
|
|
||||||
import NoData from '../NoData.vue';
|
import NoData from '../NoData.vue';
|
||||||
|
|
@ -47,7 +47,7 @@ const typeOption = ref([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function manageProperties(properties?: string) {
|
function manageProperties(properties?: string, type?: string | AdditionalType) {
|
||||||
if (properties === 'all' && propertiesOption.value) {
|
if (properties === 'all' && propertiesOption.value) {
|
||||||
if (
|
if (
|
||||||
formServiceProperties.value?.additional.length ===
|
formServiceProperties.value?.additional.length ===
|
||||||
|
|
@ -63,7 +63,7 @@ function manageProperties(properties?: string) {
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
formServiceProperties.value?.additional.push({
|
formServiceProperties.value?.additional.push({
|
||||||
fieldName: ops.value,
|
fieldName: ops.value,
|
||||||
type: null,
|
type: ops.type as AdditionalType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -80,7 +80,7 @@ function manageProperties(properties?: string) {
|
||||||
} else {
|
} else {
|
||||||
formServiceProperties.value.additional.push({
|
formServiceProperties.value.additional.push({
|
||||||
fieldName: properties ?? null,
|
fieldName: properties ?? null,
|
||||||
type: null,
|
type: type as AdditionalType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,6 +95,20 @@ function shouldShowItem(opt: Option) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeType(val: string) {
|
||||||
|
if (!propertiesOption.value) return;
|
||||||
|
|
||||||
|
const newType = propertiesOption.value.find((op) => op.value === val)?.type;
|
||||||
|
if (!newType) return;
|
||||||
|
|
||||||
|
const additionalField = formServiceProperties.value?.additional.find(
|
||||||
|
(l) => l.fieldName === val,
|
||||||
|
);
|
||||||
|
if (!additionalField) return;
|
||||||
|
|
||||||
|
additionalField.type = newType as AdditionalType;
|
||||||
|
}
|
||||||
|
|
||||||
function confirmDelete(items: unknown[], index: number) {
|
function confirmDelete(items: unknown[], index: number) {
|
||||||
dialog({
|
dialog({
|
||||||
color: 'negative',
|
color: 'negative',
|
||||||
|
|
@ -149,7 +163,7 @@ function confirmDelete(items: unknown[], index: number) {
|
||||||
v-for="(ops, index) in propertiesOption"
|
v-for="(ops, index) in propertiesOption"
|
||||||
clickable
|
clickable
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="manageProperties(ops.value)"
|
@click="manageProperties(ops.value, ops.type)"
|
||||||
>
|
>
|
||||||
<div class="full-width flex items-center">
|
<div class="full-width flex items-center">
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -243,6 +257,7 @@ function confirmDelete(items: unknown[], index: number) {
|
||||||
option-value="value"
|
option-value="value"
|
||||||
:options="propertiesOption"
|
:options="propertiesOption"
|
||||||
v-model="p.fieldName"
|
v-model="p.fieldName"
|
||||||
|
@update:model-value="changeType"
|
||||||
>
|
>
|
||||||
<template v-slot:option="scope">
|
<template v-slot:option="scope">
|
||||||
<q-item
|
<q-item
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export type Option = { label: string; value: string };
|
export type Option = { label: string; value: string; type?: string };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue