From 9d5c97b44c668f14baa6b40b1005aaad60b56b74 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 29 四月 2026 16:00:58 +0800
Subject: [PATCH] 生产模块修改
---
src/views/equipmentManagement/upkeep/index.vue | 1033 ++++++++++++++++++------------------
src/api/productionManagement/workOrder.js | 8
src/components/Dialog/FileList.vue | 377 ++++++-------
src/api/productionManagement/productionCosting.js | 2
src/views/productionManagement/workOrderEdit/index.vue | 221 +++++++
src/views/productionManagement/workOrderManagement/index.vue | 26
6 files changed, 946 insertions(+), 721 deletions(-)
diff --git a/src/api/productionManagement/productionCosting.js b/src/api/productionManagement/productionCosting.js
index ebf7daa..7e9d06d 100644
--- a/src/api/productionManagement/productionCosting.js
+++ b/src/api/productionManagement/productionCosting.js
@@ -14,7 +14,7 @@
// salesLedger/productionAccounting/page
export function salesLedgerProductionAccountingList(query) {
return request({
- url: "/salesLedger/productionAccounting/page",
+ url: "/productionAccount/listPage",
method: "get",
params: query,
});
diff --git a/src/api/productionManagement/workOrder.js b/src/api/productionManagement/workOrder.js
index e004d45..2e2fe2d 100644
--- a/src/api/productionManagement/workOrder.js
+++ b/src/api/productionManagement/workOrder.js
@@ -24,6 +24,14 @@
});
}
+export function assignProductWorkOrder(data) {
+ return request({
+ url: "/productionOperationTask/assign",
+ method: "post",
+ data: data,
+ });
+}
+
// 涓嬭浇宸ュ崟娴佽浆鍗★紙杩斿洖鏂囦欢娴侊級
export function downProductWorkOrder(id) {
return request({
diff --git a/src/components/Dialog/FileList.vue b/src/components/Dialog/FileList.vue
index e373c27..136ff8b 100644
--- a/src/components/Dialog/FileList.vue
+++ b/src/components/Dialog/FileList.vue
@@ -1,73 +1,53 @@
<template>
- <el-dialog
- v-model="isShow"
- :title="title"
- :width="width"
- @close="handleClose"
- class="attachment-dialog"
- >
+ <el-dialog v-model="isShow"
+ :title="title"
+ :width="width"
+ @close="handleClose"
+ class="attachment-dialog">
<!-- 宸ュ叿鏍� -->
<div class="toolbar">
- <el-button
- type="primary"
- size="small"
- @click="handleUpload"
- >
+ <el-button type="primary"
+ size="small"
+ @click="handleUpload">
涓婁紶闄勪欢
</el-button>
</div>
-
<!-- 涓婁紶缁勪欢寮圭獥 -->
- <el-dialog
- v-model="uploadDialogVisible"
- title="涓婁紶闄勪欢"
- width="50%"
- @close="handleUploadClose"
- >
- <AttachmentUpload
- v-model:file-list="newFileList"
- />
+ <el-dialog v-model="uploadDialogVisible"
+ title="涓婁紶闄勪欢"
+ width="50%"
+ @close="handleUploadClose">
+ <AttachmentUpload v-model:file-list="newFileList" />
<template #footer>
<el-button @click="handleUploadClose">鍏抽棴</el-button>
</template>
</el-dialog>
-
<!-- 鏂囦欢鍒楄〃琛ㄦ牸 -->
<div class="table-container">
- <el-table
- :data="tableData"
- border
- class="attachment-table"
- :height="tableData.length > 0 ? 'auto' : '120px'"
- >
- <el-table-column
- label="闄勪欢鍚嶇О"
- prop="originalFilename"
- show-overflow-tooltip
- />
- <el-table-column
- v-if="showActions"
- fixed="right"
- label="鎿嶄綔"
- :width="120"
- align="center"
- >
+ <el-table :data="tableData"
+ border
+ class="attachment-table"
+ :height="tableData.length > 0 ? 'auto' : '120px'">
+ <el-table-column label="闄勪欢鍚嶇О"
+ prop="originalFilename"
+ show-overflow-tooltip />
+ <el-table-column v-if="showActions"
+ fixed="right"
+ label="鎿嶄綔"
+ :width="120"
+ align="center">
<template #default="scope">
- <el-button
- link
- type="primary"
- size="small"
- :href="scope.row.downloadURL"
- class="download-link"
- >
+ <el-button link
+ type="primary"
+ size="small"
+ :href="scope.row.downloadURL"
+ class="download-link">
涓嬭浇
</el-button>
- <el-button
- link
- type="danger"
- size="small"
- @click="handleDelete(scope.row)"
- >
+ <el-button link
+ type="danger"
+ size="small"
+ @click="handleDelete(scope.row)">
鍒犻櫎
</el-button>
</template>
@@ -78,176 +58,173 @@
</template>
<script setup>
-import { ref, computed, getCurrentInstance, onMounted, watch } from 'vue'
-import AttachmentUpload from '@/components/AttachmentUpload/file/index.vue'
-import {attachmentList, deleteAttachment, createAttachment} from "@/api/basicData/storageAttachment.js";
+ import { ref, computed, getCurrentInstance, onMounted, watch } from "vue";
+ import AttachmentUpload from "@/components/AttachmentUpload/file/index.vue";
+ import {
+ attachmentList,
+ deleteAttachment,
+ createAttachment,
+ } from "@/api/basicData/storageAttachment.js";
-const props = defineProps({
- visible: {
- type: Boolean,
- required: true,
- },
- recordType: {
- type: String,
- default: '',
- required: true
- },
- recordId: {
- type: Number,
- default: 0,
- required: true
- },
- title: {
- type: String,
- default: '闄勪欢'
- },
- width: {
- type: String,
- default: '50%'
- },
- showActions: {
- type: Boolean,
- default: true
- }
-})
+ const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+ recordType: {
+ type: String,
+ default: "",
+ required: true,
+ },
+ recordId: {
+ type: Number,
+ default: 0,
+ required: true,
+ },
+ title: {
+ type: String,
+ default: "闄勪欢",
+ },
+ width: {
+ type: String,
+ default: "50%",
+ },
+ showActions: {
+ type: Boolean,
+ default: true,
+ },
+ });
-const emit = defineEmits([
- 'close',
- 'download',
- 'upload',
- 'delete'
-])
+ const emit = defineEmits(["close", "download", "upload", "delete"]);
-const { proxy } = getCurrentInstance()
-const tableData = ref([])
-const uploadDialogVisible = ref(false)
-const newFileList = ref([])
+ const { proxy } = getCurrentInstance();
+ const tableData = ref([]);
+ const uploadDialogVisible = ref(false);
+ const newFileList = ref([]);
-const isShow = computed({
- get() {
- return props.visible;
- },
- set(val) {
- emit("update:visible", val);
- },
-});
+ const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit("update:visible", val);
+ },
+ });
-const handleClose = () => {
- isShow.value = false
-}
+ const handleClose = () => {
+ isShow.value = false;
+ };
-const handleUpload = () => {
- uploadDialogVisible.value = true
-}
+ const handleUpload = () => {
+ uploadDialogVisible.value = true;
+ };
-const handleUploadClose = async () => {
- // 妫�鏌ユ槸鍚︽湁鏂颁笂浼犵殑鏂囦欢
- if (newFileList.value.length > 0) {
+ const handleUploadClose = async () => {
+ // 妫�鏌ユ槸鍚︽湁鏂颁笂浼犵殑鏂囦欢
+ if (newFileList.value.length > 0) {
+ try {
+ await createAttachment({
+ application: "file",
+ recordType: props.recordType,
+ recordId: props.recordId,
+ storageBlobDTOs: [...newFileList.value, ...tableData.value],
+ });
+ newFileList.value = [];
+ // 鍒锋柊鍒楄〃
+ setList();
+ } catch (error) {
+ proxy?.$modal?.msgError("涓婁紶澶辫触");
+ }
+ }
+ uploadDialogVisible.value = false;
+ };
+
+ const handleDelete = async (row, index) => {
try {
- await createAttachment({
- application: 'file',
- recordType: props.recordType,
- recordId: props.recordId,
- storageBlobDTOs: [...newFileList.value, ...tableData.value]
- })
- newFileList.value = []
- // 鍒锋柊鍒楄〃
- setList()
+ await deleteAttachment([row.storageAttachmentId]);
+ proxy?.$modal?.msgSuccess("鍒犻櫎鎴愬姛");
+ setList();
} catch (error) {
- proxy?.$modal?.msgError('涓婁紶澶辫触')
+ proxy?.$modal?.msgError("鍒犻櫎澶辫触");
}
- }
- uploadDialogVisible.value = false
-}
+ };
+ const setList = () => {
+ attachmentList({
+ recordType: props.recordType,
+ recordId: props.recordId,
+ }).then(res => {
+ if (res && res.data) {
+ tableData.value = res.data || [];
+ }
+ });
+ };
-
-const handleDelete = async (row, index) => {
- try {
- await deleteAttachment([row.storageAttachmentId])
- proxy?.$modal?.msgSuccess('鍒犻櫎鎴愬姛')
- setList()
- } catch (error) {
- proxy?.$modal?.msgError('鍒犻櫎澶辫触')
- }
-}
-
-const setList = () => {
- attachmentList({
- recordType: props.recordType,
- recordId: props.recordId,
- }).then(res => {
- if (res && res.data) {
- tableData.value = res.data || []
- }
- })
-}
-
-onMounted(() => {
- setList()
-})
+ onMounted(() => {
+ setList();
+ });
</script>
<style scoped>
-.attachment-dialog {
- border-radius: 12px;
-}
+ .attachment-dialog {
+ border-radius: 12px;
+ }
-.toolbar {
- margin-bottom: 16px;
- text-align: right;
-}
+ .toolbar {
+ margin-bottom: 16px;
+ text-align: right;
+ }
-.table-container {
- max-height: 40vh;
- overflow-y: auto;
- min-height: 120px;
- padding-bottom: 16px;
- box-sizing: border-box;
- will-change: scroll-position;
- transform: translateZ(0);
- -webkit-overflow-scrolling: touch;
-}
+ .table-container {
+ max-height: 40vh;
+ overflow-y: auto;
+ min-height: 120px;
+ padding-bottom: 16px;
+ box-sizing: border-box;
+ will-change: scroll-position;
+ transform: translateZ(0);
+ -webkit-overflow-scrolling: touch;
+ }
-:deep(.el-table) {
- margin-bottom: 0;
-}
+ :deep(.el-table) {
+ margin-bottom: 0;
+ }
-:deep(.el-table__body-wrapper) {
- overflow-y: auto;
- will-change: transform;
- transform: translateZ(0);
-}
+ :deep(.el-table__body-wrapper) {
+ overflow-y: auto;
+ will-change: transform;
+ transform: translateZ(0);
+ }
-:deep(.el-table__body tr) {
- transition: none;
-}
+ :deep(.el-table__body tr) {
+ transition: none;
+ }
-:deep(.el-dialog__footer) {
- padding-top: 12px;
- border-top: 1px solid #e9ecef;
-}
+ :deep(.el-dialog__footer) {
+ padding-top: 12px;
+ border-top: 1px solid #e9ecef;
+ }
-.attachment-table {
- border-radius: 8px;
-}
+ .attachment-table {
+ border-radius: 8px;
+ }
-:deep(.el-dialog__header) {
- background-color: #f8f9fa;
- border-bottom: 1px solid #e9ecef;
- padding: 16px 20px;
-}
+ :deep(.el-dialog__header) {
+ background-color: #f8f9fa;
+ border-bottom: 1px solid #e9ecef;
+ padding: 16px 20px;
+ }
-:deep(.el-dialog__title) {
- font-size: 16px;
- font-weight: 600;
-}
+ :deep(.el-dialog__title) {
+ font-size: 16px;
+ font-weight: 600;
+ }
-:deep(.el-dialog__body) {
- padding: 16px 20px;
-}
+ :deep(.el-dialog__body) {
+ padding: 16px 20px;
+ }
-:deep(.el-table__empty-text) {
- color: #999;
-}
+ :deep(.el-table__empty-text) {
+ color: #999;
+ }
</style>
\ No newline at end of file
diff --git a/src/views/equipmentManagement/upkeep/index.vue b/src/views/equipmentManagement/upkeep/index.vue
index 3b771bf..0ee99eb 100644
--- a/src/views/equipmentManagement/upkeep/index.vue
+++ b/src/views/equipmentManagement/upkeep/index.vue
@@ -1,619 +1,636 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange">
<!-- 瀹氭椂浠诲姟绠$悊tab -->
- <el-tab-pane label="瀹氭椂浠诲姟绠$悊" name="scheduled">
+ <el-tab-pane label="瀹氭椂浠诲姟绠$悊"
+ name="scheduled">
<div class="search_form">
- <el-form :model="scheduledFilters" :inline="true">
+ <el-form :model="scheduledFilters"
+ :inline="true">
<el-form-item label="浠诲姟鍚嶇О">
- <el-input
- v-model="scheduledFilters.taskName"
- style="width: 240px"
- placeholder="璇疯緭鍏ヤ换鍔″悕绉�"
- clearable
- :prefix-icon="Search"
- @change="getScheduledTableData"
- />
+ <el-input v-model="scheduledFilters.taskName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ヤ换鍔″悕绉�"
+ clearable
+ :prefix-icon="Search"
+ @change="getScheduledTableData" />
</el-form-item>
<el-form-item label="浠诲姟鐘舵��">
- <el-select v-model="scheduledFilters.status" placeholder="璇烽�夋嫨浠诲姟鐘舵��" clearable style="width: 200px">
- <el-option label="鍚敤" value="1" />
- <el-option label="鍋滅敤" value="0" />
+ <el-select v-model="scheduledFilters.status"
+ placeholder="璇烽�夋嫨浠诲姟鐘舵��"
+ clearable
+ style="width: 200px">
+ <el-option label="鍚敤"
+ value="1" />
+ <el-option label="鍋滅敤"
+ value="0" />
</el-select>
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="getScheduledTableData">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="getScheduledTableData">鎼滅储</el-button>
<el-button @click="resetScheduledFilters">閲嶇疆</el-button>
</el-form-item>
</el-form>
</div>
<div class="table_list">
<div class="actions">
- <el-text class="mx-1" size="large">瀹氭椂浠诲姟绠$悊</el-text>
+ <el-text class="mx-1"
+ size="large">瀹氭椂浠诲姟绠$悊</el-text>
<div>
- <el-button type="primary" icon="Plus" @click="addScheduledTask">
+ <el-button type="primary"
+ icon="Plus"
+ @click="addScheduledTask">
鏂板浠诲姟
</el-button>
- <el-button
- type="danger"
- icon="Delete"
- :disabled="scheduledMultipleList.length <= 0"
- @click="delScheduledTaskByIds(scheduledMultipleList.map((item) => item.id))"
- >
+ <el-button type="danger"
+ icon="Delete"
+ :disabled="scheduledMultipleList.length <= 0"
+ @click="delScheduledTaskByIds(scheduledMultipleList.map((item) => item.id))">
鎵归噺鍒犻櫎
</el-button>
</div>
</div>
- <PIMTable
- rowKey="id"
- isSelection
- :column="scheduledColumns"
- :tableData="scheduledDataList"
- :page="{
+ <PIMTable rowKey="id"
+ isSelection
+ :column="scheduledColumns"
+ :tableData="scheduledDataList"
+ :page="{
current: scheduledPagination.currentPage,
size: scheduledPagination.pageSize,
total: scheduledPagination.total,
}"
- @selection-change="handleScheduledSelectionChange"
- @pagination="changeScheduledPage"
- >
+ @selection-change="handleScheduledSelectionChange"
+ @pagination="changeScheduledPage">
<template #statusRef="{ row }">
- <el-tag v-if="row.status === 1" type="success">鍚敤</el-tag>
- <el-tag v-if="row.status === 0" type="danger">鍋滅敤</el-tag>
+ <el-tag v-if="row.status === 1"
+ type="success">鍚敤</el-tag>
+ <el-tag v-if="row.status === 0"
+ type="danger">鍋滅敤</el-tag>
</template>
<template #operation="{ row }">
- <el-button
- type="primary"
- link
- @click="editScheduledTask(row)"
- >
+ <el-button type="primary"
+ link
+ @click="editScheduledTask(row)">
缂栬緫
</el-button>
- <el-button
- type="danger"
- link
- @click="delScheduledTaskByIds(row.id)"
- >
+ <el-button type="danger"
+ link
+ @click="delScheduledTaskByIds(row.id)">
鍒犻櫎
</el-button>
</template>
</PIMTable>
</div>
</el-tab-pane>
-
<!-- 浠诲姟璁板綍tab锛堝師璁惧淇濆吇椤甸潰锛� -->
- <el-tab-pane label="浠诲姟璁板綍" name="record">
+ <el-tab-pane label="浠诲姟璁板綍"
+ name="record">
<div class="search_form">
- <el-form :model="filters" :inline="true">
+ <el-form :model="filters"
+ :inline="true">
<el-form-item label="璁惧鍚嶇О">
- <el-input
- v-model="filters.deviceName"
- style="width: 240px"
- placeholder="璇疯緭鍏ヨ澶囧悕绉�"
- clearable
- :prefix-icon="Search"
- @change="getTableData"
- />
+ <el-input v-model="filters.deviceName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ヨ澶囧悕绉�"
+ clearable
+ :prefix-icon="Search"
+ @change="getTableData" />
</el-form-item>
<el-form-item label="璁″垝淇濆吇鏃ユ湡">
- <el-date-picker
- v-model="filters.maintenancePlanTime"
- type="date"
- placeholder="璇烽�夋嫨璁″垝淇濆吇鏃ユ湡"
- size="default"
- @change="(date) => handleDateChange(date,2)"
- />
+ <el-date-picker v-model="filters.maintenancePlanTime"
+ type="date"
+ placeholder="璇烽�夋嫨璁″垝淇濆吇鏃ユ湡"
+ size="default"
+ @change="(date) => handleDateChange(date,2)" />
</el-form-item>
<el-form-item label="瀹為檯淇濆吇鏃ユ湡">
- <el-date-picker
- v-model="filters.maintenanceActuallyTime"
- type="date"
- placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
- size="default"
- @change="(date) => handleDateChange(date,1)"
- />
+ <el-date-picker v-model="filters.maintenanceActuallyTime"
+ type="date"
+ placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
+ size="default"
+ @change="(date) => handleDateChange(date,1)" />
</el-form-item>
<el-form-item label="瀹為檯淇濆吇浜�">
- <el-input
- v-model="filters.maintenanceActuallyName"
- style="width: 240px"
- placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
- clearable
- :prefix-icon="Search"
- @change="getTableData"
- />
+ <el-input v-model="filters.maintenanceActuallyName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
+ clearable
+ :prefix-icon="Search"
+ @change="getTableData" />
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="getTableData">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="getTableData">鎼滅储</el-button>
<el-button @click="resetFilters">閲嶇疆</el-button>
</el-form-item>
</el-form>
</div>
<div class="table_list">
<div class="actions">
- <el-text class="mx-1" size="large">浠诲姟璁板綍</el-text>
+ <el-text class="mx-1"
+ size="large">浠诲姟璁板綍</el-text>
<div>
- <el-button type="success" icon="Van" @click="addPlan">
+ <el-button type="success"
+ icon="Van"
+ @click="addPlan">
鏂板璁″垝
</el-button>
<el-button @click="handleOut">
瀵煎嚭
</el-button>
- <el-button
- type="danger"
- icon="Delete"
- :disabled="multipleList.length <= 0 || hasFinishedStatus"
- @click="delRepairByIds(multipleList.map((item) => item.id))"
- >
+ <el-button type="danger"
+ icon="Delete"
+ :disabled="multipleList.length <= 0 || hasFinishedStatus"
+ @click="delRepairByIds(multipleList.map((item) => item.id))">
鎵归噺鍒犻櫎
</el-button>
</div>
</div>
- <PIMTable
- rowKey="id"
- isSelection
- :column="columns"
- :tableData="dataList"
- :page="{
+ <PIMTable rowKey="id"
+ isSelection
+ :column="columns"
+ :tableData="dataList"
+ :page="{
current: pagination.currentPage,
size: pagination.pageSize,
total: pagination.total,
}"
- @selection-change="handleSelectionChange"
- @pagination="changePage"
- >
- <template #maintenanceResultRef="{ row }">
- <div>{{ row.maintenanceResult || '-' }}</div>
- </template>
- <template #statusRef="{ row }">
- <el-tag v-if="row.status === 2" type="danger">澶辫触</el-tag>
- <el-tag v-if="row.status === 1" type="success">瀹岀粨</el-tag>
- <el-tag v-if="row.status === 0" type="warning">寰呬繚鍏�</el-tag>
- </template>
- <template #operation="{ row }">
- <!-- 杩欎釜鍔熻兘璺熸柊澧炰繚鍏诲姛鑳戒竴妯′竴鏍凤紝鏈夊暐鎰忎箟锛� -->
- <!-- <el-button
+ @selection-change="handleSelectionChange"
+ @pagination="changePage">
+ <template #maintenanceResultRef="{ row }">
+ <div>{{ row.maintenanceResult || '-' }}</div>
+ </template>
+ <template #statusRef="{ row }">
+ <el-tag v-if="row.status === 2"
+ type="danger">澶辫触</el-tag>
+ <el-tag v-if="row.status === 1"
+ type="success">瀹岀粨</el-tag>
+ <el-tag v-if="row.status === 0"
+ type="warning">寰呬繚鍏�</el-tag>
+ </template>
+ <template #operation="{ row }">
+ <!-- 杩欎釜鍔熻兘璺熸柊澧炰繚鍏诲姛鑳戒竴妯′竴鏍凤紝鏈夊暐鎰忎箟锛� -->
+ <!-- <el-button
type="primary"
text
@click="addMaintain(row)"
>
鏂板淇濆吇
</el-button> -->
- <el-button
- type="primary"
- link
- :disabled="row.status === 1"
- @click="editPlan(row.id)"
- >
- 缂栬緫
- </el-button>
- <el-button
- type="success"
- link
- :disabled="row.status === 1"
- @click="addMaintain(row)"
- >
- 淇濆吇
- </el-button>
- <el-button
- type="danger"
- link
- :disabled="row.status === 1"
- @click="delRepairByIds(row.id)"
- >
- 鍒犻櫎
- </el-button>
- <el-button
- type="primary"
- link
- @click="openFileDialog(row)"
- >
- 闄勪欢
- </el-button>
- </template>
- </PIMTable>
+ <el-button type="primary"
+ link
+ :disabled="row.status === 1"
+ @click="editPlan(row.id)">
+ 缂栬緫
+ </el-button>
+ <el-button type="success"
+ link
+ :disabled="row.status === 1"
+ @click="addMaintain(row)">
+ 淇濆吇
+ </el-button>
+ <el-button type="danger"
+ link
+ :disabled="row.status === 1"
+ @click="delRepairByIds(row.id)">
+ 鍒犻櫎
+ </el-button>
+ <el-button type="primary"
+ link
+ @click="openFileDialog(row)">
+ 闄勪欢
+ </el-button>
+ </template>
+ </PIMTable>
</div>
</el-tab-pane>
</el-tabs>
- <PlanModal ref="planModalRef" @ok="getTableData" />
- <MaintenanceModal ref="maintainModalRef" @ok="getTableData" />
- <FormDia ref="formDiaRef" @closeDia="getScheduledTableData" />
- <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" :record-type="'device_maintenance'" :record-id="currentMaintenanceTaskId" />
+ <PlanModal ref="planModalRef"
+ @ok="getTableData" />
+ <MaintenanceModal ref="maintainModalRef"
+ @ok="getTableData" />
+ <FormDia ref="formDiaRef"
+ @closeDia="getScheduledTableData" />
+ <FileList v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ :record-type="'device_maintenance'"
+ :record-id="currentMaintenanceTaskId" />
</div>
</template>
<script setup>
-import {ref, onMounted, reactive, getCurrentInstance, nextTick, computed, defineAsyncComponent} from 'vue'
-import { Search } from '@element-plus/icons-vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import PlanModal from './Form/PlanModal.vue'
-import MaintenanceModal from './Form/MaintenanceModal.vue'
-import FormDia from './Form/formDia.vue'
-import {
- getUpkeepPage,
- delUpkeep,
- deviceMaintenanceTaskList,
- deviceMaintenanceTaskDel,
-} from '@/api/equipmentManagement/upkeep'
-import dayjs from 'dayjs'
+ import {
+ ref,
+ onMounted,
+ reactive,
+ getCurrentInstance,
+ nextTick,
+ computed,
+ defineAsyncComponent,
+ } from "vue";
+ import { Search } from "@element-plus/icons-vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import PlanModal from "./Form/PlanModal.vue";
+ import MaintenanceModal from "./Form/MaintenanceModal.vue";
+ import FormDia from "./Form/formDia.vue";
+ import {
+ getUpkeepPage,
+ delUpkeep,
+ deviceMaintenanceTaskList,
+ deviceMaintenanceTaskDel,
+ } from "@/api/equipmentManagement/upkeep";
+ import dayjs from "dayjs";
-const { proxy } = getCurrentInstance()
-const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+ const { proxy } = getCurrentInstance();
+ const FileList = defineAsyncComponent(() =>
+ import("@/components/Dialog/FileList.vue")
+ );
-// Tab鐩稿叧
-const activeTab = ref('scheduled')
+ // Tab鐩稿叧
+ const activeTab = ref("scheduled");
-// 璁″垝寮圭獥鎺у埗鍣�
-const planModalRef = ref()
-// 淇濆吇寮圭獥鎺у埗鍣�
-const maintainModalRef = ref()
-// 瀹氭椂浠诲姟寮圭獥鎺у埗鍣�
-const formDiaRef = ref()
-// 闄勪欢寮圭獥
-const fileListDialogRef = ref(null)
-const fileDialogVisible = ref(false)
-const currentMaintenanceTaskId = ref(null)
+ // 璁″垝寮圭獥鎺у埗鍣�
+ const planModalRef = ref();
+ // 淇濆吇寮圭獥鎺у埗鍣�
+ const maintainModalRef = ref();
+ // 瀹氭椂浠诲姟寮圭獥鎺у埗鍣�
+ const formDiaRef = ref();
+ // 闄勪欢寮圭獥
+ const fileListDialogRef = ref(null);
+ const fileDialogVisible = ref(false);
+ const currentMaintenanceTaskId = ref(null);
-// 浠诲姟璁板綍tab锛堝師璁惧淇濆吇椤甸潰锛夌浉鍏冲彉閲�
-const filters = reactive({
- deviceName: '',
- maintenancePlanTime: '',
- maintenanceActuallyTime: '',
- maintenanceActuallyName: '',
-})
+ // 浠诲姟璁板綍tab锛堝師璁惧淇濆吇椤甸潰锛夌浉鍏冲彉閲�
+ const filters = reactive({
+ deviceName: "",
+ maintenancePlanTime: "",
+ maintenanceActuallyTime: "",
+ maintenanceActuallyName: "",
+ });
-const dataList = ref([])
-const pagination = ref({
- currentPage: 1,
- pageSize: 10,
- total: 0,
-})
-const multipleList = ref([])
+ const dataList = ref([]);
+ const pagination = ref({
+ currentPage: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const multipleList = ref([]);
-// 瀹氭椂浠诲姟绠$悊tab鐩稿叧鍙橀噺
-const scheduledFilters = reactive({
- taskName: '',
- status: '',
-})
+ // 瀹氭椂浠诲姟绠$悊tab鐩稿叧鍙橀噺
+ const scheduledFilters = reactive({
+ taskName: "",
+ status: "",
+ });
-const scheduledDataList = ref([])
-const scheduledPagination = reactive({
- currentPage: 1,
- pageSize: 10,
- total: 0,
-})
-const scheduledMultipleList = ref([])
+ const scheduledDataList = ref([]);
+ const scheduledPagination = reactive({
+ currentPage: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const scheduledMultipleList = ref([]);
-// 瀹氭椂浠诲姟绠$悊琛ㄦ牸鍒楅厤缃�
-const scheduledColumns = ref([
- { prop: "taskName", label: "璁惧鍚嶇О"},
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "deviceModel",
- },
- {
- prop: "frequencyType",
- label: "棰戞",
- minWidth: 150,
- // PIMTable 浣跨敤鐨勬槸 formatData锛岃�屼笉鏄� Element-Plus 鐨� formatter
- formatData: (cell) => ({
- DAILY: "姣忔棩",
- WEEKLY: "姣忓懆",
- MONTHLY: "姣忔湀",
- QUARTERLY: "瀛e害"
- }[cell] || "")
- },
- {
- prop: "frequencyDetail",
- label: "寮�濮嬫棩鏈熶笌鏃堕棿",
- minWidth: 150,
- // 鍚屾牱鏀圭敤 formatData锛孭IMTable 鍐呴儴浼氭妸鍗曞厓鏍煎�间紶杩涙潵
- formatData: (cell) => {
- if (typeof cell !== 'string') return '';
- let val = cell;
- const replacements = {
- MON: '鍛ㄤ竴',
- TUE: '鍛ㄤ簩',
- WED: '鍛ㄤ笁',
- THU: '鍛ㄥ洓',
- FRI: '鍛ㄤ簲',
- SAT: '鍛ㄥ叚',
- SUN: '鍛ㄦ棩'
- };
- // 浣跨敤姝e垯涓�娆℃�ф浛鎹㈡墍鏈夊尮閰嶉」
- return val.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => replacements[match]);
- }
- },
- { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
- { prop: "registrationDate", label: "鐧昏鏃ユ湡", minWidth: 100 },
- {
- fixed: "right",
- label: "鎿嶄綔",
- dataType: "slot",
- slot: "operation",
- align: "center",
- width: "200px",
- },
-])
+ // 瀹氭椂浠诲姟绠$悊琛ㄦ牸鍒楅厤缃�
+ const scheduledColumns = ref([
+ { prop: "taskName", label: "璁惧鍚嶇О" },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "deviceModel",
+ },
+ {
+ prop: "frequencyType",
+ label: "棰戞",
+ minWidth: 150,
+ // PIMTable 浣跨敤鐨勬槸 formatData锛岃�屼笉鏄� Element-Plus 鐨� formatter
+ formatData: cell =>
+ ({
+ DAILY: "姣忔棩",
+ WEEKLY: "姣忓懆",
+ MONTHLY: "姣忔湀",
+ QUARTERLY: "瀛e害",
+ }[cell] || ""),
+ },
+ {
+ prop: "frequencyDetail",
+ label: "寮�濮嬫棩鏈熶笌鏃堕棿",
+ minWidth: 150,
+ // 鍚屾牱鏀圭敤 formatData锛孭IMTable 鍐呴儴浼氭妸鍗曞厓鏍煎�间紶杩涙潵
+ formatData: cell => {
+ if (typeof cell !== "string") return "";
+ let val = cell;
+ const replacements = {
+ MON: "鍛ㄤ竴",
+ TUE: "鍛ㄤ簩",
+ WED: "鍛ㄤ笁",
+ THU: "鍛ㄥ洓",
+ FRI: "鍛ㄤ簲",
+ SAT: "鍛ㄥ叚",
+ SUN: "鍛ㄦ棩",
+ };
+ // 浣跨敤姝e垯涓�娆℃�ф浛鎹㈡墍鏈夊尮閰嶉」
+ return val.replace(
+ /MON|TUE|WED|THU|FRI|SAT|SUN/g,
+ match => replacements[match]
+ );
+ },
+ },
+ { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
+ { prop: "registrationDate", label: "鐧昏鏃ユ湡", minWidth: 100 },
+ {
+ fixed: "right",
+ label: "鎿嶄綔",
+ dataType: "slot",
+ slot: "operation",
+ align: "center",
+ width: "200px",
+ },
+ ]);
-// 浠诲姟璁板綍琛ㄦ牸鍒楅厤缃紙鍘熻澶囦繚鍏昏〃鏍煎垪锛�
-const columns = ref([
- {
- label: "璁惧鍚嶇О",
- align: "center",
- prop: "deviceName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- align: "center",
- prop: "deviceModel",
- },
- {
- label: "璁″垝淇濆吇鏃ユ湡",
- align: "center",
- prop: "maintenancePlanTime",
- formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
- },
- {
- label: "褰曞叆浜�",
- align: "center",
- prop: "createUserName",
- },
- {
- label: "椤圭洰",
- align: "center",
- prop: "machineryCategory",
- },
- // {
- // label: "褰曞叆鏃ユ湡",
- // align: "center",
- // prop: "createTime",
- // formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
- // width: 200,
- // },
- {
- label: "瀹為檯淇濆吇浜�",
- align: "center",
- prop: "maintenanceActuallyName",
- },
- {
- label: "瀹為檯淇濆吇鏃ユ湡",
- align: "center",
- prop: "maintenanceActuallyTime",
- formatData: (cell) =>
- cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
- },
- {
- label: "淇濆吇缁撴灉",
- align: "center",
- prop: "maintenanceResult",
- dataType: "slot",
- slot: "maintenanceResultRef",
- },
- {
- label: "鐘舵��",
- align: "center",
- prop: "status",
- dataType: "slot",
- slot: "statusRef",
- },
- {
- fixed: "right",
- label: "鎿嶄綔",
- dataType: "slot",
- slot: "operation",
- align: "center",
- width: "350px",
- },
-])
+ // 浠诲姟璁板綍琛ㄦ牸鍒楅厤缃紙鍘熻澶囦繚鍏昏〃鏍煎垪锛�
+ const columns = ref([
+ {
+ label: "璁惧鍚嶇О",
+ align: "center",
+ prop: "deviceName",
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ align: "center",
+ prop: "deviceModel",
+ },
+ {
+ label: "璁″垝淇濆吇鏃ユ湡",
+ align: "center",
+ prop: "maintenancePlanTime",
+ formatData: cell => dayjs(cell).format("YYYY-MM-DD"),
+ },
+ {
+ label: "褰曞叆浜�",
+ align: "center",
+ prop: "createUserName",
+ },
+ {
+ label: "椤圭洰",
+ align: "center",
+ prop: "machineryCategory",
+ },
+ // {
+ // label: "褰曞叆鏃ユ湡",
+ // align: "center",
+ // prop: "createTime",
+ // formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
+ // width: 200,
+ // },
+ {
+ label: "瀹為檯淇濆吇浜�",
+ align: "center",
+ prop: "maintenanceActuallyName",
+ },
+ {
+ label: "瀹為檯淇濆吇鏃ユ湡",
+ align: "center",
+ prop: "maintenanceActuallyTime",
+ formatData: cell =>
+ cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
+ },
+ {
+ label: "淇濆吇缁撴灉",
+ align: "center",
+ prop: "maintenanceResult",
+ dataType: "slot",
+ slot: "maintenanceResultRef",
+ },
+ {
+ label: "鐘舵��",
+ align: "center",
+ prop: "status",
+ dataType: "slot",
+ slot: "statusRef",
+ },
+ {
+ fixed: "right",
+ label: "鎿嶄綔",
+ dataType: "slot",
+ slot: "operation",
+ align: "center",
+ width: "350px",
+ },
+ ]);
-// Tab鍒囨崲澶勭悊
-const handleTabChange = (tabName) => {
- if (tabName === 'record') {
- getTableData()
- } else if (tabName === 'scheduled') {
- getScheduledTableData()
- }
-}
-
-// 瀹氭椂浠诲姟绠$悊鐩稿叧鏂规硶
-const getScheduledTableData = async () => {
- try {
- const params = {
- current: scheduledPagination.currentPage,
- size: scheduledPagination.pageSize,
- taskName: scheduledFilters.taskName || undefined,
- status: scheduledFilters.status || undefined,
+ // Tab鍒囨崲澶勭悊
+ const handleTabChange = tabName => {
+ if (tabName === "record") {
+ getTableData();
+ } else if (tabName === "scheduled") {
+ getScheduledTableData();
}
- const { code, data } = await deviceMaintenanceTaskList(params)
- if (code === 200) {
- scheduledDataList.value = data?.records || []
- scheduledPagination.total = data?.total || 0
+ };
+
+ // 瀹氭椂浠诲姟绠$悊鐩稿叧鏂规硶
+ const getScheduledTableData = async () => {
+ try {
+ const params = {
+ current: scheduledPagination.currentPage,
+ size: scheduledPagination.pageSize,
+ taskName: scheduledFilters.taskName || undefined,
+ status: scheduledFilters.status || undefined,
+ };
+ const { code, data } = await deviceMaintenanceTaskList(params);
+ if (code === 200) {
+ scheduledDataList.value = data?.records || [];
+ scheduledPagination.total = data?.total || 0;
+ }
+ } catch (error) {
+ ElMessage.error("鑾峰彇瀹氭椂浠诲姟鍒楄〃澶辫触");
}
- } catch (error) {
- ElMessage.error('鑾峰彇瀹氭椂浠诲姟鍒楄〃澶辫触')
- }
-}
+ };
-const resetScheduledFilters = () => {
- scheduledFilters.taskName = ''
- scheduledFilters.status = ''
- getScheduledTableData()
-}
+ const resetScheduledFilters = () => {
+ scheduledFilters.taskName = "";
+ scheduledFilters.status = "";
+ getScheduledTableData();
+ };
-const handleScheduledSelectionChange = (selection) => {
- scheduledMultipleList.value = selection
-}
+ const handleScheduledSelectionChange = selection => {
+ scheduledMultipleList.value = selection;
+ };
-const changeScheduledPage = (page) => {
- scheduledPagination.currentPage = page.page
- scheduledPagination.pageSize = page.limit
- getScheduledTableData()
-}
+ const changeScheduledPage = page => {
+ scheduledPagination.currentPage = page.page;
+ scheduledPagination.pageSize = page.limit;
+ getScheduledTableData();
+ };
-const addScheduledTask = () => {
- nextTick(() => {
- formDiaRef.value?.openDialog('add');
- });
-}
+ const addScheduledTask = () => {
+ nextTick(() => {
+ formDiaRef.value?.openDialog("add");
+ });
+ };
-const editScheduledTask = (row) => {
- if (row) {
- nextTick(() => {
- formDiaRef.value?.openDialog('edit', row);
- });
- }
-}
+ const editScheduledTask = row => {
+ if (row) {
+ nextTick(() => {
+ formDiaRef.value?.openDialog("edit", row);
+ });
+ }
+ };
-const delScheduledTaskByIds = async (ids) => {
- try {
- await ElMessageBox.confirm('纭畾鍒犻櫎閫変腑鐨勫畾鏃朵换鍔″悧锛�', '鎻愮ず', {
- type: 'warning',
+ const delScheduledTaskByIds = async ids => {
+ try {
+ await ElMessageBox.confirm("纭畾鍒犻櫎閫変腑鐨勫畾鏃朵换鍔″悧锛�", "鎻愮ず", {
+ type: "warning",
+ });
+ const payload = Array.isArray(ids) ? ids : [ids];
+ await deviceMaintenanceTaskDel(payload);
+ ElMessage.success("鍒犻櫎瀹氭椂浠诲姟鎴愬姛");
+ getScheduledTableData();
+ } catch (error) {
+ // 鐢ㄦ埛鍙栨秷鍒犻櫎
+ }
+ };
+
+ const handleScheduledOut = () => {
+ ElMessage.info("瀵煎嚭瀹氭椂浠诲姟鍔熻兘寰呭疄鐜�");
+ };
+
+ // 浠诲姟璁板綍鐩稿叧鏂规硶锛堝師璁惧淇濆吇椤甸潰鏂规硶锛�
+ const getTableData = async () => {
+ try {
+ const params = {
+ current: pagination.value.currentPage,
+ size: pagination.value.pageSize,
+ deviceName: filters.deviceName || undefined,
+ maintenancePlanTime: filters.maintenancePlanTime
+ ? dayjs(filters.maintenancePlanTime).format("YYYY-MM-DD")
+ : undefined,
+ maintenanceActuallyTime: filters.maintenanceActuallyTime
+ ? dayjs(filters.maintenanceActuallyTime).format("YYYY-MM-DD")
+ : undefined,
+ maintenanceActuallyName: filters.maintenanceActuallyName || undefined,
+ };
+
+ const { code, data } = await getUpkeepPage(params);
+ if (code === 200) {
+ dataList.value = data.records;
+ pagination.value.total = data.total;
+ }
+ } catch (error) {
+ console.log(error);
+ }
+ };
+
+ const resetFilters = () => {
+ filters.deviceName = "";
+ filters.maintenancePlanTime = "";
+ filters.maintenanceActuallyTime = "";
+ filters.maintenanceActuallyName = "";
+ getTableData();
+ };
+
+ const handleSelectionChange = selection => {
+ multipleList.value = selection;
+ };
+
+ // 妫�鏌ラ�変腑鐨勮褰曚腑鏄惁鏈夊畬缁撶姸鎬佺殑
+ const hasFinishedStatus = computed(() => {
+ return multipleList.value.some(item => item.status === 1);
+ });
+
+ const changePage = page => {
+ pagination.value.currentPage = page.page;
+ pagination.value.pageSize = page.limit;
+ getTableData();
+ };
+
+ const addMaintain = row => {
+ maintainModalRef.value.open(row.id, row);
+ };
+
+ const addPlan = () => {
+ planModalRef.value.openModal();
+ };
+
+ const editPlan = id => {
+ planModalRef.value.openEdit(id);
+ };
+
+ const delRepairByIds = async ids => {
+ // 妫�鏌ユ槸鍚︽湁瀹岀粨鐘舵�佺殑璁板綍
+ const hasFinished = multipleList.value.some(item => item.status === 1);
+ if (hasFinished) {
+ ElMessage.warning("涓嶈兘鍒犻櫎鐘舵�佷负瀹岀粨鐨勮褰�");
+ return;
+ }
+
+ try {
+ await ElMessageBox.confirm("纭鍒犻櫎淇濆吇鏁版嵁, 姝ゆ搷浣滀笉鍙��?", "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ });
+
+ const { code } = await delUpkeep(ids);
+ if (code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getTableData();
+ }
+ } catch (error) {
+ // 鐢ㄦ埛鍙栨秷鍒犻櫎
+ }
+ };
+
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- const payload = Array.isArray(ids) ? ids : [ids]
- await deviceMaintenanceTaskDel(payload)
- ElMessage.success('鍒犻櫎瀹氭椂浠诲姟鎴愬姛')
- getScheduledTableData()
- } catch (error) {
- // 鐢ㄦ埛鍙栨秷鍒犻櫎
- }
-}
+ .then(() => {
+ proxy.download("/device/maintenance/export", {}, "璁惧淇濆吇.xlsx");
+ })
+ .catch(() => {
+ ElMessage.info("宸插彇娑�");
+ });
+ };
-const handleScheduledOut = () => {
- ElMessage.info('瀵煎嚭瀹氭椂浠诲姟鍔熻兘寰呭疄鐜�')
-}
-
-// 浠诲姟璁板綍鐩稿叧鏂规硶锛堝師璁惧淇濆吇椤甸潰鏂规硶锛�
-const getTableData = async () => {
- try {
- const params = {
- current: pagination.value.currentPage,
- size: pagination.value.pageSize,
- deviceName: filters.deviceName || undefined,
- maintenancePlanTime: filters.maintenancePlanTime ? dayjs(filters.maintenancePlanTime).format('YYYY-MM-DD') : undefined,
- maintenanceActuallyTime: filters.maintenanceActuallyTime ? dayjs(filters.maintenanceActuallyTime).format('YYYY-MM-DD') : undefined,
- maintenanceActuallyName: filters.maintenanceActuallyName || undefined,
+ const handleDateChange = (date, type) => {
+ if (type === 1) {
+ filters.maintenanceActuallyTime = date
+ ? dayjs(date).format("YYYY-MM-DD")
+ : "";
+ } else {
+ filters.maintenancePlanTime = date ? dayjs(date).format("YYYY-MM-DD") : "";
}
+ getTableData();
+ };
- const { code, data } = await getUpkeepPage(params)
- if (code === 200) {
- dataList.value = data.records
- pagination.value.total = data.total
+ // 鎵撳紑闄勪欢寮圭獥
+ const openFileDialog = async row => {
+ currentMaintenanceTaskId.value = row.id;
+ fileDialogVisible.value = true;
+ };
+
+ onMounted(() => {
+ // 鏍规嵁榛樿婵�娲荤殑 Tab 璋冪敤瀵瑰簲鐨勬煡璇㈡帴鍙�
+ if (activeTab.value === "scheduled") {
+ getScheduledTableData();
+ } else {
+ getTableData();
}
- } catch (error) {
- console.log(error);
-
- }
-}
-
-const resetFilters = () => {
- filters.deviceName = ''
- filters.maintenancePlanTime = ''
- filters.maintenanceActuallyTime = ''
- filters.maintenanceActuallyName = ''
- getTableData()
-}
-
-const handleSelectionChange = (selection) => {
- multipleList.value = selection
-}
-
-// 妫�鏌ラ�変腑鐨勮褰曚腑鏄惁鏈夊畬缁撶姸鎬佺殑
-const hasFinishedStatus = computed(() => {
- return multipleList.value.some(item => item.status === 1)
-})
-
-const changePage = (page) => {
- pagination.value.currentPage = page.page
- pagination.value.pageSize = page.limit
- getTableData()
-}
-
-const addMaintain = (row) => {
- maintainModalRef.value.open(row.id, row)
-}
-
-const addPlan = () => {
- planModalRef.value.openModal()
-}
-
-const editPlan = (id) => {
- planModalRef.value.openEdit(id)
-}
-
-const delRepairByIds = async (ids) => {
- // 妫�鏌ユ槸鍚︽湁瀹岀粨鐘舵�佺殑璁板綍
- const hasFinished = multipleList.value.some(item => item.status === 1)
- if (hasFinished) {
- ElMessage.warning('涓嶈兘鍒犻櫎鐘舵�佷负瀹岀粨鐨勮褰�')
- return
- }
-
- try {
- await ElMessageBox.confirm('纭鍒犻櫎淇濆吇鏁版嵁, 姝ゆ搷浣滀笉鍙��?', '璀﹀憡', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- })
-
- const { code } = await delUpkeep(ids)
- if (code === 200) {
- ElMessage.success('鍒犻櫎鎴愬姛')
- getTableData()
- }
- } catch (error) {
- // 鐢ㄦ埛鍙栨秷鍒犻櫎
- }
-}
-
-const handleOut = () => {
- ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�', '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- })
- .then(() => {
- proxy.download('/device/maintenance/export', {}, '璁惧淇濆吇.xlsx')
- })
- .catch(() => {
- ElMessage.info('宸插彇娑�')
- })
-}
-
-const handleDateChange = (date, type) => {
- if (type === 1) {
- filters.maintenanceActuallyTime = date ? dayjs(date).format('YYYY-MM-DD') : ''
- } else {
- filters.maintenancePlanTime = date ? dayjs(date).format('YYYY-MM-DD') : ''
- }
- getTableData()
-}
-
-// 鎵撳紑闄勪欢寮圭獥
-const openFileDialog = async (row) => {
- currentMaintenanceTaskId.value = row.id
- fileDialogVisible.value = true
-}
-
-onMounted(() => {
- // 鏍规嵁榛樿婵�娲荤殑 Tab 璋冪敤瀵瑰簲鐨勬煡璇㈡帴鍙�
- if (activeTab.value === 'scheduled') {
- getScheduledTableData()
- } else {
- getTableData()
- }
-})
+ });
</script>
<style lang="scss" scoped>
-.table_list {
- margin-top: unset;
-}
-.actions {
- display: flex;
- justify-content: space-between;
- margin-bottom: 10px;
-}
+ .table_list {
+ margin-top: unset;
+ }
+ .actions {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ }
</style>
diff --git a/src/views/productionManagement/workOrderEdit/index.vue b/src/views/productionManagement/workOrderEdit/index.vue
index b919973..fe75df3 100644
--- a/src/views/productionManagement/workOrderEdit/index.vue
+++ b/src/views/productionManagement/workOrderEdit/index.vue
@@ -68,6 +68,55 @@
</span>
</template>
</el-dialog>
+ <!-- 鎸囧畾鎶ュ伐浜哄脊绐� -->
+ <el-dialog v-model="assignReporterDialogVisible"
+ title="鎸囧畾鎶ュ伐浜�"
+ width="800px">
+ <div class="assign-reporter-content">
+ <div class="selected-tags-box"
+ v-if="selectedEmployeeIds.length > 0">
+ <div class="tags-label">宸查�夋嫨锛�</div>
+ <div class="tags-list">
+ <el-tag v-for="id in selectedEmployeeIds"
+ :key="id"
+ closable
+ @close="removeEmployeeTag(id)"
+ class="employee-tag">
+ {{ getEmployeeNameById(id) }}
+ </el-tag>
+ </div>
+ </div>
+ <div class="employee-list-container"
+ v-loading="employeeTableLoading">
+ <el-checkbox-group v-model="selectedEmployeeIds">
+ <div class="employee-grid">
+ <div v-for="item in employeeTableData"
+ :key="item.userId"
+ class="employee-item">
+ <el-checkbox :label="item.userId"
+ border>
+ <div class="employee-info">
+ <span class="name">{{ item.nickName }}</span>
+ <span class="dept">{{ item.dept?.deptName }}</span>
+ </div>
+ </el-checkbox>
+ </div>
+ </div>
+ </el-checkbox-group>
+ <div v-if="employeeTableData.length === 0"
+ class="empty-text">
+ 鏆傛棤鍖归厤浜哄憳
+ </div>
+ </div>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="assignReporterDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary"
+ @click="handleSaveReporters">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -77,7 +126,9 @@
import {
productWorkOrderPage,
updateProductWorkOrder,
+ assignProductWorkOrder,
} from "@/api/productionManagement/workOrder.js";
+ import { listUser } from "@/api/system/user.js";
const { proxy } = getCurrentInstance();
@@ -154,7 +205,7 @@
},
{
label: "鎿嶄綔",
- width: "100",
+ width: "200",
align: "center",
dataType: "action",
fixed: "right",
@@ -163,6 +214,12 @@
name: "璁″垝鏃堕棿",
clickFun: row => {
handleEdit(row);
+ },
+ },
+ {
+ name: "鎸囧畾鎶ュ伐浜�",
+ clickFun: row => {
+ handleAssignReporter(row);
},
},
],
@@ -178,6 +235,21 @@
size: 100,
total: 0,
});
+
+ // 鎸囧畾鎶ュ伐浜虹浉鍏�
+ const assignReporterDialogVisible = ref(false);
+ const employeeTableLoading = ref(false);
+ const employeeTableData = ref([]);
+ const employeePage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const employeeSearchForm = reactive({
+ staffName: "",
+ });
+ const selectedEmployeeIds = ref([]);
+ const currentWorkOrder = ref(null);
const data = reactive({
searchForm: {
@@ -247,6 +319,74 @@
});
};
+ const handleAssignReporter = row => {
+ currentWorkOrder.value = row;
+ assignReporterDialogVisible.value = true;
+ // 鍥炴樉宸插嬀閫夌殑浜哄憳
+ if (row.userIds) {
+ try {
+ selectedEmployeeIds.value = JSON.parse(row.userIds);
+ } catch (e) {
+ selectedEmployeeIds.value = [];
+ }
+ } else {
+ selectedEmployeeIds.value = [];
+ }
+ employeeSearchForm.staffName = "";
+ getEmployeeList();
+ };
+
+ const getEmployeeList = () => {
+ employeeTableLoading.value = true;
+ const params = {
+ pageNum: 1,
+ pageSize: 100,
+ };
+ listUser(params)
+ .then(res => {
+ employeeTableLoading.value = false;
+ employeeTableData.value = res.rows;
+ employeePage.total = res.total;
+ })
+ .catch(() => {
+ employeeTableLoading.value = false;
+ });
+ };
+
+ const getEmployeeNameById = id => {
+ const employee = employeeTableData.value.find(item => item.userId === id);
+ return employee ? employee.nickName : id;
+ };
+
+ const removeEmployeeTag = id => {
+ selectedEmployeeIds.value = selectedEmployeeIds.value.filter(
+ item => item !== id
+ );
+ };
+
+ const handleSaveReporters = () => {
+ if (selectedEmployeeIds.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鎶ュ伐浜�");
+ return;
+ }
+
+ const updateData = {
+ id: currentWorkOrder.value.id,
+ userIds: JSON.stringify(selectedEmployeeIds.value),
+ };
+ console.log(updateData, "updateData");
+
+ assignProductWorkOrder(updateData)
+ .then(() => {
+ proxy.$modal.msgSuccess("鎸囧畾鎴愬姛");
+ assignReporterDialogVisible.value = false;
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鎸囧畾澶辫触");
+ });
+ };
+
onMounted(() => {
getList();
});
@@ -269,4 +409,83 @@
font-size: 14px;
color: #606266;
}
+
+ .assign-reporter-content {
+ .selected-tags-box {
+ margin-bottom: 16px;
+ padding: 12px;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+ display: flex;
+ align-items: flex-start;
+
+ .tags-label {
+ font-size: 14px;
+ color: #606266;
+ margin-right: 8px;
+ white-space: nowrap;
+ margin-top: 4px;
+ }
+
+ .tags-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+
+ .employee-tag {
+ margin-bottom: 4px;
+ }
+ }
+ }
+
+ .employee-list-container {
+ max-height: 400px;
+ overflow-y: auto;
+ padding: 10px;
+ border: 1px solid #f0f0f0;
+ border-radius: 4px;
+
+ .employee-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
+ gap: 12px;
+ }
+
+ .employee-item {
+ :deep(.el-checkbox) {
+ width: 100%;
+ margin-right: 0;
+ height: auto;
+ padding: 8px;
+
+ .el-checkbox__label {
+ width: 100%;
+ }
+ }
+
+ .employee-info {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+
+ .name {
+ font-weight: bold;
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .dept {
+ font-size: 12px;
+ color: #909399;
+ }
+ }
+ }
+
+ .empty-text {
+ text-align: center;
+ color: #909399;
+ padding: 20px;
+ }
+ }
+ }
</style>
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index 95fb703..a0b4f32 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -242,7 +242,10 @@
<MaterialDialog v-model="materialDialogVisible"
:row-data="currentMaterialOrderRow"
@refresh="getList" />
- <FilesDia ref="workOrderFilesRef" />
+ <FileList v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ :record-type="'production_operation_task'"
+ :record-id="currentWorkOrderId" />
</div>
</template>
@@ -260,8 +263,8 @@
import { getDicts } from "@/api/system/dict/data";
import QRCode from "qrcode";
import { getCurrentInstance, reactive, toRefs } from "vue";
- import FilesDia from "./components/filesDia.vue";
import MaterialDialog from "./components/MaterialDialog.vue";
+ import FileList from "@/components/Dialog/FileList.vue";
const { proxy } = getCurrentInstance();
const tableColumn = ref([
@@ -370,7 +373,6 @@
],
},
]);
-
const tableData = ref([]);
const tableLoading = ref(false);
const transferCardVisible = ref(false);
@@ -378,7 +380,8 @@
const transferCardQrUrl = ref("");
const transferCardRowData = ref(null);
const reportDialogVisible = ref(false);
- const workOrderFilesRef = ref(null);
+ const fileDialogVisible = ref(false);
+ const currentWorkOrderId = ref(null);
const reportFormRef = ref(null);
const userOptions = ref([]);
const reportForm = reactive({
@@ -613,7 +616,8 @@
};
const openWorkOrderFiles = row => {
- workOrderFilesRef.value?.openDialog(row);
+ currentWorkOrderId.value = row.id;
+ fileDialogVisible.value = true;
};
const showReportDialog = row => {
@@ -689,12 +693,12 @@
return;
}
- if (quantity > reportForm.planQuantity) {
- ElMessageBox.alert("鏈鐢熶骇鏁伴噺涓嶈兘瓒呰繃寰呯敓浜ф暟閲�", "鎻愮ず", {
- confirmButtonText: "纭畾",
- });
- return;
- }
+ // if (quantity > reportForm.planQuantity) {
+ // ElMessageBox.alert("鏈鐢熶骇鏁伴噺涓嶈兘瓒呰繃寰呯敓浜ф暟閲�", "鎻愮ず", {
+ // confirmButtonText: "纭畾",
+ // });
+ // return;
+ // }
// 楠岃瘉鎶ュ簾鏁伴噺
const scrapQty = Number(reportForm.scrapQty);
--
Gitblit v1.9.3