reply.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div>
  3. <div class="simple-container">
  4. <simple-form
  5. :form="table_form"
  6. :handle="table_handle"
  7. @search="handleSearch"
  8. @download="handleDownload"
  9. ></simple-form>
  10. <simple-table
  11. :list="table_list"
  12. :config="table_config"
  13. :loading="table_loading"
  14. :handle-row="table_handle_row"
  15. ></simple-table>
  16. <!-- <simple-pagination
  17. :page="page"
  18. :total="total"
  19. @change="handleChange"
  20. ></simple-pagination> -->
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import simpleForm from "./components/form.vue";
  26. import simpleTable from "./components/table.vue";
  27. // import simplePagination from "./components/pagination.vue";
  28. export default {
  29. components: {
  30. simpleTable,
  31. simpleForm,
  32. // simplePagination,
  33. },
  34. data() {
  35. return {
  36. page: 1,
  37. rows: 10,
  38. total: 0,
  39. table_loading: false,
  40. table_search: {},
  41. table_form: [
  42. {
  43. label: "统计月份",
  44. props: "time",
  45. type: "month",
  46. },
  47. // {
  48. // label: "绩效类型",
  49. // props: "performance_type",
  50. // type: "select",
  51. // dictionary: [
  52. // {
  53. // label: "部门绩效",
  54. // value: "部门绩效",
  55. // },
  56. // {
  57. // label: "员工绩效",
  58. // value: "员工绩效",
  59. // },
  60. // ],
  61. // },
  62. // {
  63. // label: "绩效分类",
  64. // props: "performance_class",
  65. // type: "select",
  66. // dictionary: [
  67. // {
  68. // label: "GS",
  69. // value: "GS",
  70. // },
  71. // {
  72. // label: "KPI",
  73. // value: "KPI",
  74. // },
  75. // ],
  76. // },
  77. ],
  78. table_list: [],
  79. table_handle: [
  80. {
  81. label: "导出",
  82. props: "download",
  83. },
  84. ],
  85. table_handle_row: [],
  86. table_config: [
  87. {
  88. label: "科室名称",
  89. props: "dept",
  90. },
  91. {
  92. label: "科室经理",
  93. props: "loginName",
  94. },
  95. {
  96. label: "待办接收数",
  97. props: "number",
  98. },
  99. {
  100. label: "完成回复率",
  101. props: "percentageReply",
  102. },
  103. {
  104. label: "超期率",
  105. props: "percentageTimeOut",
  106. },
  107. {
  108. label: "累计超期时间",
  109. props: "day",
  110. },
  111. ],
  112. };
  113. },
  114. methods: {
  115. handleInit(data) {
  116. this.table_loading = true;
  117. this.$http({
  118. url: "/market/CMKIssued/CMKIssuedReplyStatistics",
  119. method: "post",
  120. headers: {
  121. "Content-Type": "application/json",
  122. },
  123. data: data,
  124. }).then(({ data }) => {
  125. // console.log(res,'data');
  126. // this.total = count;
  127. this.table_list = data;
  128. this.table_loading = false;
  129. });
  130. // const data = [];
  131. // let index = 0;
  132. // while (index < 10) {
  133. // data.push({
  134. // department_name: `科室${index}`,
  135. // department_manager: `经理${index}`,
  136. // received_umber: `${index}`,
  137. // response_rate: `${index + 1}0`,
  138. // overdue_rate: `50%`,
  139. // cumulative_overtime: `3`,
  140. // });
  141. // index = index + 1;
  142. // }
  143. },
  144. handleDownload() {
  145. this.$http({
  146. url: "/market/CMKIssued/exportCMKIssuedReplyStatistics",
  147. method: "post",
  148. headers: {
  149. "Content-Type": "application/json",
  150. },
  151. responseType: "blob",
  152. data: {
  153. ...this.table_search,
  154. time: this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY-MM") : '',
  155. },
  156. }).then((response) => {
  157. if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  158. let blob = new Blob([response.data], {
  159. type: "application/vnd.ms-excel",
  160. });
  161. let month = this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY年MM月") : ''
  162. window.navigator.msSaveOrOpenBlob(
  163. blob,`${month}回复统计.xlsx`
  164. );
  165. } else {
  166. /* 火狐谷歌的文件下载方式 */
  167. var blob = new Blob([response.data]);
  168. var downloadElement = document.createElement("a");
  169. var href = window.URL.createObjectURL(blob);
  170. downloadElement.href = href;
  171. let month = this.table_search.time ? this.$formatDate(this.table_search.time, "YYYY年MM月") : ''
  172. downloadElement.download = `${month}回复统计.xlsx`;
  173. document.body.appendChild(downloadElement);
  174. downloadElement.click();
  175. document.body.removeChild(downloadElement);
  176. window.URL.revokeObjectURL(href);
  177. }
  178. });
  179. // this.$http({
  180. // url: "/CMKIssued/exportCMKIssuedReplyStatistics",
  181. // method: "post",
  182. // headers: {
  183. // "Content-Type": "application/json",
  184. // },
  185. // data: {
  186. // ...this.table_search,
  187. // time: this.table_search.time ? this.table_search.time : "",
  188. // },
  189. // responseType: "blob", // 解决下载的文件乱码空白等问题
  190. // }).then(({ data }) => {
  191. // console.log(data,'data');
  192. // let url = window.URL.createObjectURL(new Blob([data]));
  193. // let a = document.createElement("a");
  194. // a.setAttribute("href", url);
  195. // // a.setAttribute('download', scope.row.fileName)
  196. // a.click();
  197. // });
  198. console.log("我下载了");
  199. },
  200. handleSearch(data) {
  201. let obj = {
  202. ...data,
  203. time: data.time
  204. ? this.$formatDate(data.time, "YYYY-MM")
  205. : "",
  206. };
  207. console.log(obj,'obj');
  208. this.table_search = data;
  209. this.handleReset();
  210. this.handleInit({ ...obj });
  211. },
  212. handleChange(page) {
  213. this.page = page;
  214. this.handleInit({ ...this.table_search });
  215. },
  216. handleReset() {
  217. this.page = 1;
  218. },
  219. },
  220. mounted() {
  221. this.handleInit({ time: "" });
  222. },
  223. };
  224. </script>
  225. <style></style>