receive.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <drawer-tabs-container>
  3. <div class="report-receive">
  4. <!-- 搜索 -->
  5. <Row class="sreachBox">
  6. <div class="item">
  7. <div class="item-3">
  8. <sreachTitle :val="keys.username">{{$L('发送人')}}</sreachTitle>
  9. <Input v-model="keys.username" :placeholder="$L('用户名')"/>
  10. </div>
  11. <div class="item-3">
  12. <sreachTitle :val="keys.type">{{$L('类型')}}</sreachTitle>
  13. <Select v-model="keys.type" :placeholder="$L('全部')">
  14. <Option value="">{{$L('全部')}}</Option>
  15. <Option value="日报">{{$L('日报')}}</Option>
  16. <Option value="周报">{{$L('周报')}}</Option>
  17. </Select>
  18. </div>
  19. <div class="item-3">
  20. <sreachTitle :val="keys.indate">{{$L('日期')}}</sreachTitle>
  21. <Date-picker v-model="keys.indate" type="daterange" placement="bottom" :placeholder="$L('日期范围')"></Date-picker>
  22. </div>
  23. </div>
  24. <div class="item item-button">
  25. <Button type="text" v-if="$A.objImplode(keys)!=''" @click="sreachTab(true)">{{$L('取消筛选')}}</Button>
  26. <Button type="primary" icon="md-search" :loading="loadIng > 0" @click="sreachTab">{{$L('搜索')}}</Button>
  27. </div>
  28. </Row>
  29. <!-- 列表 -->
  30. <Table class="tableFill" ref="tableRef" :columns="columns" :data="lists" :loading="loadIng > 0" :no-data-text="noDataText" @on-sort-change="sortChange" stripe></Table>
  31. <!-- 分页 -->
  32. <Page class="pageBox" :total="listTotal" :current="listPage" :disabled="loadIng > 0" @on-change="setPage" @on-page-size-change="setPageSize" :page-size-opts="[10,20,30,50,100]" placement="top" show-elevator show-sizer show-total transfer :simple="windowMax768"></Page>
  33. </div>
  34. </drawer-tabs-container>
  35. </template>
  36. <style lang="scss" scoped>
  37. .report-receive {
  38. margin: 0 12px;
  39. .tableFill {
  40. margin: 12px 0 20px;
  41. }
  42. }
  43. </style>
  44. <script>
  45. import DrawerTabsContainer from "../DrawerTabsContainer";
  46. /**
  47. * 收到的汇报
  48. */
  49. export default {
  50. name: 'ReportReceive',
  51. components: {DrawerTabsContainer},
  52. props: {
  53. canload: {
  54. type: Boolean,
  55. default: true
  56. },
  57. labelLists: {
  58. type: Array,
  59. },
  60. },
  61. data() {
  62. return {
  63. keys: {},
  64. sorts: {key:'', order:''},
  65. loadYet: false,
  66. loadIng: 0,
  67. columns: [],
  68. lists: [],
  69. listPage: 1,
  70. listTotal: 0,
  71. noDataText: "",
  72. }
  73. },
  74. mounted() {
  75. if (this.canload) {
  76. this.loadYet = true;
  77. this.getLists(true);
  78. }
  79. },
  80. watch: {
  81. canload(val) {
  82. if (val && !this.loadYet) {
  83. this.loadYet = true;
  84. this.getLists(true);
  85. }
  86. }
  87. },
  88. methods: {
  89. initLanguage() {
  90. this.noDataText = this.$L("数据加载中.....");
  91. this.contentText = this.$L("内容加载中.....");
  92. this.columns = [{
  93. "title": this.$L("标题"),
  94. "key": 'title',
  95. "sortable": true,
  96. "minWidth": 120,
  97. }, {
  98. "title": this.$L("发送人"),
  99. "key": 'username',
  100. "sortable": true,
  101. "minWidth": 80,
  102. "maxWidth": 130,
  103. render: (h, params) => {
  104. return h('UserView', {
  105. props: {
  106. username: params.row.username
  107. }
  108. });
  109. }
  110. }, {
  111. "title": this.$L("类型"),
  112. "key": 'type',
  113. "minWidth": 80,
  114. "maxWidth": 120,
  115. "align": 'center',
  116. }, {
  117. "title": this.$L("发送日期"),
  118. "minWidth": 160,
  119. "maxWidth": 200,
  120. "align": 'center',
  121. "sortable": true,
  122. render: (h, params) => {
  123. return h('span', params.row.senddate ? $A.formatDate("Y-m-d H:i:s", params.row.senddate) : '-');
  124. }
  125. }, {
  126. "title": " ",
  127. "key": 'action',
  128. "width": 70,
  129. "align": 'center',
  130. render: (h, params) => {
  131. return h('div', [
  132. h('Tooltip', {
  133. props: { content: this.$L('查看'), transfer: true, delay: 600 },
  134. style: { position: 'relative' },
  135. }, [h('Icon', {
  136. props: { type: 'md-eye', size: 16 },
  137. style: { margin: '0 3px', cursor: 'pointer' },
  138. on: {
  139. click: () => {
  140. this.reportDetail(params.row.id, params.row.title);
  141. }
  142. }
  143. })]),
  144. ]);
  145. }
  146. }];
  147. },
  148. sreachTab(clear) {
  149. if (clear === true) {
  150. this.keys = {};
  151. }
  152. this.getLists(true);
  153. },
  154. sortChange(info) {
  155. this.sorts = {key:info.key, order:info.order};
  156. this.getLists(true);
  157. },
  158. setPage(page) {
  159. this.listPage = page;
  160. this.getLists();
  161. },
  162. setPageSize(size) {
  163. if (Math.max($A.runNum(this.listPageSize), 10) != size) {
  164. this.listPageSize = size;
  165. this.getLists();
  166. }
  167. },
  168. getLists(resetLoad) {
  169. if (resetLoad === true) {
  170. this.listPage = 1;
  171. }
  172. let whereData = $A.date2string($A.cloneData(this.keys));
  173. whereData.page = Math.max(this.listPage, 1);
  174. whereData.pagesize = Math.max($A.runNum(this.listPageSize), 10);
  175. whereData.sorts = $A.cloneData(this.sorts);
  176. this.loadIng++;
  177. this.noDataText = this.$L("数据加载中.....");
  178. $A.apiAjax({
  179. url: 'report/receive',
  180. data: whereData,
  181. complete: () => {
  182. this.loadIng--;
  183. },
  184. error: () => {
  185. this.noDataText = this.$L("数据加载失败!");
  186. },
  187. success: (res) => {
  188. if (res.ret === 1) {
  189. this.lists = res.data.lists;
  190. this.listTotal = res.data.total;
  191. this.noDataText = this.$L("没有相关的数据");
  192. } else {
  193. this.lists = [];
  194. this.listTotal = 0;
  195. this.noDataText = res.msg;
  196. }
  197. }
  198. });
  199. },
  200. }
  201. }
  202. </script>