equipmentinspectionreportrtulist.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="wrap">
  3. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  4. :title="title" @clickLeft="toBack" >
  5. </uni-nav-bar>
  6. <!-- <u-gap height="75px"></u-gap> -->
  7. <view class="container">
  8. <uSection title="分组选择" type="line" style="padding-left: 10px;padding-right: 10px;">
  9. <uni-data-picker placeholder="请选择机构" popup-title="请选择所在地区" :localdata="projectTree"
  10. v-model="selectedTreeNode" @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
  11. @popupclosed="onpopupclosed">
  12. </uni-data-picker>
  13. </uSection>
  14. <uSection title="">
  15. <uni-search-bar placeholder="请录入测站编码或测站名称" @confirm="search" :focus="false" v-model="searchVal"
  16. @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear">
  17. </uni-search-bar>
  18. </uSection>
  19. <uSection title="">
  20. <uList>
  21. <uni-list-item v-for="item in list" :key="item.id">
  22. <!-- 自定义 body -->
  23. <template v-slot:body>
  24. <view style="height: 100px;width: 100%;display: flex;flex-direction: column;">
  25. <view
  26. style="display: flex;flex-direction: row;width: 100%;justify-content: flex-start;">
  27. <view
  28. style="font-size: 1rem;font-weight: bold;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
  29. {{item.rtuName}}
  30. </view>
  31. </view>
  32. <view style="margin-top: 10rpx;">
  33. <text style="font-size: 0.9rem;color: gray;">{{item.rtuCode}}</text>
  34. </view>
  35. <view
  36. style="margin-top: 10rpx;padding-left: 0rpx;padding-right: 0rpx;display: flex;flex-direction: row;justify-content: center;">
  37. <view v-if="item.reportStatus == 0" style="width: 100%;">
  38. <button style="background-color: lightblue;" type="default"
  39. @click="openPage(item.rtuCode)">开始填报</button>
  40. </view>
  41. <view v-if="item.reportStatus == 1" style="width: 100%;">
  42. <button type="default" @click="toPlanClose(item.id)">已提交</button>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. </uni-list-item>
  48. </uList>
  49. </uSection>
  50. <uGroup>
  51. <view class="uni-pagination-box">
  52. <uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
  53. @change="change" />
  54. </view>
  55. </uGroup>
  56. </view>
  57. <u-gap height="70"></u-gap>
  58. </view>
  59. </template>
  60. <script>
  61. import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
  62. import uDataPicker from '@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue'
  63. import uGroup from '@/uni_modules/uni-group/uni-group.vue'
  64. import uSection from '@/uni_modules/uni-section/uni-section.vue'
  65. import uPagination from '@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue'
  66. import uBreadcrumb from '@/uni_modules/uni-breadcrumb/components/uni-breadcrumb/uni-breadcrumb.vue'
  67. import uList from '@/uni_modules/uni-list/components/uni-list/uni-list.vue'
  68. import uListItem from '@/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue'
  69. import uIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
  70. import http from '@/http/api.js';
  71. export default {
  72. components: {
  73. uNavBar,
  74. uList,
  75. uListItem,
  76. uIcons,
  77. uGroup,
  78. uSection,
  79. },
  80. onLoad(option) {
  81. this.planId = option.id;
  82. this.getProjectTree();
  83. },
  84. data() {
  85. return {
  86. planId: 0,
  87. orgId: '',
  88. projectId: '',
  89. list: [],
  90. title: '待巡检测站列表',
  91. desc: '',
  92. pageSize: 10,
  93. // 当前页
  94. pageCurrent: 1,
  95. // 数据总量
  96. total: 0,
  97. projectTree: [],
  98. selectedTreeNode: '',
  99. searchVal: '',
  100. }
  101. },
  102. computed: {
  103. getIcon() {
  104. return path => {
  105. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  106. }
  107. },
  108. },
  109. onShow() {
  110. // uni.setNavigationBarTitle({
  111. // title: ""
  112. // });
  113. //this.getProjectTree();
  114. this.getRtuList();
  115. },
  116. methods: {
  117. toBack() {
  118. uni.navigateBack({
  119. delta: 1
  120. })
  121. },
  122. // 分页触发
  123. change(e) {
  124. //this.$refs.table.clearSelection()
  125. //this.selectedIndexs.length = 0
  126. this.pageCurrent = e.current;
  127. this.getRtuList()
  128. },
  129. onnodeclick(node) {
  130. this.orgId = node.orgId;
  131. this.projectId = node.projectId;
  132. console.log('1111111orgId:', this.orgId);
  133. console.log('1111111projectId:', this.projectId);
  134. },
  135. onpopupopened(e) {
  136. //console.log('popupopened');
  137. },
  138. onpopupclosed(e) {
  139. // console.log('popupclosed');
  140. },
  141. onchange(e) {
  142. console.log('onchange:', e.detail.value);
  143. this.searchVal = '';
  144. this.pageCurrent = 1;
  145. // this.orgId = e.detail.orgId;
  146. // this.projectId = e.detail.projectId;
  147. // if (e.detail.value.length > 0) {
  148. // let ids = this.selectedTreeNode.split("-");
  149. // this.orgId = ids[0];
  150. // if (ids[1] === '0') {
  151. // this.projectId = '';
  152. // } else {
  153. // this.projectId = ids[1];
  154. // }
  155. // console.log('1111111orgId:', this.orgId);
  156. // console.log('1111111projectId:', this.projectId);
  157. // } else {
  158. // this.orgId = '';
  159. // this.projectId = '';
  160. // }
  161. this.getRtuList();
  162. },
  163. search(res) {
  164. // uni.showToast({
  165. // title: '搜索:' + res.value,
  166. // icon: 'none'
  167. // })
  168. this.getRtuList();
  169. },
  170. input(res) {
  171. // console.log('----input:', res)
  172. },
  173. clear(res) {
  174. // uni.showToast({
  175. // title: 'clear事件,清除值为:' + res.value,
  176. // icon: 'none'
  177. // })
  178. this.searchVal = '';
  179. this.getRtuList();
  180. },
  181. blur(res) {
  182. // uni.showToast({
  183. // title: 'blur事件,输入值为:' + res.value,
  184. // icon: 'none'
  185. // })
  186. },
  187. focus(e) {
  188. // uni.showToast({
  189. // title: 'focus事件,输出值为:' + e.value,
  190. // icon: 'none'
  191. // })
  192. },
  193. cancel(res) {
  194. // uni.showToast({
  195. // title: '点击取消,输入值为:' + res.value,
  196. // icon: 'none'
  197. // })
  198. this.searchVal = '';
  199. this.getRtuList();
  200. },
  201. onBackPress() {
  202. // #ifdef APP-PLUS
  203. plus.key.hideSoftKeybord();
  204. // #endif
  205. },
  206. getProjectTree() {
  207. var that = this;
  208. http.request({
  209. url: '/galaxy-test/rtu/manage/tree',
  210. method: 'GET',
  211. }).then(res => {
  212. console.log(res)
  213. if (res.data != null) {
  214. that.projectTree = res.data;
  215. console.log("ffffffff " + that.projectTree[0].orgId)
  216. that.selectedTreeNode = that.projectTree[0].value;
  217. that.orgId = that.projectTree[0].orgId;
  218. that.projectId = that.projectTree[0].projectId;
  219. that.getRtuList();
  220. }
  221. }).catch(err => {
  222. console.log(err)
  223. })
  224. },
  225. getRtuList(res) {
  226. // uni.showToast({
  227. // title: '搜索:' + res.value,
  228. // icon: 'none'
  229. // })
  230. this.getRtuList();
  231. },
  232. getRtuList() {
  233. var that = this;
  234. const current = this.pageCurrent;
  235. const size = this.pageSize;
  236. const isSubmit = '0';
  237. var postData = {};
  238. postData['id'] = this.planId;
  239. postData['orgId'] = this.orgId;
  240. postData['projectId'] = this.projectId;
  241. console.log(postData)
  242. http.request({
  243. url: '/galaxy-test/equipment/inspection/plan/rtu/page',
  244. method: 'GET',
  245. params: {
  246. current,
  247. size,
  248. isSubmit
  249. },
  250. data: postData,
  251. }).then(res => {
  252. console.log(res)
  253. if (res.data.records != null) {
  254. that.list = res.data.records;
  255. }
  256. this.total = res.data.total;
  257. }).catch(err => {
  258. console.log(err)
  259. })
  260. },
  261. openPage(rtuCode) {
  262. var url = '/pages/equipment-inspection/equipmentinspectionreport?planId=' + this.planId +
  263. '&rtuCode=' +
  264. rtuCode;
  265. uni.navigateTo({
  266. url: url
  267. })
  268. },
  269. toPlanClose(id) {
  270. },
  271. }
  272. }
  273. </script>
  274. <style>
  275. /* page {
  276. background-color: rgb(240, 242, 244);
  277. } */
  278. </style>
  279. <style lang="scss" scoped>
  280. .container {
  281. padding: 0 0 150rpx;
  282. }
  283. .u-cell-icon {
  284. width: 36rpx;
  285. height: 36rpx;
  286. margin-right: 8rpx;
  287. }
  288. .slot-box {
  289. /* #ifndef APP-NVUE */
  290. display: flex;
  291. /* #endif */
  292. flex-direction: row;
  293. align-items: center;
  294. }
  295. .slot-image {
  296. /* #ifndef APP-NVUE */
  297. display: block;
  298. /* #endif */
  299. margin-right: 10px;
  300. width: 30px;
  301. height: 30px;
  302. }
  303. .slot-text {
  304. flex: 1;
  305. font-size: 14px;
  306. color: #4cd964;
  307. margin-right: 10px;
  308. }
  309. .content-box {
  310. flex: 1;
  311. /* #ifdef APP-NVUE */
  312. justify-content: center;
  313. /* #endif */
  314. height: 100%;
  315. line-height: 44px;
  316. padding: 0 15px;
  317. position: relative;
  318. background-color: #fff;
  319. border-bottom-color: #f5f5f5;
  320. border-bottom-width: 1px;
  321. border-bottom-style: solid;
  322. }
  323. .content-text {
  324. font-size: 15px;
  325. }
  326. .example-body {
  327. /* #ifndef APP-NVUE */
  328. display: flex;
  329. /* #endif */
  330. flex-direction: row;
  331. justify-content: center;
  332. padding: 10px 0;
  333. background-color: #fff;
  334. }
  335. .button {
  336. border-color: #e5e5e5;
  337. border-style: solid;
  338. border-width: 1px;
  339. padding: 4px 8px;
  340. border-radius: 4px;
  341. }
  342. .button-text {
  343. font-size: 15px;
  344. }
  345. .slot-button {
  346. /* #ifndef APP-NVUE */
  347. display: flex;
  348. height: 100%;
  349. /* #endif */
  350. flex: 1;
  351. flex-direction: row;
  352. justify-content: center;
  353. align-items: center;
  354. padding: 0 20px;
  355. background-color: #ff5a5f;
  356. }
  357. .slot-button-text {
  358. color: #ffffff;
  359. font-size: 14px;
  360. }
  361. </style>