<template>
|
<div class="app-container">
|
<el-row :gutter="20">
|
<!--部门数据-->
|
<el-col :span="4" :xs="24">
|
<div class="head-container">
|
<el-input
|
v-model="xmmc"
|
placeholder="请输入项目名"
|
clearable
|
size="small"
|
prefix-icon="el-icon-search"
|
style="margin-bottom: 20px"
|
/>
|
</div>
|
<div class="head-tree" style="height: 486px; overflow-y: scroll;">
|
<el-tree
|
ref="tree"
|
node-key="id"
|
highlight-current
|
:default-expanded-keys="treeId"
|
:data="deptOptions"
|
:props="defaultProps"
|
:expand-on-click-node="false"
|
:auto-expand-parent="false"
|
:filter-node-method="filterNode"
|
@node-click="handleNodeClick"
|
/>
|
</div>
|
</el-col>
|
<el-col :span="19" :xs="24">
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
size="small"
|
:inline="true"
|
v-show="showSearch"
|
label-width="68px"
|
>
|
<el-form-item label="病种名" prop="bzmc">
|
<el-input
|
v-model="queryParams.bzmc"
|
placeholder="请输入病种名"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="简写" prop="zjf">
|
<el-input
|
v-model="queryParams.zjf"
|
placeholder="请输入简写"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<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"
|
icon="el-icon-plus"
|
size="mini"
|
@click="handleAdd"
|
v-hasPermi="['hosp:ruleAdvice:add']"
|
>新增
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
icon="el-icon-edit"
|
size="mini"
|
:disabled="single"
|
@click="handleUpdate"
|
v-hasPermi="['hosp:ruleAdvice:edit']"
|
>修改
|
</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
icon="el-icon-delete"
|
size="mini"
|
:disabled="multiple"
|
@click="handleDelete"
|
v-hasPermi="['hosp:ruleAdvice: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="['hosp:ruleAdvice:export']"
|
>导出
|
</el-button>
|
</el-col> -->
|
<right-toolbar
|
:showSearch.sync="showSearch"
|
@queryTable="getList"
|
></right-toolbar>
|
</el-row>
|
|
<el-table
|
border
|
v-loading="loading"
|
:data="ruleAdviceList"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column
|
label="序号"
|
align="center"
|
prop="newID"
|
width="55"
|
/>
|
<!-- <el-table-column label="病种id" align="center" prop="bz" :show-overflow-tooltip="true"/> -->
|
<el-table-column
|
label="病种名"
|
align="center"
|
prop="bzmc"
|
:show-overflow-tooltip="true"
|
width="170"
|
/>
|
<el-table-column
|
label="简写"
|
align="center"
|
prop="zjf"
|
:show-overflow-tooltip="true"
|
width="170"
|
/>
|
<el-table-column
|
label="建议"
|
align="center"
|
prop="jy"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="操作"
|
align="center"
|
class-name="small-padding fixed-width"
|
width="70"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleUpdate(scope.row)"
|
v-hasPermi="['hosp:ruleAdvice:edit']"
|
title="修改"
|
>
|
</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-delete"
|
@click="handleDelete(scope.row)"
|
v-hasPermi="['hosp:ruleAdvice:remove']"
|
title="删除"
|
>
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div class="pag">
|
<div class="pag1">
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</div>
|
</div>
|
</el-col>
|
</el-row>
|
|
<!-- 添加或修改病种+意见对话框 -->
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<!-- <el-form-item label="病种id" prop="bz">
|
<el-input
|
v-model="form.bz"
|
type="textarea"
|
placeholder="请输入内容"
|
/>
|
</el-form-item> -->
|
<el-form-item label="病种名" prop="bzmc">
|
<el-select
|
:remote-method="getRemoteData"
|
v-model="form.bzmc"
|
remote
|
filterable
|
style="width: 200px"
|
placeholder="请选择病种名"
|
clearable
|
@change="idFn"
|
>
|
<el-option
|
v-for="dict in rulesList"
|
:key="dict.aid"
|
:label="dict.bingzhong"
|
:value="dict.bingzhong"
|
/>
|
</el-select>
|
<!-- <el-input v-model="form.bzmc" placeholder="请输入病种名" /> -->
|
</el-form-item>
|
<el-form-item label="简写" prop="zjf">
|
<el-input v-model="form.zjf" placeholder="请输入简写" disabled />
|
</el-form-item>
|
<el-form-item label="建议" prop="jy">
|
<el-input
|
:rows="7"
|
v-model="form.jy"
|
type="textarea"
|
placeholder="请输入内容"
|
/>
|
</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>
|
|
<script>
|
import {
|
listRuleAdvice,
|
getRuleAdvice,
|
delRuleAdvice,
|
addRuleAdvice,
|
updateRuleAdvice,
|
projectTree,
|
getByProId,
|
} from "@/api/hosp/ruleAdvice";
|
import { listRules } from "@/api/hosp/rules";
|
|
export default {
|
name: "RuleAdvice",
|
data() {
|
let checkPhoneNum = (rule, value, callback) => {
|
console.log(value);
|
let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
|
if (value == "" && value == undefined && !value) {
|
return callback("");
|
} else if (value != undefined && value != "") {
|
return callback();
|
} else if (!patter.test(value)) {
|
return callback("");
|
}
|
};
|
return {
|
deptOptions: [],
|
defaultProps: {
|
children: "children",
|
label: "label",
|
},
|
treeId: [],
|
xmmc: "",
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 病种+意见表格数据
|
ruleAdviceList: [],
|
rulesList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
bzmc: null,
|
jy: null,
|
zjf: null,
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
bzmc: [
|
{
|
required: true,
|
validator: checkPhoneNum,
|
trigger: "blur",
|
},
|
],
|
zjf: [
|
{
|
required: true,
|
validator: checkPhoneNum,
|
trigger: "blur",
|
},
|
],
|
jy: [
|
{
|
required: true,
|
validator: checkPhoneNum,
|
trigger: "blur",
|
},
|
],
|
},
|
};
|
},
|
watch: {
|
// 根据名称筛选部门树
|
xmmc(val) {
|
this.$refs.tree.filter(val);
|
},
|
treeId(newVal, oldVal) {
|
if (newVal) {
|
this.$nextTick(() => {
|
document
|
.querySelector(".el-tree-node__children .el-tree-node__content")
|
.click();
|
});
|
}
|
},
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询病种+意见列表 */
|
getList() {
|
this.loading = true;
|
projectTree().then((response) => {
|
this.deptOptions = response.data;
|
this.treeId.push(this.deptOptions[0].id);
|
this.loading = false;
|
});
|
},
|
// 节点单击事件
|
handleNodeClick(data) {
|
this.loading = true;
|
let date = {
|
proId: data.id,
|
};
|
getByProId(date).then((response) => {
|
response.rows.forEach((item, index) => {
|
item.newID =
|
(this.queryParams.pageNum - 1) * this.queryParams.pageSize +
|
index +
|
1;
|
});
|
this.ruleAdviceList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 筛选节点
|
filterNode(value, data) {
|
if (!value) return true;
|
return data.label.indexOf(value) !== -1;
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
gid: null,
|
bz: null,
|
bzmc: null,
|
jy: null,
|
zjf: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
deleted: null,
|
createId: null,
|
updateId: null,
|
};
|
this.resetForm("form");
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.loading = true;
|
listRuleAdvice(this.queryParams).then((response) => {
|
response.rows.forEach((item, index) => {
|
item.newID =
|
(this.queryParams.pageNum - 1) * this.queryParams.pageSize +
|
index +
|
1;
|
});
|
this.ruleAdviceList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.resetForm("queryForm");
|
this.handleQuery();
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map((item) => item.gid);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "添加病种+意见";
|
listRules(this.queryParams).then((response) => {
|
this.rulesList = response.rows;
|
});
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const gid = row.gid || this.ids;
|
getRuleAdvice(gid).then((response) => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "修改病种+意见";
|
});
|
},
|
// 搜索
|
getRemoteData(query) {
|
if (query) {
|
let data = {
|
bingzhong: query,
|
};
|
listRules(data).then((response) => {
|
this.rulesList = response.rows;
|
});
|
}
|
},
|
idFn(value) {
|
this.rulesList.forEach((item) => {
|
if (item.bingzhong == value) {
|
this.form.bz = item.aid;
|
this.form.zjf = item.bzPinyin;
|
}
|
});
|
},
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate((valid) => {
|
if (valid) {
|
if (this.form.gid != null) {
|
updateRuleAdvice(this.form).then((response) => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addRuleAdvice(this.form).then((response) => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const ids = row.gid || this.ids;
|
this.$modal
|
.confirm('是否确认删除病种意见信息编号为"' + ids + '"的数据项?')
|
.then(function () {
|
return delRuleAdvice(ids);
|
})
|
.then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
})
|
.catch(() => {});
|
},
|
},
|
};
|
</script>
|
<style scoped>
|
.pag {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
}
|
|
.pag1 {
|
width: 30%;
|
}
|
</style>
|