repairsFilter.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
  3. <view class="container_form">
  4. <view class="category">
  5. <text class="name">状态</text>
  6. <text class="value">
  7. <uni-data-picker @change="categoryChange" v-model="searchData.category" :localdata="pageData.categoryList" popup-title="请选择状态" :map="{text:'category',value:'id'}">
  8. </uni-data-picker>
  9. </text>
  10. </view>
  11. <view class="category">
  12. <label class="uni-list-cell uni-list-cell-pd">
  13. <text class="name">待评价</text>
  14. <checkbox value="1" color="#49b856" :checked="searchData.evaluate" />
  15. </label>
  16. </view>
  17. </view>
  18. <view class="container_foot">
  19. <view class="clear" @click="clear">清除选项</view>
  20. <view class="foot_btns">
  21. <view class="cancel" @click="cancel">取消</view>
  22. <view class="confirm" @click="confirm">确认</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="mask" @touchmove.stop.prevent></view>
  27. <view class="line" @touchmove.stop.prevent></view>
  28. </template>
  29. <script setup>
  30. import { defineEmits, ref, reactive, defineProps } from 'vue'
  31. import { onLoad } from '@dcloudio/uni-app'
  32. import { useLoginUserStore } from '@/stores/loginUser'
  33. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  34. import { api_area, api_incidentcategory } from "@/http/api.js"
  35. import { transform } from '@/utils/index.js'
  36. const emit = defineEmits(['cancelEmit', 'confirmEmit']);
  37. const loginUserStore = useLoginUserStore();
  38. const repositorySearchStore = repositoryListSearchStore();
  39. // 页面数据
  40. const pageData = reactive({
  41. pageRouter: 'default',
  42. areaList: [],
  43. categoryList: [],
  44. });
  45. const searchData = reactive({
  46. evaluate:false,
  47. hospital: {},
  48. selected: 'todoingAll',
  49. area: {id: 0, area: '全部'},
  50. category: {},
  51. acceptDate: [],
  52. categoryChangeData:[]
  53. })
  54. // 清空
  55. function clear(){
  56. searchData.category = {};
  57. searchData.acceptDate = [];
  58. searchData.evaluate = false;
  59. searchData.categoryChangeData = [];
  60. repositorySearchStore.clearRepositoryListSearchData()
  61. }
  62. // 取消
  63. function cancel(){
  64. emit('cancelEmit')
  65. }
  66. // 确认
  67. function confirm(){
  68. repositorySearchStore.setRepositoryListSearchData(searchData)
  69. emit('confirmEmit', searchData);
  70. }
  71. function categoryChange(val){
  72. searchData.categoryChangeData = val.detail.value
  73. }
  74. // 获取故障现象列表
  75. function getCategoryList(){
  76. uni.showLoading({
  77. title: "加载中",
  78. mask: true,
  79. });
  80. let postData = {
  81. idx: 0,
  82. sum: 9999,
  83. incidentcategory: {
  84. },
  85. }
  86. if(loginUserStore.loginUser.user.duty){
  87. postData.incidentcategory.duty = loginUserStore.loginUser.user.duty.id;
  88. }else if(loginUserStore.loginUser.user.branch){
  89. postData.incidentcategory.branch = loginUserStore.loginUser.user.branch.id;
  90. }
  91. api_incidentcategory(postData).then(res => {
  92. uni.hideLoading();
  93. if(res.status == 200){
  94. let list = res.list || [];
  95. list = list.map(i=> ({...i, parentid: i.parent?.id}))
  96. pageData.categoryList = transform(list, 'id', 'parentid')
  97. }else{
  98. uni.showToast({
  99. icon: 'none',
  100. title: res.msg || '请求数据失败!'
  101. });
  102. }
  103. })
  104. }
  105. // 页面路由跳转
  106. function clickPageRouter(type){
  107. pageData.pageRouter = type;
  108. switch(type){
  109. case 'category':
  110. getCategoryList('one');
  111. break;
  112. }
  113. }
  114. onLoad((option) => {
  115. getCategoryList()
  116. let data = repositorySearchStore.repositorySearch.data
  117. searchData.category = data && data.category;
  118. searchData.title = data && data.title;
  119. searchData.categoryChangeData = data && data.categoryChangeData
  120. searchData.evaluate = data && data.evaluate
  121. })
  122. </script>
  123. <style lang="scss" scoped>
  124. .uni-checkbox-input:hover{
  125. border-color:#49b856;
  126. }
  127. .mask{
  128. position: fixed;
  129. left: 0;
  130. top: 0;
  131. right: 0;
  132. bottom: 0;
  133. background-color: rgba(0, 0, 0, 0.4);
  134. z-index: 999;
  135. }
  136. .line{
  137. content: '';
  138. position: fixed;
  139. top: 0;
  140. left: 0;
  141. z-index: 9999;
  142. height: 8rpx;
  143. width: 100%;
  144. background-color: #EBEBEB;
  145. }
  146. .container{
  147. position: fixed;
  148. left: 125rpx;
  149. top: 0;
  150. right: 0;
  151. bottom: 0;
  152. z-index: 9999;
  153. background-color: #F7F7F7;
  154. display: flex;
  155. flex-direction: column;
  156. justify-content: space-between;
  157. .container_form{
  158. height: 100%;
  159. display: flex;
  160. flex-direction: column;
  161. flex: 1;
  162. min-height: 0;
  163. .item{
  164. padding: 32rpx;
  165. }
  166. }
  167. .hospital{
  168. display: flex;
  169. align-items: center;
  170. padding: 32rpx 24rpx 24rpx;
  171. background-color: #fff;
  172. .name{
  173. font-size: 28rpx;
  174. flex-shrink: 0;
  175. margin-right: 24rpx;
  176. }
  177. .value{
  178. width: 100%;
  179. font-size: 22rpx;
  180. .uni-input{
  181. font-size: 26rpx;
  182. }
  183. }
  184. }
  185. .areas{
  186. flex: 1;
  187. min-height: 0;
  188. margin-top: 16rpx;
  189. background-color: #fff;
  190. .areas_item{
  191. padding: 24rpx;
  192. border-bottom: 1rpx solid #DEDEDE;
  193. }
  194. }
  195. .categorys{
  196. flex: 1;
  197. min-height: 0;
  198. margin-top: 16rpx;
  199. background-color: #fff;
  200. .categorys_item{
  201. padding: 24rpx;
  202. border-bottom: 1rpx solid #DEDEDE;
  203. }
  204. }
  205. .tabs{
  206. margin-top: 16rpx;
  207. background-color: #FBFBFB;
  208. display: flex;
  209. flex-wrap: wrap;
  210. justify-content: space-between;
  211. gap: 16rpx 0;
  212. padding: 24rpx 16rpx;
  213. .tab{
  214. width: 180rpx;
  215. height: 60rpx;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. background-color: #F7F7F7;
  220. font-size: 28rpx;
  221. position: relative;
  222. .newicon-xuanzejiaobiao{
  223. opacity: 0;
  224. position: absolute;
  225. right: 0;
  226. bottom: 0;
  227. font-size: 38rpx;
  228. color: #53B9BB;
  229. }
  230. &.active{
  231. background-color: rgba(149, 220, 231, 0.30);
  232. .newicon-xuanzejiaobiao{
  233. opacity: 1;
  234. }
  235. }
  236. }
  237. }
  238. .area,
  239. .category,
  240. .acceptDate{
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. padding: 24rpx;
  245. background-color: #fff;
  246. margin-top: 24rpx;
  247. .name{
  248. font-size: 28rpx;
  249. flex-shrink: 0;
  250. margin-right: 24rpx;
  251. }
  252. .value{
  253. flex:1;
  254. }
  255. }
  256. .container_foot{
  257. .clear{
  258. padding: 24rpx;
  259. font-size: 28rpx;
  260. background-color: #fff;
  261. margin: 0 16rpx;
  262. display: flex;
  263. align-items: center;
  264. justify-content: center;
  265. }
  266. .foot_btns{
  267. margin-top: 24rpx;
  268. display: flex;
  269. border-top: 1rpx solid #BFBFBF;
  270. .cancel{
  271. flex: 1;
  272. background-color: #fff;
  273. font-size: 32rpx;
  274. padding: 24rpx;
  275. display: flex;
  276. justify-content: center;
  277. }
  278. .confirm{
  279. flex: 1;
  280. font-size: 32rpx;
  281. padding: 24rpx;
  282. background-color: $uni-primary;
  283. display: flex;
  284. justify-content: center;
  285. color: #fff;
  286. }
  287. }
  288. }
  289. }
  290. </style>