You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
6.1 KiB

3 years ago
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增详情' : '编辑详情'" :form="form"
3 years ago
:rules="rules" @submit="submit">
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>详情名称
</div>
<div class="xy-table-item-content">
<el-input v-model="form.name" placeholder="请输入详情名称" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:key>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>详情编码
</div>
<div class="xy-table-item-content">
<el-input v-model="form.key" placeholder="请输入详情编码" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:value>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>详情内容
</div>
<div class="xy-table-item-content">
<el-input :autosize="{minRows:2}" type="textarea" v-model="form.value" placeholder="请输入详情内容" clearable
style="width: 300px;"></el-input>
<!-- <el-input v-model="form.value" placeholder="请输入详情内容" clearable style="width: 300px;"></el-input> -->
</div>
</div>
</template>
<!-- <template v-slot:studyName>
3 years ago
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>访客开放时间
</div>
<div class="xy-table-item-content">
<el-input v-model="form.studyName" placeholder="请输入访客开放时间" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:studyName1>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>随访人员最大数量
</div>
<div class="xy-table-item-content">
<el-input v-model="form.studyName1" type="number" placeholder="请输入随访人员最大数量" clearable style=""></el-input>
</div>
</div>
</template>
<template v-slot:studyName2>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>单次预约可进车辆数量
</div>
<div class="xy-table-item-content">
<el-input v-model="form.studyName2" type="number" placeholder="请输入单次预约可进车辆数量" clearable style=""></el-input>
</div>
</div>
</template>
<template v-slot:recommend>
<div class="xy-table-item">
<div class="xy-table-item-label">
普通访客须知
</div>
<div class="xy-table-item-content">
<el-input :autosize="{minRows:2}" type="textarea" v-model="form.recommend" placeholder="请输入学习内容" clearable
style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:recommend1>
<div class="xy-table-item">
<div class="xy-table-item-label">
施工访客须知
</div>
<div class="xy-table-item-content">
<el-input :autosize="{minRows:2}" type="textarea" v-model="form.recommend1" placeholder="请输入学习内容" clearable
style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:recommend2>
<div class="xy-table-item">
<div class="xy-table-item-label">
物流访客须知
</div>
<div class="xy-table-item-content">
<el-input :autosize="{minRows:2}" type="textarea" v-model="form.recommend2" placeholder="请输入学习内容" clearable
style="width: 300px;"></el-input>
</div>
</div>
3 years ago
</template> -->
3 years ago
</xy-dialog>
</div>
</template>
<script>
import {
show,
save
} from "@/api/resource/bd.js"
export default {
components: {},
data() {
return {
isShow: false,
type: 'add',
id: '',
form: {
3 years ago
name:"",
key:"",
value:''
3 years ago
},
rules:{
3 years ago
name:[{
required: true,
message: '请输入详情名称'
}],
key:[{
required: true,
message: '请输入详情编码'
}],
value:[{
required: true,
message: '请输入详情内容'
}]
3 years ago
}
}
},
created() {
},
methods: {
async getDetail() {
const res = await show({
id: this.id
})
this.form = {
}
},
submit() {
3 years ago
let that = this
if (this.type === 'editor') {
this.form.id = this.id
}else{
this.form.id = ""
}
save({
...that.form
}).then(res => {
this.$successMessage(this.type, '详情')
this.isShow = false
this.$emit('refresh')
})
3 years ago
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.$refs['dialog'].reset()
}
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label {
width: 160px;
}
.img__delete {
transform: scale(0.8, 0.8);
position: absolute;
top: 4px;
right: 4px;
}
</style>