ThreeDimensionalData.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!-- 三维数据 -->
  2. <template>
  3. <CategoryMenu :type="'threeD'" v-model:currVal="currCategory"></CategoryMenu>
  4. <div class="data" v-if="currCategory && currCategory!==''">
  5. <el-button v-if="auth" type="primary" @click="addDataClick">录入三维数据</el-button>
  6. <el-button v-if="auth" type="warning" @click="batchDelete">批量删除</el-button>
  7. <div class="operation">
  8. <el-form :model="filterForm" :inline="true">
  9. <el-form-item label="标题:" style="width: 22%">
  10. <el-input v-model="filterForm.title" placeholder="请输入标题"></el-input>
  11. </el-form-item>
  12. <el-form-item label="描述:" style="width: 22%">
  13. <el-input v-model="filterForm.content" placeholder="请输入描述"></el-input>
  14. </el-form-item>
  15. <!--<el-form-item label="地名地址库:" style="width: 20%">-->
  16. <!-- <el-input v-model="filterForm.address" placeholder="请输入名称"></el-input>-->
  17. <!--</el-form-item>-->
  18. <el-form-item label="导入类型:" style="width: 28%">
  19. <el-select v-model="filterForm.importType" placeholder="请选择类型">
  20. <el-option value="单条数据录入">单条数据录入</el-option>
  21. <el-option value="Shape文件导入">Shape文件导入</el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" @click="search">搜索</el-button>
  26. </el-form-item>
  27. </el-form>
  28. </div>
  29. <div class="list">
  30. <el-table ref="dataTable" v-loading="loading" element-loading-text="正在加载,请稍后..." :data="tableData"
  31. :border="true" :stripe="true" :height="$store.state.tableHeight" style="width: 100%;margin-bottom: 15px;"
  32. @selection-change="handleTableSelect">
  33. <el-table-column type="selection" width="55"/>
  34. <el-table-column prop="id" label="ID" width="100" :show-overflow-tooltip="true">
  35. <template #default="scope">
  36. <span style="cursor: pointer" @click="$util.clipboard.copyText(scope.row.id)"> {{ scope.row.id }} </span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="title" label="标题" width="200"/>
  40. <el-table-column prop="content" label="描述" width="250"/>
  41. <el-table-column prop="modelType" label="类型" width="120"/>
  42. <el-table-column prop="menuNameTwo" label="类别" width="120"/>
  43. <el-table-column prop="lon" label="位置" width="180">
  44. <template #default="scope">
  45. [
  46. <span v-if="scope.row.lon && scope.row.lon!=='' && scope.row.lat && scope.row.lat!==''">
  47. {{ scope.row.lon }},<br/> {{ scope.row.lat }}
  48. </span>
  49. ]
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="address" label="地名地址库" width="150"/>
  53. <el-table-column prop="userName" label="修改人"/>
  54. <el-table-column prop="updateDate" label="修改时间" width="170">
  55. <template #default="scope">
  56. {{ $util.datetime.format(scope.row.updateDate) }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="createDate" label="创建时间" width="170">
  60. <template #default="scope">
  61. {{ $util.datetime.format(scope.row.createDate) }}
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="operation" label="操作" width="150" fixed="right">
  65. <template #default="scope">
  66. <el-tooltip class="box-item" effect="dark" content="查看详情" placement="top-start">
  67. <el-button type="default" @click="viewData(scope.row)" circle>
  68. <el-icon>
  69. <ElIconView/>
  70. </el-icon>
  71. </el-button>
  72. </el-tooltip>
  73. <el-tooltip v-if="auth" class="box-item" effect="dark" content="编辑" placement="top-start">
  74. <el-button type="primary" @click="editData(scope.row)" circle>
  75. <el-icon>
  76. <ElIconEdit/>
  77. </el-icon>
  78. </el-button>
  79. </el-tooltip>
  80. <el-tooltip v-if="auth" class="box-item" effect="dark" content="删除" placement="top-start">
  81. <el-button type="danger" @click="deleteData(scope.row)" circle>
  82. <el-icon>
  83. <ElIconDelete/>
  84. </el-icon>
  85. </el-button>
  86. </el-tooltip>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <el-pagination style="float:right" background layout="sizes, prev, pager, next, jumper, total"
  91. v-model:current-page="pageInfo.page" v-model:page-size="pageInfo.pageSize"
  92. v-model:total="pageInfo.total"/>
  93. </div>
  94. </div>
  95. <ThreeDimensionalDataDetail v-if="isDetailShow" :is-show="isDetailShow" :item="currRow"
  96. :close="handleDetailShow"></ThreeDimensionalDataDetail>
  97. </template>
  98. <script>
  99. import api from '@/api/data/ThreeDimensionalData'
  100. import ThreeDimensionalDataDetail from "@/components/dataManage/dataDetail/ThreeDimensionalDataDetail";
  101. import CategoryMenu from "@/components/dataManage/CategoryMenu";
  102. export default {
  103. data() {
  104. return {
  105. auth: false,
  106. loading: false,
  107. filterForm: {},
  108. tableData: [],
  109. currRow: {},
  110. selectedRows: [],
  111. pageInfo: {
  112. page: 1,
  113. pageSize: 10,
  114. total: 0,
  115. },
  116. currCategory: '',
  117. isDetailShow: false,
  118. }
  119. },
  120. components: {
  121. ThreeDimensionalDataDetail,
  122. CategoryMenu,
  123. },
  124. created() {
  125. let userInfo = this.$store.state.userInfo;
  126. if (userInfo.userLevel < 2
  127. || (userInfo.userLevel === 2) && userInfo.serviceId.split(',').indexOf(this.$constant.serviceId) > -1) {
  128. this.auth = true;
  129. }
  130. },
  131. mounted() {
  132. this.getData();
  133. },
  134. watch: {
  135. "pageInfo.page": function (val) {
  136. if (val > 0) {
  137. this.getData();
  138. }
  139. },
  140. "pageInfo.pageSize": function () {
  141. let app = this;
  142. this.pageInfo.page = -1;
  143. setTimeout(function () {
  144. app.pageInfo.page = 1;
  145. }, 50)
  146. },
  147. "currCategory": function () {
  148. this.resetCategory();
  149. this.getData();
  150. }
  151. },
  152. methods: {
  153. handleLoading(flag) {
  154. let app = this;
  155. if (flag) {
  156. app.loading = true;
  157. } else {
  158. setTimeout(() => {
  159. app.loading = false;
  160. }, 500);
  161. }
  162. },
  163. resetCategory() {
  164. let auth = this.$data.auth;
  165. let currCategory = this.$data.currCategory;
  166. Object.assign(this.$data, this.$options.data());
  167. this.auth = auth;
  168. this.currCategory = currCategory;
  169. },
  170. getData() {
  171. let app = this;
  172. if (!(app.currCategory && app.currCategory !== '')) {
  173. return;
  174. }
  175. app.tableData = [];
  176. let params = {
  177. menuId: app.currCategory,
  178. page: app.pageInfo.page,
  179. pageSize: app.pageInfo.pageSize,
  180. }
  181. Object.assign(params, app.filterForm)
  182. app.handleLoading(true)
  183. api.getData(params).then(res => {
  184. if (res.code === 200) {
  185. app.pageInfo.total = res.total;
  186. app.tableData = res.content
  187. }
  188. app.handleLoading(false)
  189. }).catch(err => {
  190. app.handleLoading(false)
  191. })
  192. },
  193. search() {
  194. let app = this;
  195. this.pageInfo.pageSize = -1;
  196. setTimeout(function () {
  197. app.pageInfo.pageSize = 10;
  198. })
  199. },
  200. handleTableSelect(val) {
  201. this.selectedRows = val;
  202. },
  203. handleDetailShow(flag) {
  204. if (flag) {
  205. this.getData()
  206. }
  207. this.isDetailShow = false
  208. },
  209. // 录入数据
  210. addDataClick() {
  211. this.currRow = {};
  212. this.isDetailShow = true;
  213. },
  214. // 批量删除数据
  215. batchDelete() {
  216. if (!this.selectedRows) {
  217. return;
  218. }
  219. let ids = this.selectedRows.map(i => {
  220. return i.id
  221. }).join(',');
  222. this.deleteData({id: ids})
  223. },
  224. // 查看详情
  225. viewData(item) {
  226. let app = this;
  227. app.currRow = JSON.parse(JSON.stringify(item))
  228. if (app.currRow.menuId) {
  229. app.currRow.menuId = Number(app.currRow.menuId)
  230. }
  231. this.currRow.isDataView = true;
  232. app.isDetailShow = true
  233. },
  234. // 编辑数据
  235. editData(item) {
  236. let app = this;
  237. app.currRow = JSON.parse(JSON.stringify(item))
  238. if (app.currRow.menuId) {
  239. app.currRow.menuId = Number(app.currRow.menuId)
  240. }
  241. app.currRow.isEdit = true;
  242. app.isDetailShow = true
  243. },
  244. // 删除数据
  245. deleteData(item) {
  246. let app = this;
  247. app.$msgbox.confirm('确认要删除此条数据吗?').then(() => {
  248. api.deleteData({threeDId: item.id}).then(res => {
  249. if (res.code === 200) {
  250. app.getData();
  251. app.$message({message: '删除成功', type: 'success'});
  252. }
  253. })
  254. })
  255. },
  256. }
  257. }
  258. </script>
  259. <style>
  260. </style>