details.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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="showSubmitButton" 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 showSubmitButton = ref(false)
  112. const pickerDeptRef = ref()
  113. const popupDeptText = ref()
  114. const yljgList = ref() // 医疗机构列表
  115. const pickerTypeRef = ref()
  116. const uniType = ref('add')
  117. const formRef = ref()
  118. const popupTypeText = ref()
  119. const loaded = ref(false)
  120. const formData = ref({
  121. djr: '',
  122. lxdh: '',
  123. yljgmc: '',
  124. yljgdm: '',
  125. fklx: '',
  126. fkxq: '',
  127. zjhm: '',
  128. })
  129. const timeLine = ref([])
  130. const openPickerDept = () => {
  131. if (!disabledRef.value) {
  132. pickerDeptRef.value?.openPop()
  133. }
  134. }
  135. const openPickerType = () => {
  136. if (!disabledRef.value) {
  137. pickerTypeRef.value?.openPop()
  138. }
  139. }
  140. const onChangeYljg = (e) => {
  141. formData.value.yljgmc = e.name
  142. formData.value.yljgdm = e.value
  143. popupDeptText.value = e.name
  144. }
  145. const onChangeType = (e) => {
  146. formData.value.fklx = e.value
  147. popupTypeText.value = e.name
  148. }
  149. const onConfirm = async () => {
  150. // 校验表单
  151. formRef.value.validate().then(async res => {
  152. // 提交请求
  153. try {
  154. if (uniType.value == 'add') {
  155. await rest.post('/zyyp/feedback/create', formData.value, globalParameter.value.authCode)
  156. dlg.success('已新增反馈登记!')
  157. }
  158. link.goBJList(true)
  159. } catch (e) {
  160. dlg.error(e)
  161. }
  162. }).catch(err => {
  163. console.log('表单错误信息:', err);
  164. })
  165. }
  166. // 初始化数据
  167. const getInfo = async () => {
  168. try {
  169. formData.value.djr = globalParameter.value.userName
  170. formData.value.zjhm = globalParameter.value.zjhm
  171. // 医疗机构列表
  172. let res = await rest.get('/system/dept/list-all-simple2', { orgType: 1 }, globalParameter.value.authCode)
  173. if (!res) return
  174. // 转换数据
  175. yljgList.value = (res as any[]).map(item => ({
  176. name: item.orgName,
  177. value: item.orgCode,
  178. }));
  179. //
  180. if (itemId.value) {
  181. let itemRes = await rest.get('/zyyp/feedback/get', { id: itemId.value }, globalParameter.value.authCode) as feedbackVO
  182. formData.value = itemRes
  183. popupDeptText.value = itemRes.yljgmc
  184. const matchedItem = feedbackArray.value.find(item => item.value === Number(itemRes.fklx));
  185. popupTypeText.value = matchedItem ? matchedItem.name : '未找到匹配项';
  186. timeLine.value = itemRes.jd
  187. if (itemRes.fkzt == '1') {
  188. timeLine.value.push({ desc: '等待受理', time: null })
  189. }
  190. disabledRef.value = true
  191. showSubmitButton.value = false;
  192. }else {
  193. showSubmitButton.value = true;
  194. }
  195. } catch (e) {
  196. dlg.error(e)
  197. }
  198. }
  199. onLoad((data) => {
  200. itemId.value = null
  201. if (data.id) {
  202. itemId.value = data.id
  203. }
  204. })
  205. onShow(() => {
  206. getInfo()
  207. })
  208. </script>
  209. <style lang="scss" scoped>
  210. .feedback-list-view {
  211. padding: $uni-spacing-col-s3 0 0;
  212. box-sizing: border-box;
  213. display: flex;
  214. flex-direction: column;
  215. height: 100%;
  216. // position: relative;
  217. :deep(.pub-loading) {
  218. flex: 1;
  219. }
  220. .feedback-info {
  221. background: #fff;
  222. padding: $uni-spacing-col-s4 $page-row-spacing $uni-spacing-col-s3;
  223. .feedback-info-title {
  224. font-size: $uni-font-size-lg;
  225. line-height: $uni-line-height-lg;
  226. font-weight: 800;
  227. margin-bottom: 24rpx;
  228. }
  229. .form-feedback {
  230. @include flex-between;
  231. border-bottom: 1px solid $uni-border-color;
  232. // height: 70rpx;
  233. padding: 8rpx 0 24rpx;
  234. // todo 模拟校验出错
  235. font-size: $uni-font-size-lg;
  236. line-height: $uni-line-height-lg;
  237. color: $uni-text-color-light;
  238. .form-feedback-input.checked {
  239. color: $uni-text-color;
  240. }
  241. }
  242. :deep(.is-disabled) {
  243. background-color: #ffffff !important;
  244. color: #363A44 !important;
  245. }
  246. :deep(.uni-forms-item__label) {
  247. color: $uni-text-color-grey;
  248. padding: 0rpx 0 0rpx 0; //12,4
  249. font-size: $uni-font-size-base;
  250. line-height: $uni-line-height-base;
  251. height: auto;
  252. }
  253. :deep(.uni-easyinput__content) {
  254. border-bottom: 1px solid $uni-border-color;
  255. .uni-easyinput__content-input {
  256. padding-left: 0 !important;
  257. height: 70rpx;
  258. .uni-input-wrapper {
  259. .uni-input-placeholder {
  260. font-size: $uni-font-size-lg;
  261. line-height: $uni-line-height-lg;
  262. color: $uni-text-color-light;
  263. }
  264. .uni-input-input {
  265. font-size: $uni-font-size-lg;
  266. line-height: $uni-line-height-lg;
  267. color: $uni-text-color;
  268. }
  269. }
  270. }
  271. }
  272. :deep(.uni-easyinput__content-textarea) {
  273. margin: 8rpx 0 4rpx;
  274. height: 220rpx;
  275. min-height: 220rpx;
  276. // overflow-y: auto !important;
  277. .uni-easyinput__placeholder-class {
  278. font-size: $uni-font-size-lg;
  279. line-height: $uni-line-height-lg;
  280. color: $uni-text-color-light;
  281. }
  282. .uni-textarea-textarea {
  283. font-size: $uni-font-size-lg;
  284. line-height: $uni-line-height-lg;
  285. color: $uni-text-color;
  286. }
  287. }
  288. }
  289. .feedback-formdate {
  290. margin-top: 20rpx;
  291. :deep(.uni-forms-item:last-of-type .uni-easyinput__content) {
  292. border-bottom: none;
  293. }
  294. }
  295. .other-text {
  296. margin-top: 10rpx;
  297. font-size: $uni-font-size-lg;
  298. line-height: $uni-line-height-lg;
  299. color: $uni-text-color;
  300. }
  301. .feedback-schedule {
  302. margin-top: 10rpx;
  303. background-color: #fff;
  304. padding: $uni-spacing-col-s4 $page-row-spacing $uni-spacing-col-s3;
  305. .schedule-title {
  306. font-size: 28rpx;
  307. font-weight: 600;
  308. }
  309. .schedule-timeline {
  310. padding: 20px 10px 0;
  311. overflow: auto;
  312. .step-item {
  313. color: $uni-text-color-grey;
  314. display: flex;
  315. min-height: 140rpx;
  316. .step_circle_item {
  317. padding-top: 4rpx;
  318. @include flex;
  319. flex-direction: column;
  320. margin-right: 24rpx;
  321. .dot {
  322. width: 24rpx;
  323. height: 24rpx;
  324. background: $uni-border-color;
  325. border-radius: 50%;
  326. }
  327. .line {
  328. flex: 1;
  329. border-left: 1px solid $uni-border-color;
  330. margin: 12rpx 0;
  331. }
  332. }
  333. .step_content_item {
  334. width: 100%;
  335. margin-bottom: 32rpx;
  336. font-size: 24rpx;
  337. .step_content {
  338. font-size: 28rpx;
  339. line-height: $uni-line-height-base;
  340. margin-bottom: 16rpx;
  341. }
  342. .step_date {
  343. margin-bottom: 8rpx;
  344. }
  345. }
  346. &:last-child {
  347. .step_circle_item {
  348. .line {
  349. display: none;
  350. }
  351. }
  352. }
  353. }
  354. }
  355. .submit {
  356. margin: 0 32rpx 16rpx;
  357. }
  358. }
  359. }
  360. </style>