index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @refresh-change="refreshChange" @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 267)"
  7. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 267)" :page.sync="page">
  8. <template slot-scope="{ row, index }" slot="sysNo">
  9. <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.sysNo }}
  10. </span>
  11. </template>
  12. <template slot-scope="{ row, index }" slot="corpName">
  13. <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.corpName }}
  14. </span>
  15. </template>
  16. <template slot-scope="{type,size,row,index}" slot="menu">
  17. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  18. <el-button :size="size" :type="type" :disabled="row.financeStatus == '已收款' || item >= 1"
  19. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  20. </template>
  21. <!-- <template slot="corpNameSearch">
  22. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  23. </template> -->
  24. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  25. <div style="display: flex;align-items: center;">
  26. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
  27. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  28. <div style="display: flex;align-items: center;">
  29. <div class="buttonBox">
  30. <span>待收款总计:</span>
  31. <span>{{ advanceReceipt }}</span>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. </avue-crud>
  37. </basic-container>
  38. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  39. </div>
  40. </template>
  41. <script>
  42. // import {getList, remove} from "@/api/oceanShipping/maritimeExport/index.js";
  43. import { getList, remove,getSettlementSum, getPendingPaymentSum } from "@/api/collectionSettlement/index.js";
  44. import detailsPage from "./detailsPage"
  45. import { getToken } from "@/util/auth";
  46. export default {
  47. name: "index",
  48. components: {
  49. detailsPage
  50. },
  51. data() {
  52. return {
  53. advanceReceipt: 0.0,
  54. detailsOpen: false,
  55. loading: false,
  56. search: {},
  57. form: {},
  58. dataList: [],
  59. detailData: {},
  60. page: {
  61. pageSize: 10,
  62. currentPage: 1,
  63. total: 0,
  64. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  65. },
  66. key: 0,
  67. option: {},
  68. optionList: {
  69. viewBtn: false,
  70. editBtn: false,
  71. delBtn: false,
  72. addBtn: false,
  73. index: true,
  74. span: 8,
  75. border: true,
  76. height: "auto",
  77. searchMenuPosition: "right",
  78. align: "center",
  79. size: "small",
  80. menuWidth: 50,
  81. searchSpan: 8,
  82. searchIcon: true,
  83. searchIndex: 5,
  84. highlightCurrentRow: true,
  85. dialogWidth: "70%",
  86. column: [{
  87. label: '单据编号',
  88. prop: "sysNo",
  89. searchOrder: 3,
  90. search: true,
  91. overHidden: true,
  92. }, {
  93. label: '合同号',
  94. prop: "contractNumber",
  95. searchOrder: 4,
  96. search: true,
  97. overHidden: true,
  98. },
  99. // {
  100. // label: "客户",
  101. // prop: "corpId",
  102. // search: true,
  103. // // remote: true,
  104. // filterable:true,
  105. // searchOrder: 1,
  106. // type: 'select',
  107. // overHidden: true,
  108. // props: {
  109. // label: 'cname',
  110. // value: 'id'
  111. // },
  112. // showColumn: false,
  113. // hide: true,
  114. // dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  115. // },
  116. {
  117. label: "客户",
  118. prop: "corpName",
  119. search: true,
  120. // remote: true,
  121. // filterable:true,
  122. searchOrder: 1,
  123. width:140,
  124. // type: 'select',
  125. overHidden: true,
  126. // props: {
  127. // label: 'cname',
  128. // value: 'cname'
  129. // },
  130. // dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  131. },
  132. {
  133. label: "结算日期",
  134. prop: "settlementDate",
  135. searchProp: "settlementDateList",
  136. searchOrder: 2,
  137. type: "date",
  138. search: true,
  139. overHidden: true,
  140. width: 100,
  141. searchRange: true,
  142. unlinkPanels: true,
  143. searchDefaultTime: ["00:00:00", "23:59:59"],
  144. format: "yyyy-MM-dd",
  145. valueFormat: "yyyy-MM-dd HH:mm:ss"
  146. }, {
  147. label: "所属公司",
  148. prop: "salesCompanyId",
  149. search: true,
  150. type: 'select',
  151. searchOrder: 6,
  152. props: {
  153. label: 'fullName',
  154. value: 'id'
  155. },
  156. dicUrl: '/api/blade-system/dept/top-list'
  157. }, {
  158. label: '账户',
  159. prop: "accountName",
  160. searchOrder: 4,
  161. search: true,
  162. overHidden: true,
  163. type: 'select',
  164. props: {
  165. label: 'cname',
  166. value: 'id',
  167. res: 'data.records'
  168. },
  169. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  170. // dicFormatter: (res => {
  171. // return res.data.records
  172. // }),
  173. }, {
  174. label: '金额',
  175. prop: "amount",
  176. // search: true,
  177. overHidden: true,
  178. }, {
  179. label: '经办人',
  180. prop: "handledByName",
  181. // search: true,
  182. overHidden: true,
  183. props: {
  184. label: "name",
  185. value: "id"
  186. },
  187. dicUrl: "/api/blade-user/client/gainUser",
  188. }, {
  189. label: '状态',
  190. prop: "financeStatus",
  191. search: true,
  192. searchOrder: 5,
  193. overHidden: true,
  194. type: 'select',
  195. dicUrl: "/api/blade-system/dict-biz/dictionary?code=put_Status",
  196. props: {
  197. label: "dictValue",
  198. value: "dictKey"
  199. }
  200. },
  201. {
  202. label: "制单日期",
  203. prop: "createTime",
  204. // searchProp: "settlementDateList",
  205. searchOrder: 5,
  206. type: "date",
  207. // search:true,
  208. overHidden: true,
  209. width: 100,
  210. searchRange: true,
  211. searchDefaultTime: ["00:00:00", "23:59:59"],
  212. format: "yyyy-MM-dd",
  213. valueFormat: "yyyy-MM-dd HH:mm:ss"
  214. },
  215. // {
  216. // label: "应结日期",
  217. // prop: "dueDate",
  218. // searchProp: "updateTimeList",
  219. // type: "date",
  220. // overHidden: true,
  221. // width: 100,
  222. // searchRange: true,
  223. // searchDefaultTime: ["00:00:00", "23:59:59"],
  224. // format: "yyyy-MM-dd",
  225. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  226. // }
  227. ]
  228. }
  229. }
  230. },
  231. async created() {
  232. this.option = await this.getColumnData(this.getColumnName(267), this.optionList);
  233. this.key++
  234. let i = 0;
  235. this.option.column.forEach(item => {
  236. if (item.search) i++
  237. })
  238. if (i % 3 !== 0) {
  239. const num = 3 - Number(i % 3)
  240. this.option.searchMenuSpan = num * 8;
  241. this.option.searchMenuPosition = "right";
  242. }
  243. // this.findObject(this.optionList.column,'corpId').click = ()=>{
  244. // console.log('点击了');
  245. // }
  246. this.getAmountSum()
  247. },
  248. // 解决AVue表格错位问题
  249. activated() {
  250. setTimeout(() => {
  251. this.$nextTick(() => {
  252. this.$refs.crud.doLayout()
  253. // this.$refs.crud.refreshTable()
  254. })
  255. }, 100)
  256. },
  257. mounted() {
  258. // 页面尺寸改变,重新渲染avue表格,避免表格错位
  259. window.addEventListener(
  260. 'resize',
  261. () => {
  262. if (Math.abs(this.screenWidth - document.body.clientWidth) > 20) {
  263. this.$nextTick(() => {
  264. this.$refs.originPlace.refreshTable();
  265. })
  266. }
  267. this.screenWidth = document.body.clientWidth;
  268. }
  269. )
  270. },
  271. methods: {
  272. getAmountSum(params){
  273. getPendingPaymentSum(params).then(res => {
  274. this.advanceReceipt = res.data.data
  275. })
  276. },
  277. //导出
  278. outExport() {
  279. let config = {
  280. params: {
  281. ...this.search,
  282. billType: "SK",
  283. dc: 'd'
  284. }
  285. }
  286. if (config.params) {
  287. for (const propName of Object.keys(config.params)) {
  288. const value = config.params[propName];
  289. if (value !== null && typeof (value) !== "undefined") {
  290. if (value instanceof Array) {
  291. for (const key of Object.keys(value)) {
  292. let params = propName + '[' + key + ']';
  293. config.params[params] = value[key]
  294. }
  295. delete config.params[propName]
  296. }
  297. }
  298. }
  299. }
  300. const routeData = this.$router.resolve({
  301. path: '/api/blade-sales-part/settlement/export', //跳转目标窗口的地址
  302. query: {
  303. ...config.params, //括号内是要传递给新窗口的参数
  304. }
  305. })
  306. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  307. },
  308. check(row) {
  309. this.form = row
  310. this.detailsOpen = true
  311. },
  312. backToList(type) {
  313. this.form = {}
  314. this.detailsOpen = false
  315. if (type === 0) {
  316. this.detailData = {}
  317. }
  318. this.onLoad(this.page, this.search)
  319. this.$nextTick(() => {
  320. this.$refs.crud.doLayout()
  321. })
  322. },
  323. //刷新
  324. refreshChange() {
  325. this.onLoad(this.page, this.search)
  326. },
  327. rowDel(form, index) {
  328. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  329. confirmButtonText: '确定',
  330. cancelButtonText: '取消',
  331. type: 'warning'
  332. }).then(() => {
  333. remove({ ids: form.id }).then(res => {
  334. this.$message({
  335. type: 'success',
  336. message: '删除成功!'
  337. });
  338. this.dataList.splice(index, 1);
  339. this.onLoad(this.page)
  340. })
  341. }).catch(() => {
  342. });
  343. },
  344. searchChange(params, done) {
  345. // console.log(params,285)
  346. this.page.currentPage = 1;
  347. done();
  348. this.onLoad(this.page, params)
  349. },
  350. onLoad(page, params = {}) {
  351. this.search.accountId = this.search.accountName
  352. params = {
  353. ...params,
  354. current: page.currentPage,
  355. size: page.pageSize,
  356. billType: "SK",
  357. dc: 'd',
  358. ...Object.assign(params, this.search)
  359. }
  360. this.loading = true
  361. getList(params).then(res => {
  362. this.dataList = res.data.data.records
  363. this.page.total = res.data.data.total
  364. /* getSettlementSum(params).then(sumRes => {
  365. this.advanceReceipt = sumRes.data.data
  366. })*/
  367. this.getAmountSum(params)
  368. }).finally(() => {
  369. this.loading = false
  370. })
  371. },
  372. //自定义列保存
  373. async saveColumnTwo(ref, option, optionBack, code) {
  374. /**
  375. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  376. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  377. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  378. */
  379. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  380. if (inSave) {
  381. this.$message.success("保存成功");
  382. //关闭窗口
  383. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  384. }
  385. },
  386. //自定义列重置
  387. async resetColumnTwo(ref, option, optionBack, code) {
  388. this[option] = this[optionBack];
  389. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  390. if (inSave) {
  391. this.$message.success("重置成功");
  392. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  393. }
  394. }
  395. }
  396. }
  397. </script>
  398. <style scoped>
  399. .buttonBox {
  400. font-size: 12px;
  401. color: #909399;
  402. margin-left: 10px;
  403. border: 1px solid #d3d4d6;
  404. border-radius: 3px;
  405. padding: 6px 10px;
  406. background: #f4f4f5;
  407. }
  408. .page-crad ::v-deep .basic-container__card {
  409. height: 94.2vh;
  410. }
  411. ::v-deep .el-form-item__error {
  412. display: none !important;
  413. }
  414. ::v-deep .el-input-group__append {
  415. padding: 0 0px !important;
  416. }
  417. .el-dialog ::v-deep .el-form-item__error {
  418. display: none !important;
  419. }
  420. .stat-td {
  421. text-align: center;
  422. position: relative;
  423. }
  424. .stat-img {
  425. width: 95%;
  426. height: 100px;
  427. }
  428. .stat-tip {
  429. position: absolute;
  430. left: 15px;
  431. top: 5px;
  432. .money {
  433. color: #fff;
  434. font-size: 28px;
  435. text-align: left;
  436. font-weight: 600;
  437. }
  438. .title {
  439. color: #fff;
  440. font-size: 14px;
  441. text-align: left;
  442. margin-top: 5px;
  443. margin-bottom: 0px;
  444. }
  445. }
  446. </style>