receiptSettle.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div>
  3. <basic-container v-show="show">
  4. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
  5. :table-loading="loading" :cell-style="cellStyle" @search-change="searchChange" @search-reset="searchReset"
  6. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  7. @refresh-change="refreshChange" @saveColumn="saveColumn" @resetColumn="resetColumn" @on-load="onLoad"
  8. @search-criteria-switch="searchCriteriaSwitch">
  9. <template slot="corpIdSearch">
  10. <select-component v-model="search.corpId" :configuration="configuration"></select-component>
  11. </template>
  12. <template slot="menuLeft">
  13. <el-button type="primary" size="small" icon="el-icon-plus" @click="addReceipt">创建单据
  14. </el-button>
  15. <el-button type="warning" size="small" icon="el-icon-top" @click.stop="openExport()">导出</el-button>
  16. </template>
  17. <template slot-scope="scope" slot="menu">
  18. <el-button type="text" size="small" icon="el-icon-delete" @click.stop="rowDel(scope.row, scope.index)">删除
  19. </el-button>
  20. </template>
  21. <template slot-scope="scope" slot="srcOrderno">
  22. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row)">{{ scope.row.srcOrderno
  23. }}</span>
  24. </template>
  25. <template slot-scope="scope" slot="corpId">
  26. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(scope.row)">{{ scope.row.corpName }}</span>
  27. </template>
  28. </avue-crud>
  29. </basic-container>
  30. <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-if="!show"></detail-page>
  31. </div>
  32. </template>
  33. <script>
  34. import option from "./configuration/mainList.json";
  35. import { getList, remove } from "@/api/financialManagement/financialManagement"
  36. import detailPage from "./receiptSettleDetailsPage.vue";
  37. import { getToken } from "@/util/auth";
  38. export default {
  39. data() {
  40. return {
  41. loading: false,
  42. form: {},
  43. search: {},
  44. option: {},
  45. parentId: 0,
  46. show: true,
  47. detailData: {},
  48. dataList: [{
  49. canem: ""
  50. }],
  51. page: {
  52. pageSize: 10,
  53. pagerCount: 5,
  54. total: 0,
  55. },
  56. query: {},
  57. configuration: {
  58. multipleChoices: false,
  59. multiple: false,
  60. disabled: false,
  61. searchShow: true,
  62. collapseTags: false,
  63. clearable: true,
  64. placeholder: '请点击右边按钮选择',
  65. dicData: []
  66. },
  67. }
  68. },
  69. components: {
  70. detailPage
  71. },
  72. async created() {
  73. this.option = await this.getColumnData(this.getColumnName(64), option);
  74. let i = 0;
  75. this.option.column.forEach(item => {
  76. if (item.search) i++
  77. })
  78. if (i % 3 !== 0) {
  79. const num = 3 - Number(i % 3)
  80. this.option.searchMenuSpan = num * 8;
  81. this.option.searchMenuPosition = "right";
  82. }
  83. },
  84. activated() {
  85. if (this.$route.query.id) {
  86. this.show = true;
  87. this.$store.commit("COLL_OPEN_EXPORT_DETAIL");
  88. this.editOpen({ id: this.$route.query.id });
  89. }
  90. },
  91. mounted() {
  92. // this.option.height = window.innerHeight - 200;
  93. },
  94. methods: {
  95. searchCriteriaSwitch(type) {
  96. if (type) {
  97. this.option.height = this.option.height - 90
  98. } else {
  99. this.option.height = this.option.height + 90
  100. }
  101. this.$refs.crud.getTableHeight()
  102. },
  103. //新单打开
  104. addReceipt(row) {
  105. this.detailData = {
  106. id: row.id,
  107. status: 1,
  108. corpId: row.corpId,
  109. };
  110. this.show = false;
  111. },
  112. //编辑打开
  113. editOpen(row) {
  114. const data = {
  115. moduleName: 'sf',
  116. tableName: 'finance_settlement',
  117. billId: row.id,
  118. no: localStorage.getItem('browserID')
  119. }
  120. this.checkLock(data).then(res => {
  121. if (res.data.code == 200) {
  122. this.detailData = {
  123. disabled: true,
  124. id: row.id,
  125. corpId: row.corpId,
  126. };
  127. this.show = false;
  128. }
  129. }).catch(error => {
  130. this.detailData = {
  131. disabled: true,
  132. id: row.id,
  133. corpId: row.corpId,
  134. };
  135. this.show = false;
  136. })
  137. },
  138. rowDel(row, index, done) {
  139. if (row.id) {
  140. this.$confirm("确定将选择数据删除?", {
  141. confirmButtonText: "确定",
  142. cancelButtonText: "取消",
  143. type: "warning"
  144. }).then(() => {
  145. remove(row.id).then(res => {
  146. if (res.data.success) {
  147. this.$message.success("操作成功!");
  148. this.onLoad(this.page);
  149. }
  150. })
  151. });
  152. }
  153. },
  154. //点击搜索按钮触发
  155. searchChange(params, done) {
  156. this.query = params;
  157. this.page.currentPage = 1;
  158. this.onLoad(this.page, params);
  159. done()
  160. },
  161. searchReset() {
  162. console.log('1')
  163. },
  164. selectionChange() {
  165. console.log('1')
  166. },
  167. currentChange(val) {
  168. this.page.currentPage = val
  169. },
  170. sizeChange() {
  171. console.log('1')
  172. },
  173. refreshChange(params) {
  174. this.onLoad(this.page, params)
  175. },
  176. paramsAdjustment(params) {
  177. params = Object.assign({}, this.search);
  178. if (params.settlementDate && params.settlementDate.length !== 0) { //合同
  179. params.settlementStartDate = params.settlementDate[0] + " " + "00:00:00";
  180. params.settlementEndDate = params.settlementDate[1] + " " + "23:59:59";
  181. this.$delete(params, 'settlementDate')
  182. }
  183. if (params.completionTime && params.completionTime.length !== 0) {
  184. params.completionTimeStart = params.completionTime[0] + " " + "00:00:00";
  185. params.completionTimeEnd = params.completionTime[1] + " " + "23:59:59";
  186. this.$delete(params, 'completionTime')
  187. }
  188. return params
  189. },
  190. onLoad(page, params) {
  191. this.loading = true
  192. params = this.paramsAdjustment(params)
  193. params.billType = "收费"
  194. params.settlementType = 1
  195. getList(page.currentPage, page.pageSize, params).then(res => {
  196. this.dataList = res.data.data.records
  197. this.page.total = res.data.data.total
  198. if (this.page.total) {
  199. this.option.height = window.innerHeight - 240;
  200. }
  201. }).finally(() => {
  202. this.loading = false
  203. })
  204. },
  205. goBack() {
  206. this.detailData = this.$options.data().detailData
  207. this.show = true;
  208. this.onLoad(this.page, this.search)
  209. },
  210. cellStyle() {
  211. return "padding:0;height:40px;";
  212. },
  213. //列保存触发
  214. async saveColumn() {
  215. const inSave = await this.saveColumnData(
  216. this.getColumnName(64),
  217. this.option
  218. );
  219. if (inSave) {
  220. this.$message.success("保存成功");
  221. //关闭窗口
  222. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  223. }
  224. },
  225. async resetColumn() {
  226. const inSave = await this.delColumnData(
  227. this.getColumnName(64),
  228. option
  229. );
  230. if (inSave) {
  231. this.$message.success("重置成功");
  232. this.option = option;
  233. //关闭窗口
  234. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  235. }
  236. },
  237. openExport() {
  238. let params = JSON.parse(JSON.stringify(this.search))
  239. if (params.settlementDate && params.settlementDate.length !== 0) { //合同
  240. params.settlementStartDate = params.settlementDate[0] + " " + "00:00:00";
  241. params.settlementEndDate = params.settlementDate[1] + " " + "23:59:59";
  242. this.$delete(params, 'settlementDate')
  243. }
  244. if (params.completionTime && params.completionTime.length !== 0) {
  245. params.completionTimeStart = params.completionTime[0] + " " + "00:00:00";
  246. params.completionTimeEnd = params.completionTime[1] + " " + "23:59:59";
  247. this.$delete(params, 'completionTime')
  248. }
  249. params.billType = "收费"
  250. params.settlementType = 1
  251. const routeData = this.$router.resolve({
  252. path: '/api/trade-finance/settlement/expenseExport', //跳转目标窗口的地址
  253. query: {
  254. ...params //括号内是要传递给新窗口的参数
  255. }
  256. })
  257. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  258. },
  259. }
  260. }
  261. </script>
  262. <style scoped></style>