| <!DOCTYPE HTML> | 
| <html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> | 
| <head> | 
|     <meta charset="utf-8"> | 
|     <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> | 
|     <meta name="renderer" content="webkit|ie-comp|ie-stand"> | 
|     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|     <meta name="viewport" | 
|           content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> | 
|     <meta http-equiv="Cache-Control" content="no-siteapp"/> | 
|     <!-- 本框架基本脚本和样式 --> | 
|     <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script> | 
|     <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}"> | 
|     <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}"> | 
|     <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> | 
| </head> | 
| <body> | 
| <div class="ibox-content" id="app" v-cloak> | 
|   | 
|     <el-row> | 
|         <el-col :span="4"> | 
|             <table class="table table-bordered"> | 
|                 <tr v-for="(item,index) in categoryList"> | 
|                     <td @click="changeCategory(index)"> | 
|                         <el-link v-if="currentCategory ==item" type="primary">{{item}}</el-link> | 
|                         <el-link v-else type="info">{{item}}</el-link> | 
|                     </td> | 
|                 </tr> | 
|             </table> | 
|         </el-col> | 
|         <el-col :span="20"> | 
|             <form class="form-horizontal" id="dataform" | 
|                   onsubmit="javascripr:return false;"> | 
|   | 
|                 <template v-for="paramSetting in paramSettings"> | 
|   | 
|                     <div v-if="paramSetting.type==4" class="form-group"> | 
|                         <label class="col-md-2 control-label">{{paramSetting.name}}</label> | 
|                     </div> | 
|   | 
|   | 
|                     <div class="form-group" v-if="paramSetting.type==1"> | 
|                         <label class="col-md-2 control-label">{{paramSetting.name}}</label> | 
|                         <div class="col-md-8"> | 
|                             <el-input v-model="paramSetting.userValue"></el-input> | 
|                         </div> | 
|                     </div> | 
|   | 
|   | 
|                     <div class="form-group" v-if="paramSetting.type==2"> | 
|                         <label class="col-md-2 control-label">{{paramSetting.name}}</label> | 
|                         <div class="col-md-8"> | 
|                             <el-select v-model="paramSetting.userValue" placeholder="请选择"> | 
|                                 <el-option | 
|                                         v-for="item in paramSetting.value" | 
|                                         :key="item" | 
|                                         :label="item" | 
|                                         :value="item"> | 
|                                 </el-option> | 
|                             </el-select> | 
|                         </div> | 
|                     </div> | 
|   | 
|                     <div class="form-group" v-if="paramSetting.type==3"> | 
|                         <label class="col-md-2 control-label">{{paramSetting.name}}</label> | 
|                         <div class="col-md-8"> | 
|                             <el-checkbox-group v-model="paramSetting.userValue"> | 
|                                 <template v-for="item in paramSetting.value"> | 
|                                     <el-checkbox v-bind:label="item" v-bind:value="item"></el-checkbox> | 
|                                 </template> | 
|                             </el-checkbox-group> | 
|                         </div> | 
|                     </div> | 
|                 </template> | 
|   | 
|   | 
|                 <el-row justify="center" type="flex"> | 
|                     <el-button type="primary" @click="submit()">保存</el-button> | 
|                 </el-row> | 
|                 <!-- 测试 --> | 
|   | 
|             </form> | 
|         </el-col> | 
|     </el-row> | 
|   | 
|   | 
| </div> | 
| </body> | 
| <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> | 
| <script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> | 
| <script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script> | 
| <script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> | 
| <script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> | 
| <script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> | 
|   | 
|   | 
| <script> | 
|   | 
|     var app = new Vue({ | 
|         el: '#app', | 
|         data: { | 
|             form: { | 
|                 warehouseId: '', | 
|                 shopId: '', | 
|   | 
|             }, | 
|             paramSettings: [], | 
|             warehouses: [], | 
|             shops: [], | 
|             categoryList: [], | 
|         }, | 
|         created: function () { | 
|             this.loadInfo(); | 
|         }, | 
|   | 
|         mounted: function () { | 
|   | 
|         }, | 
|   | 
|         methods: { | 
|   | 
|             //加载分类 | 
|             loadInfo() { | 
|                 let _this = this; | 
|   | 
|                 AjaxProxy.requst({ | 
|                     app: _this, | 
|                     type: 'Get', | 
|                     data: {}, | 
|                     url: basePath + '/admin/busParameterSettings/getAllCategoryList', | 
|                     callback: function (data) { | 
|   | 
|                         let categoryList = data.rows; | 
|                         for (let i = 0; i < categoryList.length; i++) { | 
|                             if (categoryList[i].type == 3) { | 
|                                 if (categoryList[i].value) { | 
|                                     categoryList[i].value = categoryList[i].value.split(","); | 
|                                 } | 
|                             } | 
|                         } | 
|                         console.log(categoryList); | 
|                         _this.categoryList = categoryList; | 
|                         _this.currentCategory = categoryList[0]; | 
|                         _this.loadParamSettingList(); | 
|                     } | 
|                 }); | 
|             }, | 
|   | 
|   | 
|             //改变编辑页面,切换页面元素 | 
|             changeCategory(index) { | 
|                 this.currentCategory = this.categoryList[index]; | 
|                 this.loadParamSettingList(); | 
|             }, | 
|   | 
|             loadParamSettingList() { | 
|                 let _this = this; | 
|                 //加载配置 | 
|                 AjaxProxy.requst({ | 
|                     app: _this, | 
|                     data: {category: _this.currentCategory}, | 
|                     url: basePath + '/admin/busParameterSettings/getByCategory', | 
|                     callback: function (data) { | 
|                         let paramSettings = data.rows; | 
|                         for (let i = 0; i < paramSettings.length; i++) { | 
|                            if (paramSettings[i].type == 3) { | 
|                                 paramSettings[i].value = paramSettings[i].value.split(","); | 
|                                 if (paramSettings[i].userValue) { | 
|                                     paramSettings[i].userValue = paramSettings[i].userValue.split(","); | 
|                                 } | 
|                             } else if (paramSettings[i].type == 2) { | 
|                                 paramSettings[i].value = paramSettings[i].value.split(","); | 
|   | 
|                             } | 
|                         } | 
|                         _this.paramSettings = paramSettings; | 
|                         console.log("over"); | 
|                     } | 
|                 }); | 
|             }, | 
|   | 
|             submit() { | 
|   | 
|                 console.log("提交"); | 
|                 let _this = this; | 
|                 let submitDate = []; | 
|                 for (let i = 0; i < _this.paramSettings.length; i++) { | 
|                     let paramSetting = _this.paramSettings[i]; | 
|   | 
|                     let userValue = paramSetting.userValue; | 
|   | 
|                     if (paramSetting.type == 3) { | 
|                         userValue = paramSetting.userValue.join(","); | 
|                     } | 
|                     let obj = { | 
|                         code: paramSetting.code, | 
|                         userValue: userValue | 
|                     } | 
|   | 
|                     submitDate.push(obj); | 
|                 } | 
|   | 
|   | 
|                 AjaxProxy.requst({ | 
|                     app: _this, | 
|                     data: submitDate, | 
|                     url: basePath + '/admin/busParameterSettings/modifyCompanyParams', | 
|                     callback: function (data) { | 
|                         _this.$message({ | 
|                             message: data.info, | 
|                             type: 'success', | 
|                             onClose: function () { | 
|                                 _this.loadParamSettingList(); | 
|                             } | 
|                         }); | 
|                     } | 
|                 }); | 
|   | 
|             } | 
|         } | 
|   | 
|     }) | 
| </script> | 
|   | 
| </body> | 
| </html> |