NurseStationOperateUI/src/views/system/informationInfo/index.vue

806 lines
22 KiB
Vue
Raw Normal View History

2023-02-14 17:04:38 +08:00
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="资讯标题" prop="informationTitle">
<el-input
v-model="queryParams.informationTitle"
placeholder="请输入资讯标题"
2023-02-17 11:12:00 +08:00
maxlength="100"
2023-02-14 17:04:38 +08:00
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2023-02-20 16:38:04 +08:00
<el-form-item label="资讯分类" prop="informationCategoryId">
<el-button
type=""
v-if="queryParams.informationCategoryName == '请选择资讯分类'"
@click="clickitem()"
style="
width: 250px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
"
>{{ queryParams.informationCategoryName }}</el-button
>
<el-button
@click="clickitem()"
type=""
v-else
style="
width: 250px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
"
>{{ queryParams.informationCategoryName }}</el-button
>
</el-form-item>
<!-- </el-form-item> -->
2023-02-14 17:04:38 +08:00
<el-form-item label="资讯编码" prop="informationCode">
<el-input
v-model="queryParams.informationCode"
placeholder="请输入资讯编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2023-02-16 11:52:42 +08:00
2023-02-14 17:04:38 +08:00
<el-form-item>
<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>
</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"
v-hasPermi="['system:informationInfo:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:informationInfo:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:informationInfo:remove']"
>删除</el-button
>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:informationInfo:export']"
>导出</el-button
>
</el-col> -->
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="informationInfoList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键id" align="center" prop="id" /> -->
2023-02-20 16:38:04 +08:00
2023-02-14 17:04:38 +08:00
<el-table-column
label="资讯标题"
align="center"
2023-02-24 15:11:57 +08:00
show-overflow-tooltip
2023-02-14 17:04:38 +08:00
prop="informationTitle"
/>
2023-02-20 16:38:04 +08:00
2023-02-14 17:04:38 +08:00
<el-table-column label="资讯编码" align="center" prop="informationCode" />
2023-02-20 16:38:04 +08:00
<el-table-column
label="资讯分类"
align="center"
prop="informationCategoryName"
/>
2023-02-14 17:04:38 +08:00
<el-table-column label="显示顺序" align="center" prop="informationSort" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:informationInfo:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:informationInfo:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改资讯信息管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="140px"
:inline="true"
>
<el-form-item label="资讯标题" prop="informationTitle">
<el-input
v-model="form.informationTitle"
2023-02-17 11:12:00 +08:00
maxlength="100"
2023-02-14 17:04:38 +08:00
placeholder="请输入资讯标题"
/>
</el-form-item>
<el-form-item label="资讯分类" prop="informationCategoryId">
<el-button
type=""
v-if="form.informationCategoryName == '请选择资讯分类'"
@click="clickinnerVisible()"
style="
width: 250px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
"
>{{ form.informationCategoryName }}</el-button
>
<el-button
@click="clickinnerVisible()"
type=""
v-else
style="
width: 250px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
"
>{{ form.informationCategoryName }}</el-button
>
</el-form-item>
2023-02-17 18:18:31 +08:00
<el-form-item label="资讯图标" prop="leadThumbnailUrl">
2023-02-14 17:04:38 +08:00
<stationAcatar
style="width: 208px"
@imgUrl="imgUrl"
:img="form.leadThumbnailUrl"
:type="'leadThumbnailUrl'"
/>
<!-- <el-input v-model="form.leadThumbnailUrl" placeholder="请输入资讯主缩略图地址" /> -->
</el-form-item>
<el-form-item label="显示顺序" prop="informationSort">
<el-input
v-model="form.informationSort"
placeholder="请输入显示顺序"
2023-02-17 18:11:09 +08:00
style="width: 250px"
oninput="value=value.replace(/[^\d]/g,'')"
maxLength="5"
2023-02-14 17:04:38 +08:00
/>
</el-form-item>
<el-form-item label="资讯图文内容" prop="informationContent">
<editor
@imgs="imgs"
maxlength="300"
:min-height="102"
placeholder="请输入资讯图文内容"
2023-02-15 13:54:54 +08:00
style="width: 80%; margin-left: 18%; margin-top: -5%"
2023-02-14 17:04:38 +08:00
v-model="form.informationContent"
/>
</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>
<!-- 选择资讯 -->
<el-dialog
title="选择资讯"
:visible.sync="innerVisible"
width="1000px"
append-to-body
:before-close="innerVisiblecancel"
>
<el-form
ref="queryForm"
2023-02-16 11:52:42 +08:00
:model="informationqueryParams"
2023-02-14 17:04:38 +08:00
:rules="rules"
label-width="80px"
:inline="true"
>
<el-form-item
label="资讯分类编码"
prop="informationCategoryCode"
label-width="120"
>
<el-input
2023-02-16 11:52:42 +08:00
v-model="informationqueryParams.informationCategoryCode"
2023-02-14 17:04:38 +08:00
placeholder="请输入资讯分类编码"
clearable
/>
</el-form-item>
<el-form-item
label="资讯分类名称"
prop="informationCategoryName"
label-width="120"
>
<el-input
2023-02-16 11:52:42 +08:00
v-model="informationqueryParams.informationCategoryName"
2023-02-14 17:04:38 +08:00
placeholder="请输入资讯分类名称"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="informationInfoinfo"
>搜索</el-button
>
2023-02-15 13:54:54 +08:00
<el-button
icon="el-icon-refresh"
size="mini"
@click="addresetQuerylist"
2023-02-14 17:04:38 +08:00
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
:data="infolist"
@cell-dblclick="nurseclick"
v-loading="loading"
>
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
v-if="form.informationCategoryId == scope.row.id"
circle
@click="nurseclick(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="nurseclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="informationCategoryCode"
label="资讯分类编码"
align="center"
>
</el-table-column>
<el-table-column
property="informationCategoryName"
label="资讯名称"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
<!-- <el-table-column
property="hospitalAddress"
label="医院地址"
align="center"
>
</el-table-column> -->
<!-- <el-table-column
property="hospitalIntroduce"
label="医院介绍"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column> -->
<!-- <el-table-column
property="phone"
label="联系电话"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column> -->
</el-table>
<pagination
v-show="total2 > 0"
:total="total2"
2023-02-16 11:52:42 +08:00
:page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize"
2023-02-14 17:04:38 +08:00
@pagination="informationInfoinfo"
/>
</el-dialog>
2023-02-20 16:38:04 +08:00
<!-- 搜索选择资讯 -->
<el-dialog
title="选择资讯"
:visible.sync="innerVisiblezx"
width="1000px"
append-to-body
:before-close="innerVisiblecancelzx"
>
<el-form
ref="queryForm"
:model="informationqueryParams"
:rules="rules"
label-width="80px"
:inline="true"
>
<el-form-item
label="资讯分类编码"
prop="informationCategoryCode"
label-width="120"
>
<el-input
v-model="informationqueryParams.informationCategoryCode"
placeholder="请输入资讯分类编码"
clearable
/>
</el-form-item>
<el-form-item
label="资讯分类名称"
prop="informationCategoryName"
label-width="120"
>
<el-input
v-model="informationqueryParams.informationCategoryName"
placeholder="请输入资讯分类名称"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="informationInfoinfo"
>搜索</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="addresetQuerylist"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
:data="infolist"
@cell-dblclick="nurseclickzx"
v-loading="loading"
>
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
v-if="queryParams.informationCategoryId == scope.row.id"
circle
@click="nurseclickzx(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="nurseclickzx(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="informationCategoryCode"
label="资讯分类编码"
align="center"
>
</el-table-column>
<el-table-column
property="informationCategoryName"
label="资讯名称"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
</el-table>
<pagination
v-show="total2 > 0"
:total="total2"
:page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize"
@pagination="informationInfoinfo"
/>
</el-dialog>
2023-02-14 17:04:38 +08:00
</div>
</template>
<script>
import {
listInformationInfo,
getInformationInfo,
delInformationInfo,
addInformationInfo,
updateInformationInfo,
listInformationCategory,
} from "@/api/system/informationInfo";
import stationAcatar from "../stationAvatar/index.vue";
2023-02-17 15:34:25 +08:00
import { updatePicture } from "@/api/system/station";
2023-02-14 17:04:38 +08:00
export default {
components: { stationAcatar },
name: "InformationInfo",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
innerVisible: false,
2023-02-20 16:38:04 +08:00
innerVisiblezx: false,
2023-02-16 11:52:42 +08:00
informationqueryParams: {
2023-02-14 17:04:38 +08:00
pageNum: 1,
pageSize: 10,
informationCategoryCode: "",
informationCategoryName: "",
2023-02-20 16:38:04 +08:00
informationCategoryId: "",
2023-02-14 17:04:38 +08:00
},
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 资讯信息管理表格数据
informationInfoList: [],
// 弹出层标题
title: "",
total2: 0,
imgsurl: { pictureUrlList: [] },
2023-02-15 09:29:17 +08:00
2023-02-14 17:04:38 +08:00
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
2023-02-20 16:38:04 +08:00
informationCategoryName: "请选择资讯分类",
2023-02-14 17:04:38 +08:00
informationCategoryId: null,
informationTitle: null,
informationCode: null,
informationContent: null,
informationClickCount: null,
informationJumpLink: null,
informationSource: null,
leadThumbnailUrl: null,
negativeOneThumbnailUrl: null,
negativeTwoThumbnailUrl: null,
largePictureUrl: null,
informationSort: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
informationCategoryId: [
{
required: true,
message: "请选择资讯分类",
trigger: "blur",
},
],
informationTitle: [
{
required: true,
message: "请选择资讯标题",
trigger: "blur",
},
],
leadThumbnailUrl: [
{
required: true,
trigger: "blur",
message: "请选择缩略图",
},
],
informationSort: [
{
required: true,
trigger: "blur",
message: "请输入显示顺序",
},
],
// informationContent: [
2023-02-20 11:10:42 +08:00
// { required: true, message: "请输入资讯图文内容", trigger: "blur" },
2023-02-14 17:04:38 +08:00
// ],
2023-02-20 11:10:42 +08:00
informationContent: [
{
required: true,
message: "请输入资讯图文内容",
trigger: "blur",
},
],
2023-02-14 17:04:38 +08:00
},
infolist: [],
2023-02-17 15:34:25 +08:00
imgone: "",
2023-02-14 17:04:38 +08:00
};
},
created() {
this.getList();
},
methods: {
innerVisiblecancel() {
this.innerVisible = false;
},
2023-02-20 16:38:04 +08:00
innerVisiblecancelzx() {
this.innerVisiblezx = false;
},
2023-02-15 13:54:54 +08:00
//重置
2023-02-14 17:04:38 +08:00
addresetQuery() {
2023-02-16 11:52:42 +08:00
this.queryParams = {
2023-02-14 17:04:38 +08:00
pageNum: 1,
pageSize: 10,
informationCategoryCode: "",
2023-02-16 11:52:42 +08:00
informationTitle: "",
2023-02-20 16:38:04 +08:00
informationCategoryName: "",
2023-02-14 17:04:38 +08:00
};
2023-02-15 09:29:17 +08:00
this.getList();
2023-02-14 17:04:38 +08:00
},
2023-02-15 13:54:54 +08:00
addresetQuerylist() {
2023-02-16 11:52:42 +08:00
this.informationqueryParams = {
2023-02-15 13:54:54 +08:00
pageNum: 1,
pageSize: 10,
informationCategoryCode: "",
informationCategoryName: "",
};
this.informationInfoinfo();
},
2023-02-14 17:04:38 +08:00
informationInfoinfo() {
2023-02-16 11:52:42 +08:00
listInformationCategory(this.informationqueryParams).then((response) => {
2023-02-14 17:04:38 +08:00
this.infolist = response.rows;
this.total2 = response.total;
this.loading = false;
});
},
2023-02-20 16:38:04 +08:00
// 新增按钮
2023-02-14 17:04:38 +08:00
clickinnerVisible() {
this.informationInfoinfo();
this.innerVisible = true;
},
2023-02-20 16:38:04 +08:00
clickitem() {
this.informationInfoinfo();
this.innerVisiblezx = true;
},
2023-02-14 17:04:38 +08:00
imgUrl(imgUrl) {
this.form.leadThumbnailUrl = imgUrl;
},
imgs(item) {
this.imgsurl.pictureUrlList.push(item);
},
/** 查询资讯信息管理列表 */
getList() {
this.loading = true;
listInformationInfo(this.queryParams).then((response) => {
this.informationInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
2023-02-17 15:34:25 +08:00
var obj = { pictureUrlList: [] };
if (this.imgone != this.form.leadThumbnailUrl) {
if (this.form.leadThumbnailUrl) {
obj.pictureUrlList.push(this.form.leadThumbnailUrl);
}
}
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {});
}
2023-02-20 10:00:58 +08:00
if (this.imgsurl.pictureUrlList.length > 0) {
2023-02-20 16:38:04 +08:00
updatePicture(this.imgsurl).then((res) => {});
}
this.imgsurl = { pictureUrlList: [] };
2023-02-14 17:04:38 +08:00
this.open = false;
this.reset();
},
nurseclick(row) {
2023-02-15 13:54:54 +08:00
this.form.informationCategoryId = row.id;
2023-02-14 17:04:38 +08:00
this.form.informationCategoryName = row.informationCategoryName;
this.innerVisible = false;
},
2023-02-20 16:38:04 +08:00
nurseclickzx(row) {
this.queryParams.informationCategoryId = row.id;
this.queryParams.informationCategoryName = row.informationCategoryName;
this.innerVisiblezx = false;
},
2023-02-14 17:04:38 +08:00
// 表单重置
reset() {
this.form = {
id: null,
informationCategoryId: null,
informationTitle: null,
informationCode: null,
informationContent: null,
informationClickCount: null,
informationJumpLink: null,
informationSource: null,
leadThumbnailUrl: null,
negativeOneThumbnailUrl: null,
negativeTwoThumbnailUrl: null,
largePictureUrl: null,
informationSort: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
2023-02-16 11:52:42 +08:00
this.queryParams = {
pageNum: 1,
pageSize: 10,
informationCategoryCode: "",
2023-02-20 16:38:04 +08:00
informationCategoryName: "请选择资讯分类",
// informationCategoryName:"",
2023-02-16 11:52:42 +08:00
};
this.informationInfoinfo();
2023-02-14 17:04:38 +08:00
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
2023-02-15 13:54:54 +08:00
this.form.informationCategoryName = "请选择资讯分类";
2023-02-14 17:04:38 +08:00
this.title = "添加资讯信息管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getInformationInfo(id).then((response) => {
this.form = response.data;
2023-02-17 15:34:25 +08:00
this.imgone = this.form.leadThumbnailUrl;
2023-02-14 17:04:38 +08:00
this.open = true;
this.title = "修改资讯信息管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateInformationInfo(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
2023-02-17 15:34:25 +08:00
var obj = { pictureUrlList: [] };
if (this.imgone != this.form.leadThumbnailUrl) {
obj.pictureUrlList.push(this.imgone);
}
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {});
}
2023-02-20 10:00:58 +08:00
this.imgsurl = { pictureUrlList: [] };
2023-02-14 17:04:38 +08:00
this.open = false;
this.getList();
});
} else {
2023-02-20 16:38:04 +08:00
this.form.informationSort = parseInt(this.form.informationSort);
2023-02-14 17:04:38 +08:00
addInformationInfo(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除资讯信息管理编号为"' + ids + '"的数据项?')
.then(function () {
return delInformationInfo(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/informationInfo/export",
{
...this.queryParams,
},
`informationInfo_${new Date().getTime()}.xlsx`
);
},
},
};
</script>