index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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 style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  33. <text class="name-align-drill">动火执行人:</text>
  34. <text class="conts">{{ item.executor }}</text>
  35. </view>
  36. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  37. <text class="name-align-drill">动火事由:</text>
  38. <text class="conts">{{ item.workReason }}</text>
  39. </view>
  40. <view style="margin-top: 80rpx;">
  41. <!-- 删除按钮 -->
  42. <view class="an-niu" @click.native="showModal(item.id)" v-if="item.workStatus=='未审核'">
  43. <text class="detailDel">删除</text>
  44. </view>
  45. <view class="an-niu" @click.native="onClick(item.id)" link><text class="detail">查看详情</text>
  46. </view>
  47. <view class="an-niu" @click.native="editClick(item.id)" link><text class="detail" v-if="item.workStatus=='未审核'">编辑</text>
  48. </view>
  49. </view>
  50. </uni-card>
  51. </view>
  52. </view>
  53. <!-- tableData为空时显示 -->
  54. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  55. <view class="text-gray" style="padding-top: 20px;">
  56. <img :src="tan90" alt="暂无数据" />
  57. </view>
  58. </view>
  59. <view>
  60. <image :src="Group" @click="addClick" class="tiantupian"></image>
  61. </view>
  62. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false"
  63. @select="sexSelect"></u-action-sheet>
  64. <u-modal :show="show" @confirm="confirm" @cancel="cancel" @close="close" asyncClose closeOnClickOverlay
  65. showCancelButton confirmColor="red" :title="title" :content="content" ref="uModal"></u-modal>
  66. <!-- 加载中 -->
  67. <isLodingModel></isLodingModel>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. var that = '';
  73. import {
  74. getOrgId //获取orgId
  75. } from '@/api/architecture';
  76. import {
  77. fireWorkPage,
  78. fireWorkUpdate,
  79. fireWorkDelete
  80. } from '@/api/fireSpecial';
  81. import config from '@/config'
  82. const baseUrlImg = config.baseUrlImg
  83. export default {
  84. data() {
  85. return {
  86. screenHeight: this.$screenHeight,
  87. wheight: '',
  88. keyword: '',
  89. isLoaded: false,
  90. Group: `${baseUrlImg}/checkActive/Group.png`,
  91. showOrg: false,
  92. actions: [],
  93. // 数据
  94. tableData: {},
  95. title: '是否删除该数据项?',
  96. content: '确认删除?',
  97. id: '',
  98. tan90: `${baseUrlImg}/tan90.png`,
  99. // 每页数据量
  100. pageSize: 5,
  101. // 当前页
  102. pageNo: 1,
  103. // 数据总量
  104. total: 0,
  105. // tableData数据加载中
  106. loading: false,
  107. // 初始化时搜索框的值
  108. keyword: '',
  109. // 存放orgid,orgname
  110. formData: {},
  111. show: false,
  112. showtimeStart: false,
  113. showtimeEnd: false
  114. };
  115. },
  116. // 在 vue页面,向起始页通过事件传递数据
  117. onLoad: function(option) {
  118. // this.init();
  119. },
  120. watch: {
  121. loading: {
  122. handler(newLength, oldLength) {
  123. this.$modal.isLoadingModel(this.loading)
  124. },
  125. immediate: true
  126. }
  127. },
  128. onShow() {
  129. this.actions = []
  130. that = this;
  131. getOrgId({
  132. pageNo: this.pageNo,
  133. pageSize: this.pageSize,
  134. userId: this.$store.state.user.id
  135. }).then(response => {
  136. console.log(response, 'response');
  137. // 取到用户对应的单位名称与id
  138. response.data.map(v => {
  139. this.actions.push({
  140. id: v.dwid,
  141. name: v.orgName
  142. });
  143. });
  144. console.log(response.data, '21321312');
  145. this.formData.orgName = response.data[0].orgName ? response.data[0].orgName : '';
  146. this.formData.orgId = response.data[0].dwid;
  147. this.tableData = []
  148. this.getData();
  149. });
  150. },
  151. onReady() {},
  152. mixins: [uni.$u.mixin],
  153. methods: {
  154. search(val) {
  155. console.log(val, 'valvals', this.formData);
  156. this.tableData = []
  157. this.getData()
  158. },
  159. async init() {
  160. var t = this;
  161. t.$.getlocation()
  162. .then(res => {
  163. console.log(res, 'res');
  164. })
  165. .catch(err => {
  166. console.log(err, 'err');
  167. });
  168. },
  169. // 模态框内容
  170. showModal(val) {
  171. this.show = true;
  172. this.id = val;
  173. console.log(val, 'val.id');
  174. },
  175. confirm() {
  176. this.show = false;
  177. fireWorkDelete({
  178. id: this.id
  179. }).then(response => {
  180. this.loading = true;
  181. this.isLoaded = false
  182. this.tableData = []
  183. this.getData();
  184. console.log(this.tableData, '获取建筑信息详细信息获取建筑信息详细信息获取建筑信息详细信息获取建筑信息详细信息');
  185. });
  186. },
  187. close() {
  188. this.show = false;
  189. console.log('close');
  190. },
  191. cancel() {
  192. this.show = false;
  193. console.log('cancel');
  194. },
  195. //查看详情
  196. addClickDetail(val) {
  197. uni.navigateTo({
  198. url: `/pagesA/fire/architecture/add_architecture/add_architecture?item=${JSON.stringify(val)}`
  199. });
  200. },
  201. // 获取数据
  202. getData() {
  203. this.loading = true;
  204. // 获取建筑信息详细信息
  205. let arrOrg = []
  206. arrOrg.push(this.formData.orgId)
  207. fireWorkPage({
  208. pageNo: this.pageNo,
  209. pageSize: this.pageSize,
  210. orgIds: arrOrg,
  211. executor: this.keyword
  212. }).then(response => {
  213. console.log(response, 'sdsdsd');
  214. this.isLoaded = true
  215. this.tableData = response.data ? [...this.tableData, ...response.data.list] : []
  216. this.total = response.data?response.data.total:0
  217. this.loading = false
  218. });
  219. },
  220. // 传递数据
  221. onClick(val) {
  222. this.isLoaded = false
  223. uni.navigateTo({
  224. url: `/pagesB/fire/fireWork/addWork/index?title=查看特动火审批&&viewData=${val}`
  225. })
  226. },
  227. editClick(val) {
  228. this.isLoaded = false
  229. uni.navigateTo({
  230. url: `/pagesB/fire/fireWork/addWork/index?title=查看动火审批&&editData=${val}&&orgaction=${JSON.stringify(this.actions)}`
  231. })
  232. },
  233. addClick() {
  234. this.isLoaded = false
  235. uni.navigateTo({
  236. url: `/pagesB/fire/fireWork/addWork/index?title=新增动火审批&&orgName=${this.formData.orgName}&&orgId=${this.formData.orgId}&&orgaction=${JSON.stringify(this.actions)}`
  237. });
  238. },
  239. sexSelect(e) {
  240. this.formData.orgId = e.id;
  241. this.formData.orgName = e.name;
  242. this.getData()
  243. },
  244. // 触底的事件
  245. onReachBottom() {
  246. // 判断是否还有下一页数据
  247. if (this.pageNo * this.pageSize >= this.total)
  248. return uni.showToast({
  249. title: `数据加载完毕`
  250. });
  251. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  252. if (this.loading) return;
  253. this.pageNo += 1;
  254. this.getData(this.pageNo);
  255. },
  256. // 隐藏键盘
  257. hideKeyboard() {
  258. uni.hideKeyboard();
  259. },
  260. }
  261. };
  262. </script>
  263. <style lang="scss" scoped>
  264. body {
  265. background-color: #f5f7f9;
  266. }
  267. page {
  268. background-color: #f5f7f9;
  269. }
  270. /deep/ .u-tabs__wrapper[data-v-0de61367],
  271. .u-tabs__wrapper.data-v-0de61367 {
  272. width: 99%;
  273. }
  274. .uni-container {
  275. height: 100vh;
  276. padding-right: 20upx;
  277. }
  278. .addInsp {
  279. width: 40px;
  280. position: fixed;
  281. right: 4px;
  282. z-index: 99999;
  283. }
  284. ::v-deep .u-icon__icon {
  285. margin-right: 0px !important;
  286. }
  287. .an-niu {
  288. float: right;
  289. font-size: 10px;
  290. text-align: center;
  291. display: flex;
  292. margin-top: -64upx;
  293. padding-bottom: 30rpx;
  294. // margin-top: 50rpx;
  295. color: #fff;
  296. .detail {
  297. width: 60px;
  298. height: 60rpx;
  299. padding: 0 20rpx;
  300. border-radius: 30px;
  301. background-color: #f7c41e;
  302. margin-right: 20rpx;
  303. text-align: center;
  304. line-height: 60rpx;
  305. font-size: 27upx;
  306. }
  307. .detailDel {
  308. width: 60px;
  309. height: 60rpx;
  310. padding: 0 20rpx;
  311. border-radius: 30px;
  312. background-color: #ff2e31;
  313. color: white;
  314. margin-right: 20rpx;
  315. text-align: center;
  316. line-height: 60rpx;
  317. font-size: 30upx;
  318. }
  319. .solve {
  320. width: 62px;
  321. height: 60rpx;
  322. margin-right: 20rpx;
  323. border-radius: 30px;
  324. background-color: #4cb2b6;
  325. line-height: 60rpx;
  326. }
  327. /deep/ .padding-tb-sm {
  328. padding-top: 0px;
  329. padding-bottom: 10px;
  330. }
  331. .deletes {
  332. width: 62px;
  333. height: 60rpx;
  334. border-radius: 60rpx;
  335. background-color: red;
  336. color: #fff;
  337. line-height: 60rpx;
  338. }
  339. }
  340. /deep/.segmented-control__item--button {
  341. background-color: rgb(76, 178, 182) !important;
  342. }
  343. /deep/.segmented-control__item--button--active {
  344. background-color: #ffffff !important;
  345. }
  346. /deep/.uni-card {
  347. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  348. border-radius: 30rpx;
  349. }
  350. .tiantupian {
  351. width: 110rpx;
  352. height: 110rpx;
  353. position: fixed;
  354. right: 15px;
  355. bottom: 30rpx;
  356. }
  357. //列表样式
  358. .titles {
  359. font-weight: 600;
  360. margin-bottom: 10rpx;
  361. color: black;
  362. font-size: 32rpx;
  363. }
  364. /deep/ .u-form-item__body__left__content__label {
  365. font-size: 28upx !important;
  366. }
  367. .conts {
  368. max-width: 470upx;
  369. display: -webkit-box;
  370. /*弹性伸缩盒子模型显示*/
  371. -webkit-box-orient: vertical;
  372. /*排列方式*/
  373. -webkit-line-clamp: 1;
  374. /*显示文本行数*/
  375. overflow: hidden;
  376. /*溢出隐藏*/
  377. color: #274647;
  378. text-overflow: ellipsis;
  379. }
  380. .max-width {
  381. max-width: 180upx;
  382. }
  383. /deep/.u-action-sheet {
  384. overflow-y: auto;
  385. height: 1000rpx;
  386. background-color: #fff;
  387. }
  388. .example {
  389. overflow-y: auto;
  390. }
  391. </style>