6f2d2f55de829a72c4b6944d1d09b87a09e9456e.svn-base 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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.username"></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="columns1"
  36. :dataSource="dataSource1"
  37. :pagination="ipagination"
  38. :loading="loading"
  39. :scroll="{ y: 240 }"
  40. :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange,type:'radio'}"
  41. @change="handleTableChange">
  42. </a-table>
  43. </div>
  44. <!-- table区域-end -->
  45. </a-tab-pane>
  46. </a-modal>
  47. </div>
  48. </template>
  49. <script>
  50. import {filterObj} from '@/utils/util'
  51. import {getAction} from '@/api/manage'
  52. export default {
  53. name: "SelectUserModal",
  54. data() {
  55. return {
  56. title: "推送详情",
  57. xmid:"",
  58. names: [],
  59. keys:"",
  60. visible: false,
  61. placement: 'right',
  62. description: '',
  63. // 查询条件
  64. queryParam: {},
  65. // 表头
  66. columns1: [
  67. {
  68. title: '#',
  69. dataIndex: '',
  70. key: 'rowIndex',
  71. width: 50,
  72. align: "center",
  73. customRender: function (t, r, index) {
  74. return parseInt(index) + 1;
  75. }
  76. },
  77. {
  78. title: '用户账号',
  79. align: "center",
  80. width: 100,
  81. dataIndex: 'username'
  82. },
  83. {
  84. title: '用户名称',
  85. align: "center",
  86. width: 100,
  87. dataIndex: 'realname'
  88. },
  89. {
  90. title: '性别',
  91. align: "center",
  92. width: 100,
  93. dataIndex: 'sex_dictText'
  94. },
  95. {
  96. title: '电话',
  97. align: "center",
  98. width: 100,
  99. dataIndex: 'phone'
  100. },
  101. ],
  102. columns2: [
  103. {
  104. title: '接收人',
  105. align: "center",
  106. dataIndex: 'realname',
  107. key: 'realname',
  108. },
  109. {
  110. title: '发送时间',
  111. align: "center",
  112. dataIndex: 'createTime',
  113. key: 'createTime',
  114. scopedSlots: {customRender: 'action'},
  115. },
  116. {
  117. title: '接受时间',
  118. align: "center",
  119. dataIndex: 'readTime',
  120. key: 'readTime',
  121. scopedSlots: {customRender: 'action'},
  122. },
  123. {
  124. title: '是否已读',
  125. align: "center",
  126. dataIndex: 'readFlag',
  127. key: 'readFlag',
  128. customRender: function (text) {
  129. if (text == '1') {
  130. return "已读";
  131. } else {
  132. return "未读";
  133. }
  134. }
  135. },
  136. ],
  137. //数据集
  138. dataSource1: [],
  139. dataSource2: [],
  140. dataSource3: [],
  141. // 分页参数
  142. ipagination: {
  143. current: 1,
  144. pageSize: 10,
  145. pageSizeOptions: ['10', '20', '30'],
  146. showTotal: (total, range) => {
  147. return range[0] + "-" + range[1] + " 共" + total + "条"
  148. },
  149. showQuickJumper: true,
  150. showSizeChanger: true,
  151. total: 0
  152. },
  153. isorter: {
  154. column: 'createTime',
  155. order: 'desc',
  156. },
  157. loading: false,
  158. selectedRowKeys: [],
  159. selectedRows: [],
  160. url: {
  161. list: "/sys/user/list",
  162. accecptList:"/engineeringpush/rmEngineeringpush/findAllUser"
  163. }
  164. }
  165. },
  166. created() {
  167. this.loadData();
  168. },
  169. methods: {
  170. searchQuery() {
  171. this.loadData(1);
  172. },
  173. searchReset() {
  174. this.queryParam = {};
  175. this.loadData(1);
  176. },
  177. close () {
  178. this.$emit('close');
  179. this.visible = false;
  180. },
  181. handleCancel() {
  182. this.close()
  183. },
  184. handleOk() {
  185. this.dataSource2 = this.selectedRowKeys;
  186. console.log("data:" + this.dataSource2);
  187. this.$emit("selectFinished", this.dataSource2);
  188. this.visible = false;
  189. },
  190. add(record) {
  191. this.keys="accept"
  192. this.xmid=record.id
  193. this.visible = true;
  194. },
  195. loadData(arg) {
  196. //加载数据 若传入参数1则加载第一页的内容
  197. if (arg === 1) {
  198. this.ipagination.current = 1;
  199. }
  200. var params = this.getQueryParams();//查询条件
  201. getAction(this.url.list, params).then((res) => {
  202. if (res.success) {
  203. this.dataSource1 = res.result.records;
  204. this.ipagination.total = Number(res.result.total);
  205. }
  206. })
  207. },
  208. getQueryParams() {
  209. var param = Object.assign({}, this.queryParam, this.isorter);
  210. param.field = this.getQueryField();
  211. param.pageNo = this.ipagination.current;
  212. param.pageSize = this.ipagination.pageSize;
  213. return filterObj(param);
  214. },
  215. getQueryField() {
  216. //TODO 字段权限控制
  217. },
  218. onSelectAll(selected, selectedRows, changeRows) {
  219. if (selected === true) {
  220. for (var a = 0; a < changeRows.length; a++) {
  221. this.dataSource2.push(changeRows[a]);
  222. }
  223. } else {
  224. for (var b = 0; b < changeRows.length; b++) {
  225. this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
  226. }
  227. }
  228. // console.log(selected, selectedRows, changeRows);
  229. },
  230. onSelect(record, selected) {
  231. if (selected === true) {
  232. this.dataSource2.push(record);
  233. } else {
  234. var index = this.dataSource2.indexOf(record);
  235. //console.log();
  236. if (index >= 0) {
  237. this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
  238. }
  239. }
  240. },
  241. tabsChange(key) {
  242. if (key == "accept") {
  243. this.loadData2();
  244. }
  245. },
  246. onSelectChange(selectedRowKeys, selectedRows) {
  247. this.selectedRowKeys = selectedRowKeys;
  248. this.selectionRows = selectedRows;
  249. },
  250. onClearSelected() {
  251. this.selectedRowKeys = [];
  252. this.selectionRows = [];
  253. },
  254. handleDelete: function (record) {
  255. this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
  256. },
  257. handleTableChange(pagination, filters, sorter) {
  258. //分页、排序、筛选变化时触发
  259. console.log(sorter);
  260. //TODO 筛选
  261. if (Object.keys(sorter).length > 0) {
  262. this.isorter.column = sorter.field;
  263. this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
  264. }
  265. this.ipagination = pagination;
  266. this.loadData();
  267. }
  268. }
  269. }
  270. </script>
  271. <style lang="less" scoped>
  272. .ant-card-body .table-operator {
  273. margin-bottom: 18px;
  274. }
  275. .ant-table-tbody .ant-table-row td {
  276. padding-top: 15px;
  277. padding-bottom: 15px;
  278. }
  279. .anty-row-operator button {
  280. margin: 0 5px
  281. }
  282. .ant-btn-danger {
  283. background-color: #ffffff
  284. }
  285. .ant-modal-cust-warp {
  286. height: 100%
  287. }
  288. .ant-modal-cust-warp .ant-modal-body {
  289. height: calc(100% - 110px) !important;
  290. overflow-y: auto
  291. }
  292. .ant-modal-cust-warp .ant-modal-content {
  293. height: 90% !important;
  294. overflow-y: hidden
  295. }
  296. </style>