大小類篩選
This commit is contained in:
parent
5e13d284d3
commit
3d06cab696
@ -17,8 +17,8 @@ import instance from "@/util/request";
|
|||||||
import apihandler from "@/util/apihandler";
|
import apihandler from "@/util/apihandler";
|
||||||
import { object } from "yup";
|
import { object } from "yup";
|
||||||
|
|
||||||
export const getAssetSubList = async () => {
|
export const getAssetSubList = async (variable_id) => {
|
||||||
const res = await instance.post(GET_ASSET_SUB_LIST_API);
|
const res = await instance.post(GET_ASSET_SUB_LIST_API, { variable_id });
|
||||||
|
|
||||||
return apihandler(res.code, res.data, {
|
return apihandler(res.code, res.data, {
|
||||||
msg: res.msg,
|
msg: res.msg,
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
POST_OPERATION_RECORD_API,
|
POST_OPERATION_RECORD_API,
|
||||||
GET_OPERATION_EXPORT_API,
|
GET_OPERATION_EXPORT_API,
|
||||||
GET_OPERATION_FORMID_API,
|
GET_OPERATION_FORMID_API,
|
||||||
|
DELETE_OPERATION_RECORD_API,
|
||||||
POST_OPERATION_COMPANY_API,
|
POST_OPERATION_COMPANY_API,
|
||||||
UPDATE_OPERATION_COMPANY_API,
|
UPDATE_OPERATION_COMPANY_API,
|
||||||
DELETE_OPERATION_COMPANY_API,
|
DELETE_OPERATION_COMPANY_API,
|
||||||
@ -23,10 +24,10 @@ export const getOperationRecord = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
const res = await instance.post(GET_OPERATION_RECORD_API, {
|
const res = await instance.post(GET_OPERATION_RECORD_API, {
|
||||||
work_type: parseInt(work_type),
|
work_type: parseInt(work_type),
|
||||||
start_created_at: dayjs(start_created_at).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)
|
// end_created_at: dayjs(end_created_at)
|
||||||
.date(dayjs(end_created_at).get("date") + 1)
|
// .date(dayjs(end_created_at).get("date") + 1)
|
||||||
.format("YYYY-MM-DDTHH:mm:ss"),
|
// .format("YYYY-MM-DDTHH:mm:ss"),
|
||||||
serial_number: serial_number || null,
|
serial_number: serial_number || null,
|
||||||
main_system_tag: null,
|
main_system_tag: null,
|
||||||
sub_system_tag:
|
sub_system_tag:
|
||||||
|
@ -37,7 +37,7 @@ watch(
|
|||||||
role="alert"
|
role="alert"
|
||||||
:class="
|
:class="
|
||||||
twMerge(
|
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'
|
status === 'info'
|
||||||
? 'alert-info'
|
? 'alert-info'
|
||||||
: status === 'error'
|
: status === 'error'
|
||||||
|
@ -160,6 +160,7 @@
|
|||||||
"start_time": "预计开始时间",
|
"start_time": "预计开始时间",
|
||||||
"upload": "档案上传",
|
"upload": "档案上传",
|
||||||
"finish_time": "完成时间",
|
"finish_time": "完成时间",
|
||||||
|
"updated_time": "更新时间",
|
||||||
"operation": "功能",
|
"operation": "功能",
|
||||||
"vendor": "厂商",
|
"vendor": "厂商",
|
||||||
"contact_person": "联络人",
|
"contact_person": "联络人",
|
||||||
@ -281,6 +282,7 @@
|
|||||||
"email_format": "请输入正确 Email 地址",
|
"email_format": "请输入正确 Email 地址",
|
||||||
"password_format": "密码长度至少8码,必须包含英文及数字",
|
"password_format": "密码长度至少8码,必须包含英文及数字",
|
||||||
"start_time_placeholder": "请输入预计开始日期",
|
"start_time_placeholder": "请输入预计开始日期",
|
||||||
|
"finish_time_placeholder": "请输入完成日期",
|
||||||
"rename": "重新命名",
|
"rename": "重新命名",
|
||||||
"download": "下载",
|
"download": "下载",
|
||||||
"confirm": "确认",
|
"confirm": "确认",
|
||||||
|
@ -160,6 +160,7 @@
|
|||||||
"start_time": "預計開始時間",
|
"start_time": "預計開始時間",
|
||||||
"upload": "檔案上傳",
|
"upload": "檔案上傳",
|
||||||
"finish_time": "完成時間",
|
"finish_time": "完成時間",
|
||||||
|
"updated_time": "更新時間",
|
||||||
"operation": "功能",
|
"operation": "功能",
|
||||||
"vendor": "廠商",
|
"vendor": "廠商",
|
||||||
"contact_person": "聯絡人",
|
"contact_person": "聯絡人",
|
||||||
@ -281,6 +282,7 @@
|
|||||||
"email_format": "請輸入正確的 Email 地址",
|
"email_format": "請輸入正確的 Email 地址",
|
||||||
"password_format": "密碼長度至少8碼,必須包含英文及數字",
|
"password_format": "密碼長度至少8碼,必須包含英文及數字",
|
||||||
"start_time_placeholder": "請輸入預計開始日期",
|
"start_time_placeholder": "請輸入預計開始日期",
|
||||||
|
"finish_time_placeholder": "請輸入完成日期",
|
||||||
"rename": "重新命名",
|
"rename": "重新命名",
|
||||||
"download": "下載",
|
"download": "下載",
|
||||||
"confirm": "確認",
|
"confirm": "確認",
|
||||||
|
@ -160,6 +160,7 @@
|
|||||||
"start_time": "Estimated Start Time",
|
"start_time": "Estimated Start Time",
|
||||||
"upload": "File Upload",
|
"upload": "File Upload",
|
||||||
"finish_time": "Completion Time",
|
"finish_time": "Completion Time",
|
||||||
|
"updated_time": "Update Time",
|
||||||
"operation": "Function",
|
"operation": "Function",
|
||||||
"vendor": "Company",
|
"vendor": "Company",
|
||||||
"contact_person": "Contact Person",
|
"contact_person": "Contact Person",
|
||||||
@ -281,6 +282,7 @@
|
|||||||
"email_format": "Please enter correct email address",
|
"email_format": "Please enter correct email address",
|
||||||
"password_format": "The password must be at least 8 characters long and must contain English and numbers.",
|
"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",
|
"start_time_placeholder": "Please enter expected start date",
|
||||||
|
"finish_time_placeholder": "Please enter completion date",
|
||||||
"rename": "Rename",
|
"rename": "Rename",
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import AssetMainList from "./components/AssetMainList.vue";
|
||||||
import AssetSubList from "./components/AssetSubList.vue";
|
import AssetSubList from "./components/AssetSubList.vue";
|
||||||
import AssetTable from "./components/AssetTable.vue";
|
import AssetTable from "./components/AssetTable.vue";
|
||||||
</script>
|
</script>
|
||||||
@ -7,6 +8,7 @@ import AssetTable from "./components/AssetTable.vue";
|
|||||||
<h1 class="text-2xl font-extrabold mb-2">
|
<h1 class="text-2xl font-extrabold mb-2">
|
||||||
{{ $t("assetManagement.title") }}
|
{{ $t("assetManagement.title") }}
|
||||||
</h1>
|
</h1>
|
||||||
|
<AssetMainList />
|
||||||
<AssetSubList />
|
<AssetSubList />
|
||||||
<AssetTable />
|
<AssetTable />
|
||||||
</template>
|
</template>
|
||||||
|
59
src/views/AssetManagement/components/AssetMainList.vue
Normal file
59
src/views/AssetManagement/components/AssetMainList.vue
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<script setup>
|
||||||
|
import { getAssetMainList } from "@/apis/asset";
|
||||||
|
import { ref, onMounted, watch, inject } from "vue";
|
||||||
|
import useSearchParam from "@/hooks/useSearchParam";
|
||||||
|
import useActiveBtn from "@/hooks/useActiveBtn";
|
||||||
|
|
||||||
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
|
const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn();
|
||||||
|
const { openToast, cancelToastOpen } = inject("app_toast");
|
||||||
|
const getMainSystems = async () => {
|
||||||
|
const res = await getAssetMainList();
|
||||||
|
const cate = res.data.map((d, index) => ({
|
||||||
|
...d,
|
||||||
|
title: d.system_key,
|
||||||
|
key: d.id,
|
||||||
|
active: searchParams.value?.mainSys_id
|
||||||
|
? parseInt(searchParams.value?.mainSys_id) === d.id
|
||||||
|
: index === 0,
|
||||||
|
}));
|
||||||
|
setItems(cate);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getMainSystems();
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(selectedBtn, (newValue) => {
|
||||||
|
changeParams({
|
||||||
|
...searchParams.value,
|
||||||
|
mainSys_id: newValue.key,
|
||||||
|
subSys_id: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex items-center gap-4 mb-4">
|
||||||
|
<h2 class="text-lg font-bold ps-2 whitespace-nowrap">
|
||||||
|
{{ $t("history.system_category") }} :
|
||||||
|
</h2>
|
||||||
|
<ButtonConnectedGroup
|
||||||
|
:items="items"
|
||||||
|
:onclick="
|
||||||
|
(e, item) => {
|
||||||
|
changeActiveBtn(item);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
:className="`flex w-full mt-2`"
|
||||||
|
size="sm"
|
||||||
|
color="info"
|
||||||
|
>
|
||||||
|
<template #buttonContent="{ item }">
|
||||||
|
<span class="text-base">{{ item.title }}</span>
|
||||||
|
</template>
|
||||||
|
</ButtonConnectedGroup>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
@ -8,9 +8,9 @@ import AssetSubListAddModal from "./AssetSubListAddModal.vue";
|
|||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn();
|
const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn();
|
||||||
|
|
||||||
const getSubSystems = async () => {
|
const getSubSystems = async (id) => {
|
||||||
const res = await getAssetSubList();
|
const res = await getAssetSubList(id);
|
||||||
const sub = res.data.map((d, index) => ({
|
sub = res.data.map((d, index) => ({
|
||||||
...d,
|
...d,
|
||||||
title: d.system_key,
|
title: d.system_key,
|
||||||
key: d.id,
|
key: d.id,
|
||||||
@ -21,14 +21,27 @@ const getSubSystems = async () => {
|
|||||||
setItems(sub);
|
setItems(sub);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {});
|
||||||
getSubSystems();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(selectedBtn, (newValue) => {
|
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);
|
const editRecord = ref(null);
|
||||||
// 編輯 modal
|
// 編輯 modal
|
||||||
const openModal = () => {
|
const openModal = () => {
|
||||||
@ -58,20 +71,24 @@ const deleteItem = async (id) => {
|
|||||||
:getData="getSubList"
|
:getData="getSubList"
|
||||||
:editRecord="editRecord"
|
:editRecord="editRecord"
|
||||||
/> -->
|
/> -->
|
||||||
<ButtonConnectedGroup
|
<div class="flex items-center gap-4 mb-4">
|
||||||
:items="items"
|
<h2 class="text-lg font-bold ps-2 whitespace-nowrap">
|
||||||
:onclick="
|
{{ $t("history.device_category") }} :
|
||||||
(e, item) => {
|
</h2>
|
||||||
changeActiveBtn(item);
|
<ButtonConnectedGroup
|
||||||
}
|
:items="items"
|
||||||
"
|
:onclick="
|
||||||
:className="`flex w-full mt-4`"
|
(e, item) => {
|
||||||
size="sm"
|
changeActiveBtn(item);
|
||||||
color="info"
|
}
|
||||||
>
|
"
|
||||||
<template #buttonContent="{ item }">
|
:className="`flex w-full mt-2`"
|
||||||
<span class="text-base">{{ item.title }}</span>
|
size="sm"
|
||||||
<!-- <template v-if="!item.is_IOT">
|
color="info"
|
||||||
|
>
|
||||||
|
<template #buttonContent="{ item }">
|
||||||
|
<span class="text-base">{{ item.title }}</span>
|
||||||
|
<!-- <template v-if="!item.is_IOT">
|
||||||
<span
|
<span
|
||||||
class="ml-2 text-base text-warning"
|
class="ml-2 text-base text-warning"
|
||||||
@click.stop.prevent="() => edit(item)"
|
@click.stop.prevent="() => edit(item)"
|
||||||
@ -85,8 +102,9 @@ const deleteItem = async (id) => {
|
|||||||
<FontAwesomeIcon :icon="['fas', 'trash-alt']" />
|
<FontAwesomeIcon :icon="['fas', 'trash-alt']" />
|
||||||
</span>
|
</span>
|
||||||
</template> -->
|
</template> -->
|
||||||
</template>
|
</template>
|
||||||
</ButtonConnectedGroup>
|
</ButtonConnectedGroup>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -84,15 +84,15 @@ const submitBtns = computed(() => [
|
|||||||
btn: "btn-search",
|
btn: "btn-search",
|
||||||
disabled: isSearchButtonDisabled.value,
|
disabled: isSearchButtonDisabled.value,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: t("button.export"),
|
// title: t("button.export"),
|
||||||
key: "export",
|
// key: "export",
|
||||||
icon: "download",
|
// icon: "download",
|
||||||
btn: "btn-export",
|
// btn: "btn-export",
|
||||||
active: false,
|
// active: false,
|
||||||
onClick: (e) => submit(e, "export"),
|
// onClick: (e) => submit(e, "export"),
|
||||||
disabled: isSearchButtonDisabled.value,
|
// disabled: isSearchButtonDisabled.value,
|
||||||
},
|
// },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const once = ref(false);
|
const once = ref(false);
|
||||||
|
@ -26,6 +26,9 @@ const updateDataSource = (data) => {
|
|||||||
finish_time: d?.finish_time
|
finish_time: d?.finish_time
|
||||||
? dayjs(d?.finish_time).format("YYYY-MM-DD")
|
? 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_building_tag: store.buildings[0].building_tag,
|
||||||
device_area_tag: "NTPC",
|
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 = "") => {
|
const getNewFormId = async (id = "") => {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
@ -102,7 +105,9 @@ const getAllOptions = async (id = "") => {
|
|||||||
|
|
||||||
const openModal = async (id = "") => {
|
const openModal = async (id = "") => {
|
||||||
console.log("open modal", id);
|
console.log("open modal", id);
|
||||||
getAllOptions(id);
|
if(searchParams.value?.work_type < 3){
|
||||||
|
getAllOptions(id);
|
||||||
|
}
|
||||||
operation_action_item.showModal();
|
operation_action_item.showModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,15 +37,15 @@ const submitBtns = computed(() => [
|
|||||||
onClick: search,
|
onClick: search,
|
||||||
disabled: isSearchDisabled.value,
|
disabled: isSearchDisabled.value,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: t("button.export"),
|
// title: t("button.export"),
|
||||||
key: "export",
|
// key: "export",
|
||||||
icon: "download",
|
// icon: "download",
|
||||||
btn: "btn-export",
|
// btn: "btn-export",
|
||||||
active: false,
|
// active: false,
|
||||||
onClick: exportFile,
|
// onClick: exportFile,
|
||||||
disabled: isSearchDisabled.value,
|
// disabled: isSearchDisabled.value,
|
||||||
},
|
// },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const once = ref(true);
|
const once = ref(true);
|
||||||
|
@ -6,8 +6,8 @@ import OperationSearchSubSys from "./OperationSearchSubSys.vue";
|
|||||||
import OperationActionButton from "./OperationActionButton.vue";
|
import OperationActionButton from "./OperationActionButton.vue";
|
||||||
import useSearchParam from "@/hooks/useSearchParam";
|
import useSearchParam from "@/hooks/useSearchParam";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from "vue-i18n";
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
const { search } = inject("operation_table");
|
const { search } = inject("operation_table");
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ const {
|
|||||||
const setButtonItems = () => {
|
const setButtonItems = () => {
|
||||||
setWorkTypesItems([
|
setWorkTypesItems([
|
||||||
{
|
{
|
||||||
title: t('operation.repair'),
|
title: t("operation.repair"),
|
||||||
key: "fix",
|
key: "fix",
|
||||||
active:
|
active:
|
||||||
searchParams.value.work_type === "2" || !searchParams.value.work_type,
|
searchParams.value.work_type === "2" || !searchParams.value.work_type,
|
||||||
@ -38,14 +38,14 @@ const setButtonItems = () => {
|
|||||||
params: ["work_type", "sub_system_tag"],
|
params: ["work_type", "sub_system_tag"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('operation.maintenance'),
|
title: t("operation.maintenance"),
|
||||||
key: "maintain",
|
key: "maintain",
|
||||||
active: searchParams.value.work_type === "1",
|
active: searchParams.value.work_type === "1",
|
||||||
work_type: 1,
|
work_type: 1,
|
||||||
params: ["work_type", "sub_system_tag"],
|
params: ["work_type", "sub_system_tag"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('operation.company_info'),
|
title: t("operation.company_info"),
|
||||||
key: "company_info",
|
key: "company_info",
|
||||||
active: false,
|
active: false,
|
||||||
active: searchParams.value.work_type === null,
|
active: searchParams.value.work_type === null,
|
||||||
@ -55,18 +55,18 @@ const setButtonItems = () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
setSearchTypesItems([
|
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'),
|
title: t("operation.serial"),
|
||||||
key: "date",
|
|
||||||
active:
|
|
||||||
searchParams.value.search_type === "date" ||
|
|
||||||
!searchParams.value.search_type,
|
|
||||||
params: ["start_created_at", "end_created_at"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('operation.serial'),
|
|
||||||
key: "serial",
|
key: "serial",
|
||||||
active: searchParams.value.search_type === "serial",
|
active: 1,
|
||||||
params: ["serial_number"],
|
params: ["serial_number"],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
@ -126,19 +126,22 @@ watch(
|
|||||||
ref="form"
|
ref="form"
|
||||||
class="w-full flex flex-wrap flex-col custom-border p-4 mb-4"
|
class="w-full flex flex-wrap flex-col custom-border p-4 mb-4"
|
||||||
>
|
>
|
||||||
|
<ButtonGroup
|
||||||
|
:items="workTypesItems"
|
||||||
|
:withLine="true"
|
||||||
|
:onclick="
|
||||||
|
(e, item) => {
|
||||||
|
changeWorkTypeActiveBtn(item);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<OperationSearchSubSys
|
||||||
|
:class="twMerge(selectedWorkType?.work_type === 3 ? 'hidden' : 'block')"
|
||||||
|
/>
|
||||||
<div class="w-full flex flex-wrap items-center justify-start">
|
<div class="w-full flex flex-wrap items-center justify-start">
|
||||||
<ButtonGroup
|
|
||||||
:items="workTypesItems"
|
|
||||||
:withLine="true"
|
|
||||||
:onclick="
|
|
||||||
(e, item) => {
|
|
||||||
changeWorkTypeActiveBtn(item);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
v-if="selectedWorkType?.work_type !== 3"
|
v-if="selectedWorkType?.work_type !== 3"
|
||||||
:class="twMerge('ml-8 mr-3')"
|
:class="twMerge('mr-3')"
|
||||||
:items="searchTypesItems"
|
:items="searchTypesItems"
|
||||||
:withLine="true"
|
:withLine="true"
|
||||||
:onclick="
|
:onclick="
|
||||||
@ -151,9 +154,7 @@ watch(
|
|||||||
<OperationSearchType :selected="selectedSearchType" />
|
<OperationSearchType :selected="selectedSearchType" />
|
||||||
<OperationActionButton :selectedWorkType="selectedWorkType" />
|
<OperationActionButton :selectedWorkType="selectedWorkType" />
|
||||||
</div>
|
</div>
|
||||||
<OperationSearchSubSys
|
|
||||||
:class="twMerge(selectedWorkType?.work_type === 3 ? 'hidden' : 'block')"
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,89 +1,115 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import useBuildingStore from "@/stores/useBuildingStore";
|
import { getAssetMainList, getAssetSubList } from "@/apis/asset";
|
||||||
import Checkbox from "@/components/customUI/Checkbox.vue";
|
|
||||||
import { computed, onMounted, ref, watch } from "vue";
|
import { computed, onMounted, ref, watch } from "vue";
|
||||||
import useSearchParam from "@/hooks/useSearchParam";
|
import useSearchParam from "@/hooks/useSearchParam";
|
||||||
import { useI18n } from 'vue-i18n';
|
import useActiveBtn from "@/hooks/useActiveBtn";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { searchParams, changeParams } = useSearchParam();
|
const { searchParams, changeParams } = useSearchParam();
|
||||||
|
|
||||||
const store = useBuildingStore();
|
// 選大類
|
||||||
|
const {
|
||||||
|
items: sysMainTagItems,
|
||||||
|
changeActiveBtn: changeMainSysActiveBtn,
|
||||||
|
setItems: setMainSysItems,
|
||||||
|
selectedBtn: selectedMainSysItems,
|
||||||
|
} = useActiveBtn();
|
||||||
|
// 選小類
|
||||||
|
const {
|
||||||
|
items: sysTagItems,
|
||||||
|
changeActiveBtn: changeSysActiveBtn,
|
||||||
|
setItems: setSysItems,
|
||||||
|
selectedBtn: selectedSysItems,
|
||||||
|
} = useActiveBtn("multiple");
|
||||||
|
|
||||||
const changeCheckedItem = () => {
|
const getMainSystems = async () => {
|
||||||
if (checkedItem.value.length === store.subSys.length) {
|
const res = await getAssetMainList();
|
||||||
changeParams({
|
const cate = res.data.map((d, index) => ({
|
||||||
...searchParams.value,
|
...d,
|
||||||
sub_system_tag: [],
|
title: d.system_key,
|
||||||
});
|
key: d.id,
|
||||||
} else {
|
active: searchParams.value?.mainSys_id
|
||||||
changeParams({
|
? parseInt(searchParams.value?.mainSys_id) === d.id
|
||||||
...searchParams.value,
|
: index === 0,
|
||||||
sub_system_tag: store.subSys.map(({ sub_system_tag }) => sub_system_tag),
|
}));
|
||||||
});
|
setMainSysItems(cate);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (value, checked) => {
|
const getSubSystems = async (id) => {
|
||||||
if (checked) {
|
const res = await getAssetSubList(id);
|
||||||
changeParams({
|
const sub = res.data.map((d, index) => ({
|
||||||
...searchParams.value,
|
...d,
|
||||||
sub_system_tag: searchParams.value.sub_system_tag
|
title: d.system_key,
|
||||||
? typeof searchParams.value.sub_system_tag === "string"
|
key: d.system_value,
|
||||||
? [searchParams.value.sub_system_tag, value]
|
active: searchParams.value?.sub_system_tag
|
||||||
: [...searchParams.value.sub_system_tag, value]
|
? parseInt(searchParams.value?.sub_system_tag) === d.system_value
|
||||||
: [value],
|
: index === 0,
|
||||||
});
|
}));
|
||||||
} else {
|
setSysItems(sub);
|
||||||
changeParams({
|
|
||||||
...searchParams.value,
|
|
||||||
sub_system_tag: searchParams.value.sub_system_tag.filter(
|
|
||||||
(sub) => sub !== value
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkedItem = computed(() =>
|
onMounted(() => {
|
||||||
searchParams.value.sub_system_tag
|
getMainSystems();
|
||||||
? typeof searchParams.value.sub_system_tag === "string"
|
|
||||||
? [searchParams.value.sub_system_tag]
|
|
||||||
: searchParams.value.sub_system_tag
|
|
||||||
: []
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(searchParams, (newValue, oldValue) => {
|
|
||||||
if (
|
|
||||||
(!oldValue.work_type || oldValue.work_type == "3") &&
|
|
||||||
!newValue.sub_system_tag
|
|
||||||
) {
|
|
||||||
changeParams({
|
|
||||||
...newValue,
|
|
||||||
sub_system_tag: [store.subSys[0]?.sub_system_tag],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(selectedMainSysItems, (newValue) => {
|
||||||
|
changeParams({
|
||||||
|
...searchParams.value,
|
||||||
|
mainSys_id: newValue.key,
|
||||||
|
sub_system_tag: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// watch(selectedSysItems, (newValue) => {
|
||||||
|
// changeParams({
|
||||||
|
// ...searchParams.value,
|
||||||
|
// sub_system_tag: newValue.map((d) => d.key),
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => searchParams,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (newValue.mainSys_id && newValue.mainSys_id !== oldValue.mainSys_id) {
|
||||||
|
getSubSystems(newValue.value.mainSys_id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-wrap items-center mt-6">
|
<div>
|
||||||
<h2 class="text-lg font-bold ps-1 pe-4">
|
<div class="flex items-center gap-4 my-4">
|
||||||
|
<h2 class="text-lg font-bold ps-2 whitespace-nowrap">
|
||||||
|
{{ $t("history.system_category") }} :
|
||||||
|
</h2>
|
||||||
|
<ButtonGroup
|
||||||
|
:items="sysMainTagItems"
|
||||||
|
:withLine="true"
|
||||||
|
:onclick="
|
||||||
|
(e, item) => {
|
||||||
|
changeMainSysActiveBtn(item);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 my-4">
|
||||||
|
<h2 class="text-lg font-bold ps-2 whitespace-nowrap">
|
||||||
{{ $t("history.device_category") }} :
|
{{ $t("history.device_category") }} :
|
||||||
</h2>
|
</h2>
|
||||||
<button
|
<ButtonGroup
|
||||||
class="btn btn-sm btn-success"
|
:items="sysTagItems"
|
||||||
@click.stop.prevent="changeCheckedItem"
|
:withLine="true"
|
||||||
>
|
:onclick="
|
||||||
{{ checkedItem.length === store.subSys.length ? t("button.deselect_all") : t("button.select_all") }}
|
(e, item) => {
|
||||||
</button>
|
changeSysActiveBtn(item);
|
||||||
<Checkbox
|
}
|
||||||
v-for="sub in store.subSys"
|
"
|
||||||
:key="sub.key"
|
/>
|
||||||
:title="sub.full_name"
|
</div>
|
||||||
:value="sub.sub_system_tag"
|
|
||||||
:checked="checkedItem.includes(sub.sub_system_tag)"
|
|
||||||
class="mx-3 my-3 xl:my-0 text-lg"
|
|
||||||
:onChange="onChange"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ const deleteItem = async (id) => {
|
|||||||
<Table :loading="tableLoading" :columns="columns" :dataSource="dataSource">
|
<Table :loading="tableLoading" :columns="columns" :dataSource="dataSource">
|
||||||
<template #bodyCell="{ record, column, index }">
|
<template #bodyCell="{ record, column, index }">
|
||||||
<template v-if="column.key === 'lorf'">
|
<template v-if="column.key === 'lorf'">
|
||||||
<span v-if="record.lorf.length === 0"></span>
|
<span v-if="record.lorf?.length === 0"></span>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span class="flex">
|
<span class="flex">
|
||||||
<a
|
<a
|
||||||
|
@ -38,6 +38,7 @@ const formState = ref([
|
|||||||
status: "",
|
status: "",
|
||||||
work_person_id: "",
|
work_person_id: "",
|
||||||
start_time: "",
|
start_time: "",
|
||||||
|
finish_time: "",
|
||||||
notice: "",
|
notice: "",
|
||||||
description: "",
|
description: "",
|
||||||
lorf: [],
|
lorf: [],
|
||||||
@ -52,6 +53,7 @@ const formState = ref([
|
|||||||
status: "",
|
status: "",
|
||||||
work_person_id: "",
|
work_person_id: "",
|
||||||
start_time: "",
|
start_time: "",
|
||||||
|
finish_time: "",
|
||||||
notice: "",
|
notice: "",
|
||||||
description: "",
|
description: "",
|
||||||
lorf: [],
|
lorf: [],
|
||||||
@ -109,6 +111,16 @@ const dateItem = ref([
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const dateItem2 = ref([
|
||||||
|
{
|
||||||
|
key: "finish_time",
|
||||||
|
name: "finish_time",
|
||||||
|
value: dayjs(),
|
||||||
|
dateFormat: "yyyy-MM-dd",
|
||||||
|
placeholder: t("button.finish_time_placeholder"),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
const form = ref(null);
|
const form = ref(null);
|
||||||
const {
|
const {
|
||||||
formErrorMsg: maintainFormErrorMsg,
|
formErrorMsg: maintainFormErrorMsg,
|
||||||
@ -137,7 +149,13 @@ const saveMaintain = async () => {
|
|||||||
"start_time",
|
"start_time",
|
||||||
dayjs(dateItem.value[0].value).format("YYYY-MM-DD")
|
dayjs(dateItem.value[0].value).format("YYYY-MM-DD")
|
||||||
);
|
);
|
||||||
|
formData.append(
|
||||||
|
"finish_time",
|
||||||
|
dayjs(dateItem2.value[0].value).format("YYYY-MM-DD")
|
||||||
|
);
|
||||||
props.editRecord.id && formData.append("id", props.editRecord.id);
|
props.editRecord.id && formData.append("id", props.editRecord.id);
|
||||||
|
props.editRecord.id &&
|
||||||
|
formData.append("fix_do_code", props.editRecord.fix_do_code);
|
||||||
|
|
||||||
const value = await handleMaintainSubmit(
|
const value = await handleMaintainSubmit(
|
||||||
maintainSchema,
|
maintainSchema,
|
||||||
@ -162,7 +180,7 @@ const saveCompany = async () => {
|
|||||||
formState.value[searchParams.value?.work_type - 1]
|
formState.value[searchParams.value?.work_type - 1]
|
||||||
);
|
);
|
||||||
let res;
|
let res;
|
||||||
if (props.editRecord.id) {
|
if (props.editRecord) {
|
||||||
res = await updateOperationCompany(value);
|
res = await updateOperationCompany(value);
|
||||||
} else {
|
} else {
|
||||||
res = await postOperationCompany(value);
|
res = await postOperationCompany(value);
|
||||||
@ -222,6 +240,15 @@ watch(
|
|||||||
) {
|
) {
|
||||||
dateItem.value[0].value = newVal.start_time;
|
dateItem.value[0].value = newVal.start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
Object.hasOwn(
|
||||||
|
formState.value[searchParams.value?.work_type - 1],
|
||||||
|
"finish_time"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
dateItem2.value[0].value = newVal.finish_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
Object.hasOwn(
|
Object.hasOwn(
|
||||||
@ -314,9 +341,9 @@ watch(
|
|||||||
class="my-2"
|
class="my-2"
|
||||||
selectClass="border-info focus-within:border-info"
|
selectClass="border-info focus-within:border-info"
|
||||||
name="fix_do_code"
|
name="fix_do_code"
|
||||||
Attribute="device_name"
|
Attribute="full_name"
|
||||||
:options="model_data.model_devList"
|
:options="model_data.model_devList"
|
||||||
:disabled="formState[searchParams?.work_type - 1].error_code"
|
:disabled="props.editRecord?.id !== ''"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("operation.repair_item_code") }}</template>
|
<template #topLeft>{{ $t("operation.repair_item_code") }}</template>
|
||||||
<template #bottomLeft
|
<template #bottomLeft
|
||||||
@ -338,7 +365,9 @@ watch(
|
|||||||
:options="model_data.model_companyList"
|
:options="model_data.model_companyList"
|
||||||
:required="true"
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("operation.responsible_vendor") }}</template>
|
<template #topLeft>{{
|
||||||
|
$t("operation.responsible_vendor")
|
||||||
|
}}</template>
|
||||||
<template #bottomLeft
|
<template #bottomLeft
|
||||||
><span class="text-error text-base">
|
><span class="text-error text-base">
|
||||||
{{ maintainFormErrorMsg.fix_firm }}
|
{{ maintainFormErrorMsg.fix_firm }}
|
||||||
@ -369,6 +398,19 @@ watch(
|
|||||||
>
|
>
|
||||||
<template #topLeft>{{ $t("operation.status") }}</template>
|
<template #topLeft>{{ $t("operation.status") }}</template>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
<DateGroup
|
||||||
|
class="my-2"
|
||||||
|
:items="dateItem2"
|
||||||
|
inputClass="w-full shadow-none"
|
||||||
|
:required="true"
|
||||||
|
>
|
||||||
|
<template #topLeft>{{ $t("operation.finish_time") }}</template>
|
||||||
|
<template #bottomLeft
|
||||||
|
><span class="text-error text-base">
|
||||||
|
{{ maintainFormErrorMsg.finish_time }}
|
||||||
|
</span></template
|
||||||
|
>
|
||||||
|
</DateGroup>
|
||||||
<Select
|
<Select
|
||||||
v-if="
|
v-if="
|
||||||
searchParams?.work_type &&
|
searchParams?.work_type &&
|
||||||
|
@ -3,10 +3,10 @@ export const getFIX_COL = (t) => [
|
|||||||
title: t("operation.project"),
|
title: t("operation.project"),
|
||||||
key: "work_type_name",
|
key: "work_type_name",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: t("operation.location"),
|
// title: t("operation.location"),
|
||||||
key: "location",
|
// key: "location",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: t("operation.uuid"),
|
title: t("operation.uuid"),
|
||||||
key: "error_code",
|
key: "error_code",
|
||||||
@ -44,10 +44,11 @@ export const getFIX_COL = (t) => [
|
|||||||
key: "finish_time",
|
key: "finish_time",
|
||||||
sort: true,
|
sort: true,
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: "建立時間",
|
title: t("operation.updated_time"),
|
||||||
// key: "created_at",
|
key: "updated_at",
|
||||||
// },
|
sort: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("operation.operation"),
|
title: t("operation.operation"),
|
||||||
key: "operation",
|
key: "operation",
|
||||||
|
Loading…
Reference in New Issue
Block a user