patrolPlanAddMember.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <!-- 安全检查-发起巡查计划-巡查组 -->
  2. <template>
  3. <view class="examine">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view>
  6. <view class="lab_title">
  7. <view class="lab_title_n">
  8. <input type="text" v-model="getData.searchValue" placeholder="请输入巡查组名称" name="search"
  9. @confirm='searchBtn' confirm-type='search' maxlength="50"
  10. placeholder-style="color: #CCCCCC;font-size:26rpx;">
  11. <view class="lab_title_r_btn" v-if="getData.searchValue>0" @click="clearBtn">
  12. <img src="@/pages_safetyExamine/images/clear.png" />
  13. </view>
  14. </view>
  15. </view>
  16. <view class="list">
  17. <view class="list_li" v-for="(item,index) in dataList" :key="index" @click="labSelete(index)">
  18. <text :class="item.type?'color_B':'color_A'">{{item.groupName}}</text>
  19. <img v-if="item.type" src="@/pages_safetyExamine/images/icon_xzwt_xz.png">
  20. </view>
  21. </view>
  22. </view>
  23. </scroll-view>
  24. <view class="bottom_btn" @click="submitForm">保存</view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. config
  30. } from '@/api/request/config.js'
  31. import {
  32. checkGroupList,
  33. checkGroupDetail
  34. } from '@/pages_safetyExamine/api/index.js'
  35. export default {
  36. name: "rectifyList",
  37. components: {
  38. },
  39. data() {
  40. return {
  41. pageType: 0,
  42. //列表请求参数
  43. getData: {
  44. checkLevel: '0',
  45. searchValue: '',
  46. checkLevel: '',
  47. },
  48. total: 0,
  49. dataList: [],
  50. seleteListMember: [], //临时存储选中巡查组
  51. checkMemberDtoList: [], //临时存储选中的
  52. form: {},
  53. }
  54. },
  55. onLoad(option) {
  56. if (option.form) {
  57. this.form = JSON.parse(decodeURIComponent(option.form));
  58. if (this.form.seleteListMember.length > 0) {
  59. this.seleteListMember = this.form.seleteListMember;
  60. }
  61. this.getData.checkLevel = this.form.groupDataType
  62. }
  63. if (option.pageType) { //pageType=1添加页面进入2编辑页面进入
  64. this.pageType = option.pageType
  65. }
  66. },
  67. onShow() {
  68. this.dataList = [];
  69. this.getList();
  70. },
  71. mounted() {
  72. },
  73. methods: {
  74. //滚动事件
  75. scrollGet() {
  76. let self = this;
  77. if (self.total <= self.getData.pageNum) {
  78. console.log('没有更多数据!')
  79. } else {
  80. setTimeout(function() {
  81. self.getData.pageNum += 1;
  82. self.getList();
  83. }, 1000)
  84. }
  85. },
  86. //点击选择实验室
  87. labSelete(index) {
  88. let _this = this;
  89. this.seleteListMember = [];
  90. this.dataList[index].type = !this.dataList[index].type
  91. if (_this.dataList[index].type == true) {
  92. _this.dataList.forEach(function(item2) {
  93. if (item2.id == _this.dataList[index].id) {
  94. item2.type = true
  95. } else {
  96. item2.type = false
  97. }
  98. })
  99. }
  100. this.seleteListMember.push(this.dataList[index])
  101. },
  102. //实验室搜索
  103. searchBtn() {
  104. this.dataList = [];
  105. this.getList();
  106. },
  107. //清除按钮
  108. clearBtn() {
  109. this.getData.pageNum = 1;
  110. this.getData.searchValue = '';
  111. this.dataList = [];
  112. this.getList();
  113. },
  114. handleClick(doType) {
  115. let self = this;
  116. if (doType == 'subBtn') { //保存数据
  117. }
  118. },
  119. //巡查组-保存
  120. async submitForm() {
  121. let _this = this;
  122. console.log(this.seleteListMember)
  123. let id = this.seleteListMember[0].id
  124. this.form.checkMemberDtoList = [];
  125. this.$set(this.form, 'checkGroupId', this.seleteListMember[0].id)
  126. this.$set(this.form, 'checkGroupName', this.seleteListMember[0].groupName)
  127. const {
  128. data
  129. } = await checkGroupDetail({
  130. id: id,
  131. selectEnable: '1'
  132. });
  133. if (data.code == 200) {
  134. let obj = {};
  135. for (let i = 0; i < data.data.checkGroupMemberList.length; i++) {
  136. obj = {
  137. "deptId": data.data.checkGroupMemberList[i].deptId,
  138. "deptName": data.data.checkGroupMemberList[i].deptName,
  139. "enable": data.data.checkGroupMemberList[i].enable,
  140. "jobNum": data.data.checkGroupMemberList[i].jobNum,
  141. "name": data.data.checkGroupMemberList[i].name,
  142. "userId": data.data.checkGroupMemberList[i].userId,
  143. "userType": data.data.checkGroupMemberList[i].userType
  144. }
  145. this.form.checkMemberDtoList.push(obj)
  146. }
  147. let pages = getCurrentPages();
  148. let prevPage = pages[pages.length - 2]; //上一个页面
  149. prevPage.onShow(encodeURIComponent(JSON.stringify(this.form)))
  150. uni.navigateBack()
  151. }
  152. },
  153. async getList() {
  154. let _this = this;
  155. const {
  156. data
  157. } = await checkGroupList(_this.getData);
  158. if (data.code == 200) {
  159. if (data.data) {
  160. data.data.forEach(function(item) {
  161. item.type = false
  162. })
  163. }
  164. this.dataList = [...this.dataList, ...data.data]
  165. //如果有选中的数据
  166. if (this.seleteListMember.length > 0) {
  167. for (let i = 0; i < this.dataList.length; i++) {
  168. if (this.seleteListMember[0].id == this.dataList[i].id) {
  169. this.dataList[i].type = true;
  170. }
  171. }
  172. }
  173. this.total = data.data.total;
  174. }
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="stylus" scoped>
  180. .examine {
  181. height: 100%;
  182. display flex;
  183. .info-max-box {
  184. flex: 1;
  185. overflow: scroll;
  186. padding: 120rpx 0rpx 30rpx;
  187. box-sizing: border-box;
  188. }
  189. .lab_title {
  190. width: 750rpx;
  191. height: 100rpx;
  192. background: #FFFFFF;
  193. position: fixed;
  194. top: 0;
  195. padding: 10rpx 30rpx;
  196. box-sizing: border-box;
  197. .lab_title_n {
  198. width: 690rpx;
  199. height: 80rpx;
  200. position: relative;
  201. border-radius: 10rpx;
  202. border: 1rpx solid #E0E0E0;
  203. .lab_title_r_btn {
  204. width: 60rpx;
  205. height: 80rpx;
  206. position: absolute;
  207. top: 0rpx;
  208. right: 0rpx;
  209. >img {
  210. width: 20rpx;
  211. height: 20rpx;
  212. position: absolute;
  213. top: 30rpx;
  214. left: 24rpx;
  215. }
  216. }
  217. >input {
  218. width: 360rpx;
  219. height: 80rpx;
  220. position: absolute;
  221. top: 0rpx;
  222. left: 60rpx;
  223. }
  224. }
  225. }
  226. .list {
  227. background: #FFFFFF;
  228. border-radius: 20rpx 20rpx 0rpx 0rpx;
  229. padding: 0 30rpx;
  230. box-sizing: border-box;
  231. margin: 0 30rpx;
  232. .list_li {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. height: 80rpx;
  237. border-bottom: 1rpx solid #E0E0E0;
  238. >text {
  239. font-size: 28rpx;
  240. font-family: PingFang SC-Medium, PingFang SC;
  241. font-weight: 400;
  242. line-height: 80rpx;
  243. overflow: hidden;
  244. text-overflow: ellipsis;
  245. white-space: nowrap;
  246. }
  247. >img {
  248. width: 24rpx;
  249. height: 16rpx;
  250. margin-right: 14rpx;
  251. }
  252. }
  253. .list_li:last-child {
  254. border: none;
  255. }
  256. .color_A {
  257. color: #333333;
  258. }
  259. .color_B {
  260. color: #0183FA;
  261. }
  262. }
  263. .bottom_btn {
  264. position: fixed;
  265. bottom: 26rpx;
  266. left: 30rpx;
  267. font-size: 30rpx;
  268. font-family: PingFang SC-Medium, PingFang SC;
  269. font-weight: 400;
  270. color: #FFFFFF;
  271. line-height: 90rpx;
  272. width: 690rpx;
  273. height: 90rpx;
  274. background: #0183FA;
  275. border-radius: 20rpx;
  276. text-align: center;
  277. }
  278. }
  279. </style>