<!-- 保存页面 -->
<template>
<el-dialog title="轮播_图片信息表信息" :visible.sync="visiable" width="70%">
<el-form ref="form" :rules="rules" :model="formData" label-width="100px" label-position="right">
<el-form-item label="轮播分类:" prop="sliderType">
<el-input placeholder="轮播分类" v-model="formData.sliderType"></el-input>
</el-form-item>
<el-form-item label="图片名称:" prop="picName">
<el-input placeholder="图片名称" v-model="formData.picName"></el-input>
</el-form-item>
<el-form-item label="图片地址:" prop="picAddress">
<el-input placeholder="图片地址" v-model="formData.picAddress"></el-input>
</el-form-item>
<el-form-item label="图片简述:" prop="picAbstract">
<el-input placeholder="图片简述" v-model="formData.picAbstract"></el-input>
</el-form-item>
<el-form-item label="图片顺序:" prop="picOrder">
<el-input placeholder="图片顺序" v-model="formData.picOrder"></el-input>
</el-form-item>
<el-form-item label="是否链接:" prop="whetherLink">
<el-select v-model="formData.whetherLink" placeholder="请选择活动区域">
<el-option label="是" value="是"></el-option>
<el-option label="否" value="否"></el-option>
</el-select>
</el-form-item>
<el-form-item label="链接地址:" prop="linkAddress">
<el-input placeholder="链接地址" v-model="formData.linkAddress"></el-input>
</el-form-item>
<el-form-item label="修改人ID:" prop="modifyUserId">
<el-input placeholder="修改人ID" v-model="formData.modifyUserId"></el-input>
</el-form-item>
<el-form-item label="修改人:" prop="modifyUserName">
<el-input placeholder="修改人" v-model="formData.modifyUserName"></el-input>
</el-form-item>
<el-form-item label="创建时间:" prop="createTime">
<div class="block">
<span class="demonstration">默认</span>
<el-date-picker v-model="formData.createTime" type="datetime" placeholder="选择日期时间"></el-date-picker>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button round @click="visiable = false">取消</el-button>
<el-button round type="primary" @click="saveInfo('form')">保存</el-button>
</span>
</el-dialog>
</template>
<script>
import fetch from "@/utils/fetch.js";
import { Message } from "element-ui";
export default {
data() {
return {
formData: {
picState: "",
sliderType: "",
picName: "",
picAddress: "",
picState: "1",
picAbstract: "",
picOrder: "",
whetherLink: "",
linkAddress: "",
createUserId: "",
createUserName: "",
createTime: "",
visiable: false,
rules: {},
tableData: [],
picState: "1",
conf: {
parameters: {},
dir: "asc",
sort: "id",
page: "1",
size: "10"
}
},
conf: {
parameters: {},
dir: "asc",
sort: "id",
page: "1",
size: "10"
},
pickerOptions: {
shortcuts: [
{
text: "今天",
onClick(picker) {
picker.$emit("pick", new Date());
}
},
{
text: "昨天",
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit("pick", date);
}
},
{
text: "一周前",
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", date);
}
}
]
},
visiable: false,
rules: {}
};
},
methods: {
// 初始化
init(r) {
this.visiable = !this.visiable;
// if (r != null) {
// // 编辑
// this.formData = JSON.parse(JSON.stringify(r));
// } else {
// // 新增
// if (JSON.stringify(this.formData) != "{}") {
// this.formData = {};
// this.$refs.form.resetFields();
// }
// }
},
// 保存信息
saveInfo(formName) {
this.formData.picState = 1;
this.$refs[formName].validate(valid => {
if (valid) {
fetch
.post("/api/assliderinfo/save", this.formData)
.then(res => {
if (res.code == "0") {
Message({
message: res.msg,
type: "success",
duration: 3 * 1000
});
this.$refs[formName].resetFields();
this.formData = {};
this.visiable = false;
this.$emit("loadData");
} else {
Message({
message: res.msg,
type: "error",
duration: 3 * 1000
});
}
})
.catch(error => {
console.log(error);
});
}
});
}
}
};
</script>
<style scoped>
</style>