From edb5af0f95a95d86d7293f7049ee495b3ec56ecd Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期五, 29 十月 2021 17:23:37 +0800
Subject: [PATCH] 默认更改列表

---
 src/views/your/car-manage/carManage.vue |  300 +++++++++++++++++++++++++++--------------------------------
 1 files changed, 137 insertions(+), 163 deletions(-)

diff --git a/src/views/your/car-manage/carManage.vue b/src/views/your/car-manage/carManage.vue
index 5d96e6d..3730dd1 100644
--- a/src/views/your/car-manage/carManage.vue
+++ b/src/views/your/car-manage/carManage.vue
@@ -7,17 +7,17 @@
   <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="杈撳叆鍏抽敭璇嶆悳绱�"
+          placeholder="杈撳叆杞︾墝鍙锋悳绱�"
           clearable
           style="width: 250px"
         />
@@ -61,24 +61,35 @@
       :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>
@@ -128,22 +139,14 @@
     <!-- 鏁版嵁鏉冮檺 -->
     <Modal
       :title="modalTitle"
-      v-model="depModalVisible"
+      v-model="carModalVisible"
       :mask-closable="false"
       :width="500"
       class="depModal"
     >
-      <Alert show-icon
-        >榛樿鍙煡鐪嬪叏閮ㄦ暟鎹紝鑷畾涔夋暟鎹寖鍥存椂璇峰嬀閫変笅鏂规暟鎹�</Alert
-      >
-      <Form :label-width="85">
-        <FormItem label="鏁版嵁鑼冨洿">
-          <Select v-model="dataType" transfer>
-            <Option :value="0">鍏ㄩ儴鏁版嵁鏉冮檺</Option>
-            <Option :value="1">鑷畾涔夋暟鎹潈闄�</Option>
-            <Option :value="2">鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺</Option>
-            <Option :value="3">鏈儴闂ㄦ暟鎹潈闄�</Option>
-          </Select>
+      <Form :label-width="85" ref="removeForm" :model="removeForm">
+        <FormItem label="绉婚櫎鍘熷洜" prop="removeReason">
+          <Input v-model="removeForm.removeReason"/>
         </FormItem>
       </Form>
       <div v-show="dataType == 1" style="margin-top: 15px">
@@ -164,7 +167,7 @@
         <Button
           type="primary"
           :loading="submitDepLoading"
-          @click="submitDepEdit"
+          @click="submitRemove"
           >鎻愪氦</Button
         >
       </div>
@@ -174,11 +177,7 @@
 
 <script>
 import {
-  getRoleList,
   getAllPermissionList,
-  addRole,
-  editRole,
-  deleteRole,
   setDefaultRole,
   editRolePerm,
   initDepartment,
@@ -186,9 +185,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,
@@ -204,6 +210,7 @@
       sortType: "desc",
       modalType: 0,
       roleModalVisible: false,
+      carModalVisible: false,
       permModalVisible: false,
       depModalVisible: false,
       modalTitle: "",
@@ -215,11 +222,13 @@
         order: "desc", // 榛樿鎺掑簭鏂瑰紡
         key: "",
       },
