Browse Source

新车维护增加车辆类型字段

@dongkboy 1 năm trước cách đây
mục cha
commit
166dc5c70e

+ 56 - 74
src/views/ProductManage/Newcarrule/MaintenanceRule.vue

@@ -3,102 +3,62 @@
     <el-main ref="elMain" style="padding: 0px">
     <el-main ref="elMain" style="padding: 0px">
       <!-- 工具区域Start -->
       <!-- 工具区域Start -->
       <el-row style="margin-bottom: 20px">
       <el-row style="margin-bottom: 20px">
-        <kt-button
-          icon="fa fa-plus"
-          label="添加"
-          type="primary"
-          perms="sys:maintenanceRule:add"
-          @click="handleAddjudgeRule"
-        />
+        <kt-button icon="fa fa-plus" label="添加" type="primary" perms="sys:maintenanceRule:add"
+          @click="handleAddjudgeRule" />
       </el-row>
       </el-row>
-      <kt-common-table
-        permsEdit="sys:maintenanceRule:edit"
-        permsDelete="sys:maintenanceRule:delete"
-        :data="pageResult"
-        :columns="columns"
-        editButtonName="编辑"
-        deleteButtonName="删除"
-        :showBatchDelete="false"
-        @findPage="findPage"
-        @handleEdit="handleTableEdit"
-        @handleDeleteFlag="handleTableDeleteFlag"
-      >
+      <kt-common-table permsEdit="sys:maintenanceRule:edit" permsDelete="sys:maintenanceRule:delete" :data="pageResult"
+        :columns="columns" editButtonName="编辑" deleteButtonName="删除" :showBatchDelete="false" @findPage="findPage"
+        @handleEdit="handleTableEdit" @handleDeleteFlag="handleTableDeleteFlag">
       </kt-common-table>
       </kt-common-table>
     </el-main>
     </el-main>
 
 
     <!-- 新增对话框 -->
     <!-- 新增对话框 -->
-    <el-dialog
-      :title="dialogTitle"
-      v-dialogDrag
-      :visible.sync="judgeRuleDialogVisible"
-      width="800px"
-      @open="closeDialog"
-    >
-      <el-form
-        :model="dataForm"
-        :rules="dataFormRules"
-        ref="dataForm"
-        @keyup.enter.native="submitForm"
-        label-width="100px"
-        size="small"
-      >
+    <el-dialog :title="dialogTitle" v-dialogDrag :visible.sync="judgeRuleDialogVisible" width="800px"
+      @open="closeDialog">
+      <el-form :model="dataForm" :rules="dataFormRules" ref="dataForm" @keyup.enter.native="submitForm"
+        label-width="100px" size="small">
         <el-row>
         <el-row>
-          <el-col :span="20">
+          <el-col :span="10">
             <el-form-item label="归属保司" prop="companyId">
             <el-form-item label="归属保司" prop="companyId">
-              <el-select
-                v-model="dataForm.companyId"
-                placeholder="请选择归属保司"
-                filterable
-              >
-                <el-option
-                  v-for="item in prodInsurance"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                ></el-option>
+              <el-select v-model="dataForm.companyId" placeholder="请选择归属保司" filterable>
+                <el-option v-for="item in prodInsurance" :key="item.id" :label="item.name" :value="item.id"></el-option>
               </el-select>
               </el-select>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
+          <el-col :span="10" :offset="2">
+            <el-form-item label="车辆类型" prop="vehicleType">
+              <el-radio-group v-model="dataForm.vehicleType">
+                <el-radio v-for="(item, index) in vehicleTypeData" :key="index" :label="item.dictValue">{{ item.dictTag
+                  }}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
           <el-col :span="10">
           <el-col :span="10">
             <el-form-item label="单位" prop="unitTypeCode">
             <el-form-item label="单位" prop="unitTypeCode">
-              <el-select
-                v-model="dataForm.unitTypeCode"
-                placeholder="请选择单位"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="(item, index) in unitTypeData"
-                  :key="index"
-                  :label="item.dictTag"
-                  :value="item.dictTag"
-                ></el-option>
+              <el-select v-model="dataForm.unitTypeCode" placeholder="请选择单位" style="width: 100%">
+                <el-option v-for="(item, index) in unitTypeData" :key="index" :label="item.dictTag"
+                  :value="item.dictTag"></el-option>
               </el-select>
               </el-select>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="10" :offset="2">
           <el-col :span="10" :offset="2">
             <el-form-item label="单位值" prop="unitTypeValue">
             <el-form-item label="单位值" prop="unitTypeValue">
-              <el-input
-                type="number"
-                @change="judgValue"
-                v-model="dataForm.unitTypeValue"
-                placeholder="请输入单位值"
-              ></el-input>
+              <el-input type="number" @change="judgValue" v-model="dataForm.unitTypeValue"
+                placeholder="请输入单位值"></el-input>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
         </el-row>
         </el-row>
       </el-form>
       </el-form>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
