From 596df047f3351c364896245c63c42c5c545ff7c9 Mon Sep 17 00:00:00 2001
From: zhangzeli <123456>
Date: 星期三, 27 十月 2021 11:52:50 +0800
Subject: [PATCH] 前台车辆管理

---
 src/views/your/car-manage/carManage.vue |  154 +++++++++++++++++++++++++--------------------------
 1 files changed, 75 insertions(+), 79 deletions(-)

diff --git a/src/views/your/car-manage/carManage.vue b/src/views/your/car-manage/carManage.vue
index 5d96e6d..09bae2d 100644
--- a/src/views/your/car-manage/carManage.vue
+++ b/src/views/your/car-manage/carManage.vue
@@ -7,14 +7,14 @@
   <div class="search">
     <Card>
       <Row class="operation">
-        <Button @click="addRole" type="primary" icon="md-add">娣诲姞瑙掕壊</Button>
+        <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.key"
+          v-model="searchForm.carNo"
           suffix="ios-search"
           @on-change="getDataList"
           placeholder="杈撳叆鍏抽敭璇嶆悳绱�"
@@ -61,24 +61,36 @@
       :width="500"
     >
       <Form
-        ref="roleForm"
-        :model="roleForm"
+        ref="carForm"
+        :model="carForm"
         :label-width="80"
-        :rules="roleFormValidate"
+        :rules="carFormValidate"
       >
-        <FormItem label="瑙掕壊鍚嶇О" prop="name">
-          <Input
-            v-model="roleForm.name"
-            placeholder="鎸夌収Spring Security绾﹀畾寤鸿浠モ�楻OLE_鈥欏紑澶�"
-          />
+        <FormItem label="鍝佺墝" prop="brand">
+          <Input v-model="carForm.brand"/>
         </FormItem>
-        <FormItem label="澶囨敞" prop="description">
-          <Input v-model="roleForm.description" />
+
+        <FormItem label="鍨嬪彿" prop="model">
+          <Input v-model="carForm.model" />
         </FormItem>
+        <FormItem label="鎺掗噺" prop="displacement">
+          <Input v-model="carForm.displacement" />
+        </FormItem>
+        <Form-item label="璐疆骞翠唤">
+          <Row>
+            <Col span="11">
+              <Date-picker @on-change="change1" type="date" value="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" v-model="carForm.buyYear"></Date-picker>
+            </Col>
+          </Row>
+        </Form-item>
+        <FormItem label="鐗岀収" prop="carNo">
+          <Input v-model="carForm.carNo" />
+        </FormItem>
+
       </Form>
       <div slot="footer">
-        <Button type="text" @click="cancelRole">鍙栨秷</Button>
-        <Button type="primary" :loading="submitLoading" @click="submitRole"
+        <Button type="text" @click="carRole">鍙栨秷</Button>
+        <Button type="primary" :loading="submitLoading" @click="submitCar"
           >鎻愪氦</Button
         >
       </div>
@@ -174,11 +186,7 @@
 
 <script>
 import {
-  getRoleList,
   getAllPermissionList,
-  addRole,
-  editRole,
-  deleteRole,
   setDefaultRole,
   editRolePerm,
   initDepartment,
@@ -186,9 +194,16 @@
   editRoleDep,
 } from "@/api/index";
 
