123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <!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: 8em !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">
- <el-form v-if="m">
- <sa-info name="组名称" br>{{m.name}}</sa-info>
- <sa-info type="enum" name="是否启用" :value="m.status"
- :jv="{1: '是', 0: '否'}" br></sa-info>
- <sa-info type="enum" name="完整性支付" :value="m.completePay"
- :jv="{1: '是', 0: '否'}" br></sa-info>
- <sa-item name="" class="s-ok" br>
- <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
- </sa-item>
- <el-divider></el-divider>
- <h4>规则</h4>
- <div style="width: 850px;margin-top: 20px;">
- <div v-for="item in list" :key="item.index">
- <div class="c-item" v-if="item.index>0">
- <label class="c-label">项目间隔(分):</label>
- <el-input-number disabled class="item-num" v-model="item.interval" :step="10" :min="0"
- :max="9999">
- </el-input-number>
- </div>
- <div class="c-item">
- <label class="c-label">第{{item.index + 1}}个:</label>
- <el-select disabled v-model="item.typeId" placeholder="请选择">
- <el-option :label="type.name" :value="type.id"
- v-for="(type,index) in item.businessTypeList">
- </el-option>
- </el-select>
- <label class="c-label" style="width: 160px;">单项间隔(小时):</label>
- <el-input-number disabled class="item-num" v-model="item.singleIntervalTime" :step="1"
- :min="1" :max="48">
- </el-input-number>
- </div>
- </div>
- </div>
- </el-form>
- </div>
- </div>
- <!-- ------- 底部按钮 ------- -->
- <div class="s-foot">
- <el-button type="primary" @click="sa.closeCurrIframe()">关闭</el-button>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
- },
- el: '.vue-box',
- data: {
- id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
- m: null, // 实体对象
- list: [],
- businessTypeList: [],
- },
- methods: {
- handlerAdd() {
- let list = this.list;
- this.list.push({
- index: list.length,
- typeId: '',
- interval: 30,
- singleIntervalTime: 12,
- businessTypeList: this.businessTypeList
- })
- },
- handlerDel(index) {
- let list = this.list;
- list.splice(index, 1);
- for (let i in list) {
- let obj = list[i];
- if (obj.index > index) {
- obj.index = obj.index - 1;
- }
- }
- this.list = list;
- },
- getBusinessType() {
- sa.ajax('/TbItemType/getList', {
- business: 0,
- sortType: 0
- }, function (resp) {
- let list = resp.data;
- this.businessTypeList = list;
- this.getById();
- }.bind(this))
- },
- // 创建一个 默认Model
- createModel: function () {
- return {
- id: '', //
- name: '', // 名称
- status: 1, // 是否启用(0=否,1=是)
- createTime: '', // 创建时间
- }
- },
- // 提交数据
- ok: function () {
- // 表单校验
- let m = this.m;
- sa.checkNull(m.name, '请输入 [名称]');
- // 开始增加或修改
- if (this.id <= 0) { // 添加
- sa.ajax('/TbSortGroup/add', m, function (res) {
- sa.alert('增加成功', this.clean);
- }.bind(this));
- } else { // 修改
- sa.ajax('/TbSortGroup/update', m, function (res) {
- sa.alert('修改成功', this.clean);
- }.bind(this));
- }
- },
- // 添加/修改 完成后的动作
- clean: function () {
- if (this.id == 0) {
- this.m = this.createModel();
- } else {
- parent.app.f5(); // 刷新父页面列表
- sa.closeCurrIframe(); // 关闭本页
- }
- },
- getById() {
- sa.ajax('/TbSortGroup/getById?id=' + this.id, function (res) {
- let data = res.data;
- if (data == null) {
- sa.alert('未能查找到 id=' + this.id + " 详细数据");
- return;
- }
- let sorts = data.sorts;
- let businessTypeList = this.businessTypeList;
- let list = [];
- for (let i in sorts) {
- let sort = sorts[i];
- let obj = {
- index: parseInt(i),
- typeId: sort.typeId,
- interval: sort.intervalTime,
- singleIntervalTime: sort.singleIntervalTime,
- businessTypeList: businessTypeList
- }
- list.push(obj);
- }
- this.m = data;
- this.list = list;
- }.bind(this))
- }
- },
- mounted() {
- this.getBusinessType()
- }
- })
- </script>
- </body>
- </html>
|