From 1dfede5acec9f6bb97b8769f55501b67262316e0 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期一, 27 三月 2023 17:19:22 +0800
Subject: [PATCH] 搜索bug

---
 src/views/your/car-manage/carManage.vue |  128 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 114 insertions(+), 14 deletions(-)

diff --git a/src/views/your/car-manage/carManage.vue b/src/views/your/car-manage/carManage.vue
index 0ef24a5..0129cd1 100644
--- a/src/views/your/car-manage/carManage.vue
+++ b/src/views/your/car-manage/carManage.vue
@@ -8,15 +8,14 @@
     <Card>
       <Row class="operation">
         <Button @click="addCar" type="primary" icon="md-add">娣诲姞杞﹁締</Button>
-        <Button @click="delAll" icon="md-trash">鎵归噺鍒犻櫎</Button>
         <Button @click="init" icon="md-refresh">鍒锋柊</Button>
         <Button type="dashed" @click="openTip = !openTip">{{
           openTip ? "鍏抽棴鎻愮ず" : "寮�鍚彁绀�"
         }}</Button>
         <Input
-          v-model="searchForm.carNo"
+          v-model="searchForm2.carNo"
           suffix="ios-search"
-          @on-change="getDataList"
+          @on-change="getDataList2"
           placeholder="杈撳叆杞︾墝鍙锋悳绱�"
           clearable
           style="width: 250px"
@@ -81,7 +80,24 @@
         <FormItem label="鐗岀収" prop="carNo">
           <Input v-model="carForm.carNo" />
         </FormItem>
-
+        <FormItem label="鍔犳补鍗″彿" prop="addOilCode">
+          <Input v-model="carForm.addOilCode" />
+        </FormItem>
+        <FormItem label="杞﹁締缂栧彿" prop="code">
+          <Input v-model="carForm.code" />
+        </FormItem>
+        <FormItem label="鍙告満" prop="userId">
+          <Select v-model="carForm.userId" filterable>
+            <Option :value="0">璇烽�夋嫨</Option>
+            <Option v-for="item in userList" :value="item.id" :key="item.id">{{ item.nickname }}</Option>
+          </Select>
+        </FormItem>
+        <FormItem label="閰嶉�佸憳" prop="followUserId">
+          <Select v-model="carForm.followUserId" filterable>
+            <Option :value="0" :key="0">璇烽�夋嫨</Option>
+            <Option v-for="item in driverList" :value="item.id" :key="item.id">{{ item.nickname }}</Option>
+          </Select>
+        </FormItem>
       </Form>
       <div slot="footer">
         <Button type="text" @click="carRole">鍙栨秷</Button>
@@ -103,7 +119,7 @@
     </Modal>
     <Modal :title="modalTitle" v-model="addEquipmentVisible" :mask-closable="false" :width="500">
       <Form ref="equipmentForm" :model="equipmentForm" :label-width="80" :rules="equipmentFormValidate">
-        <FormItem label="璁惧" prop="type">
+        <FormItem label="璁惧绫诲瀷" prop="type">
           <Select v-model="equipmentForm.type">
             <Option :value="0">杞︽満</Option>
             <Option :value="1">鎽勫儚鏈�</Option>
@@ -111,10 +127,10 @@
             <Option :value="3">pad</Option>
           </Select>
         </FormItem>
-        <FormItem label="璁惧" prop="status">
+        <FormItem label="鐘舵��" prop="status">
           <Select v-model="equipmentForm.status">
             <Option :value="0">姝e父</Option>
-            <Option :value="1">鍋滅敤</Option>
+            <Option :value="1">寮傚父</Option>
           </Select>
         </FormItem>
         <FormItem label="缂栧彿" prop="code">
@@ -234,6 +250,8 @@
   deleteCar,
   getEquipment,
   addEquipment,
+  getUser,
+  getDriver,
   deleteEquipment,
 } from "@/api/open";
 import util from "@/libs/util.js";
@@ -268,8 +286,19 @@
         order: "desc", // 榛樿鎺掑簭鏂瑰紡
         key: "",
       },
