From 47bae1f938f915206e3934ea960aff975e5738c9 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 12 六月 2026 16:09:49 +0800
Subject: [PATCH] feat(teachingDemo): 新增工艺路线与BOM教学演示模块

---
 src/views/financialManagement/assets/intangibleAssets.vue |   63 +++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/src/views/financialManagement/assets/intangibleAssets.vue b/src/views/financialManagement/assets/intangibleAssets.vue
index 649ec5b..b2c13b1 100644
--- a/src/views/financialManagement/assets/intangibleAssets.vue
+++ b/src/views/financialManagement/assets/intangibleAssets.vue
@@ -39,11 +39,12 @@
         <div>
           <el-button type="primary" @click="add" icon="Plus">鏂板璧勪骇</el-button>
           <el-button type="warning" @click="handleAmortization" icon="Money">鎽婇攢璁℃彁</el-button>
-          <el-button @click="handleOut" icon="Download">瀵煎嚭</el-button>
+          <!-- <el-button @click="handleOut" icon="Download">瀵煎嚭</el-button> -->
         </div>
       </div>
       <PIMTable
         rowKey="id"
+        isSelection
         :column="columns"
         :tableData="dataList"
         :page="{
@@ -51,6 +52,7 @@
           size: pagination.pageSize,
           total: pagination.total,
         }"
+        @selection-change="handleSelectionChange"
         @pagination="changePage"
       >
         <template #originalValue="{ row }">
@@ -70,18 +72,18 @@
         </template>
         <template #operation="{ row }">
           <el-button type="primary" link @click="view(row)">鏌ョ湅</el-button>
-          <el-button type="primary" link @click="edit(row)">缂栬緫</el-button>
+          <el-button v-if="row.status !== 'amortized'" type="primary" link @click="edit(row)">缂栬緫</el-button>
           <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
         </template>
       </PIMTable>
     </div>
 
     <FormDialog :title="dialogTitle" v-model="dialogVisible" width="800px" @confirm="submitForm" @cancel="dialogVisible = false">
-      <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
+      <el-form :model="form" :rules="rules" :disabled="isView" ref="formRef" label-width="120px">
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="璧勪骇缂栧彿" prop="assetCode">
-              <el-input v-model="form.assetCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled />
+              <el-input v-model="form.assetCode" placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�" disabled />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -158,8 +160,15 @@
               <el-select v-model="form.status" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%;">
                 <el-option label="鍦ㄧ敤" value="in_use" />
                 <el-option label="闂茬疆" value="idle" />
-                <el-option label="宸叉憡閿�瀹屾瘯" value="amortized" />
+                <el-option v-if="isView" label="宸叉憡閿�瀹屾瘯" value="amortized" />
               </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍒涘缓鏃堕棿" prop="createTime">
+              <el-date-picker v-model="createTimeDate" type="date" placeholder="閫夋嫨鏃ユ湡" value-format="YYYY-MM-DD" style="width: 100%;" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -171,7 +180,7 @@
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button type="primary" @click="submitForm">纭畾</el-button>
+        <el-button v-if="!isView" type="primary" @click="submitForm">纭畾</el-button>
         <el-button @click="dialogVisible = false">鍙栨秷</el-button>
       </template>
     </FormDialog>
@@ -180,6 +189,7 @@
 
 <script setup>
 import { ref, reactive, onMounted, computed } from "vue";
+import dayjs from "dayjs";
 import { ElMessage, ElMessageBox } from "element-plus";
 import FormDialog from "@/components/Dialog/FormDialog.vue";
 import {
@@ -220,13 +230,21 @@
 ];
 
 const dataList = ref([]);
+const multipleList = ref([]);
 const dialogVisible = ref(false);
 const dialogTitle = ref("");
 const formRef = ref(null);
 const isEdit = ref(false);
+const isView = ref(false);
 const currentId = ref(null);
+const selectedIds = computed(() =>
+  multipleList.value
+    .map(item => item?.id)
+    .filter(id => id !== undefined && id !== null && id !== "")
+);
 
 const createDefaultForm = () => ({
+  id: null,
   assetCode: "",
   assetName: "",
   category: "",
@@ -241,10 +259,17 @@
   status: "in_use",
   description: "",
   remark: "",
+  createTime: "",
 });
 
 const form = reactive({
   ...createDefaultForm(),
+});
+const createTimeDate = computed({
+  get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
+  set: (value) => {
+    form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+  },
 });
 
 const rules = {
@@ -319,10 +344,15 @@
       status: filters.status,
     });
     dataList.value = data?.records || [];
+    multipleList.value = [];
     pagination.total = Number(data?.total || 0);
   } catch (error) {
     // 鎻愮ず鐢卞叏灞�璇锋眰鎷︽埅鍣ㄥ鐞嗭紝杩欓噷浠呴槻姝㈡湭鎹曡幏寮傚父
   }
+};
+
+const handleSelectionChange = (selectionList) => {
+  multipleList.value = selectionList;
 };
 
 const resetFilters = () => {
@@ -340,21 +370,21 @@
   getTableData();
 };
 
-const buildAssetCode = () => `WX${Date.now().toString().slice(-10)}`;
-
 const add = () => {
   isEdit.value = false;
+  isView.value = false;
   currentId.value = null;
   dialogTitle.value = "鏂板鏃犲舰璧勪骇";
   Object.assign(form, createDefaultForm(), {
-    assetCode: buildAssetCode(),
     acquisitionDate: new Date().toISOString().split('T')[0],
+    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
   });
   dialogVisible.value = true;
 };
 
 const edit = (row) => {
   isEdit.value = true;
+  isView.value = false;
   currentId.value = row.id;
   dialogTitle.value = "缂栬緫鏃犲舰璧勪骇";
   Object.assign(form, createDefaultForm(), row);
@@ -362,7 +392,8 @@
 };
 
 const view = (row) => {
-  ElMessage.info(`鏌ョ湅璧勪骇: ${row.assetName}`);
+  edit(row);
+  isView.value = true;
 };
 
 const handleDelete = (row) => {
@@ -382,12 +413,16 @@
 };
 
 const handleAmortization = () => {
-  ElMessageBox.confirm("纭杩涜鏈湀鎽婇攢璁℃彁鍚楋紵", "鎻愮ず", {
+  const ids = selectedIds.value;
+  const confirmText = ids.length
+    ? `纭瀵归�変腑鐨� ${ids.length} 鏉¤祫浜ц繘琛屾湰鏈堟憡閿�璁℃彁鍚楋紵`
+    : "纭杩涜鏈湀鎽婇攢璁℃彁鍚楋紵";
+  ElMessageBox.confirm(confirmText, "鎻愮ず", {
     confirmButtonText: "纭",
     cancelButtonText: "鍙栨秷",
     type: "info",
   }).then(async () => {
-    await amortizeIntangibleAsset({});
+    await amortizeIntangibleAsset({ ids });
     ElMessage.success("鎽婇攢璁℃彁瀹屾垚");
     await getTableData();
   });
@@ -398,6 +433,10 @@
 };
 
 const submitForm = () => {
+  if (isView.value) {
+    dialogVisible.value = false;
+    return;
+  }
   formRef.value.validate(async valid => {
     if (valid) {
       try {

--
Gitblit v1.9.3