|
@@ -0,0 +1,116 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-dialog
|
|
|
+ v-loading="loading"
|
|
|
+ :show-close="false"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="isShow"
|
|
|
+ :title="curObj.id ? '编辑房源' : '新增房源'"
|
|
|
+ :fullscreen="false"
|
|
|
+ width="760px"
|
|
|
+ custom-class="xl-dialog"
|
|
|
+ center
|
|
|
+ >
|
|
|
+ <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
|
|
|
+ <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </base-form>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { arrToObj } from '@/utils'
|
|
|
+export default {
|
|
|
+ components: { },
|
|
|
+ mixins,
|
|
|
+ props: {
|
|
|
+ isShow: Boolean,
|
|
|
+ curObj: Object
|
|
|
+ },
|
|
|
+ inject: ['parentData'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ formData: [],
|
|
|
+ cObj: {},
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isShow: function(val) {
|
|
|
+ if (val) {
|
|
|
+ if (this.curObj.id) {
|
|
|
+ this.$api.other.admchannelsdetail({id: this.curObj.id}).then(res => {
|
|
|
+ this.cObj = res || {}
|
|
|
+ this.getDef()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.getDef()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getDef (str) {
|
|
|
+ let params = {}
|
|
|
+ params = { ...this.cObj }
|
|
|
+ if (str === 'edit') {
|
|
|
+ params = {...this.$refs.ruleForm.baseForm, ...params}
|
|
|
+ }
|
|
|
+ this.formData = [
|
|
|
+ { label: '发布时间', key: 'publish_at', type: 'datePicker', type2: 'date'},
|
|
|
+ { label: '标题', key: 'title'},
|
|
|
+ { label: '视频分类', key: 'channels_type', class: 'c-2', type: 'select', options: this.$dictData.channels_type},
|
|
|
+ { label: '状态', key: 'hide_status', class: 'c-2', type: 'select', options: this.$dictData.hide_status},
|
|
|
+ { label: '封面图', key: 'cover', class: 'c-2', type: 'cuImg',
|
|
|
+ options: {
|
|
|
+ w: 375,
|
|
|
+ h: 250,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { label: '自定义标签', class: 'c-2', key: 'custom_tag', type: 'textarea' },
|
|
|
+ { label: '视频ID', key: 'feed_id', type: 'textarea' },
|
|
|
+ ]
|
|
|
+ this.setDefaultValue(params)
|
|
|
+ },
|
|
|
+ close (str) {
|
|
|
+ if (str === 'confirm') {
|
|
|
+ this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ const newForm = { ...oldform }
|
|
|
+ if (this.curObj.id) newForm.id = this.curObj.id
|
|
|
+ newForm.custom_tag = newForm.custom_tag.replace(/,|、|\/|\\/g, ',')
|
|
|
+ let apiStr = 'admchannelsadd'
|
|
|
+ if (this.curObj.id) apiStr = 'admchannelsedit'
|
|
|
+ this.$api.other[apiStr](newForm).then(data => {
|
|
|
+ this.$msgs(newForm.id ? '编辑成功' : '新增成功')
|
|
|
+ this.cObj = {}
|
|
|
+ this.$emit('close', newForm)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$emit('close')
|
|
|
+ this.cObj = {}
|
|
|
+ this.setDefaultValue()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import '../../../../styles/libEdit.scss';
|
|
|
+.lib-edit {
|
|
|
+ padding-top: 0;
|
|
|
+ padding-left: 0;
|
|
|
+ padding-bottom: 40px;
|
|
|
+ ::v-deep .el-form-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ ::v-deep .el-date-editor.el-input {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|