index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <view class="example container" :style="'height: ' + (screenHeight - 100) + 'px'">
  4. <!-- 搜索框 -->
  5. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  6. <uni-col :span="24">
  7. <view class="u-page__tag-item">
  8. <u-search placeholder="请输入单位建筑名称" bgColor="#edf6f9" borderColor="#4cb2b6" v-model="keyword"
  9. :show-action="true" @custom="search"></u-search>
  10. </view>
  11. </uni-col>
  12. </uni-row>
  13. <!-- 下拉框 -->
  14. <view class="u-page__tag-item"
  15. style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;background-color: #f5f7fa;">
  16. <u-form>
  17. <u-form-item prop="orgName" @click="
  18. showOrg = true;
  19. hideKeyboard();
  20. " label="单位选择:" labelWidth="100px">
  21. <u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
  22. <u-icon slot="right" name="arrow-down"></u-icon>
  23. </u-form-item>
  24. </u-form>
  25. </view>
  26. <!-- 卡片栏 -->
  27. <view v-if="tableData.length>0 && isLoaded" style="margin-bottom: 120rpx">
  28. <view v-for="(item, index) in tableData" :key="index"
  29. v-if="formData.orgName === item.orgName || formData.orgId === item.orgId">
  30. <uni-card>
  31. <!-- 标题 -->
  32. <view class="titles">{{ item.buildingName }}</view>
  33. <!-- 简要内容 -->
  34. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  35. <text class="name-align-building">地理位置:</text>
  36. <text class="conts">{{ item.dlwz }}</text>
  37. </view>
  38. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  39. <text class="name-align-building">建筑面积:</text>
  40. <text class="conts">{{ item.jzmj }}</text>
  41. </view>
  42. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  43. <text class="name-align-building">档案负责人:</text>
  44. <text class="conts max-width">{{ item.dafzr }}</text>
  45. </view>
  46. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  47. <text class="name-align-building">重点部位:</text>
  48. <text class="conts max-width">{{ item.zdbwpic }}</text>
  49. </view>
  50. <!-- 删除按钮 -->
  51. <view class="an-niu" @click.native="showModal(item)">
  52. <view class="detailDel">删除</view>
  53. </view>
  54. <view class="an-niu" @click.native="onClick(item)" link><text class="detail">查看详情</text></view>
  55. </uni-card>
  56. </view>
  57. </view>
  58. <!-- tableData为空时显示 -->
  59. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  60. <view class="text-gray" style="padding-top: 20px;">
  61. <img :src="tan90" alt="暂无数据" />
  62. </view>
  63. </view>
  64. <view>
  65. <image :src="Group" @click="addClick" class="tiantupian"></image>
  66. </view>
  67. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false"
  68. @select="sexSelect"></u-action-sheet>
  69. <u-modal :show="show" @confirm="confirm" @cancel="cancel" @close="close" asyncClose closeOnClickOverlay
  70. showCancelButton confirmColor="red" :title="title" :content="content" ref="uModal"></u-modal>
  71. <!-- 加载中 -->
  72. <isLodingModel></isLodingModel>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. var that = '';
  78. import {
  79. getArc, //获取建筑信息列表
  80. delArc, //删除建筑信息
  81. getOrgId //获取orgId
  82. } from '@/api/architecture';
  83. import config from '@/config'
  84. const baseUrlImg = config.baseUrlImg
  85. export default {
  86. data() {
  87. return {
  88. screenHeight: this.$screenHeight,
  89. wheight: '',
  90. isLoaded: false,
  91. Group: `${baseUrlImg}/checkActive/Group.png`,
  92. showOrg: false,
  93. actions: [],
  94. // 数据
  95. tableData: {},
  96. title: '是否删除该数据项?',
  97. content: '确认删除?',
  98. id: '',
  99. tan90: `${baseUrlImg}/tan90.png`,
  100. // 每页数据量
  101. pageSize: 5,
  102. // 当前页
  103. pageNo: 1,
  104. // 数据总量
  105. total: 0,
  106. // tableData数据加载中
  107. loading: false,
  108. // 初始化时搜索框的值
  109. keyword: '',
  110. // 存放orgid,orgname
  111. formData: {},
  112. show: false,
  113. showtimeStart: false,
  114. showtimeEnd: false
  115. };
  116. },
  117. // 在 vue页面,向起始页通过事件传递数据
  118. onLoad: function(option) {
  119. // this.init();
  120. },
  121. watch: {
  122. loading: {
  123. handler(newLength, oldLength) {
  124. this.$modal.isLoadingModel(this.loading)
  125. },
  126. immediate: true
  127. }
  128. },
  129. onShow() {
  130. this.actions = []
  131. that = this;
  132. getOrgId({
  133. pageNo: this.pageNo,
  134. pageSize: this.pageSize,
  135. userId: this.$store.state.user.id
  136. }).then(response => {
  137. // 取到用户对应的单位名称与id
  138. response.data.map(v => {
  139. this.actions.push({
  140. id: v.dwid,
  141. name: v.orgName
  142. });
  143. });
  144. this.formData.orgName = response.data[0].orgName ? response.data[0].orgName : '';
  145. this.formData.orgId = response.data[0].dwid;
  146. this.tableData = []
  147. this.getData();
  148. });
  149. },
  150. onReady() {},
  151. mixins: [uni.$u.mixin],
  152. methods: {
  153. search(val) {
  154. this.tableData = []
  155. console.log(val,'ssssssssssssssssssssddddddddddd')
  156. this.getData()
  157. },
  158. async init() {
  159. var t = this;
  160. t.$.getlocation()
  161. .then(res => {
  162. })
  163. .catch(err => {
  164. });
  165. },
  166. // 模态框内容
  167. showModal(val) {
  168. this.show = true;
  169. this.id = val.id;
  170. },
  171. confirm() {
  172. this.show = false;
  173. delArc({
  174. id: this.id
  175. }).then(response => {
  176. this.loading = true;
  177. this.isLoaded = false
  178. this.tableData = []
  179. this.getData();
  180. });
  181. },
  182. close() {
  183. this.show = false;
  184. },
  185. cancel() {
  186. this.show = false;
  187. },
  188. //查看详情
  189. addClickDetail(val) {
  190. uni.navigateTo({
  191. url: `/pagesA/fire/architecture/add_architecture/add_architecture?item=${JSON.stringify(val)}`
  192. });
  193. },
  194. // 获取数据
  195. getData() {
  196. this.loading = true;
  197. // 获取建筑信息详细信息
  198. getArc({
  199. pageNo: this.pageNo,
  200. pageSize: this.pageSize,
  201. orgId: this.formData.orgId,
  202. buildingName: this.keyword
  203. }).then(response => {
  204. this.isLoaded = true
  205. this.tableData = [...this.tableData, ...response.data.records]
  206. this.loading = false
  207. this.total=response.data.total
  208. console.log(this.tableData,'ssssssssss')
  209. // this.tableData = response.data;
  210. });
  211. },
  212. // 传递数据
  213. onClick(val) {
  214. this.isLoaded = false
  215. uni.navigateTo({
  216. url: `/pagesA/fire/architecture/architecture_details/architecture_details?id=${val.id}`,
  217. events: {
  218. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  219. acceptDataFromOpenedPage: function(val) {
  220. }
  221. },
  222. success: function(res) {
  223. // 通过eventChannel向被打开页面传送数据
  224. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  225. }
  226. });
  227. },
  228. // 删除单位建筑信息
  229. onClickDel(val) {
  230. this.id = val.id;
  231. delArc({
  232. id: this.id
  233. }).then(response => {
  234. this.loading = true;
  235. this.isLoaded = false
  236. this.tableData = []
  237. this.getData();
  238. });
  239. },
  240. addClick() {
  241. this.isLoaded = false
  242. uni.navigateTo({
  243. url: `/pagesA/fire/architecture/add_architecture/add_architecture?&orgName=${this.formData.orgName}&orgId=${this.formData.orgId}`,
  244. });
  245. },
  246. sexSelect(e) {
  247. this.formData.orgId = e.id;
  248. this.formData.orgName = e.name;
  249. // 获取建筑信息详细信息
  250. getArc({
  251. pageNo: this.pageNo,
  252. pageSize: this.pageSize,
  253. orgId: this.formData.orgId
  254. }).then(response => {
  255. this.tableData = response.data;
  256. });
  257. },
  258. // search() {
  259. // getArc({
  260. // pageNo: this.pageNo,
  261. // pageSize: this.pageSize,
  262. // orgId: this.formData.orgId,
  263. // buildingName: this.keyword
  264. // }).then(response => {
  265. // this.tableData = response.data;
  266. // });
  267. // },
  268. // 触底的事件
  269. onReachBottom() {
  270. // 判断是否还有下一页数据
  271. if (this.pageNo * this.pageSize >= this.total)
  272. return uni.showToast({
  273. title: `数据加载完毕`
  274. });
  275. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  276. if (this.loading) return;
  277. this.pageNo += 1;
  278. this.getData(this.pageNo);
  279. },
  280. // 隐藏键盘
  281. hideKeyboard() {
  282. uni.hideKeyboard();
  283. },
  284. //日期范围
  285. // 开始日期
  286. confirmStarttime(e) {
  287. this.showtimeStart = false;
  288. let value = new Date(e.value);
  289. this.formData.start = uni.$u.timeFormat(e.value, 'yyyy/mm/dd');
  290. }
  291. }
  292. };
  293. </script>
  294. <style lang="scss" scoped>
  295. body {
  296. background-color: #f5f7f9;
  297. }
  298. page {
  299. background-color: #f5f7f9;
  300. }
  301. /deep/ .u-tabs__wrapper[data-v-0de61367],
  302. .u-tabs__wrapper.data-v-0de61367 {
  303. width: 99%;
  304. }
  305. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  306. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  307. /deep/.u-tabs__wrapper__nav__item {
  308. padding: 0 60rpx;
  309. }
  310. .uni-container {
  311. height: 100vh;
  312. padding-right: 20upx;
  313. }
  314. .addInsp {
  315. width: 40px;
  316. position: fixed;
  317. right: 4px;
  318. z-index: 99999;
  319. }
  320. ::v-deep .u-icon__icon {
  321. margin-right: 0px !important;
  322. }
  323. .an-niu {
  324. float: right;
  325. font-size: 10px;
  326. text-align: center;
  327. display: flex;
  328. margin-top: -64upx;
  329. padding-bottom: 30rpx;
  330. // margin-top: 50rpx;
  331. color: #fff;
  332. .detail {
  333. width: 60px;
  334. height: 60rpx;
  335. padding: 0 20rpx;
  336. border-radius: 30px;
  337. background-color: #f7c41e;
  338. margin-right: 20rpx;
  339. text-align: center;
  340. line-height: 60rpx;
  341. font-size: 27upx;
  342. }
  343. .detailDel {
  344. width: 60px;
  345. height: 60rpx;
  346. padding: 0 20rpx;
  347. border-radius: 30px;
  348. background-color: #ff2e31;
  349. color: white;
  350. margin-right: 20rpx;
  351. text-align: center;
  352. line-height: 60rpx;
  353. font-size: 30upx;
  354. }
  355. .solve {
  356. width: 62px;
  357. height: 60rpx;
  358. margin-right: 20rpx;
  359. border-radius: 30px;
  360. background-color: #4cb2b6;
  361. line-height: 60rpx;
  362. }
  363. /deep/ .padding-tb-sm {
  364. padding-top: 0px;
  365. padding-bottom: 10px;
  366. }
  367. .deletes {
  368. width: 62px;
  369. height: 60rpx;
  370. border-radius: 60rpx;
  371. background-color: red;
  372. color: #fff;
  373. line-height: 60rpx;
  374. }
  375. }
  376. /deep/.segmented-control__item--button {
  377. background-color: rgb(76, 178, 182) !important;
  378. }
  379. /deep/.segmented-control__item--button--active {
  380. background-color: #ffffff !important;
  381. }
  382. /deep/.uni-card {
  383. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  384. border-radius: 30rpx;
  385. }
  386. .tiantupian {
  387. width: 110rpx;
  388. height: 110rpx;
  389. position: fixed;
  390. right: 15px;
  391. bottom: 10rpx;
  392. }
  393. //列表样式
  394. .titles {
  395. font-weight: 600;
  396. margin-bottom: 10rpx;
  397. color: black;
  398. font-size: 32rpx;
  399. }
  400. /deep/ .u-form-item__body__left__content__label {
  401. font-size: 28upx !important;
  402. }
  403. .conts {
  404. max-width: 470upx;
  405. display: -webkit-box;
  406. /*弹性伸缩盒子模型显示*/
  407. -webkit-box-orient: vertical;
  408. /*排列方式*/
  409. -webkit-line-clamp: 1;
  410. /*显示文本行数*/
  411. overflow: hidden;
  412. /*溢出隐藏*/
  413. color: #274647;
  414. text-overflow: ellipsis;
  415. }
  416. .max-width {
  417. max-width: 180upx;
  418. }
  419. /deep/.u-action-sheet {
  420. overflow-y: auto;
  421. height: 1000rpx;
  422. background-color: #fff;
  423. }
  424. .example {
  425. overflow-y: auto;
  426. }
  427. </style>