index.vue 9.4 KB

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