index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <div>
  3. <basic-container class="page-crad" v-show="show">
  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" @search-reset="searchReset">
  8. <template slot="header">
  9. <el-table :data="commodityData" border size="small" @header-click="cellClick" style="width: 100%"
  10. v-loading="itemloading">
  11. <el-table-column v-for="(item, index) in commodityLabel" :key="index" :prop="item.prop" show-overflow-tooltip
  12. :label="item.label" />
  13. </el-table>
  14. </template>
  15. <template slot="menuLeft">
  16. <el-button type="info" icon="el-icon-printer" size="small" :loading="exportLoading" @click.stop="statement"
  17. v-if="false">报表打印</el-button>
  18. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  19. </template>
  20. <template slot="corpNameSearch">
  21. <crop-select v-model="search.corpId" corpType="KG"></crop-select>
  22. </template>
  23. <template slot="sizeSearch">
  24. <el-select v-model="search.size" placeholder="请选择">
  25. <el-option label="是" :value="1"></el-option>
  26. <el-option label="否" :value="0"></el-option>
  27. </el-select>
  28. </template>
  29. <template slot="customerName" slot-scope="scope">
  30. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{
  31. scope.row.customerName
  32. }}</span>
  33. </template>
  34. <template slot="whetherSettlementSearch">
  35. <el-checkbox v-model="search.whetherSettlement" :true-label="1" :false-label="0"></el-checkbox>
  36. </template>
  37. </avue-crud>
  38. </basic-container>
  39. <report-dialog :switchDialog="switchDialog" :searchValue="statementData" :reportName="'经销商-可用库存表'"
  40. @onClose="onClose()" />
  41. <detail v-if="!show" :detail-data="detailData" :trade-type="tradeType" @goBack="goBack"></detail>
  42. </div>
  43. </template>
  44. <script>
  45. import { getToken } from "@/util/auth";
  46. import { getList } from "@/api/statisticAnalysis/collectLedger";
  47. import { getStatisticsList, statisticsSum } from "@/api/tireMall/tirePartsMall/statisticAnalysis/index";
  48. import { micrometerFormat } from "@/util/validate";
  49. import _ from "lodash";
  50. import reportDialog from "@/components/report-dialog/main";
  51. import { gainUser } from "@/api/basicData/customerInquiry";
  52. import detail from "./detail";
  53. export default {
  54. name: "index",
  55. components: {
  56. reportDialog,
  57. detail
  58. },
  59. data() {
  60. return {
  61. itemloading: false,
  62. commodityLabel: [
  63. {
  64. id: 1,
  65. label: "应收金额",
  66. prop: "totalMoney",
  67. }, {
  68. id: 2,
  69. label: "实收金额",
  70. prop: "paymentAmountTl",
  71. }, {
  72. id: 3,
  73. label: "未收金额",
  74. prop: "outstandingAmount",
  75. }
  76. ],
  77. commodityData: [], // 合计数据
  78. exportLoading: false,
  79. switchDialog: false,
  80. statementData: {},
  81. form: {},
  82. search: {
  83. whetherSettlement: 0
  84. },
  85. dataList: [],
  86. loading: false,
  87. detailData: {},
  88. page: {
  89. pageSize: 20,
  90. currentPage: 1,
  91. total: 0,
  92. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  93. },
  94. option: {},
  95. defaultOption: {
  96. searchShow: true,
  97. align: "center",
  98. searchSpan: 6,
  99. searchMenuSpan: 24,
  100. border: true,
  101. index: true,
  102. addBtn: false,
  103. viewBtn: false,
  104. editBtn: false,
  105. delBtn: false,
  106. showSummary: true,
  107. summaryText: '合计',
  108. sumColumnList: [
  109. {
  110. name: 'totalMoney',
  111. type: 'sum'
  112. },
  113. {
  114. name: 'paymentAmountTl',
  115. type: 'sum'
  116. },
  117. {
  118. name: 'outstandingAmount',
  119. type: 'sum'
  120. },
  121. ],
  122. searchIcon: true,
  123. searchIndex: 3,
  124. menu: false,
  125. column: [
  126. {
  127. label: '客户',
  128. prop: "customerName",
  129. type: "select",
  130. search: true,
  131. overHidden: true,
  132. filterable: true,
  133. props: {
  134. label: 'cname',
  135. value: 'id'
  136. },
  137. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=1',
  138. },
  139. {
  140. label: '业务员',
  141. prop: "salerId",
  142. search: true,
  143. type: "select",
  144. props: {
  145. label: "name",
  146. value: "id"
  147. },
  148. dicUrl: "/api/blade-user/client/getUserByRole",
  149. filterable: true,
  150. hide: true,
  151. },
  152. {
  153. label: '业务员',
  154. prop: "salerName",
  155. overHidden: true,
  156. },
  157. {
  158. label: "结清不显示",
  159. prop: "whetherSettlement",
  160. search: true,
  161. hide: true
  162. },
  163. {
  164. label: "业务日期",
  165. prop: "businesDate",
  166. type: 'date',
  167. format: "yyyy-MM",
  168. valueFormat: "yyyy-MM",
  169. unlinkPanels: true,
  170. searchRange: true,
  171. overHidden: true,
  172. },
  173. {
  174. label: "业务日期",
  175. prop: "businesDateList",
  176. search: true,
  177. type: 'monthrange',
  178. format: "yyyy-MM",
  179. valueFormat: "yyyy-MM",
  180. unlinkPanels: true,
  181. searchRange: true,
  182. overHidden: true,
  183. hide: true
  184. },
  185. // {
  186. // label: "是否显示金额为0",
  187. // prop: "size",
  188. // search: true,
  189. // overHidden: true,
  190. // hide: true,
  191. // showColumn: false
  192. // },
  193. {
  194. label: "应收金额",
  195. prop: "totalMoney",
  196. search: false,
  197. overHidden: true,
  198. },
  199. {
  200. label: "实收金额",
  201. prop: "paymentAmountTl",
  202. search: false,
  203. overHidden: true,
  204. },
  205. {
  206. label: "未收金额",
  207. prop: "outstandingAmount",
  208. search: false,
  209. overHidden: true,
  210. },
  211. ],
  212. },
  213. // 仓库配置
  214. configurationWarehouse: {
  215. multipleChoices: false,
  216. multiple: false,
  217. collapseTags: false,
  218. placeholder: "请点击右边按钮选择",
  219. dicData: [],
  220. },
  221. brandOption: [],
  222. userList: [],
  223. tradeType: '',
  224. sysitemType: null,
  225. show: true,
  226. };
  227. },
  228. async created() {
  229. this.option = this.defaultOption;
  230. this.option = await this.getColumnData(this.getColumnName(284), this.defaultOption);
  231. this.getWorkDicts('brand').then(res => {
  232. this.brandOption = res.data.data;
  233. })
  234. gainUser().then(res => {
  235. this.userList = res.data.data;
  236. });
  237. this.key++
  238. let i = 0;
  239. this.option.column.forEach(item => {
  240. if (item.search) i++
  241. })
  242. },
  243. methods: {
  244. cellStyle() {
  245. return "padding:0;height:40px;";
  246. },
  247. searchCriteriaSwitch(type) {
  248. if (type) {
  249. this.option.height = this.option.height - 46;
  250. } else {
  251. this.option.height = this.option.height + 46;
  252. }
  253. this.$refs.crud.getTableHeight();
  254. },
  255. searchReset() {
  256. },
  257. //点击搜索按钮触发
  258. searchChange(params, done) {
  259. this.page.currentPage = 1;
  260. this.onLoad(this.page, params);
  261. done();
  262. },
  263. refreshChange() {
  264. this.onLoad(this.page, this.search);
  265. },
  266. currentChange(val) {
  267. this.page.currentPage = val;
  268. },
  269. sizeChange(val) {
  270. this.page.currentPage = 1;
  271. this.page.pageSize = val;
  272. },
  273. onLoad(page, params) {
  274. this.search.customerId = this.search.customerName
  275. this.sysitemType = localStorage.getItem('sysitemType');
  276. if (this.sysitemType == 999) {
  277. this.tradeType = ''
  278. } else if (this.sysitemType == 1) {
  279. this.tradeType = 'XX'
  280. } else if (this.sysitemType == 2) {
  281. this.tradeType = 'GN'
  282. } else if (this.sysitemType == 3) {
  283. this.tradeType = 'JK'
  284. } else if (this.sysitemType == 4) {
  285. this.tradeType = 'CK'
  286. } else if (this.sysitemType == 5) {
  287. this.tradeType = 'SW'
  288. } else if (this.sysitemType == 6) {
  289. this.tradeType = 'JXS'
  290. } else if (this.sysitemType == 7) {
  291. this.tradeType = 'LY'
  292. }
  293. this.loading = true;
  294. this.dataList.forEach(item => {
  295. this.$refs.crud.toggleRowExpansion(item, false);
  296. });
  297. let queryParams = this.deepClone(Object.assign({ type: 0 }, params, this.search));
  298. if (queryParams.accDate && queryParams.accDate.length > 0) {
  299. queryParams = {
  300. ...queryParams,
  301. accDateStart: queryParams.accDate[0] + ' 00:00:00',
  302. accDateEnd: queryParams.accDate[1] + ' 23:59:59',
  303. }
  304. delete queryParams.accDate;
  305. }
  306. getStatisticsList(
  307. page.currentPage,
  308. page.pageSize,
  309. queryParams
  310. )
  311. .then(res => {
  312. if (res.data.data.records) {
  313. res.data.data.records.forEach(e => {
  314. e.itemLoading = true;
  315. });
  316. }
  317. this.dataList = res.data.data.records ? res.data.data.records : [];
  318. this.page.total = res.data.data.total;
  319. if (this.page.total) {
  320. this.option.height = window.innerHeight - 230;
  321. }
  322. this.itemloading = true,
  323. statisticsSum({type:0,...queryParams}).then(res => {
  324. this.commodityData= [res.data.data]
  325. }).finally(() => {
  326. this.itemloading = false;
  327. });
  328. })
  329. .finally(() => {
  330. this.loading = false;
  331. });
  332. },
  333. editOpen(row) {
  334. if (row.billType == "BJ") {
  335. this.$router.push({
  336. path: "/exportTrade/customerInquiry/index",
  337. query: {
  338. id: row.id
  339. }
  340. });
  341. } else {
  342. this.$router.push({
  343. path: "/exportTrade/salesContract/index",
  344. query: {
  345. id: row.id
  346. }
  347. });
  348. }
  349. },
  350. statement() {
  351. this.statementData = { ...this.search };
  352. if (this.statementData.accDate && this.statementData.accDate.length > 0) {
  353. this.statementData.accDateStart = this.statementData.accDate[0] + " " + "00:00:00"
  354. this.statementData.accDateEnd = this.statementData.accDate[1] + " " + "23:59:59"
  355. delete this.statementData.accDate
  356. }
  357. this.switchDialog = !this.switchDialog;
  358. },
  359. onClose(val) {
  360. this.switchDialog = val;
  361. },
  362. // 跳转到详情
  363. beforeOpenPage(row, index) {
  364. this.detailData = {
  365. customerId: row.customerId,
  366. businesDate: row.businesDate,
  367. salerId: row.salerId,
  368. };
  369. this.show = false;
  370. },
  371. goBack() {
  372. this.detailData = this.$options.data().detailData
  373. if (JSON.stringify(this.$route.query) != "{}") {
  374. this.$router.$avueRouter.closeTag();
  375. this.$router.push({
  376. path: "/statisticAnalysis/collectLedger/index"
  377. });
  378. }
  379. this.dataList.forEach(item => {
  380. this.$refs.crud.toggleRowExpansion(item, false)
  381. })
  382. this.show = true;
  383. this.onLoad(this.page, this.search);
  384. },
  385. outExport() {
  386. if (!this.search.corpId) this.$set(this.search, 'corpId', '');
  387. if (this.search.accDate && this.search.accDate.length > 0) {
  388. this.search = {
  389. ...this.search,
  390. accDateStart: this.search.accDate[0] + ' 00:00:00',
  391. accDateEnd: this.search.accDate[1] + ' 23:59:59',
  392. }
  393. } else {
  394. this.search = {
  395. ...this.search,
  396. accDateStart: '',
  397. accDateEnd: '',
  398. }
  399. }
  400. this.$confirm('是否导出应收总账信息?', '提示', {
  401. confirmButtonText: '确定',
  402. cancelButtonText: '取消',
  403. type: 'warning'
  404. }).then(() => {
  405. window.open(
  406. `/api/blade-sales-part/order/statistics-export?${this.website.tokenHeader
  407. }=${getToken()}&type=0&businesDateList[0]=${this.search.businesDateList[0] == null || this.search.businesDateList[0] === undefined ? '' : this.search.businesDateList[0]
  408. }&businesDateList[1]=${this.search.businesDateList[1] == null || this.search.businesDateList[1] === undefined ? '' : this.search.businesDateList[1]
  409. }&customerId=${this.search.customerName == null || this.search.customerName === undefined ? '' : this.search.customerName}`
  410. );
  411. }).catch(() => {
  412. this.$message({
  413. type: 'info',
  414. message: '已取消' //
  415. });
  416. })
  417. },
  418. //列保存触发
  419. async saveColumn() {
  420. const inSave = this.saveColumnData(this.getColumnName(284), this.option);
  421. if (inSave) {
  422. this.$nextTick(() => {
  423. this.$refs.crud.doLayout();
  424. });
  425. this.$message.success("保存成功");
  426. //关闭窗口
  427. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  428. }
  429. },
  430. async resetColumn() {
  431. this.option = this.defaultOption;
  432. // this.option = await this.getColumnData(this.getColumnName(284), this.defaultOption);
  433. const inSave = await this.delColumnData(this.getColumnName(284), this.defaultOption);
  434. if (inSave) {
  435. this.$nextTick(() => {
  436. this.$refs.crud.doLayout()
  437. })
  438. this.$message.success("重置成功");
  439. //关闭窗口
  440. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  441. }
  442. },
  443. }
  444. };
  445. </script>
  446. <style scoped>
  447. .page-crad ::v-deep .basic-container__card {
  448. height: 94.2vh;
  449. }
  450. ::v-deep .el-table__expanded-cell[class*="cell"] {
  451. padding: 0px;
  452. }
  453. .itemTable ::v-deep .el-table {
  454. width: 100%;
  455. }
  456. /deep/ .el-col-md-8 {
  457. width: 24.33333%;
  458. }
  459. </style>