index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. column: [
  76. {
  77. label: "品牌",
  78. prop: "brand",
  79. search: true,
  80. overHidden: true,
  81. },
  82. {
  83. label: "业务员",
  84. prop: "salesName",
  85. search: true,
  86. overHidden: true,
  87. },
  88. {
  89. label: "制单日期",
  90. prop: "careteTime",
  91. search: true,
  92. type: 'date',
  93. format: "yyyy-MM-dd",
  94. valueFormat: "yyyy-MM-dd",
  95. unlinkPanels: true,
  96. searchRange: true,
  97. overHidden: true,
  98. },
  99. {
  100. label: "尺寸",
  101. prop: "specs",
  102. search: false,
  103. overHidden: true,
  104. },
  105. {
  106. label: "数量",
  107. prop: "quantity",
  108. search: false,
  109. overHidden: true,
  110. },
  111. ],
  112. },
  113. // 仓库配置
  114. configurationWarehouse: {
  115. multipleChoices: false,
  116. multiple: false,
  117. collapseTags: false,
  118. placeholder: "请点击右边按钮选择",
  119. dicData: [],
  120. },
  121. brandOption: [],
  122. userList: [],
  123. };
  124. },
  125. filters: {
  126. decimalFormat(num) {
  127. return num ? Number(num).toFixed(2) : "0.00";
  128. }
  129. },
  130. async created() {
  131. this.option = await this.getColumnData(this.getColumnName(130), this.defaultOption);
  132. this.getWorkDicts('brand').then(res => {
  133. this.brandOption = res.data.data;
  134. })
  135. gainUser().then(res => {
  136. this.userList = res.data.data;
  137. });
  138. let i = 0;
  139. this.option.column.forEach(item => {
  140. if (item.search) i++
  141. })
  142. if (i % 3 !== 0) {
  143. const num = 3 - Number(i % 3)
  144. this.option.searchMenuSpan = num * 8;
  145. this.option.searchMenuPosition = "right";
  146. }
  147. },
  148. methods: {
  149. cellStyle() {
  150. return "padding:0;height:40px;";
  151. },
  152. outExport() {
  153. let params = { ...this.search }
  154. if (!params.brand) this.$set(params, 'brand', '');
  155. if (!params.salesName) this.$set(params, 'salesName', '');
  156. if (params.careteTime && params.careteTime.length > 0) {
  157. params = {
  158. ...params,
  159. beginCreateTime: params.careteTime[0] + ' 00:00:00',
  160. endCreateTime: params.careteTime[1] + ' 23:59:59',
  161. }
  162. } else {
  163. params = {
  164. ...params,
  165. beginCreateTime: '',
  166. endCreateTime: '',
  167. }
  168. }
  169. this.$confirm('是否导出数据明细?', '提示', {
  170. confirmButtonText: '确定',
  171. cancelButtonText: '取消',
  172. type: 'warning'
  173. }).then(() => {
  174. window.open(
  175. `/api/blade-purchase-sales/exportOrder/salesCommissionExport?${this.website.tokenHeader
  176. }=${getToken()}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}&salesName=${params.salesName}`
  177. );
  178. }).catch(() => {
  179. this.$message({
  180. type: 'info',
  181. message: '已取消' //
  182. });
  183. })
  184. },
  185. searchCriteriaSwitch(type) {
  186. if (type) {
  187. this.option.height = this.option.height - 46;
  188. } else {
  189. this.option.height = this.option.height + 46;
  190. }
  191. this.$refs.crud.getTableHeight();
  192. },
  193. //点击搜索按钮触发
  194. searchChange(params, done) {
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. refreshChange() {
  200. delete this.search.corpName;
  201. delete this.search.storageName
  202. this.onLoad(this.page, this.search);
  203. },
  204. currentChange(val) {
  205. this.page.currentPage = val;
  206. },
  207. sizeChange(val) {
  208. this.page.currentPage = 1;
  209. this.page.pageSize = val;
  210. },
  211. onLoad(page, params) {
  212. if (this.search.careteTime && this.search.careteTime.length > 0) {
  213. params = {
  214. ...params,
  215. beginCreateTime: this.search.careteTime[0],
  216. endCreateTime: this.search.careteTime[1]
  217. };
  218. }
  219. let queryParams = this.deepClone(Object.assign({},params, this.search));
  220. delete queryParams.careteTime;
  221. this.loading = true;
  222. getList(
  223. page.currentPage,
  224. page.pageSize,
  225. queryParams
  226. )
  227. .then(res => {
  228. this.dataList = res.data.data.records ? res.data.data.records : [];
  229. this.page.total = res.data.data.total;
  230. if (this.page.total) {
  231. this.option.height = window.innerHeight - 210;
  232. }
  233. })
  234. .finally(() => {
  235. this.loading = false;
  236. });
  237. },
  238. editOpen(row) {
  239. if (row.billType == "BJ") {
  240. this.$router.push({
  241. path: "/exportTrade/customerInquiry/index",
  242. query: {
  243. id: row.id
  244. }
  245. });
  246. } else {
  247. this.$router.push({
  248. path: "/exportTrade/salesContract/index",
  249. query: {
  250. id: row.id
  251. }
  252. });
  253. }
  254. },
  255. statement() {
  256. this.statementData = { ...this.search };
  257. if (this.statementData.createTime && this.statementData.createTime.length > 0) {
  258. this.statementData.createStartTime = this.statementData.createTime[0] + " " + "00:00:00"
  259. this.statementData.createEndTime = this.statementData.createTime[1] + " " + "23:59:59"
  260. delete this.statementData.createTime
  261. }
  262. this.switchDialog = !this.switchDialog;
  263. },
  264. onClose(val) {
  265. this.switchDialog = val;
  266. },
  267. //列保存触发
  268. async saveColumn() {
  269. const inSave = await this.saveColumnData(
  270. this.getColumnName(130),
  271. this.option
  272. );
  273. if (inSave) {
  274. this.$nextTick(() => {
  275. this.$refs.crud.doLayout();
  276. });
  277. this.$message.success("保存成功");
  278. //关闭窗口
  279. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  280. }
  281. },
  282. async resetColumn() {
  283. this.option = this.defaultOption;
  284. const inSave = await this.delColumnData(this.getColumnName(130), this.defaultOption);
  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. }
  295. };
  296. </script>
  297. <style scoped>
  298. .page-crad ::v-deep .basic-container__card {
  299. height: 94.2vh;
  300. }
  301. ::v-deep .el-table__expanded-cell[class*="cell"] {
  302. padding: 0px;
  303. }
  304. .itemTable ::v-deep .el-table {
  305. width: 100%;
  306. }
  307. </style>