-        <el-button size="small" @click="judgeRuleDialogVisible = false"
-          >取 消</el-button
-        >
-        <el-button size="small" type="primary" @click="submitForm"
-          >确 定</el-button
-        >
+        <el-button size="small" @click="judgeRuleDialogVisible = false">取 消</el-button>
+        <el-button size="small" type="primary" @click="submitForm">确 定</el-button>
       </span>
       </span>
     </el-dialog>
     </el-dialog>
   </div>
   </div>
 </template>
 </template>
-  <script>
+<script>
 import KtButton from "@/views/Core/KtButton"; //按钮权限组件
 import KtButton from "@/views/Core/KtButton"; //按钮权限组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
 export default {
 export default {
@@ -129,6 +89,13 @@ export default {
           minWidth: 80,
           minWidth: 80,
           sortable: false,
           sortable: false,
         },
         },
+        {
+          prop: "vehicleType",
+          label: "车辆类型",
+          minWidth: 80,
+          sortable: false,
+          formatter: this.vehicleTypeFormatter,
+        },
         {
         {
           prop: "unitTypeValue",
           prop: "unitTypeValue",
           label: "新车判断单位值",
           label: "新车判断单位值",
@@ -141,6 +108,7 @@ export default {
         companyId: "", //保险公司名称
         companyId: "", //保险公司名称
         unitTypeCode: "", //新车判断单位
         unitTypeCode: "", //新车判断单位
         unitTypeValue: "", //新车判断单位值
         unitTypeValue: "", //新车判断单位值
+        vehicleType: "A0",
       },
       },
       dataFormRules: {
       dataFormRules: {
         companyId: [
         companyId: [
@@ -163,6 +131,7 @@ export default {
       prodInsurance: [], //归属保司字典
       prodInsurance: [], //归属保司字典
       id: "",
       id: "",
       unitTypeData: [], //新车判断单位字典数据
       unitTypeData: [], //新车判断单位字典数据
+      vehicleTypeData: [],
     };
     };
   },
   },
   created() {
   created() {
@@ -170,6 +139,11 @@ export default {
   },
   },
   watch: {},
   watch: {},
   methods: {
   methods: {
+    //表格车辆类型数据格式化
+    vehicleTypeFormatter(row, column) {
+      let info = this.vehicleTypeData.find(val => val.dictValue === row.vehicleType);
+      return info.dictTag;
+    },
     /**
     /**
      * 获取系统字典
      * 获取系统字典
      */
      */
@@ -182,6 +156,11 @@ export default {
             return item.dictType == "newCarJudgingUnit";
             return item.dictType == "newCarJudgingUnit";
           });
           });
           dataArr.length > 0 ? (this.unitTypeData = dataArr[0].ddList) : "";
           dataArr.length > 0 ? (this.unitTypeData = dataArr[0].ddList) : "";
+          //获取车辆类型
+          let vehicleTypedata = res.filter((item) => {
+            return item.dictType == "vehicleType";
+          });
+          vehicleTypedata.length > 0 ? (this.vehicleTypeData = vehicleTypedata[0].ddList) : "";
         })
         })
         .then(data != null ? data.callback : "");
         .then(data != null ? data.callback : "");
     },
     },
@@ -216,12 +195,14 @@ export default {
      * 列表编辑按钮
      * 列表编辑按钮
      */
      */
     handleTableEdit({ row, index }) {
     handleTableEdit({ row, index }) {
+      console.log(row)
       this.operType = "EDIT"; //'ADD','EDIT'
       this.operType = "EDIT"; //'ADD','EDIT'
       this.dialogTitle = "编辑";
       this.dialogTitle = "编辑";
       this.dataForm = {
       this.dataForm = {
         companyId: row.companyId,
         companyId: row.companyId,
         unitTypeCode: row.unitTypeCode,
         unitTypeCode: row.unitTypeCode,
         unitTypeValue: row.unitTypeValue,
         unitTypeValue: row.unitTypeValue,
+        vehicleType: row.vehicleType,
       };
       };
       this.id = row.id;
       this.id = row.id;
       this.judgeRuleDialogVisible = true;
       this.judgeRuleDialogVisible = true;
@@ -315,7 +296,9 @@ export default {
     closeDialog() {
     closeDialog() {
       if (this.operType == "ADD") {
       if (this.operType == "ADD") {
         for (let key in this.dataForm) {
         for (let key in this.dataForm) {
-          this.dataForm[key] = "";
+          if (key !== "vehicleType") {
+            this.dataForm[key] = "";
+          }
         }
         }
       }
       }
     },
     },
@@ -368,8 +351,8 @@ export default {
   },
   },
 };
 };
 </script>
 </script>
-  
-  <style scoped>
+
+<style scoped>
 /* 顶部查询条件样式Start */
 /* 顶部查询条件样式Start */
 .queryFrom .el-row {
 .queryFrom .el-row {
   margin: 10px 0px;
   margin: 10px 0px;
@@ -385,4 +368,3 @@ export default {
 
 
 /* 顶部查询条件样式End */
 /* 顶部查询条件样式End */
 </style>
 </style>
-