123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <!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">
- <!-- ------------- 检索参数 ------------- -->
- <div class="c-title">检索参数</div>
- <el-form ref="form" :model='p' @submit.native.prevent>
- <sa-item type="text" name="业务类型" v-model="p.itemName"></sa-item>
- <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
- <sa-item type="fast-btn" show="reset" style="display: inline;"></sa-item>
- <el-button type="primary" @click="add()">确定
- </el-button>
- <br/>
- </el-form>
- <!-- ------------- 数据列表 ------------- -->
- <el-table class="data-table" ref="data-table" :data="dataList">
- <sa-td type="selection"></sa-td>
- <sa-td name="业务类型" prop="itemName"></sa-td>
- <sa-td name="价格" prop="price"></sa-td>
- <sa-td name="单位" prop="unit"></sa-td>
-
- <el-table-column label="操作" fixed="right">
- <template slot-scope="s">
- <el-button class="c-btn" type="primary" @click="selectFn(s.row)">选择
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- ------------- 分页 ------------- -->
- <el-pagination :page-size="p.pageSize" :current-page="p.pageNo" layout="prev, pager, next"
- :total="dataCount" @current-change="pageChange">
- </el-pagination>
- </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: {
- typeId: sa.p('typeId', ''),
- ids: sa.p('ids', ''),
- p: { // 查询参数
- id: '', // 主键
- itemName: '', // 项目名称
- pageNo: 1, // 当前页
- pageSize: 20, // 页大小
- sortType: 0 // 排序方式
- },
- dataCount: 0,
- dataList: [], // 数据集合
- selection: []
- },
- methods: {
- // 新增
- add: function (data) {
- var selection = this.$refs['data-table'].selection;
- if (selection.length == 0) {
- return sa.msg('至少选择一条数据')
- }
- selection = selection.concat(this.selection);
- let obj = {
- typeId: this.typeId,
- itemIds: selection.map(obj => obj.id).join(',')
- }
- sa.ajax('/RelationTypeItem/setBatch', obj, function (resp) {
- sa.alert('添加成功');
- setTimeout(() => {
- sa.closeCurrIframe(); // 关闭本页
- parent.app.f5(); // 刷新父页面列表
- }, 1000)
- }.bind(this))
- },
- selectFn(data) {
- let obj = {
- typeId: this.typeId,
- itemId: data.id
- }
- sa.ajax('/RelationTypeItem/setSingle', obj, function (resp) {
- this.ids = this.ids + ',' + data.id;
- sa.alert('添加成功');
- setTimeout(() => {
- this.f5();
- }, 1000)
- }.bind(this))
- },
- pageChange(p) {
- this.selection = this.selection.concat(this.$refs['data-table'].selection);
- this.p.pageNo = p;
- this.f5();
- },
- // 刷新
- f5: function () {
- sa.ajax('/TbItem/getList', sa.removeNull(this.p), function (res) {
- let list = res.data;
- this.dataList = list; // 数据
- this.dataCount = res.dataCount; // 数据总数
- let ids = this.ids.split(',');
- ids = ids.concat(this.selection);
- list.forEach(row => {
- if (ids.indexOf(row.id) !== -1) {
- this.$nextTick(() => {
- this.$refs['data-table'].toggleRowSelection(row,
- true)
- })
- }
- })
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this));
- },
- },
- created: function () {
- this.f5();
- sa.onInputEnter();
- }
- })
- </script>
- </body>
- </html>
|