From 6817c96db53ac16f5d5eca72b73230d898f32126 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期四, 11 四月 2024 09:43:32 +0800
Subject: [PATCH] Merge branch 'master' into dev-threejs

---
 src/views/system/calculate/record/index.vue |  296 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 192 insertions(+), 104 deletions(-)

diff --git a/src/views/system/calculate/record/index.vue b/src/views/system/calculate/record/index.vue
index 3f07233..b321768 100644
--- a/src/views/system/calculate/record/index.vue
+++ b/src/views/system/calculate/record/index.vue
@@ -1,21 +1,23 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="瑙勫垯鍚嶇О" prop="rulesName">
-        <el-input
-          v-model="queryParams.rulesName"
-          placeholder="璇疯緭鍏ヨ鍒欏悕绉�"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+      <el-form-item label="鍗曚綅鍚�" prop="checkUnitId">
+        <el-select v-model="form.unitId" placeholder="璇烽�夋嫨">
+          <el-option
+            v-for="item in unitList"
+            :key="item.id"
+            :label="item.value"
+            :value="item.id">
+          </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="鍚堝悓鍚嶇О" prop="contractName">
-        <el-input
-          v-model="queryParams.contractName"
-          placeholder="璇疯緭鍏ュ悎鍚屽悕绉�"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+      <el-form-item label="鏍哥畻鏃ユ湡" prop="date" >
+        <el-date-picker clearable
+          v-model="queryParams.date"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="璇烽�夋嫨鏍哥畻鏃ユ湡">
+        </el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
@@ -26,33 +28,85 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:record:add']"
+        >鏂板</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['system:record:edit']"
+        >淇敼</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:record:remove']"
+        >鍒犻櫎</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-        >瀵煎嚭
-        </el-button>
+          v-hasPermi="['system:record:export']"
+        >瀵煎嚭</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="rulesList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="瑙勫垯鍚嶇О" align="center" prop="rulesName"/>
-      <el-table-column label="鍚堝悓鍚嶇О" align="center" prop="contractName"/>
-      <el-table-column label="閲戦(鍏�)" align="center" prop="amount"/>
-      <el-table-column label="鏁伴噺" align="center" prop="num">
-        100
-      </el-table-column>
-      <el-table-column label="鍚堣(鍏�)" align="center" prop="money">
-        <template slot-scope="scope" >
-          {{scope.row.amount*100}}
+    <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="鏍哥畻璁板綍鏃ユ湡" align="center" prop="date" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
+      <el-table-column label="鏍哥畻瑙勫垯" align="center" prop="ruleId">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+          <div v-if="scope.row.ruleId == 1">鎴愰兘x杩愮淮鑰冩牳缁撴灉搴旂敤瑙勫垯</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="鍗曚綅鍚�" align="center" prop="unitId" >
+        <template slot-scope="scope">
+          <div v-if="scope.row.unitId == 2">鎴愰兘x杩愮淮</div>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="鎬绘湇鍔¤垂" align="center" prop="totalAmount" /> -->
+      <!-- <el-table-column label="鎵e噺鏈嶅姟璐�" align="center" prop="deductAmount" /> -->
+      <el-table-column label="鑰冩牳鍒嗘暟" align="center" prop="score" />
+      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:record:edit']"
+          >淇敼</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:record:remove']"
+          >鍒犻櫎</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -65,19 +119,41 @@
       @pagination="getList"
     />
 
-    <!-- 娣诲姞鎴栦慨鏀规牳绠楄鍒欏璇濇 -->
+    <!-- 娣诲姞鎴栦慨鏀规牳绠楄褰曞璇濇 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="瑙勫垯鍚嶇О" prop="rulesName">
-          <el-input v-model="form.rulesName" placeholder="璇疯緭鍏ヨ鍒欏悕绉�"/>
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+        <el-form-item label="鏍哥畻瀵硅薄" prop="checkUnitId">
+          <el-select v-model="form.unitId" placeholder="璇烽�夋嫨">
+            <el-option
+              v-for="item in unitList"
+              :key="item.id"
+              :label="item.value"
+              :value="item.id">
+            </el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item label="鍚堝悓鍚嶇О" prop="contractName">
-          <el-input v-model="form.contractName" placeholder="璇疯緭鍏ュ悎鍚屽悕绉�"/>
+        <el-form-item label="鏍哥畻瑙勫垯" prop="ruleId">
+          <el-select v-model="form.ruleId" placeholder="璇烽�夋嫨">
+            <el-option label="鎴愰兘x杩愮淮鑰冩牳缁撴灉搴旂敤瑙勫垯" value="1">鎴愰兘x杩愮淮鑰冩牳缁撴灉搴旂敤瑙勫垯</el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item label="閲戦" prop="amount">
-          <el-input v-model="form.amount" placeholder="璇疯緭鍏ラ噾棰�"/>
+        <el-form-item label="鏍哥畻璁板綍鏃ユ湡" prop="date" >
+          <el-date-picker clearable
+            v-model="form.date"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="璇烽�夋嫨鏍哥畻璁板綍鏃ユ湡">
+          </el-date-picker>
         </el-form-item>
