dyztsd.vue 3.4 KB
<!--
  功能:单元状态设定
-->
<template>
  <div class='该组件名称'>
    <el-form :model="ruleForm">
      <el-row>
        <el-col :span="5">
          <el-form-item label="登记业务编码">
            {{ ruleForm.djywbm }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="登记业务名称">
            {{ ruleForm.djywmc }}
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div v-if="ruleForm.sfsxql != '0'">
      <div class="dyztsd-title">
        <b>请勾选需要查询的权利信息</b>
        <div>
          <el-button type="text" @click="handleSelectall">选择全部 </el-button>
          <el-button type="text" @click="handleInvert">清除全部</el-button>
        </div>
      </div>
      <el-divider></el-divider>
      <ul class="qlxx-list">
        <li v-for="(item, index) in dataList.sxql" :key="index">
          <el-checkbox v-model="item.checked">{{ item.sxzdmc }}</el-checkbox>
        </li>
      </ul>
    </div>
    <b>限制办理状态</b>
    <ul class="screen-list">
      <li v-for="(item, index) in dataList.sxzt" :key="index">
        <div class="screen-list-left">
          <el-switch v-model="item.checked" @change="handleSelect(item)">
          </el-switch>
          {{ item.sxzdmc }}
        </div>
        <el-radio-group v-model="item.selected" :disabled="!item.checked">
          <el-radio :label="obj.sxzdz" v-for="(obj, index) in item.children" :key="index">{{ obj.sxzdmc }}</el-radio>
        </el-radio-group>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  props: {
    ruleForm: {
      type: Object, default: {}
    },
    subData: {
      type: Object, default: () => {
        return {}
      }
    }
  },
  data () {
    return {
      dataList: {
        sxql: [],
        sxzt: []
      }
    }
  },
  watch: {
    dataList: {
      handler (newValue, oldValue) {
        this.$emit('updateValue', newValue)
      },
      deep: true
    },
    subData: {
      handler (newValue, oldValue) {
        if (!_.isEqual(newValue.sxql, this.dataList.sxql)) {
          this.dataList.sxql = _.cloneDeep(newValue.sxql)
        }
        if (!_.isEqual(newValue.sxzt, this.dataList.sxzt)) {
          this.dataList.sxzt = _.cloneDeep(newValue.sxzt)
        }
      },
      deep: true
    },
  },
  methods: {
    handleSelect (item) {
      if (item.checked) {
        item.selected = '0'
      }
    },
    handleSelectall () {
      this.dataList.sxql.forEach(item => {
        item.checked = true
      })
    },
    handleInvert () {
      this.dataList.sxql.forEach(item => {
        item.checked = false
      })
    }
  }
}
</script>
<style scoped lang='scss'>
@import "~@/styles/mixin.scss";

.dyztsd-title {
  @include flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 20px;
}

.qlxx-list {
  @include flex;
  flex-wrap: wrap;
  padding-left: 20px;

  li {
    width: 33%;
    margin-bottom: 15px;
  }
}

.screen-list {
  @include flex;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid $borderColor;
  border-bottom: none;

  li {
    @include flex;
    align-items: center;
    width: 50%;
    line-height: 50px;
    border-bottom: 1px solid $borderColor;
    padding-left: 20px;
  }

  &-left {
    margin-right: 20px;
    width: 160px;
    white-space: nowrap;
  }

  li:nth-child(odd) {
    border-right: 1px solid $borderColor;
  }
}
</style>