Browse Source

上报管理添加单位、状态,支持手动修改开启关闭状态

newDev
lzp 1 week ago
parent
commit
44df6bee76
  1. 884
      acupuncture-后台/src/views/report/manage.vue

884
acupuncture-后台/src/views/report/manage.vue

@ -1,358 +1,584 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" <el-form
label-width="80px"> :model="queryParams"
<el-form-item label="标题" prop="reportTitle"> ref="queryForm"
<el-input v-model="queryParams.param.reportTitle" placeholder="请输入" clearable size="small"
@keyup.enter.native="handleQuery" /> :inline="true"
</el-form-item> v-show="showSearch"
<el-form-item> label-width="80px"
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-form-item label="标题" prop="reportTitle">
</el-form-item> <el-input
</el-form> v-model="queryParams.param.reportTitle"
<el-row :gutter="10" class="mb8"> placeholder="请输入"
<el-col :span="1.5"> clearable
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> @keyup.enter.native="handleQuery"
</el-col> />
<el-col :span="1.5"> </el-form-item>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" <el-form-item>
@click="handleDelete">删除</el-button> <el-button
</el-col> type="primary"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> icon="el-icon-search"
</el-row> size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange" max-height="600"> <el-table
<el-table-column type="selection" width="55" align="center" /> v-loading="loading"
<el-table-column fixed label="标题" align="center" prop="reportTitle" min-width="100" /> :data="listData"
<el-table-column fixed label="类型" align="center" prop="typeName" show-overflow-tooltip min-width="100"> @selection-change="handleSelectionChange"
</el-table-column> max-height="600"
<el-table-column fixed label="开始时间" align="center" prop="timeRangeStart" show-overflow-tooltip >
min-width="100"> <el-table-column type="selection" width="55" align="center" />
<template slot-scope="scope"> <el-table-column
<span> fixed
{{ parseTime(scope.row.timeRangeStart, "{y}-{m}-{d}") }} label="标题"
</span> align="center"
</template> prop="reportTitle"
</el-table-column> min-width="100"
<el-table-column fixed label="结束时间" align="center" prop="timeRangeEnd" show-overflow-tooltip />
min-width="100"> <el-table-column
<template slot-scope="scope"> fixed
<span> label="类型"
{{ parseTime(scope.row.timeRangeEnd, "{y}-{m}-{d}") }} align="center"
</span> prop="typeName"
</template> show-overflow-tooltip
</el-table-column> min-width="100"
<el-table-column label="状态" align="center" prop="status" show-overflow-tooltip min-width="100"> >
</el-table-column>
<el-table-column
label="单位"
align="center"
prop="tenantIdList"
min-width="250"
show-overflow-tooltip
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.status === 0"> 未开始 </span> <!-- 通过id列表找到tenantsData中匹配的数据并替换为中文数据后面添加逗号 -->
<template v-for="(item, index) in scope.row.tenantIdList">
<template v-if="tenantsData.some((tenant) => tenant.id === item)">
{{ tenantsData.find((tenant) => tenant.id === item).name
}}{{ index < scope.row.tenantIdList.length - 1 ? "," : "" }}
</template>
</template>
</template>
</el-table-column>
<el-table-column
fixed
label="开始时间"
align="center"
prop="timeRangeStart"
show-overflow-tooltip
min-width="100"
>
<template slot-scope="scope">
<span>
{{ parseTime(scope.row.timeRangeStart, "{y}-{m}-{d}") }}
</span>
</template>
</el-table-column>
<el-table-column
fixed
label="结束时间"
align="center"
prop="timeRangeEnd"
show-overflow-tooltip
min-width="100"
>
<template slot-scope="scope">
<span>
{{ parseTime(scope.row.timeRangeEnd, "{y}-{m}-{d}") }}
</span>
</template>
</el-table-column>
<el-table-column
label="状态"
align="center"
prop="status"
show-overflow-tooltip
min-width="100"
>
<template slot-scope="scope">
<span v-if="scope.row.status === 0"> 未开始 </span>
<span v-if="scope.row.status === 1"> 进行中 </span> <span v-if="scope.row.status === 1"> 进行中 </span>
<span v-if="scope.row.status === 2"> 已结束 </span> <span v-if="scope.row.status === 2"> 已结束 </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开启/结束" align="center" prop="typeName" show-overflow-tooltip min-width="100"> <!-- <el-table-column
label="开启/结束"
align="center"
prop="typeName"
show-overflow-tooltip
min-width="100"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-color="#13ce66"
inactive-color="#ff4949"
></el-switch>
</template>
</el-table-column> -->
<el-table-column label="创建人/创建时间" align="center" min-width="140">
<template slot-scope="scope">
<div>{{ scope.row.createBy }}</div>
<span>
{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }}
</span>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch> <el-button
</template> v-if="scope.row.status === 0 || scope.row.status === 2"
</el-table-column> size="mini"
<el-table-column label="创建人/创建时间" align="center" min-width="140"> type="text"
<template slot-scope="scope"> icon="el-icon-folder-checked"
<div>{{scope.row.createBy}}</div> @click="handleSwitch(scope.row, 1)"
<span> >开启</el-button
{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }} >
</span> <el-button
</template> v-if="scope.row.status === 1"
</el-table-column> size="mini"
type="text"
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200"> icon="el-icon-folder-delete"
<template slot-scope="scope"> @click="handleSwitch(scope.row, 2)"
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" >关闭</el-button
:disabled="scope.row.id == 1 || scope.row.id == 2">修改</el-button> >
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button
:disabled="scope.row.id == 1 || scope.row.id == 2">删除</el-button> size="mini"
</template> type="text"
</el-table-column> icon="el-icon-edit"
</el-table> @click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" <pagination
:limit.sync="queryParams.pageSize" @pagination="getList" /> v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改公告对话框 --> <!-- 添加或修改公告对话框 -->
<el-dialog class="popup" :title="title" :visible.sync="open" width="780px" append-to-body> <el-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="140px" class="formStep"> class="popup"
<el-form-item label="标题" prop="reportTitle"> :title="title"
<el-input v-model="form.reportTitle" placeholder="请输入" /> :visible.sync="open"
</el-form-item> width="780px"
<el-form-item label="上报类型" prop="reportType"> append-to-body
<el-select v-model="form.reportType" placeholder="请选择"> >
<el-option v-for="item in reporTypeList" :key="item.id" :label="item.typeName" :value="item.id"> <el-form
</el-option> ref="form"
</el-select> :model="form"
</el-form-item> :rules="rules"
<el-form-item label="时间范围" prop="time"> label-width="100px"
<!-- <el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="form.timeRangeStart" class="formStep"
type="date" placeholder="选择日期"> >
</el-date-picker> --> <el-form-item label="标题" prop="reportTitle">
<el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="form.time" type="daterange" <el-input v-model="form.reportTitle" placeholder="请输入" />
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @input="$forceUpdate()"> </el-form-item>
</el-date-picker> <el-form-item label="上报类型" prop="reportType">
</el-form-item> <el-select
<!-- <el-form-item label="结束时间" prop="timeRangeEnd"> v-model="form.reportType"
<el-date-picker format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="form.timeRangeEnd" type="date" placeholder="请选择"
placeholder="选择日期"> @change="handleTypeChage"
</el-date-picker> >
</el-form-item> --> <el-option
</el-form> v-for="item in reporTypeList"
<div slot="footer" class="dialog-footer"> :key="item.id"
<el-button type="primary" @click="submitForm"> </el-button> :label="item.typeName"
<el-button @click="cancel"> </el-button> :value="item.id"
</div> >
</el-dialog> </el-option>
</div> </el-select>
</el-form-item>
<el-form-item label="单位" prop="tenantIdList">
<el-select v-model="form.tenantIdList" multiple placeholder="请选择">
<el-option
v-for="item in tenantsData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间范围" prop="time">
<el-date-picker
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
v-model="form.time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@input="$forceUpdate()"
>
</el-date-picker>
</el-form-item>
<el-form-item label="状态" prop="status" v-if="!form.id">
<el-radio-group v-model="form.status">
<el-radio :label="0">未开始</el-radio>
<el-radio :label="1">进行中</el-radio>
<el-radio :label="2">已结束</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template> </template>
<script> <script>
import { import {
managerQuery, managerQuery,
managerAdd, managerAdd,
managerUpd, managerUpd,
managerDel, managerDel,
reportList reportList,
} from "@/api/report"; } from "@/api/report";
export default { import { tenantsList } from "@/api/member";
name: "Notice", export default {
data() { name: "Notice",
return { data() {
reporTypeList: [], return {
queryParams: { reporTypeList: [],
param: { queryParams: {
reportTitle: "", pageNum: 1,
} pageSize: 10,
}, param: {
listData: [], reportTitle: "",
title: '', },
open: false, },
total: 0, listData: [],
form: {}, title: "",
loading: false, open: false,
showSearch: true, total: 0,
multiple: false, form: {},
// loading: false,
rules: { showSearch: true,
reportTitle: [{ multiple: false,
required: true, //
message: "标题不能为空", rules: {
trigger: "blur", reportTitle: [
}], {
reportType: [{ required: true,
required: true, message: "标题不能为空",
message: "类型不能为空", trigger: "blur",
trigger: "blur", },
}], ],
time: [{ reportType: [
required: true, {
message: "时间范围不能为空", required: true,
trigger: "change", message: "类型不能为空",
}] trigger: "blur",
// timeRangeStart: [{ },
// required: true, ],
// message: "", time: [
// trigger: "blur", {
// }], required: true,
// timeRangeEnd: [{ message: "时间范围不能为空",
// required: true, trigger: "change",
// message: "", },
// trigger: "blur" ],
// }], tenantIdList: [
}, {
}; required: true,
}, message: "单位不能为空",
created() { trigger: "change",
this.getList(); },
this.getReportType(); ],
}, // timeRangeStart: [{
methods: { // required: true,
getReportType() { // message: "",
reportList({ // trigger: "blur",
pageNum: -1, // }],
param: {}, // timeRangeEnd: [{
}).then((res) => { // required: true,
this.reporTypeList = res.data.list; // message: "",
}); // trigger: "blur"
}, // }],
/** 查询公告列表 */ },
getList() { tenantsData: [],
this.loading = true; };
managerQuery(this.queryParams).then((res) => { },
this.listData = res.data.list; created() {
this.total = res.data.total; this.getList();
this.loading = false; this.getReportType();
}); this.getTenantsList();
}, },
// methods: {
cancel() { //
this.open = false; handleTypeChage() {
this.reset(); // form.reportType reporTypeList id tenantIdList
}, let reportType = this.form.reportType;
// let tenantIdList = this.reporTypeList.find(
reset() { (item) => item.id == reportType
this.form = { ).tenantIdList;
"reportTitle": "", this.form.tenantIdList = tenantIdList;
"reportType": "", },
time:[], //
"timeRangeStart": "", getReportType() {
"timeRangeEnd": "", reportList({
}; pageNum: -1,
this.resetForm("form"); param: {},
}, }).then((res) => {
/** 搜索按钮操作 */ this.reporTypeList = res.data.list;
handleQuery() { });
this.queryParams.pageNum = 1; },
this.getList(); /** 查询公告列表 */
}, getTenantsList() {
/** 重置按钮操作 */ tenantsList({
resetQuery() { pageNum: -1,
this.queryParams.param = { param: {},
reportTitle: "", }).then((res) => {
}; this.tenantsData = res.data.list;
this.handleQuery(); });
}, },
// /** 查询公告列表 */
handleSelectionChange(selection) { getList() {
this.ids = selection.map((item) => item.id); this.loading = true;
this.single = selection.length != 1; managerQuery(this.queryParams).then((res) => {
this.multiple = !selection.length; this.listData = res.data.list;
}, this.total = res.data.total;
/** 新增按钮操作 */ this.loading = false;
handleAdd() { });
this.reset(); },
this.open = true; //
this.title = "新增上报"; cancel() {
}, this.open = false;
/** 修改按钮操作 */ this.reset();
handleUpdate(row) { },
this.open = true; //
this.title = "修改上报"; reset() {
this.form = JSON.parse(JSON.stringify(row)) this.form = {
let timeRangeStart = this.parseTime(this.form.timeRangeStart, "{y}-{m}-{d}") reportTitle: "",
let timeRangeEnd = this.parseTime(this.form.timeRangeEnd, "{y}-{m}-{d}") reportType: "",
this.form.time = [] time: [],
this.form.time[0] = timeRangeStart timeRangeStart: "",
this.form.time[1] = timeRangeEnd timeRangeEnd: "",
}, tenantIdList: [],
/** 诊疗档案 */ status: 0,
submitForm: function() { };
this.$refs["form"].validate((valid) => { this.resetForm("form");
if (valid) { },
let data = JSON.parse(JSON.stringify(this.form)) /** 搜索按钮操作 */
let time = data.time handleQuery() {
data.timeRangeStart = data.time[0] this.queryParams.pageNum = 1;
data.timeRangeEnd = data.time[1] this.getList();
if (data.id != undefined) { },
managerUpd(data).then((response) => { /** 重置按钮操作 */
this.$modal.msgSuccess("修改成功"); resetQuery() {
this.open = false; this.queryParams.param = {
this.getList(); reportTitle: "",
}); };
} else { this.handleQuery();
managerAdd(data).then((response) => { },
this.$modal.msgSuccess("新增成功"); //
this.open = false; handleSelectionChange(selection) {
this.getList(); this.ids = selection.map((item) => item.id);
}); this.single = selection.length != 1;
} this.multiple = !selection.length;
} },
}); /** 新增按钮操作 */
}, handleAdd() {
this.reset();
this.open = true;
this.title = "新增上报";
},
/** 修改按钮操作 */
handleSwitch(row, status) {
this.form = JSON.parse(JSON.stringify(row));
this.form.status = status;
managerUpd(this.form).then((response) => {
this.$modal.msgSuccess("操作成功");
this.getList();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.open = true;
this.title = "修改上报";
this.form = JSON.parse(JSON.stringify(row));
let timeRangeStart = this.parseTime(
this.form.timeRangeStart,
"{y}-{m}-{d}"
);
let timeRangeEnd = this.parseTime(this.form.timeRangeEnd, "{y}-{m}-{d}");
this.form.time = [];
this.form.time[0] = timeRangeStart;
this.form.time[1] = timeRangeEnd;
},
/** 诊疗档案 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
let data = JSON.parse(JSON.stringify(this.form));
let time = data.time;
data.timeRangeStart = data.time[0];
data.timeRangeEnd = data.time[1];
if (data.id != undefined) {
managerUpd(data).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
managerAdd(data).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const idList = row.id ? [row.id] : this.ids; const idList = row.id ? [row.id] : this.ids;
this.$modal this.$modal
.confirm("是否确认删除当前选择的数据?") .confirm("是否确认删除当前选择的数据?")
.then(function() { .then(function () {
return managerDel({ return managerDel({
idList: idList, idList: idList,
}); });
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
this.getList(); this.getList();
}) })
.catch(() => {}); .catch(() => {});
}, },
}, },
}; };
</script> </script>
<style scoped src="@/assets/styles/common.css"></style> <style scoped src="@/assets/styles/common.css"></style>
<style scoped> <style scoped>
.div-title1 { .div-title1 {
font-size: 22px; font-size: 22px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
} }
.div-title2 { .div-title2 {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
} }
.div-title3 { .div-title3 {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
} }
.span-but { .span-but {
display: inline-block; display: inline-block;
border-radius: 4px; border-radius: 4px;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
line-height: 32px; line-height: 32px;
padding: 0 15px; padding: 0 15px;
margin: 5px; margin: 5px;
} }
.span-but-active { .span-but-active {
border: 1px solid #1890ff; border: 1px solid #1890ff;
} }
.human-body { .human-body {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.human-body>>>.el-form-item { .human-body >>> .el-form-item {
width: 49%; width: 49%;
margin-right: 2%; margin-right: 2%;
} }
.human-body>>>.el-form-item:nth-of-type(2n) { .human-body >>> .el-form-item:nth-of-type(2n) {
margin-right: 0; margin-right: 0;
} }
.formStep1>>>.el-form-item__label {} .formStep1 >>> .el-form-item__label {
}
.form-item-zd { .form-item-zd {
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
.form-item-age { .form-item-age {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.form-item-age span { .form-item-age span {
margin: 0 10px; margin: 0 10px;
} }
.form-item-age>>>.el-input { .form-item-age >>> .el-input {
width: 100px; width: 100px;
} }
>>>.el-drawer.rtl { >>> .el-drawer.rtl {
width: 50% !important; width: 50% !important;
} }
</style> </style>

Loading…
Cancel
Save