task-details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <!-- taskshow true 编辑模式 false 展示模式-->
  2. <!-- istask 0 完成任务模块 1 任务模块 2 监督模块 3监督记录模块-->
  3. <template name="task-details">
  4. <view class="" style="padding-bottom: 40rpx;">
  5. <view class="taskbtn">
  6. <view class="taskbtn_item" v-if="istask==1" @click="taskfilling">
  7. 提交
  8. </view>
  9. <view class="taskbtn_item" v-if="istask==2" @click="skip">
  10. 监督
  11. </view>
  12. </view>
  13. <view class="taskbox">
  14. <view class="taskbox_item">
  15. <view class="taskbox_item_l">
  16. 任务派发人
  17. </view>
  18. <view class="taskbox_item_r">
  19. {{taskinfo.owner_user}}
  20. </view>
  21. </view>
  22. <view class="taskbox_item">
  23. <view class="taskbox_item_l">
  24. 任务监督人
  25. </view>
  26. <view class="taskbox_item_r">
  27. {{taskinfo.supervisor_user}}
  28. </view>
  29. </view>
  30. <view class="taskbox_item">
  31. <view class="taskbox_item_l">
  32. 任务处理人
  33. </view>
  34. <view class="taskbox_item_r">
  35. {{taskinfo.operator_user}}
  36. </view>
  37. </view>
  38. <view class="taskbox_item">
  39. <view class="taskbox_item_l">
  40. 任务时间
  41. </view>
  42. <view class="taskbox_item_r">
  43. {{taskinfo.start_time}} ~ {{taskinfo.last_time}}
  44. </view>
  45. </view>
  46. <view class="taskbox_item2">
  47. <view class="taskbox_item_l">
  48. 操作描述
  49. </view>
  50. <view class="taskbox_item_r">
  51. {{taskinfo.tesk_msg}}
  52. </view>
  53. </view>
  54. </view>
  55. <view class="imgshow">
  56. <view class="imgshow_compile" v-if="taskshow">
  57. <view class="title">
  58. 签到
  59. </view>
  60. <view class="imgbox_box">
  61. <view class="addimg" @click="gainimg">
  62. <u-icon size="20" name="plus" color="#409eff"></u-icon>
  63. </view>
  64. <view class="imgitem" v-for="item,index in urllist" :key="index">
  65. <!-- <image :src="" mode="" class="img"></image> -->
  66. <u--image :src="baseUrl+item" class="img">
  67. <view slot="error" style="font-size: 24rpx;">加载失败</view>
  68. </u--image>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="imgshow_show" v-else>
  73. <view class="title">
  74. <view class="title_l">
  75. 签到<span v-if="taskinfo.img_list.length == 0" style="font-size: 24rpx;">(暂无图片)</span>
  76. </view>
  77. <view class="title_r">
  78. {{taskinfo.end_time}}
  79. </view>
  80. </view>
  81. <view class="imgbox_box">
  82. <view class="imgitem" v-for="item,index in taskinfo.img_list" :key="index">
  83. <image :src="baseUrl+item" mode="" class="img"></image>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="report">
  89. <view class="title">
  90. 任务汇报
  91. </view>
  92. <view class="textareainput" v-if="taskshow">
  93. <u--textarea v-model="textareavalue" placeholder="请输入内容"></u--textarea>
  94. </view>
  95. <view class="textarea" v-else>
  96. {{taskinfo.report_msg || "暂无描述"}}
  97. </view>
  98. </view>
  99. <view class="basebox" v-if="task_type">
  100. <view class="title">
  101. <view class="title_l">
  102. 设备登记
  103. </view>
  104. <view class="title_r" v-if="taskinfo.trap_record_list.length>5">
  105. 更多
  106. </view>
  107. </view>
  108. <view class="basebox_info">
  109. <view class="basebox_info_item" v-for="item,index in taskinfo.trap_record_list" :key="index">
  110. <view class="box" v-if="index<5">
  111. <view class="basebox_info_item_l">
  112. {{item.trap_number}}
  113. </view>
  114. <view class="basebox_info_item_c">
  115. {{item.report_status}}
  116. </view>
  117. <view class="basebox_info_item_r">
  118. <u-icon name="search" color="#2979ff" size="20" v-if="!taskshow"></u-icon>
  119. <u-icon name="edit-pen-fill" color="#2979ff" size="20" v-else></u-icon>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="recordbox" v-if="istask==3">
  126. <view class="title">
  127. 监督信息
  128. </view>
  129. <view class="recordbox_info">
  130. <view class="recordbox_info_item">
  131. <view class="recordbox_info_item_l">
  132. 监督形式
  133. </view>
  134. <view class="recordbox_info_item_r">
  135. {{taskinfo.supervisor_type}}
  136. </view>
  137. </view>
  138. <view class="recordbox_info_item">
  139. <view class="recordbox_info_item_l">
  140. 监督单位
  141. </view>
  142. <view class="recordbox_info_item_r">
  143. {{taskinfo.supervisor_depa}}
  144. </view>
  145. </view>
  146. <view class="recordbox_info_item">
  147. <view class="recordbox_info_item_l">
  148. 监督时间
  149. </view>
  150. <view class="recordbox_info_item_r">
  151. {{taskinfo.supervisor_time}}
  152. </view>
  153. </view>
  154. <view class="recordbox_info_item">
  155. <view class="recordbox_info_item_l">
  156. 监督情况
  157. </view>
  158. <view class="recordbox_info_item_r">
  159. {{taskinfo.supervisor_msg}}
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. <kps-image-cutter @ok="onok" @cancel="oncancle" :url="kpsurlL" :fixed="false" :blob="false" :maxWidth="500"
  165. :maxHeight="500"></kps-image-cutter>
  166. <u-loading-page loading-text="加载中..." :loading="loading" font-size="16"></u-loading-page>
  167. </view>
  168. </template>
  169. <script>
  170. import kpsImageCutter from "@/components/ksp-image-cutter/ksp-image-cutter.vue";
  171. export default {
  172. name: "task-details",
  173. components: {
  174. kpsImageCutter
  175. },
  176. data() {
  177. return {
  178. kpsurlL: "",
  179. urllist: [],
  180. textareavalue: "",
  181. taskinfo: {
  182. img_list: [],
  183. trap_record_list: []
  184. },
  185. task_type: false,
  186. loading:false
  187. };
  188. },
  189. props: { //此处定义传入的参数
  190. taskshow: {
  191. type: Boolean
  192. },
  193. istask: {
  194. type: Number
  195. }
  196. },
  197. methods: {
  198. gainimg() { //添加图片
  199. uni.chooseImage({
  200. count: 1, //默认9
  201. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  202. sourceType: ['album', 'camera'], //从相册选择
  203. success: (res) => {
  204. console.log(res)
  205. // this.urllist.push(res.tempFilePaths[0])
  206. this.kpsurlL = res.tempFilePaths[0]
  207. }
  208. });
  209. },
  210. oncancle() {
  211. this.kpsurlL = ""
  212. },
  213. onok(ev) {
  214. uni.uploadFile({
  215. url: this.baseUrl +
  216. '/api/api_gateway?method=monitor_manage.cbd_manage.add_img', //仅为示例,非真实的接口地址
  217. filePath: ev.path,
  218. name: 'img_file',
  219. success: (uploadFileRes) => {
  220. console.log(JSON.parse(uploadFileRes.data).data.src)
  221. this.urllist.push(JSON.parse(uploadFileRes.data).data.src)
  222. this.kpsurlL = ""
  223. }
  224. });
  225. },
  226. async gettaskinfo(id) {
  227. this.loading = true
  228. const res = await this.$myRequest({
  229. url: '/api/api_gateway?method=control_center.task.task_info',
  230. data: {
  231. task_id: id,
  232. }
  233. })
  234. this.taskinfo = res
  235. this.taskinfo.img_list = JSON.parse(this.taskinfo.img_list)
  236. if (this.taskinfo.task_type == "有害生物监测") {
  237. this.task_type = true
  238. } else {
  239. this.task_type = false
  240. }
  241. this.loading = false
  242. console.log(res)
  243. },
  244. async taskfilling() { //任务填报接口
  245. const res = await this.$myRequest({
  246. url: '/api/api_gateway?method=app.task.task_filling',
  247. data: {
  248. // task_id:id,
  249. }
  250. })
  251. },
  252. skip() { //跳转
  253. // uni.redirectTo({
  254. // url:"../pages/supervise/submitsupe?id"+ this.taskinfo.task_id
  255. // });
  256. // console.log(this.$parent)
  257. // this.$parent.tosubm();
  258. this.$emit('tosubm')
  259. }
  260. },
  261. }
  262. </script>
  263. <style lang="less" scoped>
  264. .taskbtn {
  265. position: absolute;
  266. top: -60rpx;
  267. right: 20rpx;
  268. z-index: 9999;
  269. color: #409eff;
  270. font-size: 28rpx;
  271. }
  272. .taskbox {
  273. width: 90%;
  274. margin: 0 auto;
  275. margin-bottom: 30rpx;
  276. .taskbox_item {
  277. display: flex;
  278. justify-content: space-between;
  279. padding: 20rpx 0;
  280. border-bottom: 1rpx solid #F6F6F6;
  281. .taskbox_item_l {
  282. width: 30%;
  283. font-size: 28rpx;
  284. }
  285. .taskbox_item_r {
  286. width: 70%;
  287. text-align: right;
  288. font-size: 28rpx;
  289. color: #999999;
  290. }
  291. }
  292. .taskbox_item2 {
  293. padding: 20rpx 0;
  294. border-bottom: 1rpx solid #F6F6F6;
  295. .taskbox_item_l {
  296. margin-bottom: 20rpx;
  297. font-size: 28rpx;
  298. }
  299. .taskbox_item_r {
  300. font-size: 28rpx;
  301. color: #999999;
  302. }
  303. }
  304. }
  305. .imgshow {
  306. width: 90%;
  307. margin: 0 auto;
  308. .imgshow_compile {
  309. .title {
  310. margin-bottom: 30rpx;
  311. font-weight: 700;
  312. }
  313. .imgbox_box {
  314. display: flex;
  315. flex-wrap: wrap;
  316. width: 80%;
  317. // justify-content: space-around;
  318. .addimg {
  319. width: 140rpx;
  320. height: 140rpx;
  321. border: 1px dashed #409eff;
  322. // text-align: center;
  323. display: flex;
  324. justify-content: space-around;
  325. margin-right: 30rpx;
  326. margin-bottom: 30rpx;
  327. }
  328. .imgitem {
  329. width: 140rpx;
  330. height: 140rpx;
  331. margin-right: 30rpx;
  332. margin-bottom: 30rpx;
  333. .img {
  334. width: 100%;
  335. height: 100%;
  336. }
  337. }
  338. }
  339. }
  340. .imgshow_show {
  341. .title {
  342. display: flex;
  343. justify-content: space-between;
  344. margin-bottom: 30rpx;
  345. .title_l {
  346. font-weight: 700;
  347. }
  348. .title_r {
  349. font-size: 28rpx;
  350. color: #999999;
  351. }
  352. }
  353. .imgbox_box {
  354. display: flex;
  355. flex-wrap: wrap;
  356. width: 80%;
  357. .imgitem {
  358. width: 140rpx;
  359. height: 140rpx;
  360. margin-right: 30rpx;
  361. margin-bottom: 30rpx;
  362. .img {
  363. width: 100%;
  364. height: 100%;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .report {
  371. width: 90%;
  372. margin: 0 auto;
  373. margin-bottom: 30rpx;
  374. .title {
  375. margin-bottom: 30rpx;
  376. font-weight: 700;
  377. }
  378. }
  379. .basebox {
  380. width: 90%;
  381. margin: 0 auto;
  382. .title {
  383. margin-bottom: 20rpx;
  384. display: flex;
  385. justify-content: space-between;
  386. .title_l {
  387. font-weight: 700;
  388. }
  389. .title_r {
  390. font-size: 26rpx;
  391. color: #409eff;
  392. }
  393. }
  394. .basebox_info {
  395. width: 100%;
  396. .basebox_info_item {
  397. width: 100%;
  398. .box {
  399. display: flex;
  400. justify-content: space-between;
  401. padding: 20rpx 0;
  402. border-bottom: 1px solid #F6F6F6;
  403. .basebox_info_item_l {
  404. font-size: 28rpx;
  405. }
  406. .basebox_info_item_c {
  407. color: #999999;
  408. font-size: 28rpx;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. .recordbox {
  415. width: 90%;
  416. margin: 20rpx auto 0;
  417. .title {
  418. font-weight: 700;
  419. // margin-bottom: 20rpx;
  420. }
  421. .recordbox_info {
  422. width: 100%;
  423. .recordbox_info_item {
  424. display: flex;
  425. padding: 20rpx 0;
  426. border-bottom: 1px solid #F6F6F6;
  427. width: 100%;
  428. .recordbox_info_item_l {
  429. width: 30%;
  430. font-size: 28rpx;
  431. }
  432. .recordbox_info_item_r {
  433. width: 70%;
  434. text-align: right;
  435. font-size: 28rpx;
  436. }
  437. }
  438. }
  439. }
  440. </style>