From 3849263b31a16a91ff08acaa42786ecfde76f33c Mon Sep 17 00:00:00 2001
From: zhangback <zhangback@163.com>
Date: 星期四, 27 十一月 2025 20:18:08 +0800
Subject: [PATCH] 提交

---
 ui/admin-ui3/src/views/tms/collectionTmsQuotePlan/index.vue |  156 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 151 insertions(+), 5 deletions(-)

diff --git a/ui/admin-ui3/src/views/tms/collectionTmsQuotePlan/index.vue b/ui/admin-ui3/src/views/tms/collectionTmsQuotePlan/index.vue
index 98cdbeb..2d40f20 100644
--- a/ui/admin-ui3/src/views/tms/collectionTmsQuotePlan/index.vue
+++ b/ui/admin-ui3/src/views/tms/collectionTmsQuotePlan/index.vue
@@ -46,8 +46,40 @@
         </el-button>
       </template>
       <template #menu-before="{row}">
-        <el-link size="small" type="primary" @click="goToDetail(row)"  class="link-btn" :underline="false" icon="el-icon-d-arrow-right">鎶ヤ环鏄庣粏</el-link>
+        <el-link size="small" type="primary" @click="goToDetail(row)"  class="link-btn" :underline="false" icon="el-icon-d-arrow-right">杩愯垂鎶ヤ环</el-link>
       </template>
+      <template #items-form="scope">
+        <avue-crud
+            :option="{...itemsTableOption,selection: !scope.disabled}"          @selection-change="selectionChange2"
+
+            :data="form.items" ref="itemsCrudRef"
+        >
+          <template #unit="{row}">
+            <el-select  v-model="row.unit" :disabled="scope.disabled || !rowKeys.includes(row.rowKey)" placeholder="璇烽�夋嫨璁¤垂鍗曚綅">
+              <el-option
+                  v-for="dict in sys_unit"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+              ></el-option>
+            </el-select>
+          </template>
+          <template #price="{row}">
+            <el-input v-model="row.price" :min="1" :disabled="scope.disabled || !rowKeys.includes(row.rowKey)" type="number" placeholder="璇疯緭鍏ラ噾棰�"></el-input>
+          </template>
+          <template #currency="{row}">
+            <el-radio-group v-model="row.currency"  :disabled="scope.disabled || !rowKeys.includes(row.rowKey)">
+              <el-radio
+                  v-for="dict in sys_currency"
+                  :key="dict.value"
+                  :label="dict.value"
+              >{{ dict.label }}</el-radio>
+            </el-radio-group>
+          </template>
+
+        </avue-crud>
+      </template>
+
     </avue-crud>
   </basicContainer>
 </template>
@@ -63,16 +95,19 @@
   updateTmsQuotePlan
 } from "@/api/tms/tmsQuotePlan";
 import useCurrentInstance from "@/utils/useCurrentInstance";
-import {computed, reactive, ref, toRefs} from "vue";
+import {computed, reactive, ref, toRefs,nextTick} from "vue";
 import {PagesInterface, PageQueryInterface} from "@/utils/globalInterface";
 import {usePagePlus} from "@/hooks/usePagePlus";
 import {hasPermission} from "@/utils/permissionUtils";
 import {getTmsProject, listTmsProject} from "@/api/tms/tmsProject";
 import router from "@/router";
+import {getDicts} from "@/api/system/dict/data";
+import { randomId } from "@smallwei/avue";
 
 const {proxy} = useCurrentInstance();
 const crudRef = ref();
-
+const {sys_quotation_items,sys_unit,sys_currency} =
+    proxy.useDict("sys_quotation_items","sys_unit","sys_currency");
 const permissionList = computed(() => {
   return {
     addBtn: hasPermission(["tms:tmsQuotePlan:add"]),
@@ -91,8 +126,10 @@
     currentPage: 1,
   },
   selectionList: [],
+  selectionList2: <any>[],
+
 })
-const {queryParams, form, page, selectionList} = toRefs(data);
+const {queryParams, form, page, selectionList,selectionList2} = toRefs(data);
 const option = ref({
   pageKey: 'TmsQuotePlan',
   rowKey: 'id',
@@ -236,6 +273,15 @@
       }
     },
     {
+      label: '搴旀敹璐圭敤鎶ヤ环',
+      prop: 'bjxm',
+      column:{
+        items:{
+          label: '', labelWidth:0,span:24,
+        }
+      }
+    },
+    {
       label: '鍏朵粬淇℃伅',
       prop: 'qtxx',
       column:{
@@ -339,6 +385,30 @@
   }
 })
 
