e855f5d5705b444d8845f704d8a80dbf2d7fdb76.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div>
  3. <a-modal
  4. centered
  5. :title="title"
  6. :width="1000"
  7. :visible="visible"
  8. @ok="handleOk"
  9. @cancel="handleCancel"
  10. cancelText="关闭">
  11. <!-- 查询区域 -->
  12. <div class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :span="10">
  16. <a-form-item label="用户账号">
  17. <a-input placeholder="请输入用户账号" v-model="queryParam.realname"></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :span="8">
  21. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  22. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  23. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  24. </span>
  25. </a-col>
  26. </a-row>
  27. </a-form>
  28. </div>
  29. <!-- table区域-begin -->
  30. <div>
  31. <a-table
  32. size="small"
  33. bordered
  34. rowKey="id"
  35. :columns="columns2"
  36. :dataSource="dataSource2"
  37. :loading="loading"
  38. :scroll="{ y: 240 }"
  39. @change="handleTableChange"
  40. >
  41. </a-table>
  42. </div>
  43. <!-- table区域-end -->
  44. </a-modal>
  45. </div>
  46. </template>
  47. <script>
  48. import {filterObj} from '@/utils/util'
  49. import {getAction} from '@/api/manage'
  50. export default {
  51. name: "SelectUserModal",
  52. data() {
  53. return {
  54. title: "推送详情",
  55. xmid:"",
  56. names: [],
  57. keys:"",
  58. visible: false,
  59. placement: 'right',
  60. description: '',
  61. // 查询条件
  62. queryParam: {},
  63. // 表头
  64. columns2: [
  65. {
  66. title: '接收人',
  67. align: "center",
  68. dataIndex: 'realname',
  69. key: 'realname',
  70. },
  71. {
  72. title: '发送时间',
  73. align: "center",
  74. dataIndex: 'createTime',
  75. key: 'createTime',
  76. scopedSlots: {customRender: 'action'},
  77. },
  78. {
  79. title: '接收时间',
  80. align: "center",
  81. dataIndex: 'readTime',
  82. key: 'readTime',
  83. scopedSlots: {customRender: 'action'},
  84. },
  85. {
  86. title: '是否接受',
  87. align: "center",
  88. dataIndex: 'readFlag',
  89. key: 'readFlag',
  90. customRender: function (text) {
  91. if (text == '1') {
  92. return "已接收";
  93. } else {
  94. return "未接收";
  95. }
  96. }
  97. },
  98. ],
  99. //数据集
  100. dataSource1: [],
  101. dataSource2: [],
  102. dataSource3: [],
  103. // 分页参数
  104. ipagination: {
  105. current: 1,
  106. pageSize: 10,
  107. pageSizeOptions: ['10', '20', '30'],
  108. showTotal: (total, range) => {
  109. return range[0] + "-" + range[1] + " 共" + total + "条"
  110. },
  111. showQuickJumper: true,
  112. showSizeChanger: true,
  113. total: 0
  114. },
  115. isorter: {
  116. column: 'createTime',
  117. order: 'desc',
  118. },
  119. loading: false,
  120. selectedRowKeys: [],
  121. selectedRows: [],
  122. url: {
  123. list: "/sys/user/list",
  124. accecptList:"/engineeringpush/rmEngineeringpush/findAllUser"
  125. }
  126. }
  127. },
  128. created() {
  129. },
  130. methods: {
  131. searchQuery() {
  132. this.loadData(1);
  133. },
  134. searchReset() {
  135. this.queryParam = {};
  136. this.loadData(1);
  137. },
  138. close () {
  139. this.$emit('close');
  140. this.visible = false;
  141. },
  142. handleCancel() {
  143. this.close()
  144. },
  145. handleOk() {
  146. /* this.dataSource2 = this.selectedRowKeys;
  147. console.log("data:" + this.dataSource2);
  148. this.$emit("selectFinished", this.dataSource2);*/
  149. this.visible = false;
  150. },
  151. add(record) {
  152. this.xmid=record.id
  153. this.searchReset()
  154. this.loadData()
  155. this.visible = true;
  156. },
  157. loadData(arg) {
  158. //加载数据 若传入参数1则加载第一页的内容
  159. if (arg === 1) {
  160. this.ipagination.current = 1;
  161. }
  162. var params = this.getQueryParams();//查询条件
  163. params.xmid=this.xmid;
  164. getAction(this.url.accecptList, params).then((res) => {
  165. if (res.success) {
  166. this.dataSource2 = res.result.records;
  167. this.ipagination.total = Number(res.result.total);
  168. }
  169. })
  170. },
  171. getQueryParams() {
  172. var param = Object.assign({}, this.queryParam, this.isorter);
  173. param.field = this.getQueryField();
  174. param.pageNo = this.ipagination.current;
  175. param.pageSize = this.ipagination.pageSize;
  176. return filterObj(param);
  177. },
  178. getQueryField() {
  179. //TODO 字段权限控制
  180. },
  181. onSelectAll(selected, selectedRows, changeRows) {
  182. if (selected === true) {
  183. for (var a = 0; a < changeRows.length; a++) {
  184. this.dataSource2.push(changeRows[a]);
  185. }
  186. } else {
  187. for (var b = 0; b < changeRows.length; b++) {
  188. this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
  189. }
  190. }
  191. // console.log(selected, selectedRows, changeRows);
  192. },
  193. onSelect(record, selected) {
  194. if (selected === true) {
  195. this.dataSource2.push(record);
  196. } else {
  197. var index = this.dataSource2.indexOf(record);
  198. //console.log();
  199. if (index >= 0) {
  200. this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
  201. }
  202. }
  203. },
  204. onSelectChange(selectedRowKeys, selectedRows) {
  205. this.selectedRowKeys = selectedRowKeys;
  206. this.selectionRows = selectedRows;
  207. },
  208. onClearSelected() {
  209. this.selectedRowKeys = [];
  210. this.selectionRows = [];
  211. },
  212. handleDelete: function (record) {
  213. this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
  214. },
  215. handleTableChange(pagination, filters, sorter) {
  216. //分页、排序、筛选变化时触发
  217. console.log(sorter);
  218. //TODO 筛选
  219. if (Object.keys(sorter).length > 0) {
  220. this.isorter.column = sorter.field;
  221. this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
  222. }
  223. this.ipagination = pagination;
  224. this.loadData();
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="less" scoped>
  230. .ant-card-body .table-operator {
  231. margin-bottom: 18px;
  232. }
  233. .ant-table-tbody .ant-table-row td {
  234. padding-top: 15px;
  235. padding-bottom: 15px;
  236. }
  237. .anty-row-operator button {
  238. margin: 0 5px
  239. }
  240. .ant-btn-danger {
  241. background-color: #ffffff
  242. }
  243. .ant-modal-cust-warp {
  244. height: 100%
  245. }
  246. .ant-modal-cust-warp .ant-modal-body {
  247. height: calc(100% - 110px) !important;
  248. overflow-y: auto
  249. }
  250. .ant-modal-cust-warp .ant-modal-content {
  251. height: 90% !important;
  252. overflow-y: hidden
  253. }
  254. </style>