progress.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view>
  3. <view class="info-item">
  4. <u-row justify="space-between" gutter="10">
  5. <u-col span="12">
  6. <view class="flex_l">
  7. <view class="label">进展情况</view>
  8. <u-icon
  9. name="plus-circle"
  10. color="#2979ff"
  11. size="28"
  12. @click="addProgress()"
  13. v-if="details.taskStatus === '20' && details.step === 20 && type == 1"></u-icon>
  14. </view>
  15. </u-col>
  16. </u-row>
  17. </view>
  18. <!-- 进展列表 -->
  19. <view class="evolve-wrap" v-if="details.taskStatus === '20' && details.step === 20 && type == 1">
  20. <view class="evolve-item" v-for="(v, i) in progressList" :key="i">
  21. <view class="evolve-row split-line">
  22. <view class="no mb12">{{ i + 1 }}</view>
  23. <u-row justify="space-between" gutter="10">
  24. <u-col span="3">
  25. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="时间"></u-text>
  26. </u-col>
  27. <u-col span="9" @click="openCalendar(i)">
  28. <!-- <u-text :bold="true" customStyle="margin-bottom:12rpx" text="2022-11-11"></u-text> -->
  29. <u-input :readonly="true" v-model="v.progDate"></u-input>
  30. </u-col>
  31. </u-row>
  32. </view>
  33. <view class="evolve-row split-line">
  34. <u-row gutter="10">
  35. <u-col span="12">
  36. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="进展描述"></u-text>
  37. </u-col>
  38. </u-row>
  39. <u-row>
  40. <u-col span="12">
  41. <!-- <view class="desc mb12">2022-11-11</view> -->
  42. <u-input v-model="v.progDesc"></u-input>
  43. </u-col>
  44. </u-row>
  45. </view>
  46. <view class="evolve-row split-line">
  47. <u-row gutter="10">
  48. <u-col span="12">
  49. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="附件"></u-text>
  50. </u-col>
  51. </u-row>
  52. <u-row>
  53. <u-col span="12">
  54. <uni-file-picker file-mediatype="all" mode="grid" @select="select($event, i)" ref="upload" limit="1">
  55. <view class="upload-btn">
  56. <u-icon name="plus-circle-fill" color="blue" size="28"></u-icon>
  57. </view>
  58. </uni-file-picker>
  59. <!-- <view class="file mb12">测试啥.ppt</view> -->
  60. </u-col>
  61. </u-row>
  62. </view>
  63. <view class="evolve-row split-line">
  64. <u-row gutter="10">
  65. <u-col span="12">
  66. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="备注"></u-text>
  67. </u-col>
  68. </u-row>
  69. <u-row>
  70. <u-col span="12">
  71. <!-- <view class="file">备注备注备注备注备注备注备注</view> -->
  72. <u-input v-model="v.remark"></u-input>
  73. </u-col>
  74. </u-row>
  75. </view>
  76. <view class="evolve-row" @click="handleDel()">
  77. <u-text color="#2979ff" text="删除"></u-text>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="evolve-wrap" v-else>
  82. <view class="evolve-item" v-for="(v, i) in progressList" :key="i">
  83. <view class="evolve-row split-line">
  84. <view class="no mb12">{{ i + 1 }}</view>
  85. <u-row justify="space-between" gutter="10">
  86. <u-col span="3">
  87. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="时间"></u-text>
  88. </u-col>
  89. <u-col span="9">
  90. <u-text :bold="true" customStyle="margin-bottom:12rpx" :text="v.progDate"></u-text>
  91. </u-col>
  92. </u-row>
  93. </view>
  94. <view class="evolve-row split-line">
  95. <u-row gutter="10">
  96. <u-col span="12">
  97. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="进展描述"></u-text>
  98. </u-col>
  99. </u-row>
  100. <u-row>
  101. <u-col span="12">
  102. <view class="desc mb12">{{ v.progDesc }}</view>
  103. </u-col>
  104. </u-row>
  105. </view>
  106. <view class="evolve-row split-line">
  107. <u-row gutter="10">
  108. <u-col span="12">
  109. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="附件"></u-text>
  110. </u-col>
  111. </u-row>
  112. <u-row>
  113. <u-col span="12">
  114. <view class="file mb12">{{ v.progFile }}</view>
  115. </u-col>
  116. </u-row>
  117. </view>
  118. <view class="evolve-row split-line">
  119. <u-row gutter="10">
  120. <u-col span="12">
  121. <u-text :bold="true" customStyle="margin-bottom:12rpx" text="备注"></u-text>
  122. </u-col>
  123. </u-row>
  124. <u-row>
  125. <u-col span="12">
  126. <view class="file">{{ v.remark }}</view>
  127. </u-col>
  128. </u-row>
  129. </view>
  130. </view>
  131. </view>
  132. <!-- 提示 -->
  133. <u-toast ref="uToast"></u-toast>
  134. <!-- 日历 -->
  135. <u-calendar :show="showCalendar" @confirm="confirmCalendar" @close="showCalendar = false"></u-calendar>
  136. </view>
  137. </template>
  138. <script>
  139. import taskApi from '@/api/task'
  140. export default {
  141. props: {
  142. details: {
  143. type: Object,
  144. default: {},
  145. },
  146. type: {
  147. type: Number,
  148. default: 0,
  149. },
  150. },
  151. data() {
  152. return {
  153. curCalendarIndex: 0,
  154. progressList: [],
  155. showCalendar: false,
  156. }
  157. },
  158. mounted() {
  159. this.getProgressList()
  160. },
  161. methods: {
  162. // 获取进展信息
  163. getProgressList() {
  164. this.progressList = []
  165. taskApi
  166. .getTaskProgressList({ taskId: this.details.id + '' })
  167. .then((res) => {
  168. if (res.data.list) {
  169. this.progressList = res.data.list
  170. }
  171. })
  172. .catch((err) => {
  173. console.error(err)
  174. })
  175. },
  176. // 添加进展
  177. addProgress() {
  178. this.progressList.push({ progDesc: '', progDate: '', progFile: '', remark: '' })
  179. },
  180. // 删除进展
  181. handleDel(index) {
  182. this.progressList.splice(index, 1)
  183. },
  184. openCalendar(index) {
  185. this.showCalendar = true
  186. this.curCalendarIndex = index
  187. },
  188. confirmCalendar(val) {
  189. this.progressList[this.curCalendarIndex].progDate = val[0]
  190. this.showCalendar = false
  191. },
  192. // // 选择上传触发函数
  193. select(e, index) {
  194. let url = process.uniEnv.VUE_APP_UPLOAD_WEED
  195. uni.request({
  196. url, //仅为示例,并非真实接口地址。
  197. success: (res) => {
  198. this.uploadFiles(e, res.data, index)
  199. },
  200. })
  201. },
  202. // 上传函数
  203. async uploadFiles(e, res, index) {
  204. let action = process.uniEnv.VUE_APP_PROTOCOL + res.publicUrl + '/' + res.fid
  205. uni.uploadFile({
  206. url: action,
  207. filePath: e.tempFilePaths[0],
  208. name: 'file',
  209. formData: {
  210. file: e.tempFiles[0].file,
  211. },
  212. success: (res) => {
  213. this.$refs.uToast.show({
  214. type: 'success',
  215. message: '附件上传成功',
  216. })
  217. this.progressList[index].progFile = action
  218. },
  219. })
  220. },
  221. },
  222. }
  223. </script>
  224. <style lang="scss" scoped>
  225. .info-item {
  226. padding: 20rpx;
  227. .label {
  228. color: #646464;
  229. font-size: 26rpx;
  230. }
  231. .desc {
  232. font-size: 26rpx;
  233. text-indent: 20rpx;
  234. }
  235. }
  236. .evolve-wrap {
  237. .evolve-item {
  238. margin-bottom: 20rpx;
  239. .evolve-row {
  240. padding: 20rpx;
  241. }
  242. .split-line {
  243. border-bottom: 1px solid #e6e6e6;
  244. }
  245. border: 1px solid #e6e6e6;
  246. border-radius: 10px;
  247. .no {
  248. width: 50rpx;
  249. height: 50rpx;
  250. background: #78b0ed;
  251. border-radius: 50%;
  252. text-align: center;
  253. line-height: 50rpx;
  254. color: #fff;
  255. }
  256. }
  257. }
  258. </style>