edit.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div>
  3. <el-button size="mini" type="text" @click="onShow(dialogFormVisible = true)">{{$t(`编辑`)}}</el-button>
  4. <el-drawer
  5. :title="$t(`编辑优势劣势`)"
  6. :visible.sync="dialogFormVisible"
  7. size="600px"
  8. direction="rtl"
  9. :show-close="false"
  10. append-to-body
  11. @close="onCancel">
  12. <div class="drawer__panel">
  13. <el-row :gutter="20">
  14. <el-form :model="form" ref="form" size="mini" label-position="right" :label-width="tool.onlyZh('75px')">
  15. <el-col :span="24">
  16. <el-form-item :label="$t(`优势信息`)+':'" >
  17. <el-input type="textarea" rows="5" v-model="form.advantage" :placeholder="$t(`请输入优势信息`)"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="24">
  21. <el-form-item :label="$t(`劣势信息`)+':'" >
  22. <el-input type="textarea" rows="5" v-model="form.inferiority" :placeholder="$t(`请输入劣势信息`)"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. </el-form>
  26. </el-row>
  27. </div>
  28. <div class="fixed__btn__panel">
  29. <el-button size="small" @click="onCancel" class="normal-btn-width inline-16">{{$t('取 消')}}</el-button>
  30. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">{{$t('确 定')}}</el-button>
  31. </div>
  32. </el-drawer>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. name: "edit",
  38. props:['data'],
  39. data(){
  40. return {
  41. dialogFormVisible:false,
  42. form:{
  43. "sa_competitorid": this.$route.query.id,
  44. "sa_competitor_advid": 0,
  45. "inferiority": "",
  46. "advantage": "",
  47. "isdefault": 1
  48. }
  49. }
  50. },
  51. methods:{
  52. onShow(){
  53. this.form = Object.assign({}, this.form, this.data)
  54. },
  55. async onSubmit(){
  56. const res = await this.$api.requested({
  57. "content": this.form,
  58. "id": 2025031809205102,
  59. })
  60. this.tool.showMessage(res,()=>{
  61. this.onCancel()
  62. })
  63. },
  64. onCancel(){
  65. this.dialogFormVisible = false
  66. this.form.inferiority = ''
  67. this.form.advantage = ''
  68. this.$emit('editSuccess')
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped>
  74. </style>