Просмотр исходного кода

feature:代理商增加指标删除和编辑更新

liuzl 2 лет назад
Родитель
Сommit
311d8137b5

+ 4 - 0
src/api/base/distr.js

@@ -89,4 +89,8 @@ export default {
   editProxyIndex(query) {
   editProxyIndex(query) {
     return micro_request.postRequest(basePath, 'DistributorTarget', 'Update', query)
     return micro_request.postRequest(basePath, 'DistributorTarget', 'Update', query)
   },
   },
+  // 删除代理商指标
+  delProxyIndex(query) {
+    return micro_request.postRequest(basePath, 'DistributorTarget', 'Delete', query)
+  },
 }
 }

+ 11 - 22
src/views/base/agent/components/BusinessTarget.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-05-17 14:03:04
  * @Date: 2023-05-17 14:03:04
  * @LastEditors: liuzhenlin
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-05-19 17:18:12
+ * @LastEditTime: 2023-05-22 09:55:59
  * @Description: file content
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\base\agent\components\BusinessTarget.vue
  * @FilePath: \订单全流程管理系统\src\views\base\agent\components\BusinessTarget.vue
 -->
 -->
@@ -50,15 +50,15 @@
             {{ row.totalAmount.toFixed(2) }}
             {{ row.totalAmount.toFixed(2) }}
           </span>
           </span>
           <span v-else-if="item.prop === 'totalRate'">
           <span v-else-if="item.prop === 'totalRate'">
-            {{ row.totalAmount == 0 ? 0 : ((row.totalAmount.toFixed(2) / row.q4) * 100).toFixed(2) }} %
+            {{ row.totalAmount == 0 ? 0 : ((row.totalAmount.toFixed(2) / row.total) * 100).toFixed(2) }} %
           </span>
           </span>
           <span v-else>{{ row[item.prop] }}</span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="85">
       <el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="85">
         <template #default="{ row }">
         <template #default="{ row }">
-          <el-button v-permissions="['base:distributor:edit']" type="text">编辑</el-button>
-          <el-button v-permissions="['base:distributor:delete']" type="text" @click="handleDelete(row)">删除</el-button>
+          <el-button type="text" @click="$refs.target.open(row)">编辑</el-button>
+          <el-button type="text" @click="handleDelete(row)">删除</el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -197,25 +197,14 @@
         }
         }
       },
       },
       handleDelete(row) {
       handleDelete(row) {
-        if (row.id) {
-          this.$baseConfirm('你确定要删除当前项吗', null, async () => {
-            const { msg } = await distrApi.doDelete({ ids: [row.id] })
-            this.$baseMessage(msg, 'success', 'vab-hey-message-success')
-            await this.fetchData()
-          })
-        } else {
-          if (this.selectRows.length > 0) {
-            const ids = this.selectRows.map((item) => parseInt(item.id))
-            console.log(ids)
-            this.$baseConfirm('你确定要删除选中项吗', null, async () => {
-              const { msg } = await distrApi.doDelete({ ids })
-              this.$baseMessage(msg, 'success', 'vab-hey-message-success')
-              await this.fetchData()
-            })
-          } else {
-            this.$baseMessage('未选中任何行', 'error', 'vab-hey-message-error')
+        this.$baseConfirm('你确定要删除当前项吗', null, async () => {
+          const [err, res] = await to(distrApi.delProxyIndex({ id: [row.id] }))
+          if (err) return
+          if (res.code == 200) {
+            this.$baseMessage('删除成功', 'success', 'vab-hey-message-success')
+            await this.queryData()
           }
           }
-        }
+        })
       },
       },
     },
     },
   }
   }

+ 4 - 7
src/views/base/agent/components/EditTarget.vue

@@ -6,6 +6,7 @@
           <el-form-item label="年份" prop="year">
           <el-form-item label="年份" prop="year">
             <el-date-picker
             <el-date-picker
               v-model="form.year"
               v-model="form.year"
+              :disabled="form.id"
               placeholder="选择年"
               placeholder="选择年"
               style="width: 100%"
               style="width: 100%"
               type="year"
               type="year"
@@ -61,7 +62,6 @@
         title: '',
         title: '',
         form: {
         form: {
           distId: 0,
           distId: 0,
-          id: null,
           year: '',
           year: '',
           q1: 0,
           q1: 0,
           q2: 0,
           q2: 0,
@@ -86,14 +86,15 @@
         if (!row) {
         if (!row) {
           this.title = '新增指标'
           this.title = '新增指标'
         } else {
         } else {
-          this.form.id = row.id
+          this.form = row
+          this.form.year = '' + row.year
           this.title = '编辑指标'
           this.title = '编辑指标'
         }
         }
         this.visible = true
         this.visible = true
       },
       },
       close() {
       close() {
+        this.$refs.form.clearValidate()
         this.form = {
         this.form = {
-          id: null,
           year: '',
           year: '',
           q1: 0,
           q1: 0,
           q2: 0,
           q2: 0,
@@ -121,10 +122,6 @@
             console.log(this.form)
             console.log(this.form)
             let params = { ...this.form }
             let params = { ...this.form }
             params.year = Number(params.year)
             params.year = Number(params.year)
-            // params.q1 = Number(params.q1)
-            // params.q2 = Number(params.q2)
-            // params.q3 = Number(params.q3)
-            // params.q4 = Number(params.q4)
             console.log(params)
             console.log(params)
             let [err, res] = []
             let [err, res] = []
             if (!this.form.id) {
             if (!this.form.id) {

+ 1 - 1
src/views/base/components/Follow.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <div>
+  <div style="height: 100%">
     <ul v-if="followList.length" class="follow">
     <ul v-if="followList.length" class="follow">
       <li v-for="(date, index) in followList" :key="index">
       <li v-for="(date, index) in followList" :key="index">
         <div class="date">
         <div class="date">