repositoryFilter.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
  3. <view class="container_form">
  4. <view class="hospital">
  5. <text class="name">标题</text>
  6. <text class="value ellipsis">
  7. <input class="uni-input" v-model="searchData.title" placeholder="请输入标题" />
  8. </text>
  9. </view>
  10. <view class="category">
  11. <text class="name">故障现象</text>
  12. <text class="value">
  13. <uni-data-picker @change="categoryChange" v-model="searchData.category" :localdata="pageData.categoryList" popup-title="请选择故障信息" :map="{text:'category',value:'id'}">
  14. </uni-data-picker>
  15. </text>
  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. title:'',
  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.title = '';
  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. hasThird:true,
  82. category: {
  83. dutyIds: loginUserStore.loginUser.user.currentHospital.id,
  84. },
  85. }
  86. api_incidentcategory(postData).then(res => {
  87. uni.hideLoading();
  88. if(res.status == 200){
  89. let list = res.data || [];
  90. list = list.map(i=> ({...i, parentid: i.parent?.id}))
  91. pageData.categoryList = transform(list, 'id', 'parentid')
  92. }else{
  93. uni.showToast({
  94. icon: 'none',
  95. title: res.msg || '请求数据失败!'
  96. });
  97. }
  98. })
  99. }
  100. // 页面路由跳转
  101. function clickPageRouter(type){
  102. pageData.pageRouter = type;
  103. switch(type){
  104. case 'category':
  105. getCategoryList('one');
  106. break;
  107. }
  108. }
  109. onLoad((option) => {
  110. getCategoryList()
  111. let data = repositorySearchStore.repositorySearch.data
  112. searchData.category = data && data.category;
  113. searchData.title = data && data.title;
  114. searchData.categoryChangeData = data && data.categoryChangeData
  115. })
  116. </script>
  117. <style lang="scss" scoped>
  118. .mask{
  119. position: fixed;
  120. left: 0;
  121. top: 0;
  122. right: 0;
  123. bottom: 0;
  124. background-color: rgba(0, 0, 0, 0.4);
  125. z-index: 999;
  126. }
  127. .line{
  128. content: '';
  129. position: fixed;
  130. top: 0;
  131. left: 0;
  132. z-index: 9999;
  133. height: 8rpx;
  134. width: 100%;
  135. background-color: #EBEBEB;
  136. }
  137. .container{
  138. position: fixed;
  139. left: 125rpx;
  140. top: 0;
  141. right: 0;
  142. bottom: 0;
  143. z-index: 9999;
  144. background-color: #F7F7F7;
  145. display: flex;
  146. flex-direction: column;
  147. justify-content: space-between;
  148. .container_form{
  149. height: 100%;
  150. display: flex;
  151. flex-direction: column;
  152. flex: 1;
  153. min-height: 0;
  154. .item{
  155. padding: 32rpx;
  156. }
  157. }
  158. .hospital{
  159. display: flex;
  160. align-items: center;
  161. padding: 32rpx 24rpx 24rpx;
  162. background-color: #fff;
  163. .name{
  164. font-size: 28rpx;
  165. flex-shrink: 0;
  166. margin-right: 24rpx;
  167. }
  168. .value{
  169. width: 100%;
  170. font-size: 22rpx;
  171. .uni-input{
  172. font-size: 26rpx;
  173. }
  174. }
  175. }
  176. .areas{
  177. flex: 1;
  178. min-height: 0;
  179. margin-top: 16rpx;
  180. background-color: #fff;
  181. .areas_item{
  182. padding: 24rpx;
  183. border-bottom: 1rpx solid #DEDEDE;
  184. }
  185. }
  186. .categorys{
  187. flex: 1;
  188. min-height: 0;
  189. margin-top: 16rpx;
  190. background-color: #fff;
  191. .categorys_item{
  192. padding: 24rpx;
  193. border-bottom: 1rpx solid #DEDEDE;
  194. }
  195. }
  196. .tabs{
  197. margin-top: 16rpx;
  198. background-color: #FBFBFB;
  199. display: flex;
  200. flex-wrap: wrap;
  201. justify-content: space-between;
  202. gap: 16rpx 0;
  203. padding: 24rpx 16rpx;
  204. .tab{
  205. width: 180rpx;
  206. height: 60rpx;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. background-color: #F7F7F7;
  211. font-size: 28rpx;
  212. position: relative;
  213. .newicon-xuanzejiaobiao{
  214. opacity: 0;
  215. position: absolute;
  216. right: 0;
  217. bottom: 0;
  218. font-size: 38rpx;
  219. color: #53B9BB;
  220. }
  221. &.active{
  222. background-color: rgba(149, 220, 231, 0.30);
  223. .newicon-xuanzejiaobiao{
  224. opacity: 1;
  225. }
  226. }
  227. }
  228. }
  229. .area,
  230. .category,
  231. .acceptDate{
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. padding: 24rpx;
  236. background-color: #fff;
  237. margin-top: 24rpx;
  238. .name{
  239. font-size: 28rpx;
  240. flex-shrink: 0;
  241. margin-right: 24rpx;
  242. }
  243. .value{
  244. flex:1;
  245. }
  246. }
  247. .container_foot{
  248. .clear{
  249. padding: 24rpx;
  250. font-size: 28rpx;
  251. background-color: #fff;
  252. margin: 0 16rpx;
  253. display: flex;
  254. align-items: center;
  255. justify-content: center;
  256. }
  257. .foot_btns{
  258. margin-top: 24rpx;
  259. display: flex;
  260. border-top: 1rpx solid #BFBFBF;
  261. .cancel{
  262. flex: 1;
  263. background-color: #fff;
  264. font-size: 32rpx;
  265. padding: 24rpx;
  266. display: flex;
  267. justify-content: center;
  268. }
  269. .confirm{
  270. flex: 1;
  271. font-size: 32rpx;
  272. padding: 24rpx;
  273. background-color: $uni-primary;
  274. display: flex;
  275. justify-content: center;
  276. color: #fff;
  277. }
  278. }
  279. }
  280. }
  281. </style>