index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
  26. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  27. </template>
  28. </avue-crud>
  29. </basic-container>
  30. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  31. </div>
  32. </template>
  33. <script>
  34. // import {getList, remove} from "@/api/oceanShipping/maritimeExport/index.js";
  35. import { getList, remove } from "@/api/collectionSettlement/index.js";
  36. import detailsPage from "./detailsPage"
  37. export default {
  38. name: "index",
  39. components: {
  40. detailsPage
  41. },
  42. data() {
  43. return {
  44. detailsOpen: false,
  45. loading: false,
  46. search: {},
  47. form: {},
  48. dataList: [],
  49. detailData: {},
  50. page: {
  51. pageSize: 20,
  52. currentPage: 1,
  53. total: 0,
  54. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  55. },
  56. key: 0,
  57. option: {},
  58. optionList: {
  59. viewBtn: false,
  60. editBtn: false,
  61. delBtn: false,
  62. addBtn: false,
  63. index: true,
  64. span: 8,
  65. border: true,
  66. height: "auto",
  67. searchMenuPosition: "right",
  68. align: "center",
  69. size: "small",
  70. menuWidth: 50,
  71. searchSpan: 8,
  72. searchIcon: true,
  73. searchIndex: 5,
  74. highlightCurrentRow: true,
  75. dialogWidth: "70%",
  76. column: [{
  77. label: '单据编号',
  78. prop: "sysNo",
  79. searchOrder: 3,
  80. search: true,
  81. overHidden: true,
  82. }, {
  83. label: '合同号',
  84. prop: "contractNumber",
  85. searchOrder: 4,
  86. search: true,
  87. overHidden: true,
  88. },
  89. {
  90. label: "客户",
  91. prop: "corpId",
  92. search: true,
  93. // remote: true,
  94. filterable:true,
  95. searchOrder: 1,
  96. type: 'select',
  97. overHidden: true,
  98. props: {
  99. label: 'cname',
  100. value: 'id'
  101. },
  102. showColumn: false,
  103. hide: true,
  104. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  105. },
  106. {
  107. label: "客户",
  108. prop: "corpName",
  109. search: true,
  110. // remote: true,
  111. // filterable:true,
  112. // searchOrder: 1,
  113. // type: 'select',
  114. overHidden: true,
  115. // props: {
  116. // label: 'cname',
  117. // value: 'cname'
  118. // },
  119. // dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  120. },
  121. {
  122. label: "结算日期",
  123. prop: "settlementDate",
  124. searchProp: "settlementDateList",
  125. searchOrder: 2,
  126. type: "date",
  127. search: true,
  128. overHidden: true,
  129. width: 100,
  130. searchRange: true,
  131. unlinkPanels: true,
  132. searchDefaultTime: ["00:00:00", "23:59:59"],
  133. format: "yyyy-MM-dd",
  134. valueFormat: "yyyy-MM-dd HH:mm:ss"
  135. }, {
  136. label: "所属公司",
  137. prop: "salesCompanyId",
  138. search: true,
  139. type: 'select',
  140. searchOrder: 6,
  141. props: {
  142. label: 'fullName',
  143. value: 'id'
  144. },
  145. dicUrl: '/api/blade-system/dept/top-list'
  146. }, {
  147. label: '账户',
  148. prop: "accountName",
  149. searchOrder: 4,
  150. search: true,
  151. overHidden: true,
  152. type: 'select',
  153. props: {
  154. label: 'cname',
  155. value: 'id',
  156. res: 'data.records'
  157. },
  158. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  159. // dicFormatter: (res => {
  160. // return res.data.records
  161. // }),
  162. }, {
  163. label: '金额',
  164. prop: "amount",
  165. // search: true,
  166. overHidden: true,
  167. }, {
  168. label: '经办人',
  169. prop: "handledByName",
  170. // search: true,
  171. overHidden: true,
  172. props: {
  173. label: "name",
  174. value: "id"
  175. },
  176. dicUrl: "/api/blade-user/client/gainUser",
  177. }, {
  178. label: '状态',
  179. prop: "financeStatus",
  180. search: true,
  181. searchOrder: 5,
  182. overHidden: true,
  183. type: 'select',
  184. dicUrl: "/api/blade-system/dict-biz/dictionary?code=put_Status",
  185. props: {
  186. label: "dictValue",
  187. value: "dictKey"
  188. }
  189. },
  190. {
  191. label: "制单日期",
  192. prop: "createTime",
  193. // searchProp: "settlementDateList",
  194. searchOrder: 5,
  195. type: "date",
  196. // search:true,
  197. overHidden: true,
  198. width: 100,
  199. searchRange: true,
  200. searchDefaultTime: ["00:00:00", "23:59:59"],
  201. format: "yyyy-MM-dd",
  202. valueFormat: "yyyy-MM-dd HH:mm:ss"
  203. },
  204. // {
  205. // label: "应结日期",
  206. // prop: "dueDate",
  207. // searchProp: "updateTimeList",
  208. // type: "date",
  209. // overHidden: true,
  210. // width: 100,
  211. // searchRange: true,
  212. // searchDefaultTime: ["00:00:00", "23:59:59"],
  213. // format: "yyyy-MM-dd",
  214. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  215. // }
  216. ]
  217. }
  218. }
  219. },
  220. async created() {
  221. this.option = await this.getColumnData(this.getColumnName(267), this.optionList);
  222. this.key++
  223. let i = 0;
  224. this.option.column.forEach(item => {
  225. if (item.search) i++
  226. })
  227. if (i % 3 !== 0) {
  228. const num = 3 - Number(i % 3)
  229. this.option.searchMenuSpan = num * 8;
  230. this.option.searchMenuPosition = "right";
  231. }
  232. // this.findObject(this.optionList.column,'corpId').click = ()=>{
  233. // console.log('点击了');
  234. // }
  235. },
  236. // 解决AVue表格错位问题
  237. activated() {
  238. setTimeout(() => {
  239. this.$nextTick(() => {
  240. this.$refs.crud.doLayout()
  241. // this.$refs.crud.refreshTable()
  242. })
  243. }, 100)
  244. },
  245. mounted() {
  246. // 页面尺寸改变,重新渲染avue表格,避免表格错位
  247. window.addEventListener(
  248. 'resize',
  249. () => {
  250. if (Math.abs(this.screenWidth - document.body.clientWidth) > 20) {
  251. this.$nextTick(() => {
  252. this.$refs.originPlace.refreshTable();
  253. })
  254. }
  255. this.screenWidth = document.body.clientWidth;
  256. }
  257. )
  258. },
  259. methods: {
  260. check(row) {
  261. this.form = row
  262. this.detailsOpen = true
  263. },
  264. backToList(type) {
  265. this.form = {}
  266. this.detailsOpen = false
  267. if (type === 0) {
  268. this.detailData = {}
  269. }
  270. this.onLoad(this.page, this.search)
  271. this.$nextTick(() => {
  272. this.$refs.crud.doLayout()
  273. })
  274. },
  275. //刷新
  276. refreshChange() {
  277. this.onLoad(this.page, this.search)
  278. },
  279. rowDel(form, index) {
  280. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  281. confirmButtonText: '确定',
  282. cancelButtonText: '取消',
  283. type: 'warning'
  284. }).then(() => {
  285. remove({ ids: form.id }).then(res => {
  286. this.$message({
  287. type: 'success',
  288. message: '删除成功!'
  289. });
  290. this.dataList.splice(index, 1);
  291. this.onLoad(this.page)
  292. })
  293. }).catch(() => {
  294. });
  295. },
  296. searchChange(params, done) {
  297. // console.log(params,285)
  298. this.page.currentPage = 1;
  299. done();
  300. this.onLoad(this.page, params)
  301. },
  302. onLoad(page, params = {}) {
  303. this.search.accountId = this.search.accountName
  304. params = {
  305. ...params,
  306. current: page.currentPage,
  307. size: page.pageSize,
  308. billType: "SK",
  309. dc: 'd',
  310. ...Object.assign(params, this.search)
  311. }
  312. this.loading = true
  313. getList(params).then(res => {
  314. this.dataList = res.data.data.records
  315. this.page.total = res.data.data.total
  316. this.loading = false
  317. }).finally(() => {
  318. this.loading = false
  319. })
  320. },
  321. //自定义列保存
  322. async saveColumnTwo(ref, option, optionBack, code) {
  323. /**
  324. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  325. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  326. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  327. */
  328. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  329. if (inSave) {
  330. this.$message.success("保存成功");
  331. //关闭窗口
  332. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  333. }
  334. },
  335. //自定义列重置
  336. async resetColumnTwo(ref, option, optionBack, code) {
  337. this[option] = this[optionBack];
  338. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  339. if (inSave) {
  340. this.$message.success("重置成功");
  341. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  342. }
  343. }
  344. }
  345. }
  346. </script>
  347. <style scoped></style>