<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-03-20 14:36:37
 * @LastEditors: 无尘
 * @LastEditTime: 2020-05-14 16:46:30
 -->
<template>
  <div class="template-wrap" :style="{ minHeight: bodyHeight }">
    <div class="template-contain">
      <!-- 头部标题 -->
      <div class="template-head">
        <div class="template-title flex-1">
          <div role="alert" class="el-alert el-alert--info">
            <i class="el-alert__icon el-icon-info"></i>
            <div class="el-alert__content">
              <span class="el-alert__title">云日报系统报表：提供系统能够智能识别的指标（例如：销售额、达成率等），配置成报表融入云日报上报模板中。</span>
            </div>
          </div>
        </div>
        <div class="template-btns flex-1 flex-r">
          <el-button type="primary" plain @click="templateSet">模板设置</el-button>
          <!-- <el-button type="primary" plain @click="saveAndBack('preview')">预览</el-button> -->
          <el-button type="primary" @click="saveAndBack('save')">保存并启用</el-button>
        </div>
      </div>
      <!-- 模板body -->
      <div class="template-body">
        <!-- 左侧 -->
        <div class="template-cell template-cell-l system-template-tab">
          <div class="template-cell-title font-14 color-303133">系统字段</div>
          <!-- tab 切换 -->
          <el-tabs v-model="activeName">
            <el-tab-pane label="卡片" name="first">
              <ul style="max-width: 450px;">
                <draggable id="list1" :list="cardInfo" class="compenent" :options="leftOption" :move="onMove" @start="isDragging = true" @end="itemMoveEnd"
                  ><!-- @end="itemMoveEnd" -->
                  <li :class="['compenent-item', item.fixed == true ? 'fixed-item' : '']" :data-name="item.name" v-for="(item, index) in cardInfo" :key="index" @mousedown="clickItem(item)" aria-hidden="true">
                    <span>{{ item.title }}</span>
                  </li>
                </draggable>
              </ul>
            </el-tab-pane>
            <el-tab-pane label="交易" name="second">
              <ul style="max-width: 450px;">
                <draggable id="list2" :list="tradeInfo" class="compenent" :options="leftOption" :move="onMove" @start="isDragging = true" @end="itemMoveEnd">
                  <li :class="['compenent-item', item.fixed == true ? 'fixed-item' : '']" :data-name="item.name" v-for="(item, index) in tradeInfo" :key="index" @mousedown="clickItem(item)">
                    <span>{{ item.title }}</span>
                  </li>
                </draggable>
              </ul>
            </el-tab-pane>
            <el-tab-pane label="生日会员" name="third">
              <ul style="max-width: 450px;">
                <draggable id="list3" :list="birthdayMemberInfo" class="compenent" :options="leftOption" :move="onMove" @start="isDragging = true" @end="itemMoveEnd">
                  <li :class="['compenent-item', item.fixed == true ? 'fixed-item' : '']" :data-name="item.name" v-for="(item, index) in birthdayMemberInfo" :key="index" @mousedown="clickItem(item)">
                    <span>{{ item.title }}</span>
                  </li>
                </draggable>
              </ul>
            </el-tab-pane>
            <el-tab-pane label="会员" name="four">
              <ul style="max-width: 450px;">
                <draggable id="list4" :list="memberInfo" class="compenent" :options="leftOption" :move="onMove" @start="isDragging = true" @end="itemMoveEnd">
                  <li :class="['compenent-item', item.fixed == true ? 'fixed-item' : '']" :data-name="item.name" v-for="(item, index) in memberInfo" :key="index" @mousedown="clickItem(item)">
                    <span>{{ item.title }}</span>
                  </li>
                </draggable>
              </ul>
            </el-tab-pane>
            <el-tab-pane label="执行力" name="five">
              <ul style="max-width: 450px;">
                <draggable id="list5" :list="powerInfo" class="compenent" :options="leftOption" :move="onMove" @start="isDragging = true" @end="itemMoveEnd">
                  <li :class="['compenent-item', item.fixed == true ? 'fixed-item' : '']" :data-name="item.name" v-for="(item, index) in powerInfo" :key="index" @mousedown="clickItem(item)">
                    <span>{{ item.title }}</span>
                  </li>
                </draggable>
              </ul>
            </el-tab-pane>
          </el-tabs>
        </div>
        <!-- 中间 -->
        <div class="template-cell template-cell-m">
          <div class="phone-view">
            <div class="phone-show-content">
              <!-- 拖拽展示区域 -->
              <div class="drag-show-content">
                <div class="view-container">
                  <ul class="view-content" id="showPhoneView">
                    <template v-if="tempaletDataList.length == 0">
                      <img class="templet-null-img" src="../../../assets/templet_null_img.png" />
                    </template>
                    <draggable :options="{ group: { name: 'people', pull: false, put: true }, sort: true }" v-model="tempaletDataList" class="drag-wrap">
                      <li :class="['filed-item', currentIndex == index ? 'active-item' : '', 'li-block']" v-for="(item, index) in tempaletDataList" :key="'li1' + index" @click.stop="selectItem(item.fieldCode, index)">
                        <!-- 删除 -->
                        <span class="item-close p-item-close" @click.stop="deleteItem(item.name, item.parentCode, index)">
                          <i class="el-icon-close"></i>
                        </span>
                        <div v-if="item.classify != '1'" class="filed-item-name">
                          <div :class="['opencard-item-title', item.title.length >= 6 ? 'title-pre-wrap' : '']">{{ item.title }}</div>
                        </div>
                        <time-progress v-if="item.name == 'timeProgress'" :fieldName="item.title"> </time-progress>
                        <store-performance v-if="item.name == 'dataShop'" :fieldName="item.title"> </store-performance>
                        <membership-data v-if="item.name == 'dataNumber'" :fieldName="item.title"> </membership-data>
                        <error-mointor v-if="item.name == 'anomalMonitor'" :fieldName="item.title"> </error-mointor>
                        <old-customer-data v-if="item.name == 'oldNumber'" :fieldName="item.title"> </old-customer-data>
                        <birthday-membership-data v-if="item.name == 'birthNumber'" :fieldName="item.title"> </birthday-membership-data>
                      </li>
                    </draggable>
                  </ul>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- end -->
      </div>
    </div>
    <qrcode-dialog ref="qrcodePreview" v-model="dialogVisible"></qrcode-dialog>
    <system-set v-if="setVisible" :setting="setting" @closeSet="closeSet"></system-set>

    <!-- <vue-gic-footer></vue-gic-footer> -->
  </div>
