NurseStationUI/src/views/system/station/index.vue

929 lines
27 KiB
Vue
Raw Normal View History

2022-09-20 17:14:55 +08:00
<template>
<div class="app-container">
<el-form
2022-11-17 17:28:02 +08:00
:model="getListByUserquery"
2022-09-20 17:14:55 +08:00
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
2022-11-18 12:49:07 +08:00
<el-form-item label="护理站编号" prop="nurseStationCode">
2022-11-17 10:37:35 +08:00
<el-input
2022-11-18 12:49:07 +08:00
v-model="getListByUserquery.nurseStationCode"
placeholder="请输入护理站编号"
2022-11-17 10:37:35 +08:00
clearable
@keyup.enter.native="handleQuery"
/>
2022-09-23 14:45:51 +08:00
</el-form-item>
2022-11-18 12:49:07 +08:00
<el-form-item label="所属护理站" prop="nurseStationName">
2022-09-20 17:14:55 +08:00
<el-input
2022-11-18 12:49:07 +08:00
v-model="getListByUserquery.nurseStationName"
placeholder="请输入护理站"
2022-09-20 17:14:55 +08:00
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2022-11-16 10:25:34 +08:00
2022-09-20 17:14:55 +08:00
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
2022-11-02 15:48:04 +08:00
>搜索</el-button
2022-09-20 17:14:55 +08:00
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
2022-11-02 15:48:04 +08:00
>重置</el-button
2022-09-20 17:14:55 +08:00
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
2022-11-18 12:49:07 +08:00
<!-- <el-col :span="1.5">
2022-09-20 17:14:55 +08:00
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:station:add']"
2022-11-02 15:48:04 +08:00
>新增</el-button
2022-09-20 17:14:55 +08:00
>
2022-11-18 12:49:07 +08:00
</el-col> -->
2022-09-20 17:14:55 +08:00
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:station:edit']"
2022-11-04 09:55:48 +08:00
>修改</el-button
2022-09-20 17:14:55 +08:00
>
</el-col>
2022-11-11 15:34:09 +08:00
2022-09-20 17:14:55 +08:00
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handledata"
2022-11-18 12:49:07 +08:00
v-hasPermi="['system:station:importStationInfo']"
2022-11-04 09:55:48 +08:00
>导入</el-button
2022-09-20 17:14:55 +08:00
>
</el-col>
2022-11-11 15:34:09 +08:00
2022-09-20 17:14:55 +08:00
<right-toolbar
:showSearch.sync="showSearch"
2022-11-17 17:28:02 +08:00
@queryTable="info"
2022-09-20 17:14:55 +08:00
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
2022-11-17 17:28:02 +08:00
:data="nurseStationlist"
2022-09-20 17:14:55 +08:00
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="护理站编号"
align="center"
prop="nurseStationCode"
width="150"
2022-09-20 17:14:55 +08:00
/>
<el-table-column
label="护理站名称"
align="center"
prop="nurseStationName"
2022-11-02 15:48:04 +08:00
:show-overflow-tooltip="true"
2022-09-20 17:14:55 +08:00
/>
2022-11-18 12:49:07 +08:00
2022-09-27 09:05:46 +08:00
<el-table-column label="所属区域" align="center" prop="area">
2022-11-04 09:55:48 +08:00
<template slot-scope="scope">
<span>{{
scope.row.areaName !== "null-null-null-null"
? scope.row.areaName
: ""
}}</span>
</template>
2022-09-27 09:05:46 +08:00
</el-table-column>
2022-11-04 09:55:48 +08:00
<el-table-column
label="护理站地址"
align="center"
prop="address"
:show-overflow-tooltip="true"
/>
2022-09-20 17:14:55 +08:00
<el-table-column label="护理站经度" align="center" prop="longitude" />
<el-table-column label="护理站纬度" align="center" prop="latitude" />
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="负责人" align="center" prop="dutyPerson" />
<el-table-column label="负责人电话" align="center" prop="dutyPhone" />
2022-11-04 14:00:14 +08:00
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建人" align="center" prop="createBy" />
2022-09-20 17:14:55 +08:00
<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:station:edit']"
2022-11-04 09:55:48 +08:00
>修改</el-button
2022-09-20 17:14:55 +08:00
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:station:remove']"
2022-11-04 09:55:48 +08:00
>删除</el-button
2022-09-20 17:14:55 +08:00
>
</template>
</el-table-column>
</el-table>
<pagination
2022-11-17 17:28:02 +08:00
v-show="total2 > 0"
:total="total2"
:page.sync="getListByUserquery.pageNum"
:limit.sync="getListByUserquery.pageSize"
@pagination="info"
2022-09-20 17:14:55 +08:00
/>
<!-- 新增护理站信息对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
:before-close="cancel"
>
<el-form
:inline="true"
ref="form"
:model="form"
:rules="rules"
label-width="120px"
>
<el-form-item label="所属区域" prop="areaCode">
<el-select
2022-11-04 14:05:17 +08:00
v-model="form.provinceName"
2022-09-20 17:14:55 +08:00
clearable
placeholder="请选择省"
2022-09-22 08:32:14 +08:00
style="width: 129px"
2022-09-20 17:14:55 +08:00
>
<el-option
v-for="item in provincelist"
:key="item.areaCode"
:label="item.areaName"
:value="item.areaCode"
@click.native="province(item)"
>
</el-option>
</el-select>
<el-select
2022-11-04 14:05:17 +08:00
v-model="form.cityName"
2022-09-20 17:14:55 +08:00
clearable
placeholder="请选择市"
2022-09-22 08:32:14 +08:00
style="width: 129px; margin-left: 10px"
2022-09-20 17:14:55 +08:00
>
<el-option
v-for="item in citylist"
:key="item.areaCode"
:label="item.areaName"
:value="item.areaCode"
@click.native="clickcity(item)"
>
</el-option>
</el-select>
<el-select
2022-11-04 14:05:17 +08:00
v-model="form.regionName"
2022-09-20 17:14:55 +08:00
clearable
placeholder="请选择区"
2022-09-22 08:32:14 +08:00
style="width: 129px; margin-left: 10px"
2022-09-20 17:14:55 +08:00
>
<el-option
v-for="item in arealist"
:key="item.areaCode"
:label="item.areaName"
:value="item.areaCode"
@click.native="clickarea(item)"
>
</el-option>
</el-select>
<el-select
2022-11-16 10:25:34 +08:00
v-model="form.streetCode"
2022-09-20 17:14:55 +08:00
clearable
placeholder="请选择街道"
2022-09-22 08:32:14 +08:00
style="width: 129px; margin-left: 10px"
2022-09-20 17:14:55 +08:00
>
<el-option
v-for="item in streetlist"
:key="item.areaCode"
:label="item.areaName"
:value="item.areaCode"
@click.native="clickstreet(item)"
>
</el-option>
</el-select>
2022-11-14 10:42:31 +08:00
</el-form-item>
2022-11-15 14:50:42 +08:00
<el-form-item label="护理站名称" prop="nurseStationName">
2022-11-14 10:42:31 +08:00
<el-input
v-model="form.nurseStationName"
placeholder="请输入护理站名称"
maxlength="40"
/>
2022-09-20 17:14:55 +08:00
</el-form-item>
2022-11-16 10:25:34 +08:00
<el-form-item label="护理站地址" prop="address">
2022-09-27 09:05:46 +08:00
<el-input
v-model="form.address"
placeholder="请输入护理站地址"
maxlength="80"
/>
</el-form-item>
2022-09-22 08:32:14 +08:00
<el-form-item label="护理站经度" prop="longitude">
<el-input
v-model="form.longitude"
placeholder="请输入护理站经度"
type="number"
oninput=" if(value.length>10){value=value.slice(0,20)}"
/>
</el-form-item>
<el-form-item label="护理站纬度" prop="latitude">
<el-input
v-model="form.latitude"
placeholder="请输入护理站纬度"
type="number"
oninput=" if(value.length>10){value=value.slice(0,20)}"
/>
</el-form-item>
2022-09-20 17:14:55 +08:00
<el-form-item label="联系电话" prop="phone">
2022-09-22 08:32:14 +08:00
<el-input
v-model="form.phone"
placeholder="请输入联系电话"
maxlength="11"
/>
2022-09-20 17:14:55 +08:00
</el-form-item>
2022-11-11 15:34:09 +08:00
<el-form-item label="排序" prop="sort">
<el-input
2022-11-23 16:37:28 +08:00
placeholder="请输入排序"
2022-11-11 15:34:09 +08:00
v-model="form.sort"
2022-11-23 16:37:28 +08:00
maxlength="8"
oninput="value=value.replace(/[^\d]/g,'')"
2022-11-11 15:34:09 +08:00
/>
</el-form-item>
2022-09-20 17:14:55 +08:00
<el-form-item label="负责人" prop="dutyPerson">
2022-09-22 08:32:14 +08:00
<el-input
v-model="form.dutyPerson"
placeholder="请输入负责人"
maxlength="20"
/>
2022-09-20 17:14:55 +08:00
</el-form-item>
<el-form-item label="负责人电话" prop="dutyPhone">
<el-input
v-model="form.dutyPhone"
placeholder="请输入负责人联系电话"
2022-09-22 08:32:14 +08:00
maxlength="11"
2022-09-20 17:14:55 +08:00
/>
</el-form-item>
<el-form-item label="护理站总概述" prop="nurseStationDescription">
<el-input
2022-11-16 10:25:34 +08:00
style="width: 540px"
2022-09-20 17:14:55 +08:00
v-model="form.nurseStationDescription"
placeholder="请输入护理站信息总概述"
type="textarea"
2022-09-22 08:32:14 +08:00
maxlength="150"
2022-09-20 17:14:55 +08:00
/>
</el-form-item>
<el-form-item label="护理站简介" prop="agencyIntroduce">
<editor
2022-12-02 15:30:10 +08:00
@imgs="imgs"
2022-09-30 10:26:47 +08:00
:min-height="62"
style="width: 90%; margin: 0 auto"
2022-09-20 17:14:55 +08:00
v-model="form.agencyIntroduce"
></editor>
</el-form-item>
2022-11-04 14:00:14 +08:00
<el-form-item
label="护理站头像"
prop="stationPictureUrl"
required
style="margin-left: 10%"
>
2022-09-20 17:14:55 +08:00
<stationAcatar
2022-09-22 08:32:14 +08:00
@imgUrl="imgUrl"
2022-09-20 17:14:55 +08:00
:img="form.stationPictureUrl"
:type="'stationPictureUrl'"
/>
</el-form-item>
2022-11-04 14:00:14 +08:00
<el-form-item
label="护理站简介头像"
prop="stationIntroducePcitureUrl"
style="margin-left: 10%"
>
2022-09-20 17:14:55 +08:00
<stationAcatar
2022-09-22 08:32:14 +08:00
@imgUrl="imgUrl2"
:img="form.stationIntroducePcitureUrl"
2022-09-20 17:14:55 +08:00
:type="'stationIntroducePcitureUrl'"
/>
</el-form-item>
2022-11-04 14:00:14 +08:00
<el-form-item
label="护理站标签信息"
required
label-width="130px"
style="margin-left: 0px"
>
2022-09-22 08:32:14 +08:00
<el-table
ref="looknurseStationLabel"
:data="looknurseStationLabel"
2022-11-04 14:00:14 +08:00
style="margin-top: 50px"
2022-09-22 08:32:14 +08:00
>
<el-table-column label="标签名称" width="190" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.labelDescription"
maxlength="40"
></el-input>
</template>
</el-table-column>
<el-table-column label="排序" width="200" align="center">
<template slot-scope="scope">
<el-input
2022-11-07 11:28:09 +08:00
v-model="scope.row.labelSort"
2022-11-23 16:37:28 +08:00
maxlength="10"
oninput="value=value.replace(/[^\d]/g,'')"
2022-09-22 08:32:14 +08:00
></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="addnurseStationLabelList"
2022-11-02 15:48:04 +08:00
>新增</el-button
2022-09-22 08:32:14 +08:00
>
<el-button
size="mini"
type="text"
2022-11-11 15:34:09 +08:00
@click="delnurseStationLabelList(scope.$index, scope.row)"
2022-11-02 15:48:04 +08:00
>删除</el-button
2022-09-22 08:32:14 +08:00
>
</template>
</el-table-column>
</el-table>
</el-form-item>
2022-09-20 17:14:55 +08:00
</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="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>仅允许导入xlsxlsx格式文件</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
2022-11-02 15:48:04 +08:00
>下载模板</el-link
2022-09-20 17:14:55 +08:00
>
</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>
2022-11-17 17:28:02 +08:00
<!-- station/list -->
2022-09-20 17:14:55 +08:00
<script>
2022-11-04 09:55:48 +08:00
import {
getStation,
delStation,
addStation,
updateStation,
getFirstLevelInfo,
getSecondaryLevelInfo,
2022-11-11 15:34:09 +08:00
updatePicture,
2022-11-04 09:55:48 +08:00
} from "@/api/system/station";
import stationAcatar from "../stationAvatar/index.vue";
import { getListByUser } from "@/api/system/userlist.js";
import { getToken } from "@/utils/auth";
import editor from "@/components/Editor";
export default {
components: { stationAcatar, editor },
name: "Station",
data() {
var checkMobile = (rule, value, cb) => {
// 验证手机号的正则表达式
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/;
if (regMobile.test(value)) {
return cb();
}
cb(new Error("请输入正确的联系电话"));
};
// 验证手机号的规则
var checkMobile2 = (rule, value, cb) => {
// 验证手机号的正则表达式
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/;
if (!value) {
//所以当没有值的时候我们直接callback让他不校验直接执行下一步
return cb();
} else {
2022-09-30 10:26:47 +08:00
if (regMobile.test(value)) {
return cb();
} else {
2022-11-04 09:55:48 +08:00
cb(new Error("请输入正确的联系电话"));
2022-09-30 10:26:47 +08:00
}
2022-11-04 09:55:48 +08:00
}
};
return {
2022-12-02 15:30:10 +08:00
imgsurl: { pictureUrlList: [] },
2022-11-04 09:55:48 +08:00
imageUrl: "",
imageUrl2: "",
2022-11-16 10:25:34 +08:00
imgtwo: "",
imgone: "",
2022-11-17 10:37:35 +08:00
handstationlist: [], //页面搜索list
2022-11-04 09:55:48 +08:00
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url:
process.env.VUE_APP_BASE_API +
"/system/station/insertNurseStationImportList",
},
//护理类型
nurseTypeCode: "nurse_type_code",
nurseStationTypelist: [],
nurseStationType2: null,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
total2: 0,
//所属护理类型
typelooks: [],
//所属标签
looknurseStationLabel: [
{
labelDescription: "",
2022-11-11 15:34:09 +08:00
sort: "",
2022-11-04 09:55:48 +08:00
ids: 1,
2022-09-27 09:05:46 +08:00
},
2022-11-04 09:55:48 +08:00
],
// 护理站信息表格数据
stationList: [
{
sysAreaVOList: [
{
provinceName: null,
cityName: null,
streetName: null,
},
],
},
],
nurseStationlist: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
typeopen: false,
nurseStationLabelopen: false,
//权限查询
getListByUserquery: {
pageNum: 1,
pageSize: 10,
},
// 查询参数
// 表单参数
form: {},
ids: 1,
provincelist: [],
arealist: [],
citylist: [],
streetlist: [],
resid: null,
// 表单校验
rules: {
agencyIntroduce: [
{ required: true, message: "请输入护理站简介", trigger: "blur" },
],
stationIntroducePcitureUrl: [
{ required: true, message: "请上传护理站简介头像", trigger: "blur" },
],
stationPictureUrl: [
{ required: true, message: "请上传护理站头像", trigger: "blur" },
],
nurseStationDescription: [
{ required: true, message: "护理站总概述不能为空", trigger: "blur" },
],
phone: [
2022-09-22 08:32:14 +08:00
{
2022-11-04 09:55:48 +08:00
required: true,
validator: checkMobile,
trigger: "blur",
message: "",
2022-09-22 08:32:14 +08:00
},
],
2022-11-11 15:34:09 +08:00
2022-11-04 09:55:48 +08:00
dutyPhone: [
2022-09-22 08:32:14 +08:00
{
2022-11-04 09:55:48 +08:00
validator: checkMobile2,
trigger: "blur",
message: "",
2022-09-22 08:32:14 +08:00
},
],
2022-11-04 09:55:48 +08:00
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
address: [{ required: true, message: "地址不能为空", trigger: "blur" }],
longitude: [
{ required: true, message: "经度不能为空", trigger: "blur" },
],
latitude: [
{ required: true, message: "纬度不能为空", trigger: "blur" },
],
areaCode: [
{ required: true, message: "所属区域不能为空", trigger: "blur" },
],
nurseStationName: [
{ required: true, message: "护理站名称不能为空", trigger: "blur" },
],
nurseStationType: [
{ required: true, message: "请选择护理站类型", trigger: "blur" },
],
},
};
},
created() {
2022-11-16 11:40:24 +08:00
this.getaddress();
2022-11-04 09:55:48 +08:00
this.info();
2022-11-17 10:37:35 +08:00
this.infos();
2022-11-04 09:55:48 +08:00
},
methods: {
2022-12-02 15:30:10 +08:00
imgs(item) {
this.imgsurl.pictureUrlList.push(item);
},
2022-11-04 09:55:48 +08:00
imgUrl(imgUrl) {
this.form.stationPictureUrl = imgUrl;
2022-09-22 08:32:14 +08:00
},
2022-11-04 09:55:48 +08:00
imgUrl2(imgUrl) {
this.form.stationIntroducePcitureUrl = imgUrl;
2022-09-20 17:14:55 +08:00
},
2022-11-11 15:34:09 +08:00
delnurseStationLabelList(index, item) {
console.log(index, item);
console.log();
2022-11-04 14:00:14 +08:00
// this.looknurseStationLabel.splice(index,1)
2022-11-11 15:34:09 +08:00
if (this.looknurseStationLabel.length === 1) {
this.looknurseStationLabel = [
{
labelDescription: "",
sort: "",
ids: 1,
},
];
} else {
this.looknurseStationLabel.splice(index, 1);
2022-11-04 09:55:48 +08:00
}
2022-11-07 11:28:09 +08:00
2022-11-04 09:55:48 +08:00
console.log(this.form.nurseStationLabelList);
},
addnurseStationLabelList() {
if (this.looknurseStationLabel.length == 5) {
this.$message.error("最多只能5条");
} else {
2022-11-11 15:34:09 +08:00
this.ids++;
2022-11-04 09:55:48 +08:00
var obj = {
labelDescription: "",
2022-11-11 15:34:09 +08:00
sort: "",
2022-11-04 09:55:48 +08:00
ids: this.ids,
};
this.looknurseStationLabel.push(obj);
}
console.log(this.looknurseStationLabel);
},
2022-11-18 12:49:07 +08:00
2022-11-04 09:55:48 +08:00
//点击街道
clickstreet(item) {
this.form.areaCode = item.areaCode;
2022-11-16 10:25:34 +08:00
console.log(item, this.form);
2022-11-04 09:55:48 +08:00
},
//点击区县城
clickarea(item) {
2022-11-15 14:50:42 +08:00
this.form.areaCode = "";
2022-11-16 10:45:51 +08:00
this.form.streetCode = "";
2022-11-04 09:55:48 +08:00
getSecondaryLevelInfo(item.id).then((res) => {
this.streetlist = res.data;
});
},
//点击市
clickcity(item) {
2022-11-15 14:50:42 +08:00
this.form.regionName = "";
this.form.areaCode = "";
2022-11-16 10:45:51 +08:00
this.form.streetCode = "";
2022-11-04 09:55:48 +08:00
getSecondaryLevelInfo(item.id).then((res) => {
this.arealist = res.data;
});
},
//点击省
province(item) {
2022-11-15 14:50:42 +08:00
this.form.cityName = "";
this.form.regionName = "";
this.form.areaCode = "";
2022-11-16 10:45:51 +08:00
this.form.streetCode = "";
2022-11-04 09:55:48 +08:00
getSecondaryLevelInfo(item.id).then((res) => {
this.citylist = res.data;
});
},
/** 查询护理站信息列表 */
2022-11-16 11:40:24 +08:00
getaddress() {
2022-11-04 09:55:48 +08:00
getFirstLevelInfo().then((res) => {
this.provincelist = res.data;
});
2022-11-16 11:40:24 +08:00
},
2022-11-04 09:55:48 +08:00
// 取消按钮
cancel() {
2022-11-11 15:34:09 +08:00
var obj = { pictureUrlList: [] };
2022-11-16 10:25:34 +08:00
if (this.imgone != this.form.stationIntroducePcitureUrl) {
2022-11-11 15:34:09 +08:00
obj.pictureUrlList.push(this.form.stationIntroducePcitureUrl);
}
2022-11-16 10:25:34 +08:00
if (this.imgtwo != this.form.stationPictureUrl) {
2022-11-11 15:34:09 +08:00
obj.pictureUrlList.push(this.form.stationPictureUrl);
}
if (obj.pictureUrlList.length > 0) {
2022-11-16 10:25:34 +08:00
updatePicture(obj).then((res) => {});
2022-11-11 15:34:09 +08:00
}
2022-12-02 15:30:10 +08:00
if (this.imgsurl.pictureUrlList.length > 0) {
updatePicture(this.imgsurl).then((res) => {});
}
this.imgsurl = { pictureUrlList: [] };
2022-11-04 09:55:48 +08:00
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.nurseStationType2 = [];
this.form = {
id: null,
areaCode: null,
nurseStationCode: null,
nurseStationName: null,
nurseStationType: null,
2022-11-02 15:48:04 +08:00
agencyIntroduce: null,
nurseStationDescription: null,
longitude: null,
latitude: null,
phone: null,
address: null,
dutyPerson: null,
dutyPhone: null,
stationPictureUrl: null,
stationIntroducePcitureUrl: null,
sort: null,
nurseStationLabelList: [],
2022-11-16 11:40:24 +08:00
streetCode: null,
2022-11-02 15:48:04 +08:00
};
this.resetForm("form");
},
/** 搜索按钮操作 */
liststationinfo() {
2022-11-17 10:37:35 +08:00
this.loading = true;
2022-11-18 12:49:07 +08:00
this.info();
2022-11-02 15:48:04 +08:00
},
handleQuery() {
this.loading = true;
2022-11-17 17:28:02 +08:00
this.getListByUserquery.pageNum = 1;
this.info();
2022-11-02 15:48:04 +08:00
},
/** 重置按钮操作 */
resetQuery() {
2022-11-18 12:49:07 +08:00
this.getListByUserquery = {
pageNum: 1,
pageSize: 10,
areaCode: null,
userId: null,
nurseStationCode: null,
nurseStationName: null,
nurseStationType: null,
agencyIntroduce: null,
nurseStationDescription: null,
longitude: null,
latitude: null,
phone: null,
address: null,
dutyPerson: null,
dutyPhone: null,
stationPictureUrl: null,
sort: null,
};
this.resetForm("queryForm");
this.handleQuery();
2022-11-02 15:48:04 +08:00
},
// 多选框选中数据
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.looknurseStationLabel = [
{
labelDescription: "",
2022-11-11 15:34:09 +08:00
sort: "",
2022-11-02 15:48:04 +08:00
ids: 1,
},
];
this.title = "添加护理站信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.loading = true;
const id = row.id || this.ids;
2022-11-04 14:05:17 +08:00
getStation(id).then((response) => {
this.form = response.data;
2022-11-16 10:25:34 +08:00
this.form.streetCode = this.form.streetName;
2022-11-11 15:34:09 +08:00
this.imgone = this.form.stationIntroducePcitureUrl;
this.imgtwo = this.form.stationPictureUrl;
2022-11-04 14:05:17 +08:00
this.looknurseStationLabel = response.data.nurseStationLabel;
this.open = true;
this.loading = false;
2022-11-16 11:40:24 +08:00
console.log(this.form);
2022-11-04 14:05:17 +08:00
});
2022-11-02 15:48:04 +08:00
},
/** 提交按钮 */
submitForm() {
this.form.nurseStationLabelList = this.looknurseStationLabel;
this.form.nurseStationType = this.nurseStationType2;
console.log(this.form);
this.$refs["form"].validate((valid) => {
if (valid) {
this.form.areaCode = Number(this.form.areaCode);
this.form.nurseStationType = this.nurseStationType2.join(",");
if (this.form.id != null) {
updateStation(this.form).then((response) => {
2022-11-16 11:40:24 +08:00
var obj = { pictureUrlList: [] };
if (this.imgone != this.form.stationIntroducePcitureUrl) {
obj.pictureUrlList.push(this.imgone);
}
if (this.imgtwo != this.form.stationPictureUrl) {
obj.pictureUrlList.push(this.imgtwo);
}
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {});
}
2022-11-02 15:48:04 +08:00
this.$modal.msgSuccess("修改成功");
this.open = false;
2022-11-17 17:28:02 +08:00
this.info();
2022-09-20 17:14:55 +08:00
});
2022-11-02 15:48:04 +08:00
} else {
addStation(this.form).then((response) => {
if (response.code) {
this.$modal.msgSuccess("新增成功");
2022-09-22 08:32:14 +08:00
this.open = false;
2022-11-17 17:28:02 +08:00
this.info();
2022-11-02 15:48:04 +08:00
} else {
this.form.nurseStationType = obj;
}
});
2022-09-20 17:14:55 +08:00
}
2022-11-02 15:48:04 +08:00
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm("是否确认删除此护理站信息?")
.then(function () {
return delStation(ids);
})
.then(() => {
2022-11-16 11:40:24 +08:00
var obj = { pictureUrlList: [] };
obj.pictureUrlList.push(row.stationIntroducePcitureUrl);
obj.pictureUrlList.push(row.stationPictureUrl);
if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {});
}
2022-11-17 17:28:02 +08:00
this.info();
2022-11-02 15:48:04 +08:00
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/station/export",
{
2022-11-17 17:28:02 +08:00
...this.getListByUserquery,
2022-11-02 15:48:04 +08:00
},
`station_${new Date().getTime()}.xlsx`
);
},
/** 导入按钮操作 */
handledata() {
2022-11-02 18:11:38 +08:00
this.upload.title = "护理站信息导入";
2022-11-02 15:48:04 +08:00
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download(
"/system/station/downloadTemplate?fileType=nurseStation",
{},
`护理站信息导入模板.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;'>" +
2022-09-20 17:14:55 +08:00
response.msg +
"</div>",
2022-11-02 15:48:04 +08:00
"导入结果",
{ dangerouslyUseHTMLString: true }
);
2022-11-17 17:28:02 +08:00
this.info();
2022-11-02 15:48:04 +08:00
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
2022-11-17 17:28:02 +08:00
//护理站限列表
2022-11-02 15:48:04 +08:00
info() {
2022-11-17 17:28:02 +08:00
//加个所属区域
2022-11-02 15:48:04 +08:00
getListByUser(this.getListByUserquery).then((res) => {
2022-11-18 12:49:07 +08:00
this.nurseStationlist = res.rows;
this.total2 = res.total;
this.loading = false;
2022-11-02 15:48:04 +08:00
});
},
2022-11-17 10:37:35 +08:00
infos() {
var queryFor = {
pageNum: 1,
2022-11-18 12:49:07 +08:00
pageSize: 9999,
2022-11-17 10:37:35 +08:00
};
getListByUser(queryFor).then((res) => {
2022-11-18 12:49:07 +08:00
console.log(res);
2022-11-17 10:37:35 +08:00
this.handstationlist = res.rows;
});
2022-09-23 14:45:51 +08:00
},
2022-11-02 15:48:04 +08:00
},
};
2022-09-20 17:14:55 +08:00
</script>