details.vue 10 KB

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