+      searchForm2: {
+        // 鎼滅储妗嗗垵濮嬪寲瀵硅薄
+        pageNumber: 1, // 褰撳墠椤垫暟
+        pageSize: 10, // 椤甸潰澶у皬
+        sort: "createTime", // 榛樿鎺掑簭瀛楁
+        order: "desc", // 榛樿鎺掑簭鏂瑰紡
+        key: "",
+      },
       carForm: {
         status : 0
+      },
+      type: {
+        type : 0
       },
       equipmentForm: {
         status : 0
@@ -298,8 +327,18 @@
         {
           title: "杞︾墝鍙�",
           key: "carNo",
-          width: 100,
+          width: 110,
           sortable: true,
+        },
+        {
+          title: "鍙告満",
+          key: "nickName",
+          width: 100,
+        },
+        {
+          title: "閰嶉�佸憳",
+          key: "followNickName",
+          width: 100,
         },
         {
           title: "鍝佺墝",
@@ -315,12 +354,35 @@
           title: "鎺掗噺",
           key: "displacement",
           width: 100,
-          sortable: true,
+        },
+        {
+          title: "鍔犳补鍗″彿",
+          key: "addOilCode",
+          minWidth: 120,
+          // sortable: true,
+          render: (h, params) => {
+            return h("div",params.row.addOilCode=="undefined" ? '':params.row.addOilCode);
+          }
+        },
+        {
+          title: "缂栧彿",
+          key: "code",
+          minWidth: 120,
+          tooltip:true,
+          // render: (h, params) => {
+          //   return h("div",params.row.code=="undefined" ? '':params.row.code);
+          // }
         },
         {
           title: "璐疆骞翠唤",
           key: "buyYear",
           minWidth: 120,
+          sortable: true,
+        },
+        {
+          title: "鐧昏鏃ユ湡",
+          key: "createTime",
+          minWidth: 180,
           sortable: true,
         },
         {
@@ -361,6 +423,7 @@
           title: "鎿嶄綔",
           key: "action",
           align: "center",
+          fixed: "right",
           width: 280,
           render: (h, params) => {
             return h("div", [
@@ -572,10 +635,13 @@
       depData: [],
       dataType: 0,
       carId: '',
+      driverList: [],
+      userList: [],
       editDepartments: [],
       buyYear:''
     };
   },
+
   methods: {
     change1(e){
       this.buyYear = e;
@@ -583,7 +649,6 @@
     init() {
       this.getDataList();
       // 鑾峰彇鎵�鏈夎彍鍗曟潈闄愭爲
-      this.getPermList();
     },
     renderContent(h, { root, node, data }) {
       let icon = "";
@@ -640,6 +705,22 @@
       this.searchForm.pageSize = v;
       this.getDataList();
     },
+    getAllUser(){
+      getDriver({type:0}).then((res)=>{
+        if (res.success){
+          this.userList=res.result;
+        }
+      });
+      //this.type.type=1;
+      getDriver({type:1}).then((res)=>{
+        if (res.success){
+          this.driverList=res.result;
+        }
+      });
+      this.type.type=0;
+      console.log(this.userList);
+      console.log(this.driverList);
+    },
     changeSort(e) {
       this.searchForm.sort = e.key;
       this.searchForm.order = e.order;
@@ -658,10 +739,20 @@
         }
       });
     },
+    getDataList2() {
+      this.loading = true;
+      getCarList(this.searchForm2).then((res) => {
+        this.loading = false;
+        if (res.success) {
+          this.data = res.result.records;
+          this.total = res.result.total;
+        }
+      });
+    },
     getEquipmentList(carId) {
       this.loading = true;
-      this.searchForm.carId=carId;
-      getEquipment(this.searchForm).then((res) => {
+      this.searchForm2.carId=carId;
+      getEquipment(this.searchForm2).then((res) => {
         this.loading = false;
         if (res.success) {
           this.data2 = res.result.records;
@@ -696,6 +787,12 @@
       this.roleModalVisible = false;
     },
     submitCar() {
+      if(this.carForm.userId==undefined || this.carForm.userId==0){
+        this.carForm.userId="";
+      }
+      if(this.carForm.followUserId==undefined || this.carForm.followUserId==0){
+        this.carForm.followUserId="";
+      }
       this.carForm.buyYear = this.buyYear;
       this.$refs.carForm.validate((valid) => {
         if (valid) {
@@ -780,6 +877,8 @@
       this.equipmentVisible = true;
     },
     addCar() {
+      this.carForm={};
+      this.getAllUser();
       this.modalType = 0;
       this.modalTitle = "娣诲姞杞﹁締";
       this.$refs.carForm.resetFields();
@@ -795,9 +894,10 @@
       this.addEquipmentVisible = true;
     },
     edit(v) {
+      this.getAllUser();
       this.buyYear = v.buyYear;
       this.modalType = 1;
-      this.modalTitle = "缂栬緫瑙掕壊";
+      this.modalTitle = "缂栬緫";
       this.$refs.carForm.resetFields();
       // 杞崲null涓�""
       for (let attr in v) {
@@ -1154,4 +1254,4 @@
     this.init();
   },
 };
-</script>
\ No newline at end of file
+</script>

--
Gitblit v1.9.1