|
|
|
|
@ -5,7 +5,7 @@ |
|
|
|
|
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
|
|
|
|
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
|
|
|
|
<template slot-scope="{row}" slot="menu"> |
|
|
|
|
<el-button type="text" icon="el-icon-circle-plus-outline" size="small" @click="rowPublish(row)">{{ |
|
|
|
|
<el-button type="text" icon="el-icon-check" size="small" @click="rowPublish(row)">{{ |
|
|
|
|
row.publishSta == 1 ? '取消发布' : row.publishSta == 2 ? '重新发布' |
|
|
|
|
: '发布' |
|
|
|
|
}} |
|
|
|
|
@ -22,14 +22,15 @@ |
|
|
|
|
<el-button icon="el-icon-circle-plus-outline" size="small" v-if="type == 'add'" |
|
|
|
|
@click="$refs.crud.rowSave()">保存</el-button> |
|
|
|
|
<el-button icon="el-icon-edit" size="small" v-if="type == 'edit'" @click="$refs.crud.rowUpdate()">修改</el-button> |
|
|
|
|
<el-button type="primary" icon="el-icon-check" size="small" @click="addPublish()">发布</el-button> |
|
|
|
|
<el-button v-if="type == 'add'" type="primary" icon="el-icon-check" size="small" |
|
|
|
|
@click="addPublish()">发布</el-button> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
</basic-container> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { getList, remove, add, getNotice, doPublish } from "@/api/desk/article"; |
|
|
|
|
import { getList, remove, add, getNotice, doPublish, addPublish, queryArticleDetail } from "@/api/articlelist/article"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
@ -60,7 +61,7 @@ export default { |
|
|
|
|
dialogClickModal: false, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "注意事项标题", |
|
|
|
|
label: "预约须知标题", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
prop: "title", |
|
|
|
|
span: 24, |
|
|
|
|
@ -69,16 +70,16 @@ export default { |
|
|
|
|
searchLabelWidth: 100, |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请输入注意事项标题", |
|
|
|
|
message: "请输入预约须知标题", |
|
|
|
|
trigger: "blur" |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "发布时间", |
|
|
|
|
prop: "releaseTimeRange", |
|
|
|
|
type: "datetime", |
|
|
|
|
format: "yyyy-MM-dd hh:mm:ss", |
|
|
|
|
valueFormat: "yyyy-MM-dd hh:mm:ss", |
|
|
|
|
type: "daterange", |
|
|
|
|
format: "yyyy-MM-dd", |
|
|
|
|
valueFormat: "yyyy-MM-dd", |
|
|
|
|
searchRange: true, |
|
|
|
|
hide: true, |
|
|
|
|
addDisplay: false, |
|
|
|
|
@ -99,8 +100,11 @@ export default { |
|
|
|
|
url: "link", |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
minRows: 6, |
|
|
|
|
minRows: 12, |
|
|
|
|
span: 24, |
|
|
|
|
formatter: (val) => { |
|
|
|
|
return decodeURIComponent(val.content); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "状态", |
|
|
|
|
@ -140,7 +144,37 @@ export default { |
|
|
|
|
methods: { |
|
|
|
|
//发布 |
|
|
|
|
rowPublish(row) { |
|
|
|
|
console.log(row) |
|
|
|
|
this.$confirm("确定" + (row.publishSta == 1 ? "取消发布该条数据吗" : "发布该条数据吗") + "?", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
if (row.publishSta != 1) { |
|
|
|
|
//发布之前判断是否已有发布 |
|
|
|
|
queryArticleDetail(this.userInfo.dept_id).then(res => { |
|
|
|
|
if (JSON.stringify(res.data.data) != '{}') { |
|
|
|
|
//一个医院只可以发布一条 |
|
|
|
|
this.$confirm("只可以发布一条须知,确认发布将会把已发布须知取消发布!", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.doSurePublish(row); |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
this.doSurePublish(row); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
//取消发布不需要限制 |
|
|
|
|
this.doSurePublish(row); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//二次确认发布-取消发布 |
|
|
|
|
doSurePublish(row) { |
|
|
|
|
doPublish(row.id, row.publishSta == 1 ? 0 : 1).then(res => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
@ -164,6 +198,7 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
rowUpdate(row, index, done, loading) { |
|
|
|
|
row.content = encodeURIComponent(row.content); |
|
|
|
|
add(row).then(() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
@ -176,6 +211,34 @@ export default { |
|
|
|
|
loading(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//保存+发布 |
|
|
|
|
addPublish() { |
|
|
|
|
let param = this.form; |
|
|
|
|
param.createDept = this.userInfo.dept_id; |
|
|
|
|
queryArticleDetail(this.userInfo.dept_id).then(res => { |
|
|
|
|
if (JSON.stringify(res.data.data) != '{}') { |
|
|
|
|
//一个医院只可以发布一条 |
|
|
|
|
this.$confirm("只可以发布一条须知,确认发布将会把已发布须知取消发布!", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
addPublish(param).then(() => { |
|
|
|
|
this.$refs.crud.closeDialog(); |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
}, error => { |
|
|
|
|
window.console.log(error); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
rowDel(row) { |
|
|
|
|
this.$confirm("确定将选择数据删除?", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
@ -235,6 +298,7 @@ export default { |
|
|
|
|
beforeOpen(done, type) { |
|
|
|
|
if (["edit", "view"].includes(type)) { |
|
|
|
|
getNotice(this.form.id).then(res => { |
|
|
|
|
res.data.data.content = decodeURIComponent(res.data.data.content); |
|
|
|
|
this.form = res.data.data; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -250,7 +314,7 @@ export default { |
|
|
|
|
this.onLoad(this.page, this.query); |
|
|
|
|
}, |
|
|
|
|
onLoad(page, params = {}) { |
|
|
|
|
console.log(this.userInfo) |
|
|
|
|
// console.log(this.userInfo) |
|
|
|
|
const { releaseTimeRange, title } = this.query; |
|
|
|
|
let values = { |
|
|
|
|
...params, |
|
|
|
|
|