addOrder.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" :disabled="disabled" @click="addBtn">添 加</el-button>
  4. <el-drawer append-to-body :visible.sync="dialogFormVisible" size="60%">
  5. <div slot="title" style="font-size: 15px">
  6. 添加订单
  7. </div>
  8. <div class="drawer__panel">
  9. <el-input style="width:250px;margin-bottom:10px" size="small" placeholder="请输入搜索内容" clearable @clear="getOrderList(params.content.pageNumber=1)" v-model="params.content.where.condition" @keyup.enter.native="getOrderList(params.content.pageNumber=1)"></el-input>
  10. <selectOrder v-if="dialogFormVisible" idName="sa_orderitemsid" ref="table" v-model="result" :layout="tablecols" :data="orderList" :custom="true" height="500px" @upDateData="upDateData">
  11. <template v-slot:customcol="scope">
  12. <div>{{scope.column.data[scope.column.columnname]}}</div>
  13. </template>
  14. </selectOrder>
  15. <div class="container normal-panel" style="text-align:right">
  16. <el-pagination
  17. style="text-align:right"
  18. background
  19. small
  20. @size-change="handleSizeChange"
  21. @current-change="handleCurrentChange"
  22. :current-page="params.content.pageNumber"
  23. :page-sizes="[20, 50, 100, 200]"
  24. layout="total,sizes, prev, pager, next, jumper"
  25. :total="total">
  26. </el-pagination>
  27. </div>
  28. </div>
  29. <div class="fixed__btn__panel">
  30. <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
  31. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
  32. </div>
  33. </el-drawer>
  34. </div>
  35. </template>
  36. <script>
  37. import selectOrder from './selectOrder'
  38. export default {
  39. name: "add",
  40. props:['data','disabled'],
  41. components:{selectOrder},
  42. data(){
  43. return {
  44. result:[],
  45. dialogFormVisible:false,
  46. orderList:[],
  47. tablecols:[],
  48. total:0,
  49. params: {
  50. "id": 20221124091104,
  51. "content": {
  52. "pageNumber": 1,
  53. "pageSize": 20,
  54. "sys_enterpriseid":'',
  55. "sa_accountclassid":'',
  56. "sa_writeoffbillid":'',
  57. "where": {
  58. "condition": ""
  59. }
  60. }
  61. }
  62. }
  63. },
  64. created () {
  65. this.getOrderList()
  66. this.tablecols = this.tool.tabelCol(this.$route.name).addOrderTable.tablecols
  67. },
  68. watch: {
  69. dialogFormVisible (val) {
  70. if(!val) {
  71. this.$refs.table.allArr = []
  72. }
  73. }
  74. },
  75. methods:{
  76. addBtn () {
  77. this.dialogFormVisible = true
  78. this.getOrderList()
  79. },
  80. async onSubmit(){
  81. let result = this.$refs.table.allArr.map(item => {
  82. return {
  83. "sa_writeoffbill_orderid": 0,
  84. "sa_orderid":item.sa_orderid,
  85. "sa_orderitemsid":item.sa_orderitemsid,
  86. "writeoffamount":0,
  87. "remarks":""
  88. }
  89. })
  90. const res = await this.$api.requested({
  91. "id": "20221124090904",
  92. "version":1,
  93. "content": {
  94. sa_writeoffbillid:this.$route.query.id,
  95. writeoffbillOrder:result
  96. }
  97. })
  98. this.tool.showMessage(res,()=>{
  99. this.$emit('onSuccess')
  100. this.dialogFormVisible = false
  101. })
  102. },
  103. async getOrderList () {
  104. this.params.content.sys_enterpriseid = this.data.sys_enterpriseid
  105. this.params.content.sa_accountclassid = this.data.sa_accountclassid
  106. this.params.content.sa_writeoffbillid = this.$route.query.id
  107. let res = await this.$api.requested(this.params)
  108. this.orderList = res.data
  109. this.total = res.total
  110. console.log(res);
  111. },
  112. upDateData (data) {
  113. },
  114. handleSizeChange(val) {
  115. // console.log(`每页 ${val} 条`);
  116. this.params.content.pageSize = val
  117. this.getOrderList()
  118. },
  119. handleCurrentChange(val) {
  120. // console.log(`当前页: ${val}`);
  121. this.params.content.pageNumber = val
  122. this.getOrderList()
  123. },
  124. }
  125. }
  126. </script>
  127. <style scoped>
  128. .dialog-footer {
  129. margin-top: 0;
  130. }
  131. .el-select {
  132. width: 100%;
  133. }
  134. </style>