billDetails.vue 7.5 KB

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