+const itemsTableOption = ref({
+  pageKey: 'itemsTable',
+  rowKey: 'rowKey',
+  header: false,
+  addBtn: false,menu: false,
+  column:{
+    freeName:{
+      label: '璐圭敤鍚嶇О',
+    },
+    unit:{
+      label: '*璁¢噺鍗曚綅',
+    },
+    price:{
+      label: '*璁¤垂閲戦',
+    },
+    currency:{
+      label: '甯佸埗',
+    }
+  }
+})
+const itemsCrudRef =ref()
+
+
+
 const {
   tableData,
   pageF,
@@ -376,11 +446,87 @@
   },
   getBeginListFunc:()=>{
     queryParams.value.planType = '0'
+  },
+  handleBeforeOpenFunc:(type:string)=>{
+    form.value.items = [];
+    if (type === 'add'){
+      form.value.items = sys_quotation_items.value.map((item:any)=>{
+        return { rowKey: randomId() ,freeName: item.label,unit: '娆�'}
+      })
+    }
+  },
+  rowSaveBegin:(row:any,loading:any)=>{
+      if (selectionList2.value.length == 0){
+        proxy.$modal.msgError("璇疯嚦灏戦�夋嫨涓�鏉″簲鏀惰垂鐢ㄦ姤浠烽」");
+        loading();
+        throw new Error("璇疯嚦灏戦�夋嫨涓�鏉″簲鏀惰垂鐢ㄦ姤浠烽」");
+
+      }
+      let filter = selectionList2.value.filter((item:any)=>{
+         return !item.price || !item.currency
+       });
+      if (filter.length > 0){
+        proxy.$modal.msgError("璇峰~鍐欐墍鏈夊繀濉」");
+        loading();
+        throw new Error("璇峰~鍐欐墍鏈夊繀濉」")
+      }
+      row.quoteItems = selectionList2.value;
+
+  },
+  rowUpdateBegin(row:any,loading:any){
+    if (selectionList2.value.length == 0){
+      proxy.$modal.msgError("璇疯嚦灏戦�夋嫨涓�鏉″簲鏀惰垂鐢ㄦ姤浠烽」");
+      loading();
+      throw new Error("璇疯嚦灏戦�夋嫨涓�鏉″簲鏀惰垂鐢ㄦ姤浠烽」");
+
+    }
+    let filter = selectionList2.value.filter((item:any)=>{
+      return !item.price || !item.currency
+    });
+    if (filter.length > 0){
+      proxy.$modal.msgError("璇峰~鍐欐墍鏈夊繀濉」");
+      loading();
+      throw new Error("璇峰~鍐欐墍鏈夊繀濉」")
+    }
+    row.quoteItems = selectionList2.value;
+  },
+  handleEndOpenFunc:(type:string,res:any)=>{
+    if (type === 'edit'){
+      selectionList2.value = (res.data.quoteItems || []).map((item:any)=>{
+        item.rowKey =randomId()
+        return item;
+      });
+      form.value.items = sys_quotation_items.value.map((item:any)=>{
+        let find = selectionList2.value.find((ele:any)=>
+          ele.freeName === item.label
+        );
+        if ( find){
+          return find;
+        }else{
+          return { rowKey: randomId() ,freeName: item.label,unit: '娆�'}
+        }
+      })
+      nextTick( ()=>{
+        selectionList2.value.map((find:any)=>{
+          itemsCrudRef.value.toggleRowSelection(find,true)
+        })
+
+      })
+    }else{
+      form.value.items = res.data.quoteItems || [];
+    }
   }
 })
 
 const goToDetail = (row?:any) => {
-  router.push("/basic/tmsQuoteDetail?quotePlanId=" + row.id);
+  router.push("/collectionTmsQuotePlan/collectionTmsQuotePlanItem?quotePlanType=0&quotePlanId=" + row.id);
 }
 
+const rowKeys = ref<any>([]);
+const selectionChange2 = (selection?: any[]) => {
+  selectionList2.value = selection;
+  rowKeys.value = selection?.map((item:any)=>item.rowKey);
+}
+
+
 </script>

--
Gitblit v1.8.0