index.vue 10 KB

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