casuallyPatInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <!-- 收到随手拍详情 -->
  2. <template>
  3. <view id="casuallyPatInfo">
  4. <view class="big-box">
  5. <view class="title-box">
  6. <view>{{newData.handleStatus == 0?'问题发现人:':'问题反馈人:'}}</view>
  7. <view>{{newData.applyName}}</view>
  8. </view>
  9. <view class="title-box">
  10. <view>{{newData.handleStatus == 0?'发现时间:':'反馈时间:'}}</view>
  11. <view>{{newData.createTimeStr2}}</view>
  12. </view>
  13. <view class="title-box">
  14. <view>实验室名称:</view>
  15. <view>{{newData.subName}}</view>
  16. </view>
  17. <view class="title-box">
  18. <view>描述:</view>
  19. <view>{{newData.describe}}</view>
  20. </view>
  21. <view class="img-max-box">
  22. <view class="img-title-box">现场照片:</view>
  23. <view class="img-for-max-box">
  24. <img :src="baseUrl+img" v-for="(img,index) in newData.imgList" :key="index" @click="clickImg(img)">
  25. </view>
  26. </view>
  27. <view class="tip"></view>
  28. <view class="title-box" v-if="newData.handleStatus == 1">
  29. <view>处理人:</view>
  30. <view>{{newData.handleName}}</view>
  31. </view>
  32. <view class="title-box" v-if="newData.handleStatus == 1">
  33. <view>处理时间:</view>
  34. <view>{{newData.handleDescribe}}</view>
  35. </view>
  36. <view class="input-box">
  37. <view class="left-box">处理描述:</view>
  38. <textarea :disabled="newData.handleStatus==1" v-model="formData.handleDescribe" maxlength="200" placeholder="请输入描述"></textarea>
  39. </view>
  40. <view class="up-img-box">
  41. <view class="title-view">处理后照片:</view>
  42. <view class="img-max-box">
  43. <view class="img-box" v-for="(item,index) in formData.handleImg" :key="index">
  44. <img class="img-data" :src="baseUrl+item" @click="clickImg(item)">
  45. <img class="position-img" src="@/images/icon_ssp_closure.png" v-if="newData.handleStatus==0" @click="delImg(index)">
  46. </view>
  47. <img class="add-button" src="@/images/icon_07.png" @click="selectImage" v-if="newData.handleStatus==0">
  48. </view>
  49. </view>
  50. </view>
  51. <view class="bottom-button-box" :class="newData.handleStatus == 0?'colorA':'colorB'" @click="clickButton">{{newData.handleStatus == 0?'处理':'已处理'}}</view>
  52. </view>
  53. </template>
  54. <script>
  55. import { getPhotonote,editPhotoNote,groupListRead} from '@/api/index.js'
  56. import { config } from '@/api/request/config.js'
  57. export default {
  58. data() {
  59. return {
  60. baseUrl:config.base_url,
  61. itemData:{},
  62. newData:{},
  63. formData:{
  64. handleDescribe:'',
  65. handleImg:[],
  66. },
  67. }
  68. },
  69. onLoad(option) {
  70. this.itemData = JSON.parse(decodeURIComponent(option.item));
  71. console.log("this.itemData",this.itemData)
  72. this.getPhotonote();
  73. if(this.itemData.isApply==2){
  74. this.readNnreadFun();
  75. }
  76. },
  77. methods: {
  78. //已读未读
  79. async readNnreadFun() {
  80. let self = this;
  81. const {data} = await groupListRead({messageId:this.itemData.messageId})
  82. if(data.code==200){
  83. console.log(data.data.dynamicId)
  84. self.itemData.id=data.data.dynamicId
  85. console.log(self.itemData.id)
  86. this.getPhotonote();
  87. }
  88. },
  89. clickButton(){
  90. let self = this;
  91. if(self.newData.handleStatus == 0){
  92. uni.showModal({
  93. content: '确认处理吗?',
  94. cancelColor:"#999",
  95. confirmColor:"#0183FA",
  96. success: function (res) {
  97. if (res.confirm) {
  98. self.editPhotoNote();
  99. console.log('用户点击确定');
  100. } else if (res.cancel) {
  101. console.log('用户点击取消');
  102. }
  103. }
  104. });
  105. }
  106. },
  107. //确认处理随手拍
  108. async editPhotoNote(){
  109. let obj = {
  110. id:this.itemData.id,
  111. };
  112. const {data} = await editPhotoNote(
  113. {
  114. id:this.itemData.id,
  115. handleDescribe:this.formData.handleDescribe,
  116. handleImg:this.formData.handleImg.join(','),
  117. }
  118. );
  119. if(data.code == 200){
  120. uni.showToast({
  121. title: '处理成功',
  122. icon:"none",
  123. mask:true,
  124. duration: 2000
  125. });
  126. setTimeout(function(){
  127. uni.navigateBack();
  128. },2000);
  129. }
  130. },
  131. //获取管理员工作台随手拍数量数据
  132. async getPhotonote(){
  133. const {data} = await getPhotonote(this.itemData.id);
  134. if(data.code == 200){
  135. this.newData = data.data;
  136. if(data.data.handleImg){
  137. this.formData.handleDescribe=data.data.handleDescribe;
  138. this.formData.handleImg=data.data.handleImg.split(',');
  139. }
  140. this.newData.imgList = data.data.imgUrl.split(",");
  141. }
  142. },
  143. // 图片上传
  144. selectImage(index) {
  145. let self = this;
  146. if(self.formData.handleImg.length>4){
  147. uni.showToast({
  148. title: '最多上传5张图片',
  149. icon:"none",
  150. mask:true,
  151. duration: 2000
  152. });
  153. return
  154. }
  155. wx.chooseImage({
  156. count: 1,
  157. sizeType: ["original", "compressed"],
  158. sourceType: ["album", "camera"],
  159. success: function(res) {
  160. console.log(res)
  161. let tempFilePaths = res.tempFilePaths[0];
  162. self.uploadImg(tempFilePaths,index);
  163. }
  164. });
  165. },
  166. async uploadImg(tempFilePaths,index){
  167. var self = this;
  168. uni.showLoading({
  169. title: '上传中',
  170. mask: true
  171. });
  172. uni.uploadFile({
  173. url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
  174. header:{'Authorization':uni.getStorageSync('token')},
  175. filePath: tempFilePaths,
  176. name: 'file',
  177. formData: {
  178. 'user': 'test'
  179. },
  180. success: (uploadFileRes) => {
  181. let res = JSON.parse(uploadFileRes.data);
  182. if(res.code == 200){
  183. self.formData.handleImg.push(res.data.url);
  184. }else{
  185. uni.showToast({
  186. title: res.msg,
  187. icon:"none",
  188. mask:true,
  189. duration: 2000
  190. });
  191. }
  192. },
  193. fail: err => {},
  194. complete: () => {
  195. uni.hideLoading()
  196. }
  197. });
  198. },
  199. //删除图片
  200. delImg(index){
  201. this.formData.handleImg.splice(index,1);
  202. },
  203. clickImg(url) {
  204. wx.previewImage({
  205. urls: [this.baseUrl+url], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  206. current: '', // 当前显示图片的http链接,默认是第一个
  207. success: function(res) {},
  208. fail: function(res) {},
  209. complete: function(res) {},
  210. })
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="stylus" scoped>
  216. #casuallyPatInfo{
  217. height:100%;
  218. overflow-y:scroll;
  219. .big-box{
  220. overflow hidden
  221. background #fff
  222. margin:20rpx;
  223. border-radius:20rpx;
  224. padding:20rpx;
  225. .title-box{
  226. display flex
  227. view{
  228. line-height:60rpx;
  229. }
  230. view:nth-child(1){
  231. width:180rpx;
  232. font-size:30rpx;
  233. color:#999 ;
  234. }
  235. view:nth-child(2){
  236. font-size:28rpx;
  237. flex:1;
  238. color:#333333;
  239. }
  240. }
  241. .img-max-box{
  242. display flex;
  243. flex-wrap: wrap;
  244. .img-title-box{
  245. width:150rpx;
  246. line-height:60rpx;
  247. font-size:30rpx;
  248. color:#999 ;
  249. }
  250. .img-for-max-box{
  251. flex:1;
  252. margin-top:20rpx;
  253. img{
  254. height:150rpx;
  255. width:150rpx;
  256. display inline-block
  257. margin: 0 20rpx 20rpx 0;
  258. }
  259. }
  260. }
  261. .tip{
  262. width: 662rpx;
  263. height: 1rpx;
  264. border-top :1rpx dashed #e0e0e0;
  265. padding-bottom :30rpx;
  266. box-sizing :border-box;
  267. }
  268. .input-box{
  269. height:auto;
  270. //display flex;
  271. .left-box{
  272. width:180rpx;
  273. line-height:80rpx;
  274. font-size: 30rpx;
  275. color:#333;
  276. }
  277. textarea{
  278. width:620rpx;
  279. border-radius: 10rpx;
  280. border:2rpx solid #E0E0E0;
  281. height:206rpx;
  282. padding:20rpx;
  283. font-size: 24rpx;
  284. color: #333;
  285. }
  286. }
  287. .up-img-box{
  288. display flex
  289. margin-top:30rpx;
  290. .title-view{
  291. width:180rpx;
  292. line-height:80rpx;
  293. font-size: 30rpx;
  294. color:#333;
  295. }
  296. .img-max-box{
  297. width:510rpx;
  298. .img-box{
  299. display inline-block
  300. height:140rpx;
  301. width:140rpx;
  302. position relative
  303. margin:0 20rpx 20rpx 0;
  304. .img-data{
  305. height:140rpx;
  306. width:140rpx;
  307. }
  308. .position-img{
  309. position absolute
  310. right:0;
  311. top:0;
  312. width:36rpx;
  313. height:36rpx;
  314. }
  315. }
  316. .add-button{
  317. display inline-block
  318. height:150rpx;
  319. width:150rpx;
  320. }
  321. }
  322. }
  323. }
  324. .bottom-button-box{
  325. width: 550rpx;
  326. height: 80rpx;
  327. border-radius: 20rpx;
  328. font-size:30rpx;
  329. line-height:80rpx;
  330. margin:120rpx auto 40rpx;
  331. text-align center;
  332. }
  333. .colorA{
  334. color: #ffffff;
  335. background:#0183fa;
  336. }
  337. .colorB{
  338. color:#333;
  339. background: #E0E0E0;
  340. }
  341. }
  342. </style>