<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">
        <el-button type="" class="stationbtn" @click="ParamsStation(true)">{{
          queryParams.nurseStationName
        }}</el-button>
      </el-form-item>
      <el-form-item label="护理项目" prop="nurseItemId" label-width="100px">
        <el-button type="" class="stationbtn" @click="ParamsStationxm(true)">{{
          queryParams.nurseItemName
        }}</el-button>
      </el-form-item>
      <el-form-item label="海报名称" prop="poserName">
        <el-input
          v-model="queryParams.poserName"
          placeholder="请输入海报名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="海报所属模块" prop="moduleType">
        <el-select
          v-model="queryParams.moduleType"
          placeholder="请选择"
          style="width: 208px"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="海报编号" prop="poserCode">
        <el-input
          v-model="queryParams.poserCode"
          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:poser: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:poser: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:poser: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:poser:export']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <el-table
      v-loading="loading"
      :data="poserList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
        label="所属护理站"
        align="center"
        prop="nurseStationName"
      />
      <el-table-column
        label="所属护理项目"
        align="center"
        prop="nurseItemName"
      />
      <el-table-column label="海报名称" align="center" prop="poserName" />
      <el-table-column label="海报编号" align="center" prop="poserCode" />
      <el-table-column label="海报简介" align="center" prop="posterIntroduce" />
      <el-table-column label="海报所属模块" align="center" prop="moduleType">
        <template slot-scope="scope">
          {{
            scope.row.moduleType == "NURSE_AGENCY_MODULE" ? "护理机构模块" : ""
          }}
          {{
            scope.row.moduleType == "NURSE_ITEM_MODULE" ? "护理项目模块" : ""
          }}
          {{
            scope.row.moduleType == "HEALTH_CONSUTION_MODULE"
              ? "健康咨询模块"
              : ""
          }}
          {{ scope.row.moduleType == "HOME_PAGE_MODULE" ? "首页模块" : "" }}
        </template>
      </el-table-column>
      <el-table-column label="海报图片跳转标识" align="center" prop="jumpType">
        <template slot-scope="scope">
          {{ scope.row.jumpType == "NEW_PEOPLE_WELFARE" ? "新人福利" : "" }}
          {{ scope.row.jumpType == "HOME_PAGE" ? "首页" : "" }}
          {{ scope.row.jumpType == "SHOPPING" ? "商城" : "" }}
        </template>
      </el-table-column>
      <el-table-column label="海报显示顺序" align="center" prop="poserSort" />
      <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:poser:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:poser: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="1100px"
      :before-close="cancel"
      append-to-body
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-width="110px"
        :inline="true"
      >
        <el-form-item label="海报名称" prop="poserName">
          <el-input v-model="form.poserName" placeholder="请输入海报名称" />
        </el-form-item>
        <el-form-item label="海报所属模块" prop="moduleType">
          <el-select
            v-model="form.moduleType"
            placeholder="请选择"
            style="width: 208px"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="所属护理站"
          prop="nurseStationId"
          v-if="
            form.moduleType == 'NURSE_AGENCY_MODULE' ||
            form.moduleType == 'NURSE_ITEM_MODULE'
          "
        >
          <template>
            <el-button
              type=""
              @click="ParamsStation(false)"
              style="
                width: 208px;
                text-align: left;
                height: 36px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                color: #c0c4cc;
              "
              v-if="form.nurseStationName == '请选择所属护理站'"
              >{{ form.nurseStationName }}</el-button
            >
            <el-button
              type=""
              style="
                width: 208px;
                text-align: left;
                height: 36px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              "
              @click="ParamsStation(false)"
              v-else
              >{{ form.nurseStationName }}</el-button
            >
          </template>
        </el-form-item>
        <el-form-item
          label="所属护理项目"
          prop="nurseItemId"
          v-if="form.moduleType == 'NURSE_ITEM_MODULE'"
        >
          <template>
            <el-button
              type=""
              style="
                width: 208px;
                text-align: left;
                height: 36px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                color: #c0c4cc;
              "
              @click="ParamsStationxm(false)"
              v-if="form.nurseItemName == '请选择所属护理项目'"
              >{{ form.nurseItemName }}</el-button
            >
            <el-button
              type=""
              style="
                width: 208px;
                text-align: left;
                height: 36px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              "
              @click="ParamsStationxm(false)"
              v-else
              >{{ form.nurseItemName }}</el-button
            >
          </template></el-form-item
        >
        <el-form-item label="海报显示顺序" prop="poserSort">
          <el-input v-model="form.poserSort" placeholder="请输入海报显示顺序" />
        </el-form-item>
        <el-form-item label="海报图片" prop="posterPictureUrl">
          <el-table
            label-width="50px"
            style="margin-top: 20px"
            :data="form.posterPictureUrlLists"
          >
            <el-table-column label="图片" align="center" width="300">
              <template slot-scope="scope">
                <stationAcatar
                  @item="imgUrl"
                  :img="scope.row.posterPictureUrl"
                  :type="'posterPictureUrl'"
                  :item="scope.row"
                />
              </template>
            </el-table-column>
            <el-table-column label="图片跳转标识" align="center" width="300">
              <template slot-scope="scope">
                <el-select
                  v-model="scope.row.jumpType"
                  placeholder="请选择"
                  style="width: 208px"
                >
                  <el-option
                    v-for="item in jumpTypes"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" width="250">
              <template slot-scope="scope">
                <el-button size="mini" type="text" @click="addPictureUrl"
                  >新增</el-button
                >
                <el-button
                  size="mini"
                  type="text"
                  @click="delPictureUrl(scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>
        <el-form-item label="海报视频">
          <!-- <video
            v-if="videoForm.showVideoPath != ''"
            v-bind:src="videoForm.showVideoPath"
            class="avatar video-avatar"
            controls="controls"
          >
            您的浏览器不支持视频播放
          </video> -->
          <stationAcatar
            style="width: 208px"
            @imgUrl="imgUrl2"
            :tovideo="form.posterVideoUrl"
            :type="'posterVideoUrl'"
            v-if="open"
          />
        </el-form-item>
        <el-form-item label="海报简介">
          <textarea
            name=""
            id=""
            cols="80"
            rows="10"
            v-model="form.posterIntroduce"
          ></textarea>
        </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="info"
            >搜索</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="stationid == 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="info"
      />
    </el-dialog>
    <!-- 护理项目 -->
    <el-dialog
      title="选择所属护理项目"
      :visible.sync="nurseItemshow"
      width="1100px"
      append-to-body
      :before-close="cancelnurseItemshow"
    >
      <el-form :model="nurseItemquery" label-width="150px" :inline="true">
        <el-form-item label="护理项目编码" prop="nurseItemCode">
          <el-input
            v-model="nurseItemquery.nurseItemCode"
            placeholder="请输入护理项目编码"
          />
        </el-form-item>
        <el-form-item label="护理项目名称" prop="nurseItemName">
          <el-input
            v-model="nurseItemquery.nurseItemName"
            placeholder="请输入护理项目名称"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="nurseItemlistInfo"
            >搜索</el-button
          >
          <el-button
            icon="el-icon-refresh"
            size="mini"
            @click="nurseItemlistcancel"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        v-loading="loading"
        :data="nurseItemlist"
        @cell-dblclick="choicenurseItem"
      >
        <el-table-column label="请选择" width="70" align="center">
          <template slot-scope="scope">
            <el-button
              type="primary"
              style="width: 15px; height: 15px"
              circle
              @click="choicenurseItem(scope.row)"
              v-if="nurseitemid == scope.row.id"
            ></el-button>

            <el-button
              style="width: 15px; height: 15px"
              circle
              v-else
              @click="choicenurseItem(scope.row)"
            >
            </el-button>
          </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="护理项目分类名称"
          align="center"
          prop="nurseItemName"
        />
        <el-table-column label="创建时间" align="center" prop="createTime" />
        <el-table-column label="创建人" align="center" prop="createBy" />
      </el-table>
      <pagination
        v-show="nurseItemtotal > 0"
        :total="nurseItemtotal"
        :page.sync="nurseItemquery.pageNum"
        :limit.sync="nurseItemquery.pageSize"
        @pagination="nurseItemlistInfo"
      />
    </el-dialog>
  </div>
