From 6570b36a352edd87532dcf13a124181d4d815a39 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 30 六月 2026 13:23:26 +0800
Subject: [PATCH] 销项发票页面新增录入发票功能
---
src/views/equipmentManagement/repair/index.vue | 412 ++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 285 insertions(+), 127 deletions(-)
diff --git a/src/views/equipmentManagement/repair/index.vue b/src/views/equipmentManagement/repair/index.vue
index 96fb91b..f1573cb 100644
--- a/src/views/equipmentManagement/repair/index.vue
+++ b/src/views/equipmentManagement/repair/index.vue
@@ -1,97 +1,203 @@
<template>
<div class="app-container">
+ <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-form-item>
+ <el-form-item label="瑙勬牸鍨嬪彿">
+ <el-input v-model="filters.deviceModel"
+ style="width: 240px"
+ placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
+ clearable
+ :prefix-icon="Search"
+ @change="getTableData" />
+ </el-form-item>
+ <el-form-item label="鏁呴殰鐜拌薄">
+ <el-input v-model="filters.remark"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ユ晠闅滅幇璞�"
+ clearable
+ :prefix-icon="Search"
+ @change="getTableData" />
+ </el-form-item>
+ <el-form-item label="缁翠慨浜�">
+ <el-input v-model="filters.maintenanceName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ョ淮淇汉"
+ clearable
+ :prefix-icon="Search"
+ @change="getTableData" />
+ </el-form-item>
+ <el-form-item label="鎶ヤ慨鏃ユ湡">
+ <el-date-picker v-model="filters.repairTimeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鎶ヤ慨鏃ユ湡"
+ size="default"
+ @change="(date) => handleDateChange(date,2)" />
+ </el-form-item>
+ <el-form-item label="缁翠慨鏃ユ湡">
+ <el-date-picker v-model="filters.maintenanceTimeStr"
+ type="date"
+ placeholder="璇烽�夋嫨缁翠慨鏃ユ湡"
+ size="default"
+ @change="(date) => handleDateChange(date,1)" />
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="getTableData">鎼滅储</el-button>
+ <el-button @click="resetFilters">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
<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"
- :disabled="multipleList.length !== 1"
- @click="addMaintain"
- >
- 鏂板缁翠慨
- </el-button>
- <el-button type="success" icon="Van" @click="addRepair">
+ <el-button type="success"
+ icon="Van"
+ @click="addRepair">
鏂板鎶ヤ慨
</el-button>
- <el-button
- type="danger"
- icon="Delete"
- :disabled="multipleList.length <= 0"
- @click="delRepairByIds(multipleList.map((item) => item.id))"
- >
+ <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>
</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"
- >
+ @selection-change="handleSelectionChange"
+ @pagination="changePage">
<template #statusRef="{ row }">
- <el-tag v-if="row.status === 1" type="success">瀹岀粨</el-tag>
- <el-tag v-if="row.status === 0" type="error">寰呯淮淇�</el-tag>
+ <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 === 3"
+ type="info">寰呴獙鏀�</el-tag>
+ <el-tag v-if="row.status === 0"
+ type="warning">寰呯淮淇�</el-tag>
</template>
<template #operation="{ row }">
- <el-button
- type="primary"
- text
- icon="editPen"
- @click="editRepair(row.id)"
- >
+ <el-button type="primary"
+ link
+ @click="viewRepair(row.id)">
+ 璇︽儏
+ </el-button>
+ <el-button type="primary"
+ link
+ :disabled="row.status === 1 || row.status === 3"
+ @click="editRepair(row.id)">
缂栬緫
</el-button>
- <el-button
- type="danger"
- text
- icon="delete"
- @click="delRepairByIds(row.id)"
- >
+ <el-button type="success"
+ link
+ :disabled="row.status !== 0"
+ @click="addMaintain(row)">
+ 缁翠慨
+ </el-button>
+ <el-button type="warning"
+ link
+ :disabled="row.status !== 3"
+ @click="openAcceptance(row)">
+ 楠屾敹
+ </el-button>
+ <el-button type="danger"
+ link
+ :disabled="row.status === 1 || row.status === 3"
+ @click="delRepairByIds(row.id)">
鍒犻櫎
+ </el-button>
+ <el-button type="primary"
+ link
+ @click="openFileDialog(row)">
+ 闄勪欢
</el-button>
</template>
</PIMTable>
</div>
- <RepairModal ref="repairModalRef" @ok="getTableData" />
- <MaintainModal ref="maintainModalRef" @ok="getTableData" />
+ <RepairModal ref="repairModalRef"
+ @ok="getTableData" />
+ <MaintainModal ref="maintainModalRef"
+ @ok="getTableData" />
+ <AcceptanceModal ref="acceptanceModalRef"
+ @ok="getTableData" />
+ <FileList v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ :record-type="'device_repair'"
+ :record-id="recordId" />
</div>
</template>
<script setup>
-import { usePaginationApi } from "@/hooks/usePaginationApi";
-import { getRepairPage, delRepair } from "@/api/equipmentManagement/repair";
-import { onMounted } from "vue";
-import RepairModal from "./Modal/RepairModal.vue";
-import { ElMessageBox, ElMessage } from "element-plus";
-import dayjs from "dayjs";
-import MaintainModal from "./Modal/MaintainModal.vue";
+ import {
+ onMounted,
+ getCurrentInstance,
+ computed,
+ ref,
+ defineAsyncComponent,
+ } from "vue";
+ import { usePaginationApi } from "@/hooks/usePaginationApi";
+ import { getRepairPage, delRepair } from "@/api/equipmentManagement/repair";
+ import RepairModal from "./Modal/RepairModal.vue";
+ import { ElMessageBox, ElMessage } from "element-plus";
+ import dayjs from "dayjs";
+ import MaintainModal from "./Modal/MaintainModal.vue";
+ import AcceptanceModal from "./Modal/AcceptanceModal.vue";
+ const FileList = defineAsyncComponent(() =>
+ import("@/components/Dialog/FileList.vue")
+ );
-defineOptions({
- name: "璁惧鎶ヤ慨",
-});
+ defineOptions({
+ name: "璁惧鎶ヤ慨",
+ });
-// 妯℃�佹瀹炰緥
-const repairModalRef = ref();
-const maintainModalRef = ref();
+ const { proxy } = getCurrentInstance();
-// 琛ㄦ牸澶氶�夋閫変腑椤�
-const multipleList = ref([]);
+ // 妯℃�佹瀹炰緥
+ const repairModalRef = ref();
+ const maintainModalRef = ref();
+ const acceptanceModalRef = ref();
-// 琛ㄦ牸閽╁瓙
-const { filters, columns, dataList, pagination, getTableData, resetFilters } =
- usePaginationApi(
+ // 琛ㄦ牸澶氶�夋閫変腑椤�
+ const multipleList = ref([]);
+
+ // 琛ㄦ牸閽╁瓙
+ const {
+ filters,
+ columns,
+ dataList,
+ pagination,
+ getTableData,
+ resetFilters,
+ onCurrentChange,
+ } = usePaginationApi(
getRepairPage,
{
- searchText: undefined,
+ deviceName: undefined,
+ deviceModel: undefined,
+ remark: undefined,
+ maintenanceName: undefined,
+ repairTimeStr: undefined,
+ maintenanceTimeStr: undefined,
},
[
{
@@ -108,33 +214,12 @@
label: "鎶ヤ慨鏃ユ湡",
align: "center",
prop: "repairTime",
- formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
+ formatData: cell => dayjs(cell).format("YYYY-MM-DD"),
},
{
label: "鎶ヤ慨浜�",
align: "center",
prop: "repairName",
- },
- {
- label: "鏁呴殰鐜拌薄",
- align: "center",
- prop: "remark",
- },
- {
- label: "缁翠慨浜�",
- align: "center",
- prop: "maintenanceName",
- },
- {
- label: "缁翠慨缁撴灉",
- align: "center",
- prop: "maintenanceResult",
- },
- {
- label: "缁翠慨鏃ユ湡",
- align: "center",
- prop: "maintenanceTime",
- formatData: (cell) => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
},
{
label: "鐘舵��",
@@ -149,59 +234,132 @@
dataType: "slot",
slot: "operation",
align: "center",
- width: "200px",
+ width: "320px",
},
]
);
-// 澶氶�夊悗鍋氫粈涔�
-const handleSelectionChange = (selectionList) => {
- multipleList.value = selectionList;
-};
-
-// 鏂板鎶ヤ慨
-const addRepair = () => {
- repairModalRef.value.openModal();
-};
-
-// 缂栬緫鎶ヤ慨
-const editRepair = (id) => {
- repairModalRef.value.openEdit(id);
-};
-
-// 鏂板缁翠慨
-const addMaintain = () => {
- const row = multipleList.value[0];
- maintainModalRef.value.open(row.id, row);
-};
-
-// 鍗曡鍒犻櫎
-const delRepairByIds = async (ids) => {
- ElMessageBox.confirm("纭鍒犻櫎鎶ヤ慨鏁版嵁, 姝ゆ搷浣滀笉鍙��?", "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(async () => {
- const { code } = await delRepair(ids);
- if (code === 200) {
- ElMessage.success("鍒犻櫎鎴愬姛");
- getTableData();
+ // type === 1 缁翠慨 2鎶ヤ慨闂�
+ const handleDateChange = (value, type) => {
+ filters.maintenanceTimeStr = null;
+ filters.c = null;
+ if (type === 1) {
+ if (value) {
+ filters.maintenanceTimeStr = dayjs(value).format("YYYY-MM-DD");
+ }
+ } else {
+ if (value) {
+ filters.repairTimeStr = dayjs(value).format("YYYY-MM-DD");
+ }
}
- });
-};
+ getTableData();
+ };
-onMounted(() => {
- getTableData();
-});
+ // 鎵撳紑闄勪欢寮圭獥
+ const recordId = ref(0);
+ const fileDialogVisible = ref(false);
+
+ const openFileDialog = async row => {
+ recordId.value = row.id;
+ fileDialogVisible.value = true;
+ };
+
+ // 澶氶�夊悗鍋氫粈涔�
+ const handleSelectionChange = selectionList => {
+ multipleList.value = selectionList;
+ };
+
+ // 妫�鏌ラ�変腑鐨勮褰曚腑鏄惁鏈夊畬缁撶姸鎬佺殑
+ const hasFinishedStatus = computed(() => {
+ return multipleList.value.some(item => item.status === 1);
+ });
+
+ // 鏂板鎶ヤ慨
+ const addRepair = () => {
+ repairModalRef.value.openAdd();
+ };
+
+ // 璇︽儏鏌ョ湅
+ const viewRepair = id => {
+ repairModalRef.value.openView(id);
+ };
+
+ // 缂栬緫鎶ヤ慨
+ const editRepair = id => {
+ repairModalRef.value.openEdit(id);
+ };
+
+ // 鏂板缁翠慨
+ const addMaintain = row => {
+ maintainModalRef.value.open(row.id, row);
+ };
+
+ // 鎵撳紑楠屾敹寮圭獥
+ const openAcceptance = row => {
+ acceptanceModalRef.value.open(row);
+ };
+
+ const changePage = ({ page, limit }) => {
+ pagination.currentPage = page;
+ pagination.pageSize = limit;
+ onCurrentChange(page);
+ };
+
+ // 鍗曡鍒犻櫎
+ const delRepairByIds = async ids => {
+ // 妫�鏌ユ槸鍚︽湁瀹岀粨鐘舵�佺殑璁板綍
+ const idsArray = Array.isArray(ids) ? ids : [ids];
+ const hasFinished = idsArray.some(id => {
+ const record = dataList.value.find(item => item.id === id);
+ return record && record.status === 1;
+ });
+
+ if (hasFinished) {
+ ElMessage.warning("涓嶈兘鍒犻櫎鐘舵�佷负瀹岀粨鐨勮褰�");
+ return;
+ }
+
+ ElMessageBox.confirm("纭鍒犻櫎鎶ヤ慨鏁版嵁, 姝ゆ搷浣滀笉鍙��?", "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(async () => {
+ const { code } = await delRepair(ids);
+ if (code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getTableData();
+ }
+ });
+ };
+
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/device/repair/export", {}, "璁惧鎶ヤ慨.xlsx");
+ })
+ .catch(() => {
+ ElMessage.info("宸插彇娑�");
+ });
+ };
+
+ onMounted(() => {
+ 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>
--
Gitblit v1.9.3