details.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="feedback-list-view">
  3. <pub-loading-view :loaded="loaded" height="100%">
  4. <uni-forms ref="formRef" :modelValue="formData" :rules="formRules" label-position="top" label-width="200px">
  5. <view class="feedback-info">
  6. <view class="feedback-info-title">登记人信息</view>
  7. <uni-forms-item label="姓名" name="djr">
  8. <uni-easyinput :disabled="disabledRef" class="pub-input" :inputBorder="false" trim="all"
  9. v-model="formData.djr" placeholder="请输入"></uni-easyinput>
  10. </uni-forms-item>
  11. <uni-forms-item label="联系电话">
  12. <uni-easyinput :disabled="disabledRef" class="pub-input" :inputBorder="false" trim="all"
  13. v-model="formData.lxdh" placeholder="请输入"></uni-easyinput>
  14. </uni-forms-item>
  15. <uni-forms-item label="医疗机构">
  16. <view class="form-feedback" @click="openPickerDept">
  17. <view class="form-feedback-input" :class="popupDeptText?'checked':''">
  18. {{ popupDeptText ? popupDeptText : '请选择'}}
  19. </view>
  20. <view><text class="iconfont checkbox">&#xe656;</text></view>
  21. </view>
  22. <PickerType ref="pickerDeptRef" :feedbackArray="yljgList" :feedbackType="formData.yljgdm"
  23. @change="onChangeYljg" />
  24. </uni-forms-item>
  25. </view>
  26. <view class="feedback-info feedback-formdate">
  27. <uni-forms-item label="反馈类型" name="fklx">
  28. <view class="form-feedback" @click="openPickerType">
  29. <view class="form-feedback-input" :class="popupTypeText?'checked':''">
  30. {{ popupTypeText ? popupTypeText : '请选择'}}
  31. </view>
  32. <view><text class="iconfont checkbox">&#xe656;</text></view>
  33. </view>
  34. <PickerType ref="pickerTypeRef" :feedbackArray="feedbackArray" :feedbackType="formData.fklx"
  35. @change="onChangeType" />
  36. </uni-forms-item>
  37. <uni-forms-item label="反馈详情" name="fkxq">
  38. <uni-easyinput v-if="!disabledRef" :inputBorder="false" trim="all" type="textarea" v-model="formData.fkxq"
  39. placeholder="请输入"></uni-easyinput>
  40. <view v-else class="other-text">{{ formData.fkxq }}</view>
  41. </uni-forms-item>
  42. </view>
  43. </uni-forms>
  44. <view v-if="disabledRef" class="feedback-schedule">
  45. <view class="schedule-title">进度</view>
  46. <view class="schedule-timeline">
  47. <view class="step-item" v-for="(item,index) in timeLine" :key="index">
  48. <view class="step_circle_item">
  49. <view class="dot"></view>
  50. <view class="line"></view>
  51. </view>
  52. <view class="step_content_item">
  53. <view class="step_content">{{ item.desc }}</view>
  54. <view class="step_date">{{ formatDate(item.time,'{y}-{m}-{d} {h}:{i}:{s}')}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </pub-loading-view>
  60. <view v-if="!disabledRef" class="pub-button is-bg large submit" @click="onConfirm">提交</view>
  61. </view>
  62. </template>
  63. <script lang="ts" setup>
  64. import { ref, reactive, computed } from 'vue'
  65. import rest from '@/stores/rest'
  66. import dlg from '@/lib/dlg'
  67. import * as link from '@/lib/link'
  68. import { onLoad, onShow } from "@dcloudio/uni-app";
  69. import PickerType from './PickertType.vue'
  70. import { feedbackVO } from '../../lib/type';
  71. import { formatDate } from '@/lib/util'
  72. import { useUserStore } from '@/lib/store';
  73. const store = useUserStore();
  74. const globalParameter = computed(() => store.getGlobalParameter);
  75. const formRules = reactive({
  76. djr: {
  77. rules: [{
  78. required: true,
  79. errorMessage: '姓名不能为空'
  80. }]
  81. },
  82. fklx: {
  83. rules: [{
  84. required: true,
  85. errorMessage: '反馈类型不能为空'
  86. }]
  87. },
  88. fkxq: {
  89. rules: [{
  90. required: true,
  91. errorMessage: '反馈详情不能为空'
  92. }]
  93. },
  94. })
  95. const feedbackArray = ref([
  96. {
  97. name: '缺药补药',
  98. value: 1,
  99. },
  100. {
  101. name: '审方标准建议',
  102. value: 2,
  103. },
  104. {
  105. name: '其他建议',
  106. value: 3,
  107. },
  108. ])
  109. const itemId = ref()
  110. const disabledRef = ref(false)
  111. const pickerDeptRef = ref()
  112. const popupDeptText = ref()
  113. const yljgList = ref() // 医疗机构列表
  114. const pickerTypeRef = ref()
  115. const uniType = ref('add')
  116. const formRef = ref()
  117. const popupTypeText = ref()
  118. const loaded = ref(false)
  119. const formData = ref({
  120. djr: '',
  121. lxdh: '',
  122. yljgmc: '',
  123. yljgdm: '',
  124. fklx: '',
  125. fkxq: '',
  126. zjhm: '',
  127. })
  128. const timeLine = ref([])
  129. const openPickerDept = () => {
  130. if (!disabledRef.value) {
  131. pickerDeptRef.value?.openPop()
  132. }
  133. }
  134. const openPickerType = () => {
  135. if (!disabledRef.value) {
  136. pickerTypeRef.value?.openPop()
  137. }
  138. }
  139. const onChangeYljg = (e) => {
  140. formData.value.yljgmc = e.name
  141. formData.value.yljgdm = e.value
  142. popupDeptText.value = e.name
  143. }
  144. const onChangeType = (e) => {
  145. formData.value.fklx = e.value
  146. popupTypeText.value = e.name
  147. }
  148. const onConfirm = async () => {
  149. // 校验表单
  150. formRef.value.validate().then(async res => {
  151. // 提交请求
  152. try {
  153. if (uniType.value == 'add') {
  154. await rest.post('/zyyp/feedback/create', formData.value, globalParameter.value.authCode)
  155. dlg.success('已新增反馈登记!')
  156. }
  157. link.back()
  158. } catch (e) {
  159. dlg.error(e)
  160. }
  161. }).catch(err => {
  162. console.log('表单错误信息:', err);
  163. })
  164. }
  165. // 初始化数据
  166. const getInfo = async () => {
  167. try {
  168. formData.value.djr = globalParameter.value.userName
  169. formData.value.zjhm = globalParameter.value.zjhm
  170. // 医疗机构列表
  171. let res = await rest.get('/system/dept/list-all-simple2', { orgType: 1 }, globalParameter.value.authCode)
  172. if (!res) return
  173. // 转换数据
  174. yljgList.value = (res as any[]).map(item => ({
  175. name: item.orgName,
  176. value: item.orgCode,
  177. }));
  178. //
  179. if (itemId.value) {
  180. let itemRes = await rest.get('/zyyp/feedback/get', { id: itemId.value }, globalParameter.value.authCode) as feedbackVO
  181. formData.value = itemRes
  182. popupDeptText.value = itemRes.yljgmc
  183. const matchedItem = feedbackArray.value.find(item => item.value === Number(itemRes.fklx));
  184. popupTypeText.value = matchedItem ? matchedItem.name : '未找到匹配项';
  185. timeLine.value = itemRes.jd
  186. if (itemRes.fkzt == '1') {
  187. timeLine.value.push({ desc: '等待受理', time: null })
  188. }
  189. disabledRef.value = true
  190. }
  191. } catch (e) {
  192. dlg.error(e)
  193. }
  194. }
  195. onLoad((data) => {
  196. if (data.id) {
  197. itemId.value = data.id
  198. }
  199. })
  200. onShow(() => {
  201. getInfo()
  202. })
  203. </script>
  204. <style lang="scss" scoped>
  205. .feedback-list-view {
  206. padding: $uni-spacing-col-s3 0 0;
  207. box-sizing: border-box;
  208. display: flex;
  209. flex-direction: column;
  210. height: 100%;
  211. // position: relative;
  212. :deep(.pub-loading) {
  213. flex: 1;
  214. }
  215. .feedback-info {
  216. background: #fff;
  217. padding: $uni-spacing-col-s4 $page-row-spacing $uni-spacing-col-s3;
  218. .feedback-info-title {
  219. font-size: $uni-font-size-lg;
  220. line-height: $uni-line-height-lg;
  221. font-weight: 800;
  222. margin-bottom: 24rpx;
  223. }
  224. .form-feedback {
  225. @include flex-between;
  226. border-bottom: 1px solid $uni-border-color;
  227. // height: 70rpx;
  228. padding: 8rpx 0 24rpx;
  229. // todo 模拟校验出错
  230. font-size: $uni-font-size-lg;
  231. line-height: $uni-line-height-lg;
  232. color: $uni-text-color-light;
  233. .form-feedback-input.checked {
  234. color: $uni-text-color;
  235. }
  236. }
  237. :deep(.is-disabled) {
  238. background-color: #ffffff !important;
  239. color: #363A44 !important;
  240. }
  241. :deep(.uni-forms-item__label) {
  242. color: $uni-text-color-grey;
  243. padding: 0rpx 0 0rpx 0; //12,4
  244. font-size: $uni-font-size-base;
  245. line-height: $uni-line-height-base;
  246. height: auto;
  247. }
  248. :deep(.uni-easyinput__content) {
  249. border-bottom: 1px solid $uni-border-color;
  250. .uni-easyinput__content-input {
  251. padding-left: 0 !important;
  252. height: 70rpx;
  253. .uni-input-wrapper {
  254. .uni-input-placeholder {
  255. font-size: $uni-font-size-lg;
  256. line-height: $uni-line-height-lg;
  257. color: $uni-text-color-light;
  258. }
  259. .uni-input-input {
  260. font-size: $uni-font-size-lg;
  261. line-height: $uni-line-height-lg;
  262. color: $uni-text-color;
  263. }
  264. }
  265. }
  266. }
  267. :deep(.uni-easyinput__content-textarea) {
  268. margin: 8rpx 0 4rpx;
  269. height: 220rpx;
  270. min-height: 220rpx;
  271. // overflow-y: auto !important;
  272. .uni-easyinput__placeholder-class {
  273. font-size: $uni-font-size-lg;
  274. line-height: $uni-line-height-lg;
  275. color: $uni-text-color-light;
  276. }
  277. .uni-textarea-textarea {
  278. font-size: $uni-font-size-lg;
  279. line-height: $uni-line-height-lg;
  280. color: $uni-text-color;
  281. }
  282. }
  283. }
  284. .feedback-formdate {
  285. margin-top: 20rpx;
  286. :deep(.uni-forms-item:last-of-type .uni-easyinput__content) {
  287. border-bottom: none;
  288. }
  289. }
  290. .other-text {
  291. margin-top: 10rpx;
  292. font-size: $uni-font-size-lg;
  293. line-height: $uni-line-height-lg;
  294. color: $uni-text-color;
  295. }
  296. .feedback-schedule {
  297. margin-top: 10rpx;
  298. background-color: #fff;
  299. padding: $uni-spacing-col-s4 $page-row-spacing $uni-spacing-col-s3;
  300. .schedule-title {
  301. font-size: 28rpx;
  302. font-weight: 600;
  303. }
  304. .schedule-timeline {
  305. padding: 20px 10px 0;
  306. overflow: auto;
  307. .step-item {
  308. color: $uni-text-color-grey;
  309. display: flex;
  310. min-height: 140rpx;
  311. .step_circle_item {
  312. padding-top: 4rpx;
  313. @include flex;
  314. flex-direction: column;
  315. margin-right: 24rpx;
  316. .dot {
  317. width: 24rpx;
  318. height: 24rpx;
  319. background: $uni-border-color;
  320. border-radius: 50%;
  321. }
  322. .line {
  323. flex: 1;
  324. border-left: 1px solid $uni-border-color;
  325. margin: 12rpx 0;
  326. }
  327. }
  328. .step_content_item {
  329. width: 100%;
  330. margin-bottom: 32rpx;
  331. font-size: 24rpx;
  332. .step_content {
  333. font-size: 28rpx;
  334. line-height: $uni-line-height-base;
  335. margin-bottom: 16rpx;
  336. }
  337. .step_date {
  338. margin-bottom: 8rpx;
  339. }
  340. }
  341. &:last-child {
  342. .step_circle_item {
  343. .line {
  344. display: none;
  345. }
  346. }
  347. }
  348. }
  349. }
  350. .submit {
  351. margin: 0 32rpx 16rpx;
  352. }
  353. }
  354. }
  355. </style>