</template>

<script>
import baseurl from "@/api/baseurl.js";
import {
  listPoser,
  getPoser,
  delPoser,
  addPoser,
  getListByUser,
  updatePoser,
  updatePicture,
} from "@/api/system/poser";
import { list } from "@/api/system/nurseItem";
import stationAcatar from "../stationAvatar/index.vue";
import editor from "@/components/Editor";
export default {
  name: "Poser",
  components: { stationAcatar, editor },
  data() {
    return {
      // 遮罩层
      loading: true,
      getListByUserquery: {
        pageNum: 1,
        pageSize: 10,
      },
      nurseStationlist: [],
      nurseStationshow: false,
      imgs: { pictureUrlList: [] },
      // 选中数组
      ids: [],
      itemids: [],
      Types: [],
      idd: 9999999,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      nurseItemshow: false,
      // 总条数
      total: 0,
      total2: 0,
      total4: 0,
      nurseItemtotal: 0,
      nurseItemlist: [],
      // 泉医到家系统海报模块信息（包含咨询简介信息）表格数据
      poserList: [],
      nurseItemList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      nurseItemquery: {
        pageNum: 1,
        pageSize: 10,
        nurseItemCode: null,
        nurseItemName: null,
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        nurseStationId: null,
        nurseItemId: null,
        nursenurseItemId: null,
        poserName: null,
        poserCode: null,
        posterIntroduce: null,
        posterPictureUrl: null,
        posterVideoUrl: null,
        moduleType: null,
        poserSort: null,
        jumpLink: null,
        jumpType: null,
      },
      // 表单参数
      form: {
        nurseStationId: null,
        nurseTypeId: null,
        nurseItemName: "",
        nurseItemContent: "",
        advanceAppointDuration: "",
        itemPictureUrl: "",
        sort: "",
        nurseStationId: "",
        nurseStationName: "请选择所属护理站",
        nurseItemName: "请选择所属护理项目",
        nurseItemId: "",
      },
      // 表单校验
      rules: {
        moduleType: [
          { required: true, message: "请选择海报所属模块", trigger: "blur" },
        ],
        poserName: [
          { required: true, message: "请输入海报名称", trigger: "blur" },
        ],
        nurseStationId: [
          { required: true, message: "请选择所属护理站", trigger: "blur" },
        ],
        posterIntroduce: [
          { required: true, message: "请输入海报简介", trigger: "blur" },
        ],
        posterPictureUrl: [
          { required: true, message: "请选择海报图片", trigger: "blur" },
        ],
        posterVideoUrl: [
          { required: true, message: "请选择海报视频", trigger: "blur" },
        ],
        poserSort: [
          { required: true, message: "请输入海报顺序", trigger: "blur" },
        ],
        nurseItemId: [
          { required: true, message: "请选择所属护理项目", trigger: "blur" },
        ],
      },
      options: [
        {
          value: "NURSE_AGENCY_MODULE",
          label: "护理机构模块",
        },
        {
          value: "NURSE_ITEM_MODULE",
          label: "护理项目模块",
        },
        {
          value: "HEALTH_CONSUTION_MODULE",
          label: "健康咨询模块",
        },
        {
          value: "HOME_PAGE_MODULE",
          label: "首页模块",
        },
      ],
      jumpTypes: [
        {
          value: "NEW_PEOPLE_WELFARE",
          label: "新人福利",
        },
        {
          value: "HOME_PAGE",
          label: "首页",
        },
        {
          value: "SHOPPING",
          label: "商城",
        },
      ],
      //页面链接
      stationid: "",
      nurseitemid: "",
      homenumber: false,
      videourl: "",
      videoFlag: false,
      //是否显示进度条
      videoUploadPercent: "",
      //进度条的进度，
      isShowUploadVideo: false,
      //显示上传按钮
      videoForm: {
        showVideoPath: "", //回显的变量
      },
    };
  },
  created() {
    this.videourl = baseurl + "/system/station/updateNurseStationHeads";
    this.getList();
    this.nurseItemlistInfo();
  },
  methods: {
    //删除海报图片列表
    delPictureUrl(item) {
      console.log(item);
      if (item.idd && !item.id) {
        if (this.form.posterPictureUrlLists.length == 1) {
          this.$message.error("最后一条不可删除");
        } else {
          this.form.posterPictureUrlLists =
            this.form.posterPictureUrlLists.filter((e) => e.idd != item.idd);
        }
      } else if (!item.idd && item.id) {
        if (this.form.posterPictureUrlLists.length == 1) {
          this.$message.error("最后一条不可删除");
        } else {
          this.form.posterPictureUrlLists =
            this.form.posterPictureUrlLists.filter((e) => e.id != item.id);
        }
      }
    },
    //新增海报图片列表
    addPictureUrl() {
      this.idd++;
      var obj = {
        posterPictureUrl: "",
        jumpType: "",
        idd: this.idd,
      };
      if (this.form.posterPictureUrlLists.length >= 5) {
        this.$message.error("最多新增5条");
      } else {
        this.form.posterPictureUrlLists.push(obj);
      }
    },
    //打开遮罩层
    clicknurseItemshow() {
      this.nurseItemshow = true;
      this.nurseItemlistcancel();
    },
    //关闭遮罩层
    cancelnurseItemshow() {
      this.nurseItemshow = false;
    },
    //选中护理项目
    choicenurseItem(e) {
      this.nurseitemid = e.id;
      if (this.homenumber) {
        this.queryParams.nurseItemName = e.nurseItemName;
        this.queryParams.nurseItemId = e.id;
        this.form.nurseItemId = e.id;
      } else {
        this.form.nurseItemId = e.id;
        this.form.nurseItemName = e.nurseItemName;
      }
      this.nurseItemshow = false;
    },
    //重置
    nurseItemlistcancel() {
      this.nurseItemquery = {
        pageNum: 1,
        pageSize: 10,
        nurseItemCode: null,
        nurseItemName: null,
      };
      this.nurseItemlistInfo();
    },
    //搜索
    nurseItemlistInfo() {
      list(this.nurseItemquery).then((res) => {
        this.nurseItemlist = res.rows;
        this.nurseItemtotal = res.total;
      });
    },
    //所属护理站页面
    ParamsStation(item) {
      this.info();
      this.nurseStationshow = true;
      this.homenumber = item;
      if (this.homenumber) {
        this.stationid = this.queryParams.nurseStationId;
      } else {
        this.stationid = this.form.nurseStationId;
      }
    },
    //所属护理项目页面
    ParamsStationxm(item) {
      if (this.nurseItemquery.nurseStationId) {
        this.nurseItemlistInfo();
        this.homenumber = item;
        this.nurseItemshow = true;
        if (this.homenumber) {
          this.nurseitemid = this.queryParams.nurseItemId;
        } else {
          this.nurseitemid = this.form.nurseItemId;
        }
      } else {
        this.$modal.msgError("请先选择所属护理站");
      }
    },
    //护理站list
    info() {
      getListByUser(this.getListByUserquery).then((res) => {
        this.nurseStationlist = res.rows;
        this.total4 = res.total;
      });
    },
    //打开护理站列表
    nurseStationshowclick() {
      this.stationcancel();
      this.stationid = this.form.nurseStationId;
      this.nurseStationshow = true;
    },
    //护理站重置
    stationcancel() {
      this.getListByUserquery = {
        pageNum: 1,
        pageSize: 10,
      };
      this.info();
    },
    //护理站页面  =》选择护理站
    choicestationid(item) {
      if (this.homenumber) {
        this.queryParams.nurseStationName = item.nurseStationName;
        this.queryParams.nurseStationId = item.id;
      } else {
        this.stationid = item.id;
        this.form.nurseStationId = item.id;
        this.form.nurseStationName = item.nurseStationName;
      }
      this.nurseItemquery.nurseStationId = item.id;
      this.nurseStationshow = false;
      this.stationcancel();
    },
    //关闭护理站页面
    clicknurseStationshow() {
      this.nurseStationshow = false;
    },
    imgss(item) {
      this.imgs.pictureUrlList.push(item);
    },
    //图片传值过来接收
    imgUrl(imgUrl) {
      console.log(imgUrl);
    },
    imgUrl2(imgUrl) {
      this.videoForm.showVideoPath = baseurl + imgUrl;
      this.form.posterVideoUrl = imgUrl;
    },
    /** 查询泉医到家系统海报模块信息（包含咨询简介信息）列表 */
    getList() {
      this.loading = true;
      listPoser(this.queryParams).then((response) => {
        this.poserList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      var obj = { pictureUrlList: [] };
      if (obj.pictureUrlList.length > 0) {
        updatePicture(obj).then((res) => {});
      }
      if (this.imgs.pictureUrlList.length > 0) {
        updatePicture(this.imgs).then((res) => {});
      }
      this.nurseItemquery.nurseStationId = null;
      this.imgs = { pictureUrlList: [] };
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        posterPictureUrlLists: [
          {
            posterPictureUrl: "",
            jumpType: "",
            idd: this.idd,
          },
        ],
        id: null,
        poserName: null,
        posterPictureUrl: null,
        posterVideoUrl: null,
        posterVideoUrl2: null,
        poserSort: null,
        nurseStationName: "请选择所属护理站",
        nurseStationId: null,
        nurseItemName: "请选择所属护理项目",
        nurseItemId: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.nurseItemquery = {
        pageNum: 1,
        pageSize: 10,
      };
      this.stationid = "";
      this.nurseitemid = "";
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
      };
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.nurseStationId);
      this.itemids = selection.map((item) => item.nurseItemId);
      this.Types = selection.map((item) => item.moduleType);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加海报模块信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.nurseStationId || this.ids;
      const itemid = row.nurseItemId || this.itemids;
      const type = row.moduleType || this.Types;
      getPoser(type, id, itemid).then((response) => {
        this.form = response.data;
        if (response.data.goodAttributeDetailsLists) {
          this.goodDetailsLists = response.data.goodAttributeDetailsLists;
        }
        this.nurseItemquery.nurseStationId = response.data.nurseStationId;
        this.open = true;
        this.title = "修改海报模块信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updatePoser(this.form).then((response) => {
              var obj = { pictureUrlList: [] };
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPoser(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 delPoser(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "system/poser/export",
        {
          ...this.queryParams,
        },
        `poser_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style  lang="scss" scoped>
.avatar-uploader-icon {
  border: 1px dashed #d9d9d9 !important;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9 !important;
  border-radius: 6px !important;
  position: relative !important;
  overflow: hidden !important;
}
.avatar-uploader .el-upload:hover {
  border: 1px dashed #d9d9d9 !important;
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 208px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 208px;
  height: 178px;
  display: block;
}
.stationbtn {
  width: 208px;
  text-align: left;
  height: 32px;
  overflow: hidden;
  font-size: 14px;
}
</style>
