index.vue 11 KB

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