123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>作业配置项-添加/修改</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
- <!-- 所有的 css js 资源 -->
- <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <style type="text/css">
- .c-panel .el-form .c-label {
- width: 7em !important;
- }
- .c-panel .el-form .el-input,
- .c-panel .el-form .el-textarea__inner {
- width: 250px;
- }
- .item-num .el-input__inner {
- width: 130px;
- display: inline;
- }
- </style>
- </head>
- <body>
- <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
- <!-- ------- 内容部分 ------- -->
- <div class="s-body">
- <div class="c-panel">
- <div class="c-title" v-if="id == 0">数据添加</div>
- <div class="c-title" v-else>数据修改</div>
- <el-form v-if="m">
- <sa-item type="text" name="车型" v-model="m.itemName" placeholder="请输入业务类型" br></sa-item>
- <div class="c-item">
- <label class="c-label">通知类型:</label>
- <el-select v-model="m.businessType">
- <el-option v-for="item in businessTypeList" :key="item.id" :value="item.id"
- :label="item.name">
- </el-option>
- </el-select>
- </div>
- <div class="c-item">
- <label class="c-label">统计类型:</label>
- <el-select v-model="m.payType">
- <el-option v-for="item in payTypeList" :key="item.id" :value="item.id"
- :label="item.name">
- </el-option>
- </el-select>
- </div>
- <div class="c-item">
- <label class="c-label">空车/载重:</label>
- <el-select multiple v-model="itemType" placeholder="请选择">
- <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
- </el-option>
- </el-select>
- </div>
- <sa-item type="text" name="计价单位" v-model="m.unit" placeholder="请输入计量单位" br></sa-item>
- <div class="c-item">
- <label class="c-label">计费金额(元):</label>
- <el-input-number class="item-num" v-model="m.price" :step="10" :min="1" :max="9999">
- </el-input-number>
- </div>
- <div class="c-item">
- <label class="c-label">税率(%):</label>
- <el-input-number class="item-num" v-model="m.taxRate" :step="0.1" :min="0.01" :max="100">
- </el-input-number>
- </div>
- <div>
- <label>适用载重(kg):</label>
- <div style="display: inline;margin-left: 20px;">
- <el-input-number class="item-num" v-model="m.minWeight" :step="1" :min="1"
- :max="999999"></el-input-number>
- 至
- <el-input-number class="item-num" v-model="m.maxWeight" :step="1" :min="0"
- :max="9999999"></el-input-number>
- </div>
- </div>
- <div style="margin-top: 20px;">
- <label>适用车长(米):</label>
- <div style="display: inline;margin-left: 20px;">
- <el-input-number class="item-num" v-model="m.minLength" :step="1" :min="0" :max="99">
- </el-input-number>
- 至
- <el-input-number class="item-num" v-model="m.carLength" :step="1" :min="0" :max="99">
- </el-input-number>
- </div>
- </div>
- </el-form>
- </div>
- </div>
- <!-- ------- 底部按钮 ------- -->
- <div class="s-foot">
- <el-button type="primary" @click="ok()">确定</el-button>
- <el-button @click="sa.closeCurrIframe()">取消</el-button>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
- },
- el: '.vue-box',
- data: {
- id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
- m: {
- id: '', // 主键
- itemName: '',
- price: '400',
- payType: '',
- taxRate: 6,
- businessType: '',
- unit: '元/车',
- minLength: '4.2',
- carLength: '20', //车长
- minWeight: '5',
- maxWeight: '10', //最大载重
- status: '1', //转态
- }, // 实体对象
- itemTypeList: [],
- payTypeList: [],
- businessTypeList: [],
- carTypeList: [],
- itemType: []
- },
- methods: {
- getItemType() {
- sa.ajax('/TbItem/getItemType', function (resp) {
- this.carTypeList = resp.data;
- }.bind(this))
- },
- getBusinessTypeList() {
- sa.ajax('/TbCostomer/getTypeList', function (resp) {
- let list = resp.data;
- this.businessTypeList = list
- }.bind(this))
- },
- getPayTypeList() {
- sa.ajax('/TbFeeStatistics/getFeeType', function (resp) {
- let list = resp.data;
- this.payTypeList = list;
- }.bind(this))
- },
- // 提交数据
- ok: function () {
- // 表单校验
- let m = this.m;
- // sa.checkNull(m.id, '请输入 [主键]');
- sa.checkNull(m.itemName, '请输入 [业务类型]');
- sa.checkNull(m.price, '请输入 [计费金额]');
- sa.checkNull(m.unit, '请输入 [计价单位]');
- let minLength = m.minLength;
- let maxLength = m.carLength;
- let minWeight = m.minWeight;
- let maxWeight = m.maxWeight;
- sa.checkNull(minLength, '请输入 [最小车长]');
- sa.checkNull(maxLength, '请输入 [最大车长]');
- sa.checkNull(minWeight, '请输入 [最小载重]');
- sa.checkNull(maxWeight, '请输入 [最大载重]');
- if (minLength > maxLength) {
- sa.error('最小车长不能大于最大车长')
- return;
- }
- if (minWeight > maxWeight) {
- sa.error('最小载重不能大于最大载重')
- return;
- }
- let payTypeList = this.payTypeList;
- let payType = payTypeList.filter(obj => obj.id == m.payType).pop();
- sa.checkNull(payType, '请选择收费分类');
- m.payType = payType.id;
- m.payTypeName = payType.name;
- let businessTypeList = this.businessTypeList;
- let businessType = businessTypeList.filter(obj => obj.id == m.businessType).pop();
- m.businessType = businessType.id;
- m.businessTypeName = businessType.name;
- m.itemType = this.itemType.join(',')
- // 开始增加或修改
- sa.ajax('/TbItem/update', m, function (res) {
- sa.alert('修改成功', this.clean);
- }.bind(this));
- },
- // 添加/修改 完成后的动作
- clean: function () {
- if (this.id == 0) {
- } else {
- parent.app.f5(); // 刷新父页面列表
- sa.closeCurrIframe(); // 关闭本页
- }
- },
- },
- mounted: function () {
- sa.ajax('/TbItem/getById?id=' + this.id, function (res) {
- this.m = res.data;
- this.itemType = this.m.itemType ? this.m.itemType.split(',') : []
- }.bind(this))
- this.getBusinessTypeList();
- this.getPayTypeList();
- this.getItemType();
- }
- })
- </script>
- </body>
- </html>
|