receive.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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></Page>
  33. </div>
  34. <Modal
  35. v-model="contentShow"
  36. :title="contentTitle"
  37. width="80%"
  38. :styles="{top: '35px', paddingBottom: '35px'}"
  39. footerHide>
  40. <report-content :content="contentText"></report-content>
  41. </Modal>
  42. </drawer-tabs-container>
  43. </template>
  44. <style lang="scss" scoped>
  45. .report-receive {
  46. margin: 0 12px;
  47. .tableFill {
  48. margin: 12px 0 20px;
  49. }
  50. }
  51. </style>
  52. <script>
  53. import DrawerTabsContainer from "../DrawerTabsContainer";
  54. import ReportContent from "./content";
  55. /**
  56. * 收到的汇报
  57. */
  58. export default {
  59. name: 'ReportReceive',
  60. components: {ReportContent, DrawerTabsContainer},
  61. props: {
  62. canload: {
  63. type: Boolean,
  64. default: true
  65. },
  66. labelLists: {
  67. type: Array,
  68. },
  69. },
  70. data() {
  71. return {
  72. keys: {},
  73. sorts: {key:'', order:''},
  74. loadYet: false,
  75. loadIng: 0,
  76. columns: [],
  77. lists: [],
  78. listPage: 1,
  79. listTotal: 0,
  80. noDataText: "",
  81. contentShow: false,
  82. contentTitle: '',
  83. contentText: '',
  84. }
  85. },
  86. created() {
  87. this.noDataText = this.$L("数据加载中.....");
  88. this.contentText = this.$L("内容加载中.....");
  89. this.columns = [{
  90. "title": this.$L("标题"),
  91. "key": 'title',
  92. "sortable": true,
  93. "minWidth": 120,
  94. }, {
  95. "title": this.$L("发送人"),
  96. "key": 'username',
  97. "sortable": true,
  98. "minWidth": 80,
  99. "maxWidth": 130,
  100. }, {
  101. "title": this.$L("类型"),
  102. "key": 'type',
  103. "minWidth": 80,
  104. "maxWidth": 120,
  105. "align": 'center',
  106. }, {
  107. "title": this.$L("创建日期"),
  108. "minWidth": 160,
  109. "maxWidth": 200,
  110. "align": 'center',
  111. "sortable": true,
  112. render: (h, params) => {
  113. return h('span', $A.formatDate("Y-m-d H:i:s", params.row.indate));
  114. }
  115. }, {
  116. "title": " ",
  117. "key": 'action',
  118. "width": 70,
  119. "align": 'center',
  120. render: (h, params) => {
  121. return h('div', [
  122. h('Tooltip', {
  123. props: { content: this.$L('查看'), transfer: true, delay: 600 },
  124. style: { position: 'relative' },
  125. }, [h('Icon', {
  126. props: { type: 'md-eye', size: 16 },
  127. style: { margin: '0 3px', cursor: 'pointer' },
  128. on: {
  129. click: () => {
  130. this.contentReport(params.row);
  131. }
  132. }
  133. })]),
  134. ]);
  135. }
  136. }];
  137. },
  138. mounted() {
  139. if (this.canload) {
  140. this.loadYet = true;
  141. this.getLists(true);
  142. }
  143. },
  144. watch: {
  145. canload(val) {
  146. if (val && !this.loadYet) {
  147. this.loadYet = true;
  148. this.getLists(true);
  149. }
  150. }
  151. },
  152. methods: {
  153. sreachTab(clear) {
  154. if (clear === true) {
  155. this.keys = {};
  156. }
  157. this.getLists(true);
  158. },
  159. sortChange(info) {
  160. this.sorts = {key:info.key, order:info.order};
  161. this.getLists(true);
  162. },
  163. setPage(page) {
  164. this.listPage = page;
  165. this.getLists();
  166. },
  167. setPageSize(size) {
  168. if (Math.max($A.runNum(this.listPageSize), 10) != size) {
  169. this.listPageSize = size;
  170. this.getLists();
  171. }
  172. },
  173. getLists(resetLoad) {
  174. if (resetLoad === true) {
  175. this.listPage = 1;
  176. }
  177. let whereData = $A.date2string($A.cloneData(this.keys));
  178. whereData.page = Math.max(this.listPage, 1);
  179. whereData.pagesize = Math.max($A.runNum(this.listPageSize), 10);
  180. whereData.sorts = $A.cloneData(this.sorts);
  181. this.loadIng++;
  182. this.noDataText = this.$L("数据加载中.....");
  183. $A.aAjax({
  184. url: 'report/receive',
  185. data: whereData,
  186. complete: () => {
  187. this.loadIng--;
  188. },
  189. error: () => {
  190. this.noDataText = this.$L("数据加载失败!");
  191. },
  192. success: (res) => {
  193. if (res.ret === 1) {
  194. this.lists = res.data.lists;
  195. this.listTotal = res.data.total;
  196. this.noDataText = this.$L("没有相关的数据");
  197. } else {
  198. this.lists = [];
  199. this.listTotal = 0;
  200. this.noDataText = res.msg;
  201. }
  202. }
  203. });
  204. },
  205. contentReport(row) {
  206. this.contentShow = true;
  207. this.contentTitle = row.title;
  208. this.contentText = this.$L('详细内容加载中.....');
  209. $A.aAjax({
  210. url: 'report/content?id=' + row.id,
  211. error: () => {
  212. alert(this.$L(this.$L('网络繁忙,请稍后再试!')));
  213. this.contentShow = false;
  214. },
  215. success: (res) => {
  216. if (res.ret === 1) {
  217. this.contentText = res.data.content;
  218. } else {
  219. this.contentShow = false;
  220. this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
  221. }
  222. }
  223. });
  224. },
  225. }
  226. }
  227. </script>