NurseStationOperateUI/src/views/system/stationItem/index.vue
2022-11-16 11:49:46 +08:00

1279 lines
38 KiB
Vue

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="110px"
>
<el-form-item
label="护理站名称"
prop="nurseStationId"
label-width="100px"
v-if="nurseStationlist.find((e) => e.isAdmin == '1')"
>
<el-select
v-model="queryParams.nurseStationId"
clearable
placeholder="请选择护理站"
v-loadmore="loadMore"
>
<el-option
v-for="item in nurseStationlist"
:key="item.id"
:label="item.nurseStationName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="所属护理站"
prop="nurseStationId"
label-width="100px"
v-else
>
<el-select
v-model="queryParams.nurseStationId"
placeholder="请选择护理站"
v-loadmore="loadMore"
>
<el-option
v-for="item in nurseStationlist"
:key="item.id"
:label="item.nurseStationName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="护理项目编号" prop="nurseItemCode">
<el-input
v-model="queryParams.nurseItemCode"
placeholder="请输入护理项目编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="护理项目名称" prop="nurseItemName">
<el-input
v-model="queryParams.nurseItemName"
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"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:stationItem: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:stationItem: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:stationItem:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleExport"
>导入</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="nurseItemList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="护理时长" style="margin-left: 120px">
<div
v-for="(item, index) in props.row.nurseStationItemPrices"
:key="index"
style="display: block"
>
{{ item.serveDurationUnit }}
</div>
</el-form-item>
<el-form-item label="价格(元)" style="margin-left: 30px">
<div
v-for="(item, index) in props.row.nurseStationItemPrices"
:key="index"
style="display: block"
>
{{ item.price }}
</div>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column
label="所属护理站"
align="center"
prop="nurseStationName"
/>
<!-- <el-table-column label="护理类型" align="center" prop="nurseTypeName" /> -->
<el-table-column
label="护理项目编号"
align="center"
prop="nurseItemCode"
/>
<el-table-column
label="护理项目名称"
align="center"
prop="nurseItemName"
/>
<el-table-column
label="提前预约时长(h)"
align="center"
prop="advanceAppointDuration"
/>
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建人" align="center" prop="createBy" />
<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:stationItem:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:stationItem: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="1120px"
append-to-body
:before-close="cancel"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="130px"
:inline="true"
>
<!-- prop="nurseStationItem.nurseStationId" -->
<el-form-item label="所属护理站" required>
<template>
<el-button
type=""
@click="nurseStationshow = true"
style="
width: 208px;
text-align: left;
height: 36px;
color: #c0c4cc;
"
v-if="
this.form.nurseStationItem.nurseStationName ==
'请选择所属护理站'
"
>{{ form.nurseStationItem.nurseStationName }}</el-button
>
<el-button
type=""
@click="nurseStationshow = true"
v-else
style="
width: 208px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
"
>{{ form.nurseStationItem.nurseStationName }}</el-button
>
</template>
</el-form-item>
<el-form-item
label="护理项目名称"
prop="nurseStationItem.nurseItemName"
>
<el-input
v-model="form.nurseStationItem.nurseItemName"
placeholder="请输入护理项目名称"
maxlength="50"
/>
</el-form-item>
<el-form-item
label="提前预约时长"
prop="nurseStationItem.advanceAppointDuration"
>
<el-input
v-model="form.nurseStationItem.advanceAppointDuration"
placeholder="提前预约时长(单位小时)"
oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+0)} if(value.length>5){value=value.slice(0,5)}"
type="number"
min="0"
/>
</el-form-item>
<el-form-item label="项目头像" prop="nurseStationItem.itemPictureUrl">
<stationAcatar
style="width: 208px"
@imgUrl="imgUrl"
:img="form.nurseStationItem.itemPictureUrl"
:type="'itemPictureUrl'"
/>
</el-form-item>
<el-form-item label="排序" prop="nurseStationItem.sort">
<el-input
v-model="form.nurseStationItem.sort"
placeholder="不可输入小数点"
type="number"
min="0"
oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+0)} if(value.length>10){value=value.slice(0,10)}"
/>
</el-form-item>
<el-form-item
label="项目内容简介"
prop="nurseStationItem.nurseItemContent"
>
<el-input
maxlength="300"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
placeholder="请输入内容"
style="width: 208px"
v-model="form.nurseStationItem.nurseItemContent"
>
</el-input>
</el-form-item>
<el-form-item label="项目时长和价格" required>
<el-table
ref="nurseStationItemPrices"
:data="form.nurseStationItemPrices"
style="margin-top: 20px; width: 900px"
>
<el-table-column
property="serveDurationUnit"
label="服务时长和单位"
align="center"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.serveDurationUnit"
maxlength="6"
></el-input>
</template>
</el-table-column>
<el-table-column property="price" label="价格" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.price"
placeholder="小数点后两位(元)"
type="number"
oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+3)} if(value.length>6){value=value.slice(0,6)}"
></el-input>
</template>
</el-table-column>
<el-table-column property="description" label="描述" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.description"
maxlength="300"
></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="addnurseStationItemPrices"
>新增</el-button
>
<el-button
size="mini"
type="text"
@click="delnurseStationItemPrices(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="护理项目耗材">
<el-button
type="primary"
size="small"
plain
@click="listStationConsumableinfo"
>添加护理项目耗材</el-button
>
<el-table
ref="singleTable"
:data="form.nurseStationItemConsumables"
style="margin-top: 20px; width: 900px"
>
<el-table-column
property="nurseStationConsumableId"
label="耗材包名称"
align="center"
>
<template slot-scope="scope">
{{ scope.row.consumableDetail }}
</template>
</el-table-column>
<el-table-column
property="consumableCount"
label="耗材包数量"
align="center"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.consumableCount"
placeholder="不可输入小数点"
oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+0)} if(value.length>10){value=value.slice(0,10)}"
type="number"
></el-input>
</template>
</el-table-column>
<el-table-column
property="consumablePrice"
label="耗材包单位"
align="center"
>
<template slot-scope="scope">
{{ scope.row.consumableUnit }}
</template>
</el-table-column>
<el-table-column
property="consumablePrice"
label="耗材包单价"
align="center"
>
<template slot-scope="scope">
{{ scope.row.consumablePrice }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="delConsumable(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</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="nurseStationshow"
width="1100px"
append-to-body
:before-close="clicknurseStationshow"
>
<el-form
ref="form"
:model="getListByUserquery"
label-width="110px"
:inline="true"
>
<el-form-item label="护理站编码" prop="nurseStationCode">
<el-input
v-model="getListByUserquery.nurseStationCode"
placeholder="请输入护理站编码"
/>
</el-form-item>
<el-form-item label="护理站名称" prop="nurseStationName">
<el-input
v-model="getListByUserquery.nurseStationName"
placeholder="请输入护理站名称"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="stationlist"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="stationcancel"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="nurseStationlist"
@cell-dblclick="choicestationid"
>
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
circle
@click="choicestationid(scope.row)"
v-if="form.nurseStationItem.nurseStationId == scope.row.id"
></el-button>
<el-button
style="width: 15px; height: 15px"
circle
v-else
@click="choicestationid(scope.row)"
>
</el-button>
</template>
</el-table-column>
<el-table-column
property="nurseStationCode"
label="护理站编码"
align="center"
>
</el-table-column>
<el-table-column
property="nurseStationName"
label="护理站名称"
align="center"
>
</el-table-column>
<el-table-column property="phone" label="联系电话" align="center">
</el-table-column>
<el-table-column
property="address"
label="护理站地址"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
</el-table>
<pagination
v-show="total4 > 0"
:total="total4"
:page.sync="getListByUserquery.pageNum"
:limit.sync="getListByUserquery.pageSize"
@pagination="stationlist"
/>
</el-dialog>
<!-- 耗材弹框 -->
<el-dialog
title="添加护理项目耗材"
:visible.sync="stationConsumableshow"
width="1100px"
append-to-body
:before-close="clickstationConsumableshow"
>
<el-form
ref="form"
:model="StationConsumablequeryParams"
label-width="110px"
:inline="true"
>
<el-form-item label="耗材包详情" prop="nurseStationId">
<el-input
v-model="StationConsumablequeryParams.consumableDetail"
placeholder="请输入耗材包详情"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="listStationConsumableinfo"
>搜索</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="listStationConsumableinfocancel"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="stationConsumableList"
@cell-dblclick="cellchoiceConsumable"
>
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
circle
@click="delConsumable(scope.row)"
v-if="
form.nurseStationItemConsumables.find(
(e) => e.id == scope.row.id
)
"
></el-button>
<el-button
style="width: 15px; height: 15px"
circle
v-else
@click="choiceConsumable(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
label="护理站名称"
align="center"
prop="nurseStationName"
/>
<el-table-column
label="耗材包编号"
align="center"
prop="consumableCode"
/>
<el-table-column
label="服务项目耗材包详情"
align="center"
prop="consumableDetail"
/>
<el-table-column
label="耗材包单位"
align="center"
prop="consumableUnit"
/>
<el-table-column
label="耗材包价格"
align="center"
prop="consumablePrice"
/>
</el-table>
<el-button
type="primary"
size="mini"
@click="clickstationConsumableshow"
style="
margin-top: 20px;
margin-left: 85%;
width: 100px;
height: 40px;
font-size: 15px;
"
>选择完成</el-button
>
<pagination
v-show="total3 > 0"
:total="total3"
:page.sync="StationConsumablequeryParams.pageNum"
:limit.sync="StationConsumablequeryParams.pageSize"
@pagination="listStationConsumable"
/>
</el-dialog>
<!-- //导入 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板</el-link
>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listStationConsumable } from "@/api/system/stationConsumable";
import stationAcatar from "../stationAvatar/index.vue";
import {
list,
getNurseItem,
delNurseItem,
addNurseItem,
updateNurseItem,
getInfoList,
liststation,
updatePicture,
} from "@/api/system/nurseItem";
import { getToken } from "@/utils/auth";
import { getListByUser } from "@/api/system/userlist.js";
export default {
components: { stationAcatar },
name: "NurseItem",
data() {
return {
imageUrl: "",
imgone: "",
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/stationItem/importData",
},
// 遮罩层
loading: true,
stationConsumableshow: false,
nurseStationshow: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
total2: 0,
total3: 0,
total4: 0,
//耗材
stationConsumableList: [],
// 护理站护理项目表格数据
nurseItemList: [],
//护理站类型表
typelist: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
//权限查询
nurseStationlist: [],
nurseStationlist2: [],
getListByUserquery: {
pageNum: 1,
pageSize: 10,
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
nurseStationId: null,
nurseTypeId: null,
userId: null,
nurseItemCode: null,
nurseItemName: null,
nurseItemContent: null,
advanceAppointDuration: null,
sort: null,
},
// 查询参数
StationConsumablequeryParams: {
pageNum: 1,
pageSize: 10,
nurseStationId: null,
consumableDetail: null,
},
// 表单参数
form: {
nurseStationItem: {
nurseStationId: null,
nurseTypeId: null,
nurseItemName: "",
nurseItemContent: "",
advanceAppointDuration: "",
itemPictureUrl: "",
sort: "",
nurseStationName: "请选择所属护理站",
},
},
ids: 1,
// 表单校验
rules: {
"nurseStationItem.nurseItemName": [
{ required: true, message: "护理项目名称不能为空", trigger: "blur" },
],
"nurseStationItem.nurseItemContent": [
{ required: true, message: "项目内容简介不能为空", trigger: "blur" },
],
"nurseStationItem.sort": [
{ required: true, message: "排序不能为空", trigger: "blur" },
],
"nurseStationItem.advanceAppointDuration": [
{ required: true, message: "提前预约时长不能为空", trigger: "blur" },
],
"nurseStationItem.itemPictureUrl": [
{
required: true,
trigger: "blur",
message: "请选择项目头像",
},
],
nurseStationId: [
{ required: true, trigger: "blur", message: "请选择所属护理站" },
],
nurseTypeId: [
{ required: true, message: "请选择护理类型", trigger: "blur" },
],
},
};
},
created() {
this.getList();
this.info();
this.getInfoListinfo();
// this.stationlist();
// this.listStationConsumableinfo();
},
methods: {
imgUrl(imgUrl) {
console.log(imgUrl);
this.form.nurseStationItem.itemPictureUrl = imgUrl;
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
/** 下载模板操作 */
importTemplate() {
this.download(
"/system/stationItem/downloadTemplate?fileType=1",
{},
`护理站项目信息导入模板.xlsx`
);
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//耗材包选择完成
stationConsumablechoiceok() {
this.form.nurseStationItemConsumables.forEach((e) => {
e.nurseStationConsumableId = e.id;
});
this.stationConsumableshow = false;
},
//删除已经选择的耗材包
delConsumable(item) {
this.form.nurseStationItemConsumables =
this.form.nurseStationItemConsumables.filter((e) => e.id != item.id);
},
//双击耗材包
cellchoiceConsumable(item) {
if (this.form.nurseStationItemConsumables.find((e) => e.id == item.id)) {
console.log(1);
this.form.nurseStationItemConsumables =
this.form.nurseStationItemConsumables.filter((e) => e.id != item.id);
} else {
console.log(2);
this.form.nurseStationItemConsumables.push(item);
}
console.log(this.form.nurseStationItemConsumables);
},
//选择耗材宝
choiceConsumable(item) {
console.log(item);
this.form.nurseStationItemConsumables.push(item);
console.log(this.form.nurseStationItemConsumables);
},
//护理站页面选择护理站
choicestationid(item) {
this.form.nurseStationItem.nurseStationId = item.id;
// this.form.nurseStationId = item.id;
this.form.nurseStationItem.nurseStationName = item.nurseStationName;
this.StationConsumablequeryParams.nurseStationId = item.id;
// console.log(item);
this.nurseStationshow = false;
this.stationcancel();
},
//关闭护理站页面
clicknurseStationshow() {
this.stationcancel();
this.nurseStationshow = false;
},
//耗材包关闭
clickstationConsumableshow() {
this.listStationConsumableinfocancel();
this.stationConsumableshow = false;
},
// 耗材重置
listStationConsumableinfocancel() {
this.StationConsumablequeryParams.consumableDetail = null;
this.StationConsumablequeryParams.pageNum = 1;
this.StationConsumablequeryParams.pageSize = 10;
this.listStationConsumable();
},
//护理站重置
stationcancel() {
this.getListByUserquery = {
pageNum: 1,
pageSize: 10,
};
this.stationlist();
},
//下拉框
stationlist() {
getListByUser(this.getListByUserquery).then((res) => {
this.total4 = res.total;
this.nurseStationlist = res.rows;
});
},
//护理类型
getInfoListinfo() {
getInfoList().then((res) => {
this.typelist = res.data;
});
},
/** 耗材列表 */
listStationConsumable() {
listStationConsumable(this.StationConsumablequeryParams).then(
(response) => {
this.stationConsumableList = response.rows;
this.total3 = response.total;
}
);
},
listStationConsumableinfo() {
if (this.form.nurseStationItem.nurseStationId != null) {
listStationConsumable(this.StationConsumablequeryParams).then(
(response) => {
this.stationConsumableList = response.rows;
this.total3 = response.total;
this.stationConsumableshow = true;
}
);
} else {
this.$message.error("请先选择护理站");
}
},
/** 查询护理站护理项目列表 */
getList() {
this.loading = true;
list(this.queryParams).then((response) => {
response.rows.forEach((e) => {
this.typelist.forEach((el) => {
if (e.nurseTypeId == el.id) {
e.nurseTypeName = el.nurseTypeName;
}
});
});
this.nurseItemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
console.log(this.form.nurseStationItem);
var obj = { pictureUrlList: [] };
if (this.imgone != this.form.nurseStationItem.itemPictureUrl) {
obj.pictureUrlList.push(this.form.nurseStationItem.itemPictureUrl);
}
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {
console.log(res);
});
}
this.open = false;
this.reset();
},
//时长价格
addnurseStationItemPrices(item, index) {
if (this.form.nurseStationItemPrices.length == 5) {
this.$message.error("最多只能5条");
} else {
this.ids++;
var obj = {
serveDurationUnit: "",
price: "",
description: "",
ids: this.ids,
};
this.form.nurseStationItemPrices.push(obj);
}
},
delnurseStationItemPrices(item) {
if (item.ids && !item.id) {
if (this.form.nurseStationItemPrices.length == 1) {
this.$message.error("最后一条不可删除");
} else {
this.form.nurseStationItemPrices =
this.form.nurseStationItemPrices.filter((e) => e.ids != item.ids);
}
} else if (!item.ids && item.id) {
if (this.form.nurseStationItemPrices.length == 1) {
this.$message.error("最后一条不可删除");
} else {
this.form.nurseStationItemPrices =
this.form.nurseStationItemPrices.filter((e) => e.id != item.id);
}
}
},
// 表单重置
reset() {
this.form = {
nurseStationItem: {
nurseStationId: null,
nurseTypeId: null,
nurseItemName: null,
nurseItemContent: null,
advanceAppointDuration: null,
itemPictureUrl: null,
sort: null,
nurseStationName: "请选择所属护理站",
},
nurseStationItemConsumables: [
// {
// nurseStationConsumableId: "",
// consumableCount: "",
// consumablePrice: "",
// },
],
nurseStationItemPrices: [
{
serveDurationUnit: null,
price: null,
description: null,
ids: this.ids,
},
],
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
if (this.nurseStationlist[0].isAdmin == "1") {
this.queryParams = {
pageNum: 1,
pageSize: 10,
nurseStationId: null,
nurseTypeId: null,
userId: null,
nurseItemCode: null,
nurseItemName: null,
nurseItemContent: null,
advanceAppointDuration: null,
sort: null,
};
this.handleQuery();
} else {
this.queryParams.pageNum = 1;
this.queryParams.nurseTypeId = null;
this.queryParams.nurseItemCode = null;
this.queryParams.nurseItemName = null;
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;
this.StationConsumablequeryParams.nurseStationId = null;
this.title = "添加护理站护理项目";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.StationConsumablequeryParams.nurseStationId = null;
const id = row.id || this.ids;
getNurseItem(id).then((response) => {
console.log(response);
this.form = response.data;
this.StationConsumablequeryParams.nurseStationId =
response.data.nurseStationItem.nurseStationId;
this.imgone = this.form.nurseStationItem.itemPictureUrl;
if (this.form.nurseStationItemPrices == []) {
var obj = {
serveDurationUnit: "",
price: "",
description: "",
ids: this.ids,
};
this.form.nurseStationItemPrices.push(obj);
} else if (this.form.nurseStationItemPrices.length == 0) {
var obj = {
serveDurationUnit: "",
price: "",
description: "",
ids: this.ids,
};
this.form.nurseStationItemPrices.push(obj);
} else if (this.form.nurseStationItemPrices == null) {
var obj = {
serveDurationUnit: "",
price: "",
description: "",
ids: this.ids,
};
this.form.nurseStationItemPrices.push(obj);
}
this.open = true;
this.title = "修改护理站护理项目";
});
},
/** 提交按钮 */
submitForm() {
this.form.nurseStationItemConsumables.forEach((e) => {
e.nurseStationConsumableId = e.id;
});
this.form.nurseStationItem.nurseTypeId = this.form.nurseTypeId;
// this.form.nurseStationItem.nurseStationId = this.form.nurseStationId;
console.log(this.form);
this.$refs["form"].validate((valid) => {
console.log(valid);
if (valid) {
if (this.form.nurseStationItem.id != null) {
updateNurseItem(this.form).then((response) => {
var obj = { pictureUrlList: [] };
if (this.imgone != this.form.nurseStationItem.itemPictureUrl) {
obj.pictureUrlList.push(this.imgone);
}
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {
console.log(res);
});
}
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addNurseItem(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.$forceUpdate();
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm("是否确认删除此护理站护理项目?")
.then(function () {
return delNurseItem(ids);
})
.then(() => {
var obj = { pictureUrlList: [] };
obj.pictureUrlList.push(row.nurseStationItem.itemPictureUrl);
updatePicture(obj).then((res) => {
console.log(res);
});
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导入按钮操作 */
handleExport() {
this.upload.title = "护理站护理项目导入";
this.upload.open = true;
},
//权限列表
info() {
getListByUser(this.getListByUserquery).then((res) => {
console.log(res);
if (res.rows[0].isAdmin == "1") {
console.log(true);
this.nurseStationlist = res.rows;
this.total4 = res.total;
} else {
this.total4 = res.total;
this.nurseStationlist = res.rows;
this.queryParams.nurseStationId = res.rows[0].id;
this.handleQuery();
}
});
},
loadMore() {
var a = Math.ceil(this.total4 / 10);
if (this.nurseStationlist.length + 1 >= this.total4s) {
} else {
if (this.getListByUserquery.pageNum >= a) {
} else {
this.getListByUserquery.pageNum++;
getListByUser(this.getListByUserquery).then((res) => {
res.rows.forEach((e) => {
this.nurseStationlist.push(e);
});
});
}
}
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-table__cell .el-form-item--medium .el-form-item__content {
display: block;
}
// ::v-deep .el-form-item__label {
// font-weight: 550;
// }
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>