details.vue 10.0 KB

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