index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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" icon="el-icon-printer" size="small" :loading="exportLoading" @click.stop="statement">
  10. 报表打印
  11. </el-button> -->
  12. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  13. </template>
  14. <template slot="brandSearch">
  15. <el-select v-model="search.brand" filterable clearable placeholder="请选择 品牌">
  16. <el-option v-for="(item, index) in brandOption" :key="index" :label="item.dictValue"
  17. :value="item.dictValue" />
  18. </el-select>
  19. </template>
  20. <template slot="chargeMemberSearch">
  21. <el-select v-model="search.chargeMember" filterable clearable placeholder="请选择 业务员">
  22. <el-option v-for="(item, index) in userList" :key="index" :label="item.realName" :value="item.realName">
  23. </el-option>
  24. </el-select>
  25. </template>
  26. </avue-crud>
  27. </basic-container>
  28. <report-dialog :switchDialog="switchDialog" :searchValue="statementData" :reportName="'统计分析-销售人员提成'"
  29. @onClose="onClose()" />
  30. </div>
  31. </template>
  32. <script>
  33. import { getToken } from "@/util/auth";
  34. import { getList } from "@/api/statisticAnalysis/salesCommission";
  35. import { micrometerFormat } from "@/util/validate";
  36. import _ from "lodash";
  37. import reportDialog from "@/components/report-dialog/main";
  38. import { gainUser } from "@/api/basicData/customerInquiry";
  39. export default {
  40. name: "index",
  41. components: {
  42. reportDialog
  43. },
  44. data() {
  45. return {
  46. exportLoading: false,
  47. switchDialog: false,
  48. statementData: {},
  49. form: {},
  50. search: {},
  51. dataList: [],
  52. loading: false,
  53. detailData: {},
  54. page: {
  55. pageSize: 20,
  56. currentPage: 1,
  57. total: 0,
  58. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  59. },
  60. option: {},
  61. defaultOption: {
  62. searchShow: true,
  63. align: "center",
  64. searchSpan: 8,
  65. border: true,
  66. index: true,
  67. addBtn: false,
  68. viewBtn: false,
  69. editBtn: false,
  70. delBtn: false,
  71. showSummary: true,
  72. searchIcon: true,
  73. searchIndex: 2,
  74. menu: false,
  75. summaryText: "合计",
  76. sumColumnList: [{
  77. name: "quantity",
  78. type: "sum",
  79. decimals: 0
  80. }],
  81. column: [
  82. {
  83. label: "品牌",
  84. prop: "brand",
  85. search: true,
  86. overHidden: true,
  87. },
  88. {
  89. label: "业务员",
  90. prop: "salesName",
  91. search: true,
  92. overHidden: true,
  93. },
  94. {
  95. label: "制单日期",
  96. prop: "careteTime",
  97. search: true,
  98. type: 'date',
  99. format: "yyyy-MM-dd",
  100. valueFormat: "yyyy-MM-dd",
  101. unlinkPanels: true,
  102. searchRange: true,
  103. overHidden: true,
  104. },
  105. {
  106. label: "尺寸",
  107. prop: "specs",
  108. search: false,
  109. overHidden: true,
  110. },
  111. {
  112. label: "数量",
  113. prop: "quantity",
  114. search: false,
  115. overHidden: true,
  116. },
  117. {
  118. label: "政策",
  119. prop: "priceType",
  120. search: false,
  121. overHidden: true,
  122. },
  123. ],
  124. },
  125. // 仓库配置
  126. configurationWarehouse: {
  127. multipleChoices: false,
  128. multiple: false,
  129. collapseTags: false,
  130. placeholder: "请点击右边按钮选择",
  131. dicData: [],
  132. },
  133. brandOption: [],
  134. userList: [],
  135. };
  136. },
  137. filters: {
  138. decimalFormat(num) {
  139. return num ? Number(num).toFixed(2) : "0.00";
  140. }
  141. },
  142. async created() {
  143. this.option = await this.getColumnData(this.getColumnName(130), this.defaultOption);
  144. this.getWorkDicts('brand').then(res => {
  145. this.brandOption = res.data.data;
  146. })
  147. gainUser().then(res => {
  148. this.userList = res.data.data;
  149. });
  150. let i = 0;
  151. this.option.column.forEach(item => {
  152. if (item.search) i++
  153. })
  154. if (i % 3 !== 0) {
  155. const num = 3 - Number(i % 3)
  156. this.option.searchMenuSpan = num * 8;
  157. this.option.searchMenuPosition = "right";
  158. }
  159. },
  160. methods: {
  161. cellStyle() {
  162. return "padding:0;height:40px;";
  163. },
  164. outExport() {
  165. let params = { ...this.search }
  166. if (!params.brand) this.$set(params, 'brand', '');
  167. if (!params.salesName) this.$set(params, 'salesName', '');
  168. if (params.careteTime && params.careteTime.length > 0) {
  169. params = {
  170. ...params,
  171. beginCreateTime: params.careteTime[0] + ' 00:00:00',
  172. endCreateTime: params.careteTime[1] + ' 23:59:59',
  173. }
  174. } else {
  175. params = {
  176. ...params,
  177. beginCreateTime: '',
  178. endCreateTime: '',
  179. }
  180. }
  181. this.$confirm('是否导出数据明细?', '提示', {
  182. confirmButtonText: '确定',
  183. cancelButtonText: '取消',
  184. type: 'warning'
  185. }).then(() => {
  186. window.open(
  187. `/api/blade-purchase-sales/exportOrder/salesCommissionExport?${this.website.tokenHeader
  188. }=${getToken()}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}&salesName=${params.salesName}`
  189. );
  190. }).catch(() => {
  191. this.$message({
  192. type: 'info',
  193. message: '已取消' //
  194. });
  195. })
  196. },
  197. searchCriteriaSwitch(type) {
  198. if (type) {
  199. this.option.height = this.option.height - 46;
  200. } else {
  201. this.option.height = this.option.height + 46;
  202. }
  203. this.$refs.crud.getTableHeight();
  204. },
  205. //点击搜索按钮触发
  206. searchChange(params, done) {
  207. this.page.currentPage = 1;
  208. this.onLoad(this.page, params);
  209. done();
  210. },
  211. refreshChange() {
  212. delete this.search.corpName;
  213. delete this.search.storageName
  214. this.onLoad(this.page, this.search);
  215. },
  216. currentChange(val) {
  217. this.page.currentPage = val;
  218. },
  219. sizeChange(val) {
  220. this.page.currentPage = 1;
  221. this.page.pageSize = val;
  222. },
  223. onLoad(page, params) {
  224. if (this.search.careteTime && this.search.careteTime.length > 0) {
  225. params = {
  226. ...params,
  227. beginCreateTime: this.search.careteTime[0] + ' 00:00:00',
  228. endCreateTime: this.search.careteTime[1] + ' 23:59:59'
  229. };
  230. }
  231. let queryParams = this.deepClone(Object.assign({}, params, this.search));
  232. delete queryParams.careteTime;
  233. this.loading = true;
  234. getList(
  235. page.currentPage,
  236. page.pageSize,
  237. queryParams
  238. )
  239. .then(res => {
  240. this.dataList = res.data.data.records ? res.data.data.records : [];
  241. this.page.total = res.data.data.total;
  242. if (this.page.total) {
  243. this.option.height = window.innerHeight - 210;
  244. }
  245. })
  246. .finally(() => {
  247. this.loading = false;
  248. });
  249. },
  250. editOpen(row) {
  251. if (row.billType == "BJ") {
  252. this.$router.push({
  253. path: "/exportTrade/customerInquiry/index",
  254. query: {
  255. id: row.id
  256. }
  257. });
  258. } else {
  259. this.$router.push({
  260. path: "/exportTrade/salesContract/index",
  261. query: {
  262. id: row.id
  263. }
  264. });
  265. }
  266. },
  267. statement() {
  268. this.statementData = { ...this.search };
  269. if (this.statementData.createTime && this.statementData.createTime.length > 0) {
  270. this.statementData.createStartTime = this.statementData.createTime[0] + " " + "00:00:00"
  271. this.statementData.createEndTime = this.statementData.createTime[1] + " " + "23:59:59"
  272. delete this.statementData.createTime
  273. }
  274. this.switchDialog = !this.switchDialog;
  275. },
  276. onClose(val) {
  277. this.switchDialog = val;
  278. },
  279. //列保存触发
  280. async saveColumn() {
  281. const inSave = await this.saveColumnData(
  282. this.getColumnName(130),
  283. this.option
  284. );
  285. if (inSave) {
  286. this.$nextTick(() => {
  287. this.$refs.crud.doLayout();
  288. });
  289. this.$message.success("保存成功");
  290. //关闭窗口
  291. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  292. }
  293. },
  294. async resetColumn() {
  295. this.option = this.defaultOption;
  296. const inSave = await this.delColumnData(this.getColumnName(130), this.defaultOption);
  297. if (inSave) {
  298. this.$nextTick(() => {
  299. this.$refs.crud.doLayout()
  300. })
  301. this.$message.success("重置成功");
  302. //关闭窗口
  303. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  304. }
  305. },
  306. }
  307. };
  308. </script>
  309. <style scoped>
  310. .page-crad ::v-deep .basic-container__card {
  311. height: 94.2vh;
  312. }
  313. ::v-deep .el-table__expanded-cell[class*="cell"] {
  314. padding: 0px;
  315. }
  316. .itemTable ::v-deep .el-table {
  317. width: 100%;
  318. }
  319. </style>