index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. :table-loading="loading"
  10. :span-method="spanMethod"
  11. :cell-style="cellStyle"
  12. @search-change="searchChange"
  13. @search-reset="searchReset"
  14. @selection-change="selectionChange"
  15. @current-change="currentChange"
  16. @size-change="sizeChange"
  17. @refresh-change="refreshChange"
  18. @saveColumn="saveColumn"
  19. @resetColumn="resetColumn"
  20. @on-load="onLoad">
  21. <template slot="yearSearch">
  22. <el-date-picker
  23. v-model="search.year"
  24. type="year"
  25. placeholder="">
  26. </el-date-picker>
  27. </template>
  28. <template slot="userIdSearch">
  29. <user-com
  30. v-model="search.userId"
  31. style="width: 100%"
  32. ></user-com>
  33. </template>
  34. <template slot="goodsNameSearch">
  35. <goods-select
  36. v-model="search.goodsName"
  37. @valueName="(value) => valueName(value)"
  38. :configuration="configuration"
  39. >
  40. </goods-select>
  41. </template>
  42. <template slot="menuLeft">
  43. <el-button size="small"
  44. type="primary"
  45. @click.stop="statement"
  46. >报表打印
  47. </el-button>
  48. </template>
  49. </avue-crud>
  50. <report-dialog
  51. :switchDialog="switchDialog"
  52. :searchValue="statementData"
  53. :reportName="'进口贸易-提成统计表'"
  54. @onClose="onClose()"
  55. ></report-dialog>
  56. </basic-container>
  57. </template>
  58. <script>
  59. import option from "./config/mainList.json";
  60. import { getCommission } from "@/api/statisticAnalysis/profit";
  61. import { contrastList } from "@/util/contrastData";
  62. import reportDialog from "@/components/report-dialog/main";
  63. export default {
  64. data() {
  65. return {
  66. loading : false,
  67. form: {},
  68. search:{},
  69. show:true,
  70. detailData:{},
  71. option: option,
  72. spanArr:[],
  73. position:0,
  74. parentId:0,
  75. dataList: [],
  76. statementData:[],
  77. switchDialog:false,
  78. page: {
  79. pageSize: 10,
  80. pagerCount: 5,
  81. total: 0,
  82. },
  83. query:{},
  84. configuration:{
  85. multipleChoices:false,
  86. multiple:false,
  87. disabled:false,
  88. searchShow:true,
  89. collapseTags:false,
  90. clearable:true,
  91. placeholder:'请点击右边按钮选择',
  92. dicData:[]
  93. },
  94. }
  95. },
  96. components:{
  97. reportDialog
  98. },
  99. async created() {
  100. // this.option = await this.getColumnData(this.getColumnName(66), option);
  101. },
  102. mounted() {
  103. },
  104. methods: {
  105. valueName(value){
  106. this.search.goodsId = value.id
  107. },
  108. addReceipt(){
  109. console.log('1')
  110. },
  111. editOpen(){
  112. console.log('1')
  113. },
  114. // rowspan() {
  115. // //记录原始
  116. // let oldList = [this.dataList[0].userName]
  117. // this.dataList.forEach((item,index)=>{
  118. // let newList = [item.userName]
  119. // if(index===0){
  120. // this.spanArr.push(1)
  121. // this.position=0;
  122. // }else{
  123. // //如果循环数据与原始数据相等 那么合并
  124. // if(!contrastList(oldList,newList)){
  125. // this.spanArr[this.position] +=1;
  126. // this.spanArr.push(0)
  127. // }else{
  128. // //如果不等 更新原始数据 循环在比较
  129. // oldList = newList
  130. // this.spanArr.push(1)
  131. // this.position = index
  132. // }
  133. // }
  134. // })
  135. // },
  136. // spanMethod({ row, column, rowIndex, columnIndex }) {
  137. // if (column.property === "userName") {
  138. // const _row=this.spanArr[rowIndex];
  139. // const _col=_row>0?1:0;
  140. // return {
  141. // rowspan:_row,
  142. // colspan:_col
  143. // }
  144. // }
  145. // },
  146. //点击搜索按钮触发
  147. searchChange(params, done) {
  148. this.query = params;
  149. this.page.currentPage = 1;
  150. this.onLoad(this.page, params);
  151. done()
  152. },
  153. searchReset() {
  154. console.log('1')
  155. },
  156. selectionChange() {
  157. console.log('1')
  158. },
  159. currentChange(val) {
  160. this.page.currentPage = val
  161. },
  162. sizeChange() {
  163. console.log('1')
  164. },
  165. refreshChange() {
  166. this.onLoad(this.page);
  167. },
  168. statement(){
  169. this.statementData = this.paramsAdjustment(this.search)
  170. this.switchDialog =! this.switchDialog;
  171. },
  172. onClose(val) {
  173. this.switchDialog = val;
  174. },
  175. paramsAdjustment(params) {
  176. params = Object.assign({}, this.search);
  177. if(params.year && params.year !== '2022'){
  178. params.year = params.year.getFullYear()
  179. }
  180. return params
  181. },
  182. onLoad(page, params) {
  183. params = this.paramsAdjustment(params)
  184. if(!params.goodsId){
  185. this.$message.warning("请先选择商品!")
  186. return
  187. }
  188. if(!params.userType){
  189. this.$message.warning("请先选择提成类型!")
  190. return
  191. }
  192. if(!params.quarter){
  193. this.$message.warning("请先选择季度!")
  194. return
  195. }
  196. if(!params.year){
  197. this.$message.warning("请先选择年份!")
  198. return
  199. }
  200. this.loading = true;
  201. getCommission(page.currentPage, page.pageSize,params).then(res=>{
  202. this.dataList = res.data.data
  203. if (res.data.data) {
  204. this.option.height = window.innerHeight - 240;
  205. }
  206. // this.rowspan()
  207. }).finally(()=>{
  208. this.loading = false;
  209. })
  210. },
  211. cellStyle() {
  212. return "padding:0;height:40px;";
  213. },
  214. //列保存触发
  215. async saveColumn() {
  216. const inSave = await this.saveColumnData(
  217. this.getColumnName(66),
  218. this.option
  219. );
  220. if (inSave) {
  221. this.$message.success("保存成功");
  222. //关闭窗口
  223. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  224. }
  225. },
  226. async resetColumn() {
  227. const inSave = await this.delColumnData(
  228. this.getColumnName(66),
  229. option
  230. );
  231. if (inSave) {
  232. this.$message.success("重置成功");
  233. this.option = option;
  234. //关闭窗口
  235. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  236. }
  237. },
  238. }
  239. }
  240. </script>
  241. <style scoped>
  242. </style>