-
+        <!-- <el-form-item label="鎬绘湇鍔¤垂" prop="totalAmount">
+          <el-input v-model="form.totalAmount" placeholder="璇疯緭鍏ユ�绘湇鍔¤垂" />
+        </el-form-item> -->
+        <!-- <el-form-item label="鎵e噺鏈嶅姟璐�" prop="deductAmount">
+          <el-input v-model="form.deductAmount" placeholder="璇疯緭鍏ユ墸鍑忔湇鍔¤垂" />
+        </el-form-item> -->
+        <el-form-item label="鑰冩牳鍒嗘暟" prop="score">
+          <el-input v-model="form.score" placeholder="璇疯緭鍏ヨ�冩牳鍒嗘暟" />
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
@@ -88,13 +164,12 @@
 </template>
 
 <script>
-import { listRules, getRules, delRules, addRules, updateRules } from '@/api/platform/rules'
-
+import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/platform/calculate-record";
+import {unitSelect} from "@/api/platform/unit";
 export default {
-  name: 'Rules',
+  name: "Record",
   data() {
     return {
-      num: 100,
       // 閬僵灞�
       loading: true,
       // 閫変腑鏁扮粍
@@ -107,126 +182,139 @@
       showSearch: true,
       // 鎬绘潯鏁�
       total: 0,
-      // 鏍哥畻瑙勫垯琛ㄦ牸鏁版嵁
-      rulesList: [],
+      // 鏍哥畻璁板綍琛ㄦ牸鏁版嵁
+      recordList: [],
       // 寮瑰嚭灞傛爣棰�
-      title: '',
+      title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        rulesName: null,
-        contractName: null,
-        deleted: null
+        date: null,
+        ruleId: null,
+        unitId: null,
+        totalAmount: null,
+        deductAmount: null,
+        score: null
       },
       // 琛ㄥ崟鍙傛暟
       form: {},
       // 琛ㄥ崟鏍¢獙
-      rules: {}
-    }
+      rules: {
+        id: [
+          { required: true, message: "$comment涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+      }
+    };
   },
   created() {
-    this.getList()
+    this.getList();
+    this.selectUnit();
   },
   methods: {
-    /** 鏌ヨ鏍哥畻瑙勫垯鍒楄〃 */
-    getList() {
-      this.loading = true
-      listRules(this.queryParams).then(response => {
-        this.rulesList = response.rows
-        this.total = response.total
-        this.loading = false
+    // 杩愮淮鍏徃涓嬫媺鏁版嵁
+    selectUnit() {
+      unitSelect().then(res => {
+        this.unitList = res.data;
       })
+    },
+    /** 鏌ヨ鏍哥畻璁板綍鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listRecord(this.queryParams).then(response => {
+        this.recordList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
     },
     // 鍙栨秷鎸夐挳
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     // 琛ㄥ崟閲嶇疆
     reset() {
       this.form = {
         id: null,
-        rulesName: null,
-        contractName: null,
-        amount: null,
-        createTime: null,
-        updateTime: null,
-        deleted: null
-      }
-      this.resetForm('form')
+        date: null,
+        ruleId: null,
+        unitId: null,
+        totalAmount: null,
+        deductAmount: null,
+        score: null
+      };
+      this.resetForm("form");
     },
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery() {
-      this.queryParams.pageNum = 1
-      this.getList()
+      this.queryParams.pageNum = 1;
+      this.getList();
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.resetForm('queryForm')
-      this.handleQuery()
+      this.resetForm("queryForm");
+      this.handleQuery();
     },
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
+      this.single = selection.length!==1
       this.multiple = !selection.length
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '娣诲姞鏍哥畻瑙勫垯'
+      this.reset();
+      this.open = true;
+      this.title = "娣诲姞鏍哥畻璁板綍";
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
-      this.reset()
+      this.reset();
       const id = row.id || this.ids
-      getRules(id).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '淇敼鏍哥畻瑙勫垯'
-      })
+      getRecord(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "淇敼鏍哥畻璁板綍";
+      });
     },
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
-      this.$refs['form'].validate(valid => {
+      this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            updateRules(this.form).then(response => {
-              this.$modal.msgSuccess('淇敼鎴愬姛')
-              this.open = false
-              this.getList()
-            })
+            updateRecord(this.form).then(response => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
           } else {
-            addRules(this.form).then(response => {
-              this.$modal.msgSuccess('鏂板鎴愬姛')
-              this.open = false
-              this.getList()
-            })
+            addRecord(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
           }
         }
-      })
+      });
     },
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
-      const ids = row.id || this.ids
-      this.$modal.confirm('鏄惁纭鍒犻櫎鏍哥畻瑙勫垯缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
-        return delRules(ids)
+      const ids = row.id || this.ids;
+      this.$modal.confirm('鏄惁纭鍒犻櫎鏍哥畻璁板綍缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+        return delRecord(ids);
       }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('鍒犻櫎鎴愬姛')
-      }).catch(() => {
-      })
+        this.getList();
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      }).catch(() => {});
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      this.download('platform/rules/export', {
+      this.download('system/record/export', {
         ...this.queryParams
-      }, `rules_${new Date().getTime()}.xlsx`)
+      }, `record_${new Date().getTime()}.xlsx`)
     }
   }
-}
+};
 </script>

--
Gitblit v1.8.0