From dcdb0231034810232f2542f3865666ebf72daf11 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 30 四月 2025 16:45:34 +0800
Subject: [PATCH] sf

---
 company_admin/src/components/business/OperaCategoryWindow.vue |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/company_admin/src/components/business/OperaCategoryWindow.vue b/company_admin/src/components/business/OperaCategoryWindow.vue
index 89cde75..16bdce6 100644
--- a/company_admin/src/components/business/OperaCategoryWindow.vue
+++ b/company_admin/src/components/business/OperaCategoryWindow.vue
@@ -3,19 +3,20 @@
       :title="title"
       :visible.sync="visible"
       :confirm-working="isWorking"
+      width="50%"
       @confirm="confirm"
     >
       <el-alert title="濡傛灉浠庡钩鍙伴�夋嫨鍟嗗搧杩涜鐩存挱锛屽缓璁被鍒�夋嫨浠庡钩鍙板簱閫夋嫨锛岀郴缁熷凡鍋氭暟鎹叧鑱旓紱" type="warning" effect="dark" :closable="false"></el-alert>
       <h3 style="margin: 20px 0 10px 0;">鍩烘湰淇℃伅</h3>
       <el-form :model="form" ref="form" :rules="rules">
         <el-form-item label="绫诲埆鏉ユ簮" prop="type">
-          <el-radio-group v-model="form.type" @change="changeRadio">
+          <el-radio-group v-model="form.type" :disabled="form.id ? true : false" @change="changeRadio">
             <el-radio :label="1">浠庡钩鍙板簱閫夋嫨</el-radio>
             <el-radio :label="0">浼佷笟鑷缓</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="閫夋嫨绫诲埆" prop="platCateId" v-if="form.type == 1">
-          <el-select v-model="form.platCateId" placeholder="璇烽�夋嫨" @change="changeCategory">
+          <el-select v-model="form.platCateId" filterable placeholder="璇烽�夋嫨" @change="changeCategory">
             <el-option
               v-for="item in categoryList"
               :key="item.id"
@@ -56,7 +57,7 @@
           style="width: 100%">
           <el-table-column label="鍙傛暟鍚�">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.name" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
+              <el-input v-model="scope.row.name" placeholder="璇疯緭鍏ュ悕绉�"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="璁剧疆涓洪�夐」">
@@ -65,6 +66,7 @@
                 v-model="scope.row.isselect"
                 active-color="#13ce66"
                 inactive-color="#ff4949"
+                @change="changeIsselect($event, scope.row)"
                 :active-value="1"
                 :inactive-value="0">
               </el-switch>
@@ -133,7 +135,7 @@
   <script>
   import BaseOpera from '@/components/base/BaseOpera'
   import GlobalWindow from '@/components/common/GlobalWindow'
-  import { create, updateById, baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js'
+  import { baseCategoryList, companyCreate, companyUpdateById } from '@/api/business/category.js'
   export default {
     name: 'OperaCategoryWindow',
     extends: BaseOpera,
@@ -187,6 +189,18 @@
       })
     },
     methods: {
+      changeIsselect(e, item) {
+        let num = 0
+        this.form.tableData.forEach(row => {
+          if (row.isselect === 1) {
+            num += 1
+          }
+        })
+        if (num > 2) {
+          item.isselect = 0
+          this.$message.warning({ message: '鍙兘璁剧疆涓や釜閫夐」' })
+        }
+      },
       addItem() {
         this.form.tableData.push({ name: '', isselect: 0, isshow: 1 })
       },
@@ -211,6 +225,12 @@
           // 璋冪敤鏂板缓鎺ュ彛
           this.isWorking = true
           if (!this.form.id) {
+            let arr = []
+            this.form.budgetList.forEach(item => {
+              if (item.maxamount || item.minamount) {
+                arr.push(item)
+              }
+            })
             companyCreate({
               paramList: this.form.tableData,
               type: this.form.type,
@@ -218,7 +238,7 @@
               platCateId: this.form.platCateId,
               name: this.form.name,
               imgurl: this.form.imgurl,
-              budgetList: this.form.budgetList
+              budgetList: arr
             })
               .then(() => {
                 this.visible = false
@@ -232,6 +252,12 @@
                 this.isWorking = false
               })
           } else {
+            let arr = []
+            this.form.budgetList.forEach(item => {
+              if (item.maxamount || item.minamount) {
+                arr.push(item)
+              }
+            })
             companyUpdateById({
               id: this.form.id,
               paramList: this.form.tableData,
@@ -240,7 +266,7 @@
               platCateId: this.form.platCateId,
               name: this.form.name,
               imgurl: this.form.imgurl,
-              budgetList: this.form.budgetList
+              budgetList: arr
             })
               .then(() => {
                 this.visible = false
@@ -264,7 +290,7 @@
             this.form.sortnum = item.sortnum
             let arr = []
             item.baseCateParamList.forEach((row, index) => {
-              arr.push({ name: row.name, isselect: index <= 1 ? 1 : 0, isshow: 1 })
+              arr.push({ name: row.name, baseCateParamId: row.id, isselect: 0, isshow: 1 })
             })
             this.form.tableData = arr
             this.form.imgurl = item.imgurl

--
Gitblit v1.9.3