黑名单、须知接口联调

main
xuechunyuan 3 years ago
parent c799adfcc8
commit 8f84222d47
  1. 20
      src/api/articlelist/article.js
  2. 23
      src/api/blacklist/blacklist.js
  3. 86
      src/views/articlelist/index.vue
  4. 27
      src/views/blacklist/index.vue

@ -40,6 +40,7 @@ export const getNotice = (id) => {
}) })
} }
//发布
export const doPublish = (id, publishFlag) => { export const doPublish = (id, publishFlag) => {
return request({ return request({
url: '/api/blade-business/article/publish', url: '/api/blade-business/article/publish',
@ -50,3 +51,22 @@ export const doPublish = (id, publishFlag) => {
} }
}) })
} }
//保存+发布
export const addPublish = (row) => {
return request({
url: '/api/blade-business/article/save-publish',
method: 'post',
data: row
})
}
//根据医院id获取须知
export const queryArticleDetail = (createDept) => {
return request({
url: '/api/blade-business/article/detail-publish',
method: 'get',
params:{
createDept
}
})
};

@ -0,0 +1,23 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
return request({
url: '/api/blade-business/blacklist/page',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const remove = (ids) => {
return request({
url: '/api/blade-business/blacklist/remove',
method: 'post',
params: {
ids,
}
})
}

@ -5,7 +5,7 @@
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
<template slot-scope="{row}" slot="menu"> <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 ? '重新发布' row.publishSta == 1 ? '取消发布' : row.publishSta == 2 ? '重新发布'
: '发布' : '发布'
}} }}
@ -22,14 +22,15 @@
<el-button icon="el-icon-circle-plus-outline" size="small" v-if="type == 'add'" <el-button icon="el-icon-circle-plus-outline" size="small" v-if="type == 'add'"
@click="$refs.crud.rowSave()">保存</el-button> @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 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> </template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
</template> </template>
<script> <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"; import { mapGetters } from "vuex";
export default { export default {
@ -60,7 +61,7 @@ export default {
dialogClickModal: false, dialogClickModal: false,
column: [ column: [
{ {
label: "注意事项标题", label: "预约须知标题",
labelWidth: 120, labelWidth: 120,
prop: "title", prop: "title",
span: 24, span: 24,
@ -69,16 +70,16 @@ export default {
searchLabelWidth: 100, searchLabelWidth: 100,
rules: [{ rules: [{
required: true, required: true,
message: "请输入注意事项标题", message: "请输入预约须知标题",
trigger: "blur" trigger: "blur"
}] }]
}, },
{ {
label: "发布时间", label: "发布时间",
prop: "releaseTimeRange", prop: "releaseTimeRange",
type: "datetime", type: "daterange",
format: "yyyy-MM-dd hh:mm:ss", format: "yyyy-MM-dd",
valueFormat: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd",
searchRange: true, searchRange: true,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
@ -99,8 +100,11 @@ export default {
url: "link", url: "link",
} }
}, },
minRows: 6, minRows: 12,
span: 24, span: 24,
formatter: (val) => {
return decodeURIComponent(val.content);
}
}, },
{ {
label: "状态", label: "状态",
@ -140,7 +144,37 @@ export default {
methods: { methods: {
// //
rowPublish(row) { 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 => { doPublish(row.id, row.publishSta == 1 ? 0 : 1).then(res => {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
@ -164,6 +198,7 @@ export default {
}); });
}, },
rowUpdate(row, index, done, loading) { rowUpdate(row, index, done, loading) {
row.content = encodeURIComponent(row.content);
add(row).then(() => { add(row).then(() => {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
@ -176,6 +211,34 @@ export default {
loading(); 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) { rowDel(row) {
this.$confirm("确定将选择数据删除?", { this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定", confirmButtonText: "确定",
@ -235,6 +298,7 @@ export default {
beforeOpen(done, type) { beforeOpen(done, type) {
if (["edit", "view"].includes(type)) { if (["edit", "view"].includes(type)) {
getNotice(this.form.id).then(res => { getNotice(this.form.id).then(res => {
res.data.data.content = decodeURIComponent(res.data.data.content);
this.form = res.data.data; this.form = res.data.data;
}); });
} }
@ -250,7 +314,7 @@ export default {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
console.log(this.userInfo) // console.log(this.userInfo)
const { releaseTimeRange, title } = this.query; const { releaseTimeRange, title } = this.query;
let values = { let values = {
...params, ...params,

@ -16,7 +16,7 @@
</template> </template>
<script> <script>
import { getList, remove, update, add, getNotice } from "@/api/desk/notice"; import { getList, remove } from "@/api/blacklist/blacklist";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
export default { export default {
@ -50,19 +50,30 @@ export default {
}, },
{ {
label: "身份证号码", label: "身份证号码",
prop: "releaseTimeRange", prop: "cupCardNo",
search: true,
searchLabelWidth:100
}, },
{ {
label: "联系方式", label: "联系方式",
prop: "content", prop: "content",
}, },
{
label: "预约时间",
prop: "releaseTime",
type: "daterange",
format: "yyyy-MM-dd",
valueFormat: "yyyy-MM-dd",
searchRange: true,
search: true,
hide: true,
},
{ {
label: "预约时间", label: "预约时间",
prop: "releaseTime", prop: "releaseTime",
type: "date", type: "date",
format: "yyyy-MM-dd hh:mm:ss", format: "yyyy-MM-dd hh:mm:ss",
valueFormat: "yyyy-MM-dd hh:mm:ss", valueFormat: "yyyy-MM-dd hh:mm:ss",
search: true
}, },
{ {
label: "状态", label: "状态",
@ -156,7 +167,7 @@ export default {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
onLoad(page, params = {}) { onLoad(page, params = {}) {
const { releaseTimeRange } = this.query; const { releaseTimeRange, cupCardNo } = this.query;
let values = { let values = {
...params, ...params,
...this.query ...this.query
@ -164,11 +175,15 @@ export default {
if (releaseTimeRange) { if (releaseTimeRange) {
values = { values = {
...values, ...values,
releaseTime_datege: releaseTimeRange[0], startTime: releaseTimeRange[0],
releaseTime_datelt: releaseTimeRange[1], endTime: releaseTimeRange[1],
}; };
values.releaseTimeRange = null; values.releaseTimeRange = null;
} else {
values.startTime = '';
values.endTime = '';
} }
values.cupCardNo = cupCardNo ? cupCardNo : '';
this.loading = true; this.loading = true;
getList(page.currentPage, page.pageSize, values).then(res => { getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data; const data = res.data.data;

Loading…
Cancel
Save