From b6fde711bf33cede4cb84f85146c32b0c0c61aa5 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 04 十一月 2024 09:06:28 +0800
Subject: [PATCH] 优化需求

---
 company/src/views/business/solutions.vue |  146 ++++++++++++++++++++++++++++++------------------
 1 files changed, 90 insertions(+), 56 deletions(-)

diff --git a/company/src/views/business/solutions.vue b/company/src/views/business/solutions.vue
index 3b1c2b0..c65c11e 100644
--- a/company/src/views/business/solutions.vue
+++ b/company/src/views/business/solutions.vue
@@ -5,12 +5,6 @@
             <el-form-item label="淇濋櫓鏂规" prop="name">
                 <el-input v-model="searchForm.name" placeholder="璇疯緭鍏�" @keypress.enter.native="search"></el-input>
             </el-form-item>
-            <el-form-item label="鍚敤鐘舵��" prop="status">
-                <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨" @keypress.enter.native="search">
-                    <el-option label="鍚敤" value="0"></el-option>
-                    <el-option label="绂佺敤" value="1"></el-option>
-                </el-select>
-            </el-form-item>
             <section>
                 <el-button type="primary" @click="search">鎼滅储</el-button>
                 <el-button @click="reset">閲嶇疆</el-button>
@@ -19,51 +13,69 @@
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
             <ul class="toolbar" v-permissions="['business:solutions:create']">
-                <li><el-button type="primary" @click="$refs.operaSolutionsWindow.open('鏂板缓淇濋櫓鏂规')" icon="el-icon-plus" v-permissions="['business:solutions:create']">鏂板缓</el-button></li>
+                <template v-if="userInfo.type !== 1">
+                    <li><el-button type="primary" @click="$refs.operaSolutionsWindow.open('鏂板瀛愭柟妗�')" v-permissions="['business:solutions:create']">娣诲姞鏂规</el-button></li>
+                </template>
             </ul>
             <el-table
                 v-loading="isWorking.search"
                 :data="tableData.list"
                 stripe
             >
-                <el-table-column prop="name" label="淇濋櫓鏂规" min-width="100px"></el-table-column>
-                <el-table-column prop="insuranceId" label="淇濋櫓鍏徃" min-width="100px"></el-table-column>
-                <el-table-column prop="insuranceId" label="鎶曚繚骞撮緞" min-width="100px"></el-table-column>
-                <el-table-column label="鎶曚繚鐢熸晥鏃ユ湡" min-width="100px">
-                    <template slot-scope="{row}">
-                        <span v-if="row.validType === 0">鏃ュ悗鐢熸晥</span>
-                        <span v-if="row.validType === 1">娆℃湀鐢熸晥</span>
+                <el-table-column label="搴忓彿" width="50px">
+                    <template slot-scope="scope">
+                        <span>{{scope.$index + 1}}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="淇濋櫓璐圭敤" min-width="100px">
+                <el-table-column prop="name" label="瀛愭柟妗堝悕绉�" min-width="150px"></el-table-column>
+                <el-table-column prop="solutionBaseName" label="涓绘柟妗�" min-width="100px"></el-table-column>
+                <el-table-column label="鎶曚繚绫诲瀷" min-width="120px" align="center">
                     <template slot-scope="{row}">
-                        <span>{{row.price}}鍏�/浜�/鏈�</span>
+                        <span v-if="row.type === 0">鐩翠繚</span>
+                        <span v-if="row.type === 1">濮旀墭<div style="color: blue;display:  block" >{{row.shopName||'-'}}</div></span>
                     </template>
                 </el-table-column>
-                <el-table-column prop="status" label="鍚敤鐘舵��" min-width="100px">
+                <el-table-column label="鎶曚繚浠锋牸" min-width="100px">
+                    <template slot-scope="{row}">
+                        <span>{{row.price}}鍏�/浜�/</span>
+                        <span v-if="row.timeUnit === 0">澶�</span>
+                        <!--                        <span v-if="row.timeUnit === 1">鍗婃湀</span>-->
+                        <span v-if="row.timeUnit === 2">鏈�</span>
+                        <span v-if="row.timeUnit === 3">瀛e害</span>
+                        <span v-if="row.timeUnit === 4">鍗婂勾</span>
+                        <span v-if="row.timeUnit === 5">骞�</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="retrial" label="闇�瑕佸瀹�">
+                    <template slot-scope="{row}">
+                        <span v-if="row.retrial === 0">涓嶉渶瑕�</span>
+                        <span v-if="row.retrial === 1">闇�瑕�</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="createDate" label="鏂规鍒涘缓鏃ユ湡" min-width="100px"></el-table-column>
+                <el-table-column prop="status" label="鍚敤鐘舵��" min-width="100px" v-if="userInfo.type !== 1">
                     <template slot-scope="{row}">
                         <el-switch
