<template>
  <div style="background-color: #f7f7f7; padding: 10px 10px">
    <div class="zhuti">
      <div style="height: 58px; line-height: 58px">
        <div style="color: #0006">
          <span>问卷调查</span> <span style="padding: 0 5px">></span>
          <span style="color: #000000e6">题库管理</span>
        </div>
      </div>
      <!-- 线上 -->
      <div>
        <!-- 搜索 -->

        <div class="formSearch">
          <el-form :inline="true" :model="formSel">
            <el-form-item label="题库管理">
              <el-select v-model="formSel.questionBank" placeholder="请选择" style="width: 168px; margin-right: 15px"
                @change="tikuBox">
                <el-option label="用户端题库" value="用户端题库" />
                <el-option label="商户端题库" value="商户端题库" />
                <el-option label="公共端题库" value="公共端题库" />
              </el-select>
            </el-form-item>
            <el-form-item label="题目">
              <el-input v-model="formSel.tikuTitle" placeholder="请输入" style="width: 168px" />
            </el-form-item>
            <el-form-item label="题型">
              <el-select v-model="formSel.questionType" placeholder="请选择" style="width: 168px; margin-right: 15px">
                <el-option label="单选" value="单选" />
                <el-option label="多选" value="多选" />
                <el-option label="文本" value="文本" />
              </el-select>
            </el-form-item>
          </el-form>
          <div>
            <el-button style="background-color: #3f9b6a; color: #fff" @click="onSubmit">查询
            </el-button>
            <el-button class="buttonHover" style="
                color: #606266;
                border: 1px solid #dddfe5;
                background-color: #fff;
              " @click="resetting">重置
            </el-button>
          </div>
        </div>
        <div style="margin-bottom: 20px">
          <div>
            <el-button style="background-color: #3f9b6a; color: #fff; padding: 8px 15px"
              icon="el-icon-circle-plus-outline" @click="addTimu">新增</el-button>
          </div>
        </div>
        <!-- 表格 -->

        <el-table :data="tableData.slice(
					(currentPage - 1) * pageSize,
					currentPage * pageSize
				)
					" :header-cell-style="{
						fontSize: '14px',
						color: '#0009',
						fontWeight: 'normal',
						backgroundColor: '#F2F3F5',
					}" tooltip-effect="dark custom-tooltip-effect">
          <el-table-column label="序号" min-width="150">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>

          <el-table-column label="题目" prop="tikuTitle" min-width="300" show-overflow-tooltip />
          <el-table-column label="题型" prop="questionType" min-width="150" />

          <!-- <el-table-column label="创建人" prop="createUser" min-width="150">
          </el-table-column> -->
          <el-table-column prop="createDate" label="创建时间" min-width="200" />
          <el-table-column label="操作" min-width="200">
            <template slot-scope="scope">
              <div class="tableBtn greens" @click="details(0, scope.row)">
                查看
              </div>
              <div class="tableBtn greens" @click="bianls(scope.row)">编辑</div>
              <!-- <div @click="" class="tableBtn greens">发布</div>
              <div @click="" class="tableBtn greens">下架</div> -->
              <div class="tableBtn greens" @click="tikuDel(scope.row)">
                删除
              </div>
              <!-- <div @click="addbuss(3,scope.row)" class="tableBtn greens">终止</div> -->
            </template>
          </el-table-column>
        </el-table>
        <div class="fenye">
          <el-pagination :hide-on-single-page="flag" background small size="mini" :current-page="currentPage"
            :page-sizes="[10, 20, 50, 100]" layout="prev, pager, next,total" :total="total"
            @size-change="handleSizeChange" @current-change="handleCurrentChange" />
        </div>
      </div>
    </div>
    <!-- 详情框 -->
    <el-dialog :visible.sync="detbox" custom-class="tongyong_css" style="padding: 0" width="50%" center
      :close-on-click-modal="false" :show-close="false">
      <div style="padding: 20px">
        <div style="font-size: 14px; padding-bottom: 20px; color: #000">
          详情页
        </div>
        <div>
          <el-descriptions class="margin-top" :column="1" border :label-style="labelStyle"
            :content-style="contentStyle">
            <el-descriptions-item>
              <template slot="label"> 题目 </template>
              {{ secondData.tikuTitle }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 题型 </template>
              {{ secondData.questionType }}
            </el-descriptions-item>
			<el-descriptions-item v-if="secondData.questionType == '多选'">
              <template slot="label"> 最多可选 </template>
              {{ secondData.maxChoose || '0' }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 隶属题库 </template>
              {{ secondData.questionBank }}
            </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="secondData.questionType != '文本'" class="margin-top" :column="1" border
            :label-style="labelStyle" :content-style="contentStyle">
            <el-descriptions-item>
              <template slot="label"> 默认是否必填 </template>
              {{ secondData.isRequired }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 设置内容 </template>
              <div v-for="(value, key) in secondData.optionSettings" :key="key">
                {{ key }}：{{ value }}
              </div>
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <div style="padding-top: 20px; display: flex; justify-content: flex-end">
          <el-button class="buttonHover" style="
              color: #606266;
              border: 1px solid #dddfe5;
              background-color: #fff;
            " @click="detbox = false">返回</el-button>
        </div>
      </div>
    </el-dialog>

    <!-- 新增 -->
    <el-dialog :visible.sync="ggXin" custom-class="tongyong_css" style="padding: 0" width="60%" class="dialog_css_Xq"
      center :close-on-click-modal="false" :show-close="false">
      <div style="padding: 20px">
        <div style="font-size: 14px; padding-bottom: 20px; color: #000">
          新增题目
        </div>
        <div style="padding: 20px">
          <el-form ref="reform" :model="formInline" label-width="140px" :rules="rules">
            <el-form-item label="题目" prop="tikuTitle">
              <el-input v-model="formInline.tikuTitle" maxlength="100" />
            </el-form-item>
            <el-form-item label="题型" prop="questionType">
              <el-select v-model="formInline.questionType" placeholder="请选择">
                <el-option label="单选" value="单选" />
                <el-option label="多选" value="多选" />
                <el-option label="文本" value="文本" />
              </el-select>
            </el-form-item>
            <!-- 如果formInline.questionType为多选，那么就显示最多可以选择多少个，计步器来设置，默认是 0 -->
            <el-form-item v-if="formInline.questionType == '多选'" label="最多可选" prop="maxChoose">
              <el-input-number v-model="formInline.maxChoose" :min="0" :max="options.length" />0为不限制填写数量
            </el-form-item>
            <el-form-item label="隶属题库" prop="questionBank">
              <el-select v-model="formInline.questionBank" placeholder="请选择">
                <el-option label="用户端题库" value="用户端题库" />
                <el-option label="商户端题库" value="商户端题库" />
                <el-option label="公共端题库" value="公共端题库" />
              </el-select>
            </el-form-item>
            <el-form-item label="布局类型" prop="layoutType">
              <el-radio-group v-model="formInline.layoutType" style="margin-top: 13px">
                <el-radio :label="1">垂直布局</el-radio>
                <el-radio :label="2">自由布局</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="是否必填" prop="isRequired">
              <!-- <el-select v-model="formInline.isRequired" placeholder="请选择">
                 <el-option label="必填" value="必填" />
                 <el-option label="非必填" value="非必填" />
               </el-select> -->
              <el-radio-group v-model="formInline.isRequired" style="margin-top: 13px">
                <el-radio label="必填">必填</el-radio>
                <el-radio label="非必填">非必填</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item v-if="formInline.questionType != '文本'" label="答案设置" prop="optionSettings">
              <el-table :data="options" :header-cell-style="{
								fontSize: '14px',
								color: '#0009',
								fontWeight: 'normal',
								backgroundColor: '#F2F3F5',
							}">
                <el-table-column prop="index" label="序号" width="80">
                  <template #default="scope">
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="选项名称" width="300">
                  <template #default="scope">
                    <el-input v-model="scope.row.name" :readonly="scope.row.readonly" maxlength="50" />
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="分数">
                  <template #default="scope">
                    <el-input v-model.number="scope.row.num" :min="0" :max="100" :readonly="scope.row.readonly"
                      @input="validateScore(scope.row)" />
                  </template>
                </el-table-column>
                <el-table-column label=""  min-width="120">
                  <template #default="{ $index }">
                    <span style="cursor: pointer;margin-right: 5px; color: #3F9B6A;" @click="answerMoveUp($index)"
                      v-if="$index != 0">↑</span>
                    <span style="cursor: pointer; color: #3F9B6A;" @click="answerMoveDown($index)"
                      v-if="$index != (options.length - 1)">↓</span>
                  </template>
                </el-table-column>
                <el-table-column label="操作">
                  <template #default="scope">
                    <div class="tableBtn greens" @click="deleteOption(scope.$index)">
                      删除
                    </div>
                  </template>
                </el-table-column>
              </el-table>
              <el-button style="width: 100%; background-color: #3f9b6a; color: #fff" @click="addOption">+
                添加</el-button>
            </el-form-item>
          </el-form>
        </div>

        <div style="padding-top: 20px; display: flex; justify-content: flex-end">
          <el-button class="buttonHover" style="
              color: #606266;
              border: 1px solid #dddfe5;
              background-color: #fff;
            " @click="closeFn(1)">返回</el-button>
          <el-button style="background-color: #3f9b6a; color: #fff" @click="addCheck(2)">确认</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 编辑 -->
    <el-dialog :visible.sync="bainjiBox" custom-class="tongyong_css" style="padding: 0" width="60%" center
      :close-on-click-modal="false" :show-close="false">
      <div style="padding: 20px">
        <div style="font-size: 14px; padding-bottom: 20px; color: #000">
          编辑题目
        </div>
        <div style="padding: 20px">
          <el-form ref="bianform" :model="secondData" :rules="rules" label-width="140px">
            <el-form-item label="题目" prop="tikuTitle">
              <el-input v-model="secondData.tikuTitle" maxlength="100" />
            </el-form-item>
            <el-form-item label="题型" prop="questionType">
              <el-select v-model="secondData.questionType" placeholder="请选择" disabled>
                <el-option label="单选" value="单选" />
                <el-option label="多选" value="多选" />
                <el-option label="文本" value="文本" />
              </el-select>
            </el-form-item>
            <!-- 如果formInline.questionType为多选，那么就显示最多可以选择多少个，计步器来设置，默认是 0 -->
            <el-form-item v-if="secondData.questionType == '多选'" label="最多可选" prop="maxChoose">
              <el-input-number v-model="secondData.maxChoose" :min="0" :max="options.length" /> 0为不限制填写数量
            </el-form-item>
            <el-form-item label="隶属题库" prop="questionBank">
              <el-select v-model="secondData.questionBank" placeholder="请选择">
                <el-option label="用户端题库" value="用户端题库" />
                <el-option label="商户端题库" value="商户端题库" />
                <el-option label="公共端题库" value="公共端题库" />
              </el-select>
            </el-form-item>
            <el-form-item label="布局类型" prop="layoutType">
              <el-radio-group v-model="secondData.layoutType" style="margin-top: 13px">
                <el-radio :label="1">垂直布局</el-radio>
                <el-radio :label="2">自由布局</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="是否必填" prop="isRequired">
              <!-- <el-select v-model="secondData.isRequired" placeholder="请选择">
                   <el-option label="必填" value="必填" />
                   <el-option label="非必填" value="非必填" />
                 </el-select> -->
              <el-radio-group v-model="secondData.isRequired" style="margin-top: 13px">
                <el-radio label="必填">必填</el-radio>
                <el-radio label="非必填">非必填</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item v-if="secondData.questionType != '文本'" label="答案设置">
              <el-table :data="options" :header-cell-style="{
								fontSize: '14px',
								color: '#0009',
								fontWeight: 'normal',
								backgroundColor: '#F2F3F5',
							}">

                <el-table-column prop="index" label="序号" width="180">
                  <template #default="scope">
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="选项名称">
                  <template #default="scope">
                    <el-input v-model="scope.row.name" :readonly="scope.row.readonly" />
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="分数">
                  <template #default="scope">
                    <el-input v-model="scope.row.num" :min="0" :max="100" :readonly="scope.row.readonly"
                      @input="validateScore(scope.row)" />
                  </template>
                </el-table-column>
                <el-table-column label=""  min-width="120">
                                      <template #default="{ $index }">
                                          <span style="cursor: pointer;margin-right: 5px; color: #3F9B6A;"
                      @click="answerMoveUp($index)" v-if="$index != 0">↑</span>
                                          <span style="cursor: pointer; color: #3F9B6A;" @click="answerMoveDown($index)"
                      v-if="$index != (options.length - 1)">↓</span>
                                        </template>
                                    </el-table-column>
                <el-table-column label="操作">
                  <template #default="scope">
                    <div class="tableBtn greens" @click="deleteOption(scope.$index)">
                      删除
                    </div>
                  </template>
                </el-table-column>

              </el-table>

              <el-button style="width: 100%; background-color: #3f9b6a; color: #fff" @click="addOption">+
                添加</el-button>
            </el-form-item>
          </el-form>
        </div>

        <div style="padding-top: 20px; display: flex; justify-content: flex-end">
          <el-button class="buttonHover" style="
              color: #606266;
              border: 1px solid #dddfe5;
              background-color: #fff;
            " @click="closeFn(2)">返回</el-button>
          <el-button style="background-color: #3f9b6a; color: #fff" @click="bianCheck">确认</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
    async
  } from "q";
  import axios from "axios";
  import {
    QuestionGetAll,
    QuestionAdd,
    QuestionEdit,
    QuestionDel,
  } from "../../api/question.js";
  import upimg from "@/components/ImageUpload/index";
  export default {
    components: {
      upimg,
    },
    data() {
      return {
        detbox: false, // 详情
        currentPage: 1,
        total: 10,
        flag: false,
        pageSize: 10,
        ggXin: false,
        formInline: {
          tikuTitle: "",
          questionType: "",
          questionBank: "用户端题库",
          isRequired: "必填",
          maxChoose: 0,
          questionDescription: "",
          optionSettings: {},
        },
        tableData: [],
        secondData: {},
        formSel: {
          questionBank: "用户端题库",
          tikuTitle: "",
          questionType: "",
          pageNumber: 0,
          pageSize: 10,
        },
        pageindex: {
          pageNumber: 0,
          pageSize: 10,
          questionBank: "用户端题库",
        },
        bainjiBox: false,
        options: [],
        labelStyle: {
          width: "160px",
        },
        contentStyle: {
          width: "246px",
        },
        rules: {
          tikuTitle: [{
            required: true,
            message: "请输入题目",
            trigger: "blur"
          }],
          questionType: [{
            required: true,
            message: "请选择题型",
            trigger: "change"
          }, ],
          questionBank: [{
            required: true,
            message: "请选择所属题库",
            trigger: "change"
          }, ],
          layoutType: [{
            required: true,
            message: "请选择布局类型",
            trigger: "change"
          }, ],
          optionSettings: [{
            required: true,
            message: "请设置答案",
            trigger: "change"
          }, ],
        },
      };
    },
    computed: {},
    mounted() {
      this.getAll();
    },
    methods: {
      chenge(val) {
        this.formSel = {
          questionBank: "用户端题库",
          tikuTitle: "",
          questionType: "",
          pageNumber: 0,
          pageSize: 10,
        };
      },
      getAll() {
        QuestionGetAll(this.pageindex).then((res) => {
          this.tableData = res.data.content;
          this.total = res.data.totalElements;
        });
      },

      // 新增确定按钮
      addCheck(val) {
        this.$refs.reform.validate((valid) => {
          if (valid) {
            if (
              this.formInline.questionType != "文本" &&
              this.options.length == 0
            ) {
              this.$message({
                message: "请添加答案选项",
              });
              return;
            }
            for (let i = 0; i < this.options.length; i++) {
              if (this.options[i].name == "") {
                this.$message({
                  message: "答案选项不能为空",
                });
                return;
              }
            }
            let accumulator = {}
            let fenshu = {}
            this.options.forEach((item, index) => {
              accumulator[index] = item.name
              fenshu[index] = Number(item.num) || 0
            })
            this.formInline.optionSettings = accumulator
            this.formInline.score = fenshu
            this.formInline.optionSettings = JSON.stringify(
              this.formInline.optionSettings
            );
            this.formInline.score = JSON.stringify(this.formInline.score);
            this.formInline.createDate = this.currentTime();
			console.log({...this.formInline})
			// return
            QuestionAdd(this.formInline).then((res) => {
              this.$message({
                message: "保存成功",
                type: "success",
              });
              this.formInline = {
                tikuTitle: "",
                questionType: "",
                questionBank: "用户端题库",
                isRequired: "必填",
                questionDescription: "",
                optionSettings: {},
              };
              this.getAll();
            });

            this.ggXin = false;
          } else {
            return false;
          }
        });
      },
      // 编辑确定
      async bianCheck() {
        this.$refs.bianform.validate((valid) => {
          if (valid) {
            if (
              this.secondData.questionType != "文本" &&
              this.options.length == 0
            ) {
              this.$message({
                message: "请添加答案选项",
              });
              return;
            }
            for (let i = 0; i < this.options.length; i++) {
              if (this.options[i].name == "") {
                this.$message({
                  message: "答案选项不能为空",
                });
                return;
              }
            }
            let accumulator = {}
            let fenshu = {}
            this.options.forEach((item, index) => {

              accumulator[index] = item.name
              fenshu[index] = Number(item.num) || 0
            })
            this.secondData.optionSettings = JSON.stringify(
              accumulator
            );
            this.secondData.score = JSON.stringify(fenshu);
			console.log({...this.secondData})
			// return
            QuestionEdit(this.secondData).then((res) => {
              this.$message({
                message: "保存成功",
                type: "success",
              });

              this.getAll();
            });

            this.bainjiBox = false;
          } else {
            this.$message({
              message: "请填写完整信息",
              type: "error",
            });
            return false;
          }
        });
      },
      // 获取时间
      currentTime() {
        const date = new Date();
        const year = date.getFullYear();
        let month = date.getMonth() + 1; // 月份从0~11，所以加一
        let day = date.getDate();
        let hours = date.getHours();
        let minutes = date.getMinutes();
        let seconds = date.getSeconds();

        // 为月、日、小时、分钟和秒添加前导零（如果需要）
        month = month < 10 ? "0" + month : month;
        day = day < 10 ? "0" + day : day;
        hours = hours < 10 ? "0" + hours : hours;
        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        // 返回格式化的日期和时间字符串
        return `${year}-${month}-${day} ${hours}:${minutes}`;
      },

      // 详情
      details(val, item) {
        this.secondData = item;

        if (typeof item.optionSettings === "string") {
          this.secondData.optionSettings = JSON.parse(item.optionSettings);
        }
        this.detbox = true;
      },
      addbuss(val, item) {
        this.detbox = false;
        this.ggXin = true;
      },
      handleSizeChange(val) {
        this.pageSize = val;
      },
      handleCurrentChange(val) {
        // this.currentPage = val
        this.pageindex.pageNumber = val - 1;
        QuestionGetAll(this.pageindex).then((res) => {
          this.tableData = res.data.content;
        });
      },

      closeFn(val) {
        if (val == 1) {
          this.ggXin = false;
        } else {
          this.bainjiBox = false;
        }
      },

      // 查询按钮
      async onSubmit() {
        const res = await QuestionGetAll(this.formSel);
        this.tableData = res.data.content;
        this.total = res.data.totalElements;
      },
      // 重置按钮
      resetting() {
        this.formSel = {
          questionBank: "用户端题库",
          pageNumber: 0,
          pageSize: 10,
        };
        this.currentPage = 1;
        this.pageindex.pageNumber = 0;
        this.getAll();
      },
      addOption() {
        const newOption = {
          index: this.options.length + 1,
          name: "",
          readonly: false,
        };
        this.options.push(newOption);
      },
      deleteOption(index) {
        this.options.splice(index, 1);
      },
      bianls(item) {
        let settings = null;
        let socer = null;
        if (typeof item.optionSettings !== "object") {
          settings = JSON.parse(item.optionSettings);
        } else {
          settings = item.optionSettings;
        }
        if (typeof item.score !== "object") {
          socer = JSON.parse(item.score);
        } else {
          socer = item.score;
        }
        console.log("我是点击后的数据", item)
        const keys = Object.keys(settings);
        this.options = keys.map((key) => ({
          index: parseInt(key), // 将字符串键转换为整数
          name: settings[key],
          num: socer[key], // 添加 socer 的值
        }));

        this.bainjiBox = true;
        //判断item.maxChoose是undefined的话，默认为0

        this.secondData = item;
        
		console.error({...this.secondData} )
		// 刷新渲染层
		this.$nextTick(() => {
			this.secondData.maxChoose = item.maxChoose || 0;
		});
      },
      tikuDel(item) {
        const h = this.$createElement;
        this.$msgbox({
          title: "消息",
          message: h("p", null, [h("span", null, "是否删除 ")]),
          showCancelButton: true,
          showClose: false,
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          customClass: "oe-dialog-btn",
          beforeClose: (action, instance, done) => {
            if (action === "confirm") {
              QuestionDel({
                id: item.id,
              }).then((res) => {
                this.getAll();
                done();
              });
            } else {
              done();
            }
          },
        });
      },
      async tikuBox(val) {
        this.pageindex.questionBank = val;

        const res = await QuestionGetAll(this.pageindex);
        this.tableData = res.data.content;
        this.total = res.data.totalElements;
      },
      addTimu() {
        this.formInline = {
          tikuTitle: "",
          questionType: "",
          questionBank: "用户端题库",
          isRequired: "必填",
          maxChoose: 0,
          layoutType: 1,
          questionDescription: "",
          optionSettings: {},
        };
        this.options = [];
        // this.$refs.reform.resetFields()
        this.ggXin = true;
      },
      validateScore(row) {
        // 如果输入的不是数字或者是NaN，则重置为1
        if (isNaN(row.num) || row.num < 0) {
          row.num = 0;
        }
        // 如果输入的数字大于100，则重置为100
        if (row.num > 100) {
          row.num = 100;
        }
      },
      answerMoveUp(index) {
        [this.options[index], this.options[index - 1]] = [this.options[index - 1], this.options[index]]
        console.log(this.options[index])
        this.options[index].index = index - 1
        this.options.sort()


      },
      answerMoveDown(index) {
        [this.options[index], this.options[index + 1]] = [this.options[index + 1], this.options[index]]
        this.options[index].index = index + 1
        this.options.sort()

      },
    },
  };
