addBiillboardModel.vue 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244
  1. <template>
  2. <div
  3. class="ZTGlobal"
  4. style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white"
  5. >
  6. <el-row>
  7. <el-col :span="7">
  8. <span>广告牌名称:</span>
  9. </el-col>
  10. <el-col :span="17"
  11. ><el-input
  12. size="mini"
  13. type="text"
  14. placeholder="请输入广告牌名称"
  15. v-model="billboardModel.billboardName"
  16. ></el-input
  17. ></el-col>
  18. </el-row>
  19. <el-row>
  20. <el-col :span="7"><span>附属信息</span></el-col>
  21. <el-col :span="17">
  22. <el-input
  23. type="textarea"
  24. :autosize="{ minRows: 2, maxRows: 6 }"
  25. size="mini"
  26. v-model="billboardModel.remarks"
  27. ></el-input>
  28. </el-col>
  29. </el-row>
  30. <el-row>
  31. <el-col :span="7"> <span>广告类型:</span></el-col>
  32. <el-col :span="17">
  33. <el-cascader
  34. ref="billboardTypeCascader"
  35. size="mini"
  36. placeholder="请选择广告类型"
  37. v-model="billboardModel.billboardType"
  38. @change="changeBillboardType"
  39. :options="options"
  40. :show-all-levels="false"
  41. :props="{
  42. value: 'billboardType',
  43. label: 'billboardType',
  44. children: 'children',
  45. emitPath: false,
  46. }"
  47. ></el-cascader>
  48. <!-- <el-select
  49. placeholder="请选择广告类型"
  50. v-model="billboardModel.billboardType"
  51. >
  52. <el-option
  53. v-for="item in options"
  54. :key="item.value"
  55. :value="item.value"
  56. :label="item.label"
  57. >{{ item.label }}</el-option
  58. >
  59. </el-select> -->
  60. </el-col>
  61. </el-row>
  62. <div v-show="billboardReview.isAddModel">
  63. <!-- <el-row>
  64. <el-col :span="7"><span>选择广告牌样式: </span></el-col>
  65. <el-col :span="17">
  66. <div class="imgdomf" style="display: flex">
  67. <div
  68. v-for="thisbillboardModelRule in billboardModelRule"
  69. :key="thisbillboardModelRule"
  70. class="con-col imgdom hover_style"
  71. style="cursor: pointer"
  72. @click.stop="selectModeltemplate(thisbillboardModelRule)"
  73. >
  74. <a>{{ thisbillboardModelRule.templateName }}</a>
  75. <el-image
  76. style="width: 2rem; height: 2rem"
  77. :src="thisbillboardModelRule.thumbnailUrl"
  78. fit="fill"
  79. ></el-image>
  80. </div>
  81. </div>
  82. </el-col>
  83. </el-row> -->
  84. <el-row>
  85. <el-col :span="7"><span>添加广告模型:</span></el-col>
  86. <!-- <el-col :span="8">
  87. <el-switch
  88. size="mini"
  89. v-model="billboardReview.isAddModel"
  90. active-text="是"
  91. inactive-text="否"
  92. >
  93. </el-switch>
  94. </el-col> -->
  95. <el-col :span="17">
  96. <!-- v-if="
  97. selectbillboardModelRule &&
  98. selectbillboardModelRule.templateTopType == 'model'
  99. " -->
  100. <el-upload
  101. class="upload-demo"
  102. ref="upload"
  103. :action="uploadUrl"
  104. :on-remove="handleRemove"
  105. :on-success="handleAvatarSuccess"
  106. :before-remove="beforeRemove"
  107. :before-upload="beforeAvatarUpload"
  108. :on-change="handleFileChange"
  109. :on-exceed="handleExceed"
  110. :auto-upload="true"
  111. :multiple="false"
  112. accept=".zip"
  113. :limit="1"
  114. >
  115. <el-button size="small" type="primary">上传广告模型</el-button>
  116. <!-- <el-button
  117. style="margin-left: 10px"
  118. size="small"
  119. type="success"
  120. @click="submitUpload"
  121. >上传到服务器</el-button
  122. > -->
  123. <div slot="tip" class="el-upload__tip" style="color: #ffffff">
  124. 请上传包含gltf的zip文件,且不超过50M
  125. <br />不上传时,添加系统默认模型
  126. </div>
  127. </el-upload>
  128. <el-button
  129. size="mini"
  130. v-show="billboardReview.isAddModel"
  131. type="primary"
  132. @click="addModel()"
  133. >添加广告牌</el-button
  134. >
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="7"><span>X坐标(度) </span></el-col>
  139. <el-col :span="17">
  140. <el-input-number
  141. name="x"
  142. v-model="billboardModel.x"
  143. size="mini"
  144. precision="6"
  145. :min="108.6"
  146. :max="110.5"
  147. @change="handleChange"
  148. step="0.000001"
  149. label="X坐标(度)"
  150. ></el-input-number
  151. ></el-col>
  152. </el-row>
  153. <el-row>
  154. <el-col :span="7"><span>Y坐标(度):</span></el-col>
  155. <el-col :span="17">
  156. <el-input-number
  157. name="y"
  158. v-model="billboardModel.y"
  159. size="mini"
  160. precision="6"
  161. :min="18.16"
  162. :max="18.7"
  163. @change="handleChange"
  164. step="0.000001"
  165. label="Y坐标(度)"
  166. ></el-input-number>
  167. </el-col>
  168. </el-row>
  169. <el-row>
  170. <el-col :span="7"> <span>Z坐标(米):</span></el-col>
  171. <el-col :span="17">
  172. <el-input-number
  173. name="z"
  174. v-model="billboardModel.z"
  175. size="mini"
  176. precision="2"
  177. :min="0"
  178. :max="100"
  179. step="0.1"
  180. @change="handleChange"
  181. label="Z坐标(米)"
  182. ></el-input-number>
  183. </el-col>
  184. </el-row>
  185. <el-row>
  186. <el-col :span="7"><span>X轴旋转角(度):</span></el-col>
  187. <el-col :span="17">
  188. <el-input-number
  189. name="rotateX"
  190. v-model="billboardModel.rotateX"
  191. size="mini"
  192. precision="1"
  193. :min="0"
  194. :max="360"
  195. step="0.1"
  196. @change="handleChange"
  197. label="X轴旋转角(度)"
  198. ></el-input-number
  199. ></el-col>
  200. </el-row>
  201. <el-row>
  202. <el-col :span="7"><span>Y轴旋转角(度):</span></el-col>
  203. <el-col :span="17">
  204. <el-input-number
  205. name="rotateY"
  206. v-model="billboardModel.rotateY"
  207. size="mini"
  208. precision="1"
  209. :min="0"
  210. :max="360"
  211. step="0.1"
  212. @change="handleChange"
  213. label="Y轴旋转角(度)"
  214. ></el-input-number
  215. ></el-col>
  216. </el-row>
  217. <el-row>
  218. <el-col :span="7"><span>Z轴旋转角(度):</span></el-col>
  219. <el-col :span="17">
  220. <el-input-number
  221. name="rotateZ"
  222. v-model="billboardModel.rotateZ"
  223. size="mini"
  224. precision="1"
  225. :min="0"
  226. :max="360"
  227. step="0.1"
  228. @change="handleChange"
  229. label="Z轴旋转角(度)"
  230. ></el-input-number
  231. ></el-col>
  232. </el-row>
  233. <!--顶部广告牌-->
  234. <div v-if="JSON.stringify(billboardModel.templateTop) != '{}'">
  235. <el-divider v-if="JSON.stringify(billboardModel.templateCentre) != '{}'"
  236. >广告牌面模型参数</el-divider
  237. >
  238. <el-divider v-else>广告模型参数</el-divider>
  239. <!--如果模型是广告牌类型-->
  240. <div
  241. v-if="
  242. selectbillboardModelRule &&
  243. selectbillboardModelRule.templateTopType == 'billboard'
  244. "
  245. >
  246. <el-row v-if="thisfileurl">
  247. <el-col :span="7"> <span>缩放比例:</span></el-col>
  248. <el-col :span="17">
  249. <el-input-number
  250. name="scaleL"
  251. v-model="billboardModel.templateTop.scaleL"
  252. size="mini"
  253. precision="2"
  254. :min="0"
  255. :max="100"
  256. step="0.1"
  257. @change="handleChange"
  258. label="缩放比例:"
  259. ></el-input-number>
  260. </el-col>
  261. </el-row>
  262. <el-row>
  263. <el-col :span="7"> <span>长(米):</span></el-col>
  264. <el-col :span="17">
  265. <el-input-number
  266. name="xL"
  267. v-model="billboardModel.templateTop.xL"
  268. size="mini"
  269. precision="2"
  270. :min="0"
  271. :max="100"
  272. step="0.1"
  273. @change="handleChange"
  274. label="长(米)"
  275. ></el-input-number>
  276. </el-col>
  277. </el-row>
  278. <el-row>
  279. <el-col :span="7"> <span>高(米):</span></el-col>
  280. <el-col :span="17">
  281. <el-input-number
  282. name="yL"
  283. v-model="billboardModel.templateTop.yL"
  284. size="mini"
  285. precision="2"
  286. :min="0"
  287. :max="100"
  288. step="0.1"
  289. @change="handleChange"
  290. label="高(米)"
  291. ></el-input-number>
  292. </el-col>
  293. </el-row>
  294. <el-row>
  295. <el-col :span="7"
  296. ><span style="color: aqua">厚度(米):</span></el-col
  297. >
  298. <el-col :span="17">
  299. <el-input-number
  300. name="zL"
  301. v-model="billboardModel.templateTop.zL"
  302. size="mini"
  303. precision="2"
  304. :min="0"
  305. :max="100"
  306. step="0.1"
  307. label="厚度(米)"
  308. ></el-input-number>
  309. </el-col>
  310. </el-row>
  311. </div>
  312. <!--如果模型是模型类型-->
  313. <div
  314. v-if="
  315. selectbillboardModelRule &&
  316. selectbillboardModelRule.templateTopType == 'model'
  317. "
  318. >
  319. <el-row>
  320. <el-col :span="7"> <span>缩放比例:</span></el-col>
  321. <el-col :span="17">
  322. <el-input-number
  323. name="scaleL"
  324. v-model="billboardModel.templateTop.scaleL"
  325. size="mini"
  326. precision="2"
  327. :min="0"
  328. :max="100"
  329. step="0.1"
  330. @change="handleChange"
  331. label="缩放比例:"
  332. ></el-input-number>
  333. </el-col>
  334. </el-row>
  335. <el-row>
  336. <el-col :span="7">
  337. <span style="color: aqua">长(米):</span></el-col
  338. >
  339. <el-col :span="17">
  340. <el-input-number
  341. name="xL"
  342. v-model="billboardModel.templateTop.xL"
  343. size="mini"
  344. precision="2"
  345. :min="0"
  346. :max="100"
  347. step="0.1"
  348. label="长(米)"
  349. ></el-input-number>
  350. </el-col>
  351. </el-row>
  352. <el-row>
  353. <el-col :span="7">
  354. <span style="color: aqua">高(米):</span></el-col
  355. >
  356. <el-col :span="17">
  357. <el-input-number
  358. name="yL"
  359. v-model="billboardModel.templateTop.yL"
  360. size="mini"
  361. precision="2"
  362. :min="0"
  363. :max="100"
  364. step="0.1"
  365. label="高(米)"
  366. ></el-input-number>
  367. </el-col>
  368. </el-row>
  369. <el-row>
  370. <el-col :span="7"
  371. ><span style="color: aqua">厚度(米):</span></el-col
  372. >
  373. <el-col :span="17">
  374. <el-input-number
  375. name="zL"
  376. v-model="billboardModel.templateTop.zL"
  377. size="mini"
  378. precision="2"
  379. :min="0"
  380. :max="100"
  381. step="0.1"
  382. label="厚度(米)"
  383. ></el-input-number>
  384. </el-col>
  385. </el-row>
  386. </div>
  387. <!--如果模型是box类型-->
  388. <div
  389. v-if="
  390. selectbillboardModelRule &&
  391. selectbillboardModelRule.templateTopType == 'box'
  392. "
  393. >
  394. <el-row v-if="thisfileurl">
  395. <el-col :span="7"> <span>缩放比例:</span></el-col>
  396. <el-col :span="17">
  397. <el-input-number
  398. name="scaleL"
  399. v-model="billboardModel.templateTop.scaleL"
  400. size="mini"
  401. precision="2"
  402. :min="0"
  403. :max="100"
  404. step="0.1"
  405. @change="handleChange"
  406. label="缩放比例:"
  407. ></el-input-number>
  408. </el-col>
  409. </el-row>
  410. <!--box-->
  411. <el-row>
  412. <el-col :span="7"> <span>长(米):</span></el-col>
  413. <el-col :span="17">
  414. <el-input-number
  415. name="xL"
  416. v-model="billboardModel.templateTop.xL"
  417. size="mini"
  418. precision="2"
  419. :min="0"
  420. :max="100"
  421. step="0.1"
  422. @change="handleChange"
  423. label="长(米)"
  424. ></el-input-number>
  425. </el-col>
  426. </el-row>
  427. <el-row>
  428. <el-col :span="7"> <span>高(米):</span></el-col>
  429. <el-col :span="17">
  430. <el-input-number
  431. name="yL"
  432. v-model="billboardModel.templateTop.yL"
  433. size="mini"
  434. precision="2"
  435. :min="0"
  436. :max="50"
  437. step="0.1"
  438. @change="handleChange"
  439. label=""
  440. >宽/高(米)</el-input-number
  441. >
  442. </el-col>
  443. </el-row>
  444. <el-row>
  445. <el-col :span="7"><span>厚度(米):</span></el-col>
  446. <el-col :span="17">
  447. <el-input-number
  448. name="zL"
  449. v-model="billboardModel.templateTop.zL"
  450. size="mini"
  451. precision="2"
  452. :min="0"
  453. :max="100"
  454. step="0.1"
  455. @change="handleChange"
  456. label="厚度(米)"
  457. ></el-input-number>
  458. </el-col>
  459. </el-row>
  460. <!--box-->
  461. </div>
  462. </div>
  463. <!--中部模型-->
  464. <div v-if="JSON.stringify(billboardModel.templateCentre) != '{}'">
  465. <el-divider>底座/立柱模型参数</el-divider>
  466. <!--如果模型是圆柱类型-->
  467. <div
  468. v-if="
  469. selectbillboardModelRule &&
  470. selectbillboardModelRule.templateCentreType == 'cylinder'
  471. "
  472. >
  473. <!--cylinder-->
  474. <el-row>
  475. <el-col :span="7"> <span>高(米):</span></el-col>
  476. <el-col :span="17">
  477. <el-input-number
  478. name="xL"
  479. v-model="billboardModel.templateCentre.yL"
  480. size="mini"
  481. precision="2"
  482. :min="0"
  483. :max="100"
  484. step="0.1"
  485. @change="handleChange"
  486. label="高(米)"
  487. ></el-input-number>
  488. </el-col>
  489. </el-row>
  490. <el-row>
  491. <el-col :span="7"> <span>半径(米):</span></el-col>
  492. <el-col :span="17">
  493. <el-input-number
  494. name="zL"
  495. v-model="billboardModel.templateCentre.rL"
  496. size="mini"
  497. precision="2"
  498. :min="0"
  499. :max="50"
  500. step="0.1"
  501. @change="handleChange"
  502. label=""
  503. >半径(米)</el-input-number
  504. >
  505. </el-col>
  506. </el-row>
  507. <!--cylinder-->
  508. </div>
  509. <!--如果模型是box类型-->
  510. <div
  511. v-if="
  512. selectbillboardModelRule &&
  513. selectbillboardModelRule.templateCentreType == 'box'
  514. "
  515. >
  516. <!--box-->
  517. <el-row>
  518. <el-col :span="7"> <span>长(米):</span></el-col>
  519. <el-col :span="17">
  520. <el-input-number
  521. name="xL"
  522. v-model="billboardModel.templateCentre.xL"
  523. size="mini"
  524. precision="2"
  525. :min="0"
  526. :max="100"
  527. step="0.1"
  528. @change="handleChange"
  529. label="长(米)"
  530. ></el-input-number>
  531. </el-col>
  532. </el-row>
  533. <el-row>
  534. <el-col :span="7"><span>宽(米):</span></el-col>
  535. <el-col :span="17">
  536. <el-input-number
  537. name="zL"
  538. v-model="billboardModel.templateCentre.zL"
  539. size="mini"
  540. precision="2"
  541. :min="0"
  542. :max="100"
  543. step="0.1"
  544. @change="handleChange"
  545. ></el-input-number>
  546. </el-col>
  547. </el-row>
  548. <el-row>
  549. <el-col :span="7"> <span>厚度(米):</span></el-col>
  550. <el-col :span="17">
  551. <el-input-number
  552. name="yL"
  553. v-model="billboardModel.templateCentre.yL"
  554. size="mini"
  555. precision="2"
  556. :min="0"
  557. :max="50"
  558. step="0.1"
  559. @change="handleChange"
  560. ></el-input-number>
  561. </el-col>
  562. </el-row>
  563. <!--box-->
  564. </div>
  565. </div>
  566. <!--底部模型-->
  567. <!-- 弃用 -->
  568. <div v-if="JSON.stringify(billboardModel.templateBottom) != '{}'">
  569. <el-divider>底部模型参数</el-divider>
  570. <!--如果模型是box类型-->
  571. <div
  572. v-if="
  573. selectbillboardModelRule &&
  574. selectbillboardModelRule.templateBottomType == 'box'
  575. "
  576. >
  577. <!--box-->
  578. <el-row>
  579. <el-col :span="7"> <span>长(米):</span></el-col>
  580. <el-col :span="17">
  581. <el-input-number
  582. name="xL"
  583. v-model="billboardModel.templateBottom.xL"
  584. size="mini"
  585. precision="2"
  586. :min="0"
  587. :max="100"
  588. step="0.1"
  589. @change="handleChange"
  590. label="长(米)"
  591. ></el-input-number>
  592. </el-col>
  593. </el-row>
  594. <el-row>
  595. <el-col :span="7"> <span>宽/高(米):</span></el-col>
  596. <el-col :span="17">
  597. <el-input-number
  598. name="yL"
  599. v-model="billboardModel.templateBottom.yL"
  600. size="mini"
  601. precision="2"
  602. :min="0"
  603. :max="50"
  604. step="0.1"
  605. @change="handleChange"
  606. label=""
  607. >宽/高(米)</el-input-number
  608. >
  609. </el-col>
  610. </el-row>
  611. <el-row>
  612. <el-col :span="7"><span>厚度(米):</span></el-col>
  613. <el-col :span="17">
  614. <el-input-number
  615. name="zL"
  616. v-model="billboardModel.templateBottom.zL"
  617. size="mini"
  618. precision="2"
  619. :min="0"
  620. :max="100"
  621. step="0.1"
  622. @change="handleChange"
  623. label="厚度(米)"
  624. ></el-input-number>
  625. </el-col>
  626. </el-row>
  627. <!--box-->
  628. </div>
  629. </div>
  630. <!--附加参数-->
  631. <div v-if="billboardReview && billboardReview.AttachedData">
  632. <el-divider>附加参数</el-divider>
  633. <!--如果模型是box类型-->
  634. <div>
  635. <el-row
  636. v-for="AttachedDataItem in billboardReview.AttachedData"
  637. :key="AttachedDataItem.key"
  638. >
  639. <el-col :span="7">
  640. <span>{{ AttachedDataItem.value }}:</span></el-col
  641. >
  642. <el-col
  643. :span="17"
  644. v-if="
  645. AttachedDataItem.selectData &&
  646. AttachedDataItem.selectData.length > 0
  647. "
  648. >
  649. <el-select
  650. v-model="billboardModel.AttachedData[AttachedDataItem.key]"
  651. placeholder="请选择"
  652. >
  653. <el-option
  654. v-for="item in AttachedDataItem.selectData"
  655. :key="item.value"
  656. :label="item.label"
  657. :value="item.value"
  658. >
  659. </el-option>
  660. </el-select>
  661. </el-col>
  662. <el-col v-else :span="17">
  663. <el-input
  664. v-model="billboardModel.AttachedData[AttachedDataItem.key]"
  665. placeholder="请输入内容"
  666. ></el-input>
  667. </el-col>
  668. </el-row>
  669. </div>
  670. </div>
  671. </div>
  672. <el-row>
  673. <el-col :span="24">
  674. <span
  675. >注意:当前视角为保存完成后定位显示视角,请确保当前广告牌观察视角为最佳视角,保存即可
  676. </span>
  677. </el-col>
  678. </el-row>
  679. <el-row>
  680. <div style="display: inline-flex">
  681. <el-button size="mini" type="primary" @click="saveMode()"
  682. >保存</el-button
  683. >
  684. <el-button size="mini" @click="cancle()">取消</el-button>
  685. </div>
  686. </el-row>
  687. </div>
  688. </template>
  689. <script>
  690. import { Image } from "element-ui";
  691. import { v4 as uuidv4 } from "uuid";
  692. import { addBillboardModelList } from "@/api/zt/ztApi.js";
  693. /**
  694. * 添加的模型集合
  695. */
  696. let modelList = [];
  697. export default {
  698. props: {
  699. layerid: {
  700. type: String,
  701. default: "",
  702. },
  703. project: {
  704. type: String,
  705. default: "",
  706. },
  707. info: {
  708. type: Object,
  709. default: () => {
  710. return {};
  711. },
  712. },
  713. lydata: {
  714. type: Object,
  715. default: () => {
  716. return {};
  717. },
  718. },
  719. lyoption: {
  720. type: Object,
  721. default: () => {
  722. return {};
  723. },
  724. },
  725. },
  726. data() {
  727. return {
  728. billboardModel: {
  729. id: "",
  730. billboardInfoId: "",
  731. billboardName: "",
  732. billboardType: "",
  733. x: 109.56047,
  734. y: 18.36254,
  735. z: 3,
  736. rotateX: 0,
  737. rotateY: 0,
  738. rotateZ: 90,
  739. ReviewStatus: "",
  740. ReviewComments: "",
  741. isAddModel: false,
  742. remarks: "",
  743. template: {},
  744. templateTop: {},
  745. templateCentre: {},
  746. templateBottom: {},
  747. AttachedData: {},
  748. },
  749. options: [],
  750. /**
  751. * 编辑句柄
  752. */
  753. handlerPoint: null,
  754. /**
  755. * 当前编辑模型
  756. */
  757. currentEntity: null,
  758. point3D: null,
  759. GUID: "",
  760. billboardReview: { isAddModel: false, ModelType: "box", modelurl: "" },
  761. billboardModelRule: [],
  762. selectbillboardModelRule: null,
  763. uploadUrl: window.ZTaxiosURI + "/uploadFile/uploadZipFile",
  764. thisfileurl: "",
  765. fileList: [],
  766. };
  767. },
  768. watch: {},
  769. mounted() {
  770. this.getGGLX();
  771. },
  772. methods: {
  773. submitUpload() {
  774. //文件大小校验
  775. this.fileList.forEach((file) => {
  776. const isLt2M = file.size / 1024 / 1024 < 10;
  777. if (!isLt2M) {
  778. this.$message.error("图片大小不能超过 2MB!");
  779. return false;
  780. }
  781. });
  782. //校验添加文件完整性
  783. let gltffile = this.fileList.find((c) => c.name.includes(".gltf"));
  784. debugger;
  785. if (gltffile) {
  786. try {
  787. var reader = new FileReader();
  788. reader.onload = function () {
  789. if (reader.result) {
  790. //打印文件内容
  791. if (reader.result) {
  792. let contentJson = JSON.parse(reader.result);
  793. }
  794. } else {
  795. //清除
  796. this.$refs.upload.clearFiles();
  797. this.$message.error("gltf文件读取失败!");
  798. }
  799. };
  800. reader.readAsText(gltffile.raw);
  801. } catch (error) {
  802. console.log(error);
  803. //清除
  804. this.$refs.upload.clearFiles();
  805. this.$message.error("上传文件出现意外的错误!");
  806. }
  807. // this.$refs.upload.submit();
  808. } else {
  809. this.$message.error("请上传gltf主文件!");
  810. //清除
  811. this.$refs.upload.clearFiles();
  812. }
  813. },
  814. handleFileChange(file, fileList) {
  815. this.fileList = fileList;
  816. },
  817. //文件列表移除文件时的钩子
  818. handleRemove(file, fileList) {
  819. console.log(file, fileList);
  820. },
  821. //文件列表超出最大文件个数回调
  822. handleExceed() {
  823. this.$message.error("请先删除已上传的文件,再上传!");
  824. },
  825. // 删除确认回调
  826. beforeRemove(file, fileList) {
  827. return true; //this.$confirm(`确定移除 ${file.name}?`);
  828. },
  829. //文件上传前回调
  830. beforeAvatarUpload(file) {
  831. const isLt2M = file.size / 1024 / 1024 < 50;
  832. if (!isLt2M) {
  833. this.$message.error("文件大小不能超过 50MB!");
  834. return false;
  835. }
  836. return true;
  837. },
  838. //上传成功回调
  839. handleAvatarSuccess(res, file) {
  840. console.log(res);
  841. if (res.data.url.includes(".gltf")) {
  842. this.thisfileurl = res.data.url;
  843. } else {
  844. this.$message.error("请上传包含gltf文件的zip压缩包!");
  845. this.$refs.upload.clearFiles();
  846. }
  847. },
  848. //过滤广告类型
  849. getGGLX() {
  850. // if (this.project.dataurl) {
  851. // this.options = window.billboardReviewList.filter(
  852. // (c) => c.id == "wew1" || c.id == "wew2sdfk32"
  853. // );
  854. // } else {
  855. // this.options = window.billboardReviewList.filter((c) => c.id != "wew1");
  856. // }
  857. // 所有
  858. var sdf = window.billboardReviewList;
  859. //如果不是报建模型 去除报建类型
  860. if (!this.project.dataurl) {
  861. sdf = this.filterTreeByReportBuilding(sdf);
  862. }
  863. this.options = sdf;
  864. },
  865. filterTreeByReportBuilding(tree) {
  866. const treeArray = Array.isArray(tree) ? tree : [tree];
  867. return treeArray
  868. .filter(
  869. (node) => !node.isReportBuilding && node.isReportBuilding != true
  870. )
  871. .map((node) => {
  872. // 复制当前节点,避免修改原数据
  873. const newNode = { ...node };
  874. // 递归过滤子节点
  875. if (newNode.children && newNode.children.length > 0) {
  876. newNode.children = this.filterTreeByReportBuilding(
  877. newNode.children
  878. );
  879. }
  880. return newNode;
  881. });
  882. },
  883. /**
  884. * 点击添加位置
  885. */
  886. addModel() {
  887. var that = this;
  888. this.removeModel();
  889. if (modelList.length > 0) {
  890. for (let index = 0; index < modelList.length; index++) {
  891. const element = modelList[index];
  892. viewer.entities.removeById(element.id);
  893. }
  894. modelList = [];
  895. }
  896. if (that.billboardReview && that.billboardReview.ModelType) {
  897. that.TemplateDefaultValues(that.billboardReview.ModelType);
  898. }
  899. if (that.thisfileurl) {
  900. that.billboardModel.template.isImportModel = "true";
  901. debugger;
  902. }
  903. viewer._container.style.cursor = "pointer";
  904. that.GUID = uuidv4();
  905. that.handlerPoint = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
  906. //todo:在显示地形情况下点击创建点
  907. var imageurl = "../../../../static/ModelData/billboard/1.jpg";
  908. var modelurl = "../../../../static/ModelData/billboard/box.gltf";
  909. that.handlerPoint.setInputAction(function (event) {
  910. // // 使用场景的pick方法获取点击位置的实体
  911. // var pickedObject = viewer.scene.pick(event.position);
  912. // // 检查是否点击到了实体
  913. // if (
  914. // scene.pickPositionSupported &&
  915. // Cesium.defined(pickedObject) &&
  916. // pickedObject.primitive
  917. // ) {
  918. // debugger;
  919. // }
  920. var newposition = viewer.scene.pickPosition(event.position); //获取到地形图上面的坐标
  921. var orientation = Cesium.Transforms.headingPitchRollQuaternion(
  922. newposition,
  923. new Cesium.HeadingPitchRoll(
  924. Cesium.Math.toRadians(that.billboardModel.rotateZ),
  925. Cesium.Math.toRadians(that.billboardModel.rotateY),
  926. Cesium.Math.toRadians(that.billboardModel.rotateX)
  927. )
  928. );
  929. var coordinate = Cesium.Cartographic.fromCartesian(newposition);
  930. var longitude = Cesium.Math.toDegrees(coordinate.longitude);
  931. var latitude = Cesium.Math.toDegrees(coordinate.latitude);
  932. var height = coordinate.height;
  933. that.billboardModel.x = longitude;
  934. that.billboardModel.y = latitude;
  935. that.billboardModel.z = height;
  936. // var newPosition = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
  937. if (that.billboardReview && that.billboardReview.ModelType) {
  938. var sd = that.billboardReview.ModelType;
  939. switch (sd) {
  940. //矩形广告
  941. case "rectangleBillboard":
  942. that.billboardModel.templateTop.templateType =
  943. that.selectbillboardModelRule.templateTopType;
  944. //计算当前实体的xyz
  945. that.billboardModel.templateTop.x = that.billboardModel.x;
  946. that.billboardModel.templateTop.y = that.billboardModel.y;
  947. if (that.billboardModel.template.isImportModel == "true") {
  948. that.billboardModel.templateTop.z = that.billboardModel.z;
  949. } else {
  950. that.billboardModel.templateTop.z =
  951. that.billboardModel.z +
  952. that.billboardModel.templateTop.yL / 2;
  953. }
  954. var p = Cesium.Cartesian3.fromDegrees(
  955. that.billboardModel.templateTop.x,
  956. that.billboardModel.templateTop.y,
  957. that.billboardModel.templateTop.z
  958. );
  959. if (that.billboardModel.template.isImportModel == "true") {
  960. var url = that.billboardModelRule.templateTopUrl || modelurl;
  961. if (that.thisfileurl) {
  962. url = window.ZTaxiosURI + that.thisfileurl;
  963. that.selectbillboardModelRule.templateTopUrl =
  964. that.thisfileurl;
  965. }
  966. var entity = viewer.entities.add({
  967. id: "top_billboard_" + that.GUID,
  968. name: "gltf",
  969. show: true,
  970. position: p,
  971. /**
  972. * 模型
  973. */
  974. model: {
  975. uri: url,
  976. scale: that.billboardModel.templateTop.scaleL,
  977. },
  978. orientation: orientation,
  979. });
  980. modelList.push(entity);
  981. } else {
  982. var topentity = viewer.entities.add({
  983. id: "top_billboard_" + that.GUID,
  984. name: "gltf",
  985. show: true,
  986. position: p,
  987. /**
  988. * 长方体
  989. */
  990. box: {
  991. dimensions: new Cesium.Cartesian3(
  992. that.billboardModel.templateTop.xL,
  993. that.billboardModel.templateTop.zL,
  994. that.billboardModel.templateTop.yL
  995. ),
  996. show: true,
  997. material: Cesium.Color.LIGHTGREEN,
  998. },
  999. orientation: orientation,
  1000. });
  1001. modelList.push(topentity);
  1002. }
  1003. break;
  1004. // 立杆型广告
  1005. case "postsBillboard":
  1006. that.billboardModel.templateCentre.templateType =
  1007. that.selectbillboardModelRule.templateCentreType;
  1008. that.billboardModel.templateCentre.x = that.billboardModel.x;
  1009. that.billboardModel.templateCentre.y = that.billboardModel.y;
  1010. that.billboardModel.templateCentre.z =
  1011. that.billboardModel.z +
  1012. that.billboardModel.templateCentre.yL / 2;
  1013. if (that.billboardModel.template.isImportModel != "true") {
  1014. var c_p = Cesium.Cartesian3.fromDegrees(
  1015. that.billboardModel.templateCentre.x,
  1016. that.billboardModel.templateCentre.y,
  1017. that.billboardModel.templateCentre.z
  1018. );
  1019. var Centreentity = viewer.entities.add({
  1020. id: "Centre_billboard_" + that.GUID,
  1021. name: "gltf",
  1022. show: true,
  1023. position: c_p,
  1024. /**
  1025. * 圆柱
  1026. */
  1027. cylinder: {
  1028. length: that.billboardModel.templateCentre.yL, //圆柱体长度
  1029. topRadius: that.billboardModel.templateCentre.rL, //圆柱顶部半径
  1030. bottomRadius: that.billboardModel.templateCentre.rL, //圆柱体底部半径
  1031. material: Cesium.Color.LIGHTGREEN,
  1032. shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
  1033. },
  1034. orientation: Cesium.Transforms.headingPitchRollQuaternion(
  1035. newposition,
  1036. new Cesium.HeadingPitchRoll(
  1037. Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1038. Cesium.Math.toRadians(0),
  1039. Cesium.Math.toRadians(0)
  1040. )
  1041. ),
  1042. });
  1043. modelList.push(Centreentity);
  1044. }
  1045. that.billboardModel.templateTop.templateType =
  1046. that.selectbillboardModelRule.templateTopType;
  1047. //计算当前实体的xyz
  1048. that.billboardModel.templateTop.x = that.billboardModel.x;
  1049. that.billboardModel.templateTop.y = that.billboardModel.y;
  1050. if (that.billboardModel.template.isImportModel == "true") {
  1051. that.billboardModel.templateTop.z = that.billboardModel.z;
  1052. } else {
  1053. that.billboardModel.templateTop.z =
  1054. that.billboardModel.templateCentre.z +
  1055. that.billboardModel.templateCentre.yL / 2 +
  1056. that.billboardModel.templateTop.yL / 2;
  1057. }
  1058. var t_p = Cesium.Cartesian3.fromDegrees(
  1059. that.billboardModel.templateTop.x,
  1060. that.billboardModel.templateTop.y,
  1061. that.billboardModel.templateTop.z
  1062. );
  1063. if (that.billboardModel.template.isImportModel == "true") {
  1064. var url = that.billboardModelRule.templateTopUrl || modelurl;
  1065. if (that.thisfileurl) {
  1066. url = window.ZTaxiosURI + that.thisfileurl;
  1067. that.selectbillboardModelRule.templateTopUrl =
  1068. that.thisfileurl;
  1069. }
  1070. var topentity = viewer.entities.add({
  1071. id: "top_billboard_" + that.GUID,
  1072. name: "gltf",
  1073. show: true,
  1074. position: t_p,
  1075. /**
  1076. * 模型
  1077. */
  1078. model: {
  1079. uri: url,
  1080. scale: that.billboardModel.templateTop.scaleL,
  1081. },
  1082. orientation: orientation,
  1083. });
  1084. modelList.push(topentity);
  1085. } else {
  1086. var topentity = viewer.entities.add({
  1087. id: "top_billboard_" + that.GUID,
  1088. name: "gltf",
  1089. show: true,
  1090. position: t_p,
  1091. /**
  1092. * 矩形
  1093. */
  1094. box: {
  1095. dimensions: new Cesium.Cartesian3(
  1096. that.billboardModel.templateTop.xL,
  1097. that.billboardModel.templateTop.zL,
  1098. that.billboardModel.templateTop.yL
  1099. ),
  1100. material: Cesium.Color.LIGHTGREEN,
  1101. // outline: false,
  1102. // outlineColor: Cesium.Color.SPRINGGREEN,
  1103. // outlineWidth: 1,
  1104. },
  1105. orientation: orientation,
  1106. });
  1107. modelList.push(topentity);
  1108. }
  1109. break;
  1110. //底座型立杆广告
  1111. case "ColumnWithaseBillboard":
  1112. that.billboardModel.templateCentre.templateType =
  1113. that.selectbillboardModelRule.templateBottomType;
  1114. //计算当前实体的xyz
  1115. that.billboardModel.templateCentre.x = that.billboardModel.x;
  1116. that.billboardModel.templateCentre.y = that.billboardModel.y;
  1117. that.billboardModel.templateCentre.z =
  1118. that.billboardModel.z +
  1119. that.billboardModel.templateCentre.yL / 2;
  1120. if (that.billboardModel.template.isImportModel != "true") {
  1121. var b_p = Cesium.Cartesian3.fromDegrees(
  1122. that.billboardModel.templateCentre.x,
  1123. that.billboardModel.templateCentre.y,
  1124. that.billboardModel.templateCentre.z
  1125. );
  1126. var bottomentity = viewer.entities.add({
  1127. id: "bottom_billboard_" + that.GUID,
  1128. name: "gltf",
  1129. show: true,
  1130. position: b_p,
  1131. /**
  1132. * 矩形
  1133. */
  1134. box: {
  1135. dimensions: new Cesium.Cartesian3(
  1136. that.billboardModel.templateCentre.xL,
  1137. that.billboardModel.templateCentre.zL,
  1138. that.billboardModel.templateCentre.yL
  1139. ),
  1140. material: Cesium.Color.LIGHTGREEN,
  1141. // outline: false,
  1142. // outlineColor: Cesium.Color.SPRINGGREEN,
  1143. // outlineWidth: 1,
  1144. },
  1145. orientation: Cesium.Transforms.headingPitchRollQuaternion(
  1146. newposition,
  1147. new Cesium.HeadingPitchRoll(
  1148. Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1149. Cesium.Math.toRadians(0),
  1150. Cesium.Math.toRadians(0)
  1151. )
  1152. ),
  1153. });
  1154. modelList.push(bottomentity);
  1155. }
  1156. // that.billboardModel.templateCentre.templateType =
  1157. // that.selectbillboardModelRule.templateCentreType;
  1158. // that.billboardModel.templateCentre.x = that.billboardModel.x;
  1159. // that.billboardModel.templateCentre.y = that.billboardModel.y;
  1160. // that.billboardModel.templateCentre.z =
  1161. // that.billboardModel.templateBottom.z +
  1162. // that.billboardModel.templateBottom.yL / 2 +
  1163. // that.billboardModel.templateCentre.yL / 2;
  1164. // if (that.billboardModel.template.isImportModel != "true") {
  1165. // var c_p = Cesium.Cartesian3.fromDegrees(
  1166. // that.billboardModel.templateCentre.x,
  1167. // that.billboardModel.templateCentre.y,
  1168. // that.billboardModel.templateCentre.z
  1169. // );
  1170. // var Centreentity = viewer.entities.add({
  1171. // id: "Centre_billboard_" + that.GUID,
  1172. // name: "gltf",
  1173. // show: true,
  1174. // position: c_p,
  1175. // /**
  1176. // * 圆柱
  1177. // */
  1178. // cylinder: {
  1179. // length: that.billboardModel.templateCentre.yL, //圆柱体长度
  1180. // topRadius: that.billboardModel.templateCentre.rL, //圆柱顶部半径
  1181. // bottomRadius: that.billboardModel.templateCentre.rL, //圆柱体底部半径
  1182. // material: Cesium.Color.LIGHTGREEN,
  1183. // shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
  1184. // },
  1185. // orientation: Cesium.Transforms.headingPitchRollQuaternion(
  1186. // newposition,
  1187. // new Cesium.HeadingPitchRoll(
  1188. // Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1189. // Cesium.Math.toRadians(0),
  1190. // Cesium.Math.toRadians(0)
  1191. // )
  1192. // ),
  1193. // });
  1194. // modelList.push(Centreentity);
  1195. // }
  1196. that.billboardModel.templateTop.templateType =
  1197. that.selectbillboardModelRule.templateTopType;
  1198. //计算当前实体的xyz
  1199. that.billboardModel.templateTop.x = that.billboardModel.x;
  1200. that.billboardModel.templateTop.y = that.billboardModel.y;
  1201. if (that.billboardModel.template.isImportModel == "true") {
  1202. that.billboardModel.templateTop.z = that.billboardModel.z;
  1203. } else {
  1204. that.billboardModel.templateTop.z =
  1205. that.billboardModel.templateCentre.z +
  1206. that.billboardModel.templateCentre.yL / 2 +
  1207. that.billboardModel.templateTop.yL / 2;
  1208. }
  1209. // if (that.selectbillboardModelRule.templateTopAngleRoll) {
  1210. // var sd =
  1211. // that.billboardModel.templateTop.yL *
  1212. // Math.cos(that.selectbillboardModelRule.templateTopAngleRoll);
  1213. // that.billboardModel.templateTop.z =
  1214. // that.billboardModel.templateTop.z -
  1215. // sd +
  1216. // that.billboardModel.templateTop.zL;
  1217. // }
  1218. var t_p = Cesium.Cartesian3.fromDegrees(
  1219. that.billboardModel.templateTop.x,
  1220. that.billboardModel.templateTop.y,
  1221. that.billboardModel.templateTop.z
  1222. );
  1223. if (that.billboardModel.template.isImportModel == "true") {
  1224. var url = that.billboardModelRule.templateTopUrl || modelurl;
  1225. if (that.thisfileurl) {
  1226. url = window.ZTaxiosURI + that.thisfileurl;
  1227. that.selectbillboardModelRule.templateTopUrl =
  1228. that.thisfileurl;
  1229. }
  1230. var entity = viewer.entities.add({
  1231. id: "top_billboard_" + that.GUID,
  1232. name: "gltf",
  1233. show: true,
  1234. position: t_p,
  1235. /**
  1236. * 模型
  1237. */
  1238. model: {
  1239. uri: url,
  1240. scale: that.billboardModel.templateTop.scaleL,
  1241. },
  1242. orientation: orientation,
  1243. });
  1244. modelList.push(entity);
  1245. } else {
  1246. var topentity = viewer.entities.add({
  1247. id: "top_billboard_" + that.GUID,
  1248. name: "gltf",
  1249. show: true,
  1250. position: t_p,
  1251. /**
  1252. * 矩形
  1253. */
  1254. box: {
  1255. dimensions: new Cesium.Cartesian3(
  1256. that.billboardModel.templateTop.xL,
  1257. that.billboardModel.templateTop.zL,
  1258. that.billboardModel.templateTop.yL
  1259. ),
  1260. material: Cesium.Color.LIGHTGREEN,
  1261. // outline: false,
  1262. // outlineColor: Cesium.Color.SPRINGGREEN,
  1263. // outlineWidth: 1,
  1264. },
  1265. orientation: orientation,
  1266. });
  1267. modelList.push(topentity);
  1268. }
  1269. break;
  1270. //实物型广告(模型型)
  1271. case "ModelBillboard":
  1272. that.billboardModel.templateTop.templateType =
  1273. that.selectbillboardModelRule.templateTopType;
  1274. //计算当前实体的xyz
  1275. that.billboardModel.templateTop.x = that.billboardModel.x;
  1276. that.billboardModel.templateTop.y = that.billboardModel.y;
  1277. that.billboardModel.templateTop.z = that.billboardModel.z;
  1278. var p = Cesium.Cartesian3.fromDegrees(
  1279. that.billboardModel.templateTop.x,
  1280. that.billboardModel.templateTop.y,
  1281. that.billboardModel.templateTop.z
  1282. );
  1283. var url = that.billboardModelRule.templateTopUrl || modelurl;
  1284. if (that.thisfileurl) {
  1285. url = window.ZTaxiosURI + that.thisfileurl;
  1286. that.selectbillboardModelRule.templateTopUrl = that.thisfileurl;
  1287. }
  1288. var entity = viewer.entities.add({
  1289. id: "top_billboard_" + that.GUID,
  1290. name: "gltf",
  1291. show: true,
  1292. position: p,
  1293. /**
  1294. * 模型
  1295. */
  1296. model: {
  1297. uri: url,
  1298. scale: that.billboardModel.templateTop.scaleL,
  1299. },
  1300. orientation: orientation,
  1301. });
  1302. modelList.push(entity);
  1303. break;
  1304. //图片型广告
  1305. case "imgBillboard":
  1306. that.billboardModel.templateTop.templateType =
  1307. that.selectbillboardModelRule.templateTopType;
  1308. //计算当前实体的xyz
  1309. var x = that.billboardModel.x;
  1310. var y = that.billboardModel.y;
  1311. var z =
  1312. that.billboardModel.z + that.billboardModel.templateTop.yL / 2;
  1313. if (that.billboardModel.template.isImportModel == "true") {
  1314. z = that.billboardModel.z;
  1315. }
  1316. that.billboardModel.templateTop.x = x;
  1317. that.billboardModel.templateTop.y = y;
  1318. that.billboardModel.templateTop.z = z;
  1319. var p = Cesium.Cartesian3.fromDegrees(
  1320. that.billboardModel.templateTop.x,
  1321. that.billboardModel.templateTop.y,
  1322. that.billboardModel.templateTop.z
  1323. );
  1324. var url = that.billboardModelRule.templateTopUrl || imageurl;
  1325. var entity = viewer.entities.add({
  1326. id: "top_billboard_" + that.GUID,
  1327. name: "gltf",
  1328. show: true,
  1329. position: p,
  1330. /**
  1331. * 广告牌
  1332. */
  1333. billboard: {
  1334. image: url,
  1335. width: that.billboardModel.templateTop.xL,
  1336. height: that.billboardModel.templateTop.yL,
  1337. rotation: that.billboardModel.rotateX,
  1338. sizeInMeters: true,
  1339. },
  1340. orientation: orientation,
  1341. });
  1342. modelList.push(entity);
  1343. break;
  1344. //上传的广告模型(模型型)
  1345. // case "bjModel":
  1346. // that.billboardModel.templateTop.templateType =
  1347. // that.selectbillboardModelRule.templateTopType;
  1348. // //计算当前实体的xyz
  1349. // that.billboardModel.templateTop.x = that.billboardModel.x;
  1350. // that.billboardModel.templateTop.y = that.billboardModel.y;
  1351. // that.billboardModel.templateTop.z = that.billboardModel.z;
  1352. // var p = Cesium.Cartesian3.fromDegrees(
  1353. // that.billboardModel.templateTop.x,
  1354. // that.billboardModel.templateTop.y,
  1355. // that.billboardModel.templateTop.z
  1356. // );
  1357. // var url = that.billboardModelRule.templateTopUrl || modelurl;
  1358. // if (that.thisfileurl) {
  1359. // url = window.ZTaxiosURI + that.thisfileurl;
  1360. // }
  1361. // var entity = viewer.entities.add({
  1362. // id: "top_billboard_" + that.GUID,
  1363. // name: "gltf",
  1364. // show: true,
  1365. // position: p,
  1366. // /**
  1367. // * 模型
  1368. // */
  1369. // model: {
  1370. // uri: url,
  1371. // scale: that.billboardModel.templateTop.scaleL,
  1372. // shadows: Cesium.ShadowMode.DISABLED,
  1373. // // imageBasedLightingFactor: new Cesium.Cartesian2(10, 1),
  1374. // lightColor: new Cesium.Cartesian3(10.0, 10.0, 10.0), //解决模型发暗,直接把光增强10倍 //这样就是白光增强到100倍。对Pbr材质有效
  1375. // },
  1376. // orientation: orientation,
  1377. // });
  1378. // modelList.push(entity);
  1379. // break;
  1380. default:
  1381. that.billboardModel.templateTop.templateType =
  1382. that.selectbillboardModelRule.templateTopType;
  1383. //计算当前实体的xyz
  1384. that.billboardModel.templateTop.x = that.billboardModel.x;
  1385. that.billboardModel.templateTop.y = that.billboardModel.y;
  1386. if (that.billboardModel.template.isImportModel == "true") {
  1387. that.billboardModel.templateTop.z = that.billboardModel.z;
  1388. } else {
  1389. that.billboardModel.templateTop.z =
  1390. that.billboardModel.z +
  1391. that.billboardModel.templateTop.yL / 2;
  1392. }
  1393. var p = Cesium.Cartesian3.fromDegrees(
  1394. that.billboardModel.templateTop.x,
  1395. that.billboardModel.templateTop.y,
  1396. that.billboardModel.templateTop.z
  1397. );
  1398. if (that.billboardModel.template.isImportModel == "true") {
  1399. var url = that.billboardModelRule.templateTopUrl || modelurl;
  1400. if (that.thisfileurl) {
  1401. url = window.ZTaxiosURI + that.thisfileurl;
  1402. that.selectbillboardModelRule.templateTopUrl =
  1403. that.thisfileurl;
  1404. }
  1405. var entity = viewer.entities.add({
  1406. id: "top_billboard_" + that.GUID,
  1407. name: "gltf",
  1408. show: true,
  1409. position: p,
  1410. /**
  1411. * 模型
  1412. */
  1413. model: {
  1414. uri: url,
  1415. scale: that.billboardModel.templateTop.scaleL,
  1416. },
  1417. orientation: orientation,
  1418. });
  1419. modelList.push(entity);
  1420. } else {
  1421. var topentity = viewer.entities.add({
  1422. id: "top_billboard_" + that.GUID,
  1423. name: "gltf",
  1424. show: true,
  1425. position: p,
  1426. /**
  1427. * 长方体
  1428. */
  1429. box: {
  1430. dimensions: new Cesium.Cartesian3(
  1431. that.billboardModel.templateTop.xL,
  1432. that.billboardModel.templateTop.zL,
  1433. that.billboardModel.templateTop.yL
  1434. ),
  1435. show: true,
  1436. material: Cesium.Color.LIGHTGREEN,
  1437. },
  1438. orientation: orientation,
  1439. });
  1440. modelList.push(topentity);
  1441. }
  1442. break;
  1443. }
  1444. }
  1445. if (that.handlerPoint)
  1446. that.handlerPoint.removeInputAction(
  1447. Cesium.ScreenSpaceEventType.LEFT_CLICK
  1448. );
  1449. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  1450. // var colorStr = color.toCssColorString();
  1451. // viewModel.boxMaterial = colorStr;
  1452. },
  1453. /**
  1454. * 动态调整模型
  1455. */
  1456. handleChange() {
  1457. this.$forceUpdate(); //解决点击计数器失效问题
  1458. var that = this;
  1459. debugger;
  1460. // modelList.forEach(model => {
  1461. // });
  1462. // var currentEntity = viewer.entities.getById("billboard_" + that.GUID);
  1463. // if (that.billboardReview && that.billboardReview.ModelType) {
  1464. // switch (that.billboardReview.ModelType) {
  1465. // case "box":
  1466. // /**
  1467. // * box
  1468. // */
  1469. // currentEntity.box.dimensions = new Cesium.Cartesian3(
  1470. // that.billboardModel.t_xL,
  1471. // that.billboardModel.t_zL,
  1472. // that.billboardModel.t_yL
  1473. // );
  1474. // break;
  1475. // case "img":
  1476. // /**
  1477. // * billoard
  1478. // */
  1479. // // debugger
  1480. // currentEntity.billboard.width = that.billboardModel.xL;
  1481. // currentEntity.billboard.height = that.billboardModel.yL;
  1482. // currentEntity.billboard.rotation = that.billboardModel.rotateX;
  1483. // break;
  1484. // case "model":
  1485. // /**
  1486. // * model
  1487. // */
  1488. // currentEntity.model.scale = that.billboardModel.xL;
  1489. // break;
  1490. // }
  1491. // }
  1492. // /**
  1493. // * 更新位置
  1494. // */
  1495. // var newposition = Cesium.Cartesian3.fromDegrees(
  1496. // parseFloat(that.billboardModel.x),
  1497. // parseFloat(that.billboardModel.y),
  1498. // parseFloat(that.billboardModel.z)
  1499. // );
  1500. // currentEntity.position = newposition;
  1501. // /**
  1502. // * 旋转
  1503. // */
  1504. // var heading = Cesium.Math.toRadians(that.billboardModel.rotateX);
  1505. // var pitch = Cesium.Math.toRadians(that.billboardModel.rotateY);
  1506. // var roll = Cesium.Math.toRadians(that.billboardModel.rotateZ);
  1507. // var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1508. // var neworientation = Cesium.Transforms.headingPitchRollQuaternion(
  1509. // newposition,
  1510. // hpr
  1511. // );
  1512. // currentEntity.orientation = neworientation;
  1513. // if (modelList.length > 0) {
  1514. // for (let index = 0; index < modelList.length; index++) {
  1515. // const element = modelList[index];
  1516. // viewer.entities.removeById(element.id);
  1517. // }
  1518. // modelList = [];
  1519. // }
  1520. if (that.billboardReview && that.billboardReview.ModelType) {
  1521. var newposition = Cesium.Cartesian3.fromDegrees(
  1522. parseFloat(that.billboardModel.x),
  1523. parseFloat(that.billboardModel.y),
  1524. parseFloat(that.billboardModel.z)
  1525. );
  1526. /**
  1527. * 旋转
  1528. */
  1529. var heading = Cesium.Math.toRadians(that.billboardModel.rotateZ);
  1530. var pitch = Cesium.Math.toRadians(that.billboardModel.rotateY);
  1531. var roll = Cesium.Math.toRadians(that.billboardModel.rotateX);
  1532. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1533. var orientation = Cesium.Transforms.headingPitchRollQuaternion(
  1534. newposition,
  1535. hpr
  1536. );
  1537. var sd = that.billboardReview.ModelType;
  1538. switch (sd) {
  1539. //矩形广告
  1540. case "rectangleBillboard":
  1541. //计算当前实体的xyz
  1542. that.billboardModel.templateTop.x = that.billboardModel.x;
  1543. that.billboardModel.templateTop.y = that.billboardModel.y;
  1544. if (that.billboardModel.template.isImportModel == "true") {
  1545. that.billboardModel.templateTop.z = that.billboardModel.z;
  1546. } else {
  1547. that.billboardModel.templateTop.z =
  1548. that.billboardModel.z + that.billboardModel.templateTop.yL / 2;
  1549. }
  1550. var p = Cesium.Cartesian3.fromDegrees(
  1551. that.billboardModel.templateTop.x,
  1552. that.billboardModel.templateTop.y,
  1553. that.billboardModel.templateTop.z
  1554. );
  1555. if (that.billboardModel.template.isImportModel == "true") {
  1556. var topentity = viewer.entities.getById(
  1557. "top_billboard_" + that.GUID
  1558. );
  1559. topentity.position = t_p;
  1560. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1561. topentity.orientation = orientation;
  1562. } else {
  1563. var topentity = viewer.entities.getById(
  1564. "top_billboard_" + that.GUID
  1565. );
  1566. topentity.position = p;
  1567. topentity.box.dimensions = new Cesium.Cartesian3(
  1568. that.billboardModel.templateTop.xL,
  1569. that.billboardModel.templateTop.zL,
  1570. that.billboardModel.templateTop.yL
  1571. );
  1572. topentity.orientation = orientation;
  1573. }
  1574. break;
  1575. // 立杆型广告
  1576. case "postsBillboard":
  1577. that.billboardModel.templateCentre.x = that.billboardModel.x;
  1578. that.billboardModel.templateCentre.y = that.billboardModel.y;
  1579. that.billboardModel.templateCentre.z =
  1580. that.billboardModel.z + that.billboardModel.templateCentre.yL / 2;
  1581. if (that.billboardModel.template.isImportModel != "true") {
  1582. var c_p = Cesium.Cartesian3.fromDegrees(
  1583. that.billboardModel.templateCentre.x,
  1584. that.billboardModel.templateCentre.y,
  1585. that.billboardModel.templateCentre.z
  1586. );
  1587. var Centreentity = viewer.entities.getById(
  1588. "Centre_billboard_" + that.GUID
  1589. );
  1590. Centreentity.position = c_p;
  1591. Centreentity.cylinder = {
  1592. length: that.billboardModel.templateCentre.yL, //圆柱体长度
  1593. topRadius: that.billboardModel.templateCentre.rL, //圆柱顶部半径
  1594. bottomRadius: that.billboardModel.templateCentre.rL, //圆柱体底部半径
  1595. material: Cesium.Color.LIGHTGREEN,
  1596. shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
  1597. };
  1598. Centreentity.orientation =
  1599. Cesium.Transforms.headingPitchRollQuaternion(
  1600. newposition,
  1601. new Cesium.HeadingPitchRoll(
  1602. Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1603. Cesium.Math.toRadians(0),
  1604. Cesium.Math.toRadians(0)
  1605. )
  1606. );
  1607. }
  1608. //计算当前实体的xyz
  1609. that.billboardModel.templateTop.x = that.billboardModel.x;
  1610. that.billboardModel.templateTop.y = that.billboardModel.y;
  1611. if (that.billboardModel.template.isImportModel == "true") {
  1612. that.billboardModel.templateTop.z = that.billboardModel.z;
  1613. } else {
  1614. that.billboardModel.templateTop.z =
  1615. that.billboardModel.templateCentre.z +
  1616. that.billboardModel.templateCentre.yL / 2 +
  1617. that.billboardModel.templateTop.yL / 2;
  1618. }
  1619. if (that.billboardModel.rotateX > 10) {
  1620. that.billboardModel.templateTop.z =
  1621. that.billboardModel.templateTop.z -
  1622. that.billboardModel.templateTop.yL / 2;
  1623. }
  1624. var t_p = Cesium.Cartesian3.fromDegrees(
  1625. that.billboardModel.templateTop.x,
  1626. that.billboardModel.templateTop.y,
  1627. that.billboardModel.templateTop.z
  1628. );
  1629. if (that.billboardModel.template.isImportModel == "true") {
  1630. var topentity = viewer.entities.getById(
  1631. "top_billboard_" + that.GUID
  1632. );
  1633. topentity.position = t_p;
  1634. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1635. topentity.orientation = orientation;
  1636. } else {
  1637. var topentity = viewer.entities.getById(
  1638. "top_billboard_" + that.GUID
  1639. );
  1640. topentity.position = t_p;
  1641. topentity.box.dimensions = new Cesium.Cartesian3(
  1642. that.billboardModel.templateTop.xL,
  1643. that.billboardModel.templateTop.zL,
  1644. that.billboardModel.templateTop.yL
  1645. );
  1646. topentity.orientation = orientation;
  1647. }
  1648. break;
  1649. //底座型立杆广告
  1650. case "ColumnWithaseBillboard":
  1651. //计算当前实体的xyz
  1652. that.billboardModel.templateCentre.x = that.billboardModel.x;
  1653. that.billboardModel.templateCentre.y = that.billboardModel.y;
  1654. that.billboardModel.templateCentre.z =
  1655. that.billboardModel.z + that.billboardModel.templateCentre.yL / 2;
  1656. if (that.billboardModel.template.isImportModel != "true") {
  1657. var b_p = Cesium.Cartesian3.fromDegrees(
  1658. that.billboardModel.templateCentre.x,
  1659. that.billboardModel.templateCentre.y,
  1660. that.billboardModel.templateCentre.z
  1661. );
  1662. var bottomentity = viewer.entities.getById(
  1663. "bottom_billboard_" + that.GUID
  1664. );
  1665. bottomentity.position = b_p;
  1666. bottomentity.box.dimensions = new Cesium.Cartesian3(
  1667. that.billboardModel.templateCentre.xL,
  1668. that.billboardModel.templateCentre.zL,
  1669. that.billboardModel.templateCentre.yL
  1670. );
  1671. bottomentity.orientation =
  1672. Cesium.Transforms.headingPitchRollQuaternion(
  1673. newposition,
  1674. new Cesium.HeadingPitchRoll(
  1675. Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1676. Cesium.Math.toRadians(0),
  1677. Cesium.Math.toRadians(0)
  1678. )
  1679. );
  1680. }
  1681. // that.billboardModel.templateCentre.x = that.billboardModel.x;
  1682. // that.billboardModel.templateCentre.y = that.billboardModel.y;
  1683. // that.billboardModel.templateCentre.z =
  1684. // that.billboardModel.templateBottom.z +
  1685. // that.billboardModel.templateBottom.yL / 2 +
  1686. // that.billboardModel.templateCentre.yL / 2;
  1687. // if (that.billboardModel.template.isImportModel != "true") {
  1688. // var c_p = Cesium.Cartesian3.fromDegrees(
  1689. // that.billboardModel.templateCentre.x,
  1690. // that.billboardModel.templateCentre.y,
  1691. // that.billboardModel.templateCentre.z
  1692. // );
  1693. // var Centreentity = viewer.entities.getById(
  1694. // "Centre_billboard_" + that.GUID
  1695. // );
  1696. // Centreentity.position = c_p;
  1697. // Centreentity.cylinder = {
  1698. // length: that.billboardModel.templateCentre.yL, //圆柱体长度
  1699. // topRadius: that.billboardModel.templateCentre.rL, //圆柱顶部半径
  1700. // bottomRadius: that.billboardModel.templateCentre.rL, //圆柱体底部半径
  1701. // material: Cesium.Color.LIGHTGREEN,
  1702. // shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
  1703. // };
  1704. // Centreentity.orientation =
  1705. // Cesium.Transforms.headingPitchRollQuaternion(
  1706. // newposition,
  1707. // new Cesium.HeadingPitchRoll(
  1708. // Cesium.Math.toRadians(that.billboardModel.rotateZ),
  1709. // Cesium.Math.toRadians(0),
  1710. // Cesium.Math.toRadians(0)
  1711. // )
  1712. // );
  1713. // }
  1714. //计算当前实体的xyz
  1715. that.billboardModel.templateTop.x = that.billboardModel.x;
  1716. that.billboardModel.templateTop.y = that.billboardModel.y;
  1717. if (that.billboardModel.template.isImportModel == "true") {
  1718. that.billboardModel.templateTop.z = that.billboardModel.z;
  1719. } else {
  1720. that.billboardModel.templateTop.z =
  1721. that.billboardModel.templateCentre.z +
  1722. that.billboardModel.templateCentre.yL / 2 +
  1723. that.billboardModel.templateTop.yL / 2;
  1724. }
  1725. // if (that.billboardModel.rotateX > 10) {
  1726. // // var sd =
  1727. // // (that.billboardModel.templateTop.yL / 2) *
  1728. // // Math.cos(that.billboardModel.rotateX);
  1729. // // that.billboardModel.templateTop.z =
  1730. // // that.billboardModel.templateTop.z -
  1731. // // sd +
  1732. // // that.billboardModel.templateTop.zL;
  1733. // that.billboardModel.templateTop.z =
  1734. // that.billboardModel.templateTop.z -
  1735. // that.billboardModel.templateTop.yL / 2 +
  1736. // that.billboardModel.templateTop.zL;
  1737. // }
  1738. var t_p = Cesium.Cartesian3.fromDegrees(
  1739. that.billboardModel.templateTop.x,
  1740. that.billboardModel.templateTop.y,
  1741. that.billboardModel.templateTop.z
  1742. );
  1743. if (that.billboardModel.template.isImportModel == "true") {
  1744. var topentity = viewer.entities.getById(
  1745. "top_billboard_" + that.GUID
  1746. );
  1747. topentity.position = t_p;
  1748. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1749. topentity.orientation = orientation;
  1750. } else {
  1751. var topentity = viewer.entities.getById(
  1752. "top_billboard_" + that.GUID
  1753. );
  1754. topentity.position = t_p;
  1755. topentity.box.dimensions = new Cesium.Cartesian3(
  1756. that.billboardModel.templateTop.xL,
  1757. that.billboardModel.templateTop.zL,
  1758. that.billboardModel.templateTop.yL
  1759. );
  1760. topentity.orientation = orientation;
  1761. }
  1762. break;
  1763. //实物型广告(模型型)
  1764. case "ModelBillboard":
  1765. //计算当前实体的xyz
  1766. that.billboardModel.templateTop.x = that.billboardModel.x;
  1767. that.billboardModel.templateTop.y = that.billboardModel.y;
  1768. that.billboardModel.templateTop.z = that.billboardModel.z;
  1769. var t_p = Cesium.Cartesian3.fromDegrees(
  1770. that.billboardModel.templateTop.x,
  1771. that.billboardModel.templateTop.y,
  1772. that.billboardModel.templateTop.z
  1773. );
  1774. var topentity = viewer.entities.getById(
  1775. "top_billboard_" + that.GUID
  1776. );
  1777. topentity.position = t_p;
  1778. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1779. topentity.orientation = orientation;
  1780. break;
  1781. //图片型广告
  1782. case "imgBillboard":
  1783. //计算当前实体的xyz
  1784. var x = that.billboardModel.x;
  1785. var y = that.billboardModel.y;
  1786. var z =
  1787. that.billboardModel.z + that.billboardModel.templateTop.yL / 2;
  1788. if (that.billboardModel.template.isImportModel == "true") {
  1789. z = that.billboardModel.z;
  1790. }
  1791. that.billboardModel.templateTop.x = x;
  1792. that.billboardModel.templateTop.y = y;
  1793. that.billboardModel.templateTop.z = z;
  1794. var t_p = Cesium.Cartesian3.fromDegrees(
  1795. that.billboardModel.templateTop.x,
  1796. that.billboardModel.templateTop.y,
  1797. that.billboardModel.templateTop.z
  1798. );
  1799. if (that.billboardModel.template.isImportModel == "true") {
  1800. var topentity = viewer.entities.getById(
  1801. "top_billboard_" + that.GUID
  1802. );
  1803. topentity.position = t_p;
  1804. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1805. topentity.orientation = orientation;
  1806. } else {
  1807. var topentity = viewer.entities.getById(
  1808. "top_billboard_" + that.GUID
  1809. );
  1810. topentity.position = t_p;
  1811. topentity.billboard.width = that.billboardModel.templateTop.xL;
  1812. topentity.billboard.height = that.billboardModel.templateTop.yL;
  1813. topentity.billboard.rotation = that.billboardModel.rotateX;
  1814. topentity.orientation = orientation;
  1815. }
  1816. break;
  1817. default:
  1818. //计算当前实体的xyz
  1819. that.billboardModel.templateTop.x = that.billboardModel.x;
  1820. that.billboardModel.templateTop.y = that.billboardModel.y;
  1821. if (that.billboardModel.template.isImportModel == "true") {
  1822. that.billboardModel.templateTop.z = that.billboardModel.z;
  1823. } else {
  1824. that.billboardModel.templateTop.z =
  1825. that.billboardModel.z + that.billboardModel.templateTop.yL / 2;
  1826. }
  1827. var p = Cesium.Cartesian3.fromDegrees(
  1828. that.billboardModel.templateTop.x,
  1829. that.billboardModel.templateTop.y,
  1830. that.billboardModel.templateTop.z
  1831. );
  1832. if (that.billboardModel.template.isImportModel == "true") {
  1833. var topentity = viewer.entities.getById(
  1834. "top_billboard_" + that.GUID
  1835. );
  1836. topentity.position = p;
  1837. topentity.model.scale = that.billboardModel.templateTop.scaleL;
  1838. topentity.orientation = orientation;
  1839. } else {
  1840. var topentity = viewer.entities.getById(
  1841. "top_billboard_" + that.GUID
  1842. );
  1843. topentity.position = p;
  1844. topentity.box.dimensions = new Cesium.Cartesian3(
  1845. that.billboardModel.templateTop.xL,
  1846. that.billboardModel.templateTop.zL,
  1847. that.billboardModel.templateTop.yL
  1848. );
  1849. topentity.orientation = orientation;
  1850. }
  1851. break;
  1852. }
  1853. }
  1854. },
  1855. /**
  1856. * 类型修改时触发
  1857. */
  1858. changeBillboardType() {
  1859. debugger;
  1860. let sds = this.$refs["billboardTypeCascader"].getCheckedNodes()[0].data;
  1861. this.billboardReview = JSON.parse(JSON.stringify(sds));
  1862. if (this.billboardReview.isAddModel) {
  1863. this.billboardModel.isAddModel = this.billboardReview.isAddModel;
  1864. if (this.billboardReview && this.billboardReview.ModelType) {
  1865. this.TemplateDefaultValues(this.billboardReview.ModelType);
  1866. }
  1867. this.billboardModelRule = JSON.parse(
  1868. JSON.stringify(
  1869. window.billboardModelRuleList.find(
  1870. (c) => c.code == this.billboardReview.ModelType
  1871. ).template
  1872. )
  1873. );
  1874. this.selectbillboardModelRule =
  1875. this.billboardModelRule.length > 0
  1876. ? this.billboardModelRule[0]
  1877. : null;
  1878. } else {
  1879. this.billboardModelRule = null;
  1880. }
  1881. this.removeModel();
  1882. },
  1883. //模板默认值
  1884. TemplateDefaultValues(ModelType) {
  1885. debugger;
  1886. this.billboardModel.AttachedData = {};
  1887. this.billboardModel.rotateX = 0;
  1888. this.billboardModel.rotateY = 0;
  1889. this.billboardModel.rotateZ = 90;
  1890. switch (ModelType) {
  1891. //矩形广告
  1892. case "rectangleBillboard":
  1893. this.billboardModel.templateBottom = {};
  1894. this.billboardModel.templateCentre = {};
  1895. this.billboardModel.templateTop = {
  1896. xL: 1,
  1897. yL: 1,
  1898. zL: 0.1,
  1899. };
  1900. this.billboardModel.templateTop.scaleL = 1;
  1901. break;
  1902. // 立杆型广告
  1903. case "postsBillboard":
  1904. this.billboardModel.templateBottom = {};
  1905. this.billboardModel.templateCentre = {
  1906. yL: 1,
  1907. rL: 0.1,
  1908. };
  1909. this.billboardModel.templateTop = {
  1910. xL: 1,
  1911. yL: 1,
  1912. zL: 0.1,
  1913. };
  1914. this.billboardModel.templateTop.scaleL = 1;
  1915. break;
  1916. //底座型立杆广告
  1917. case "ColumnWithaseBillboard":
  1918. this.billboardModel.templateBottom = {
  1919. // xL: 1,
  1920. // yL: 0.1,
  1921. // zL: 1,
  1922. };
  1923. this.billboardModel.templateCentre = {
  1924. xL: 1,
  1925. yL: 0.1,
  1926. zL: 1,
  1927. };
  1928. this.billboardModel.templateTop = {
  1929. xL: 1,
  1930. yL: 1,
  1931. zL: 0.1,
  1932. };
  1933. this.billboardModel.templateTop.scaleL = 1;
  1934. break;
  1935. //实物型广告(模型型)
  1936. case "ModelBillboard":
  1937. this.billboardModel.templateBottom = {};
  1938. this.billboardModel.templateCentre = {};
  1939. this.billboardModel.templateTop = {
  1940. scaleL: 1,
  1941. };
  1942. break;
  1943. //图片型广告
  1944. case "imgBillboard":
  1945. this.billboardModel.templateBottom = {};
  1946. this.billboardModel.templateCentre = {};
  1947. this.billboardModel.templateTop = {
  1948. xL: 2,
  1949. yL: 1,
  1950. };
  1951. this.billboardModel.templateTop.scaleL = 1;
  1952. break;
  1953. default:
  1954. this.billboardModel.templateBottom = {};
  1955. this.billboardModel.templateCentre = {};
  1956. this.billboardModel.templateTop = {
  1957. xL: 1,
  1958. zL: 1,
  1959. yL: 0.1,
  1960. };
  1961. this.billboardModel.templateTop.scaleL = 1;
  1962. break;
  1963. }
  1964. },
  1965. /**
  1966. * 选择模型模板
  1967. */
  1968. selectModeltemplate(item) {
  1969. this.selectbillboardModelRule = item;
  1970. },
  1971. /**
  1972. * 保存编辑
  1973. */
  1974. async saveMode() {
  1975. debugger;
  1976. let that = this;
  1977. if (that.billboardReview.AttachedData) {
  1978. for (
  1979. var index = 0;
  1980. index < that.billboardReview.AttachedData.length;
  1981. index++
  1982. ) {
  1983. var attached = that.billboardReview.AttachedData[index];
  1984. var value = that.billboardModel.AttachedData[attached.key];
  1985. if (!value || value == "") {
  1986. this.$message.error("请添加附加参数");
  1987. return;
  1988. }
  1989. }
  1990. }
  1991. if (
  1992. that.billboardModel.billboardName == "" ||
  1993. that.billboardModel.billboardName == null
  1994. ) {
  1995. this.$message.error("请添加广告牌名称");
  1996. return;
  1997. }
  1998. if (that.billboardModel.isAddModel && modelList.length == 0) {
  1999. this.$message.error("请先完成[添加广告牌],再保存");
  2000. return;
  2001. }
  2002. if (
  2003. that.billboardReview.ModelType == "ModelBillboard" ||
  2004. that.billboardReview.ModelType == "imgBillboard"
  2005. ) {
  2006. if (
  2007. !that.billboardModel.templateTop.xL ||
  2008. !that.billboardModel.templateTop.yL ||
  2009. !that.billboardModel.templateTop.zL
  2010. ) {
  2011. this.$message.error("请输入广告牌长宽高和厚度参数");
  2012. return;
  2013. }
  2014. }
  2015. debugger;
  2016. let data = JSON.parse(JSON.stringify(that.billboardModel));
  2017. data.id = uuidv4();
  2018. data.billboardInfoId = that.project.id;
  2019. data.template = {
  2020. isImportModel: that.billboardModel.template.isImportModel,
  2021. ModelType: that.billboardReview.ModelType,
  2022. ...that.selectbillboardModelRule,
  2023. };
  2024. //添加附属信息的详细信息
  2025. var fsxxs = [];
  2026. if (
  2027. data.AttachedData &&
  2028. data.AttachedData != "{}" &&
  2029. Object.keys(data.AttachedData).length > 0
  2030. ) {
  2031. for (
  2032. var index = 0;
  2033. index < that.billboardReview.AttachedData.length;
  2034. index++
  2035. ) {
  2036. var attached = that.billboardReview.AttachedData[index];
  2037. var fsxx = { key: attached.key, value: attached.value, data: "" };
  2038. var valuedata = that.billboardModel.AttachedData[attached.key];
  2039. if (attached.selectData) {
  2040. fsxx.data = attached.selectData.find((c) => c.value == valuedata);
  2041. } else {
  2042. fsxx.data = valuedata;
  2043. }
  2044. fsxxs.push(JSON.parse(JSON.stringify(fsxx)));
  2045. }
  2046. data.AttachedData = JSON.stringify(fsxxs);
  2047. } else {
  2048. data.AttachedData = JSON.stringify(data.AttachedData);
  2049. }
  2050. data.template = JSON.stringify(data.template);
  2051. data.templateBottom = JSON.stringify(data.templateBottom);
  2052. data.templateCentre = JSON.stringify(data.templateCentre);
  2053. data.templateTop = JSON.stringify(data.templateTop);
  2054. data.viewing_angle = JSON.stringify({
  2055. destination: viewer.camera.position,
  2056. orientation: {
  2057. // 方向
  2058. heading: viewer.camera.heading,
  2059. // 视角
  2060. pitch: viewer.camera.pitch,
  2061. // 倾斜角度
  2062. roll: viewer.camera.roll,
  2063. },
  2064. });
  2065. debugger;
  2066. let result = await addBillboardModelList(data);
  2067. debugger;
  2068. if (result.code) {
  2069. that.$message({
  2070. message: "添加成功",
  2071. type: "success",
  2072. });
  2073. viewer.entities.removeAll();
  2074. // that.lyoption.cancel();
  2075. //添加截图提醒
  2076. debugger;
  2077. if (
  2078. that.billboardReview.isAddModel &&
  2079. that.lyoption.content.parent.jttx
  2080. ) {
  2081. that.lyoption.content.parent.jttx();
  2082. }
  2083. that.$layer.close(that.layerid);
  2084. }
  2085. // window.billboardModelList.push(that.billboardModel);
  2086. // this.$message({
  2087. // message: "添加成功",
  2088. // type: "success",
  2089. // });
  2090. },
  2091. //取消
  2092. cancle() {
  2093. this.removeModel();
  2094. this.$layer.close(this.layerid);
  2095. },
  2096. //清除
  2097. removeModel() {
  2098. if (this.handlerPoint)
  2099. this.handlerPoint.removeInputAction(
  2100. Cesium.ScreenSpaceEventType.LEFT_CLICK
  2101. );
  2102. modelList = [];
  2103. viewer.entities.removeAll();
  2104. },
  2105. },
  2106. components: { Image },
  2107. beforeDestroy() {
  2108. this.removeModel();
  2109. },
  2110. };
  2111. </script>
  2112. <style lang="scss">
  2113. @import "@/../../zt.scss";
  2114. </style>
  2115. <style lang="scss" scoped>
  2116. .hover_style:hover {
  2117. border: 1px solid rgba(15, 123, 200, 0.247);
  2118. background-color: rgba(15, 123, 200, 0.247);
  2119. }
  2120. .con-col {
  2121. border: 1px solid;
  2122. display: flex;
  2123. flex-flow: column nowrap;
  2124. justify-content: center;
  2125. align-items: center;
  2126. border-radius: 4px;
  2127. }
  2128. .imgdomf {
  2129. border: 1px solid rgba(15, 122, 200, 0.4);
  2130. padding: 4px;
  2131. }
  2132. .imgdom {
  2133. border: 1px solid rgba(15, 122, 200, 0.4);
  2134. margin: 4px;
  2135. padding: 2px;
  2136. }
  2137. .el-divider__text {
  2138. background-color: #11123bde;
  2139. color: #ffffff;
  2140. }
  2141. </style>