details.vue 9.8 KB

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