index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="uni-container">
  3. <view class="example container">
  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 v-if="!township" 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: 80rpx;">
  28. <view v-for="(item, index) in tableData" :key="index"
  29. v-if="formData.orgName === item.orgName || formData.orgId === item.orgId||township">
  30. <uni-card>
  31. <!-- 标题 -->
  32. <view class="titles">{{ item.microName }}</view>
  33. <!-- 简要内容 -->
  34. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  35. <text class="name-align-building">详细地址:</text>
  36. <text class="conts">{{ item.addr }}</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.county }}</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.charger }}</text>
  45. </view>
  46. <!-- 删除按钮 -->
  47. <view class="an-niu" @click.native="showModal(item)">
  48. <view class="detailDel">删除</view>
  49. </view>
  50. <view class="an-niu" @click.native="onClick(item,formData.orgName)" link><text
  51. class="detail">查看详情</text></view>
  52. <view class="an-niu" @click.native="onClickFireRun(item,formData.orgName)" link><text
  53. class="operation">出动记录</text></view>
  54. </uni-card>
  55. </view>
  56. </view>
  57. <!-- tableData为空时显示 -->
  58. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  59. <view class="text-gray" style="padding-top: 20px;" v-if="tableData == 0">
  60. <img :src="tan90" alt="暂无数据" />
  61. </view>
  62. </view>
  63. <view>
  64. <image :src="Group" @click="addClick" class="tiantupian"></image>
  65. </view>
  66. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false"
  67. @select="sexSelect">
  68. </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. getOrgId,
  80. getStation,
  81. delStation,
  82. } from '@/api/fire_station/index';
  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. orgName: '',
  113. mkind:1
  114. },
  115. show: false,
  116. showtimeStart: false,
  117. showtimeEnd: false,
  118. township:''
  119. };
  120. },
  121. // 在 vue页面,向起始页通过事件传递数据
  122. onLoad: function(option) {},
  123. onShow() {
  124. this.township=uni.getStorageSync('getUserInfo_key').streetInfo?uni.getStorageSync('getUserInfo_key').streetInfo:''
  125. if(this.township){
  126. this.formData.mkind=2
  127. }
  128. this.actions = []
  129. that = this;
  130. getOrgId({
  131. pageNo: this.pageNo,
  132. pageSize: this.pageSize,
  133. userId: this.$store.state.user.id
  134. }).then(response => {
  135. // 取到用户对应的单位名称与id
  136. response.data.map(v => {
  137. this.actions.push({
  138. id: v.dwid,
  139. name: v.orgName
  140. });
  141. });
  142. this.formData.orgName = response.data[0]?.orgName ? response.data[0].orgName : '';
  143. this.formData.orgId = response.data[0]?.dwid;
  144. this.tableData = []
  145. this.getData();
  146. });
  147. },
  148. watch: {
  149. loading: {
  150. handler(newLength, oldLength) {
  151. this.$modal.isLoadingModel(this.loading)
  152. },
  153. immediate: true
  154. }
  155. },
  156. onReady() {},
  157. mixins: [uni.$u.mixin],
  158. methods: {
  159. search(val) {
  160. this.tableData = []
  161. this.getData(1)
  162. },
  163. // 模态框内容
  164. showModal(val) {
  165. this.show = true;
  166. this.id = val.id;
  167. },
  168. confirm() {
  169. this.show = false;
  170. delStation({
  171. id: this.id
  172. }).then(response => {
  173. this.loading = true;
  174. this.isLoaded = false
  175. this.tableData = []
  176. this.getData();
  177. // this.tableData = response.data.list;
  178. });
  179. },
  180. close() {
  181. this.show = false;
  182. },
  183. cancel() {
  184. this.show = false;
  185. },
  186. //查看详情
  187. addClickDetail(val) {
  188. this.isLoaded = false
  189. uni.navigateTo({
  190. url: `/pagesA/fire/fire_station/fireStation_details/fireStation_details?item=${JSON.stringify(val)}`
  191. });
  192. },
  193. // 获取数据
  194. getData() {
  195. this.loading = true;
  196. // 获取消防站信息详细信息
  197. getStation({
  198. pageNo: this.pageNo,
  199. pageSize: this.pageSize,
  200. orgId: this.formData.orgId,
  201. microName: this.keyword,
  202. mkind:this.formData.mkind
  203. // userId: this.$store.state.user.id
  204. }).then(response => {
  205. this.isLoaded = true
  206. this.tableData = [...this.tableData, ...response.data.list]
  207. this.loading = false
  208. this.total = response.data.total
  209. // this.tableData = response.data.list;
  210. // console.log(this.tableData[0].id, 'ppp');
  211. // localStorage.setItem('fireId',this.tableData[0].id)
  212. });
  213. },
  214. // 传递数据
  215. onClick(val, orgName) {
  216. localStorage.setItem("fireId", JSON.stringify(val.id))
  217. this.isLoaded = false
  218. uni.navigateTo({
  219. url: '/pagesA/fire/fire_station/fireStation_details/fireStation_details?id=' + val.id +
  220. '&orgName=' + orgName,
  221. events: {
  222. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  223. acceptDataFromOpenedPage: function(val) {
  224. }
  225. },
  226. success: function(res) {
  227. // 通过eventChannel向被打开页面传送数据
  228. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  229. }
  230. });
  231. },
  232. // 删除单位消防站信息
  233. onClickDel(val) {
  234. this.id = val.id;
  235. delStation({
  236. id: this.id
  237. }).then(response => {
  238. this.loading = true;
  239. this.isLoaded = false
  240. this.tableData = []
  241. this.getData();
  242. });
  243. },
  244. addClick() {
  245. this.isLoaded = false
  246. uni.navigateTo({
  247. url: `/pagesA/fire/fire_station/add_fireStation/add_fireStation?&orgName=${this.formData.orgName}&orgId=${this.formData.orgId}`
  248. });
  249. },
  250. //微型消防站运行
  251. onClickFireRun(item) {
  252. this.isLoaded = false
  253. uni.navigateTo({
  254. url: `/pagesA/fire/add_fireRun/fireRun?runId=${item.id}`
  255. });
  256. },
  257. sexSelect(e) {
  258. this.formData.orgId = e.id;
  259. this.formData.orgName = e.name;
  260. // 获取消防站信息详细信息
  261. getStation({
  262. pageNo: this.pageNo,
  263. pageSize: this.pageSize,
  264. orgId: this.formData.orgId,
  265. userId: this.$store.state.user.id
  266. }).then(response => {
  267. this.tableData = response.data.list;
  268. });
  269. },
  270. // 隐藏键盘
  271. hideKeyboard() {
  272. uni.hideKeyboard();
  273. },
  274. //日期范围
  275. // 开始日期
  276. confirmStarttime(e) {
  277. this.showtimeStart = false;
  278. let value = new Date(e.value);
  279. this.formData.start = uni.$u.timeFormat(e.value, 'yyyy/mm/dd');
  280. }
  281. },
  282. // 触底的事件
  283. onReachBottom() {
  284. // 判断是否还有下一页数据
  285. if (this.pageNo * this.pageSize >= this.total)
  286. return uni.showToast({
  287. title: `数据加载完毕`
  288. });
  289. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  290. if (this.loading) return;
  291. this.pageNo += 1;
  292. this.getData(this.pageNo);
  293. }
  294. };
  295. </script>
  296. <style lang="scss" scoped>
  297. body {
  298. background-color: #f5f7f9;
  299. }
  300. page {
  301. background-color: #f5f7f9 !important;
  302. }
  303. /deep/ .u-tabs__wrapper[data-v-0de61367],
  304. /deep/.u-tabs__wrapper.data-v-0de61367,
  305. /deep/.u-tabs__wrapper {
  306. width: 99%;
  307. }
  308. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  309. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  310. /deep/.u-tabs__wrapper__nav__item {
  311. padding: 0 60rpx;
  312. }
  313. .uni-container {
  314. padding-right: 20upx;
  315. }
  316. .addInsp {
  317. width: 40px;
  318. position: fixed;
  319. right: 4px;
  320. z-index: 99999;
  321. }
  322. ::v-deep .u-icon__icon {
  323. margin-right: 0px !important;
  324. }
  325. .an-niu {
  326. float: right;
  327. text-align: center;
  328. display: flex;
  329. // margin-top: -64upx;
  330. padding-bottom: 30rpx;
  331. // margin-top: 50rpx;
  332. color: #fff;
  333. font-size: 20rpx;
  334. .detail {
  335. width: 120rpx;
  336. padding: 0 20rpx;
  337. height: 60rpx;
  338. border-radius: 60rpx;
  339. background-color: #f7c41e;
  340. margin-right: 20rpx;
  341. text-align: center;
  342. line-height: 60rpx;
  343. }
  344. .detailDel {
  345. width: 120rpx;
  346. height: 60rpx;
  347. padding: 0 20rpx;
  348. border-radius: 60rpx;
  349. background-color: #ff2e31;
  350. color: white;
  351. margin-right: 20rpx;
  352. text-align: center;
  353. line-height: 60rpx;
  354. }
  355. .operation {
  356. padding: 0 20rpx;
  357. }
  358. .solve,
  359. .operation {
  360. width: 124rpx;
  361. height: 60rpx;
  362. margin-right: 20rpx;
  363. border-radius: 60rpx;
  364. background-color: #4cb2b6;
  365. line-height: 60rpx;
  366. }
  367. /deep/ .padding-tb-sm {
  368. padding-top: 0px;
  369. padding-bottom: 10px;
  370. }
  371. .deletes {
  372. width: 124rpx;
  373. height: 60rpx;
  374. border-radius: 60rpx;
  375. background-color: red;
  376. color: #fff;
  377. line-height: 60rpx;
  378. }
  379. }
  380. /deep/.segmented-control__item--button {
  381. background-color: rgb(76, 178, 182) !important;
  382. }
  383. /deep/.segmented-control__item--button--active {
  384. background-color: #ffffff !important;
  385. }
  386. /deep/.uni-card {
  387. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  388. border-radius: 30rpx;
  389. }
  390. .tiantupian {
  391. width: 110rpx;
  392. height: 110rpx;
  393. position: fixed;
  394. right: 15px;
  395. bottom: 10rpx;
  396. }
  397. //列表样式
  398. .titles {
  399. font-weight: 600;
  400. margin-bottom: 10rpx;
  401. color: #1E293B;
  402. font-size: 30rpx;
  403. }
  404. .conts {
  405. max-width: 470rpx;
  406. display: -webkit-box;
  407. /*弹性伸缩盒子模型显示*/
  408. -webkit-box-orient: vertical;
  409. /*排列方式*/
  410. -webkit-line-clamp: 1;
  411. /*显示文本行数*/
  412. overflow: hidden;
  413. /*溢出隐藏*/
  414. color: #274647;
  415. text-overflow: ellipsis;
  416. /*不知道干嘛的*/
  417. .conts-title {
  418. margin-right: 10rpx;
  419. color: #728f90;
  420. }
  421. }
  422. .max-width {
  423. max-width: 180upx;
  424. }
  425. /deep/ .u-form-item__body__left__content__label {
  426. font-size: 28upx !important;
  427. }
  428. /deep/.u-action-sheet {
  429. overflow-y: auto;
  430. height: 1000rpx;
  431. background-color: #fff;
  432. }
  433. .example {
  434. overflow-y: auto;
  435. }
  436. </style>