ref="list" :column="column" :search="search" :button="button" :add="add" :type="'multipleTable'" >
import fetch from "@/utils/fetch.js";
import { Message } from "element-ui";
import list from "list";
export default {
components: {
list
},
data() {
return {
conf: {
parameters: {
keyWord: ""
},
dir: "desc",
sort: "id"
},
search: [
{
name: "查询内容",
searchType: "input",
type: "keyWord"
}
],
column: [
{ name: "分类", type: "typeName", width: "150", sortable: false },
{
name: "文章标题",
type: "articlesTitle",
align: "left",
sortable: false
},
{
name: "文章作者",
type: "articlesAuthor",
width: "150",
sortable: false
},
{
name: "发表日期",
type: "publishDate ",
width: "150",
sortable: false,
render: this.dateFormat
},
{
name: "文章状态",
type: "articlesState",
width: "100",
sortable: false,
render: function(r) {
return r.articlesState == "1" ? "有效" : "已作废";
}
}
],
button: [
{
name: "编辑",
type: "warning",
click: this.editInfo
},
{
name: "删除",
type: "danger",
click: this.deleteInfo
},
{
name: "查看",
type: "primary",
click: this.viewInfo
}
],
add: {
name: "添加",
type: "primary",
click: this.add
},
form: {
name: "",
region: "",
date1: "",
date2: "",
delivery: false,
type: [],
resource: "",
desc: ""
},
formLabelWidth: "120px",
dialogFormVisible: false
};
},
mounted() {
this.loadData();
},
methods: {
loadData() {
this.$refs.list.loadData("/api/asarticlesinfo", this.conf);
},
add() {
this.dialogFormVisible = true;
},
addInfo(){
if(form.title){
var path = this.getPath(form.title);
console.log(path);
fetch.post("/api/asarticlesinfo/save").then(res => {
if ((res.code = "0")) {
Message({
message: "操作成功",
type: "success",
duration: 3 * 1000
});
this.load();
} else {
Message({
message: res.msg,
type: "error",
duration: 5 * 1000
});
}
});
}
},
deleteInfo(e) {
alert("delete");
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true
})
.then(() => {
this.$message({
type: "success",
message: "删除成功!"
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
},
editInfo(e) {
alert("edit");
},
viewInfo(e) {
alert("view");
},
dateFormat(r) {
return this.$moment(r.publishDate).format("YYYY-MM-DD");
}
}
};