+import {
+  getAll,
+  addCar,
+  getCarList,
+  editCar,
+  deleteCar,
+} from "@/api/open";
 import util from "@/libs/util.js";
 export default {
-  name: "role-manage",
+  name: "car-manage",
   data() {
     return {
       maxHeight: 510,
@@ -211,15 +226,15 @@
         // 鎼滅储妗嗗垵濮嬪寲瀵硅薄
         pageNumber: 1, // 褰撳墠椤垫暟
         pageSize: 10, // 椤甸潰澶у皬
-        sort: "createTime", // 榛樿鎺掑簭瀛楁
+        sort: "carNo", // 榛樿鎺掑簭瀛楁
         order: "desc", // 榛樿鎺掑簭鏂瑰紡
         key: "",
       },
-      roleForm: {
-        name: "",
-        description: "",
+      carForm: {
+        type : 0,
+        status : 0
       },
-      roleFormValidate: {
+      carFormValidate: {
         name: [
           { required: true, message: "瑙掕壊鍚嶇О涓嶈兘涓虹┖", trigger: "change" },
         ],
@@ -269,57 +284,38 @@
           sortType: "desc",
         },
         {
-          title: "绉婚櫎鍘熷洜",
-          key: "removeReason",
+          title: "鐘舵��",
+          key: "status",
           width: 170,
           sortable: true,
-        },
-        {
-          title: "褰撳墠椹鹃┒浜篒D",
-          key: "userId",
-          width: 100,
-          sortable: true,
-        },
-        {
-          title: "褰撳墠璺熻溅浜篒D",
-          key: "followUserId",
-          width: 100,
-          sortable: true,
-        },
-        {
-          title: "璁剧疆涓烘敞鍐岀敤鎴烽粯璁よ鑹�",
-          key: "defaultRole",
-          align: "center",
-          width: 200,
           render: (h, params) => {
-            if (params.row.defaultRole) {
+            let re = "";
+            if (params.row.status == 0) {
               return h("div", [
-                h("Checkbox", {
+                h("Badge", {
                   props: {
-                    value: true,
-                  },
-                  on: {
-                    "on-change": () => {
-                      this.cancelDefault(params.row);
-                    },
+                    status: "success",
+                    text: "姝e父",
                   },
                 }),
               ]);
-            } else {
+            } else if (params.row.status == 1) {
               return h("div", [
-                h("Checkbox", {
+                h("Badge", {
                   props: {
-                    value: false,
-                  },
-                  on: {
-                    "on-change": () => {
-                      this.setDefault(params.row);
-                    },
+                    status: "error",
+                    text: "绉婚櫎",
                   },
                 }),
               ]);
             }
           },
+        },
+        {
+          title: "绉婚櫎鍘熷洜",
+          key: "removeReason",
+          width: 170,
+          sortable: true,
         },
         {
           title: "鎿嶄綔",
@@ -403,6 +399,9 @@
     };
   },
   methods: {
+    change1(e){
+      this.carForm.buyYear = e;
+    },
     init() {
       this.getDataList();
       // 鑾峰彇鎵�鏈夎彍鍗曟潈闄愭爲
@@ -473,15 +472,11 @@
     },
     getDataList() {
       this.loading = true;
-      getRoleList(this.searchForm).then((res) => {
+      getCarList(this.searchForm).then((res) => {
         this.loading = false;
         if (res.success) {
-          this.data = res.result.content;
-          this.total = res.result.totalElements;
-          if (this.data.length == 0 && this.searchForm.pageNumber > 1) {
-            this.searchForm.pageNumber -= 1;
-            this.getDataList();
-          }
+          this.data = res.result.records;
+          this.total = res.result.total;
         }
       });
     },
@@ -509,16 +504,17 @@
         }
       });
     },
-    cancelRole() {
+    carRole() {
       this.roleModalVisible = false;
     },
-    submitRole() {
-      this.$refs.roleForm.validate((valid) => {
+    submitCar() {
+      this.$refs.carForm.validate((valid) => {
+        this.carForm.buyYear = this.carForm.buyYear.toString()
         if (valid) {
           if (this.modalType == 0) {
             // 娣诲姞
             this.submitLoading = true;
-            addRole(this.roleForm).then((res) => {
+            addCar(this.carForm).then((res) => {
               this.submitLoading = false;
               if (res.success) {
                 this.$Message.success("鎿嶄綔鎴愬姛");
@@ -528,7 +524,7 @@
             });
           } else {
             this.submitLoading = true;
-            editRole(this.roleForm).then((res) => {
+            editCar(this.carForm).then((res) => {
               this.submitLoading = false;
               if (res.success) {
                 this.$Message.success("鎿嶄綔鎴愬姛");
@@ -540,17 +536,17 @@
         }
       });
     },
-    addRole() {
+    addCar() {
       this.modalType = 0;
       this.modalTitle = "娣诲姞杞﹁締";
-      this.$refs.roleForm.resetFields();
-      delete this.roleForm.id;
+      this.$refs.carForm.resetFields();
+      delete this.carForm.id;
       this.roleModalVisible = true;
     },
     edit(v) {
       this.modalType = 1;
       this.modalTitle = "缂栬緫杞﹁締";
-      this.$refs.roleForm.resetFields();
+      this.$refs.carForm.resetFields();
       // 杞崲null涓�""
       for (let attr in v) {
         if (v[attr] == null) {
@@ -559,7 +555,7 @@
       }
       let str = JSON.stringify(v);
       let roleInfo = JSON.parse(str);
-      this.roleForm = roleInfo;
+      this.carForm = roleInfo;
       this.roleModalVisible = true;
     },
     remove(v) {
@@ -568,7 +564,7 @@
         content: "鎮ㄧ‘璁よ鍒犻櫎杞﹁締 " + v.name + " ?",
         loading: true,
         onOk: () => {
-          deleteRole({ ids: v.id }).then((res) => {
+          deleteCar({ ids: v.id }).then((res) => {
             this.$Modal.remove();
             if (res.success) {
               this.clearSelectAll();
@@ -628,7 +624,7 @@
             ids += e.id + ",";
           });
           ids = ids.substring(0, ids.length - 1);
-          deleteRole({ ids: ids }).then((res) => {
+          deleteCar({ ids: ids }).then((res) => {
             this.$Modal.remove();
             if (res.success) {
               this.$Message.success("鍒犻櫎鎴愬姛");

--
Gitblit v1.9.1