index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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', 266)"
  7. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 266)" :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" :disabled="row.financeStatus == '已付款' || item >= 1" :type="type"
  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/collectionSettlement/index.js";
  35. import detailsPage from "./detailsPage"
  36. import { getToken } from "@/util/auth";
  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. search: true,
  80. overHidden: true,
  81. }, {
  82. label: '合同号',
  83. prop: "contractNumber",
  84. search: true,
  85. overHidden: true,
  86. }, {
  87. label: "供应商",
  88. prop: "corpName",
  89. searchOrder: 1,
  90. search: true,
  91. // type: "select",
  92. // filterable: true,
  93. // remote: true,
  94. // props: {
  95. // label: 'cname',
  96. // value: 'id'
  97. // },
  98. // dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS',
  99. }, {
  100. label: '结算日期',
  101. prop: "settlementDate",
  102. searchProp: "settlementDateList",
  103. search: true,
  104. overHidden: true,
  105. type: "date",
  106. searchOrder: 2,
  107. width: 100,
  108. searchRange: true,
  109. unlinkPanels: true,
  110. searchDefaultTime: ["00:00:00", "23:59:59"],
  111. format: "yyyy-MM-dd",
  112. valueFormat: "yyyy-MM-dd HH:mm:ss"
  113. }, {
  114. label: '账户',
  115. prop: "accountName",
  116. search: true,
  117. overHidden: true,
  118. type: "select",
  119. props: {
  120. label: 'cname',
  121. value: 'id',
  122. res: 'data.records'
  123. },
  124. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  125. // dicFormatter: (res => {
  126. // return res.data.records
  127. // }),
  128. }, {
  129. label: '金额',
  130. prop: "amount",
  131. // search: true,
  132. overHidden: true,
  133. }, {
  134. label: '状态',
  135. prop: "financeStatus",
  136. search: true,
  137. overHidden: true,
  138. type: 'select',
  139. dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_Status",
  140. props: {
  141. label: "dictValue",
  142. value: "dictKey"
  143. }
  144. }, {
  145. label: "制单时间",
  146. prop: "createTime",
  147. // searchProp: "createTimeList",
  148. type: "date",
  149. overHidden: true,
  150. width: 100,
  151. searchRange: true,
  152. searchDefaultTime: ["00:00:00", "23:59:59"],
  153. format: "yyyy-MM-dd",
  154. valueFormat: "yyyy-MM-dd HH:mm:ss"
  155. },
  156. // {
  157. // label: "创建人",
  158. // prop: "createUserName",
  159. // searchProp: "createUser",
  160. // overHidden: true,
  161. // width: 100,
  162. // filterable: true,
  163. // remote: true,
  164. // type: "select",
  165. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  166. // props: {
  167. // label: "account",
  168. // value: "id",
  169. // res: 'data.records'
  170. // }
  171. // }, {
  172. // label: "修改人",
  173. // prop: "updateUserName",
  174. // searchProp: "updateUser",
  175. // overHidden: true,
  176. // width: 100,
  177. // filterable: true,
  178. // remote: true,
  179. // type: "select",
  180. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  181. // props: {
  182. // label: "account",
  183. // value: "id",
  184. // res: 'data.records'
  185. // }
  186. // },
  187. // {
  188. // label: "更新日期",
  189. // prop: "updateTime",
  190. // searchProp: "updateTimeList",
  191. // type: "date",
  192. // overHidden: true,
  193. // width: 100,
  194. // searchRange: true,
  195. // searchDefaultTime: ["00:00:00", "23:59:59"],
  196. // format: "yyyy-MM-dd",
  197. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  198. // }
  199. ]
  200. }
  201. }
  202. },
  203. async created() {
  204. this.option = await this.getColumnData(this.getColumnName(266), this.optionList);
  205. this.key++
  206. let i = 0;
  207. this.option.column.forEach(item => {
  208. if (item.search) i++
  209. })
  210. if (i % 3 !== 0) {
  211. const num = 3 - Number(i % 3)
  212. this.option.searchMenuSpan = num * 8;
  213. this.option.searchMenuPosition = "right";
  214. }
  215. },
  216. methods: {
  217. //导出
  218. outExport() {
  219. let config = {
  220. params: {
  221. ...this.search,
  222. billType: "FK",
  223. dc: 'c'
  224. }
  225. }
  226. if (config.params) {
  227. for (const propName of Object.keys(config.params)) {
  228. const value = config.params[propName];
  229. if (value !== null && typeof (value) !== "undefined") {
  230. if (value instanceof Array) {
  231. for (const key of Object.keys(value)) {
  232. let params = propName + '[' + key + ']';
  233. config.params[params] = value[key]
  234. }
  235. delete config.params[propName]
  236. }
  237. }
  238. }
  239. }
  240. const routeData = this.$router.resolve({
  241. path: '/api/blade-sales-part/settlement/export', //跳转目标窗口的地址
  242. query: {
  243. ...config.params, //括号内是要传递给新窗口的参数
  244. }
  245. })
  246. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  247. },
  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. },
  260. //刷新
  261. refreshChange() {
  262. this.onLoad(this.page, this.search)
  263. },
  264. rowDel(form, index) {
  265. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  266. confirmButtonText: '确定',
  267. cancelButtonText: '取消',
  268. type: 'warning'
  269. }).then(() => {
  270. remove({ ids: form.id }).then(res => {
  271. this.$message({
  272. type: 'success',
  273. message: '删除成功!'
  274. });
  275. this.dataList.splice(index, 1);
  276. this.onLoad(this.page)
  277. })
  278. }).catch(() => {
  279. });
  280. },
  281. searchChange(params, done) {
  282. this.page.currentPage = 1;
  283. done();
  284. this.onLoad(this.page, params)
  285. },
  286. onLoad(page, params = {}) {
  287. console.log(params);
  288. console.log(this.search);
  289. this.search.accountId = this.search.accountName
  290. params = {
  291. ...params,
  292. current: page.currentPage,
  293. size: page.pageSize,
  294. billType: "FK",
  295. dc: 'c',
  296. ...Object.assign(params, this.search)
  297. }
  298. this.loading = true
  299. getList(params).then(res => {
  300. this.dataList = res.data.data.records
  301. this.page.total = res.data.data.total
  302. this.loading = false
  303. }).finally(() => {
  304. this.loading = false
  305. })
  306. },
  307. //自定义列保存
  308. async saveColumnTwo(ref, option, optionBack, code) {
  309. /**
  310. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  311. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  312. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  313. */
  314. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  315. if (inSave) {
  316. this.$message.success("保存成功");
  317. //关闭窗口
  318. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  319. }
  320. },
  321. //自定义列重置
  322. async resetColumnTwo(ref, option, optionBack, code) {
  323. this[option] = this[optionBack];
  324. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  325. if (inSave) {
  326. this.$message.success("重置成功");
  327. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  328. }
  329. }
  330. }
  331. }
  332. </script>
  333. <style scoped></style>