detail.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="">
  3. <u-navbar title="详情" :custom-back="back">
  4. <template #right>
  5. <view class="navbar-right">
  6. <view class="message-box right-item" style="padding-right: 20rpx;">
  7. <u-icon name='more-dot-fill' @click="show=true" v-if="!groupId"></u-icon>
  8. </view>
  9. </view>
  10. </template>
  11. </u-navbar>
  12. <view class="scheduleForm-v jnpf-wrap">
  13. <u-toast ref="uToast" />
  14. <u-form :model="dataForm" ref="dataForm" :errorType="['toast']" label-position="left" label-width="150"
  15. label-align="left">
  16. <view class="u-p-l-20 u-p-r-20 form-item-box">
  17. <u-form-item label="标题" prop="title">
  18. <u-input input-align='right' v-model="dataForm.title" label-align="right" placeholder=""
  19. disabled></u-input>
  20. </u-form-item>
  21. <u-form-item label="内容" prop="content">
  22. <u-input input-align='right' v-model="dataForm.content" type="textarea" placeholder=""
  23. disabled></u-input>
  24. </u-form-item>
  25. </view>
  26. <!-- #ifdef APP-HARMONY -->
  27. <view class="u-p-l-20 u-p-r-20 u-m-t-20 form-item-box">
  28. <u-form-item label="附件" prop="content">
  29. <JnpfUploadFile v-model="dataForm.files" detailed />
  30. </u-form-item>
  31. </view>
  32. <!-- #endif -->
  33. <view class="jnpf-card">
  34. <view class="u-p-l-20 u-p-r-20 form-item-box">
  35. <u-form-item label="紧急程度" prop="urgent">
  36. <u-input input-align='right' v-model="dataForm.urgent" label-align="right" placeholder=""
  37. disabled></u-input>
  38. </u-form-item>
  39. <u-form-item label="类型" prop="category">
  40. <u-input input-align='right' v-model="dataForm.category" placeholder="" disabled></u-input>
  41. </u-form-item>
  42. <u-form-item label="创建人" prop="creatorUserId">
  43. <u-input input-align='right' v-model="dataForm.creatorUserId" placeholder=""
  44. disabled></u-input>
  45. </u-form-item>
  46. <u-form-item label="参与人" prop="toUserIds">
  47. <u-input input-align='right' v-model="dataForm.toUserIds" placeholder="" disabled></u-input>
  48. </u-form-item>
  49. </view>
  50. </view>
  51. <view class="jnpf-card">
  52. <view class="u-p-l-20 u-p-r-20 form-item-box">
  53. <u-form-item label="开始时间" prop="startDay">
  54. <datetime :delayMin="0" v-model="startDay" :date="startDate" disabled
  55. :showtdatetime='showtdatetime' :type="1" :allDay='dataForm.allDay' placeholder="" />
  56. </u-form-item>
  57. <u-form-item label="结束时间" prop="endDay">
  58. <datetime :delayMin="0" v-model="endDay" :date="endDate" disabled
  59. :showtdatetime='showtdatetime' :type="2" :allDay='dataForm.allDay' placeholder="" />
  60. </u-form-item>
  61. </view>
  62. </view>
  63. </u-form>
  64. </view>
  65. <u-action-sheet @click="handleAction" :list="actionList" :tips="{ text:'' , color: '#000' , fontSize: 30 }"
  66. v-model="show">
  67. </u-action-sheet>
  68. <u-action-sheet @click="delAction" :list="delList"
  69. :tips="{ text:toUserType===true?dataForm.repetition != '1'?'此为重复日程,将删除(含参与人)应用于':'确认删除(含参与人)当前日程':dataForm.repetition != '1'?'此为重复日程,将删除应用于':'确认删除当前日程' , color: '#000' , fontSize: 30 }"
  70. v-model="showBtn">
  71. </u-action-sheet>
  72. </view>
  73. </template>
  74. <script>
  75. import datetime from './t-datetime.vue'
  76. import {
  77. ScheduleDetail,
  78. ScheduleDelete
  79. } from '@/api/workFlow/schedule.js'
  80. import {
  81. useBaseStore
  82. } from '@/store/modules/base'
  83. const baseStore = useBaseStore()
  84. export default {
  85. components: {
  86. datetime
  87. },
  88. data() {
  89. return {
  90. showAction: '',
  91. userInfo: {},
  92. show: false,
  93. showtdatetime: false,
  94. dataForm: {
  95. id: 0,
  96. category: '',
  97. creatorUserId: 0,
  98. userName: '',
  99. allDay: 0,
  100. urgent: '1',
  101. startDay: '',
  102. startTime: '',
  103. endDay: '',
  104. endTime: '',
  105. duration: '',
  106. content: '',
  107. title: '',
  108. toUserIds: '',
  109. reminderTime: -2,
  110. reminderType: 1,
  111. send: '',
  112. sendName: '',
  113. repetition: 1,
  114. repeatTime: '',
  115. color: '#188ae2'
  116. },
  117. showBtn: false,
  118. startDate: {},
  119. endDate: {},
  120. repeatDate: {},
  121. repeat: '',
  122. endDay: '',
  123. startDay: '',
  124. toUserType: false,
  125. actionList: [],
  126. delList: [],
  127. groupId: ''
  128. }
  129. },
  130. onReady() {
  131. this.$refs.dataForm.setRules(this.rules);
  132. },
  133. onLoad(option) {
  134. this.dataForm.id = option.id
  135. this.toUserType = option.type
  136. this.actionList = []
  137. this.delList = []
  138. this.groupId = option.groupId
  139. if (this.toUserType == 'true') {
  140. this.actionList.push({
  141. text: '编辑',
  142. id: 'update'
  143. })
  144. this.actionList.push({
  145. text: '删除',
  146. id: 'deldete',
  147. color: '#ff3a3a',
  148. })
  149. } else {
  150. this.actionList.push({
  151. text: '删除',
  152. id: 'deldete',
  153. color: '#ff3a3a',
  154. })
  155. }
  156. ScheduleDetail(this.groupId, option.id).then(res => {
  157. let data = res.data || {};
  158. data.files = data.files ? JSON.parse(data.files) : [];
  159. this.dataForm = data
  160. if (this.dataForm.repetition != '1') {
  161. this.delList.push({
  162. text: '仅删除此日程',
  163. id: '1'
  164. })
  165. this.delList.push({
  166. text: '删除此日程及后续日程',
  167. id: '2',
  168. })
  169. this.delList.push({
  170. text: '删除所有日程',
  171. id: '3',
  172. })
  173. } else {
  174. this.delList.push({
  175. text: '删除',
  176. id: '3',
  177. color: '#ff3a3a',
  178. })
  179. }
  180. this.startDate = this.timestampToTime(this.dataForm.startDay)
  181. this.endDate = this.timestampToTime(this.dataForm.endDay)
  182. }).catch((err) => {
  183. uni.showToast({
  184. title: err,
  185. complete: () => {
  186. setTimeout(() => {
  187. uni.navigateBack()
  188. }, 300)
  189. }
  190. })
  191. })
  192. },
  193. methods: {
  194. delAction(index) {
  195. if (this.dataForm.repetition != '1') {
  196. ScheduleDelete(this.dataForm.id, index + 1).then(res => {
  197. uni.showToast({
  198. title: res.msg,
  199. complete: () => {
  200. uni.$emit('refresh')
  201. uni.navigateBack()
  202. }
  203. })
  204. })
  205. } else {
  206. ScheduleDelete(this.dataForm.id, 3).then(res => {
  207. uni.showToast({
  208. title: res.msg,
  209. complete: () => {
  210. uni.$emit('refresh')
  211. uni.navigateBack()
  212. }
  213. })
  214. })
  215. }
  216. },
  217. handleAction(index) {
  218. if (this.actionList[index].id == 'update') {
  219. uni.navigateTo({
  220. url: './form?id=' + this.dataForm.id
  221. })
  222. } else {
  223. this.showBtn = true
  224. }
  225. },
  226. back() {
  227. uni.navigateBack();
  228. },
  229. getResult() {
  230. uni.navigateBack()
  231. },
  232. changeSend(id, name) {
  233. this.dataForm.send = id
  234. this.dataForm.sendName = name
  235. },
  236. getDictionaryData() {
  237. baseStore.getDictionaryData({
  238. sort: 'scheduleType'
  239. }).then((res) => {
  240. this.typeOptions = res
  241. })
  242. },
  243. timestampToTime(timestamp) {
  244. let list = {}
  245. var date = new Date(timestamp);
  246. let Y = date.getFullYear();
  247. let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
  248. let D = date.getDate();
  249. let h = date.getHours();
  250. let m = date.getMinutes();
  251. let s = date.getSeconds();
  252. list.year = Y
  253. list.month = M
  254. list.date = D
  255. list.hours = h < 10 ? 0 + h : h
  256. list.minutes = m < 10 ? 0 + m : m
  257. list.seconds = s
  258. return list
  259. },
  260. }
  261. }
  262. </script>
  263. <style lang="scss">
  264. page {
  265. background-color: #f0f2f6;
  266. }
  267. .scheduleForm-v {
  268. padding-bottom: 110rpx;
  269. }
  270. </style>