-                            v-model="row.status"
-                            active-color="#13ce66"
-                            inactive-color="#ff4949"
-                            :active-value="0"
-                            :inactive-value="1">
+                                @change="changeStatus($event, row)"
+                                v-model="row.status"
+                                active-color="#13ce66"
+                                inactive-color="#ff4949"
+                                :active-value="0"
+                                :inactive-value="1">
                         </el-switch>
                     </template>
                 </el-table-column>
-
-                <el-table-column prop="minAge" label="鏈�浣庡勾榫�" min-width="100px"></el-table-column>
-                <el-table-column prop="maxAge" label="鏈�楂樺勾榫�" min-width="100px"></el-table-column>
-
                 <el-table-column
                     v-if="containPermissions(['business:solutions:update', 'business:solutions:delete'])"
                     label="鎿嶄綔"
-                    min-width="120"
+                    min-width="150"
                     fixed="right"
                 >
                     <template slot-scope="{row}">
-                        <el-button type="text" @click="$refs.operaSolutionsWindow.open('鏂规璇︽儏', row)" icon="el-icon-edit" v-permissions="['business:solutions:update']">鏌ョ湅璇︽儏</el-button>
-                        <el-button type="text" @click="$refs.operaSolutionsWindow.open('缂栬緫淇濋櫓鏂规', row)" icon="el-icon-edit" v-permissions="['business:solutions:update']">淇敼</el-button>
+                        <el-button type="text" @click="$refs.OperaSolutionsDescWindow.open('瀛愭柟妗堣鎯�', { id: row.id })" icon="el-icon-edit" v-permissions="['business:solutions:update']">鏌ョ湅璇︽儏</el-button>
+                        <template v-if="userInfo.type !== 1">
+                            <el-button type="text" @click="$refs.operaSolutionsWindow.open('缂栬緫瀛愭柟妗�', { id: row.id })" icon="el-icon-edit" v-permissions="['business:solutions:update']">淇敼</el-button>
+                        </template>
                     </template>
                 </el-table-column>
             </el-table>
@@ -80,34 +92,56 @@
         <OperaSolutionsDescWindow ref="OperaSolutionsDescWindow" @success="handlePageChange"/>
     </TableLayout>
 </template>
-
 <script>
-    import BaseTable from '@/components/base/BaseTable'
-    import TableLayout from '@/layouts/TableLayout'
-    import Pagination from '@/components/common/Pagination'
-    import OperaSolutionsWindow from '@/components/business/OperaSolutionsWindow'
-    import OperaSolutionsDescWindow from '@/components/business/OperaSolutionsDescWindow'
-    export default {
-        name: 'Solutions',
-        extends: BaseTable,
-        components: { TableLayout, Pagination, OperaSolutionsWindow, OperaSolutionsDescWindow },
-        data () {
-            return {
-                // 鎼滅储
-                searchForm: {
-                    name: '',
-                    status: ''
-                }
-            }
-        },
-        created () {
-            this.config({
-                module: '淇濋櫓鏂规淇℃伅琛�',
-                api: '/business/solutions',
-                'field.id': 'id',
-                'field.main': 'id'
-            })
-            this.search()
+  import BaseTable from '@/components/base/BaseTable'
+  import TableLayout from '@/layouts/TableLayout'
+  import Pagination from '@/components/common/Pagination'
+  import OperaSolutionsWindow from '@/components/business/OperaSolutionsWindow'
+  import OperaSolutionsDescWindow from '@/components/business/OperaSolutionsDescWindow'
+  import { updateStatus } from '@/api/business/solutions'
+  import { mapState } from 'vuex'
+  export default {
+    name: 'Solutions',
+    extends: BaseTable,
+    components: { TableLayout, Pagination, OperaSolutionsWindow, OperaSolutionsDescWindow },
+    data () {
+      return {
+        // 鎼滅储
+        searchForm: {
+          name: '',
+          status: '',
+          type: ''
         }
+      }
+    },
+    computed: {
+      ...mapState(['userInfo'])
+    },
+    created () {
+      this.config({
+        module: '淇濋櫓鏂规淇℃伅琛�',
+        api: '/business/solutions',
+        'field.id': 'id',
+        'field.main': 'id'
+      })
+      if (this.userInfo.type === 1) {
+        this.searchForm.status = '0'
+      } else {
+        this.searchForm.status = ''
+      }
+      this.search()
+    },
+    methods: {
+      // 淇敼鐘舵��
+      changeStatus (status, row) {
+        updateStatus({ id: row.id, status })
+          .then(res => {
+            this.search()
+          })
+          .catch(err => {
+            row.status = row.status === 0 ? 1 : 0
+          })
+      }
     }
+  }
 </script>

--
Gitblit v1.9.3