</script>

<style scoped>
  .zhuti {
    padding: 0 20px 20px 20px;
    min-height: calc(100vh - 50px - 20px);
    background-color: #fff;
  }

  .chengeXia {
    border-bottom: 6px solid #3f9b6a;
    padding-bottom: 4px;
    color: #3f9b6a;
  }

  /deep/ .el-form-item__content {
    line-height: 0;
  }

  .tableBtn {
    display: inline-block;
    margin-right: 10px;
    color: #acacac;
    cursor: pointer;
  }

  .formSearch {
    display: flex;
    width: 100%;
    font-size: 14px;
    justify-content: space-between;
  }

  .greens {
    color: #3f9b6a;
  }

  /deep/ .el-table__row {
    font-size: 14px;
    color: #000000e6;
    height: 42px;
  }

  .fenye {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
  }

  /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
    background-color: #3f9b6a;
  }

  .el-row {
    margin-bottom: 20px;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .el-col {
    border-radius: 4px;
  }

  .bg-purple-dark {
    background: #99a9bf;
  }

  .bg-purple {
    background: #d3dce6;
  }

  .bg-purple-light {
    background: #e5e9f2;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }

  /deep/ .bg-purple[data-v-0e3fe4ec] {
    background: #fff;
    height: 50px;
  }

  /deep/ .bg-purple[data-v-3bebae82] {
    background: #fff;
    height: 50px;
  }

  ::v-deep .bg-purple {
    background: #fff;
    height: 50px;
  }

  /deep/ .el-form--label-top .el-form-item__label {
    padding: 0;
  }

  ::v-deep .el-form-item {
    margin-bottom: 16px;
  }

  .device-form .el-form-item__label::after {
    content: "*";
    color: #1a1a1a;
    margin-left: 5px;
    font-size: 16px;
  }

  ::v-deep .el-dialog__wrapper {
    .el-dialog__header {
      background-color: #fafafa;
    }
  }

  ::v-deep .el-input__inner:focus {
    border: #3f9b6a 1px solid;
  }

  .dialog-footer {
    display: flex;
    justify-content: flex-end;
    border-top: solid rgba(209, 209, 209, 0.2) 2px;
    padding-top: 20px;
  }

  ::v-deep .el-input__inner:focus {
    border: #3f9b6a 1px solid;
  }

  ::v-deep .el-input__inner:hover {
    border: #3f9b6a 1px solid;
  }

  ::v-deep .el-select .el-input.is-focus .el-input__inner {
    border-color: #3f9b6a;
  }

  .el-select-dropdown__item.selected {
    color: #3f9b6a;
  }

  .el-pagination__sizes .el-input .el-input__inner:hover {
    border-color: #3f9b6a;
  }

  ::v-deep .el-dialog__wrapper {
    .dialog_css {
      margin-right: 12px;
      margin-top: 61px !important;

      .el-dialog__title {
        font-size: 16px !important;
        font-weight: 600;
        color: #000;
      }
    }

    .diaslog_zhong {
      margin-left: 25%;
      margin-top: 61px !important;
    }
  }

  ::v-deep .diaslog_zhong {
    margin-left: 20%;
    margin-top: 61px !important;

    .el-dialog__header {
      background-color: #fff;
      border-bottom: 1px solid #efefef;

      .el-dialog__title {
        font-size: 14px;
        color: #000000e6;
      }
    }

    .el-dialog__body {
      padding: 10px 30px 30px 20px;
    }
  }

  /deep/ .el-table_1_column_8 .hetong {
    color: #7dbb9a;
    text-decoration: underline;
  }

  /deep/ .first-column-bg {
    background-color: #fafafa !important;
  }

  ::v-deep .textarea {
    width: 85%;

    .el-textarea__inner {
      width: 100%;
    }
  }

  ::v-deep .pass_input {
    width: 100%;

    .el-input__inner {
      border: none;
      padding: 0;
    }
  }

  ::v-deep .pass_select {
    width: 100%;

    .el-input__inner {
      border: none;
      padding: 0;
    }

    .el-icon-arrow-up:before {
      content: "";
    }
  }

  /deep/ .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
    background-color: #fff;
  }

  /deep/ .el-input-number__decrease,
  /deep/.el-input-number__increase {
    height: 30px !important;
    line-height: 32px !important;
    margin-top: 3px;
  }
</style>
<style lang="scss" scoped>
  ::v-deep .bian_css {
    .el-dialog__header {
      padding: 0px;
    }

    .el-input__inner {
      height: 18px;
      border: 0px;
      margin-top: 0px;
    }

    .el-input__inner:hover {
      border: 0px;
    }

    .el-input__inner:focus {
      border: 0px;
    }
  }

  ::v-deep .buttonHover:hover {
    color: #3f9b6a !important;
    border-color: #c5e1d2 !important;
    background-color: #ecf5f0 !important;
    outline: none;
  }

  ::v-deep .el-pagination__total {
    position: absolute;
    left: 33px;
  }

  ::v-deep .diaslog_zhong {
    .el-dialog__body {
      padding: 10px 20px 20px 20px;
    }

    .el-upload--picture-card {
      width: 130px;
      height: 130px;
    }
  }
</style>
