VisaCommission.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="VisaCommission-all">
  3. <div class="VisaCommission-hand">
  4. <el-select v-model="DiId" placeholder="团组选择" clearable filterable @change="groupchange"
  5. style="width: 250px;">
  6. <el-option v-for="item in groupInfoList" :key="item.id" :label="item.groupName"
  7. :value="item.id">
  8. </el-option>
  9. </el-select>
  10. <el-button @click="preserve" type="primary">保存</el-button>
  11. </div>
  12. <!-- <div class="VisaCommission-tjyh">
  13. <el-button @click="vctjyh" type="primary">添加一行</el-button>
  14. </div> -->
  15. <div class="VisaCommission-table">
  16. <el-table
  17. :data="tableData"
  18. border
  19. style="width: 100%">
  20. <el-table-column
  21. label="国家"
  22. width="200">
  23. <template slot-scope="scope">
  24. <el-autocomplete
  25. class="inline-input"
  26. v-model="scope.row.country"
  27. :fetch-suggestions="querySearch"
  28. @select="handleSelect(scope.row,$event,scope.$index)"
  29. ></el-autocomplete>
  30. </template>
  31. </el-table-column>
  32. <el-table-column
  33. label="签证办理数量"
  34. width="180">
  35. <template slot-scope="scope">
  36. <el-input-number style="width:100px" v-model="scope.row.quantity" :controls='false'>
  37. </el-input-number>
  38. </template>
  39. </el-table-column>
  40. <el-table-column
  41. label="备注">
  42. <template slot-scope="scope">
  43. <el-input
  44. type="text"
  45. placeholder="请输入内容"
  46. v-model="scope.row.remark"
  47. show-word-limit
  48. >
  49. </el-input>
  50. </template>
  51. </el-table-column>
  52. <!-- <el-table-column
  53. label="操作"
  54. width="200">
  55. </el-table-column> -->
  56. </el-table>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. export default {
  62. data() {
  63. return {
  64. userId:'',
  65. DiId:'',
  66. groupInfoList:[],
  67. tableData: [],
  68. restaurants: [],
  69. }
  70. },
  71. methods:{
  72. //获取分类
  73. VisaCommissionInit() {
  74. var url = "/api/Groups/VisaCommissionInit"
  75. var that = this
  76. this.$axios({
  77. method: 'get',
  78. url: url,
  79. headers: {
  80. Authorization: 'Bearer '
  81. },
  82. }).then(function (res) {
  83. if (res.data.code == 200) {
  84. that.groupInfoList=res.data.data.groupData;
  85. if (that.DiId=="") {
  86. that.DiId=that.groupInfoList[0].id;
  87. }
  88. that.VisaCommissionItem();
  89. }else{
  90. that.$message.error(res.data.msg);
  91. }
  92. })
  93. },
  94. //查询提成list
  95. VisaCommissionItem() {
  96. var url = "/api/Groups/VisaCommissionItem"
  97. var that = this
  98. this.$axios({
  99. method: 'post',
  100. url: url,
  101. headers: {
  102. Authorization: 'Bearer '
  103. },
  104. data:{
  105. portType:1,
  106. currUserId:that.userId,
  107. diId:that.DiId,
  108. }
  109. }).then(function (res) {
  110. if (res.data.code == 200) {
  111. var dataarr=res.data.data;
  112. that.tableData=dataarr;
  113. that.restaurants = dataarr.map((terminal) => {
  114. return {
  115. value: terminal.country,
  116. id: terminal.id,
  117. quantity: terminal.quantity,
  118. remark: terminal.remark,
  119. };
  120. });
  121. console.log(that.restaurants);
  122. }else{
  123. that.$message.error(res.data.msg);
  124. }
  125. })
  126. },
  127. //团组切换
  128. groupchange(){
  129. this.VisaCommissionItem()
  130. },
  131. //添加一行
  132. vctjyh(){
  133. var newtblist={
  134. country: "",
  135. id: 0,
  136. quantity: 0,
  137. remark: ""
  138. }
  139. this.tableData.push(newtblist)
  140. },
  141. //保存
  142. preserve(){
  143. for(let j=0;j<this.tableData.length;j++){
  144. this.tableData[j].currUserId=this.userId;
  145. this.tableData[j].diId=this.DiId;
  146. }
  147. // console.log(this.tableData);
  148. this.VisaCommissionSave(this.tableData)
  149. },
  150. //保存api
  151. VisaCommissionSave(val) {
  152. var url = "/api/Groups/VisaCommissionSave"
  153. var that = this
  154. this.$axios({
  155. method: 'post',
  156. url: url,
  157. headers: {
  158. Authorization: 'Bearer '
  159. },
  160. data:{
  161. items:val
  162. }
  163. }).then(function (res) {
  164. if (res.data.code == 200) {
  165. that.$message({
  166. message: res.data.msg,
  167. type: 'success',
  168. offset: 50
  169. });
  170. }else{
  171. that.$message.error(res.data.msg);
  172. }
  173. })
  174. },
  175. querySearch(queryString, cb) {
  176. var restaurants = this.restaurants;
  177. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  178. // 调用 callback 返回建议列表的数据
  179. cb(results);
  180. },
  181. createFilter(queryString) {
  182. return (restaurant) => {
  183. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  184. };
  185. },
  186. handleSelect(row,evet,index) {
  187. row.quantity=evet.quantity;
  188. row.remark=evet.remark;
  189. }
  190. },
  191. mounted(){
  192. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  193. this.VisaCommissionInit()
  194. }
  195. }
  196. </script>
  197. <style>
  198. .VisaCommission-all {
  199. background-color: #fff;
  200. padding: 10px;
  201. box-shadow: 0 0 5px #0005;
  202. border-radius: 10px;
  203. min-height: 830px;
  204. }
  205. .VisaCommission-hand{
  206. display: flex;
  207. justify-content: space-between;
  208. }
  209. .VisaCommission-tjyh{
  210. text-align: right;
  211. margin-top: 10px;
  212. }
  213. .VisaCommission-table{
  214. margin-top: 10px;
  215. }
  216. </style>