index.vue 14 KB

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