reportlist.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <basic-container>
  3. <el-tabs type="card" v-model="cycle" @tab-click="handleClick">
  4. <el-tab-pane label="每日報表" name="day">
  5. </el-tab-pane>
  6. <el-tab-pane label="每週報表" name="week">
  7. </el-tab-pane>
  8. <el-tab-pane label="每月報表" name="month">
  9. </el-tab-pane>
  10. </el-tabs>
  11. <avue-crud :option="option"
  12. :table-loading="loading"
  13. :data="data"
  14. ref="crud"
  15. v-model="form"
  16. :page.sync="page"
  17. :permission="permissionList"
  18. @search-change="searchChange"
  19. @search-reset="searchReset"
  20. @selection-change="selectionChange"
  21. @current-change="currentChange"
  22. @size-change="sizeChange"
  23. @refresh-change="refreshChange"
  24. @on-load="onLoad">
  25. <template slot="menuLeft">
  26. <el-button type="primary"
  27. size="small"
  28. icon="el-icon-download"
  29. plain
  30. @click="handleDownload">下載
  31. </el-button>
  32. </template>
  33. </avue-crud>
  34. <el-dialog :append-to-body="true" :modal-append-to-body="false" :visible.sync="chartVisible" title="圖表">
  35. <div v-if="chartVisible">
  36. <check-chart :cycle="cycle" :data="chartData"></check-chart>
  37. </div>
  38. </el-dialog>
  39. </basic-container>
  40. </template>
  41. <script>
  42. import {mapGetters} from "vuex";
  43. import {getDeptTree, getTree} from "@/api/system/dept";
  44. import CheckChart from "../../components/chart/check-chart";
  45. import {getReport} from "../../api/bank/home";
  46. import {dateFormat} from "../../util/date";
  47. export default {
  48. components: {CheckChart},
  49. data() {
  50. return {
  51. // dataType: 1,
  52. cycle: "day",
  53. chartData: {},
  54. chartVisible: false,
  55. form: {},
  56. query: {},
  57. loading: true,
  58. page: {
  59. pageSize: 10,
  60. currentPage: 1,
  61. total: 0
  62. },
  63. selectionList: [],
  64. option: {
  65. height:'auto',
  66. calcHeight: 30,
  67. tip: false,
  68. searchShow: true,
  69. searchMenuSpan: 6,
  70. border: true,
  71. index: true,
  72. viewBtn: true,
  73. addBtn: false,
  74. editBtn: false,
  75. delBtn: false,
  76. menu: false,
  77. selection: true,
  78. dialogClickModal: false,
  79. column: [
  80. /*{
  81. label: "銀行號",
  82. prop: "bankNo",
  83. disabled: true,
  84. search: true,
  85. searchSpan: 4,
  86. rules: [{
  87. required: true,
  88. message: "請输入銀行號",
  89. trigger: "blur"
  90. }]
  91. },*/
  92. {
  93. label: "機構號",
  94. prop: "orgNo",
  95. disabled: true,
  96. },
  97. {
  98. label: "支行",
  99. prop: "deptName",
  100. },
  101. /*{
  102. label: "区域/支行",
  103. prop: "orgNos",
  104. hide: true,
  105. display: false,
  106. searchMultiple: true,
  107. search: true,
  108. type: "tree",
  109. dicData: [],
  110. props: {
  111. label: "title",
  112. value: "key"
  113. },
  114. checkStrictly: true,
  115. rules: [{
  116. required: true,
  117. message: "請输入機構號",
  118. trigger: "blur"
  119. }]
  120. },*/
  121. {
  122. label: "需核對日期",
  123. prop: "needCheckDate",
  124. },
  125. {
  126. label: "核對日期",
  127. prop: "checkDate",
  128. },
  129. {
  130. label: "日期",
  131. prop: "dateRange",
  132. type: "date",
  133. format: "yyyy-MM-dd",
  134. valueFormat: "yyyy-MM-dd",
  135. searchRange:true,
  136. hide: true,
  137. addDisplay: false,
  138. editDisplay: false,
  139. viewDisplay: false,
  140. search: true,
  141. },
  142. {
  143. label: "週",
  144. prop: "week",
  145. type: "week",
  146. format: "yyyy 第 WW 週",
  147. hide: true,
  148. addDisplay: false,
  149. editDisplay: false,
  150. viewDisplay: false,
  151. search: false,
  152. },
  153. {
  154. label: "月",
  155. prop: "month",
  156. type: "month",
  157. hide: true,
  158. addDisplay: false,
  159. editDisplay: false,
  160. viewDisplay: false,
  161. search: false,
  162. },
  163. {
  164. label: "分類",
  165. prop: "type",
  166. type: "select",
  167. // search: true,
  168. // searchSpan: 4,
  169. searchMultiple: true,
  170. dicUrl: "/api/blade-system/dict/dictionary?code=check_category",
  171. props:{
  172. label: "dictValue",
  173. value: "dictKey",
  174. },dicFormatter: (res) => {
  175. res.data.forEach(item => {item.disabled = item.isSealed == 1;})
  176. return res.data;
  177. },
  178. rules: [{
  179. required: true,
  180. message: "請输入分類",
  181. trigger: "blur"
  182. }]
  183. },
  184. {
  185. label: "核對項目",
  186. prop: "item",
  187. type: "select",
  188. // search: true,
  189. // searchSpan: 4,
  190. searchMultiple: true,
  191. dicUrl: "/api/blade-system/dict/dictionary?code=check_item",
  192. props:{
  193. label: "dictValue",
  194. value: "dictKey",
  195. },dicFormatter: (res) => {
  196. res.data.forEach(item => {item.disabled = item.isSealed == 1;})
  197. return res.data;
  198. },
  199. rules: [{
  200. required: true,
  201. message: "請输入核對項目",
  202. trigger: "blur"
  203. }]
  204. },
  205. /*{
  206. label: "核對內容/標準",
  207. prop: "content",
  208. type: "select",
  209. dicUrl: "/api/blade-system/dict/dictionary?code=check_content_normal",
  210. props:{
  211. label: "dictValue",
  212. value: "dictKey",
  213. },
  214. rules: [{
  215. required: true,
  216. message: "請输入核對內容/標準",
  217. trigger: "blur"
  218. }]
  219. },*/
  220. {
  221. label: "已核對",
  222. prop: "checked",
  223. },
  224. {
  225. label: "未核對",
  226. prop: "nocheck",
  227. },
  228. {
  229. label: "後補核對",
  230. prop: "over",
  231. },
  232. ]
  233. },
  234. data: []
  235. };
  236. },
  237. computed: {
  238. ...mapGetters(["permission"]),
  239. ...mapGetters(["userInfo"]),
  240. permissionList() {
  241. return {
  242. addBtn: this.vaildData(this.permission.checklist_add, false),
  243. viewBtn: this.vaildData(this.permission.checklist_view, false),
  244. delBtn: this.vaildData(this.permission.checklist_delete, false),
  245. editBtn: this.vaildData(this.permission.checklist_edit, false)
  246. };
  247. },
  248. ids() {
  249. let ids = [];
  250. this.selectionList.forEach(ele => {
  251. ids.push(ele.id);
  252. });
  253. return ids.join(",");
  254. }
  255. },
  256. mounted() {
  257. },
  258. methods: {
  259. handleInit(){
  260. if (this.selectionList.length === 0) {
  261. this.$message.warning("請選擇至少一条数据");
  262. return;
  263. }
  264. let checkedCount = 0, noCheckCount = 0;
  265. for (let i = 0; i < this.selectionList.length; i++) {
  266. let item = this.selectionList[i];
  267. if (item.checked == 1){
  268. checkedCount++;
  269. }else{
  270. noCheckCount++;
  271. }
  272. }
  273. this.chartData = {checkedCount: checkedCount, noCheckCount: noCheckCount};
  274. this.chartVisible = true;
  275. },
  276. handleDownload(){
  277. if (this.selectionList.length === 0) {
  278. this.$message.warning("請選擇至少一條數據");
  279. return;
  280. }
  281. let columns = this.deepClone(this.option.column);
  282. for (let i = 0; i < columns.length; i++) {
  283. let item = columns[i];
  284. if (item.hide || item.prop == 'process'){
  285. columns.splice(i, 1);
  286. i--;
  287. }
  288. if (item.type == 'select' || item.type == 'tree'){
  289. item.prop = '$' + item.prop;
  290. }
  291. }
  292. let title = '';
  293. if (this.cycle == "day"){
  294. title = "每日核對記錄匯總";
  295. }
  296. if (this.cycle == "week"){
  297. title = "每週核對記錄匯總";
  298. }
  299. if (this.cycle == "month"){
  300. title = "每月核對記錄匯總";
  301. }
  302. this.$Export.excel({
  303. title: title || new Date().getTime(),
  304. columns: columns,
  305. data: this.selectionList
  306. });
  307. },
  308. handleInitAll(){
  309. },
  310. handleClick(tab, event) {
  311. //搜索条件重置
  312. this.query = {};
  313. this.cycle = tab.name;
  314. this.findObject(this.option.column, 'dateRange').search = tab.name == 'day';
  315. this.findObject(this.option.column, 'week').search = tab.name == 'week';
  316. this.findObject(this.option.column, 'month').search = tab.name == 'month';
  317. this.findObject(this.option.column, "needCheckDate").hide = tab.name != 'day';
  318. this.onLoad(this.page);
  319. },
  320. beforeOpen(done, type) {
  321. let arr = [];
  322. arr.push(this.form.isChecked)
  323. this.form.checked = arr;
  324. if (["edit", "view"].includes(type)) {
  325. /*if (type == "view"){
  326. this.findObject(this.option.column, "content").tip = this.form.$content;
  327. console.log(this.form)
  328. }
  329. getDetail(this.form.id).then(res => {
  330. this.form = res.data.data;
  331. if (type == "view"){
  332. this.findObject(this.option.column, "content").tip = "this.form.$content";
  333. console.log(this.form)
  334. }
  335. });*/
  336. }
  337. done();
  338. },
  339. searchReset() {
  340. this.query = {};
  341. this.onLoad(this.page);
  342. },
  343. searchChange(params, done) {
  344. if (params.dateRange){
  345. params.date_begin = params.dateRange[0], params.date_end = params.dateRange[1];
  346. params.dateRange = null;
  347. }
  348. if (params.week){
  349. params.date_begin = dateFormat(params.week, "yyyy-MM-dd");
  350. params.date_end = dateFormat(params.week, "yyyy-MM-dd");
  351. }
  352. if (params.month){
  353. params.date_begin = dateFormat(params.month, "yyyy-MM-dd");
  354. params.date_end = dateFormat(params.month, "yyyy-MM-dd");
  355. }
  356. this.query = params;
  357. this.page.currentPage = 1;
  358. this.onLoad(this.page, params);
  359. done();
  360. },
  361. selectionChange(list) {
  362. this.selectionList = list;
  363. },
  364. selectionClear() {
  365. this.selectionList = [];
  366. this.$refs.crud.toggleSelection();
  367. },
  368. currentChange(currentPage){
  369. this.page.currentPage = currentPage;
  370. },
  371. sizeChange(pageSize){
  372. this.page.pageSize = pageSize;
  373. },
  374. refreshChange() {
  375. this.onLoad(this.page, this.query);
  376. },
  377. onLoad(page, params = {}) {
  378. this.loading = true;
  379. delete this.query.cycle;
  380. params.cycle = this.cycle;
  381. getReport(Object.assign(params, this.query)).then(res => {
  382. const data = res.data.data;
  383. this.data = data;
  384. this.loading = false;
  385. this.selectionClear();
  386. });
  387. }
  388. }
  389. };
  390. </script>
  391. <style>
  392. </style>