Browse Source

车系车型页面&&上传资料页面

suxinf 5 years ago
parent
commit
1ec36e49a4

+ 1 - 1
src/App.vue

@@ -36,7 +36,7 @@ export default {
     return {
       navTitle1: ' > 数据管理',
       navTitle2: '',
-      isManufacturer: 'distributor', // distributor 经销商 manufacturer 厂商
+      isManufacturer: 'manufacturer', // distributor 经销商 manufacturer 厂商
     }
   },
   methods: {

+ 3 - 3
src/components/LoginInfo.vue

@@ -15,7 +15,7 @@
           </div>
           <div class="login_time">
               <p>登录时间</p>
-              <p>2021年-3-(星期四)</p>
+              <p>2021-3-31(星期三)</p>
           </div>
       </div>
   </div>
@@ -55,8 +55,8 @@ export default {};
         display: flex;
         .clock_icon{
             margin: 8px 0 0 10px;
-            width: 30px;
-            height: 30px;
+            width: 24px;
+            height: 24px;
             img{
                 width: 30px;
                 height: 30px;

+ 3 - 3
src/components/Table.vue

@@ -13,9 +13,9 @@
                     {{ item }}
                 </td>
                 <td v-if="operation" :style="trStyle">
-                    <span 
-                        v-for="(operationObj, index) in operation" :key="index"
-                        @click="operationObj.function" 
+                    <span
+                        v-for="(operationObj, i) in operation" :key="i"
+                        @click="operationObj.function(index)"
                         :style="operationStyle"
                     >{{ operationObj.name }}
                     </span>

+ 131 - 0
src/components/UploadInforTable.vue

@@ -0,0 +1,131 @@
+<template>
+  <div class="table_template">
+    <table class="table">
+        <thead>
+            <tr :style="tableHeadStyle">
+                <td v-for="(item, index) in tableHeader" :key="index" :style="tableHeadStyle">{{ item }}</td>
+            </tr>
+        </thead>
+        <tbody>
+            <tr v-for="(obj, index) in tableData" :key="index" :class="{ table_gray: !discolor && index%2 === 0 }">
+                <td :style="trStyle" v-if="flag">{{ index + 1 }}</td>
+                <td v-for="(item, index) in obj" :key="index" :style="trStyle">
+                    {{ item }}
+                </td>
+                <td :style="trStyle">
+                    <img src="../img/add.png" @click="changeIcon(index)" :style="operationStyle" v-if="imgFlag[index]">
+                    <img src="../img/delete.png" @click="changeIcon(index)" :style="operationStyle" v-else>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+  </div>
+</template>
+
+<script>
+export default {
+    props: {
+        // 表数据
+        tableData: {
+            type: Array,
+            default: () => {
+                return []
+            }
+        },
+        // 表头
+        tableHeader: {
+            type: Array,
+            default: () => {
+                return []
+            }
+        },
+        // 表头样式
+        tableHeadStyle: {
+            type: Object,
+            default: () => {
+                return {
+                    background: '#848484',
+                    height: '50px',
+                    color: '#fff'
+                }
+            }
+        },
+        // 操作样式
+        operationStyle: {
+            type: Object,
+            default: () => {
+                return {
+                    color: '#0000ff'
+                }
+            }
+        },
+        // imgFlag
+        imgFlag: {
+            type: Array,
+            default: () => {
+                let arr = new Array(20).fill(20);
+                return arr
+            }
+        },
+        // 表格除去表头的样式
+        trStyle: {
+            type: Object,
+            default: () => {
+                return {
+                    width: '200px',
+                    height: '50px'
+                }
+            }
+        },
+        // 是否隔行变色
+        discolor: {
+            type: Boolean,
+            default: true
+        },
+        // 每页表格共有多少数据
+        pageSize: {
+            type: Number,
+            default: 20
+        },
+        flag: {
+            type: Boolean,
+            default: true
+        },
+    },
+    methods: { 
+        changeIcon: function(index) {
+            console.log(index);
+            this.$emit('change_icon', index);
+        }
+    },
+    mounted() {
+    },
+    data() {
+        return {
+        }
+    }
+};
+</script>
+
+<style scoped lang="less">
+.table_template{
+    text-align: center;
+    .table{
+        background-color: #fff;
+        border-collapse:collapse;
+        border:none;
+        width: 100%;
+        td{
+            border: 1px solid #ccc;
+        }
+        span{
+            &:hover{
+                cursor: pointer;
+            }
+        }
+    }
+}
+.table_gray{
+    background: #f5f5f5;
+}
+</style>

BIN
src/img/add.png


BIN
src/img/delete.png


File diff suppressed because it is too large
+ 7 - 0
src/img/search.svg


BIN
src/img/select.png


+ 22 - 0
src/tableConfig/carSeries.js

@@ -0,0 +1,22 @@
+const TABLEHEADS = ['车系', '操作'];
+const TABLEHEADSTYLES = {
+    background: '#8D9092',
+    height: '36px',
+    color: '#fff',
+};
+const TRSSTYLE =  {
+    width: '50%',
+    height: '36px',
+    // padding: '20px'
+};
+const OPERATIONSSTYLE = {
+    padding: '10px',
+    color: '#00f'
+
+}
+module.exports = {
+    TABLEHEADS,
+    TABLEHEADSTYLES,
+    TRSSTYLE,
+    OPERATIONSSTYLE
+}

+ 9 - 15
src/tableConfig/uploadinfo.js

@@ -1,32 +1,26 @@
 const AREASLIST = ['全区', '北区', '南区', '东区', '自定义分组'];
-const RANGESLIST = ['共通', '部分'];
 const MATERIALTIMESLIST = ['2021/03', '2021/04'];
-const TABLEHEADS = ['序号', '经销商名称', '结案材料审核', '所属区域', '筛选'];
+const TABLEHEADS = ['序号', '经销商名称', 'DLR Code', '所属区域', '筛选'];
 const TABLEHEADSTYLES = {
     background: '#8D9092',
-    height: '30px',
+    height: '36px',
     color: '#fff'
 };
-const OPERATIONS = [
-    {
-        name: '查看',
-        function: () => {
-          alert(1)
-        }
-    }
-];
 const TRSSTYLE =  {
     width: '20%',
-    height: '30px'
+    height: '36px'
 };
+const OPERATIONSTYLES = {
+    width: '20px',
+    height: '20px'
+}
 const GROUPLISTS = ['第一小组', '第二小组', '第三小组', '第四小组', '第五小组', '第六小组'];
 module.exports = {
     AREASLIST,
-    RANGESLIST,
     MATERIALTIMESLIST,
     TABLEHEADS,
     TABLEHEADSTYLES,
-    OPERATIONS,
     TRSSTYLE,
-    GROUPLISTS
+    GROUPLISTS,
+    OPERATIONSTYLES
 }

+ 160 - 28
src/views/data/UploadInfor.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="upload_record">
     <form>
-      <div>
-        <span>资料名称</span><input type="text" class="inputStyle focusStyle" v-model="inforName">
+      <div class="dataName">
+        <span>资料名称</span><input type="text" class="inputStyle focusStyle" v-model="inforName" @focus="hideTip" @blur="checkName()">
+        <p v-show="tipFlag">资料名称不能重复,请重新输入</p>
       </div>
       <div  class="inforDes">
         <span>资料描述</span><textarea name="inforDes" cols="40" rows="4" class="focusStyle" v-model="inforDes"></textarea>
@@ -11,18 +12,18 @@
         <p>选择类型</p>
         <div>
           <span>素材时间</span>
-          <select name="materialTime" class="selectStyle" v-model="materialTime">
-            <option>请选择</option>
+          <select name="materialTime" class="selectStyle" v-model="materialTime" autocomplete="off">
+            <option value="" selected>请选择</option>
             <option  v-for="(time, index) in materialTimeList" :key="index" :value="time">{{time}}</option>
           </select>
           <span>经销商范围</span>
-          <select name="" id="" class="selectStyle" v-model="range">
-            <option>请选择</option>
-            <option v-for="(range, index) in rangeList" :key="index" :value="range">{{range}}</option>
+          <select class="selectStyle" v-model="range" autocomplete="off">
+            <option value="" selected>共通</option>
+            <option value="part">部分</option>
           </select>          
         </div>
       </div>
-      <div>
+      <div v-show="isShow">
         <p>权限设置</p>
         <div class="addByArea">
           <span>按区域添加</span>
@@ -33,15 +34,28 @@
         </div>
         <div class="addByCustomize">
           <span>自定义添加</span>
-          <input type="text" class="inputStyle focusStyle" v-model="addByCustomize">
+          <input id="drl" list="drls" class="inputStyle focusStyle" v-model="addByCustomize"/>
+          <datalist id="drls" value='12'>
+            <option value="BMW"/>
+            <option value="Ford"/>
+            <option value="Volvo"/>
+            </datalist>
           <button>添加</button>
         </div>
         <div class="addByGroup">
           <span>按小组添加</span>
-          <select name="" id="">
-            <option>请选择</option>
-            <option v-for="(group, index) in groupList" :key="index" :value="group">{{group}}</option>
-          </select>
+          <div class="selectBox">
+            <img src="../../img/select.png" @click="showOption">
+            <div class="optionBox" v-if="optionFlag">
+              <ul>
+                <li v-for="(item, index) in groupList" :key="index">
+                  <p>{{item}}</p>
+                  <img src="../../img/add.png" v-if="addFlag[index]" @click="addGroup(index)">
+                  <img src="../../img/delete.png" v-else @click="deleteGroup(index)">
+                </li>
+              </ul>
+            </div>
+          </div>
           <button>添加</button>
         </div>
       </div>
@@ -55,8 +69,10 @@
         :tableHeader='tableHeader'
         :tableData='tableData'
         :tableHeadStyle='tableHeadStyle'
-        :operation='operation'
         :discolor='discolor'
+        @change_icon='changeIcon'
+        :operationStyle='operationStyle'
+        :imgFlag='imgFlag'
       />
     </div>
     <div class="page">
@@ -72,14 +88,15 @@
       <input type="file" :v-model="fileValue" name="fileName" @change='changeFile()'>
     </div>
     <button @click="submit" class="submitBtn">提交</button>
+    <input id="myCar" list="cars" />
   </div>
 </template>
 
 <script>
-import UpLoadTable from '../../components/Table';
+import UpLoadTable from '../../components/UploadInforTable';
 import Count from '../../components/Count';
 import Tablepage from '../../components/TablePage';
-import { AREASLIST, RANGESLIST, MATERIALTIMESLIST, TABLEHEADS,TABLEHEADSTYLES, OPERATIONS, TRSSTYLE, GROUPLISTS } from '../../tableConfig/uploadinfo';
+import { AREASLIST, MATERIALTIMESLIST, TABLEHEADS,TABLEHEADSTYLES, TRSSTYLE, GROUPLISTS, OPERATIONSTYLES } from '../../tableConfig/uploadinfo';
 export default {
   props:{
     isManufacturer: {
@@ -92,14 +109,27 @@ export default {
     Count,
     Tablepage
   },
+  watch: {
+    range(val) {
+      if(val === 'part') {
+        this.isShow = true;
+      } else [
+        this.isShow = false
+      ]
+    }
+  },
   data() {
     return {
+      tipFlag: false, // 是否展示提示
+      isShow: false, // 共通时不展示权限设置
       inforName: '',
       inforDes: '',
       materialTime: '',
       range: '',
       addByCustomize: '',
       fileValue: '',
+      addFlag: [true, true, true, true, true, true], // 长度等于groupList.length
+      optionFlag: false, // 是否展示按小组添加的选择栏
       // 表格配置
       sum: 240, // 一共有多少条数据
       pageSize: 20, // 每页展示的数据
@@ -108,11 +138,11 @@ export default {
       areaList: AREASLIST, // 按区域添加
       groupList: GROUPLISTS, // 按小组添加
       materialTimeList: MATERIALTIMESLIST, // 素材时间
-      rangeList: RANGESLIST, // 经销商范围
       tableHeader: TABLEHEADS, // 表头
       tableData: [{name: '北京博瑞',code: 'L020',area: '东区'},{name: 'a',code: 'a',area: 'N'},{name: 'a',code: 'a',area: 'N'}],
       tableHeadStyle: TABLEHEADSTYLES, // 表头样式
-      operation: OPERATIONS, // 操作
+      operationStyle: OPERATIONSTYLES,// 筛选图片样式
+      imgFlag: new Array(20).fill(true), // 筛选栏用添加图片还是删除图片
       trStyle: TRSSTYLE // 表格tr样式
       // 文件
     }
@@ -127,6 +157,36 @@ export default {
     showDetail: () => {
       alert('展示详情');
     },
+    // 检查名字是否重复
+    checkName: function() {
+      if(this.inforName==1) {
+        this.tipFlag = true;
+      }
+    },
+    // 名字不重复,隐藏提示
+    hideTip: function() {
+      this.tipFlag = false;
+    },
+    // 显示隐藏按小组添加下拉框
+    showOption() {
+      this.optionFlag = !this.optionFlag;
+    },
+    // 按小组添加,增加小组
+    addGroup: function(index) {
+      this.addFlag.splice(index, 1, false);
+      console.log( this.addFlag);
+      // 添加数据
+    },
+    // 按小组添加,删除小组
+    deleteGroup: function(index) {
+      this.addFlag.splice(index, 1, true);
+      // 删除数据
+    },
+    // 筛选
+    changeIcon: function(i) {
+      this.imgFlag.splice(i,1,!this.imgFlag[i]);
+      console.log(i)
+    },
     // 获取某一页面的数据,展示在表格
     changePage: function(page) {
       this.currentPage = page;
@@ -179,12 +239,25 @@ export default {
     border: 1px solid #ccc;
     padding: 10px;
   }
+  .dataName{
+    p{
+      margin-left: 65px;
+      font-size: 10px;
+      color: rgb(206, 84, 84);
+    }
+  }
   .inforDes{
     margin: 10px 0 0 0;
     span{
       vertical-align: top;
       margin-right: 17px;
     }
+    textarea{
+      border: 1px solid #ccc;
+      border-radius: 3px;
+      color: #555555;
+      font-size: 12px;
+    }
   }
   .selectType{
     margin-top: 10px;
@@ -196,8 +269,12 @@ export default {
   .selectStyle{
     margin-left: 20px;
     margin-right: 20px;
-    height: 20px;
-    width: 100px;
+    padding: 4px 6px;
+    height: 28px;
+    width: 144px;
+    border: 1px solid #ccc;
+    color: #555555;
+    font-size: 12px;
   }
   .addByArea{
     margin: 10px 0 0 65px;
@@ -215,6 +292,7 @@ export default {
         height: 12px;
         vertical-align: middle;
         margin-top: -2px;
+        border:1px solid #ccc
       }
       span{
         margin-left: 2px;
@@ -231,13 +309,62 @@ export default {
     button{
       height: 28px;
     }
+    input{
+      // background: url('../../img/search.svg') no-repeat center left;
+      // background-size: 21px 25px;
+      background-color: #fff;
+    }
   }
   .addByGroup{
     margin: 10px 0 0 65px;
-    select{
+    display: flex;
+    align-items: center;
+    .selectBox{
+      position: relative;
       margin-left: 17px;
-      width: 172.8px;
-      height: 28px;
+      img{
+        width: 144px;
+        height: 28px;
+        &:hover{
+          cursor: pointer;
+        }
+      }
+      .optionBox{
+        position: absolute;
+        top: 28px;
+        left: 0;
+        border: 1px solid #ccc;
+        border-top: none;
+        width: 142px;
+        background-color: #fff;
+        border-radius: 5px;
+        ul{
+            width: 144px;
+            padding-bottom: 6px;
+            display: flex;
+            flex-direction: column;
+            align-items: center;
+          li{
+            width: 132px;
+            height: 28px;
+            font-size: 12px;
+            color: #555555;
+            display: flex;
+            align-items: center;
+            border-bottom: 1px solid #ccc;
+            display: flex;
+            justify-content: space-between;
+            padding-right: 5px;
+            img{
+              width: 20px;
+              height: 20px;
+              &:hover{
+                cursor: pointer;
+              }
+            }
+          }
+        }
+      }
     }
     button{
       height: 28px;
@@ -272,25 +399,30 @@ export default {
 }
 .inputStyle{
   margin-left: 17px;
-  height: 16px;
-  line-height: 16px;
+  width: 130px;
+  height: 18px;
+  line-height: 18px;
   padding: 4px 6px;
+  border: 1px solid #ccc;
+  color: #555555;
+  font-size: 12px;
 }
 .focusStyle{
-  outline-color: #ccc;
+  border: 1px solid #ccc;
   line-height: 20px;
   color: #555555;
+  outline: none;
 }
 .focusStyle:focus{
   animation: shadowAni 200ms linear forwards;
 }
 @keyframes shadowAni{
   0%{
-    outline-color: #cccccc;
+    border-color: #cccccc;
     box-shadow: inset 0px 0px 0 #ccc;
   };
   100%{
-    outline-color: #75b9F0;
+    border-color: #75b9F0;
     box-shadow: 0px 0px 10px #75b9F0;
   }
 }

+ 172 - 2
src/views/parameter/CarSeries.vue

@@ -1,20 +1,190 @@
 <template>
   <div class="car_series">
-      车型车系
+    <div class="count">
+      <button v-if="queryTag === 1" @click="showModal">新增车系</button>
+      <button v-else>新增车型</button>
+      <Count :sum='sum'></Count>
+    </div>
+    <div class="table">
+      <Table
+        :trStyle='trStyle'
+        :tableHeader='tableHeader'
+        :tableData='tableData'
+        :tableHeadStyle='tableHeadStyle'
+        :operation='operation'
+        :operationStyle='operationStyle'
+        :discolor='discolor'
+        :flag='flag'
+      ></Table>
+    </div>
+    <div class="page">
+      <Tablepage
+        :totalPage='totalPage'
+        :currentPage='currentPage'
+        @change_page='changePage'
+        @jump_page='jumpPage'
+      ></Tablepage>
+    </div>
+    <div class="modal">
+      <Modal
+        :modalFlag='modalFlag'
+        @hide_modal='showModal'
+      ></Modal>
+    </div>
   </div>
 </template>
 
 <script>
+import Count from '../../components/Count';
+import Tablepage from '../../components/TablePage';
+import Table from '../../components/Table';
+import { TABLEHEADS,TABLEHEADSTYLES, TRSSTYLE, OPERATIONSSTYLE } from '../../tableConfig/carSeries.js';
+import Modal from "./components/modal";
+
 export default {
+  components: {
+    Count,
+    Table,
+    Tablepage,
+    Modal
+  },
   data() {
     return {
+      sum: 140, // 一共有多少条数据
+      pageSize: 20, // 每页展示的数据
+      currentPage: 1,
+      // 表格配置
+      discolor: false,
+      flag: false,
+      tableHeader: TABLEHEADS, // 表头
+      operationStyle: OPERATIONSSTYLE, // 操作栏样式
+      tableData: [],
+      tableHeadStyle: TABLEHEADSTYLES, // 表头样式
+      operation: [
+        {
+          name: '编辑',
+          function: (index) => {
+            this.edit(index);
+          }
+        },
+        {
+          name: '删除',
+          function: (index) => {
+            this.delete(index);
+          }
+        },
+        {
+          name: '系列车型>',
+          function: (index) => {
+            this.carType(index);
+          }
+        }
+      ], // 操作
+      trStyle: TRSSTYLE, // 表格tr样式
+      getDate: [{carSeries: '雷克萨斯ES', str: '123'},{carSeries: '雷克萨斯ES', str: '124'},{carSeries: '雷克萨斯ES', str: '125'},],
+      functionData: [],
+      modalFlag: false, // 控制模态框展示
+    }
+  },
+    computed:{
+    // 表格总页数
+    totalPage() {
+      return Math.ceil(this.sum/this.pageSize);
+    },
+    // 获取路由参数
+    queryTag() {
+      console.log (111, this.$route.query);
+      return (this.$route.query && this.$route.query.tag) ? 0 : 1
+    }
+  },
+  methods: {
+    // 获取某一页面的数据,展示在表格
+    changePage: function(page) {
+      this.currentPage = page;
+      console.log(page);
+    },
+    // 点击上一页,下一页,首页,尾页
+    jumpPage: function(item) {
+      switch(item) {
+        case 1:
+          this.currentPage = 1;
+          break;
+        case 2:
+          this.currentPage = this.currentPage - 1;
+          break;
+        case 3:
+          this.currentPage = this.currentPage + 1;
+          break;
+        case 4:
+          this.currentPage = this.totalPage;
+          break;
+      }
+      console.log(this.currentPage);
+    },
+    // 获取数据
+    getData: function() {
+      this.tableData = [];
+      this.functionData = [];
+      this.getDate.forEach( (element) => {
+        this.tableData.push(
+          {
+            carSeries: element.carSeries
+          }
+        );
+        this.functionData.push(
+          {
+            str: element.str
+          }
+        )
+      });
+    },
+    // 展示、隐藏模态框
+    showModal: function() {
+      this.modalFlag = !this.modalFlag;
+    },
+    // 点击编辑
+    edit (index) {
+      console.log(this.functionData[index].str);
+    },
+    // 点击删除
+    delete (index) {
+      console.log('删除', this.functionData[index].str)
+    }, 
+    // 点击系列车型
+    carType (index) {
+      // 页面变化
+      this.$router.push({ query: { tag:  'vehicle_type' } });
+      console.log('点击系列车型', this.functionData[index].str)
     }
   },
   mounted() {
+    this.getData();
   }
 }
 </script>
 
 <style scoped lang="less">
-
+.car_series{
+  .table{
+    // margin-top: 10px;
+    max-height: 140px;
+    overflow: auto;
+    margin-top: 10px;
+  }
+  .count{
+    height: 40px;
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    button{
+      width: 86px;
+      height: 30px;
+      position: relative;
+      bottom: -5px;
+      margin: 0;
+      border-radius: 2px;
+    }
+  }
+}
 </style>

+ 50 - 0
src/views/parameter/components/modal.vue

@@ -0,0 +1,50 @@
+<template>
+  <div class="vehicle_servies_modal" v-if="modalFlag">
+      <div class="modal_content">
+          车系名称<input type="text" name="" id="">
+          <div class="btn">
+              <button >保存</button>
+              <button @click="hideModal">取消</button>
+          </div>
+      </div>
+  </div>
+</template>
+
+<script>
+export default {
+    props: {
+        modalFlag: {
+            type: Boolean,
+            default: false
+        }
+    },
+    methods: {
+        hideModal: function() {
+            this.$emit('hide_modal');
+        }
+    }
+}
+</script>
+
+<style scoped lang="less">
+.vehicle_servies_modal{
+    position: fixed;
+    left: 0;
+    top: 0;
+    height: 100vh;
+    width: 100vw;
+    background-color: rgba(127, 127, 127, 0.7);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    .modal_content{
+        width: 50vw;
+        height: 50vh;
+        background-color: #fff;
+        display: flex;
+        flex-direction: column;
+        justify-content: center;
+        align-items: center;
+    }
+}
+</style>