patrolPlanAddMember.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. // if(this.dataList[index].type){//判断是选中还是取消
  102. // this.seleteListMember.push(this.dataList[index])
  103. // }else{
  104. // this.seleteListMember=[];
  105. // }
  106. },
  107. //实验室搜索
  108. searchBtn() {
  109. this.dataList = [];
  110. this.getList();
  111. },
  112. //清除按钮
  113. clearBtn() {
  114. this.getData.pageNum = 1;
  115. this.getData.searchValue = '';
  116. this.dataList = [];
  117. this.getList();
  118. },
  119. handleClick(doType) {
  120. let self = this;
  121. if (doType == 'subBtn') { //保存数据
  122. }
  123. },
  124. //巡查组-保存
  125. async submitForm() {
  126. let _this = this;
  127. console.log(this.seleteListMember)
  128. let id = this.seleteListMember[0].id
  129. this.form.checkMemberDtoList = [];
  130. this.$set(this.form, 'checkGroupId', this.seleteListMember[0].id)
  131. this.$set(this.form, 'checkGroupName', this.seleteListMember[0].groupName)
  132. const {
  133. data
  134. } = await checkGroupDetail({
  135. id: id,
  136. selectEnable: '1'
  137. });
  138. if (data.code == 200) {
  139. let obj = {};
  140. for (let i = 0; i < data.data.checkGroupMemberList.length; i++) {
  141. obj = {
  142. "deptId": data.data.checkGroupMemberList[i].deptId,
  143. "deptName": data.data.checkGroupMemberList[i].deptName,
  144. "enable": data.data.checkGroupMemberList[i].enable,
  145. "jobNum": data.data.checkGroupMemberList[i].jobNum,
  146. "name": data.data.checkGroupMemberList[i].name,
  147. "userId": data.data.checkGroupMemberList[i].userId,
  148. "userType": data.data.checkGroupMemberList[i].userType
  149. }
  150. this.form.checkMemberDtoList.push(obj)
  151. }
  152. let pages = getCurrentPages();
  153. let prevPage = pages[pages.length - 2]; //上一个页面
  154. prevPage.onShow(encodeURIComponent(JSON.stringify(this.form)))
  155. uni.navigateBack()
  156. // if(this.pageType==1){
  157. // uni.redirectTo({
  158. // url: '/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
  159. // });
  160. // }else if(this.pageType==2){
  161. // uni.redirectTo({
  162. // url: '/pages_safetyExamine/patrolPlan/patrolPlanEdit?form='+encodeURIComponent(JSON.stringify(this.form))
  163. // });
  164. // }
  165. }
  166. },
  167. async getList() {
  168. let _this = this;
  169. const {
  170. data
  171. } = await checkGroupList(_this.getData);
  172. if (data.code == 200) {
  173. if (data.data) {
  174. data.data.forEach(function(item) {
  175. item.type = false
  176. })
  177. }
  178. this.dataList = [...this.dataList, ...data.data]
  179. //如果有选中的数据
  180. if (this.seleteListMember.length > 0) {
  181. for (let i = 0; i < this.dataList.length; i++) {
  182. if (this.seleteListMember[0].id == this.dataList[i].id) {
  183. this.dataList[i].type = true;
  184. }
  185. }
  186. }
  187. this.total = data.data.total;
  188. }
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="stylus" scoped>
  194. .examine {
  195. height: 100%;
  196. display flex;
  197. .info-max-box {
  198. flex: 1;
  199. overflow: scroll;
  200. padding: 120rpx 0rpx 30rpx;
  201. box-sizing: border-box;
  202. }
  203. .lab_title {
  204. width: 750rpx;
  205. height: 100rpx;
  206. background: #FFFFFF;
  207. position: fixed;
  208. top: 0;
  209. padding: 10rpx 30rpx;
  210. box-sizing: border-box;
  211. .lab_title_n {
  212. width: 690rpx;
  213. height: 80rpx;
  214. position: relative;
  215. border-radius: 10rpx;
  216. border: 1rpx solid #E0E0E0;
  217. .lab_title_r_btn {
  218. width: 60rpx;
  219. height: 80rpx;
  220. position: absolute;
  221. top: 0rpx;
  222. right: 0rpx;
  223. >img {
  224. width: 20rpx;
  225. height: 20rpx;
  226. position: absolute;
  227. top: 30rpx;
  228. left: 24rpx;
  229. }
  230. }
  231. >input {
  232. width: 360rpx;
  233. height: 80rpx;
  234. position: absolute;
  235. top: 0rpx;
  236. left: 60rpx;
  237. }
  238. }
  239. }
  240. .list {
  241. background: #FFFFFF;
  242. border-radius: 20rpx 20rpx 0rpx 0rpx;
  243. padding: 0 30rpx;
  244. box-sizing: border-box;
  245. margin: 0 30rpx;
  246. .list_li {
  247. display: flex;
  248. justify-content: space-between;
  249. align-items: center;
  250. height: 80rpx;
  251. border-bottom: 1rpx solid #E0E0E0;
  252. >text {
  253. font-size: 28rpx;
  254. font-family: PingFang SC-Medium, PingFang SC;
  255. font-weight: 400;
  256. line-height: 80rpx;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. white-space: nowrap;
  260. }
  261. >img {
  262. width: 24rpx;
  263. height: 16rpx;
  264. margin-right: 14rpx;
  265. }
  266. }
  267. .list_li:last-child {
  268. border: none;
  269. }
  270. .color_A {
  271. color: #333333;
  272. }
  273. .color_B {
  274. color: #0183FA;
  275. }
  276. }
  277. .bottom_btn {
  278. position: fixed;
  279. bottom: 26rpx;
  280. left: 30rpx;
  281. font-size: 30rpx;
  282. font-family: PingFang SC-Medium, PingFang SC;
  283. font-weight: 400;
  284. color: #FFFFFF;
  285. line-height: 90rpx;
  286. width: 690rpx;
  287. height: 90rpx;
  288. background: #0183FA;
  289. border-radius: 20rpx;
  290. text-align: center;
  291. }
  292. }
  293. </style>