heimawl
2023-06-27 eb29d7570a43ca078aa9568446ec5d0b3e02526a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<template>
  <div class="educationmanagement">
    <!-- 左侧栏 -->
    <div class="sidecolumn">
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        @select="handleSelect"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>患者管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="1-1">选项1</el-menu-item>
          </el-menu-item-group>
          <!-- <el-submenu index="1-4">
            <template slot="title">选项4</template>
            <el-menu-item index="1-4-1">选项1</el-menu-item>
          </el-submenu> -->
        </el-submenu>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>知识库</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="2-1">宣教管理</el-menu-item>
            <el-menu-item index="2-2">问卷管理</el-menu-item>
            <el-menu-item index="2-3">题库管理</el-menu-item>
          </el-menu-item-group>
          <!-- <el-submenu index="1-4">
            <template slot="title">选项4</template>
            <el-menu-item index="1-4-1">选项1</el-menu-item>
          </el-submenu> -->
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>患者管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="3-1">话术库</el-menu-item>
            <el-menu-item index="3-2">意图管理</el-menu-item>
            <el-menu-item index="3-3">模版库</el-menu-item>
          </el-menu-item-group>
          <!-- <el-submenu index="1-4">
            <template slot="title">选项4</template>
            <el-menu-item index="1-4-1">选项1</el-menu-item>
          </el-submenu> -->
        </el-submenu>
      </el-menu>
    </div>
    <!-- 右侧数据 -->
    <div class="leftvlue">
      <div class="leftvalu-top">
        <el-tabs
          v-model="editableTabsValue"
          type="card"
          editable
          @edit="handleTabsEdit"
        >
          <el-tab-pane
            :key="item.name"
            v-for="(item, index) in editableTabs"
            :label="item.title"
            :name="item.name"
          >
            <!-- {{ item.content }} -->
            <div class="leftvalu-code" v-if="editableTabs.length">
              <el-tabs
                v-model="fiactiveName"
                type="card"
                @tab-click="handleClick"
              >
                <el-tab-pane
                  v-if="item.content == 0 || item.content == 3"
                  label="代码展示"
                  name="first"
                  ><codemirror
                    v-model="item.value"
                    :options="options"
                  ></codemirror
                ></el-tab-pane>
                <el-tab-pane
                  v-if="item.content == 1 || item.content == 3"
                  label="表格展示"
                  name="second"
                  ><el-table :data="tableData" style="width: 100%">
                    <el-table-column prop="date" label="日期" width="180">
                    </el-table-column>
                    <el-table-column prop="name" label="姓名" width="180">
                    </el-table-column>
                    <el-table-column prop="address" label="地址">
                    </el-table-column> </el-table
                ></el-tab-pane>
              </el-tabs>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>
 
