index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div>
  3. <div>
  4. <div class="flex-align-center" style="margin-bottom:10px">
  5. <el-input size="small" style="width:200px;margin-right:10px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="listData(params.content.pageNumber = 1)" @keyup.native.enter="listData(params.content.pageNumber = 1)" clearable></el-input>
  6. <slot name="add"/>
  7. </div>
  8. <tableLayout :layout="tablecols" :data="list" :opwidth="200" :width="false" height="calc(100vh - 550px)" :custom="true" fixedName="operation" >
  9. <template v-slot:customcol="scope">
  10. <div v-if="scope.column.columnname == 'accountname'">
  11. <!-- <el-select v-if="currentEdit.sa_creditbilldetailid == scope.column.data.sa_creditbilldetailid && accountList.length > 0" size="small" v-model="scope.column.data.sa_accountclassid" placeholder="请选择账户类型">
  12. <el-option
  13. v-for="item in accountList"
  14. :key="item.sa_accountclassid"
  15. :label="item.accountname"
  16. :value="item.sa_accountclassid">
  17. </el-option>
  18. </el-select> -->
  19. <span>{{scope.column.data.accountname}}</span>
  20. </div>
  21. <div v-else-if="scope.column.columnname == 'creditquota'">
  22. <el-input size="mini" v-if="currentEdit.sa_creditbilldetailid == scope.column.data.sa_creditbilldetailid" v-model="scope.column.data.creditquota"></el-input>
  23. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  24. </div>
  25. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  26. </template>
  27. <template v-slot:opreation="scope">
  28. <el-button v-if="currentEdit.sa_creditbilldetailid == scope.data.sa_creditbilldetailid || scope.data.sa_creditbilldetailid == 0" type="text" size="mini" @click="save(scope.data)" class="inline-16">保 存</el-button>
  29. <slot name="edit" :data="scope.data" v-else></slot>
  30. <slot name="del" :data="scope.data"></slot>
  31. </template>
  32. </tableLayout>
  33. </div>
  34. <div style="margin-top:16px;text-align:right">
  35. <el-pagination
  36. background
  37. small
  38. @size-change="handleSizeChange"
  39. @current-change="handleCurrentChange"
  40. :current-page="params.content.pageNumber"
  41. :page-size="params.content.pageSize"
  42. layout="total, prev, pager, next, jumper"
  43. :total="total">
  44. </el-pagination>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. export default {
  50. props:['disabled'],
  51. components: {},
  52. name: '',
  53. data() {
  54. return {
  55. list:[],
  56. params: {
  57. "id": 20230104100903,
  58. "content": {
  59. "sa_creditbillid":'',
  60. "pageNumber": 1,
  61. "pageSize": 20,
  62. "where": {
  63. "condition": ""
  64. }
  65. },
  66. },
  67. accountParam: {
  68. "id": "20221008164203",
  69. "version":1,
  70. "content": {
  71. "sys_enterpriseid":'',
  72. "sa_creditbillid":this.$route.query.id
  73. }
  74. },
  75. tablecols:[],
  76. total:0,
  77. currentEdit:{},
  78. accountList:[]
  79. };
  80. },
  81. computed:{
  82. },
  83. watch:{
  84. },
  85. created () {
  86. this.listData()
  87. this.tablecols = this.tool.tabelCol(this.$route.name).enterpriseInfoTable.tablecols
  88. },
  89. methods: {
  90. async listData(){
  91. this.params.content.sa_creditbillid = this.$route.query.id
  92. const res = await this.$api.requested(this.params)
  93. this.list = res.data
  94. this.total = res.total
  95. console.log(this.list);
  96. },
  97. // accountSelect (data) {
  98. // console.log(data);
  99. // data.sa_accountclassid = ''
  100. // this.accountParam.content.sys_enterpriseid=data.sys_enterpriseid
  101. // this.getAccountList(data)
  102. // },
  103. async getAccountList (data) {
  104. this.accountParam.content.sa_creditbillid = data.sa_creditbillid
  105. let res = await this.$api.requested(this.accountParam)
  106. this.accountList = res.data
  107. console.log(this.accountList);
  108. },
  109. handleChange(num) {
  110. },
  111. async save (data) {
  112. // if (!data.sa_accountclassid) return this.$message({
  113. // type:'warning',
  114. // message:'请选择账户类型'
  115. // })
  116. // console.log(typeof data.creditquota);
  117. if (typeof +data.creditquota != 'number') return this.$message({
  118. type:'warning',
  119. message:'信用额度是数字类型'
  120. })
  121. let res = await this.$api.requested({
  122. "id": 20230104100203,
  123. "content": {
  124. "sa_creditbillid": this.$route.query.id,
  125. "enterpriseinfos": [
  126. {
  127. "sa_creditbilldetailid":data.sa_creditbilldetailid,
  128. "sys_enterpriseid":data.sys_enterpriseid,
  129. "sa_accountclassid":data.sa_accountclassid,
  130. "creditquota":data.creditquota
  131. },
  132. ]
  133. },
  134. })
  135. this.tool.showMessage(res,() => {
  136. this.currentEdit = ''
  137. this.$emit('onSuccess')
  138. this.listData()
  139. })
  140. },
  141. handleSizeChange(val) {
  142. // console.log(`每页 ${val} 条`);
  143. this.params.content.pageSize = val
  144. },
  145. handleCurrentChange(val) {
  146. // console.log(`当前页: ${val}`);
  147. this.params.content.pageNumber = val
  148. },
  149. },
  150. };
  151. </script>
  152. <style scoped>
  153. </style>