index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <div class="reportRepair">
  3. <div class="reportBody">
  4. <div class="record" @click.stop="toRecord">
  5. 报事记录 <img src="https://www.idea-sf.com/gardenProduct/image/rightIcon.png" class="recordImg">
  6. </div>
  7. <ul class="detailUl">
  8. <li class="detailLi">
  9. <span class="liName">当前企业</span>
  10. <span class="liInfo">{{getUserLocalStorageInfo.username}}</span>
  11. </li>
  12. <li class="detailLi">
  13. <span class="liName">
  14. <span style="color: red;margin-right: 10rpx;">*</span>
  15. 您是想
  16. </span>
  17. <van-radio-group :value="form.type" @change="onChange">
  18. <van-radio name="1">报事</van-radio>
  19. <van-radio name="2">咨询</van-radio>
  20. </van-radio-group>
  21. </li>
  22. <li class="detailLi2">
  23. <span class="liName">
  24. 快捷选择
  25. </span>
  26. <div class="detailLi2Box">
  27. <div class="detailLi2BoxTop">
  28. <div class="checkItem" :class="form.serviceType===item.value?'checked':''" v-for="item in checkList" @click="clickCheck(item)">{{item.label}}</div>
  29. </div>
  30. <van-field
  31. :value="form.description"
  32. autosize
  33. type="textarea"
  34. placeholder="请输入文字进行报事报修描述"
  35. class="myField"
  36. maxlength="800"
  37. show-word-limit
  38. @input="changeIpt"
  39. />
  40. </div>
  41. </li>
  42. <li class="detailLi">
  43. <span class="liName">
  44. <span style="color: red;margin-right: 10rpx;">*</span>
  45. 位置
  46. </span>
  47. <van-radio-group :value="form.position" @change="onChange2">
  48. <van-radio name="1">室内</van-radio>
  49. <van-radio name="2">公区</van-radio>
  50. </van-radio-group>
  51. </li>
  52. <li class="detailLi2">
  53. <span class="liName">
  54. 补充说明
  55. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片/视频上传限20M内,最多6张)</span>
  56. </span>
  57. <div class="detailLi2Box" style="margin: 24rpx 0 0 0">
  58. <van-uploader
  59. accept="media"
  60. :max-count="6"
  61. @delete="deleteRYXXZP"
  62. :file-list="fileList"
  63. @after-read="uploadRYXXZP"
  64. :show-upload="true"
  65. @click-preview="showClick"
  66. />
  67. </div>
  68. </li>
  69. <li class="detailLi" style="border-bottom: none">
  70. <span class="liName">
  71. 报事人
  72. </span>
  73. <span class="liInfo">
  74. {{submitUser}}
  75. </span>
  76. </li>
  77. </ul>
  78. </div>
  79. <div class="buttonBox">
  80. <button class="btn zcBtn" @tap="submit('unSubmit')">暂存</button>
  81. <button class="btn tjBtn" @tap="submit('unAcceptance')">提交</button>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import { repairAdd,getUserLocalStorageInfo,getByCodes, editRepair} from "@/js_sdk/http";
  87. import dayjs from "dayjs";
  88. export default {
  89. data(){
  90. return{
  91. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  92. dc_key: ['QUICK_SELECTION'],
  93. isCheck:false,
  94. isCheck2:false,
  95. form: {
  96. groupId: '',
  97. companyId: getUserLocalStorageInfo().userId,
  98. companyName: getUserLocalStorageInfo().username,
  99. type: '1',
  100. serviceType: '',
  101. description: '',
  102. position: '1',
  103. userId:getUserLocalStorageInfo().userId + '-' + getUserLocalStorageInfo().username + '-' + getUserLocalStorageInfo().phone,
  104. fileUrl: '',
  105. status: '',
  106. userType: getUserLocalStorageInfo().userType
  107. },
  108. submitUser:getUserLocalStorageInfo().username + '-' + getUserLocalStorageInfo().phone,
  109. checkList:[
  110. // {name:'挂件安装'},
  111. // {name:'我要投诉'},
  112. // {name:'疏通管道'},
  113. // {name:'维修线路'},
  114. // {name:'更换灯泡'},
  115. // {name:'网络维修'},
  116. // {name:'保洁服务'},
  117. // {name:'其他维修'},
  118. ],
  119. quickSleced: {},
  120. fileList:[],
  121. dic_SelectList:[]
  122. }
  123. },
  124. created(){
  125. this.getByCodes()
  126. },
  127. onLoad(options){
  128. const item = JSON.parse(options.item)
  129. this.id = item.id
  130. this.form = item
  131. this.fileList = JSON.parse(item.fileUrl)
  132. },
  133. methods:{
  134. showClick(e){
  135. console.log(e)
  136. },
  137. changeIpt(e){
  138. this.form.description = e.detail
  139. },
  140. onChange(e){
  141. // console.log(e)
  142. this.form.type = e.detail
  143. },
  144. onChange2(e){
  145. // console.log(e)
  146. this.form.position = e.detail
  147. },
  148. async getByCodes() {
  149. let data = await getByCodes(JSON.stringify(this.dc_key));
  150. this.dic_SelectList = this.$common.handleDicList(data);
  151. this.checkList = this.dic_SelectList.QUICK_SELECTION
  152. },
  153. toRecord() {
  154. uni.navigateTo({
  155. url:'/pages/subPackages/reportRepair/repairRecord'
  156. })
  157. },
  158. clickCheck(item){
  159. // console.log(item)
  160. this.form.serviceType = item.value
  161. this.form.description = item.label
  162. },
  163. submit(e){
  164. if (!this.form.serviceType || !this.form.description) {
  165. uni.showToast({
  166. title: '请选择服务类型',
  167. icon: 'none',
  168. mask: true,
  169. duration: 1000
  170. });
  171. return
  172. }
  173. if (this.fileList.length <= 0 || !this.fileList){
  174. uni.showToast({
  175. title: '请上传补充说明图片',
  176. icon: 'none',
  177. mask: true,
  178. duration: 1000
  179. });
  180. return
  181. }
  182. let picArr = []
  183. this.fileList.forEach(item=>{
  184. // console.log(item)
  185. picArr.push(item)
  186. })
  187. this.form.fileUrl = JSON.stringify(picArr)
  188. // this.form.serviceType = this.quickSleced.value
  189. this.form.createdBy = this.getUserLocalStorageInfo.userId
  190. this.form.status = e
  191. if (this.id){
  192. this.form.id = this.id
  193. editRepair(this.form).then((res) => {
  194. if (res.code ===200){
  195. uni.showToast({
  196. title: '填报成功',
  197. icon: 'success',
  198. mask: true,
  199. duration: 1000
  200. });
  201. uni.redirectTo({
  202. url:'/pages/subPackages/reportRepair/repairRecord'
  203. })
  204. }else {
  205. uni.showToast({
  206. title: res.msg,
  207. icon: 'success',
  208. mask: true,
  209. duration: 1000
  210. });
  211. }
  212. })
  213. }else{
  214. repairAdd(this.form).then((res) => {
  215. if (res.code ===200){
  216. uni.showToast({
  217. title: '填报成功',
  218. icon: 'success',
  219. mask: true,
  220. duration: 1000
  221. });
  222. uni.redirectTo({
  223. url:'/pages/subPackages/reportRepair/repairRecord'
  224. })
  225. }else {
  226. uni.showToast({
  227. title: res.msg,
  228. icon: 'success',
  229. mask: true,
  230. duration: 1000
  231. });
  232. }
  233. })
  234. }
  235. },
  236. deleteRYXXZP(event) {
  237. this.fileList.splice(event.detail.index, 1);
  238. this.$forceUpdate();
  239. },
  240. uploadRYXXZP(event) {
  241. // console.log(event)
  242. let that = this;
  243. const { file } = event.detail;
  244. console.log(event.detail)
  245. uni.uploadFile({
  246. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  247. filePath: file.url,
  248. name: "file",
  249. formData: { user: "test" },
  250. success(res) {
  251. // 上传完成需要更新 fileList
  252. let data = JSON.parse(res.data);
  253. if (event.detail.file.type==='image'){
  254. that.fileList.push({
  255. imgUrl: "/FileController/download/" + data.data[0],
  256. id: data.data[0],
  257. url:
  258. that.$constant.BASE_URI +
  259. "/FileController/download/" +
  260. data.data[0],
  261. type:event.detail.file.type,
  262. isImage:true,
  263. });
  264. }else{
  265. that.fileList.push({
  266. imgUrl: "/FileController/download/" + data.data[0],
  267. id: data.data[0],
  268. url:
  269. that.$constant.BASE_URI +
  270. "/FileController/download/" +
  271. data.data[0],
  272. type:event.detail.file.type,
  273. isVideo:true
  274. });
  275. }
  276. },
  277. fail(res) {},
  278. });
  279. },
  280. }
  281. }
  282. </script>
  283. <style lang="scss">
  284. .reportRepair{
  285. .reportBody{
  286. margin-top: 24rpx;
  287. padding: 38rpx 36rpx;
  288. background: white;
  289. //height: 1416rpx;
  290. box-sizing: border-box;
  291. .record {
  292. display: flex;
  293. align-items: center;
  294. justify-content: flex-end;
  295. color: #0365F9;
  296. font-size: 32rpx;
  297. .recordImg{
  298. width: 36rpx;
  299. height: 36rpx;
  300. padding: 5rpx 0 0 10rpx;
  301. }
  302. }
  303. .detailUl{
  304. margin-top: 20rpx;
  305. .liName{
  306. font-size: 32rpx;
  307. color: rgba(51, 51, 51, 1);
  308. white-space: nowrap;
  309. }
  310. .detailLi{
  311. display: flex;
  312. justify-content: space-between;
  313. align-items: center;
  314. padding: 32rpx 0;
  315. border-bottom: 2rpx solid #E6E6E6;
  316. .liInfo{
  317. display: flex;
  318. justify-content: flex-end;
  319. gap: 0 64prx;
  320. max-width: 428rpx;
  321. color: rgba(102, 102, 102, 1);
  322. font-size: 32rpx;
  323. line-height: 38rpx;
  324. }
  325. .van-radio-group{
  326. display: flex;
  327. align-items: center;
  328. gap: 0 32rpx;
  329. }
  330. }
  331. .detailLi2{
  332. display: flex;
  333. flex-direction: column;
  334. padding: 32rpx 0;
  335. border-bottom: 2rpx solid #E6E6E6;
  336. .detailLi2BoxTop{
  337. display: flex;
  338. flex-wrap: wrap;
  339. justify-content: space-between;
  340. margin: 12rpx 0;
  341. .checkItem{
  342. width: 160rpx;
  343. height: 64rpx;
  344. font-size: 28rpx;
  345. color: #666666;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. background: #F5F7FA;
  350. border-radius: 8rpx;
  351. margin: 12rpx 0;
  352. }
  353. .checked{
  354. background: #0365F9;
  355. color: white;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. .van-cell {
  362. background: #F5F7FA !important;
  363. border-radius: 8rpx;
  364. font-size: 28rpx;
  365. }
  366. .buttonBox{
  367. display: flex;
  368. justify-content: center;
  369. .btn{
  370. width: 240rpx;
  371. height: 80rpx;
  372. display: flex;
  373. border-radius: 8rpx;
  374. align-items: center;
  375. justify-content: center;
  376. margin: 48rpx 16rpx 150rpx 16rpx;
  377. color: white;
  378. letter-spacing: 2rpx;
  379. text-indent: 2rpx;
  380. }
  381. .zcBtn{
  382. background: #FE8643;
  383. }
  384. .tjBtn{
  385. background: #0365F9;
  386. }
  387. }
  388. }
  389. </style>