<script>
// import { codemirror } from "vue-codemirror";
export default {
  name: "education",
 
  data() {
    return {
      code: "",
      fiactiveName: "first",
      options: {
        line: true,
        theme: "rubyblue", // 主题
        tabSize: 4, // 制表符的宽度
        indentUnit: 2, // 一个块应该缩进多少个空格(无论这在编辑语言中意味着什么)。默认值为 2。
        firstLineNumber: 1, // 从哪个数字开始计算行数。默认值为 1。
        readOnly: false, // 只读
        autorefresh: true,
        smartIndent: true, // 上下文缩进
        lineNumbers: true, // 是否显示行号
        styleActiveLine: true, // 高亮选中行
        viewportMargin: Infinity, //处理高度自适应时搭配使用
        showCursorWhenSelecting: true, // 当选择处于活动状态时是否应绘制游标
        mode: "javascript",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
 
      editableTabsValue: "2-2-3",
      editableTabslist: [
        {
          title: "患者管理",
          name: "1-1",
          content: 0,
          value: "<el-tab-pane>",
        },
        {
          title: "宣教管理",
          name: "2-1",
          content: 1,
          value:
            "<el-table-column prop='address' label='地址'></el-table-column>",
        },
        {
          title: "问卷管理",
          name: "2-2",
          content: 3,
          value:
            "<el-table-column prop='address' label='地址'></el-table-column>",
        },
        {
          title: "题库管理",
          name: "2-3",
          content: "",
        },
        {
          title: "话术库",
          name: "3-1",
          content: "",
        },
        {
          title: "意图管理",
          name: "3-2",
          content: "",
        },
        {
          title: "模板库",
          name: "3-3",
          content: "",
        },
      ],
      // 需要的树的格式
      editableTabslisat: [
        {
          title: "患者管理",
          name: "1",
          son: [
            {
              title: "患者管理",
              name: "1-1",
              content: "",
            },
          ],
        },
        {
          title: "知识库",
          name: "2",
          son: [
            {
              title: "宣教管理",
              name: "2-1",
              content: "",
            },
            {
              title: "问卷管理",
              name: "2-2",
              content: "",
            },
            {
              title: "题库管理",
              name: "2-3",
              content: "",
              son: [
                { title: "政策管理", name: "2-3-1", content: "" },
                { title: "治安管理", name: "2-3-2", content: "" },
              ],
            },
          ],
        },
      ],
      editableTabs: [],
      tabIndex: 2,
    };
  },
 
  methods: {
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath, "ss");
      var result = this.editableTabslist.find((v) => {
        return v.name === key; // return v.value ===  '9'  返回undefined
      });
 
      var results = this.editableTabs.some(function (item) {
        if (item.name == key) {
          //item.name == "王麻子"
          return true; //返回false
        }
      });
      if (!results) {
        this.editableTabs.push(result);
      }
      this.editableTabsValue = key;
      console.log(result);
    },
    handleTabsEdit(targetName, action) {
      if (action === "add") {
      }
      if (action === "remove") {
        let tabs = this.editableTabs;
        let activeName = this.editableTabsValue;
        if (activeName === targetName) {
          tabs.forEach((tab, index) => {
            if (tab.name === targetName) {
              let nextTab = tabs[index + 1] || tabs[index - 1];
              if (nextTab) {
                activeName = nextTab.name;
              }
            }
          });
        }
 
        this.editableTabsValue = activeName;
        this.editableTabs = tabs.filter((tab) => tab.name !== targetName);
      }
    },
  },
};
</script>
 
<style lang="scss" scoped>
.educationmanagement {
  display: flex;
}
.leftvalu-code {
  // background: #3a3d42;
  height: 300px;
  ::v-deep.CodeMirror {
    position: relative;
    overflow: hidden;
    // background: #3a3d42;
    color: #3a92ef;
    font-size: 20px;
  }
}
.sidecolumn {
  width: 300px;
  min-height: 100vh;
  text-align: center;
  //   display: flex;
  margin-top: 20px;
  margin: 20px;
  padding: 10px;
  background: #edf1f7;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .sidecolumn-top {
    display: flex;
    justify-content: space-between;
    .top-wj {
      font-size: 20px;
    }
    .top-tj {
      font-size: 18px;
 
      color: rgb(0, 89, 255);
      cursor: pointer;
    }
  }
  .center-ss {
    margin-top: 30px;
    .input-with-select {
      height: 40px !important;
    }
  }
  .bottom-fl {
    margin-top: 30px;
    display: center !important;
  }
}
 
.qrcode-dialo {
  text-align: center;
  //   display: flex;
  margin: 20px;
  padding: 30px;
  background: #edf1f7;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .qrcode-text {
    font-size: 20px;
    span {
      margin-left: 20px;
    }
  }
  .qrcode-img {
    width: 300px;
    height: 400px;
  }
}
::v-deep.el-tabs--left,
.el-tabs--right {
  overflow: hidden;
  align-items: center;
  display: flex;
}
::v-deep.el-input--medium .el-input__inner {
  height: 40px !important;
}
::v-deep.el-tabs--right .el-tabs__active-bar.is-right {
  height: 40px;
  width: 5px;
  left: 0;
}
::v-deep.el-tabs--right .el-tabs__item.is-right {
  display: block;
  font-size: 20px;
}
.leftvlue {
  //   display: flex;
  //   flex: 1;
  width: 80%;
  margin-top: 20px;
  //   margin: 20px;
  padding: 30px;
  background: #ffff;
  border: 1px solid #dcdfe6;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
  .mulsz {
    font-size: 20px;
  }
}
.button-text {
  color: rgb(70, 204, 238);
}
.button-textck {
  color: rgb(39, 167, 67);
}
.button-textxg {
  color: rgb(35, 81, 233);
}
.button-textsc {
  color: rgb(235, 23, 23);
}
</style>