index.vue 10 KB

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