index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="info" size="small" @click="outExport">导出
  10. </el-button>
  11. </template>
  12. <template slot="userNameSearch">
  13. <user-select v-model="search.userName" :configuration="UConfiguration">
  14. </user-select>
  15. </template>
  16. <template slot="businesDateSearch">
  17. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  18. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  19. </el-date-picker>
  20. </template>
  21. </avue-crud>
  22. </basic-container>
  23. </div>
  24. </template>
  25. <script>
  26. import { getToken } from "@/util/auth";
  27. import { getList } from "@/api/statisticAnalysis/taskStatistics"
  28. export default {
  29. name: "index",
  30. data() {
  31. return {
  32. UConfiguration: {
  33. multipleChoices: false,
  34. multiple: false,
  35. disabled: false,
  36. searchShow: true,
  37. collapseTags: false,
  38. placeholder: '请点击右边按钮选择',
  39. dicData: []
  40. },
  41. form: {},
  42. search: {},
  43. dataList: [],
  44. loading: false,
  45. detailData: {},
  46. page: {
  47. pageSize: 20,
  48. currentPage: 1,
  49. total: 0,
  50. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  51. },
  52. option: {},
  53. optionBack: {
  54. searchShow: true,
  55. searchMenuPosition: "right",
  56. searchSpan: 8,
  57. searchMenuSpan: 24,
  58. border: true,
  59. index: true,
  60. addBtn: false,
  61. viewBtn: false,
  62. editBtn: false,
  63. delBtn: false,
  64. searchIcon: true,
  65. menu: false,
  66. column: [
  67. {
  68. label: "承做人",
  69. prop: "userName",
  70. overHidden: true,
  71. search: true
  72. },
  73. {
  74. label: "业务日期",
  75. prop: "beginTime",
  76. type: "date",
  77. format: 'yyyy-MM-dd',
  78. valueFormat: 'yyyy-MM-dd',
  79. searchRange: true,
  80. overHidden: true,
  81. search: true,
  82. },
  83. {
  84. label: "客户名称",
  85. prop: "cornName",
  86. overHidden: true,
  87. },
  88. {
  89. label: "任务名称",
  90. prop: "pname",
  91. overHidden: true,
  92. },
  93. {
  94. label: "状态",
  95. prop: "taskStatus",
  96. search: true,
  97. type: "select",
  98. overHidden: true,
  99. dataType: 'number',
  100. dicData: [],
  101. props: {
  102. label: "dictValue",
  103. value: "dictKey"
  104. }
  105. }
  106. ]
  107. }
  108. };
  109. },
  110. async created() {
  111. this.option = await this.getColumnData(this.getColumnName(183), this.optionBack);
  112. this.getWorkDicts("task_status").then(res => {
  113. this.findObject(this.option.column, "taskStatus").dicData =
  114. res.data.data;
  115. });
  116. },
  117. methods: {
  118. cellStyle() {
  119. return "padding:0;height:40px;";
  120. },
  121. searchCriteriaSwitch(type) {
  122. if (type) {
  123. this.option.height = this.option.height - 46;
  124. } else {
  125. this.option.height = this.option.height + 46;
  126. }
  127. this.$refs.crud.getTableHeight();
  128. },
  129. //点击搜索按钮触发
  130. searchChange(params, done) {
  131. this.page.currentPage = 1;
  132. this.onLoad(this.page, params);
  133. done();
  134. },
  135. refreshChange() {
  136. this.onLoad(this.page, this.search);
  137. },
  138. currentChange(val) {
  139. this.page.currentPage = val;
  140. },
  141. sizeChange(val) {
  142. this.page.currentPage = 1;
  143. this.page.pageSize = val;
  144. },
  145. onLoad(page, params = {}) {
  146. let data = this.deepClone(Object.assign({}, params, this.search));
  147. if (data.beginTime) {
  148. data.beginTimeStart = data.beginTime[0]
  149. data.beginTimeEnd = data.beginTime[1]
  150. delete data.beginTime
  151. }
  152. data.branch = "Y"
  153. this.loading = true;
  154. getList(
  155. page.currentPage,
  156. page.pageSize,
  157. Object.assign(data)
  158. ).then(res => {
  159. if (res.data.data.records) {
  160. res.data.data.records.forEach(e => {
  161. e.itemLoading = true;
  162. });
  163. }
  164. this.dataList = res.data.data.records ? res.data.data.records : [];
  165. this.page.total = res.data.data.total;
  166. if (this.page.total) {
  167. this.option.height = window.innerHeight - 210;
  168. }
  169. }).finally(() => {
  170. this.loading = false;
  171. });
  172. },
  173. //列保存触发
  174. async saveColumn() {
  175. const inSave = await this.saveColumnData(this.getColumnName(183), this.option);
  176. if (inSave) {
  177. this.$message.success("保存成功");
  178. //关闭窗口
  179. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  180. }
  181. },
  182. async resetColumn() {
  183. this.option = this.optionBack;
  184. const inSave = await this.delColumnData(this.getColumnName(183), this.optionBack);
  185. if (inSave) {
  186. this.$message.success("重置成功");
  187. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  188. }
  189. },
  190. editOpen(row) {
  191. },
  192. outExport() {
  193. let queryParams = this.search
  194. if (queryParams.beginTime) {
  195. queryParams.beginTimeStart = queryParams.beginTime[0]
  196. queryParams.beginTimeEnd = queryParams.beginTime[1]
  197. delete queryParams.beginTime
  198. }
  199. const routeData = this.$router.resolve({
  200. path: '/api/trade-project/project/statisticsExport', //跳转目标窗口的地址
  201. query: {
  202. "Blade-Auth": getToken(),
  203. type: "RW",
  204. branch: "Y",
  205. ...queryParams //括号内是要传递给新窗口的参数
  206. }
  207. })
  208. window.open(routeData.href.slice(1, routeData.href.length - 1));
  209. }
  210. }
  211. };
  212. </script>
  213. <style scoped>
  214. .page-crad ::v-deep .basic-container__card {
  215. height: 94.2vh;
  216. }
  217. ::v-deep .el-table__expanded-cell[class*="cell"] {
  218. padding: 0px;
  219. }
  220. .itemTable ::v-deep .el-table {
  221. width: 100%;
  222. }
  223. </style>