index.vue 10 KB

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