企微助手 ,仓库名 短剧

addPitcher.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div v-loading="loading">
  3. <div class="dialogCon">
  4. <div class="itemBox">
  5. <div class="name"><em>*</em>短剧:</div>
  6. <self-channel title="" width="250px" type='dramaList' :afferent_value='drama_id' @channelDefine="(val)=>{drama_id = val;}"></self-channel>
  7. </div>
  8. <div class="itemBox">
  9. <div class="name"><em>*</em>选择投手:</div>
  10. <self-channel title="" width="250px" type='pitcher' :afferent_value='user_id' :afferent_params="{user_id:''}" @channelDefine="(val)=>{user_id = val;}"></self-channel>
  11. </div>
  12. <div class="itemBox">
  13. <div class="name"><em>*</em>起止时间:</div>
  14. <date-picker title="" width="250px" @changeTime="changeTime" :pickerOptions='{}' :afferent_time='time'></date-picker>
  15. </div>
  16. <div class="itemBox" style="margin-top:15px" v-if="editPitcher">
  17. <div class="name"><em>*</em>是否启用:</div>
  18. <el-switch v-model="enable" active-color="#43B083" inactive-color="#ccc"></el-switch>
  19. </div>
  20. </div>
  21. <div slot="footer" class="dialog-footer">
  22. <el-button size="mini" @click="$emit('returnAddPitcher')">取 消</el-button>
  23. <el-button size="mini" type="primary" @click="submitEvent">确 定</el-button>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import selfChannel from '@/components/assembly/screen/channel.vue'
  29. import datePicker from '@/components/assembly/screen/datePicker.vue'
  30. export default {
  31. props: ['gzhData', 'editPitcher'],
  32. components: {
  33. selfChannel,
  34. datePicker
  35. },
  36. data () {
  37. return {
  38. drama_id: '',
  39. user_id: '',
  40. time: [],
  41. loading: false,
  42. enable: true
  43. }
  44. },
  45. created () {
  46. if (this.editPitcher) {
  47. this.drama_id = this.editPitcher.drama_id ? this.editPitcher.drama_id : '';
  48. this.user_id = this.editPitcher.user_id ? this.editPitcher.user_id : '';
  49. this.time = this.editPitcher.start_date && this.editPitcher.end_date ? [this.editPitcher.start_date, this.editPitcher.end_date] : [];
  50. this.enable = this.editPitcher.enable == 1 ? true : false
  51. }
  52. },
  53. methods: {
  54. changeTime (time) {//筛选时间变化
  55. if (!time || time && time.length == 0) {
  56. this.time = []
  57. } else {
  58. this.time = time;
  59. }
  60. },
  61. async submitEvent () {
  62. if (this.drama_id == '') {
  63. this.$message({
  64. message: '请选择短剧',
  65. type: "warning"
  66. })
  67. return
  68. }
  69. if (this.user_id == '') {
  70. this.$message({
  71. message: '请选择投手',
  72. type: "warning"
  73. })
  74. return
  75. }
  76. if (!this.time || this.time == '' || this.time.length == 0) {
  77. this.$message({
  78. message: '请选择起止时间',
  79. type: "warning"
  80. })
  81. return
  82. }
  83. this.loading = true
  84. console.log('this.gzhData => ', JSON.parse(JSON.stringify(this.gzhData)))
  85. let axios_api = this.URL.adqAccount_adqBindPitcher
  86. let params = {
  87. drama_id: this.drama_id,
  88. user_id: this.user_id,
  89. start_date: this.time[0],
  90. end_date: this.time[1]
  91. }
  92. if (this.editPitcher && this.editPitcher.drama_id) {
  93. axios_api = this.URL.adqAccount_adqEditPitcher
  94. params.rela_id = this.editPitcher.rela_id
  95. params.enable = this.enable ? 1 : 0
  96. } else {
  97. params.account_id = this.gzhData.account_id
  98. }
  99. try {
  100. console.log('params => ', JSON.parse(JSON.stringify(params)))
  101. console.log('axios_api => ', axios_api)
  102. const { data: res = {} } = await this.$axios.post(this.URL.BASEURL + axios_api, params)
  103. this.loading = false
  104. if (res && res.errno == 0) {
  105. this.$message.success('操作成功')
  106. this.$emit('returnAddPitcher', 'update')
  107. } else if (res.errno != 4002) {
  108. this.$message.warning(res.err)
  109. }
  110. } catch (error) {
  111. console.log('error => ', error)
  112. } finally {
  113. this.loading = false
  114. }
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .dialogCon {
  121. .itemBox {
  122. display: flex;
  123. align-items: center;
  124. margin-bottom: 10px;
  125. .name {
  126. width: 90px;
  127. flex-wrap: nowrap;
  128. em {
  129. color: red;
  130. }
  131. }
  132. }
  133. }
  134. .dialog-footer {
  135. text-align: center;
  136. margin-top: 30px;
  137. }
  138. </style>