billDetails.vue 8.4 KB

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