From 4c18dc33c4076c95190ef24632f65f20836553b6 Mon Sep 17 00:00:00 2001
From: zhangzeli <123456>
Date: 星期五, 29 十月 2021 15:46:52 +0800
Subject: [PATCH] 加油记录和事故记录

---
 src/views/your/car-manage/carManage.vue |  144 ++++++++++++++++++++---------------------------
 1 files changed, 61 insertions(+), 83 deletions(-)

diff --git a/src/views/your/car-manage/carManage.vue b/src/views/your/car-manage/carManage.vue
index 09bae2d..3730dd1 100644
--- a/src/views/your/car-manage/carManage.vue
+++ b/src/views/your/car-manage/carManage.vue
@@ -17,7 +17,7 @@
           v-model="searchForm.carNo"
           suffix="ios-search"
           @on-change="getDataList"
-          placeholder="杈撳叆鍏抽敭璇嶆悳绱�"
+          placeholder="杈撳叆杞︾墝鍙锋悳绱�"
           clearable
           style="width: 250px"
         />
@@ -69,7 +69,6 @@
         <FormItem label="鍝佺墝" prop="brand">
           <Input v-model="carForm.brand"/>
         </FormItem>
-
         <FormItem label="鍨嬪彿" prop="model">
           <Input v-model="carForm.model" />
         </FormItem>
@@ -140,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">
@@ -176,7 +167,7 @@
         <Button
           type="primary"
           :loading="submitDepLoading"
-          @click="submitDepEdit"
+          @click="submitRemove"
           >鎻愪氦</Button
         >
       </div>
@@ -219,6 +210,7 @@
       sortType: "desc",
       modalType: 0,
       roleModalVisible: false,
+      carModalVisible: false,
       permModalVisible: false,
       depModalVisible: false,
       modalTitle: "",
@@ -226,13 +218,15 @@
         // 鎼滅储妗嗗垵濮嬪寲瀵硅薄
         pageNumber: 1, // 褰撳墠椤垫暟
         pageSize: 10, // 椤甸潰澶у皬
-        sort: "carNo", // 榛樿鎺掑簭瀛楁
+        sort: "createTime", // 榛樿鎺掑簭瀛楁
         order: "desc", // 榛樿鎺掑簭鏂瑰紡
         key: "",
       },
       carForm: {
-        type : 0,
         status : 0
+      },
+      removeForm: {
+        status : 1
       },
       carFormValidate: {
         name: [
@@ -253,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: "鎺掗噺",
@@ -273,20 +271,13 @@
         {
           title: "璐疆骞翠唤",
           key: "buyYear",
-          minWidth: 150,
+          minWidth: 120,
           sortable: true,
-        },
-        {
-          title: "鐗岀収",
-          key: "carNo",
-          width: 170,
-          sortable: true,
-          sortType: "desc",
         },
         {
           title: "鐘舵��",
           key: "status",
-          width: 170,
+          width: 100,
           sortable: true,
           render: (h, params) => {
             let re = "";
@@ -321,7 +312,6 @@
           title: "鎿嶄綔",
           key: "action",
           align: "center",
-          fixed: "right",
           width: 280,
           render: (h, params) => {
             return h("div", [
@@ -330,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: {
@@ -396,11 +370,12 @@
       depData: [],
       dataType: 0,
       editDepartments: [],
+      buyYear:''
     };
   },
   methods: {
     change1(e){
-      this.carForm.buyYear = e;
+      this.buyYear = e;
     },
     init() {
       this.getDataList();
@@ -508,8 +483,8 @@
       this.roleModalVisible = false;
     },
     submitCar() {
+      this.carForm.buyYear = this.buyYear;
       this.$refs.carForm.validate((valid) => {
-        this.carForm.buyYear = this.carForm.buyYear.toString()
         if (valid) {
           if (this.modalType == 0) {
             // 娣诲姞
@@ -536,6 +511,21 @@
         }
       });
     },
+    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 = "娣诲姞杞﹁締";
@@ -544,8 +534,9 @@
       this.roleModalVisible = true;
     },
     edit(v) {
+      this.buyYear = v.buyYear;
       this.modalType = 1;
-      this.modalTitle = "缂栬緫杞﹁締";
+      this.modalTitle = "缂栬緫瑙掕壊";
       this.$refs.carForm.resetFields();
       // 杞崲null涓�""
       for (let attr in v) {
@@ -555,13 +546,32 @@
       }
       let str = JSON.stringify(v);
       let roleInfo = JSON.parse(str);
+
       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: () => {
           deleteCar({ ids: v.id }).then((res) => {
@@ -735,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