</template>
<script>
import draggable from 'vuedraggable';
import AddInput from '@/components/templateSet/add-input';
import limitInput from '@/components/limit-input.vue';
import timeProgress from '@/components/app/cloudDaily/time-progress.vue';
import storePerformance from '@/components/app/cloudDaily/store-performance.vue';
import membershipData from '@/components/app/cloudDaily/membership-data.vue';
import errorMointor from '@/components/app/cloudDaily/error-mointor.vue';
import oldCustomerData from '@/components/app/cloudDaily/old-customer-data.vue';
import birthdayMembershipData from '@/components/app/cloudDaily/birthday-membership-data.vue';
import qrcodeDialog from '@/components/app/qrcode-dialog.vue';
import systemSet from '@/components/app/cloudDaily/system-set.vue';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
// import strLength from '@/common/js/strlen';
import { _debounce } from '@/common/js/public';
import { getRequest, postRequest } from '@/api/api';
export default {
  name: 'staffRecordsTemplate',
  props: {
    brandId: {
      type: String,
      default() {
        return '';
      }
    }
  },
  data() {
    return {
      // tab
      activeName: 'first',
      // right tab
      rightName: 'first',
      dialogVisible: false,
      bodyHeight: (document.documentElement.clientHeight || document.body.clientHeight) - 277 + 'px',
      // option
      isDragging: false,
      delayedDragging: false,
      // leftOption
      leftOption: {
        group: {
          name: 'people',
          pull: 'clone',
          put: false
        },
        sort: false,
        disabled: false
      },
      enterpriseId: this.brandId, // 品牌 Id(即：商户 id)
      setting: '0', // 右侧设置
      // rightOption
      selectKey: '',
      // 卡片
      cardInfo: [],
      // 交易
      tradeInfo: [],
      // 生日会员
      birthdayMemberInfo: [],
      // 会员
      memberInfo: [],
      // 执行力
      powerInfo: [],
      // 中间数据集合
      currentIndex: 0, //当前选择的 item
      tempaletDataList: [],
      // 已经选择的字段集合
      setParent: [],
      setVisible: false
    };
  },
  created() {
    // this.selectReplayStyle()
  },
  methods: {
    /**
     *  模板设置
     */
    templateSet() {
      const that = this;
      that.setVisible = true;
    },
    closeSet(res) {
      const that = this;
      that.setVisible = false;
      if (res == 'close') {
        return false;
      }
      that.setting = res;
    },
    /**
     * 点击左侧字段 item
     */
    /* eslint-disable */
    clickItem(item) {
      const that = this;
      // item.fixed = !item.fixed
      // 判断 中间数据中是否存在父级
    },

    /**
     *  move{relatedContext, draggedContext}
     */
    onMove(evt) {
      let that = this;
      const draggedElement = evt.draggedContext.element;
      let names = that.tempaletDataList.map(ele => ele.name);
      if (names.includes(draggedElement.name)) {
        return false;
      }
      return !draggedElement.fixed;
    },

    /**
     *  move end
     */
    itemMoveEnd(evt) {
      const that = this;
      that.isDragging = false;
      that.selectKey = '';
      that.selectKey = evt.clone.dataset.name;
      // 判断中间是否已经添加
      that.tempaletDataList.forEach(function(ele, index) {
        if (ele.name == that.selectKey) {
          setKey(ele.parentCode);
        }
      });
      /* eslint-disable */
      function setKey(parentCode) {
        /* eslint-disable */
        that[parentCode].forEach(function(ele, index) {
          /* eslint-disable */
          if (ele.name == that.selectKey) {
            ele.fixed = true;
          }
        });
      }

      that.selectKey = '';
      that.tempaletDataList = JSON.parse(JSON.stringify(that.tempaletDataList));
      that.$forceUpdate();
    },

    // 中间部分方法
    /**
     *  选择 item 即父级 item
     */
    selectItem(key, index) {
      const that = this;
      that.currentIndex = index; // 父级：当前选中的索引
    },

    /**
     *   删除 item 即父级 item
     */
    deleteItem(key, pCode, index) {
      const that = this;
      that.tempaletDataList.splice(index, 1);
      that.currentIndex--;
      if (that.currentIndex <= 0) {
        that.currentIndex = 0;
      }
      // 删除后重新设置 fixed 值
      that[pCode].forEach(function(ele, index) {
        if (ele.name == key) {
          ele.fixed = false;
        }
      });
    },

    /**
     *  右侧方法
     */

    /**
     *  路由跳转
     */
    changeRoute(route) {
      this.$router.push(route);
    },

    /**
     *  判断添加重复字段
     */
    isRepeat(arr) {
      let hash = {};
      for (let i in arr) {
        if (hash[arr[i]]) {
          return true;
        }
        hash[arr[i]] = true;
      }
      return false;
    },

    /**
     *  检查
     */
    checkTag(data) {
      const that = this;
      let tag = {};
      tag.filedFlag = true;
      tag.filedRepeat = false;
      let filedArr = [];
      data.forEach(function(ele, index) {
        filedArr.push(ele.title);
      });
      // 判断重复 fieldName
      if (that.isRepeat(filedArr)) {
        tag.filedRepeat = true;
      }
      return tag;
    },

    /**
     *  获取 uuid
     */
    getUuid() {
      return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        let r = (Math.random() * 16) | 0;
        let v = c == 'x' ? r : (r & 0x3) | 0x8;
        return v.toString(16);
      });
    },

    /**
     *  保存
     */
    saveAndBack: _debounce(function(opt) {
      const that = this;
      let data = JSON.parse(JSON.stringify(that.tempaletDataList));
      let tagObj = that.checkTag(data);
      if (tagObj.filedRepeat) {
        that.$message.error({
          duration: 1000,
          message: '字段标题不能重复'
        });
        return false;
      }
      data.forEach(function(ele, index) {
        ele.sort = index;
      });
      if (!data.length) {
        that.$message.error({
          duration: 1000,
          message: '请先配置字段'
        });
        return false;
      }
      // console.log(JSON.stringify(data))
      if (opt === 'save') {
        that.saveAllData(data);
      } else {
        that.postPreview(data);
      }
    }, 500),

    /**
     *  保存---api
     */
    saveAllData(data) {
      const that = this;
      let para = {
        enterpriseId: that.enterpriseId,
        templateContent: JSON.stringify({
          setting: that.setting,
          data: data
        })
      };
      postRequest('/haoban-app-daily-three-web/daily/save-system-template', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            showMsg.showmsg('保存成功', 'success');
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },

    /**
     *  预览---api
     */
    postPreview(data) {
      const that = this;
      let para = {
        templateType: 0, // 模板类型
        enterpriseId: that.enterpriseId,
        templateContent: JSON.stringify(data)
      };
      postRequest('/haoban-app-daily-three-web/daily/preview-template', para)
        .then(res => {
          let resData = res.data;
          let enterpriseId = JSON.parse(localStorage.getItem('userInfos')).enterpriseId;
          if (resData.errorCode == 1) {
            // 生成二维码需要的 url
            let webUrl = `${window.location.origin}/office-mobile/#/systemTemplate?enterpriseId=${that.enterpriseId}&templateId=${resData.result}`;
            that.$refs.qrcodePreview.qrcode(webUrl, 'daily-preview');
            that.dialogVisible = true;
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },

    /**
     *  关闭预览窗口
     */
    closeDialog() {
      const that = this;
      that.dialogVisible = false;
    },

    /**
     *  获取所有字段
     */
    getAllFields() {
      const that = this;
      getRequest('/haoban-app-daily-three-web/daily/get-template-items', {
        enterpriseId: that.enterpriseId,
        type: 1
      })
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            let timeAll = setTimeout(() => {
              that.handleAllFields(resData.result);
              clearTimeout(timeAll);
            }, 200);
            return false;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },

    /**
     *  处理所有系统模板信息
     */
    handleAllFields(result) {
      const that = this;
      result.forEach(function(ele, index) {
        if (that.setParent.includes(ele.name)) {
          ele.fixed = true;
        } else {
          ele.fixed = false;
        }
        if (ele.classify == 1) {
          ele.parentCode = 'cardInfo';
          that.cardInfo.push(ele);
        }
        if (ele.classify == 2) {
          ele.parentCode = 'tradeInfo';
          that.tradeInfo.push(ele);
        }
        if (ele.classify == 3) {
          ele.parentCode = 'birthdayMemberInfo';
          that.birthdayMemberInfo.push(ele);
        }
        if (ele.classify == 4) {
          ele.parentCode = 'memberInfo';
          that.memberInfo.push(ele);
        }
        if (ele.classify == 5) {
          ele.parentCode = 'powerInfo';
          that.powerInfo.push(ele);
        }
      });
    },

    /**
     *  获取已经保存模板信息---api
     */
    getInfo() {
      const that = this;
      // /daily/get-system-template-data
      getRequest('/haoban-app-daily-three-web/daily/get-system-template-data', {
        enterpriseId: that.enterpriseId
      })
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            if (!!resData.result) {
              that.setting = String(resData.result.setting);
              if (!!resData.result.data && !!resData.result.data.length) {
                that.handleGetInfo(resData.result.data);
              }
            }
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },

    /**
     * 处理已存配置信息
     */
    handleGetInfo(result) {
      const that = this;
      let data = JSON.parse(JSON.stringify(result));
      that.setParent = [];
      data.forEach(function(ele, index) {
        ele.fixed = true;
        that.setParent.push(ele.name);
      });
      that.tempaletDataList = data;
    }
  },
  watch: {
    isDragging(newValue) {
      const that = this;
      if (newValue) {
        that.delayedDragging = true;
        return;
      }
      that.$nextTick(() => {
        that.delayedDragging = false;
      });
    },
    brandId: function(newData, oldData) {
      const that = this;
      if (!!newData) {
        that.enterpriseId = newData;
        // 卡片
        that.cardInfo = [];
        // 交易
        that.tradeInfo = [];
        // 生日会员
        that.birthdayMemberInfo = [];
        // 会员
        that.memberInfo = [];
        // 执行力
        that.powerInfo = [];
        // 中间数据集合
        that.currentIndex = 0; //当前选择的 item
        that.tempaletDataList = [];
        that.setParent = [];
        /* eslint-disable */
        Promise.all([that.getInfo()])
          .then(values => {
            console.log();
            that.getAllFields();
          })
          .catch(reason => {
            console.log(reason);
          });
      }
    }
  },
  components: {
    draggable,
    AddInput,
    limitInput,
    timeProgress,
    storePerformance,
    errorMointor,
    membershipData,
    oldCustomerData,
    birthdayMembershipData,
    qrcodeDialog,
    systemSet
  },
  mounted() {
    const that = this;
    that.$emit('showTab', '31');
    document.documentElement.style.backgroundColor = '#f0f2f5';
    // 获取已经配置的数据
    // that.getInfo()
    that.enterpriseId = that.brandId;
    /* eslint-disable */
    Promise.all([that.getInfo()])
      .then(values => {
        that.getAllFields();
      })
      .catch(reason => {
        console.log(reason);
      });
    document.body.ondrop = function(event) {
      event.preventDefault();
      event.stopPropagation();
    };
  },
  destroyed() {
    document.documentElement.style.backgroundColor = '#fff';
  }
};
</script>
<style type="text/less" lang="less" scoped>
.el-alert--info {
  width: 730px;
  font-size: 14px;
  color: #606266;
  background: rgba(240, 245, 255, 1);
  border-radius: 2px;
  border: 1px solid rgba(133, 165, 255, 1);
}
.el-icon-info {
  width: 12px;
  font-size: 12px;
  color: #2f54eb;
}
.template-wrap {
  width: 100%; /*height: 100%;*/
  min-height: 560px;
  padding: 0;
  margin: 0;
  background: #fff;
  .b-t-1 {
    border-top: 1px solid #e4e7ed;
  }
  .template-contain {
    min-width: 1200px;
  }
  .template-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    align-items: center;
    border-bottom: 1px solid #e4e7ed;
    .flex-1 {
      -webkit-flex: 1;
      -moz-flex: 1;
      -ms-flex: 1;
      -o-flex: 1;
      flex: 1;
      display: -webkit-box;
      display: -webkit-flex;
      display: flex;
      align-items: center;
    }
    .flex-r {
      justify-content: flex-end;
    }
    .template-title-span {
      color: #fff;
      font-size: 30px;
      padding-left: 18px;
    }
    .el-button--default.is-plain {
      background: rgba(255, 255, 255, 0);
      color: #fff;
      &:hover {
        color: #fff;
        background: #2f54eb;
      }
    }
    .el-button--primary.is-plain {
      /* background: transparent; */
      border-color: #2f54eb;
      &:hover {
        background: #2f54eb;
      }
    }
  }
  .template-body {
    width: 100%;
    position: relative;
    overflow: hidden;
    .el-tab-pane {
      height: calc(100vh - 225px);
      overflow-y: scroll;
    } /* 左侧 */
    .template-cell-l {
      width: 420px;
      min-width: 33%;
      max-width: 450px;
      float: left;
      height: calc(100vh - 190px);
      padding-top: 16px; /* border-right: 2px solid #E4E7ED; */
      border-right: 2px solid #E4E7ED;
      .template-cell-title {
        font-weight: bold;
        padding-left: 20px;
        margin-bottom: 12px;
      }
      .el-tabs {
        /deep/ .el-tabs__item {
          /* // width: 50%; // width: 175px */ /*padding: 0;*/ /* */ /* color: rgba(255, 255, 255, 0.5); */
          &.is-active {
            color: #2f54ed;
          }
        }
      }
      .compenent-item {
        position: relative;
        width: 180px;
        height: 42px;
        margin: 0 10px 10px 0;
        line-height: 16px;
        display: inline-block;
        text-align: center;
        cursor: move;
        color: #606266;
        padding: 0;
        overflow: hidden;
        font-size: 14px;
        background: rgba(250, 250, 250, 1);
        border-radius: 2px;
        border: 1px solid rgba(220, 223, 230, 1);
        span {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 42px;
        }
        &:nth-child(2n + 1) {
          margin-left: 20px;
        }
        &.fixed-item {
          opacity: 0.5;
          cursor: not-allowed;
        }
      }
      #list5 {
        .compenent-item {
          /* // text-align: left; // padding: 0 16px; */
          -webkit-box-sizing: border-box;
          -moz-box-sizing: border-box;
          box-sizing: border-box;
          overflow: hidden;
          span,
          .bg-icon {
            /* display: inline-block; vertical-align: middle; */
          }
          .bg-icon {
            position: absolute;
            top: 50%;
            right: 16px;
            -webkit-transform: translate(0, -50%);
            -ms-transform: translate(0, -50%);
            -o-transform: translate(0, -50%);
            transform: translate(0, -50%);
            width: 17px;
            height: 17px; /* background: url('../../../assets/icon-template.png') no-repeat center center; background-size: 35px; */
            &.bg-icon-one {
              background-position: 0 -16px;
            }
            &.bg-icon-two {
              background-position: 0 0;
            }
            &.bg-icon-three {
              background-position: 0 -50px;
            }
            &.bg-icon-four {
              background-position: 0 -180px;
            }
            &.bg-icon-five {
              background-position: 0 -66.5px;
            }
            &.bg-icon-six {
              background-position: 0 -83px;
            }
            &.bg-icon-seven {
              background-position: 0 -33px;
            }
            &.bg-icon-eight {
              background-position: 0 -98px;
            }
          }
          &:hover {
            /* color: #2f54eb; border-color: #2f54eb; */
            .bg-icon {
              &.bg-icon-one {
                background-position: -18px -16px;
              }
              &.bg-icon-two {
                background-position: -18px 0;
              }
              &.bg-icon-three {
                background-position: -18px -50px;
              }
              &.bg-icon-four {
                background-position: -18px -180px;
              }
              &.bg-icon-five {
                background-position: -18px -66px;
              }
              &.bg-icon-six {
                background-position: -18px -83px;
              }
              &.bg-icon-seven {
                background-position: -18px -33px;
              }
              &.bg-icon-eight {
                background-position: -18px -98px;
              }
            }
          }
        }
      }
      .filed-item-title {
        padding: 15px 0;
        font-size: 14px;
        color: #ffffff;
      }
    } /* 中间 */ /* 模板 */
    .template-cell-m {
      float: left;
      width: 410px;
      min-width: 33%; /* height: calc(100vh
  - 222px); */
      padding-top: 48px;
      margin: 0 20px;
      position: relative;
      // border-left: 2px solid #e4e7ed;
      .view-content {
        position: relative;
      }
      .templet-null-img {
        width: 200px;
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
      }
    }
    .drag-wrap {
      min-height: 463px;
      overflow-x: hidden;
      overflow-y: auto;
    }
    .phone-container {
      margin-top: 40px;
    }
    .phone-view {
      background: url(../../../assets/iphone.png) no-repeat;
      background-size: 100%;
      width: 268px;
      height: 579px;
      margin: 0 auto;
      position: relative;
    }
    .phone-show-content {
      width: 230px;
      height: 463px;
      position: absolute;
      left: 19px;
      top: 49px;
      overflow-y: auto;
      .drag-show-content {
        background: #f0eff4;
      }
    }
    .opend-card-item {
      height: 46px;
      line-height: 46px;
      background: #fff;
      border-bottom: 1px solid #e7e7eb;
      font-size: 14px;
      position: relative;
      &.sex::after {
        content: '';
        width: 100%;
        height: 100%;
        z-index: 2;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
      }
    }
    .opend-card-group-title {
      height: 40px;
      line-height: 40px;
      padding-left: 10px;
    }
    .opend-card-item {
      height: 46px;
      line-height: 46px;
      background: #fff;
      border-bottom: 1px solid #e7e7eb;
    }
    .phone-list-item {
      height: 44px;
      line-height: 44px;
      background: #fff;
      margin-bottom: 5px;
    }
    .item-title {
      width: 100px;
      float: left;
      padding-left: 10px;
    }
    .filed-item {
      position: relative;
      width: 100%;
      min-height: 46px;
      background: #fff;
      cursor: move;
      padding: 0px;
      margin: 0;
      font-size: 12px;
      color: #292929;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      .filed-item-name {
        width: 100%;
        height: 46px;
      }
      &.active-item {
        border: 1px solid #2f54eb;
      }
      & + .filed-item {
        margin-top: 5px;
        &.li-block {
          margin-top: 15px;
        }
      } /*删除*/
      .item-close {
        position: absolute;
        top: 0;
        right: 0;
        width: 18px;
        height: 18px;
        line-height: 18px;
        text-align: center;
        background: #2f54eb;
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        display: none;
        z-index: 2;
      }
      &:hover {
        border: 1px dashed #2f54eb;
        .p-item-close {
          display: block;
        }
      }
      &.child-filed-item {
        &:hover {
          .child-item-close {
            display: block;
          }
        }
      }
    }
    .opencard-drag {
      background: #fff;
      height: 46px;
    }
    .opencard-item-title {
      width: 90px;
      height: 46px;
      line-height: 46px;
      text-align: left;
      float: left;
      padding-left: 10px;
      overflow: hidden;
      white-space: nowrap;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      font-size: 14px;
      &.title-pre-wrap {
        line-height: 15px;
        word-break: break-all;
        white-space: pre-wrap;
        padding-top: 9px;
        height: 40px;
      } /*&.block-pre-wrap{ line-height: 12px; word-break: break-all; white-space: pre-wrap; padding-top: 9px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box;
  box-sizing: border-box; }*/
    }
    .show-warm-text {
      color: #c0c4cc;
      width: 185px;
      text-align: left;
      display: inline-block;
      white-space: nowrap;
      height: 46px;
      line-height: 46px;
      font-size: 14px;
      .el-icon-arrow-right {
        font-size: 20px;
        vertical-align: middle;
      }
      .iconfont.icon-icon {
        font-size: 20px;
        color: #808995;
      }
      &.select-flag {
        width: 225px;
        text-align: right;
      }
    }
    .limit-w-340 {
      /deep/ .el-input__inner {
        font-size: 12px;
        color: #fff;
        background-color: rgba(255, 255, 255, 0.1);
      }
      .tip {
        color: rgba(255, 255, 255, 0.7);
      }
    } /* 右侧 */
    .template-cell-r {
      width: 400px;
      float: left;
      overflow: hidden;
      padding-top: 40px;
      .input-line-cell {
        .tip {
          color: rgba(255, 255, 255, 0.7);
        }
      }
      .limit-w-340 {
        /deep/ .el-input__inner {
          font-size: 12px;
          color: #fff;
          background-color: rgba(255, 255, 255, 0.1);
        }
        .tip {
          color: rgba(255, 255, 255, 0.7);
        }
      }
      .el-tabs {
        /deep/.el-tabs__item {
          width: 175px; /* padding: 0; */ /*color: rgba(255, 255, 255, 0.5);*/
        }
        /deep/.el-tabs__nav-wrap::after {
          content: none;
        }
      }
      .label-txt {
        margin: 0 10px;
        font-size: 14px;
        color: #fff;
      }
      .margin-t-15 {
        margin-top: 15px;
      }
      .margin-t-30 {
        margin-top: 30px;
      }
      .margin-l-15 {
        margin-left: 15px;
      }
      .margin-b-15 {
        margin-bottom: 15px;
      }
      .w-60 {
        width: 60px;
      }
      .w-120 {
        width: 120px;
      }
      .w-316 {
        width: 316px;
      }
      .limit-w-340 {
        /deep/ .el-input__inner {
          color: #fff;
          background-color: rgba(255, 255, 255, 0.1);
        }
      }
      .opt-btn {
        cursor: pointer;
        color: #c9d3df;
        vertical-align: middle;
        &.add-item:hover {
          /*color: #2f54eb;*/
        }
        &.del-item:hover {
          /*color: #F56C6C;*/
        }
      }
      .flex {
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
      }
      .flex-wrap {
        -webkit-flex-wrap: wrap;
        -moz-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
        -o-flex-wrap: wrap;
        flex-wrap: wrap;
      }
      .staffRecords-limit {
        .flex();
        .flex-wrap();
        .label-cell {
          min-width: 50%;
          max-width: 50%;
          margin-left: 0;
        }
      }
      .label-cell {
        margin-bottom: 15px;
        color: #fff;
      }
      .el-radio {
        /deep/ span.el-radio__label {
          color: #fff;
        }
        &.is-disabled {
          /deep/ span.el-radio__label {
            color: #fff;
          }
        }
      }
      .edit-item {
        color: #fff;
        padding-bottom: 10px;
        .tip {
          margin-left: -40px;
          color: rgba(255, 255, 255, 0.7);
          width: 30px;
          display: inline-block;
          text-align: right;
          margin-right: 10px;
          font-size: 12px;
        }
      }
      .edit-item-title {
        color: #ffffff;
        font-size: 14px;
        font-weight: normal;
        padding: 20px 0;
        &.edit-title-padding {
          padding-top: 15px;
        }
      }
      .edit-item-title span {
        font-size: 12px;
        margin-left: 5px;
      }
    }
  }
}
</style>
