modelForm.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508
  1. <style lang="scss" scoped>
  2. .content {
  3. display: flex;
  4. padding: 0;
  5. .content-item {
  6. flex: 1;
  7. padding: 20px;
  8. &.middle {
  9. border-left: 2px solid #d8d8d8;
  10. border-right: 2px solid #d8d8d8;
  11. }
  12. &.right,
  13. &.middle {
  14. flex: 2;
  15. }
  16. .item-title {
  17. font-size: 14px;
  18. font-weight: bold;
  19. color: #666666;
  20. margin-bottom: 20px;
  21. }
  22. .el-row {
  23. margin-top: 20px;
  24. }
  25. .model {
  26. width: 80px;
  27. height: 80px;
  28. display: flex;
  29. flex-direction: column;
  30. align-items: center;
  31. justify-content: space-evenly;
  32. &:hover {
  33. cursor: pointer;
  34. background: #f5faff;
  35. }
  36. img {
  37. height: 28px;
  38. width: 28px;
  39. }
  40. span {
  41. font-size: 14px;
  42. color: #666666;
  43. // margin-top:19px;
  44. }
  45. }
  46. .el-form {
  47. margin-bottom: 20px;
  48. .el-form-item {
  49. background: #f5faff;
  50. padding: 10px 20px;
  51. margin-bottom: 5px;
  52. /deep/.el-form-item__label {
  53. font-size: 16px;
  54. color: #666666;
  55. display: block;
  56. line-height: 20px;
  57. margin-bottom: 10px;
  58. text-align: left;
  59. }
  60. /deep/.el-form-item__content {
  61. margin-right: 160px;
  62. position: relative;
  63. font,
  64. .drag {
  65. position: absolute;
  66. right: -145px;
  67. }
  68. font {
  69. top: 0px;
  70. color: #3895fe;
  71. font-size: 12px;
  72. span {
  73. margin-left: 5px;
  74. cursor: pointer;
  75. }
  76. }
  77. .drag {
  78. right: -160px;
  79. bottom: -3px;
  80. }
  81. div {
  82. font-size: 16px;
  83. color: #333333;
  84. }
  85. .el-radio,
  86. .el-checkbox {
  87. margin-right: 32px;
  88. // height: 32px;
  89. line-height: 20px;
  90. }
  91. .el-radio-group,
  92. .el-checkbox-group {
  93. display: flex;
  94. flex-direction: column;
  95. }
  96. .cus_select .el-radio,
  97. .el-radio__input {
  98. white-space: normal;
  99. }
  100. .cus_select .el-checkbox,
  101. .el-checkbox__input {
  102. white-space: normal;
  103. }
  104. .cus_select .el-checkbox__label {
  105. display: inline;
  106. }
  107. .el-radio__label,
  108. .el-checkbox__label {
  109. display: inline-block !important;
  110. width: 93%;
  111. vertical-align: top;
  112. }
  113. .el-radio,
  114. .el-checkbox {
  115. margin-bottom: 10px;
  116. }
  117. }
  118. /deep/.el-form-item__label {
  119. float: none;
  120. font-weight: bold;
  121. }
  122. &.text {
  123. /deep/.el-form-item__content {
  124. // margin-left:60px;
  125. }
  126. }
  127. }
  128. }
  129. // 右边
  130. .phone {
  131. width: 350px;
  132. height: 713px;
  133. background: url("../../assets/survey_bg.png") no-repeat;
  134. background-size: 100% auto;
  135. margin: auto;
  136. }
  137. .item-main {
  138. height: 551px;
  139. width: 315px;
  140. background: #ffffff;
  141. border: 1px solid #ddd;
  142. overflow: auto;
  143. position: relative;
  144. top: 80px;
  145. left: 21px;
  146. // display: none;
  147. // border: 1px solid #DDDDDD;
  148. // box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.13);
  149. border-radius: 5px;
  150. overflow: auto;
  151. .el-form.over_y {
  152. border: none;
  153. overflow: visible;
  154. }
  155. }
  156. // label样式
  157. .edit_label {
  158. /deep/.el-input__inner {
  159. background: #f5faff;
  160. border: 0px;
  161. padding: 0px;
  162. }
  163. }
  164. /deep/.opicon {
  165. font-weight: bold;
  166. padding: 5px;
  167. color: #3895fe;
  168. }
  169. .tpl_title {
  170. font-size: 18px;
  171. // margin-bottom:20px;
  172. }
  173. .tpl_form {
  174. margin: 0px;
  175. border: 1px solid #ccc;
  176. border-radius: 20px;
  177. /deep/.el-form-item {
  178. background: none;
  179. }
  180. /deep/.el-form-item__content {
  181. width: 100%;
  182. }
  183. }
  184. .survey_logo {
  185. width: 145px;
  186. position: relative;
  187. top: 5px;
  188. left: 20px;
  189. }
  190. .item_require {
  191. position: absolute;
  192. top: 0px;
  193. right: 35px !important;
  194. /deep/.el-checkbox__label {
  195. padding-left: 5px;
  196. // color:red;
  197. }
  198. }
  199. .require::before {
  200. content: "*";
  201. color: #f56c6c;
  202. margin-right: 4px;
  203. position: absolute;
  204. left: -10px;
  205. }
  206. }
  207. /deep/.radio .el-input {
  208. width: 85%;
  209. }
  210. /deep/.checkbox .el-input {
  211. width: 85%;
  212. }
  213. // 操作按钮
  214. .ctl_btn {
  215. display: inline-block;
  216. width: 28px;
  217. position: absolute;
  218. top: 13px;
  219. }
  220. .ctl_btn_note {
  221. right: 55px;
  222. color: #ffb800;
  223. }
  224. .ctl_btn_edit {
  225. right: 20px;
  226. color: green;
  227. }
  228. .ctl_btn_del {
  229. right: -15px;
  230. color: red;
  231. }
  232. // 注释弹窗
  233. /deep/.noteDialog .el-form-item__content {
  234. margin-right: 0px !important;
  235. margin-left: 0px !important;
  236. }
  237. // /deep/.noteDialog .el-dialog{
  238. // margin-top:20vh!important;
  239. // }
  240. /deep/.noteDialog .el-dialog__body {
  241. padding: 10px 20px !important;
  242. }
  243. .img_list {
  244. li {
  245. display: inline-block;
  246. min-width: 140px;
  247. height: 148px;
  248. margin: 10px;
  249. position: relative;
  250. overflow: hidden;
  251. img {
  252. height: 100%;
  253. }
  254. .el-icon-delete {
  255. color: red;
  256. font-size: 18px;
  257. cursor: pointer;
  258. }
  259. .move {
  260. position: absolute;
  261. bottom: 0;
  262. left: 0;
  263. width: 100%;
  264. text-align: center;
  265. background: rgba(0, 0, 0, 0.527);
  266. color: #fff;
  267. cursor: pointer;
  268. }
  269. }
  270. }
  271. //
  272. /deep/.group .el-form-item__content {
  273. margin-right: 0px !important;
  274. }
  275. .active_item {
  276. border: 2px solid #3a8ee6;
  277. }
  278. // 提示信息展示
  279. .noteInfoDialog {
  280. width: 90%;
  281. margin: 0 auto;
  282. height: 300px;
  283. border: 1px solid #ccc;
  284. position: absolute;
  285. top: 10vh;
  286. left: 5%;
  287. background: #ffffff;
  288. }
  289. .noteInfoDialog .body {
  290. width: 100%;
  291. margin: 0 auto;
  292. height: 300px;
  293. // border:1px solid red;
  294. position: absolute;
  295. // top:10vh;
  296. // left:5%;
  297. }
  298. }
  299. .tool_text {
  300. width: 315px;
  301. p {
  302. margin-bottom: 10px;
  303. }
  304. .toolText_img {
  305. img {
  306. width: 100px;
  307. height: 100px;
  308. margin-bottom: 5px;
  309. margin-right: 5px;
  310. }
  311. // img:nth-child(odd) {
  312. // margin-right: 5px;
  313. // }
  314. }
  315. }
  316. </style>
  317. <template>
  318. <section>
  319. <p><span>信息管理></span>新增模板</p>
  320. <div class="content">
  321. <div class="content-item">
  322. <div class="item-title">模板组件</div>
  323. <el-row>
  324. <el-col :span="12">
  325. <div class="model" @click="addWidget(0)">
  326. <img src="../../assets/slt_small.png" alt="" />
  327. <span>单行文本</span>
  328. </div>
  329. </el-col>
  330. <el-col :span="12">
  331. <div class="model" @click="addWidget(1)">
  332. <img src="../../assets/mlt_small.png" alt="" />
  333. <span>多行文本</span>
  334. </div>
  335. </el-col>
  336. </el-row>
  337. <el-row>
  338. <el-col :span="12">
  339. <div class="model" @click="addWidget(2)">
  340. <img src="../../assets/radio_small.png" alt="" />
  341. <span>单选统计</span>
  342. </div>
  343. </el-col>
  344. <el-col :span="12">
  345. <div class="model" @click="addWidget(3)">
  346. <img src="../../assets/checked_small.png" alt="" />
  347. <span>多选统计</span>
  348. </div>
  349. </el-col>
  350. </el-row>
  351. <el-row>
  352. <el-col :span="12">
  353. <div class="model" @click="addWidget(4)">
  354. <img src="../../assets/upload_small.png" alt="" />
  355. <span>图片上传</span>
  356. </div>
  357. </el-col>
  358. <!-- <el-col :span='12'>
  359. <div class='model' @click="addWidget(5)">
  360. <img src="../../assets/file_small.png" alt="">
  361. <span>文件上传</span>
  362. </div>
  363. </el-col> -->
  364. <el-col :span="12">
  365. <div class="model" @click="addWidget(6)">
  366. <img src="../../assets/group_small.png" alt="" />
  367. <span>域组件</span>
  368. </div>
  369. </el-col>
  370. </el-row>
  371. </div>
  372. <div class="content-item middle">
  373. <div class="item-title">编辑模板-{{ title }}</div>
  374. <el-form
  375. size="small"
  376. label-width=""
  377. label-position="top"
  378. class="over_y"
  379. >
  380. <!-- handle=".dargBtn" 触发拖拽事件的按钮类名 filter=".undraggable" 不可拖拽的元素的类名 -->
  381. <vuedraggable
  382. class="wrapper"
  383. v-model="widgetList"
  384. handle=".dargBtn"
  385. @change="change"
  386. @start="start"
  387. @end="end"
  388. >
  389. <transition-group>
  390. <el-form-item
  391. v-for="(item, index) in widgetList"
  392. :key="index"
  393. :prop="item.label"
  394. :class="item.active == 1 ? 'active_item' : 'test'"
  395. @click.native.self="activeItem(index)"
  396. >
  397. <section v-if="item.type == 'input'">
  398. <el-input
  399. :readonly="item.edit"
  400. v-model="item.label"
  401. :class="[
  402. item.edit ? 'edit_label' : '',
  403. item.require ? 'require' : '',
  404. ]"
  405. ></el-input>
  406. <el-input
  407. placeholder="请输入"
  408. v-model="item.placeholder"
  409. ></el-input>
  410. <font>
  411. <el-checkbox class="item_require" v-model="item.require"
  412. >必填</el-checkbox
  413. >
  414. <span class="ctl_btn ctl_btn_note" @click="addNote(item)"
  415. >注释</span
  416. >
  417. <span
  418. class="ctl_btn ctl_btn_edit"
  419. @click="item.edit = !item.edit"
  420. >{{ item.edit ? "编辑" : "保存" }}</span
  421. >
  422. <span
  423. class="ctl_btn ctl_btn_del"
  424. @click="widgetList.splice(index, 1)"
  425. >删除</span
  426. >
  427. </font>
  428. <el-button type="primary" class="dargBtn drag" size="mini"
  429. >拖拽移动顺序</el-button
  430. >
  431. </section>
  432. <section v-if="item.type == 'textarea'">
  433. <el-input
  434. :readonly="item.edit"
  435. v-model="item.label"
  436. :class="[
  437. item.edit ? 'edit_label' : '',
  438. item.require ? 'require' : '',
  439. ]"
  440. ></el-input>
  441. <el-input
  442. type="textarea"
  443. placeholder="请输入"
  444. v-model="item.placeholder"
  445. ></el-input>
  446. <font>
  447. <el-checkbox class="item_require" v-model="item.require"
  448. >必填</el-checkbox
  449. >
  450. <span class="ctl_btn ctl_btn_note" @click="addNote(item)"
  451. >注释</span
  452. >
  453. <span
  454. @click="item.edit = !item.edit"
  455. class="ctl_btn ctl_btn_edit"
  456. >{{ item.edit ? "编辑" : "保存" }}</span
  457. >
  458. <span
  459. @click="widgetList.splice(index, 1)"
  460. class="ctl_btn ctl_btn_del"
  461. >删除</span
  462. >
  463. </font>
  464. <el-button type="primary" class="dargBtn drag" size="mini"
  465. >拖拽移动顺序</el-button
  466. >
  467. </section>
  468. <section v-if="item.type == 'radio'" class="radio">
  469. <el-input
  470. :readonly="item.edit"
  471. v-model="item.label"
  472. :class="[
  473. item.edit ? 'edit_label' : '',
  474. item.require ? 'require' : '',
  475. ]"
  476. ></el-input
  477. >(单选)
  478. <el-radio-group>
  479. <el-radio
  480. :label="iitem.label"
  481. v-for="(iitem, index) in item.items"
  482. :key="index"
  483. >
  484. <el-input
  485. :readonly="item.edit"
  486. v-model="iitem.label"
  487. :class="item.edit ? 'edit_label' : ''"
  488. ></el-input>
  489. <template v-if="!item.edit">
  490. <i
  491. class="el-icon-minus opicon"
  492. @click="minusOption(item.items, index)"
  493. ></i
  494. ><i
  495. class="el-icon-plus opicon"
  496. @click="plusOption(item.items, index)"
  497. ></i>
  498. </template>
  499. </el-radio>
  500. </el-radio-group>
  501. <font>
  502. <el-checkbox class="item_require" v-model="item.require"
  503. >必填</el-checkbox
  504. >
  505. <span class="ctl_btn ctl_btn_note" @click="addNote(item)"
  506. >注释</span
  507. >
  508. <span
  509. @click="item.edit = !item.edit"
  510. class="ctl_btn ctl_btn_edit"
  511. >{{ item.edit ? "编辑" : "保存" }}</span
  512. >
  513. <span
  514. @click="widgetList.splice(index, 1)"
  515. class="ctl_btn ctl_btn_del"
  516. >删除</span
  517. >
  518. </font>
  519. <el-button type="primary" class="dargBtn drag" size="mini"
  520. >拖拽移动顺序</el-button
  521. >
  522. </section>
  523. <section v-if="item.type == 'checkbox'" class="checkbox">
  524. <el-input
  525. :readonly="item.edit"
  526. v-model="item.label"
  527. :class="[
  528. item.edit ? 'edit_label' : '',
  529. item.require ? 'require' : '',
  530. ]"
  531. ></el-input
  532. >(多选)
  533. <el-radio-group>
  534. <el-checkbox
  535. :label="iitem.label"
  536. v-for="(iitem, index) in item.items"
  537. :key="index"
  538. >
  539. <el-input
  540. :readonly="item.edit"
  541. v-model="iitem.label"
  542. :class="item.edit ? 'edit_label' : ''"
  543. ></el-input>
  544. <template v-if="!item.edit">
  545. <i
  546. class="el-icon-minus opicon"
  547. @click="minusOption(item.items, index)"
  548. ></i
  549. ><i
  550. class="el-icon-plus opicon"
  551. @click="plusOption(item.items, index)"
  552. ></i>
  553. </template>
  554. </el-checkbox>
  555. </el-radio-group>
  556. <font>
  557. <el-checkbox class="item_require" v-model="item.require"
  558. >必填</el-checkbox
  559. >
  560. <span class="ctl_btn ctl_btn_note" @click="addNote(item)"
  561. >注释</span
  562. >
  563. <span
  564. @click="item.edit = !item.edit"
  565. class="ctl_btn ctl_btn_edit"
  566. >{{ item.edit ? "编辑" : "保存" }}</span
  567. >
  568. <span
  569. @click="widgetList.splice(index, 1)"
  570. class="ctl_btn ctl_btn_del"
  571. >删除</span
  572. >
  573. </font>
  574. <el-button type="primary" class="dargBtn drag" size="mini"
  575. >拖拽移动顺序</el-button
  576. >
  577. </section>
  578. <section v-if="item.type == 'image'">
  579. <!-- <el-input :readonly="item.edit" v-model="item.label" :class="item.edit?'edit_label':''"></el-input> -->
  580. <el-input
  581. :readonly="item.edit"
  582. v-model="item.label"
  583. :class="[
  584. item.edit ? 'edit_label' : '',
  585. item.require ? 'require' : '',
  586. ]"
  587. ></el-input>
  588. <el-upload
  589. action="/api/admin/uploadfile"
  590. list-type="picture-card"
  591. :on-preview="handlePreview"
  592. :on-remove="handleRemove"
  593. limit="9"
  594. >
  595. <i class="el-icon-plus"></i>
  596. </el-upload>
  597. <font>
  598. <el-checkbox class="item_require" v-model="item.require"
  599. >必填</el-checkbox
  600. >
  601. <span class="ctl_btn ctl_btn_note" @click="addNote(item)"
  602. >注释</span
  603. >
  604. <span
  605. @click="item.edit = !item.edit"
  606. class="ctl_btn ctl_btn_edit"
  607. >{{ item.edit ? "编辑" : "保存" }}</span
  608. >
  609. <span
  610. @click="widgetList.splice(index, 1)"
  611. class="ctl_btn ctl_btn_del"
  612. >删除</span
  613. >
  614. </font>
  615. <el-button type="primary" class="dargBtn drag" size="mini"
  616. >拖拽移动顺序</el-button
  617. >
  618. </section>
  619. <section v-if="item.type == 'file'">
  620. <el-input
  621. :readonly="item.edit"
  622. v-model="item.label"
  623. :class="item.edit ? 'edit_label' : ''"
  624. ></el-input>
  625. <el-upload
  626. class="upload-demo"
  627. ref="upload"
  628. action="/api/admin/uploadfile"
  629. :on-preview="handlePreview"
  630. :on-remove="handleRemove"
  631. :file-list="fileList"
  632. :auto-upload="false"
  633. >
  634. <!-- <el-button slot="trigger" size="small" type="primary">选取文件</el-button> -->
  635. <el-button
  636. style="margin-left: 10px"
  637. size="small"
  638. type="primary"
  639. plain
  640. @click="submitUpload"
  641. >添加文件</el-button
  642. >
  643. <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
  644. </el-upload>
  645. <font>
  646. <span @click="item.edit = !item.edit">{{
  647. item.edit ? "编辑" : "保存"
  648. }}</span>
  649. <span @click="widgetList.splice(index, 1)">删除</span>
  650. </font>
  651. <el-button type="primary" class="dargBtn drag" size="mini"
  652. >拖拽移动顺序</el-button
  653. >
  654. </section>
  655. <!-- 域组件 -->
  656. <section v-if="item.type == 'group'" class="group">
  657. <el-input
  658. :readonly="item.edit"
  659. v-model="item.label"
  660. :class="[
  661. item.edit ? 'edit_label' : '',
  662. item.require ? 'require' : '',
  663. ]"
  664. ></el-input>
  665. <el-form-item
  666. v-for="(iitem, index) in item.children"
  667. :key="index"
  668. :prop="iitem.label"
  669. >
  670. <section v-if="iitem.type == 'input'">
  671. <el-input
  672. :readonly="iitem.edit"
  673. v-model="iitem.label"
  674. :class="[
  675. iitem.edit ? 'edit_label' : '',
  676. iitem.require ? 'require' : '',
  677. ]"
  678. ></el-input>
  679. <el-input
  680. placeholder="请输入"
  681. v-model="iitem.placeholder"
  682. ></el-input>
  683. <font>
  684. <el-checkbox
  685. class="item_require"
  686. v-model="iitem.require"
  687. >必填</el-checkbox
  688. >
  689. <span
  690. class="ctl_btn ctl_btn_note"
  691. @click="addNote(iitem)"
  692. >注释</span
  693. >
  694. <span
  695. class="ctl_btn ctl_btn_edit"
  696. @click="iitem.edit = !iitem.edit"
  697. >{{ iitem.edit ? "编辑" : "保存" }}</span
  698. >
  699. <span
  700. class="ctl_btn ctl_btn_del"
  701. @click="item.children.splice(index, 1)"
  702. >删除</span
  703. >
  704. </font>
  705. </section>
  706. <section v-if="iitem.type == 'textarea'">
  707. <el-input
  708. :readonly="iitem.edit"
  709. v-model="iitem.label"
  710. :class="[
  711. iitem.edit ? 'edit_label' : '',
  712. iitem.require ? 'require' : '',
  713. ]"
  714. ></el-input>
  715. <el-input
  716. type="textarea"
  717. placeholder="请输入"
  718. v-model="iitem.placeholder"
  719. ></el-input>
  720. <font>
  721. <span
  722. class="ctl_btn ctl_btn_note"
  723. @click="addNote(iitem)"
  724. >注释</span
  725. >
  726. <span
  727. class="ctl_btn ctl_btn_edit"
  728. @click="iitem.edit = !iitem.edit"
  729. >{{ iitem.edit ? "编辑" : "保存" }}</span
  730. >
  731. <span
  732. class="ctl_btn ctl_btn_del"
  733. @click="item.children.splice(index, 1)"
  734. >删除</span
  735. >
  736. </font>
  737. </section>
  738. <section v-if="iitem.type == 'radio'" class="radio">
  739. <el-input
  740. :readonly="iitem.edit"
  741. v-model="iitem.label"
  742. :class="[
  743. iitem.edit ? 'edit_label' : '',
  744. iitem.require ? 'require' : '',
  745. ]"
  746. ></el-input
  747. >(单选)
  748. <el-radio-group>
  749. <el-radio
  750. :label="iiitem.label"
  751. v-for="(iiitem, index) in iitem.items"
  752. :key="index"
  753. >
  754. <el-input
  755. :readonly="iitem.edit"
  756. v-model="iiitem.label"
  757. :class="iitem.edit ? 'edit_label' : ''"
  758. ></el-input>
  759. <template v-if="!iitem.edit">
  760. <i
  761. class="el-icon-minus opicon"
  762. @click="minusOption(iitem.items, index)"
  763. ></i
  764. ><i
  765. class="el-icon-plus opicon"
  766. @click="plusOption(iitem.items, index)"
  767. ></i>
  768. </template>
  769. </el-radio>
  770. </el-radio-group>
  771. <font>
  772. <el-checkbox
  773. class="item_require"
  774. v-model="iitem.require"
  775. >必填</el-checkbox
  776. >
  777. <span
  778. class="ctl_btn ctl_btn_note"
  779. @click="addNote(iitem)"
  780. >注释</span
  781. >
  782. <span
  783. @click="iitem.edit = !iitem.edit"
  784. class="ctl_btn ctl_btn_edit"
  785. >{{ iitem.edit ? "编辑" : "保存" }}</span
  786. >
  787. <span
  788. @click="item.children.splice(index, 1)"
  789. class="ctl_btn ctl_btn_del"
  790. >删除</span
  791. >
  792. </font>
  793. </section>
  794. <section v-if="iitem.type == 'checkbox'" class="checkbox">
  795. <el-input
  796. :readonly="iitem.edit"
  797. v-model="iitem.label"
  798. :class="[
  799. iitem.edit ? 'edit_label' : '',
  800. iitem.require ? 'require' : '',
  801. ]"
  802. ></el-input
  803. >(多选)
  804. <el-radio-group>
  805. <el-checkbox
  806. :label="iiitem.label"
  807. v-for="(iiitem, index) in iitem.items"
  808. :key="index"
  809. >
  810. <el-input
  811. :readonly="iitem.edit"
  812. v-model="iiitem.label"
  813. :class="iitem.edit ? 'edit_label' : ''"
  814. ></el-input>
  815. <template v-if="!iitem.edit">
  816. <i
  817. class="el-icon-minus opicon"
  818. @click="minusOption(iitem.items, index)"
  819. ></i
  820. ><i
  821. class="el-icon-plus opicon"
  822. @click="plusOption(iitem.items, index)"
  823. ></i>
  824. </template>
  825. </el-checkbox>
  826. </el-radio-group>
  827. <font>
  828. <el-checkbox
  829. class="item_require"
  830. v-model="iitem.require"
  831. >必填</el-checkbox
  832. >
  833. <span
  834. class="ctl_btn ctl_btn_note"
  835. @click="addNote(iitem)"
  836. >注释</span
  837. >
  838. <span
  839. @click="iitem.edit = !iitem.edit"
  840. class="ctl_btn ctl_btn_edit"
  841. >{{ iitem.edit ? "编辑" : "保存" }}</span
  842. >
  843. <span
  844. @click="item.children.splice(index, 1)"
  845. class="ctl_btn ctl_btn_del"
  846. >删除</span
  847. >
  848. </font>
  849. </section>
  850. <section v-if="iitem.type == 'image'">
  851. <!-- <el-input :readonly="item.edit" v-model="item.label" :class="item.edit?'edit_label':''"></el-input> -->
  852. <el-input
  853. :readonly="iitem.edit"
  854. v-model="iitem.label"
  855. :class="[
  856. iitem.edit ? 'edit_label' : '',
  857. iitem.require ? 'require' : '',
  858. ]"
  859. ></el-input>
  860. <el-upload
  861. action="/api/admin/uploadfile"
  862. list-type="picture-card"
  863. :on-preview="handlePreview"
  864. :on-remove="handleRemove"
  865. limit="9"
  866. >
  867. <i class="el-icon-plus"></i>
  868. </el-upload>
  869. <font>
  870. <el-checkbox class="item_require" v-model="iitem.require"
  871. >必填</el-checkbox
  872. >
  873. <span
  874. class="ctl_btn ctl_btn_note"
  875. @click="addNote(iitem)"
  876. >注释</span
  877. >
  878. <span
  879. @click="iitem.edit = !iitem.edit"
  880. class="ctl_btn ctl_btn_edit"
  881. >{{ iitem.edit ? "编辑" : "保存" }}</span
  882. >
  883. <span
  884. @click="item.children.splice(index, 1)"
  885. class="ctl_btn ctl_btn_del"
  886. >删除</span
  887. >
  888. </font>
  889. </section>
  890. </el-form-item>
  891. </section>
  892. <font style="top: -18px" v-if="item.type == 'group'">
  893. <span @click="widgetList.splice(index, 1)">删除</span>
  894. </font>
  895. <el-button type="primary" class="dargBtn drag" size="mini"
  896. >拖拽移动顺序</el-button
  897. >
  898. </el-form-item>
  899. </transition-group>
  900. </vuedraggable>
  901. <div v-if="this.widgetList.length">
  902. <el-button size="medium" type="primary" @click="save"
  903. >保存</el-button
  904. >
  905. </div>
  906. </el-form>
  907. <!-- 添加注释 -->
  908. <el-dialog
  909. class="noteDialog"
  910. :title="dialogTitle"
  911. :close-on-click-modal="false"
  912. :visible.sync="dialogVisible"
  913. >
  914. <el-form
  915. size="small"
  916. class="preview"
  917. :inline="false"
  918. label-width="80px"
  919. ref="form1"
  920. :rules="rules"
  921. >
  922. <el-form-item>
  923. <el-input
  924. v-model="noteDesc"
  925. placeholder="请输入注释信息"
  926. ></el-input>
  927. </el-form-item>
  928. <el-form-item>
  929. <ul class="img_list">
  930. <li v-for="(item, index) in noteImgs" :key="index">
  931. <img :src="item" alt="" />
  932. <p class="move">
  933. <i @click="remove(index)" class="el-icon-delete"></i>
  934. </p>
  935. </li>
  936. <li>
  937. <el-upload
  938. multiple
  939. :on-success="imgchange"
  940. action="/api/admin/uploadfile"
  941. :show-file-list="false"
  942. list-type="picture-card"
  943. :limit="9"
  944. :on-exceed="limitUploadNum"
  945. :file-list="fileList"
  946. >
  947. <i class="el-icon-plus"></i>
  948. </el-upload>
  949. </li>
  950. </ul>
  951. </el-form-item>
  952. </el-form>
  953. <span slot="footer" class="dialog-footer">
  954. <el-button
  955. size="small"
  956. type="normal"
  957. @click="(dialogVisible = false), (curNote = '<p></p>')"
  958. >取消</el-button
  959. >
  960. <el-button size="small" type="primary" @click="saveNote(curItem)"
  961. >确 定</el-button
  962. >
  963. </span>
  964. </el-dialog>
  965. </div>
  966. <div class="content-item right">
  967. <div class="item-title">效果预览</div>
  968. <div class="phone">
  969. <div class="item-main" style="position: relative">
  970. <!-- <img src="../../assets/survey_logo.png" alt="" class="survey_logo"> -->
  971. <h5 align="center" class="tpl_title">{{ title }}</h5>
  972. <el-form ref="form" :model="form" class="tpl_form over_y">
  973. <template v-for="(item, index) in widgetList">
  974. <h6 v-if="item.type=='group'" align="center" class="tpl_title">----{{ item.label }}----</h6>
  975. <el-form-item :key="index" :label="item.label + item.cntype">
  976. <el-tooltip
  977. class="item"
  978. effect="dark"
  979. content="Left Bottom 提示文字"
  980. placement="bottom-end"
  981. >
  982. <i
  983. v-if="item.noteDesc"
  984. class="el-icon-info"
  985. style="position: absolute; top: -28px; right: 0px"
  986. ></i>
  987. <div slot="content" class="tool_text">
  988. <p>{{ item.noteDesc }}</p>
  989. <div class="toolText_img">
  990. <img
  991. :src="item"
  992. alt=""
  993. v-for="(item, index) in item.noteImgs"
  994. :key="index"
  995. />
  996. </div>
  997. </div>
  998. </el-tooltip>
  999. <el-input
  1000. :class="item.require ? 'require' : ''"
  1001. v-if="item.type == 'input'"
  1002. v-model="form.label"
  1003. :placeholder="item.placeholder"
  1004. ></el-input>
  1005. <el-input
  1006. :class="item.require ? 'require' : ''"
  1007. v-if="item.type == 'textarea'"
  1008. type="textarea"
  1009. v-model="form.label"
  1010. :placeholder="item.placeholder"
  1011. ></el-input>
  1012. <el-radio-group
  1013. class="cus_select"
  1014. v-if="item.type == 'radio'"
  1015. :class="item.require ? 'require' : ''"
  1016. >
  1017. <el-radio
  1018. :label="iitem.label"
  1019. v-for="(iitem, index) in item.items"
  1020. :key="index"
  1021. >{{ iitem.label }}</el-radio
  1022. >
  1023. </el-radio-group>
  1024. <el-radio-group
  1025. class="cus_select"
  1026. v-if="item.type == 'checkbox'"
  1027. :class="item.require ? 'require' : ''"
  1028. >
  1029. <el-checkbox
  1030. :label="iitem.label"
  1031. v-for="(iitem, index) in item.items"
  1032. :key="index"
  1033. >{{ iitem.label }}</el-checkbox
  1034. >
  1035. </el-radio-group>
  1036. <el-upload
  1037. :class="item.require ? 'require' : ''"
  1038. v-if="item.type == 'image'"
  1039. action="/api/admin/uploadfile"
  1040. list-type="picture-card"
  1041. :on-preview="handlePreview"
  1042. :on-remove="handleRemove"
  1043. >
  1044. <i class="el-icon-plus"></i>
  1045. </el-upload>
  1046. <el-upload
  1047. v-if="item.type == 'file'"
  1048. class="upload-demo"
  1049. ref="upload"
  1050. action="/api/admin/uploadfile"
  1051. :on-preview="handlePreview"
  1052. :on-remove="handleRemove"
  1053. :file-list="fileList"
  1054. :auto-upload="false"
  1055. >
  1056. <!-- <el-button slot="trigger" size="small" type="primary">选取文件</el-button> -->
  1057. <el-button
  1058. style="margin-left: 10px"
  1059. size="small"
  1060. type="primary"
  1061. plain
  1062. @click="submitUpload"
  1063. >添加文件</el-button
  1064. >
  1065. <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
  1066. </el-upload>
  1067. </el-form-item>
  1068. </template>
  1069. <el-form-item v-if="this.widgetList.length">
  1070. <el-button
  1071. size="medium"
  1072. type="primary"
  1073. @click="dialogVisible = false"
  1074. style="width: 100%; margin-top: 20px"
  1075. >提交</el-button
  1076. >
  1077. </el-form-item>
  1078. </el-form>
  1079. <!-- 展示注释信息 -->
  1080. <!-- <div class="noteInfoDialog">
  1081. <div class="body">
  1082. <el-button size="mini">关闭</el-button>
  1083. </div>
  1084. </div> -->
  1085. </div>
  1086. </div>
  1087. <!-- 注释信息展示 -->
  1088. <el-dialog
  1089. class="noteDialog"
  1090. :title="dialogTitle1"
  1091. :close-on-click-modal="false"
  1092. :visible.sync="dialogVisible1"
  1093. >
  1094. <span slot="footer" class="dialog-footer">
  1095. <el-button
  1096. size="small"
  1097. type="normal"
  1098. @click="
  1099. (dialogVisible = false), (noteForm = {}), (curNote = '<p></p>')
  1100. "
  1101. >取消</el-button
  1102. >
  1103. <el-button size="small" type="primary" @click="saveNote(curItem)"
  1104. >确 定</el-button
  1105. >
  1106. </span>
  1107. </el-dialog>
  1108. </div>
  1109. </div>
  1110. </section>
  1111. </template>
  1112. <script>
  1113. import vuedraggable from "vuedraggable";
  1114. import fuEditor from "../../components/fuEditor";
  1115. export default {
  1116. components: { vuedraggable, fuEditor },
  1117. data() {
  1118. return {
  1119. fileList:[],
  1120. noteDesc: "",
  1121. noteImgs: [],
  1122. realImgs: [],
  1123. noteImgList: [],
  1124. curItem: {},
  1125. dialogTitle: "",
  1126. dialogTitle1: "",
  1127. // noteForm:{noteDesc:"",noteImgs:[]},
  1128. curNote: "",
  1129. dialogVisible: false,
  1130. dialogVisible1: false,
  1131. rules: {
  1132. 姓名: [{ required: true, message: "请输入标题", trigger: "blur" }],
  1133. },
  1134. title: this.$route.query.title,
  1135. edit: 0,
  1136. form: { name: "", page: 1, page_size: 20 },
  1137. total: 1,
  1138. list: [{ name: "2333" }],
  1139. loading: false,
  1140. checkList: [],
  1141. input: "",
  1142. dialogVisible: false,
  1143. defaultProps: {},
  1144. data: [
  1145. {
  1146. id: 1,
  1147. label: "一级 1",
  1148. },
  1149. {
  1150. id: 2,
  1151. label: "一级 2",
  1152. children: [
  1153. {
  1154. id: 5,
  1155. label: "二级 2-1",
  1156. },
  1157. {
  1158. id: 6,
  1159. label: "二级 2-2",
  1160. },
  1161. ],
  1162. },
  1163. ],
  1164. stdWidgetList: [
  1165. {
  1166. type: "input",
  1167. cntype: "",
  1168. label: "请输入标题",
  1169. placeholder: "请输入",
  1170. edit: false,
  1171. require: true,
  1172. },
  1173. {
  1174. type: "textarea",
  1175. cntype: "",
  1176. label: "请输入标题",
  1177. placeholder: "请输入",
  1178. edit: false,
  1179. require: true,
  1180. },
  1181. {
  1182. type: "radio",
  1183. cntype: "(单选)",
  1184. label: "请输入标题",
  1185. placeholder: "请输入",
  1186. edit: false,
  1187. require: true,
  1188. items: [
  1189. { label: "选项", value: "选项值" },
  1190. { label: "选项1", value: "选项值" },
  1191. ],
  1192. },
  1193. {
  1194. type: "checkbox",
  1195. cntype: "(多选)",
  1196. label: "请输入标题",
  1197. placeholder: "请输入",
  1198. edit: false,
  1199. require: true,
  1200. items: [
  1201. { label: "选项", value: "选项值" },
  1202. { label: "选项1", value: "选项值" },
  1203. ],
  1204. },
  1205. {
  1206. type: "image",
  1207. cntype: "",
  1208. label: "请输入标题",
  1209. placeholder: "请输入",
  1210. edit: false,
  1211. require: true,
  1212. },
  1213. {
  1214. type: "file",
  1215. cntype: "",
  1216. label: "请输入标题",
  1217. placeholder: "请输入",
  1218. edit: false,
  1219. require: true,
  1220. },
  1221. {
  1222. type: "group",
  1223. cntype: "",
  1224. label: "请输入域组件标题",
  1225. placeholder: "请输入",
  1226. edit: false,
  1227. require: true,
  1228. children: [],
  1229. },
  1230. ],
  1231. widgetList: [],
  1232. };
  1233. },
  1234. methods: {
  1235. limitUploadNum(files,fileList){
  1236. this.$message.alert("最多只能上传9张图片!")
  1237. },
  1238. showNoteInfo() {
  1239. // this.dialogTitle1 = true
  1240. // this.dialogVisible1 = true;
  1241. },
  1242. activeItem(index) {
  1243. var widgetList = this.widgetList;
  1244. for (let i = 0; i < widgetList.length; i++) {
  1245. if(widgetList[i].type=="group"){
  1246. if (i == index) {
  1247. this.$set(widgetList[i], "active", !widgetList[i].active);
  1248. } else {
  1249. this.$set(widgetList[i], "active", 0);
  1250. }
  1251. // this.$set(widgetList[i], "active", !widgetList[i].active);
  1252. }
  1253. }
  1254. this.widgetList = widgetList;
  1255. },
  1256. change(evt) {},
  1257. start(evt) {},
  1258. end(evt) {},
  1259. upload() {},
  1260. imgchange(file, fileList) {
  1261. console.log(fileList);
  1262. var img = this.noteImgs;
  1263. img.push(fileList.response.data);
  1264. this.noteImgs = img;
  1265. },
  1266. remove(index) {
  1267. var img = this.noteImgs;
  1268. img.splice(index, 1);
  1269. this.noteImgs = img;
  1270. },
  1271. addNote(item) {
  1272. this.noteDesc = item.noteDesc;
  1273. this.noteImgs = item.noteImgs ? item.noteImgs : [];
  1274. this.curItem = item;
  1275. this.dialogTitle = "为" + '"' + item.label + '"添加注释信息';
  1276. this.dialogVisible = true;
  1277. },
  1278. saveNote(item) {
  1279. item.noteDesc = this.noteDesc;
  1280. item.noteImgs = this.noteImgs;
  1281. this.dialogVisible = false;
  1282. },
  1283. handlePreview() {},
  1284. handleRemove() {},
  1285. unique(arr) {
  1286. var x = new Set(arr);
  1287. return [...x];
  1288. },
  1289. save() {
  1290. let id = this.$route.query.id;
  1291. let copyid = this.$route.query.copyid;
  1292. let widgets = Array.from(this.widgetList);
  1293. let flag = 0;
  1294. let labels = [];
  1295. widgets.forEach((item, index) => {
  1296. labels.push(item.label);
  1297. });
  1298. if (labels.length != this.unique(labels).length) {
  1299. flag = 1;
  1300. this.$alert("题干不能相同请仔细检查数据!", "数据错误", {
  1301. confirmButtonText: "确定",
  1302. type: "error",
  1303. });
  1304. return false;
  1305. }
  1306. widgets.forEach((item, index) => {
  1307. if (item.label == "") {
  1308. flag = 2;
  1309. }
  1310. if (item.type == "radio" || item.type == "checkbox") {
  1311. let item_labels = [];
  1312. item.items.forEach((obj, index) => {
  1313. item_labels.push(obj.label);
  1314. });
  1315. if (item_labels.length != this.unique(item_labels).length) {
  1316. flag = 3;
  1317. }
  1318. }
  1319. });
  1320. if (flag == 2) {
  1321. this.$alert("题干不能为空请仔细检查数据!", "数据错误", {
  1322. confirmButtonText: "确定",
  1323. type: "error",
  1324. });
  1325. return false;
  1326. }
  1327. if (flag == 3) {
  1328. this.$alert("选择题选项不能相同请仔细检查数据!", "数据错误", {
  1329. confirmButtonText: "确定",
  1330. type: "error",
  1331. });
  1332. return false;
  1333. }
  1334. let params = {
  1335. name: this.title,
  1336. widget: JSON.stringify(widgets),
  1337. };
  1338. if (id && !copyid) {
  1339. params.id = id;
  1340. this.$api.editTemplate(params).then((res) => {
  1341. if (res.data.code == 0) {
  1342. this.$message({
  1343. type: "success",
  1344. message: "成功!",
  1345. });
  1346. } else {
  1347. this.$message.error("失败!");
  1348. }
  1349. this.$router.push("/message/template");
  1350. });
  1351. } else {
  1352. this.$api.addTemplate(params).then((res) => {
  1353. if (res.data.code == 0) {
  1354. this.$message({
  1355. type: "success",
  1356. message: "成功!",
  1357. });
  1358. } else {
  1359. this.$message.error("失败!");
  1360. }
  1361. this.$router.push("/message/template");
  1362. });
  1363. }
  1364. },
  1365. addWidget(i) {
  1366. let item = JSON.parse(JSON.stringify(this.stdWidgetList[i]));
  1367. if (item.type == "group") {
  1368. item.active = 1;
  1369. this.widgetList.forEach((item, index) => {
  1370. item.active = 0;
  1371. });
  1372. }
  1373. // 筛选域组件
  1374. let gwidget = this.widgetList.filter(function (val) {
  1375. return val.type == "group" && val.active == 1;
  1376. });
  1377. if (gwidget.length) {
  1378. gwidget[0].children.push(item);
  1379. } else {
  1380. this.widgetList.push(item);
  1381. }
  1382. },
  1383. minusOption(options, index) {
  1384. if (options.length <= 1) {
  1385. this.$message.error("选项不能少于1个!");
  1386. } else {
  1387. options.splice(index, 1);
  1388. }
  1389. },
  1390. plusOption(options, index) {
  1391. if (options.length >= 100) {
  1392. this.$message.error("选项不能超过100个!");
  1393. } else {
  1394. options.splice(index + 1, 0, {
  1395. label: "选项" + (index + 1),
  1396. value: "选项值",
  1397. });
  1398. }
  1399. },
  1400. gopage(size) {
  1401. if (size) {
  1402. this.form.page_size = size;
  1403. }
  1404. this.form.page = this.$refs.pageButton.page;
  1405. this.getData();
  1406. },
  1407. handleSelectionChange(val) {
  1408. this.multipleSelection = val;
  1409. },
  1410. gopage1(size) {
  1411. if (size) {
  1412. this.form1.page_size = size;
  1413. }
  1414. this.form1.page = this.$refs.pageButton1.page;
  1415. this.getJl();
  1416. },
  1417. open(data) {
  1418. this.dialogFormVisible = true;
  1419. this.message = { ...data };
  1420. },
  1421. download() {
  1422. let array = this.multipleSelection,
  1423. ids = [];
  1424. for (let i = 0; i < array.length; i++) {
  1425. ids.push(array[i].id);
  1426. }
  1427. ids = ids.join(",");
  1428. this.$api.downloadMon({ ids: ids }).then((res) => {
  1429. var elink = document.createElement("a");
  1430. let blob = new Blob([res.data], { type: "application/vnd.ms-excel" });
  1431. let objUrl = URL.createObjectURL(blob);
  1432. console.log(res.headers["content-disposition"]);
  1433. let file_name = res.headers["content-disposition"].split("=")[1];
  1434. elink.download = file_name;
  1435. elink.style.display = "none";
  1436. elink.href = objUrl;
  1437. document.body.appendChild(elink);
  1438. elink.click();
  1439. document.body.removeChild(elink);
  1440. });
  1441. },
  1442. prview(id) {
  1443. this.form1.enterprise_id = id;
  1444. this.getJl();
  1445. this.dialogFormVisible1 = true;
  1446. },
  1447. getJl() {
  1448. var parm = this.form1;
  1449. this.$api.getMonitjobList(parm).then((res) => {
  1450. this.data = res.data.data.list;
  1451. this.total1 = res.data.data.total;
  1452. });
  1453. },
  1454. detail(id) {
  1455. this.$router.push({
  1456. path: "/company/detail",
  1457. query: { id: id, page: this.form.page, page_size: this.form.page_size },
  1458. });
  1459. },
  1460. getData() {
  1461. let id = this.$route.query.id;
  1462. if (id) {
  1463. this.$api.getTemplate({ id: id }).then((res) => {
  1464. if (res.data.code == 0) {
  1465. this.widgetList = res.data.data.widget;
  1466. }
  1467. });
  1468. }
  1469. },
  1470. del(id) {
  1471. this.$confirm("确定删除吗?", "提示", {
  1472. type: "warning",
  1473. }).then(() => {
  1474. this.$api.deleteEnterprise({ id: id }).then((res) => {
  1475. this.$message({
  1476. message: "删除成功",
  1477. type: "success",
  1478. });
  1479. this.getData();
  1480. });
  1481. });
  1482. },
  1483. permission(name) {
  1484. let permissions = this.info.permissions || [];
  1485. let list = [];
  1486. for (let i = 0; i < permissions.length; i++) {
  1487. list.push(permissions[i].name);
  1488. }
  1489. if (list.indexOf(name) < 0) {
  1490. return false;
  1491. } else {
  1492. return true;
  1493. }
  1494. },
  1495. },
  1496. created() {
  1497. this.getData();
  1498. },
  1499. };
  1500. </script>