123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <div class="data_body">
- <div class="noMind" v-if="mindV">
- <img src="../../assets/nominddata.png" alt />
- </div>
- <!-- <img src="../../assets/dataimage/1.png" style="width:90%" /> -->
- <div class="b_box">
- <div class="b_box_table">
- <div class="bbt_title">{{ ename }}</div>
- <div class="bbt_content">
- <div v-for="(item, index) in ooption" :key="index" class="bbt_c1">
- <div
- class="bbt_c1_div"
- :class="{ bbn: index == ooption.length - 1 }"
- >
- {{ item.name }}
- </div>
- <div class="bbt_c2">
- <div
- v-for="(item2, index2) in item.children"
- :key="index + '-' + index2"
- class="bbt_c1"
- >
- <div
- class="bbt_c2_div"
- :class="{
- bbn:
- index2 == item.children.length - 1 &&
- index == ooption.length - 1,
- }"
- >
- {{ item2.name }}
- </div>
- <div class="bbt_c3">
- <div
- v-for="(item3, index3) in item2.children"
- :key="index + '-' + index2 + '-' + index3"
- :class="{
- bbn:
- index2 == item.children.length - 1 &&
- index == ooption.length - 1 &&
- index3 == item2.children.length - 1,
- }"
- >
- {{ item3.name }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- props: ["Josn", "num", "ename"],
- data() {
- return {
- mindV: true,
- ooption: [],
- };
- },
- methods: {
- setData() {
- if (!Object.keys(this.Josn).length) {
- this.mindV = true;
- } else {
- this.mindV = false;
- }
- var res = this.Josn;
- var _array = [];
- let i = 0;
- for (var item in res) {
- let num = Object.keys(res);
- let count = 10 / num.length;
- let _item = res[item];
- _array.push({ name: _item.name, value: count, children: [] });
- let j = 0;
- for (var item2 in _item.child) {
- let num2 = Object.keys(res);
- let count2 = count / num2.length;
- let _item2 = _item.child[item2];
- _array[i].children.push({
- name: _item2.name,
- value: count2,
- children: [],
- });
- for (var item3 in _item2.child) {
- let num3 = Object.keys(res);
- let count3 = count2 / num3.length;
- let _item3 = _item2.child[item3];
- _array[i].children[j].children.push({
- name: _item3.name,
- value: count3,
- });
- }
- j++;
- }
- i++;
- console.log(item);
- }
- this.ooption = _array;
- },
- },
- watch: {
- num: {
- handler: function (newVal, oldVal) {
- this.setData();
- },
- deep: true,
- },
- Josn: {
- handler: function (newVal, oldVal) {},
- deep: true,
- },
- },
- mounted() {
- this.setData();
- },
- };
- </script>
- <style scoped>
- .data_body {
- /* display: flex; */
- /* flex-direction: column; */
- width: 500px;
- height: 450px;
- /* height: 500px; */
- /* margin: 15px 5px 0 0; */
- background: #fff;
- overflow: hidden;
- flex-shrink: 0;
- position: relative;
- }
- .noMind {
- position: absolute;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100%;
- z-index: 999;
- background: #fff;
- }
- .b_box {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- overflow: auto;
- }
- .b_box_table {
- border: 2px solid #000;
- height: fit-content;
- width: auto;
- margin: 20px 0;
- }
- .bbt_content {
- }
- .bbt_title {
- height: 50px;
- width: 330px;
- border-bottom: 2px solid #000;
- text-align: center;
- line-height: 50px;
- font-size: 18px;
- background: rgb(57, 76, 165);
- color: #fff;
- }
- .bbt_c1 {
- display: flex;
- width: 100%;
- }
- .bbt_c1_div {
- display: flex;
- align-items: center;
- justify-content: center;
- border-bottom: 2px solid #000;
- max-width: 110px;
- width: 110px;
- min-height: 50px;
- font-size: 16px;
- background: rgb(171, 179, 214);
- color: #000;
- box-sizing: border-box;
- padding: 5px 10px;
- }
- .bbt_c2 {
- display: flex;
- flex-direction: column;
- max-width: 220px;
- width: 220px;
- border-left: 2px solid #000;
- box-sizing: border-box;
- }
- .bbt_c2_div {
- display: flex;
- align-items: center;
- justify-content: center;
- max-width: 110px;
- width: 110px;
- border-bottom: 2px solid #000;
- min-height: 50px;
- background: rgb(189, 194, 226);
- color: #000;
- box-sizing: border-box;
- padding: 5px 10px;
- }
- .bbt_c3 {
- display: flex;
- flex-direction: column;
- max-width: 110px;
- width: 110px;
- border-left: 2px solid #000;
- }
- .bbt_c3 > div {
- display: flex;
- align-items: center;
- justify-content: center;
- min-height: 50px;
- width: 100%;
- height: 100%;
- background: rgb(214, 216, 234);
- color: #000;
- border-bottom: 2px solid #000;
- box-sizing: border-box;
- padding: 5px 10px;
- }
- .bl {
- border-left: 2px solid #000;
- }
- .bbn {
- border-bottom: none !important;
- }
- </style>
|