-      roleForm: {
-        name: "",
-        description: "",
+      carForm: {
+        status : 0
       },
-      roleFormValidate: {
+      removeForm: {
+        status : 1
+      },
+      carFormValidate: {
         name: [
           { required: true, message: "瑙掕壊鍚嶇О涓嶈兘涓虹┖", trigger: "change" },
         ],
@@ -238,16 +247,20 @@
           align: "center",
         },
         {
+          title: "杞︾墝鍙�",
+          key: "carNo",
+          width: 100,
+          sortable: true,
+        },
+        {
           title: "鍝佺墝",
           key: "brand",
           width: 100,
-          sortable: true,
         },
         {
           title: "鍨嬪彿",
           key: "model",
           width: 100,
-          sortable: true,
         },
         {
           title: "鎺掗噺",
@@ -258,15 +271,36 @@
         {
           title: "璐疆骞翠唤",
           key: "buyYear",
-          minWidth: 150,
+          minWidth: 120,
           sortable: true,
         },
         {
-          title: "鐗岀収",
-          key: "carNo",
-          width: 170,
+          title: "鐘舵��",
+          key: "status",
+          width: 100,
           sortable: true,
-          sortType: "desc",
+          render: (h, params) => {
+            let re = "";
+            if (params.row.status == 0) {
+              return h("div", [
+                h("Badge", {
+                  props: {
+                    status: "success",
+                    text: "姝e父",
+                  },
+                }),
+              ]);
+            } else if (params.row.status == 1) {
+              return h("div", [
+                h("Badge", {
+                  props: {
+                    status: "error",
+                    text: "绉婚櫎",
+                  },
+                }),
+              ]);
+            }
+          },
         },
         {
           title: "绉婚櫎鍘熷洜",
@@ -275,57 +309,9 @@
           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) {
-              return h("div", [
-                h("Checkbox", {
-                  props: {
-                    value: true,
-                  },
-                  on: {
-                    "on-change": () => {
-                      this.cancelDefault(params.row);
-                    },
-                  },
-                }),
-              ]);
-            } else {
-              return h("div", [
-                h("Checkbox", {
-                  props: {
-                    value: false,
-                  },
-                  on: {
-                    "on-change": () => {
-                      this.setDefault(params.row);
-                    },
-                  },
-                }),
-              ]);
-            }
-          },
-        },
-        {
           title: "鎿嶄綔",
           key: "action",
           align: "center",
-          fixed: "right",
           width: 280,
           render: (h, params) => {
             return h("div", [
@@ -334,27 +320,11 @@
                 {
                   on: {
                     click: () => {
-                      this.editPerm(params.row);
+                      this.removeCar(params.row);
                     },
                   },
                 },
-                "鑿滃崟鏉冮檺"
-              ),
-              h("Divider", {
-                props: {
-                  type: "vertical",
-                },
-              }),
-              h(
-                "a",
-                {
-                  on: {
-                    click: () => {
-                      this.editDep(params.row);
-                    },
-                  },
-                },
-                "鏁版嵁鏉冮檺"
+                "绉婚櫎杞﹁締"
               ),
               h("Divider", {
                 props: {
@@ -400,9 +370,13 @@
       depData: [],
       dataType: 0,
       editDepartments: [],
+      buyYear:''
     };
   },
   methods: {
+    change1(e){
+      this.buyYear = e;
+    },
     init() {
       this.getDataList();
       // 鑾峰彇鎵�鏈夎彍鍗曟潈闄愭爲
@@ -473,15 +447,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 +479,17 @@
         }
       });
     },
-    cancelRole() {
+    carRole() {
       this.roleModalVisible = false;
     },
-    submitRole() {
-      this.$refs.roleForm.validate((valid) => {
+    submitCar() {
+      this.carForm.buyYear = this.buyYear;
+      this.$refs.carForm.validate((valid) => {
         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 +499,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 +511,33 @@
         }
       });
     },
-    addRole() {
+    submitRemove(){
+      this.$refs.removeForm.validate((valid) => {
+        if (valid) {
+            this.submitLoading = true;
+            editCar(this.removeForm).then((res) => {
+              this.submitLoading = false;
+              if (res.success) {
+                this.$Message.success("鎿嶄綔鎴愬姛");
+                this.getDataList();
+                this.carModalVisible = false;
+              }
+            });
+        }
+      });
+    },
+    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.buyYear = v.buyYear;
       this.modalType = 1;
-      this.modalTitle = "缂栬緫杞﹁締";
-      this.$refs.roleForm.resetFields();
+      this.modalTitle = "缂栬緫瑙掕壊";
+      this.$refs.carForm.resetFields();
       // 杞崲null涓�""
       for (let attr in v) {
         if (v[attr] == null) {
@@ -559,16 +546,35 @@
       }
       let str = JSON.stringify(v);
       let roleInfo = JSON.parse(str);
-      this.roleForm = roleInfo;
+
+      this.carForm = roleInfo;
       this.roleModalVisible = true;
+    },
+    removeCar(v) {
+      this.dataType = 0;
+      this.modalTitle = "绉婚櫎杞﹁締";
+      this.$refs.carForm.resetFields();
+      // 杞崲null涓�""
+      for (let attr in v) {
+        if (v[attr] == null) {
+          v[attr] = "";
+        }
+      }
+      let str = JSON.stringify(v);
+      let roleInfo = JSON.parse(str);
+      roleInfo.status=1
+      console.log(roleInfo);
+      this.removeForm = roleInfo;
+      this.carModalVisible = true;
+
     },
     remove(v) {
       this.$Modal.confirm({
         title: "纭鍒犻櫎",
-        content: "鎮ㄧ‘璁よ鍒犻櫎杞﹁締 " + v.name + " ?",
+        content: "鎮ㄧ‘璁よ鍒犻櫎鍚� ",
         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 +634,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("鍒犻櫎鎴愬姛");
@@ -739,38 +745,6 @@
           callback(res.result);
         }
       });
-    },
-    editDep(v) {
-      this.dataType = 0;
-      this.editRolePermId = v.id;
-      this.modalTitle = "鍒嗛厤 " + v.name + " 鐨勬暟鎹潈闄�";
-      if (v.dataType) {
-        this.dataType = v.dataType;
-      }
-      // 鍖归厤鍕鹃��
-      let roleDepIds = v.departments;
-      this.editDepartments = roleDepIds;
-      this.depTreeLoading = true;
-      initDepartment({ openDataFilter: false }).then((res) => {
-        this.depTreeLoading = false;
-        if (res.success) {
-          res.result.forEach(function (e) {
-            e.selected = false;
-            if (e.isParent) {
-              e.loading = false;
-              e.children = [];
-            }
-            if (e.status == -1) {
-              e.title = "[宸茬鐢╙ " + e.title;
-              e.disabled = true;
-            }
-          });
-          this.depData = res.result;
-          // 鍒ゆ柇瀛愯妭鐐�
-          this.checkDepTree(this.depData, roleDepIds);
-        }
-      });
-      this.depModalVisible = true;
     },
     expandCheckDep(v) {
       // 鍒ゆ柇灞曞紑瀛愯妭鐐�

--
Gitblit v1.9.1