diff --git a/src/apis/asset/index.js b/src/apis/asset/index.js index b45fbc3..91a9098 100644 --- a/src/apis/asset/index.js +++ b/src/apis/asset/index.js @@ -17,8 +17,8 @@ import instance from "@/util/request"; import apihandler from "@/util/apihandler"; import { object } from "yup"; -export const getAssetSubList = async () => { - const res = await instance.post(GET_ASSET_SUB_LIST_API); +export const getAssetSubList = async (variable_id) => { + const res = await instance.post(GET_ASSET_SUB_LIST_API, { variable_id }); return apihandler(res.code, res.data, { msg: res.msg, diff --git a/src/apis/operation/index.js b/src/apis/operation/index.js index e7ab25c..c7c9d1b 100644 --- a/src/apis/operation/index.js +++ b/src/apis/operation/index.js @@ -6,6 +6,7 @@ import { POST_OPERATION_RECORD_API, GET_OPERATION_EXPORT_API, GET_OPERATION_FORMID_API, + DELETE_OPERATION_RECORD_API, POST_OPERATION_COMPANY_API, UPDATE_OPERATION_COMPANY_API, DELETE_OPERATION_COMPANY_API, @@ -23,10 +24,10 @@ export const getOperationRecord = async ({ }) => { const res = await instance.post(GET_OPERATION_RECORD_API, { work_type: parseInt(work_type), - start_created_at: dayjs(start_created_at).format("YYYY-MM-DDTHH:mm:ss"), - end_created_at: dayjs(end_created_at) - .date(dayjs(end_created_at).get("date") + 1) - .format("YYYY-MM-DDTHH:mm:ss"), + // start_created_at: dayjs(start_created_at).format("YYYY-MM-DDTHH:mm:ss"), + // end_created_at: dayjs(end_created_at) + // .date(dayjs(end_created_at).get("date") + 1) + // .format("YYYY-MM-DDTHH:mm:ss"), serial_number: serial_number || null, main_system_tag: null, sub_system_tag: diff --git a/src/components/customUI/Toast.vue b/src/components/customUI/Toast.vue index 4029dd5..cf312e9 100644 --- a/src/components/customUI/Toast.vue +++ b/src/components/customUI/Toast.vue @@ -37,7 +37,7 @@ watch( role="alert" :class=" twMerge( - `alert text-xl rounded-md absolute left-1/2 -translate-x-1/2 top-5 z-[1000] max-w-fit`, + `alert text-xl rounded-md fixed left-1/2 -translate-x-1/2 top-24 z-[1000] max-w-fit`, status === 'info' ? 'alert-info' : status === 'error' diff --git a/src/config/cn.json b/src/config/cn.json index 77aec9f..cf6558b 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -160,6 +160,7 @@ "start_time": "预计开始时间", "upload": "档案上传", "finish_time": "完成时间", + "updated_time": "更新时间", "operation": "功能", "vendor": "厂商", "contact_person": "联络人", @@ -281,6 +282,7 @@ "email_format": "请输入正确 Email 地址", "password_format": "密码长度至少8码,必须包含英文及数字", "start_time_placeholder": "请输入预计开始日期", + "finish_time_placeholder": "请输入完成日期", "rename": "重新命名", "download": "下载", "confirm": "确认", diff --git a/src/config/tw.json b/src/config/tw.json index d4bd684..23f0e5b 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -160,6 +160,7 @@ "start_time": "預計開始時間", "upload": "檔案上傳", "finish_time": "完成時間", + "updated_time": "更新時間", "operation": "功能", "vendor": "廠商", "contact_person": "聯絡人", @@ -281,6 +282,7 @@ "email_format": "請輸入正確的 Email 地址", "password_format": "密碼長度至少8碼,必須包含英文及數字", "start_time_placeholder": "請輸入預計開始日期", + "finish_time_placeholder": "請輸入完成日期", "rename": "重新命名", "download": "下載", "confirm": "確認", diff --git a/src/config/us.json b/src/config/us.json index 8088271..686c343 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -160,6 +160,7 @@ "start_time": "Estimated Start Time", "upload": "File Upload", "finish_time": "Completion Time", + "updated_time": "Update Time", "operation": "Function", "vendor": "Company", "contact_person": "Contact Person", @@ -281,6 +282,7 @@ "email_format": "Please enter correct email address", "password_format": "The password must be at least 8 characters long and must contain English and numbers.", "start_time_placeholder": "Please enter expected start date", + "finish_time_placeholder": "Please enter completion date", "rename": "Rename", "download": "Download", "confirm": "Confirm", diff --git a/src/views/AssetManagement/AssetManagement.vue b/src/views/AssetManagement/AssetManagement.vue index 7a17e06..ef9cf35 100644 --- a/src/views/AssetManagement/AssetManagement.vue +++ b/src/views/AssetManagement/AssetManagement.vue @@ -1,4 +1,5 @@ @@ -7,6 +8,7 @@ import AssetTable from "./components/AssetTable.vue";

{{ $t("assetManagement.title") }}

+ diff --git a/src/views/AssetManagement/components/AssetMainList.vue b/src/views/AssetManagement/components/AssetMainList.vue new file mode 100644 index 0000000..6ac1b73 --- /dev/null +++ b/src/views/AssetManagement/components/AssetMainList.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/src/views/AssetManagement/components/AssetSubList.vue b/src/views/AssetManagement/components/AssetSubList.vue index a5594e7..fb21c15 100644 --- a/src/views/AssetManagement/components/AssetSubList.vue +++ b/src/views/AssetManagement/components/AssetSubList.vue @@ -8,9 +8,9 @@ import AssetSubListAddModal from "./AssetSubListAddModal.vue"; const { searchParams, changeParams } = useSearchParam(); const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn(); -const getSubSystems = async () => { - const res = await getAssetSubList(); - const sub = res.data.map((d, index) => ({ +const getSubSystems = async (id) => { + const res = await getAssetSubList(id); + sub = res.data.map((d, index) => ({ ...d, title: d.system_key, key: d.id, @@ -21,14 +21,27 @@ const getSubSystems = async () => { setItems(sub); }; -onMounted(() => { - getSubSystems(); -}); +onMounted(() => {}); watch(selectedBtn, (newValue) => { - changeParams({ subSys_id: newValue.key }); + changeParams({ + ...searchParams.value, + subSys_id: newValue.key, + }); }); +watch( + () => searchParams, + (newValue) => { + if(newValue.value.mainSys_id){ + getSubSystems(newValue.value.mainSys_id); + } + }, + { + deep: true, + } +); + const editRecord = ref(null); // 編輯 modal const openModal = () => { @@ -58,20 +71,24 @@ const deleteItem = async (id) => { :getData="getSubList" :editRecord="editRecord" /> --> - - - + + + diff --git a/src/views/history/components/HistoryActionButton.vue b/src/views/history/components/HistoryActionButton.vue index 6ac9b90..83c5d8b 100644 --- a/src/views/history/components/HistoryActionButton.vue +++ b/src/views/history/components/HistoryActionButton.vue @@ -84,15 +84,15 @@ const submitBtns = computed(() => [ btn: "btn-search", disabled: isSearchButtonDisabled.value, }, - { - title: t("button.export"), - key: "export", - icon: "download", - btn: "btn-export", - active: false, - onClick: (e) => submit(e, "export"), - disabled: isSearchButtonDisabled.value, - }, + // { + // title: t("button.export"), + // key: "export", + // icon: "download", + // btn: "btn-export", + // active: false, + // onClick: (e) => submit(e, "export"), + // disabled: isSearchButtonDisabled.value, + // }, ]); const once = ref(false); diff --git a/src/views/operation/Operation.vue b/src/views/operation/Operation.vue index b75fa1c..15bf0d3 100644 --- a/src/views/operation/Operation.vue +++ b/src/views/operation/Operation.vue @@ -26,6 +26,9 @@ const updateDataSource = (data) => { finish_time: d?.finish_time ? dayjs(d?.finish_time).format("YYYY-MM-DD") : "", + updated_at: d?.updated_at + ? dayjs(d?.updated_at).format("YYYY-MM-DD") + : "", })); }; @@ -59,7 +62,7 @@ const getModalDevList = async () => { device_building_tag: store.buildings[0].building_tag, device_area_tag: "NTPC", }); - return res.data.map((d) => ({ ...d, key: d.device_number })); + return res.data.map((d) => ({ ...d, key: d.main_id })); }; const getNewFormId = async (id = "") => { if (!id) { @@ -102,7 +105,9 @@ const getAllOptions = async (id = "") => { const openModal = async (id = "") => { console.log("open modal", id); - getAllOptions(id); + if(searchParams.value?.work_type < 3){ + getAllOptions(id); + } operation_action_item.showModal(); }; diff --git a/src/views/operation/components/OperationActionButton.vue b/src/views/operation/components/OperationActionButton.vue index 2128ec1..21f1eef 100644 --- a/src/views/operation/components/OperationActionButton.vue +++ b/src/views/operation/components/OperationActionButton.vue @@ -37,15 +37,15 @@ const submitBtns = computed(() => [ onClick: search, disabled: isSearchDisabled.value, }, - { - title: t("button.export"), - key: "export", - icon: "download", - btn: "btn-export", - active: false, - onClick: exportFile, - disabled: isSearchDisabled.value, - }, + // { + // title: t("button.export"), + // key: "export", + // icon: "download", + // btn: "btn-export", + // active: false, + // onClick: exportFile, + // disabled: isSearchDisabled.value, + // }, ]); const once = ref(true); diff --git a/src/views/operation/components/OperationSearch.vue b/src/views/operation/components/OperationSearch.vue index 4b8cf2b..b94375e 100644 --- a/src/views/operation/components/OperationSearch.vue +++ b/src/views/operation/components/OperationSearch.vue @@ -6,8 +6,8 @@ import OperationSearchSubSys from "./OperationSearchSubSys.vue"; import OperationActionButton from "./OperationActionButton.vue"; import useSearchParam from "@/hooks/useSearchParam"; import { twMerge } from "tailwind-merge"; -import { useI18n } from 'vue-i18n'; -const { t, locale } = useI18n(); +import { useI18n } from "vue-i18n"; +const { t, locale } = useI18n(); const { searchParams, changeParams } = useSearchParam(); const { search } = inject("operation_table"); @@ -30,7 +30,7 @@ const { const setButtonItems = () => { setWorkTypesItems([ { - title: t('operation.repair'), + title: t("operation.repair"), key: "fix", active: searchParams.value.work_type === "2" || !searchParams.value.work_type, @@ -38,14 +38,14 @@ const setButtonItems = () => { params: ["work_type", "sub_system_tag"], }, { - title: t('operation.maintenance'), + title: t("operation.maintenance"), key: "maintain", active: searchParams.value.work_type === "1", work_type: 1, params: ["work_type", "sub_system_tag"], }, { - title: t('operation.company_info'), + title: t("operation.company_info"), key: "company_info", active: false, active: searchParams.value.work_type === null, @@ -55,18 +55,18 @@ const setButtonItems = () => { ]); setSearchTypesItems([ + // { + // title: t('operation.date'), + // key: "date", + // active: + // searchParams.value.search_type === "date" || + // !searchParams.value.search_type, + // params: ["start_created_at", "end_created_at"], + // }, { - title: t('operation.date'), - key: "date", - active: - searchParams.value.search_type === "date" || - !searchParams.value.search_type, - params: ["start_created_at", "end_created_at"], - }, - { - title: t('operation.serial'), + title: t("operation.serial"), key: "serial", - active: searchParams.value.search_type === "serial", + active: 1, params: ["serial_number"], }, ]); @@ -126,19 +126,22 @@ watch( ref="form" class="w-full flex flex-wrap flex-col custom-border p-4 mb-4" > + +
-
- + diff --git a/src/views/operation/components/OperationSearchSubSys.vue b/src/views/operation/components/OperationSearchSubSys.vue index 224640b..bfef454 100644 --- a/src/views/operation/components/OperationSearchSubSys.vue +++ b/src/views/operation/components/OperationSearchSubSys.vue @@ -1,89 +1,115 @@ diff --git a/src/views/operation/components/OperationTable.vue b/src/views/operation/components/OperationTable.vue index fc27606..a9731f5 100644 --- a/src/views/operation/components/OperationTable.vue +++ b/src/views/operation/components/OperationTable.vue @@ -48,7 +48,7 @@ const deleteItem = async (id) => {