index.vue 13 KB

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