detailPageTwo.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div v-if="key>0">
  3. <avue-crud ref="crud"
  4. :key="key"
  5. :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  6. :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange"
  7. @size-change="sizeChange"
  8. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  9. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
  10. <template slot="menuLeft">
  11. <el-button type="info" size="small" @click="outExport">导出
  12. </el-button>
  13. </template>
  14. <template slot="corpNameSearch" slot-scope="scope">
  15. <crop-select v-model="search.corpId" corpType="KH"/>
  16. </template>
  17. </avue-crud>
  18. </div>
  19. </template>
  20. <script>
  21. import {getToken} from "@/util/auth";
  22. import {getListThree} from "@/api/statisticAnalysis/analysisOfCoping"
  23. export default {
  24. name: "index",
  25. data() {
  26. return {
  27. UConfiguration: {
  28. multipleChoices: false,
  29. multiple: false,
  30. disabled: false,
  31. searchShow: true,
  32. collapseTags: false,
  33. placeholder: '请点击右边按钮选择',
  34. dicData: []
  35. },
  36. form: {},
  37. search: {},
  38. dataList: [],
  39. loading: false,
  40. detailData: {},
  41. page: {
  42. pageSize: 20,
  43. currentPage: 1,
  44. total: 0,
  45. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  46. },
  47. option: {},
  48. key:0,
  49. optionBack: {
  50. searchShow: false,
  51. searchShowBtn: false,
  52. align: "center",
  53. searchMenuPosition: "right",
  54. searchSpan: 8,
  55. searchMenuSpan: 8,
  56. searchLabelWidth: 100,
  57. border: true,
  58. index: true,
  59. addBtn: false,
  60. viewBtn: false,
  61. editBtn: false,
  62. delBtn: false,
  63. highlightCurrentRow: true,
  64. menu: false,
  65. height: "auto",
  66. summaryText: "合计",
  67. showSummary: true,
  68. sumColumnList: [{
  69. name: "storageQuantity",
  70. type: "sum",
  71. decimals: 0
  72. },{
  73. name: "price",
  74. type: "sum",
  75. decimals: 2
  76. },{
  77. name: "storageQuantity",
  78. type: "sum",
  79. decimals: 2
  80. }],
  81. column: [{
  82. label: "系统号",
  83. prop: "orderNo"
  84. }, {
  85. label: "客户名称",
  86. prop: "corpsName"
  87. }, {
  88. label: "业务日期",
  89. prop: "businesDate",
  90. width: 100,
  91. overHidden: true,
  92. type: "date",
  93. searchRange: true,
  94. searchDefaultTime: ["00:00:00", "23:59:59"],
  95. format: "yyyy-MM-dd",
  96. valueFormat: "yyyy-MM-dd HH:mm:ss"
  97. }, {
  98. label: "数量",
  99. prop: "storageQuantity"
  100. }, {
  101. label: "金额",
  102. prop: "debitAmount"
  103. }]
  104. }
  105. };
  106. },
  107. props:{
  108. condition:Object
  109. },
  110. async created() {
  111. this.search = this.condition
  112. this.option = await this.getColumnData(this.getColumnName(244.2), this.optionBack);
  113. this.key++
  114. },
  115. methods: {
  116. cellStyle() {
  117. return "padding:0;height:40px;";
  118. },
  119. searchCriteriaSwitch(type) {
  120. if (type) {
  121. this.option.height = this.option.height - 46;
  122. } else {
  123. this.option.height = this.option.height + 46;
  124. }
  125. this.$refs.crud.getTableHeight();
  126. },
  127. //点击搜索按钮触发
  128. searchChange(params, done) {
  129. this.page.currentPage = 1;
  130. this.onLoad(this.page, params);
  131. done();
  132. },
  133. refreshChange() {
  134. this.onLoad(this.page, this.search);
  135. },
  136. currentChange(val) {
  137. this.page.currentPage = val;
  138. },
  139. sizeChange(val) {
  140. this.page.currentPage = 1;
  141. this.page.pageSize = val;
  142. },
  143. onLoad(page, params = {}) {
  144. let data = this.deepClone(Object.assign({}, params, this.search));
  145. this.loading = true;
  146. getListThree(
  147. page.currentPage,
  148. page.pageSize,
  149. Object.assign(data)
  150. ).then(res => {
  151. this.dataList = res.data.data.records ? res.data.data.records : [];
  152. this.page.total = res.data.data.total;
  153. }).finally(() => {
  154. this.loading = false;
  155. });
  156. },
  157. //列保存触发
  158. async saveColumn() {
  159. const inSave = await this.saveColumnData(this.getColumnName(244.2), this.option);
  160. if (inSave) {
  161. this.$message.success("保存成功");
  162. //关闭窗口
  163. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  164. }
  165. },
  166. async resetColumn() {
  167. this.option = this.optionBack;
  168. const inSave = await this.delColumnData(this.getColumnName(244.2), this.optionBack);
  169. if (inSave) {
  170. this.$message.success("重置成功");
  171. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  172. }
  173. },
  174. outExport() {
  175. let config = {params: {...this.search,billType:'XS',tradeType:'YPJ'}}
  176. if (config.params) {
  177. for (const propName of Object.keys(config.params)) {
  178. const value = config.params[propName];
  179. if (value !== null && typeof (value) !== "undefined") {
  180. if (value instanceof Array) {
  181. for (const key of Object.keys(value)) {
  182. let params = propName + '[' + key + ']';
  183. config.params[params] = value[key]
  184. }
  185. delete config.params[propName]
  186. }
  187. }
  188. }
  189. }
  190. const routeData = this.$router.resolve({
  191. path: '/api/blade-purchase-sales/appParts/detailsListExport', //跳转目标窗口的地址
  192. query: {
  193. ...config.params //括号内是要传递给新窗口的参数
  194. }
  195. })
  196. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  197. }
  198. }
  199. };
  200. </script>
  201. <style scoped>
  202. .page-crad ::v-deep .basic-container__card {
  203. height: 94.2vh;
  204. }
  205. ::v-deep .el-dialog {
  206. margin: 0 auto;
  207. }
  208. ::v-deep .el-dialog__body {
  209. padding: 20px 20px;
  210. }
  211. ::v-deep .el-table__expanded-cell[class*="cell"] {
  212. padding: 0px;
  213. }
  214. .itemTable ::v-deep .el-table {
  215. width: 100%;
  216. }
  217. </style>