From c7b4b9a2f4c0f05aeb60a9e3f5fba5d9a3676f3f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 18 八月 2025 16:22:42 +0800
Subject: [PATCH] 中强恒兴设备管理页面添加

---
 src/views/procurementManagement/returnManagement/index.vue |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/src/views/procurementManagement/returnManagement/index.vue b/src/views/procurementManagement/returnManagement/index.vue
new file mode 100644
index 0000000..c72fbaf
--- /dev/null
+++ b/src/views/procurementManagement/returnManagement/index.vue
@@ -0,0 +1,234 @@
+<template>
+  <div class="app-container">
+    <el-card class="search-card" shadow="never">
+      <el-form :model="searchForm" :inline="true">
+        <el-form-item label="閫�璐у崟鍙凤細" style="width: 300px;">
+          <el-input v-model="searchForm.returnNo" placeholder="璇疯緭鍏ラ��璐у崟鍙�" clearable />
+        </el-form-item>
+        <el-form-item label="閫�璐х被鍨嬶細" style="width: 300px;">
+          <el-select v-model="searchForm.returnType" placeholder="璇烽�夋嫨绫诲瀷" clearable>
+            <el-option label="閲囪喘閫�璐�" value="purchase" />
+            <el-option label="璐ㄦ閫�璐�" value="quality" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
+          <el-button @click="resetSearch">閲嶇疆</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <el-card class="table-card" shadow="never">
+      <div class="table-header">
+        <el-button type="primary" @click="openDialog('add')">鏂板閫�璐у崟</el-button>
+        <el-button type="success" @click="handleBatchApprove">鎵归噺瀹℃牳</el-button>
+        <el-button type="danger" @click="handleBatchDelete">鎵归噺鍒犻櫎</el-button>
+      </div>
+
+      <el-table :data="tableData" border v-loading="loading" @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="閫�璐у崟鍙�" prop="returnNo" width="180" />
+        <el-table-column label="鍏宠仈鍗曞彿" prop="relatedNo" width="180" />
+        <el-table-column label="閫�璐х被鍨�" prop="returnType" width="100">
+          <template #default="{ row }">
+            <el-tag :type="row.returnType === 'purchase' ? 'danger' : 'warning'">
+              {{ getReturnTypeText(row.returnType) }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" />
+        <el-table-column label="閫�璐х姸鎬�" prop="status" width="100">
+          <template #default="{ row }">
+            <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="閫�璐ч噾棰�" prop="returnAmount" width="120">
+          <template #default="{ row }">楼{{ row.returnAmount.toFixed(2) }}</template>
+        </el-table-column>
+        <el-table-column label="鍒涘缓鏃堕棿" prop="createTime" width="180" />
+        <el-table-column label="鎿嶄綔" width="200" align="center">
+          <template #default="{ row }">
+            <el-button type="primary" link @click="openDialog('edit', row)">缂栬緫</el-button>
+            <el-button type="success" link @click="handleApprove(row)" v-if="row.status === 'pending'">瀹℃牳</el-button>
+            <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-card>
+
+    <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '鏂板閫�璐у崟' : '缂栬緫閫�璐у崟'" width="600px">
+      <el-form :model="formData" label-width="120px">
+        <el-form-item label="閫�璐х被鍨�">
+          <el-select v-model="formData.returnType" placeholder="璇烽�夋嫨閫�璐х被鍨�" style="width: 100%">
+            <el-option label="閲囪喘閫�璐�" value="purchase" />
+            <el-option label="璐ㄦ閫�璐�" value="quality" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="鍏宠仈鍗曞彿">
+          <el-input v-model="formData.relatedNo" placeholder="璇疯緭鍏ュ叧鑱斿崟鍙�" />
+        </el-form-item>
+        <el-form-item label="渚涘簲鍟嗗悕绉�">
+          <el-input v-model="formData.supplierName" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" />
+        </el-form-item>
+        <el-form-item label="閫�璐у師鍥�">
+          <el-select v-model="formData.returnReason" placeholder="璇烽�夋嫨閫�璐у師鍥�" style="width: 100%">
+            <el-option label="璐ㄩ噺闂" value="quality" />
+            <el-option label="瑙勬牸涓嶇" value="specification" />
+            <el-option label="鏁伴噺閿欒" value="quantity" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="澶囨敞">
+          <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="dialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="handleSubmit">纭畾</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+
+const loading = ref(false)
+const dialogVisible = ref(false)
+const dialogType = ref('add')
+const selectedRows = ref([])
+
+const searchForm = reactive({
+  returnNo: '',
+  returnType: ''
+})
+
+const formData = reactive({
+  returnType: '',
+  relatedNo: '',
+  supplierName: '',
+  returnReason: '',
+  remark: ''
+})
+
+const mockData = [
+  {
+    id: 1,
+    returnNo: 'RT20241201001',
+    relatedNo: 'PO20241201001',
+    returnType: 'purchase',
+    supplierName: '渚涘簲鍟咥',
+    status: 'approved',
+    returnAmount: 500.00,
+    createTime: '2024-12-01 17:30:00',
+    returnReason: '璐ㄩ噺闂',
+    remark: '鍟嗗搧瀛樺湪璐ㄩ噺闂'
+  }
+]
+
+const tableData = ref([...mockData])
+
+const getReturnTypeText = (type) => {
+  const typeMap = { purchase: '閲囪喘閫�璐�', quality: '璐ㄦ閫�璐�' }
+  return typeMap[type] || '鏈煡'
+}
+
+const getStatusType = (status) => {
+  const statusMap = { pending: 'warning', approved: 'success', returned: 'info' }
+  return statusMap[status] || 'info'
+}
+
+const getStatusText = (status) => {
+  const statusMap = { pending: '寰呭鏍�', approved: '宸插鏍�', returned: '宸查��璐�' }
+  return statusMap[status] || '鏈煡'
+}
+
+const handleSearch = () => {
+  loading.value = true
+  setTimeout(() => { loading.value = false }, 500)
+}
+
+const resetSearch = () => {
+  Object.assign(searchForm, { returnNo: '', returnType: '' })
+}
+
+const openDialog = (type, row = {}) => {
+  dialogType.value = type
+  if (type === 'edit' && row.id) {
+    Object.assign(formData, {
+      returnType: row.returnType,
+      relatedNo: row.relatedNo,
+      supplierName: row.supplierName,
+      returnReason: row.returnReason,
+      remark: row.remark
+    })
+  } else {
+    Object.assign(formData, {
+      returnType: '',
+      relatedNo: '',
+      supplierName: '',
+      returnReason: '',
+      remark: ''
+    })
+  }
+  dialogVisible.value = true
+}
+
+const handleSubmit = () => {
+  if (dialogType.value === 'add') {
+    const newReturn = {
+      id: Date.now(),
+      returnNo: `RT${Date.now()}`,
+      relatedNo: formData.relatedNo,
+      returnType: formData.returnType,
+      supplierName: formData.supplierName,
+      status: 'pending',
+      returnAmount: 0,
+      createTime: new Date().toLocaleString(),
+      returnReason: formData.returnReason,
+      remark: formData.remark
+    }
+    tableData.value.unshift(newReturn)
+    ElMessage.success('鏂板鎴愬姛')
+  }
+  dialogVisible.value = false
+}
+
+const handleApprove = (row) => {
+  row.status = 'approved'
+  ElMessage.success('瀹℃牳閫氳繃')
+}
+
+const handleDelete = (row) => {
+  ElMessageBox.confirm('纭畾瑕佸垹闄よ繖鏉¤褰曞悧锛�', '鎻愮ず', {
+    confirmButtonText: '纭畾',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning'
+  }).then(() => {
+    const index = tableData.value.findIndex(item => item.id === row.id)
+    if (index !== -1) {
+      tableData.value.splice(index, 1)
+      ElMessage.success('鍒犻櫎鎴愬姛')
+    }
+  })
+}
+
+const handleBatchApprove = () => {
+  ElMessage.success('鎵归噺瀹℃牳鎴愬姛')
+}
+
+const handleBatchDelete = () => {
+  ElMessage.success('鎵归噺鍒犻櫎鎴愬姛')
+}
+
+const handleSelectionChange = (rows) => {
+  selectedRows.value = rows
+}
+</script>
+
+<style scoped>
+.app-container { padding: 20px; }
+.search-card { margin-bottom: 20px; }
+.table-card { margin-bottom: 20px; }
+.table-header { margin-bottom: 20px; }
+</style>

--
Gitblit v1.9.3