widget.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497
  1. <template>
  2. <div>
  3. <tf-page>
  4. <template v-slot:action>
  5. <tf-title>工程列表</tf-title>
  6. <el-row style="padding-bottom:10px;">
  7. <el-col :span="12">
  8. <el-row>
  9. <el-col></el-col>
  10. </el-row>
  11. <span></span>
  12. <span>工程名称</span>
  13. <pbs-tree :structures='structures' @changeProjectName="treeNodeClick" style="width:50%;display:inline-block;"></pbs-tree>
  14. <el-button type="primary" size="mini" @click="getPbsTree">查询</el-button>
  15. </el-col>
  16. <el-col :span="6" :offset="6">
  17. <el-button type="primary" size="mini" @click="publicService">数据发布</el-button>
  18. </el-col>
  19. </el-row>
  20. </template>
  21. <tf-table v-if="!isNewProj" highlight-current-row @current-change="selectChange" class="tabletree" :stripe='false' row-key="id" border style='width:100%' :data="tableData" :tree-props="{children:'children'}">
  22. <el-table-column prop="name" label="节点名称" width="400" :show-overflow-tooltip="true">
  23. </el-table-column>
  24. <el-table-column prop="code" label="PBS编码">
  25. </el-table-column>
  26. <el-table-column prop="levelname" label="类型">
  27. </el-table-column>
  28. <el-table-column prop="isPublish" label="发布状态">
  29. <template slot-scope="scope">
  30. <el-tag v-if="scope.row.isPublish==='1'" type="success">已发布</el-tag>
  31. <el-tag v-else type="danger">未发布</el-tag>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="" label="操作">
  35. <template slot-scope="scope">
  36. <div v-if="scope.row.levelname==='工程'||scope.row.levelname==='单项工程'||scope.row.levelname==='单位工程(CWP)'">
  37. <el-button class="tdbutton" size="mini" type="primary" @click="openNewNode(scope.row)">新建</el-button>
  38. </div>
  39. <div v-else-if="scope.row.levelname==='分部工程(专业)'">
  40. <el-button class="tdbutton" size="mini" type="success" @click="pipeDataImport(scope.row)">导入</el-button>
  41. <i class="el-icon-delete" style="color:red;margin-left:10px;" @click="deleteData(scope.row)"></i>
  42. </div>
  43. <div v-else>
  44. <el-button class="tdbutton" size="mini" type="primary" @click="openNewNode(scope.row)">新建</el-button>
  45. <i class="el-icon-delete" style="color:red;margin-left:10px;" @click="deleteData(scope.row)"></i>
  46. </div>
  47. </template>
  48. </el-table-column>
  49. </tf-table>
  50. <el-row v-else type="flex" justify="center" align="middle" style="height:100%;background:#fff;">
  51. <el-button type="primary" @click="addProjectNode">创建项目工程结构树</el-button>
  52. </el-row>
  53. </tf-page>
  54. <tf-dialog :visible.sync="newNodeDialogShow" title="新建下级节点" width="600px">
  55. <el-form :model="addNodeForm" label-width="140px">
  56. <el-form-item label="当前节点">
  57. <el-input v-model="addNodeForm.pName" disabled></el-input>
  58. </el-form-item>
  59. <el-form-item label="当前节点PBS编码">
  60. <el-input v-model="addNodeForm.pCode" disabled></el-input>
  61. </el-form-item>
  62. <el-form-item label="下级节点选择">
  63. <el-select @change="nextNodeChange()" v-model="addNodeForm.id" clearable style="width:100%">
  64. <el-option v-for="(item,index) in nodeOptions" :key="index" :label="item.name" :value="item.value">
  65. <span style="float: left">{{ item.name }}</span>
  66. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="下级节点PBS编码">
  71. <el-input v-model="addNodeForm.code" disabled></el-input>
  72. </el-form-item>
  73. </el-form>
  74. <div slot="footer" style="text-align:right;">
  75. <el-button type="primary" @click="addNodeSubmit()" size="small">提 交</el-button>
  76. <el-button @click="newNodeDialogShow = false" size="small">取 消</el-button>
  77. </div>
  78. </tf-dialog>
  79. <tf-dialog class="fullDialog" title="管线数据导入" max-width="100%" max-height="calc(100vh - 54px)" :fullscreen="true" :visible.sync="importDialogShow">
  80. <el-container style="height:100%;">
  81. <el-aside width="300px" style="overflow-x:hidden">
  82. <div>
  83. <tf-title>成果表选择</tf-title>
  84. <el-form ref='addForm' :model="impForm" size="mini">
  85. <el-form-item label="项目工程" prop="prjName" class="impForm" :rules="addRules">
  86. <!-- <pbs-tree @changeProjectName="treeNodeClick" style="width:100%;"></pbs-tree> -->
  87. <el-input type="textarea" :rows="3" v-model="impForm.prjName"></el-input>
  88. </el-form-item>
  89. <el-form-item label="数据阶段" prop="stage">
  90. <el-select v-model="impForm.stage" style="width:100%">
  91. <el-option label="设计" value="SJ"></el-option>
  92. <!-- <el-option label="普查" value="PC"></el-option>
  93. <el-option label="竣工" value="JG"></el-option> -->
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item label="成果表">
  97. <el-upload class="eluploadcontainer" action="none" :file-list="fileList" accept=".xls,.xlsx" multiple :limit="2" :before-remove="onBeforeRemove" :on-remove="onRemove" :on-change="onChange" :auto-upload="false" :on-exceed="onExceed">
  98. <el-button slot="trigger" size="small" type="text">本地文件</el-button>
  99. <el-button size="small" type="text" @click="OnlineAccess">在线获取</el-button>
  100. </el-upload>
  101. </el-form-item>
  102. <el-form-item>
  103. <el-row :gutter="20">
  104. <el-col :span="12">
  105. <el-button type="primary" size="small" style="width:100%">取消</el-button>
  106. </el-col>
  107. <el-col :span="12">
  108. <el-button type="primary" size="small" style="width:100%" @click="previewExcel">提交</el-button>
  109. </el-col>
  110. </el-row>
  111. </el-form-item>
  112. <!-- <el-form-item>
  113. <el-button type="primary" style="width:100%" @click="deleteData">删除数据</el-button>
  114. </el-form-item> -->
  115. </el-form>
  116. <tf-dialog title="在线获取数据成果" :visible.sync="dialogVisible" width="80%" top="3%">
  117. <el-form :inline="true" class="toolbar" size="mini">
  118. <el-form-item label="所属区域">
  119. <el-select v-model="areaName" filterable clearable placeholder="请选择" size="mini">
  120. <el-option v-for="item in prjOptions" :key="item.code" :label="item.name" :value="item.value">
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. <el-form-item label="项目">
  125. <el-select v-model="selectPrjId" filterable clearable placeholder="请选择" size="mini">
  126. <el-option v-for="item in optionsoffter" :key="item.key" :label="item.name" :value="item.value">
  127. </el-option>
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item>
  131. <el-input v-model="queryPara" clearable placeholder="支持数据名称,上传单位">
  132. <el-button type="primary" slot="append" size="mini" icon="el-icon-search" @click="getlist"></el-button>
  133. </el-input>
  134. <!-- <el-button type="primary" size="mini" icon="el-icon-search" @click="getlist"></el-button> -->
  135. </el-form-item>
  136. <el-form-item label="提交状态">
  137. <el-radio-group v-model="radio" @change="getlist">
  138. <el-radio label="">全部</el-radio>
  139. <el-radio label="1">未提交</el-radio>
  140. <el-radio label="0">已提交</el-radio>
  141. </el-radio-group>
  142. </el-form-item>
  143. <el-form-item>
  144. <el-radio-group v-model="radio2" @change="getlist">
  145. <el-radio label="">全部</el-radio>
  146. <el-radio label="2">设计</el-radio>
  147. <el-radio label="1">普查</el-radio>
  148. <el-radio label="3">竣工</el-radio>
  149. </el-radio-group>
  150. </el-form-item>
  151. </el-form>
  152. <!-- 弹出框表单 -->
  153. <div class="content-body" style="height:410px;">
  154. <tf-table @page-change="onPageChange" :data="onlineRecords" :pagination="pagination">
  155. <template slot="empty">
  156. <img src="@/assets/icon/null.png" alt="暂无数据" />
  157. </template>
  158. <el-table-column prop="id" label="ID" width="100"></el-table-column>
  159. <el-table-column prop="areaName" label="所属区域"></el-table-column>
  160. <el-table-column prop="fullName" label="项目"></el-table-column>
  161. <el-table-column prop="division" label="片区"></el-table-column>
  162. <el-table-column prop="batchName" label="数据名称" :show-overflow-tooltip="true"></el-table-column>
  163. <el-table-column prop="dataSource" label="数据阶段"></el-table-column>
  164. <el-table-column prop="submitStatus" label="提交状态"></el-table-column>
  165. <el-table-column prop="detectionUnit" label="上传单位" :show-overflow-tooltip="true"></el-table-column>
  166. <el-table-column prop="updateTime" label="上传时间" width="150px"></el-table-column>
  167. <el-table-column label="下载" width="50">
  168. <template slot-scope="scope">
  169. <el-button type="text" icon="el-icon-download" @click="downLoadFile(scope.row)"></el-button>
  170. </template>
  171. </el-table-column>
  172. </tf-table>
  173. </div>
  174. <!-- <div class="content-footer">
  175. <el-pagination class="pagination" @size-change="onPageChange" @current-change="onPageChange" :current-page="pagination.current" :page-sizes="pageSizes" :page-size="pagination.size" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
  176. </div> -->
  177. </tf-dialog>
  178. </div>
  179. </el-aside>
  180. <el-main class="impotMain">
  181. <el-tabs class="pipetable">
  182. <el-tab-pane label="表格">
  183. <el-row>
  184. <el-col :span="8">源数据情况:{{importInfo}}</el-col>
  185. <el-col :span="8">预览情况:{{priviewInfo}}</el-col>
  186. <el-col :span="8">
  187. <el-button type="primary" size="small" @click="buildDatasets">预览</el-button>
  188. <el-button type="primary" size="small" @click="zsbuildDatasets">提交</el-button>
  189. </el-col>
  190. </el-row>
  191. <el-tabs>
  192. <el-tab-pane label="点表">
  193. <tf-table :columns="impForm.pointColumns" :data="impForm.pointData"></tf-table>
  194. </el-tab-pane>
  195. <el-tab-pane label="线表">
  196. <tf-table :columns="impForm.lineColumns" :data="impForm.lineData"></tf-table>
  197. </el-tab-pane>
  198. </el-tabs>
  199. </el-tab-pane>
  200. <el-tab-pane label="地图">
  201. <div id="viewer" class="cesium_container"></div>
  202. </el-tab-pane>
  203. </el-tabs>
  204. </el-main>
  205. </el-container>
  206. <div slot="footer">
  207. </div>
  208. </tf-dialog>
  209. <tf-dialog title="服务发布" width="600px" :visible.sync="isPublicDialogShow">
  210. <el-checkbox-group v-model="publicConfig">
  211. <el-checkbox label="重建三维网络"></el-checkbox>
  212. <el-checkbox label="发布地图服务" :disabled="true"></el-checkbox>
  213. <el-checkbox label="更新发布标识" :disabled="!listSelect"></el-checkbox>
  214. </el-checkbox-group>
  215. <div slot='footer' style="text-align:right;">
  216. <el-button type="primary" size="small" @click="submitPublicService">确 定</el-button>
  217. <el-button size="small" @click="isPublicDialogShow=false">取 消</el-button>
  218. </div>
  219. </tf-dialog>
  220. </div>
  221. </template>
  222. <script lang='ts'>
  223. declare global {
  224. interface Window {
  225. impViewer: any
  226. }
  227. }
  228. declare let Cesium
  229. /**
  230. *@description 该功能为管网数据在线入库
  231. *@author lishun <876330731@qq.com>
  232. */
  233. import { Vue, Prop, Watch, Component } from 'vue-property-decorator'
  234. import request, { IP } from '@/utils/request'
  235. import { getDefaultPagination } from '@/utils/constant'
  236. import {
  237. pbsTreeListwithPublish,
  238. getStructureDetailByID,
  239. getPbsLevelByID,
  240. getPbsLevelPage,
  241. getBoinfoPage,
  242. getPbsCodeDetailPage,
  243. addStrctureNode
  244. } from '@/api/APIs'
  245. import { pageSizes } from '@/utils/constant'
  246. import { IPagination } from '@/api/common'
  247. import PbsTree from '../DataImport/components/PbsTree.vue'
  248. import BaseConfig from '@/config/configure'
  249. @Component({
  250. name: 'PipeOnlineImprt',
  251. components: { PbsTree }
  252. })
  253. export default class PipeOnlineImprt extends Vue {
  254. impForm = {
  255. id: null, //pbs结构id
  256. prjName: '',
  257. stage: 'SJ',
  258. paperName: '',
  259. paperUnit: '',
  260. paperPerson: '',
  261. origin: '',
  262. pointColumns: [],
  263. lineColumns: [],
  264. pointData: [],
  265. lineData: []
  266. }
  267. /**是否创建新项目 */
  268. isNewProj=false
  269. /**服务发布对话框 */
  270. isPublicDialogShow = false
  271. /**发布服务选项 */
  272. publicConfig = []
  273. /**新建下级节点弹框显隐 */
  274. newNodeDialogShow = false
  275. /**导入弹框显隐控制 */
  276. importDialogShow = false
  277. /**下级节点列表 */
  278. nodeOptions = []
  279. /**下级节点连接符 */
  280. connector = ''
  281. tableData = []
  282. pageSizes = pageSizes
  283. addNodeForm = {
  284. pid: '',
  285. pName: '',
  286. pCode: '',
  287. id: '',
  288. code: '',
  289. name: ''
  290. }
  291. /**表格树勾选项 */
  292. listSelect = null
  293. addRules = {
  294. prjName: [{ required: true, message: '请选择单位工程', trigger: 'blur' }],
  295. stage: [{ required: true, message: '请选择数据阶段', trigger: 'change' }],
  296. paperName: [{ required: true, message: '请输入图纸名称', trigger: 'blur' }],
  297. paperUnit: [{ required: true, message: '请输入图纸提供单位', trigger: 'blur' }],
  298. paperPerson: [{ required: true, message: '请输入图纸提供人', trigger: 'blur' }]
  299. }
  300. importInfo = ''
  301. priviewInfo = ''
  302. /**
  303. * 搜索PBS结构树层级ID
  304. */
  305. searchStructureId = null
  306. /**
  307. 在线获取弹窗开关
  308. */
  309. dialogVisible = false
  310. radio = ''
  311. radio2 = ''
  312. areaName = ''
  313. selectPrjId = ''
  314. queryPara = ''
  315. prjOptions = []
  316. optionsoffter = [{ name: '全部', value: '', key: '2' }]
  317. pagination: IPagination = getDefaultPagination()
  318. tableColumns = [
  319. {
  320. prop: 'id',
  321. label: 'ID'
  322. },
  323. {
  324. prop: 'areaName',
  325. label: '所属区域'
  326. },
  327. {
  328. prop: 'fullName',
  329. label: '项目'
  330. },
  331. {
  332. prop: 'division',
  333. label: '片区'
  334. },
  335. {
  336. prop: 'batchName',
  337. label: '数据名称',
  338. showOverflowTooltip: true
  339. },
  340. {
  341. prop: 'dataSource',
  342. label: '数据阶段'
  343. },
  344. {
  345. prop: 'submitStatus',
  346. label: '提交状态'
  347. },
  348. {
  349. prop: 'detectionUnit',
  350. label: '上传单位',
  351. showOverflowTooltip: true
  352. },
  353. {
  354. prop: 'proName',
  355. label: '上传人'
  356. },
  357. {
  358. prop: 'updateTime',
  359. label: '上传时间',
  360. minWidth: '150px'
  361. },
  362. {
  363. slot: 'DownloadBtn',
  364. width: '50px'
  365. }
  366. ]
  367. /**
  368. * 在线文件列表数据
  369. */
  370. onlineRecords = []
  371. /**树结构 */
  372. structures = []
  373. /**
  374. * 上传文件
  375. */
  376. fileList = []
  377. /**
  378. * 最终提交的上传文件
  379. */
  380. files = []
  381. mapService = ['img', 'theme', 'temp']
  382. baseScene = 'scenes'
  383. baseTerrain = 'terrain'
  384. terrain = 'dixing'
  385. baselayer = []
  386. scenesIndex = 0
  387. get AppX() {
  388. return this.$store.getters.AppX
  389. }
  390. uploadSuccess() {
  391. this.$message.success('文件上传成功')
  392. }
  393. onBeforeRemove(file, fileList) {
  394. return this.$confirm(`确定移除${file.name}?`)
  395. }
  396. onRemove(file, fileList) {
  397. this.fileList = fileList
  398. }
  399. onCheckFile(file) {
  400. let fileName = file.name
  401. let esuffixt = fileName.substr(fileName.lastIndexOf('.') + 1)
  402. const isIMAGE = esuffixt === 'xls' || esuffixt === 'xlsx'
  403. //const isLt1M = file.size / 1024 / 1024 < 10
  404. if (!isIMAGE) {
  405. this.$message.error('上传文件只能是excel文件!')
  406. }
  407. // if (!isLt1M) {
  408. // this.$message.error('上传文件大小不能超过 10MB!')
  409. // }
  410. return isIMAGE
  411. }
  412. onChange(file, fileList) {
  413. const isLoad = this.onCheckFile(file.raw)
  414. if (isLoad) {
  415. this.fileMap(fileList)
  416. } else {
  417. fileList.pop()
  418. }
  419. }
  420. fileMap(fileList) {
  421. if (fileList.length !== 0) {
  422. const files = fileList.map((v) => {
  423. return v.raw
  424. })
  425. this.files = files
  426. }
  427. }
  428. mounted() {
  429. this.getPbsTree()
  430. }
  431. /**未过滤发布状态的 */
  432. getPbsTree() {
  433. const params = { structDetailId: this.searchStructureId }
  434. pbsTreeListwithPublish(params).then((res) => {
  435. const { code, result } = res
  436. if (code === 1) {
  437. function formatTree(obj) {
  438. const copyedObj = JSON.parse(JSON.stringify(obj)) // 深拷贝源数据
  439. return copyedObj.filter((parent) => {
  440. const findChildren = copyedObj.filter((child) => parent.id === child.pid)
  441. findChildren.length > 0 ? (parent.children = findChildren) : (parent.children = [])
  442. return parent.pid === null // 返回顶层,依据实际情况判断这里的返回值
  443. })
  444. }
  445. if (result[0]) {
  446. this.structures = result[0].structures
  447. let data = formatTree(result[0].structures)
  448. this.tableData = data
  449. }else{
  450. this.isNewProj=true;
  451. }
  452. } else {
  453. this.$message.error('信息获取失败')
  454. }
  455. })
  456. }
  457. onExceed(files, fileList) {
  458. this.$message.warning(
  459. `当前限制选择 2 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
  460. )
  461. }
  462. treeNodeClick(info) {
  463. if (!info) return
  464. this.searchStructureId = info.id
  465. }
  466. /**
  467. * 该方法用于新建节点
  468. */
  469. openNewNode(row) {
  470. this.addNodeForm.id = ''
  471. this.addNodeForm.code = ''
  472. this.newNodeDialogShow = true
  473. this.addNodeForm.pName = row.name
  474. this.addNodeForm.pCode = row.code
  475. this.addNodeForm.pid = row.id
  476. getStructureDetailByID({ id: row.id }).then((result) => {
  477. //获取PBSlevel id
  478. if (result.code === 1) {
  479. getPbsLevelByID({ id: result.result.pbslevelId }).then((pbslevel) => {
  480. //获取pbslevel信息
  481. if (pbslevel.code === 1) {
  482. this.connector = pbslevel.result.connector ? pbslevel.result.connector : ''
  483. //获取下级PBSlevel信息
  484. getPbsLevelPage({ alevel: pbslevel.result.alevel + 1, pbsId: pbslevel.result.pbsId }).then(
  485. (nextPbslevel) => {
  486. if (nextPbslevel.code === 1 && nextPbslevel.result.records.length === 1) {
  487. //获取层级对应的业务对象
  488. getPbsCodeDetailPage({ pbslevelId: nextPbslevel.result.records[0].id }).then((codeDetail) => {
  489. if (codeDetail.code === 1 && codeDetail.result.records.length === 1) {
  490. getBoinfoPage({
  491. boId: codeDetail.result.records[0].boId,
  492. size: 100,
  493. 'orders[0].column': 'code',
  494. 'orders[0].asc': true
  495. }).then((boinfos) => {
  496. if (boinfos.code === 1) {
  497. const list = boinfos.result.records.map((item) => {
  498. return { name: item.name, value: item.code }
  499. })
  500. this.nodeOptions = list
  501. }
  502. })
  503. }
  504. })
  505. }
  506. }
  507. )
  508. }
  509. })
  510. }
  511. })
  512. }
  513. /**该方法用于提交新建节点信息 */
  514. addNodeSubmit() {
  515. const data = {
  516. pid: this.addNodeForm.pid,
  517. code: this.addNodeForm.code,
  518. name: this.addNodeForm.name,
  519. prjId: this.$store.state.project.project.currentPrj
  520. }
  521. addStrctureNode(data)
  522. .then((result) => {
  523. if (result.code === -1) {
  524. this.$message.error('添加失败')
  525. return
  526. }
  527. this.$message.success('添加成功')
  528. this.newNodeDialogShow = false
  529. this.getPbsTree()
  530. })
  531. .catch((err) => {
  532. console.error(err)
  533. })
  534. }
  535. /**下级节点选择器选中事件 */
  536. nextNodeChange() {
  537. const node = this.nodeOptions.find((item) => {
  538. return item.value === this.addNodeForm.id
  539. })
  540. this.addNodeForm.code = this.addNodeForm.pCode + this.connector + node.value
  541. this.addNodeForm.name = node.name
  542. }
  543. /**添加项目 */
  544. addProjectNode() {
  545. const { pbsModel } = this.$store.state.project.project
  546. if (!pbsModel) {
  547. this.$message.warning('项目未绑定PBS模板')
  548. return
  549. }
  550. getPbsLevelPage({ pbsId: pbsModel, alevel: 1 }).then((pbslevel) => {
  551. if (pbslevel.code == 1 && pbslevel.result.records.length > 0) {
  552. const levelId = pbslevel.result.records[0].id
  553. //获取层级对应的业务对象
  554. getPbsCodeDetailPage({ pbslevelId: levelId }).then((codeDetail) => {
  555. if (codeDetail.code === 1 && codeDetail.result.records.length === 1) {
  556. getBoinfoPage({
  557. boId: codeDetail.result.records[0].boId,
  558. size: 100,
  559. 'orders[0].column': 'code',
  560. 'orders[0].asc': true
  561. }).then((boinfos) => {
  562. if (boinfos.code === 1) {
  563. const list = boinfos.result.records.map((item) => {
  564. return { name: item.name, value: item.code }
  565. })
  566. if(list.length===0){
  567. this.$message.warning('未创建工程业务对象');
  568. return;
  569. }
  570. const proj=list[0]
  571. const data = {
  572. pid: null,
  573. code: proj.value,
  574. name: proj.name,
  575. prjId: this.$store.state.project.project.id
  576. }
  577. addStrctureNode(data)
  578. .then((result) => {
  579. if (result.code === -1) {
  580. this.$message.error('添加失败')
  581. return
  582. }
  583. this.$message.success('添加成功')
  584. this.getPbsTree()
  585. })
  586. .catch((err) => {
  587. console.error(err)
  588. })
  589. }
  590. })
  591. }
  592. })
  593. }
  594. })
  595. }
  596. /**导入按钮点击事件 */
  597. pipeDataImport(row) {
  598. this.impForm.id = row.id
  599. getStructureDetailByID({ id: row.pid })
  600. .then((result) => {
  601. this.impForm.prjName = result.result.name + '-' + row.name
  602. })
  603. .catch((err) => {
  604. console.log(err)
  605. })
  606. this.importDialogShow = true
  607. this.fileList = []
  608. this.impForm.pointColumns = []
  609. this.impForm.lineColumns = []
  610. this.impForm.pointData = []
  611. this.impForm.lineData = []
  612. this.importInfo = ''
  613. this.priviewInfo = ''
  614. this.$nextTick(() => {
  615. this.addToMap()
  616. })
  617. }
  618. /**
  619. 导入excel表,创建二三维数据集
  620. */
  621. buildDatasets() {
  622. if (this.files.length === 0) {
  623. this.$message.warning('请上传管网数据表')
  624. return
  625. }
  626. if (!this.impForm.id) {
  627. this.$message.warning('请选择导入层级')
  628. return
  629. }
  630. const loading = this.$loading({
  631. text: '后台处理中',
  632. lock: true,
  633. spinner: 'el-icon-loading',
  634. background: 'rgba(0, 0, 0, 0.7)'
  635. })
  636. const formdata = new FormData()
  637. this.files.forEach((item) => {
  638. formdata.append('files', item)
  639. })
  640. formdata.append('importType', '0')
  641. formdata.append('id', '' + this.impForm.id)
  642. formdata.append('wkid', '4546')
  643. request({
  644. url: '/tofly-lzd-data/data/import/' + this.impForm.id,
  645. method: 'post',
  646. data: formdata
  647. })
  648. .then((result) => {
  649. if (result.code === 1) {
  650. this.$message.success('临时库数据集生成成功')
  651. this.priviewInfo = '管点:' + result.result['管点数量'] + ',管线' + result.result['管线数量'] + '条'
  652. //this.buildNetwork()
  653. }
  654. })
  655. .catch((err) => {
  656. this.$message.error('临时数据集生成失败')
  657. console.log(err)
  658. })
  659. .finally(() => {
  660. loading.close()
  661. })
  662. }
  663. /**
  664. * 该方法用于预览excel表格数据
  665. */
  666. previewExcel() {
  667. if (this.files.length === 0) {
  668. this.$message.warning('请上传管网数据表')
  669. return
  670. }
  671. if (!this.impForm.id) {
  672. this.$message.warning('请选择导入层级')
  673. return
  674. }
  675. const loading = this.$loading({
  676. text: '后台处理中',
  677. lock: true,
  678. spinner: 'el-icon-loading',
  679. background: 'rgba(0, 0, 0, 0.7)'
  680. })
  681. const id = this.impForm.id
  682. const formdata = new FormData()
  683. this.files.forEach((item) => {
  684. formdata.append('files', item)
  685. })
  686. formdata.append('id', id)
  687. request({
  688. url: '/tofly-lzd-data/data/previewImportData/' + id,
  689. method: 'post',
  690. data: formdata
  691. })
  692. .then((result) => {
  693. if (result.code === 1) {
  694. this.$message.success('excel预览成功')
  695. //点表
  696. this.importInfo = '导入管点0个'
  697. if (result.result['点表'].length > 0) {
  698. const pointcolumns = Object.getOwnPropertyNames(result.result['点表'][0]).map((item) => {
  699. return { prop: item, label: item, showOverflowTooltip: true }
  700. })
  701. this.impForm.pointColumns = pointcolumns
  702. this.impForm.pointData = result.result['点表']
  703. this.importInfo = '导入管点' + result.result['点表'].length + '个'
  704. }
  705. //线表
  706. let lineinfo = ',管线0条'
  707. if (result.result['线表'].length > 0) {
  708. const linecolumns = Object.getOwnPropertyNames(result.result['线表'][0]).map((item) => {
  709. return { prop: item, label: item, showOverflowTooltip: true }
  710. })
  711. this.impForm.lineColumns = linecolumns
  712. this.impForm.lineData = result.result['线表']
  713. lineinfo = ',管线' + result.result['线表'].length + '条'
  714. }
  715. this.importInfo += lineinfo
  716. }
  717. })
  718. .catch((err) => {
  719. this.$message.error('导入excel出错')
  720. console.log(err)
  721. })
  722. .finally(() => {
  723. loading.close()
  724. })
  725. }
  726. /**
  727. 导入excel表,创建二三维数据集【正式库】
  728. */
  729. zsbuildDatasets() {
  730. if (this.files.length === 0) {
  731. this.$message.warning('请上传管网数据表')
  732. return
  733. }
  734. if (!this.impForm.id) {
  735. this.$message.warning('请选择导入层级')
  736. return
  737. }
  738. const loading = this.$loading({
  739. text: '后台处理中',
  740. lock: true,
  741. spinner: 'el-icon-loading',
  742. background: 'rgba(0, 0, 0, 0.7)'
  743. })
  744. const formdata = new FormData()
  745. this.files.forEach((item) => {
  746. formdata.append('files', item)
  747. })
  748. formdata.append('importType', '1')
  749. formdata.append('id', '' + this.impForm.id)
  750. formdata.append('wkid', '4546')
  751. request({
  752. url: '/tofly-lzd-data/data/import/' + this.impForm.id,
  753. method: 'POST',
  754. data: formdata
  755. })
  756. .then((result) => {
  757. this.$message.success('正式库数据集生成成功')
  758. //this.buildNetwork()
  759. })
  760. .catch((err) => {
  761. this.$message.error('正式库数据集生成失败')
  762. console.log(err)
  763. })
  764. .finally(() => {
  765. loading.close()
  766. })
  767. }
  768. /**
  769. 重建三维网络【临时库】
  770. */
  771. buildNetwork() {
  772. request({
  773. url: '/tofly-lzd-data/data/createNetwork?importType=0',
  774. method: 'POST'
  775. })
  776. .then((result) => {
  777. if (result.code === 1) {
  778. this.$message.success('三维网络生成成功')
  779. //this.buildModelTiles()
  780. }
  781. })
  782. .catch((err) => {
  783. this.$message.error('三维网络生成失败')
  784. console.log(err)
  785. })
  786. }
  787. /**
  788. 重建三维网络【正式库】
  789. */
  790. zsbuildNetwork() {
  791. request({
  792. url: '/tofly-lzd-data/data/createNetwork?importType=1',
  793. method: 'POST'
  794. })
  795. .then((result) => {
  796. if (result.code === 1) {
  797. this.$message.success('三维网络生成成功')
  798. this.zsbuildModelTiles()
  799. }
  800. })
  801. .catch((err) => {
  802. this.$message.error('三维网络生成失败')
  803. console.log(err)
  804. })
  805. }
  806. /**
  807. 制作场景缓存【临时库】
  808. */
  809. buildModelTiles() {
  810. request({
  811. url: '/tofly-lzd-data/data/modelSlice3d?importType=0',
  812. method: 'POST'
  813. })
  814. .then((result) => {
  815. if (result.code === 1) {
  816. this.$message.success('场景缓存生成成功')
  817. this.publishService()
  818. }
  819. })
  820. .catch((err) => {
  821. this.$message.error('场景缓存生成失败')
  822. console.log(err)
  823. })
  824. }
  825. /**
  826. 制作场景缓存【正式库】
  827. */
  828. zsbuildModelTiles() {
  829. request({
  830. url: '/tofly-lzd-data/data/modelSlice3d?importType=1',
  831. method: 'POST'
  832. })
  833. .then((result) => {
  834. if (result.code === 1) {
  835. this.$message.success('场景缓存生成成功')
  836. this.zspublishService()
  837. }
  838. })
  839. .catch((err) => {
  840. this.$message.error('场景缓存生成失败')
  841. console.log(err)
  842. })
  843. }
  844. /**
  845. 发布服务【临时库】
  846. */
  847. publishService() {
  848. request({
  849. url: '/tofly-lzd-data/data/publishService?importType=0',
  850. method: 'POST'
  851. })
  852. .then((result) => {
  853. if (result.code === 1) {
  854. this.$message.success('服务发布成功')
  855. this.addScene(result.result + '/realspace').then((layers) => {
  856. this.$message.success('三维管线模型加载完成')
  857. })
  858. }
  859. })
  860. .catch((err) => {
  861. this.$message.error('服务发布失败')
  862. console.log(err)
  863. })
  864. }
  865. /**
  866. 发布服务
  867. */
  868. zspublishService() {
  869. request({
  870. url: '/tofly-lzd-data/data/publishService?importType=1',
  871. method: 'POST'
  872. })
  873. .then((result) => {
  874. if (result.code === 1) {
  875. this.$message.success('服务发布成功')
  876. this.addScene(result.result + '/realspace').then((layers) => {
  877. this.$message.success('三维管线模型加载完成')
  878. })
  879. }
  880. })
  881. .catch((err) => {
  882. this.$message.error('服务发布失败')
  883. console.log(err)
  884. })
  885. }
  886. /**更新发布标识 */
  887. updatePubcliSign(id) {
  888. request({
  889. url: `/tofly-lzd-data/data/updateStatus/${id}`,
  890. method: 'get',
  891. params: { id }
  892. })
  893. .then((result) => {
  894. if (result.code === -1) {
  895. this.$message.error('更新发布标识失败')
  896. return
  897. }
  898. this.$message.success('更新发布标识成功')
  899. this.getPbsTree()
  900. })
  901. .catch((err) => {
  902. console.log(err)
  903. })
  904. }
  905. addScene(url) {
  906. //@ts-ignore
  907. const viewer = window.impViewer
  908. return viewer.scene.open(url, undefined, {
  909. autoSetView: false
  910. })
  911. }
  912. /**
  913. * 根据工程id删除数据
  914. */
  915. deleteData(row) {
  916. const id = row.id
  917. this.$confirm('是否删除该节点')
  918. .then(() => {
  919. const loading = this.$loading({
  920. text: '后台处理中',
  921. lock: true,
  922. spinner: 'el-icon-loading',
  923. background: 'rgba(0, 0, 0, 0.7)'
  924. })
  925. request({
  926. url: '/tofly-lzd-data/data/deleteData/' + id + '?importType=1&id=' + id,
  927. method: 'POST'
  928. })
  929. .then((result) => {
  930. if (result.code === 1) {
  931. this.$message.success('数据删除成功')
  932. this.getPbsTree()
  933. }
  934. })
  935. .catch((err) => {
  936. this.$message.error('数据删除失败')
  937. console.log(err)
  938. })
  939. .finally(() => {
  940. loading.close()
  941. })
  942. })
  943. .catch(() => {
  944. this.$message.info('取消删除')
  945. })
  946. }
  947. OnlineAccess() {
  948. this.dialogVisible = true
  949. this.getlist()
  950. this.getAreaInfo()
  951. // const obj = await this.$PortApi.getAreaInfo_api();//公司名称
  952. // this.prjOptions = obj.data.result;
  953. // console.log(this.prjOptions, '公司名称');
  954. }
  955. /**
  956. * 在线获取-项目公司列表信息
  957. */
  958. getAreaInfo() {
  959. request({
  960. url: '/tofly-sxgk/outpiper/getAreaInfo',
  961. method: 'GET',
  962. params: {}
  963. }).then((result) => {
  964. if (result.code !== 1) {
  965. return
  966. }
  967. const list = [{ name: '全部', value: '' }]
  968. result.result.forEach((item) => {
  969. list.push({ name: item.name, value: item.name })
  970. })
  971. this.prjOptions = list
  972. })
  973. }
  974. onPageChange(pagination) {
  975. this.pagination = { ...this.pagination, ...pagination }
  976. this.getlist()
  977. }
  978. /**
  979. * 在线获取- 文件下载
  980. */
  981. downLoadFile(row) {
  982. let filename = row.files[0].fileSourceName
  983. let fileurl
  984. if (row.files[0].localFileUrl != null) {
  985. fileurl = row.files[0].localFileUrl
  986. let url =
  987. IP +
  988. '/base/file/downloadFile?remotePath=' +
  989. fileurl +
  990. '&fileName=' +
  991. filename +
  992. '&access_token=' +
  993. this.$store.getters.token
  994. window.open(url, '_parent')
  995. } else {
  996. let id = row.files[0].id.toString()
  997. request({
  998. url: '/tofly-sxgk/pipepr/downloadRemote',
  999. method: 'GET',
  1000. params: { fileIdsStr: id }
  1001. }).then((result) => {
  1002. if (result.code !== 1) return
  1003. if (result) {
  1004. fileurl = result.result[0].url
  1005. let url =
  1006. IP +
  1007. '/base/file/downloadFile?remotePath=' +
  1008. fileurl +
  1009. '&fileName=' +
  1010. filename +
  1011. '&access_token=' +
  1012. this.$store.getters.token
  1013. window.open(url, '_parent')
  1014. }
  1015. })
  1016. }
  1017. }
  1018. /**
  1019. * 获取图纸在线表单
  1020. */
  1021. getlist() {
  1022. let params = {
  1023. submitStatus: this.radio,
  1024. areaName: this.areaName,
  1025. proName: '',
  1026. queryPara: this.queryPara,
  1027. dataSource: this.radio2,
  1028. current: this.pagination.current,
  1029. size: this.pagination.size
  1030. }
  1031. request({
  1032. method: 'get',
  1033. url: '/tofly-sxgk/outpiper/page',
  1034. params: params
  1035. }).then((res) => {
  1036. // pagesizes: [10, 25, 50, 100],
  1037. // pagesize: 10,
  1038. // currentPage: 1,
  1039. // totalNum: 0,
  1040. const { records, size, total, current } = res.result
  1041. //this.onlineRecords = records
  1042. this.pagination.size = size
  1043. this.pagination.current = current
  1044. this.pagination.total = total
  1045. let obj = {
  1046. 2: '设计',
  1047. 1: '普查',
  1048. 3: '竣工'
  1049. }
  1050. const status = {
  1051. 0: '已提交',
  1052. 1: '未提交'
  1053. }
  1054. this.onlineRecords = records.map((item) => {
  1055. Object.keys(item).forEach((val) => (item[val] = item[val] || '暂无'))
  1056. return {
  1057. ...item,
  1058. dataSource: obj[item.dataSource],
  1059. submitStatus: status[item.submitStatus]
  1060. }
  1061. })
  1062. })
  1063. }
  1064. /**
  1065. * 加载地图
  1066. */
  1067. addToMap() {
  1068. var configItem = this.AppX.appConfig.gisResource[this.baseTerrain]
  1069. var url = configItem.config[this.terrain].url
  1070. var layerTitle = configItem.config[this.terrain].name
  1071. // var url =
  1072. // "https://yeepms.yeec.com.cn/iserver/services/3D-sxgk_dem/rest/realspace/datas/TF_PAPN_DEM@sxgk_base";
  1073. // var layerTitle = "dixing";
  1074. var viewer = new Cesium.Viewer('viewer', {
  1075. terrainProvider: new Cesium.CesiumTerrainProvider({
  1076. url: url,
  1077. requestWaterMask: true,
  1078. requestVertexNormals: true,
  1079. credit: layerTitle,
  1080. isSct: true
  1081. }),
  1082. navigation: true,
  1083. contextOptions: {
  1084. webgl: {
  1085. alpha: false,
  1086. depth: true,
  1087. stencil: true,
  1088. antialias: true,
  1089. premultipliedAlpha: true,
  1090. preserveDrawingBuffer: true, //通过canvas.toDataURL()实现截图需要将该项设置为true
  1091. failIfMajorPerformanceCaveat: false
  1092. },
  1093. allowTextureFilterAnisotropic: true
  1094. },
  1095. timeline: false,
  1096. animation: false,
  1097. infoBox: false,
  1098. selectionIndicator: false //设置绿色框框不可见
  1099. })
  1100. //this.$store.state.cesiumMap.mapContainerId = 'cesiumContainer'
  1101. window.impViewer = viewer
  1102. viewer._cesiumWidget._creditContainer.style.display = 'none' //去掉logo
  1103. //this.isInit = true
  1104. //this.panels.viewer = window.impViewer = viewer;
  1105. //this.$store.commit('viewer',viewer)
  1106. // const viewerInit = new ViewerInitEvent(viewer);
  1107. // viewerInit.init();
  1108. this.initCesiumStatus()
  1109. //viewer.scene.logarithmicDepthBuffer = false;
  1110. //高动态范围渲染
  1111. //viewer.scene.highDynamicRange = false;
  1112. this.initTianditu()
  1113. this.initBaseMap()
  1114. const initPosition = this.AppX.appConfig.initPosition
  1115. const carto = Cesium.Cartographic.fromDegrees(
  1116. parseFloat(initPosition.lon),
  1117. parseFloat(initPosition.lat),
  1118. parseFloat(initPosition.height)
  1119. )
  1120. const cartes3 = Cesium.Cartographic.toCartesian(carto)
  1121. // const cartes3 = new Cesium.Cartesian3(
  1122. // -2204482.2366905585,
  1123. // 5150077.372278957,
  1124. // 3152769.164041396
  1125. // );
  1126. const camera = cartes3
  1127. viewer.camera.setView({
  1128. destination: new Cesium.Cartesian3(camera.x, camera.y, camera.z),
  1129. orientation: {
  1130. heading: 0,
  1131. pitch: Cesium.Math.toRadians(-90),
  1132. roll: 0
  1133. }
  1134. })
  1135. this.$emit('afterMapLoad')
  1136. setTimeout(
  1137. function () {
  1138. //this.addInitScene()
  1139. }.bind(this),
  1140. 5000
  1141. )
  1142. }
  1143. /**初始化基础底图*/
  1144. initBaseMap() {
  1145. this.baseMapConfig()
  1146. let layerInfo = this.baselayer
  1147. layerInfo.forEach((item) => {
  1148. if (item.show) {
  1149. const gisItem = this.AppX.appConfig.gisResource[item.type].config[item.name]
  1150. if (!gisItem) {
  1151. return true
  1152. }
  1153. const url = gisItem.url
  1154. if (this.mapService.indexOf(item.type) > -1) {
  1155. window.impViewer.imageryLayers.addImageryProvider(
  1156. new Cesium.SuperMapImageryProvider({
  1157. url: url,
  1158. credit: item.name
  1159. })
  1160. )
  1161. } else if ((item.type = 'mvt')) {
  1162. window.impViewer.scene.addVectorTilesMap({
  1163. url: url,
  1164. name: item.name
  1165. })
  1166. }
  1167. }
  1168. })
  1169. // window.impViewer.imageryLayers.addImageryProvider(
  1170. // new Cesium.SuperMapImageryProvider({
  1171. // url: "https://yeepms.yeec.com.cn/iserver/services/map-sxgk/rest/maps/hnyy_type",
  1172. // credit: "typetheme",
  1173. // })
  1174. // );
  1175. }
  1176. /**
  1177. * 地图服务配置
  1178. */
  1179. baseMapConfig() {
  1180. const source = this.AppX.appConfig.gisResource
  1181. const mapList = this.mapService
  1182. const baseLayer = []
  1183. for (let name in source) {
  1184. if (mapList.indexOf(name) > -1) {
  1185. const config = source[name].config
  1186. for (let key in config) {
  1187. const item = config[key]
  1188. baseLayer.push({
  1189. name: key,
  1190. type: name,
  1191. show: item.isDisplay === '0' ? false : true
  1192. })
  1193. }
  1194. // for (let i = 0; i < config.length; i++) {
  1195. // const item = config[i];
  1196. // baseLayer.push({
  1197. // name: item.key,
  1198. // type: name,
  1199. // show: item.isDisplay === "0" ? false : true,
  1200. // });
  1201. // }
  1202. }
  1203. }
  1204. this.baselayer = baseLayer
  1205. }
  1206. /**
  1207. * 加载初始化场景
  1208. */
  1209. addInitScene() {
  1210. var scenes = this.AppX.appConfig.gisResource[this.baseScene]
  1211. if (scenes && scenes.config) {
  1212. this.scenesIndex = 0
  1213. Object.keys(scenes.config).forEach(
  1214. function (keyName, index) {
  1215. const item = scenes.config[keyName]
  1216. var promise = window.impViewer.scene.open(item.url, undefined, {
  1217. autoSetView: false
  1218. })
  1219. Cesium.when(
  1220. promise,
  1221. function (layers) {
  1222. this.scenesIndex += 1
  1223. for (var i = 0; i < layers.length; i++) {
  1224. var ly = layers[i]
  1225. ly.selectEnabled = false
  1226. ly.clearMemoryImmediately = false
  1227. ly.cullEnabled = false
  1228. //ly.lodRangeScale=0.01
  1229. var model = BaseConfig.layers[ly.name]
  1230. if (BaseConfig.sjpipeLayers.indexOf(ly.name) > -1) {
  1231. let style3d = new Cesium.Style3D()
  1232. style3d.altitudeMode = 0
  1233. style3d.bottomAltitude = 0 - this.AppX.appConfig.downDepth
  1234. ly.style3D = style3d
  1235. //ly.visibleDistanceMax=800;
  1236. ly.maxVisibleAltitude = BaseConfig.pipeMaxVisibel
  1237. }
  1238. //普查管线初始隐藏
  1239. if (BaseConfig.pcpipeLayers.indexOf(ly.name) > -1) {
  1240. let style3d = new Cesium.Style3D()
  1241. style3d.altitudeMode = 0
  1242. style3d.bottomAltitude = 0 - this.AppX.appConfig.downDepth
  1243. ly.style3D = style3d
  1244. ly.visible = false
  1245. ly.maxVisibleAltitude = BaseConfig.pipeMaxVisibel
  1246. }
  1247. if (BaseConfig.pipeSelectLayers.indexOf(ly.name) > -1) {
  1248. ly.selectedColor = Cesium.Color.DARKRED
  1249. ly.selectColorType = 1
  1250. }
  1251. if (BaseConfig.pipeLineLayer.indexOf(ly.name) > -1) {
  1252. ly.lodRangeScale = 20
  1253. }
  1254. if (model) {
  1255. let style3d = new Cesium.Style3D()
  1256. style3d.altitudeMode = 0
  1257. style3d.bottomAltitude = model.bottomAltitude
  1258. ly.visible = model.visible
  1259. ly.style3D = style3d
  1260. //ly.brightness = model.brightness;
  1261. //ly.contrast = model.contrast;
  1262. //ly.hue = model.hue;
  1263. //ly.saturation = model.saturation;
  1264. //ly.gamma = model.gamma;
  1265. //if (Cesium.defined(model.maxVisibleAltitude)) ly.maxVisibleAltitude = model.maxVisibleAltitude;
  1266. //if(Cesium.defined(model.maxVisibleDistance)) ly.visibleDistanceMax=model.maxVisibleDistance;
  1267. }
  1268. ly.refresh()
  1269. }
  1270. if (!this.AppX.runtimeConfig.activeView.scene.pickPositionSupported) {
  1271. console.error('不支持深度纹理,无法拾取位置!')
  1272. }
  1273. }.bind(this),
  1274. function (e) {
  1275. console.error('加载SCP失败,请检查网络连接状态或者url地址是否正确?')
  1276. }
  1277. )
  1278. }.bind(this)
  1279. )
  1280. }
  1281. }
  1282. /**
  1283. * 该方法用于初始化cesium属性
  1284. */
  1285. initCesiumStatus() {
  1286. //开启地形深度测试
  1287. window.impViewer.scene.globe.depthTestAgainstTerrain = true
  1288. //关闭灯光
  1289. window.impViewer.scene.globe.enableLighting = false
  1290. //globeAlpha导致月球始终可见
  1291. window.impViewer.scene.moon.show = false
  1292. //地球表面双面显示
  1293. window.impViewer.scene.globe.backFaceCulling = false
  1294. //开启地下模式
  1295. window.impViewer.scene.undergroundMode = true
  1296. window.impViewer.scene.screenSpaceCameraController.minimumZoomDistance = -1000
  1297. window.impViewer.terrainProvider.isCreateSkirt = false //关闭地形裙边
  1298. //设置地球表面颜色
  1299. window.impViewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0, 1)
  1300. //帧率工具
  1301. window.impViewer.scene.debugShowFramesPerSecond = false
  1302. const nowDate = new Date(Date.now())
  1303. nowDate.setHours(16) //设置系统时间为12点,时差12小时
  1304. nowDate.setMinutes(0)
  1305. window.impViewer.clock.currentTime = Cesium.JulianDate.fromDate(nowDate)
  1306. window.impViewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
  1307. Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
  1308. )
  1309. }
  1310. /**
  1311. * 系统初始化加载天地图
  1312. */
  1313. initTianditu() {
  1314. const layerType = 'vec_w'
  1315. const poiType = 'cva_w'
  1316. const layerName = layerType.split('_')[0]
  1317. const poiName = poiType.split('_')[0]
  1318. const token = this.$store.state.cesiumMap.tdttoken
  1319. const url =
  1320. 'https://t{s}.tianditu.gov.cn/' +
  1321. layerType +
  1322. '/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=' +
  1323. layerName +
  1324. '&TILEMATRIXSET=w&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&STYLE=default&FORMAT=tiles&tk=' +
  1325. token
  1326. const poiurl =
  1327. 'https://t{s}.tianditu.gov.cn/' +
  1328. poiType +
  1329. '/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=' +
  1330. poiName +
  1331. '&TILEMATRIXSET=w&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&STYLE=default&FORMAT=tiles&tk=' +
  1332. token
  1333. const imagelayers = window.impViewer.imageryLayers
  1334. const layerlen = imagelayers.length
  1335. const subdomains = ['0', '1', '2', '3', '4', '5', '6', '7']
  1336. //中台
  1337. const imglayer = new Cesium.WebMapTileServiceImageryProvider({
  1338. //影像底图
  1339. url: new Cesium.Resource({
  1340. url: url,
  1341. headers: {
  1342. Accept: 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8'
  1343. }
  1344. }),
  1345. subdomains,
  1346. credit: 'tianditu_base',
  1347. layer: 'tdtVecLayer',
  1348. style: 'default',
  1349. maximumLevel: 17,
  1350. format: 'image/jpeg',
  1351. tileMatrixSetID: 'GoogleMapsCompatible', //使用谷歌的瓦片切片方式
  1352. show: true
  1353. })
  1354. const poilayer = new Cesium.WebMapTileServiceImageryProvider({
  1355. //影像底图
  1356. url: new Cesium.Resource({
  1357. url: poiurl,
  1358. headers: {
  1359. Accept: 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8'
  1360. }
  1361. }),
  1362. subdomains: subdomains,
  1363. credit: 'tianditu_poi',
  1364. layer: 'tdtCvaLayer',
  1365. style: 'default',
  1366. format: 'image/jpeg',
  1367. maximumLevel: 17,
  1368. tileMatrixSetID: 'GoogleMapsCompatible', //使用谷歌的瓦片切片方式
  1369. show: true
  1370. })
  1371. imagelayers.addImageryProvider(imglayer)
  1372. imagelayers.addImageryProvider(poilayer)
  1373. }
  1374. /**刷新地图 */
  1375. refreshViewer() {
  1376. window.impViewer.render()
  1377. }
  1378. /**服务发布按钮点击事件 */
  1379. publicService() {
  1380. this.isPublicDialogShow = true
  1381. this.publicConfig = []
  1382. }
  1383. /**发布服务 */
  1384. submitPublicService() {
  1385. if (this.publicConfig.length === 0) {
  1386. this.$message.error('请勾选发布选项')
  1387. return
  1388. }
  1389. if (this.publicConfig.indexOf('重建三维网络') > -1) {
  1390. this.zsbuildNetwork()
  1391. }
  1392. if (this.publicConfig.indexOf('发布地图服务') > -1) {
  1393. }
  1394. if (this.publicConfig.indexOf('更新发布标识') > -1) {
  1395. this.updatePubcliSign(this.listSelect.id)
  1396. }
  1397. }
  1398. /**表格勾选事件 */
  1399. selectChange(selection) {
  1400. this.listSelect = selection
  1401. }
  1402. }
  1403. </script>
  1404. <style lang="scss" scoped>
  1405. .tdbutton {
  1406. padding: 5px;
  1407. }
  1408. .eluploadcontainer {
  1409. >>> .el-upload-list {
  1410. height: 100px;
  1411. border: 1px solid #dcdfe6;
  1412. margin-top: 10px;
  1413. }
  1414. }
  1415. .fullDialog {
  1416. >>> .el-dialog {
  1417. max-width: 100vw !important;
  1418. .el-dialog__body {
  1419. height: 100%;
  1420. }
  1421. }
  1422. .impotMain {
  1423. margin-top: -5px;
  1424. padding: 0 0 0 20px;
  1425. >>> .el-tabs {
  1426. height: 100%;
  1427. .el-tabs__content {
  1428. height: calc(100% - 55px);
  1429. .el-tab-pane {
  1430. height: 100%;
  1431. }
  1432. }
  1433. }
  1434. }
  1435. }
  1436. .content-body {
  1437. .el-table {
  1438. >>> th > .cell {
  1439. white-space: pre-line;
  1440. }
  1441. >>> .el-table__body {
  1442. td.el-table__cell {
  1443. padding: 0 !important;
  1444. height: 34px;
  1445. }
  1446. }
  1447. }
  1448. }
  1449. .content-footer {
  1450. width: 100%;
  1451. height: 55px;
  1452. line-height: 35px;
  1453. padding: 10px 20px;
  1454. }
  1455. .cesium_container {
  1456. width: 100%;
  1457. height: 100%;
  1458. canvas {
  1459. width: 100% !important;
  1460. height: 100% !important;
  1461. touch-action: none;
  1462. }
  1463. .cesium-viewer-bottom,
  1464. .cesium-viewer-selectionIndicatorContainer,
  1465. .cesium-viewer-infoBoxContainer,
  1466. .cesium-viewer-toolbar,
  1467. .cesium-viewer-zoomIndicatorContainer {
  1468. display: none !important;
  1469. }
  1470. .cesium-viewer-navigationContainer {
  1471. left: 0 !important;
  1472. }
  1473. }
  1474. .refresjBtn {
  1475. position: absolute;
  1476. top: 10px;
  1477. left: 10px;
  1478. }
  1479. </style>