2
0

2 Ревизии a8cd5999ef ... bafd41e9d2

Автор SHA1 Съобщение Дата
  zzy90 bafd41e9d2 Merge remote-tracking branch 'origin/master' преди 2 месеца
  zzy90 d1d98e940d Merge remote-tracking branch 'origin/master' преди 2 месеца
променени са 2 файла, в които са добавени 30 реда и са изтрити 12 реда
  1. 21 12
      src/components/RulesTable.vue
  2. 9 0
      src/http/api.js

+ 21 - 12
src/components/RulesTable.vue

@@ -10,8 +10,8 @@ import {
   Search,
   Upload
 } from "@element-plus/icons-vue";
-import {ElMessageBox} from "element-plus";
-import {addRuleInfo} from "@/http/api";
+import {ElMessage, ElMessageBox} from "element-plus";
+import {addRuleInfo, searchRules} from "@/http/api";
 
 export default {
   name: "RulesTable",
@@ -54,14 +54,14 @@ export default {
       searchForm: {
         name: '',
         rounds: '',
-        duration: '',
-        interval: ''
+        duration_minutes: '',
+        interval_minutes: ''
       },
       tableData: [{
         name: '煤炭采购规则',
         rounds: '2',
-        duration: '2',
-        interval: '1'
+        duration_minutes: '2',
+        interval_minutes: '1'
       }],
       addForm: {
         name: '',
@@ -89,9 +89,18 @@ export default {
             // catch error
           })
     },
-    addRule(){
+    addRule() {
       addRuleInfo(this.addForm);
       this.dialogVisible = false;
+    },
+    searchRules() {
+      searchRules(this.searchForm).then(
+          res => {
+            console.log(res.data);
+            this.tableData = res.data;
+            ElMessage.success("搜索成功");
+          }
+      )
     }
   }
 }
@@ -108,13 +117,13 @@ export default {
           <el-input v-model="searchForm.rounds" placeholder="请输入轮次数"></el-input>
         </el-form-item>
         <el-form-item label="轮次时间">
-          <el-input v-model="searchForm.duration" placeholder="请输入轮次时间"></el-input>
+          <el-input v-model="searchForm.duration_minutes" placeholder="请输入轮次时间"></el-input>
         </el-form-item>
         <el-form-item label="间隔时长">
-          <el-input v-model="searchForm.interval" placeholder="请输入间隔时长"></el-input>
+          <el-input v-model="searchForm.interval_minutes" placeholder="请输入间隔时长"></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" :icon="Search">搜索</el-button>
+          <el-button type="primary" :icon="Search" @click="searchRules">搜索</el-button>
         </el-form-item>
         <el-form-item>
           <el-button :icon="Refresh" @click="resetSearchForm">重置</el-button>
@@ -146,11 +155,11 @@ export default {
             label="轮次数">
         </el-table-column>
         <el-table-column
-            prop="duration"
+            prop="duration_minutes"
             label="轮次时间(分钟)">
         </el-table-column>
         <el-table-column
-            prop="interval"
+            prop="interval_minutes"
             label="间隔时长(分钟)">
         </el-table-column>
         <el-table-column

+ 9 - 0
src/http/api.js

@@ -124,6 +124,15 @@ export function addRuleInfo(params){
   }
   return request(new_params);
 }
+//搜索规则
+export function searchRules(params){
+  let new_params = {
+    url: '/Rules/searchRules',
+    method: "post",
+    data:params
+  }
+  return request(new_params);
+}
 //其实,也不一定就是params,也可以是 query 还有 data 的呀!
 //params是添加到url的请求字符串中的,用于get请求。(后面这句不对)会将参数加到 url后面。所以,传递的都是字符串。无法传递参数中含有json格式的数据
 //而data是添加到请求体(body)中的, 用于post请求。添加到请求体(body)中,json 格式也是可以的。