QueryView.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="query-view">
  3. <view class="query-content" :style="contentStyle">
  4. <view class="query-left">
  5. <InputCom
  6. ref="orderNoRef"
  7. title="任务单号:"
  8. type="orderNo"
  9. :text-style="{ width: '100px' }"
  10. :style="{ marginLeft: 0 }"
  11. @change="handleChange('orderNo', $event)"
  12. />
  13. <CheckNatureCom
  14. ref="checkTypeRef"
  15. title="检验性质:"
  16. type="checkType"
  17. :equip-type="equipType"
  18. :text-style="{ width: '100px' }"
  19. :style="{ marginLeft: 0 }"
  20. @change="handleChange('checkType', $event)"
  21. />
  22. <CheckDateCom
  23. ref="checkDateRef"
  24. title="检验时间:"
  25. type="checkDate"
  26. :text-style="{ width: '100px' }"
  27. :style="{ marginLeft: 0 }"
  28. @change="handleChange('checkDate', $event)"
  29. />
  30. <CellCom
  31. ref="mainCheckerStrIdsRef"
  32. title="主检人:"
  33. type="mainCheckerStrIds"
  34. :text-style="{ width: '100px' }"
  35. :style="{ marginLeft: 0, marginBottom: 0 }"
  36. @click="showUserListPopup('主检人', 'mainCheckerStrIds')"
  37. />
  38. <CellCom
  39. ref="managerIdRef"
  40. title="项目负责人:"
  41. type="managerId"
  42. :text-style="{ width: '100px' }"
  43. :style="{ marginLeft: 0, marginBottom: 0 }"
  44. @click="showUserListPopup('项目负责人', 'managerId')"
  45. />
  46. </view>
  47. <view class="query-right">
  48. <CellCom
  49. ref="queryTypeRef"
  50. :title="queryTypeTitle"
  51. type="queryType"
  52. :text-style="{ width: '100px' }"
  53. :style="{ marginLeft: 0 }"
  54. :default-value="defaultValue"
  55. @click="showUserListPopup(queryTypeTitle, 'queryType')"
  56. />
  57. <InputCom
  58. v-if="equipType === EquipmentType.BOILER || equipType === EquipmentType.CONTAINER"
  59. ref="equipCodeRef"
  60. title="设备注册代码:"
  61. type="equipCode"
  62. :text-style="{ width: '100px' }"
  63. :style="{ marginLeft: 0 }"
  64. @change="handleChange('equipCode', $event)"
  65. />
  66. <InputCom
  67. v-if="equipType === EquipmentType.PIPE"
  68. ref="projectNoRef"
  69. title="工程号:"
  70. type="projectNo"
  71. :text-style="{ width: '100px' }"
  72. :style="{ marginLeft: 0 }"
  73. @change="handleChange('projectNo', $event)"
  74. />
  75. <InputCom
  76. ref="unitNameRef"
  77. title="单位名称:"
  78. type="unitName"
  79. :text-style="{ width: '100px' }"
  80. :style="{ marginLeft: 0 }"
  81. @change="handleChange('unitName', $event)"
  82. />
  83. <CellCom
  84. ref="checkUserStrIdsRef"
  85. title="检验员:"
  86. type="checkUserStrIds"
  87. :text-style="{ width: '100px' }"
  88. :style="{ marginLeft: 0, marginBottom: 0 }"
  89. @click="showUserListPopup('检验员', 'checkUserStrIds')"
  90. />
  91. <view class="btn-group">
  92. <button class="btn reset-btn" @click="reset">重置</button>
  93. <button class="btn query-btn" @click="query">查询</button>
  94. </view>
  95. </view>
  96. </view>
  97. <view class="query-toggle" @click="toggleFilter">
  98. <text class="query-toggle-text">查询</text>
  99. <image
  100. class="arrow-icon"
  101. :src="iconMap.ArrowDown"
  102. :class="{ 'arrow-rotate': isOpen }"
  103. />
  104. </view>
  105. </view>
  106. </template>
  107. <script lang="ts" setup>
  108. import { ref, reactive, computed } from 'vue'
  109. import { useUserStore } from '@/store/user'
  110. import iconMap from '@/utils/imagesMap'
  111. import { EquipmentType } from '@/utils/dictMap'
  112. import { InputCom } from '@/components/QueryViewItem'
  113. import { CheckDateCom } from '@/components/QueryViewItem'
  114. import { CheckNatureCom } from '@/components/QueryViewItem'
  115. import { CellCom } from '@/components/QueryViewItem'
  116. interface Props {
  117. equipType: EquipmentType
  118. queryType: { value: string; id: string }
  119. }
  120. const props = defineProps<Props>()
  121. const emit = defineEmits<{
  122. queryAction: [params: Record<string, any>]
  123. }>()
  124. const userStore = useUserStore()
  125. const userInfo = computed(() => userStore.userInfo)
  126. const isOpen = ref(false)
  127. const params = reactive<Record<string, any>>({
  128. orderNo: '',
  129. checkType: '',
  130. mainCheckerStrIds: '',
  131. queryType: '',
  132. checkDate: '',
  133. checkUserStrIds: '',
  134. equipCode: '',
  135. projectNo: '',
  136. unitName: '',
  137. managerId: '',
  138. })
  139. const defaultValue = computed(() => userInfo.value?.nickname || '')
  140. const queryTypeTitle = computed(() => {
  141. return props.queryType.value + ':'
  142. })
  143. const contentStyle = computed(() => ({
  144. height: isOpen.value ? '220px' : '0',
  145. opacity: isOpen.value ? 1 : 0,
  146. overflow: 'hidden',
  147. transition: 'all 0.3s',
  148. }))
  149. const orderNoRef = ref<any>(null)
  150. const checkTypeRef = ref<any>(null)
  151. const checkDateRef = ref<any>(null)
  152. const mainCheckerStrIdsRef = ref<any>(null)
  153. const managerIdRef = ref<any>(null)
  154. const queryTypeRef = ref<any>(null)
  155. const equipCodeRef = ref<any>(null)
  156. const projectNoRef = ref<any>(null)
  157. const unitNameRef = ref<any>(null)
  158. const checkUserStrIdsRef = ref<any>(null)
  159. const toggleFilter = () => {
  160. isOpen.value = !isOpen.value
  161. }
  162. const handleChange = (propName: string, value: any) => {
  163. params[propName] = value
  164. }
  165. const reset = () => {
  166. orderNoRef.value?.reset()
  167. checkTypeRef.value?.reset()
  168. checkDateRef.value?.reset()
  169. mainCheckerStrIdsRef.value?.reset()
  170. managerIdRef.value?.reset()
  171. queryTypeRef.value?.reset()
  172. equipCodeRef.value?.reset()
  173. projectNoRef.value?.reset()
  174. unitNameRef.value?.reset()
  175. checkUserStrIdsRef.value?.reset()
  176. Object.assign(params, {
  177. orderNo: '',
  178. checkType: '',
  179. mainCheckerStrIds: '',
  180. queryType: '',
  181. checkDate: '',
  182. checkUserStrIds: '',
  183. equipCode: '',
  184. projectNo: '',
  185. unitName: '',
  186. managerId: '',
  187. })
  188. emit('queryAction', params)
  189. }
  190. const query = () => {
  191. Object.assign(params, {
  192. checkType: checkTypeRef.value?.inputContent,
  193. checkDate: checkDateRef.value?.inputContent,
  194. queryType: userInfo.value?.id || '',
  195. })
  196. emit('queryAction', params)
  197. }
  198. const showUserListPopup = (title: string, type: string) => {
  199. console.log('显示用户列表弹窗:', title, type)
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .query-view {
  204. width: 100%;
  205. background-color: #fff;
  206. }
  207. .query-content {
  208. display: flex;
  209. flex-direction: row;
  210. flex-wrap: wrap;
  211. justify-content: space-between;
  212. padding: 0 15px;
  213. }
  214. .query-left,
  215. .query-right {
  216. flex: 1;
  217. padding: 15px 0;
  218. }
  219. .query-right {
  220. margin-left: 10px;
  221. }
  222. .btn-group {
  223. display: flex;
  224. flex-direction: row;
  225. justify-content: flex-end;
  226. margin-top: 10px;
  227. padding: 0 10%;
  228. gap: 10%;
  229. }
  230. .btn {
  231. padding: 0 15px;
  232. height: 30px;
  233. margin-left: 5px;
  234. border-radius: 3px;
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. font-size: 15px;
  239. border: none;
  240. }
  241. .reset-btn {
  242. background-color: #fff;
  243. color: rgb(47, 142, 255);
  244. border: 1px solid rgb(47, 142, 255);
  245. }
  246. .query-btn {
  247. background-color: rgb(47, 142, 255);
  248. color: rgb(222, 238, 255);
  249. }
  250. .query-toggle {
  251. display: flex;
  252. flex-direction: row;
  253. justify-content: space-between;
  254. align-items: center;
  255. padding: 0 20px;
  256. height: 60px;
  257. border-top: 1px solid rgba(187, 187, 187, 0.8);
  258. }
  259. .query-toggle-text {
  260. color: rgb(51, 51, 51);
  261. font-size: 16px;
  262. }
  263. .arrow-icon {
  264. width: 21px;
  265. height: 21px;
  266. transition: transform 0.3s;
  267. }
  268. .arrow-rotate {
  269. transform: rotate(180deg);
  270. }
  271. </style>