From 9cf2a2365b1e5cf0c5a25cf05281465b8f667428 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 05 二月 2026 11:38:14 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/customerService/afterSalesHandling/index.vue | 233 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 229 insertions(+), 4 deletions(-)
diff --git a/src/views/customerService/afterSalesHandling/index.vue b/src/views/customerService/afterSalesHandling/index.vue
index 65a7551..c3a19b4 100644
--- a/src/views/customerService/afterSalesHandling/index.vue
+++ b/src/views/customerService/afterSalesHandling/index.vue
@@ -46,15 +46,64 @@
></PIMTable>
</div>
<form-dia ref="formDia" @close="handleQuery"></form-dia>
+ <FileListDialog
+ ref="fileListRef"
+ v-model="fileListDialogVisible"
+ title="鍞悗闄勪欢"
+ :show-upload-button="true"
+ :show-delete-button="true"
+ :upload-method="handleFileUpload"
+ :delete-method="handleFileDelete"
+ />
+ <el-dialog
+ v-model="repairDialogVisible"
+ title="缁翠慨璁板綍"
+ width="700px"
+ destroy-on-close
+ @close="repairRecordList = []"
+ >
+ <el-table
+ :data="repairRecordList"
+ border
+ v-loading="repairRecordLoading"
+ max-height="400"
+ >
+ <el-table-column type="index" label="搴忓彿" width="55" align="center" />
+ <el-table-column label="缁翠慨鏃ユ湡" prop="maintenanceTime" min-width="120" show-overflow-tooltip>
+ <template #default="{ row }">
+ {{ row.maintenanceTime || row.repairTime || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="缁翠慨浜�" prop="maintenanceName" min-width="100" show-overflow-tooltip>
+ <template #default="{ row }">
+ {{ row.maintenanceName || row.repairName || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="缁翠慨缁撴灉" prop="maintenanceResult" min-width="180" show-overflow-tooltip />
+ </el-table>
+ <template #footer>
+ <el-button @click="repairDialogVisible = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
</div>
</template>
<script setup>
import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, getCurrentInstance, nextTick} from "vue";
+import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {afterSalesServiceDelete, afterSalesServiceListPage} from "@/api/customerService/index.js";
+import FileListDialog from "@/components/Dialog/FileListDialog.vue";
+import { ElMessageBox } from "element-plus";
+import request from "@/utils/request";
+import { getToken } from "@/utils/auth";
+import {
+ afterSalesServiceDelete,
+ afterSalesServiceListPage,
+ afterSalesServiceFileListPage,
+ afterSalesServiceFileAdd,
+ afterSalesServiceFileDel,
+ afterSalesServiceRepairListPage,
+} from "@/api/customerService/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
@@ -134,7 +183,7 @@
label: "鎿嶄綔",
align: "center",
fixed: 'right',
- width: 120,
+ width: 240,
operation: [
{
name: "澶勭悊",
@@ -151,6 +200,22 @@
type: "text",
clickFun: (row) => {
openForm("view", row);
+ },
+ },
+ // TODO 涓哄啓鎶ュ憡娣诲姞鐨�
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: (row) => {
+ openFilesFormDia(row);
+ },
+ },
+ // TODO 涓哄啓鎶ュ憡娣诲姞鐨�
+ {
+ name: "缁翠慨璁板綍",
+ type: "text",
+ clickFun: (row) => {
+ openRepairDialog(row);
},
},
],
@@ -170,6 +235,166 @@
selectedRows.value = selection;
};
const formDia = ref()
+const fileListRef = ref(null)
+const fileListDialogVisible = ref(false)
+const currentFileRow = ref(null)
+const repairDialogVisible = ref(false)
+const repairRecordList = ref([])
+const repairRecordLoading = ref(false)
+
+// 鎵撳紑缁翠慨璁板綍寮规
+const openRepairDialog = async (row) => {
+ repairDialogVisible.value = true
+ repairRecordLoading.value = true
+ repairRecordList.value = []
+ try {
+ const res = await afterSalesServiceRepairListPage({
+ afterSalesServiceId: row.id,
+ current: 1,
+ size: 100,
+ })
+ if (res.code === 200 && res.data?.records) {
+ repairRecordList.value = res.data.records
+ }
+ } catch (error) {
+ proxy.$modal.msgError("鑾峰彇缁翠慨璁板綍澶辫触")
+ } finally {
+ repairRecordLoading.value = false
+ }
+}
+
+// 鎵撳紑闄勪欢寮规----- TODO锛氭帴鍙f槸娌℃湁瀵规帴鐨勶紝闇�瑕佹柊澧炴帴鍙o紝涓哄啓鎶ュ憡娣诲姞鐨�
+const openFilesFormDia = async (row) => {
+ currentFileRow.value = row
+ try {
+ const res = await afterSalesServiceFileListPage({
+ afterSalesServiceId: row.id,
+ current: 1,
+ size: 100,
+ })
+ if (res.code === 200 && fileListRef.value) {
+ const fileList = (res.data?.records || []).map((item) => ({
+ name: item.name || item.fileName,
+ url: item.url || item.fileUrl,
+ id: item.id,
+ ...item,
+ }))
+ fileListRef.value.open(fileList)
+ fileListDialogVisible.value = true
+ } else {
+ fileListRef.value?.open([])
+ fileListDialogVisible.value = true
+ }
+ } catch (error) {
+ proxy.$modal.msgError("鑾峰彇闄勪欢鍒楄〃澶辫触")
+ fileListRef.value?.open([])
+ fileListDialogVisible.value = true
+ }
+}
+
+// 涓婁紶闄勪欢
+const handleFileUpload = async () => {
+ if (!currentFileRow.value) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁")
+ return
+ }
+ return new Promise((resolve) => {
+ const input = document.createElement("input")
+ input.type = "file"
+ input.style.display = "none"
+ input.onchange = async (e) => {
+ const file = e.target.files[0]
+ if (!file) {
+ resolve(null)
+ return
+ }
+ try {
+ const formData = new FormData()
+ formData.append("file", file)
+ const uploadRes = await request({
+ url: "/file/upload",
+ method: "post",
+ data: formData,
+ headers: {
+ "Content-Type": "multipart/form-data",
+ Authorization: `Bearer ${getToken()}`,
+ },
+ })
+ if (uploadRes.code === 200) {
+ const fileData = {
+ afterSalesServiceId: currentFileRow.value.id,
+ name: uploadRes.data?.originalName || file.name,
+ url: uploadRes.data?.tempPath || uploadRes.data?.url,
+ }
+ const saveRes = await afterSalesServiceFileAdd(fileData)
+ if (saveRes.code === 200) {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛")
+ const listRes = await afterSalesServiceFileListPage({
+ afterSalesServiceId: currentFileRow.value.id,
+ current: 1,
+ size: 100,
+ })
+ if (listRes.code === 200 && fileListRef.value) {
+ const fileList = (listRes.data?.records || []).map((item) => ({
+ name: item.name || item.fileName,
+ url: item.url || item.fileUrl,
+ id: item.id,
+ ...item,
+ }))
+ fileListRef.value.setList(fileList)
+ }
+ resolve({ name: fileData.name, url: fileData.url, id: saveRes.data?.id })
+ } else {
+ proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触")
+ resolve(null)
+ }
+ } else {
+ proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触")
+ resolve(null)
+ }
+ } catch (err) {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触")
+ resolve(null)
+ } finally {
+ document.body.removeChild(input)
+ }
+ }
+ document.body.appendChild(input)
+ input.click()
+ })
+}
+
+// 鍒犻櫎闄勪欢
+const handleFileDelete = async (row) => {
+ try {
+ const res = await afterSalesServiceFileDel([row.id])
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+ if (currentFileRow.value && fileListRef.value) {
+ const listRes = await afterSalesServiceFileListPage({
+ afterSalesServiceId: currentFileRow.value.id,
+ current: 1,
+ size: 100,
+ })
+ if (listRes.code === 200) {
+ const fileList = (listRes.data?.records || []).map((item) => ({
+ name: item.name || item.fileName,
+ url: item.url || item.fileUrl,
+ id: item.id,
+ ...item,
+ }))
+ fileListRef.value.setList(fileList)
+ }
+ }
+ } else {
+ proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触")
+ return false
+ }
+ } catch (error) {
+ proxy.$modal.msgError("鍒犻櫎澶辫触")
+ return false
+ }
+}
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
--
Gitblit v1.9.3