123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>作业配置项-列表</title>
- <meta 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>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <div class="c-panel">
- <!-- ------------- 检索参数 ------------- -->
- <el-form ref="form" :model='p' @submit.native.prevent>
- <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">重置</el-button>
- <el-button type="primary" icon="el-icon-plus" @click="add()">选择
- </el-button>
- <br/>
- </el-form>
- <!-- ------------- 数据列表 ------------- -->
- <el-table class="data-table" ref="data-table" :data="dataList" style="margin-top: 10px;">
- <el-table-column type="index" width="50">
- </el-table-column>
- <sa-td name="车型" prop="itemName" width="200"></sa-td>
- <sa-td name="价格" prop="price"></sa-td>
- <sa-td name="单位" prop="unit"></sa-td>
- <sa-td name="税率" prop="taxRate"></sa-td>
- <sa-td name="适合规格(米)" width="120">
- <template slot-scope="s">
- <label>{{s.row.minLength}}—{{s.row.carLength}}</label>
- </template>
- </sa-td>
- <sa-td name="适合载重(kg)" width="120">
- <template slot-scope="s">
- <label>{{s.row.minWeight}}—{{s.row.maxWeight}}</label>
- </template>
- </sa-td>
- <el-table-column label="操作" fixed="right">
- <template slot-scope="s">
- <el-button class="c-btn" type="danger" @click="del(s.row)">移除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- ------------- 分页 ------------- -->
- <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
- </sa-item>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
- },
- el: '.vue-box',
- data: {
- p: { // 查询参数
- id: '', // 主键
- typeId: sa.p('id', ''),
- pageNo: 1, // 当前页
- pageSize: 20, // 页大小
- sortType: 0 // 排序方式
- },
- dataCount: 0,
- dataList: [], // 数据集合
- },
- methods: {
- updateRemarkNeed: function (data) {
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.need;
- var ajax = sa.ajax('/RelationTypeItem/updateRemarkNeed', {
- itemId: data.id,
- typeId: data.typeId,
- needRemark: data.needRemark
- }, function (res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function () {
- if (isOk == false) {
- data.needRemark = oldValue;
- }
- })
- },
- updateNum: function (data) {
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.inc;
- var ajax = sa.ajax('/RelationTypeItem/updateNum', {
- itemId: data.id,
- typeId: data.typeId,
- inc: data.inc
- }, function (res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function () {
- if (isOk == false) {
- data.inc = oldValue;
- }
- })
- },
- updateRemarkMust: function (data) {
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.need;
- var ajax = sa.ajax('/RelationTypeItem/updateRemarkMust', {
- itemId: data.id,
- typeId: data.typeId,
- mustRemark: data.mustRemark
- }, function (res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function () {
- if (isOk == false) {
- data.mustMark = oldValue;
- }
- })
- },
- updateStatus: function (data) {
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.need;
- var ajax = sa.ajax('/RelationTypeItem/updateStatus', {
- itemId: data.id,
- typeId: data.typeId,
- need: data.need
- }, function (res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function () {
- if (isOk == false) {
- data.need = oldValue;
- }
- })
- },
- // 新增
- add: function (data) {
- let ids = this.dataList.map(obj => obj.id).join(',');
- sa.showIframe('选择明细', 'tb-item-select.html?typeId=' + this.p.typeId + '&ids=' + ids, '900px',
- '90%');
- },
- // 删除
- del: function (data) {
- sa.confirm('是否移除出该收费项?', function () {
- sa.ajax('/RelationTypeItem/delete?id=' + data.id + '&typeId=' + data.typeId, function (res) {
- sa.arrayDelete(this.dataList, data);
- sa.ok('删除成功');
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this))
- }.bind(this));
- },
- // 刷新
- f5: function () {
- sa.ajax('/TbItem/getTypeItemList', sa.removeNull(this.p), function (res) {
- let list = res.data;
- this.dataList = list; // 数据
- this.dataCount = res.dataCount; // 数据总数
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this));
- },
- },
- created: function () {
- this.f5();
- sa.onInputEnter();
- }
- })
- </script>
- </body>
- </html>
|