index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <div class="repairs">
  3. <div class="container">
  4. <div class="repairs-title">
  5. <div class="title-left">
  6. <p>服务说明:</p>
  7. <span>{{ titleData.servedesc }}</span>
  8. </div>
  9. <div class="title-right">
  10. <a :href="'/repairs/' + $route.params.id + '/historicalInfo'"><i class="fa fa-history"/>历史服务申请</a>
  11. </div>
  12. </div>
  13. <div class="repairs-flow">
  14. <ul class="list-inline">
  15. <li><span>01 发起申请</span></li>
  16. <li><i class="fa fa-long-arrow-right"/><span>02 受理派工</span></li>
  17. <li><i class="fa fa-long-arrow-right"/><span>03 服务预约</span></li>
  18. <li><i class="fa fa-long-arrow-right"/><span>04 上门服务</span></li>
  19. <li><i class="fa fa-long-arrow-right"/><span>05 结果反馈</span></li>
  20. <li><i class="fa fa-long-arrow-right"/><span>06 客户评价</span></li>
  21. </ul>
  22. </div>
  23. <div class="repairs-form">
  24. <form class="form-horizontal" v-for="(item, index) in formData.formdetail">
  25. <div class="form-group" v-if="item.fd_type === 'SS'">
  26. <div class="col-xs-2 input-label">{{ item.fd_caption }}:</div>
  27. <div class="col-xs-10" >
  28. <input type="text" class="form-control" v-model="modelData[index]" :name="item.fd_field" :required="item.fd_allowblank==='f'">
  29. </div>
  30. </div>
  31. <div class="form-group" v-if="item.fd_type === 'CBG'">
  32. <div class="col-xs-2 input-label">{{ item.fd_caption }}:</div>
  33. <div class="col-xs-10" >
  34. <label class="checkbox-inline" v-for="(list, k) in item.fd_logictype.split(';')">
  35. <input type="checkbox"
  36. :name="item.fd_id"
  37. :value="list"
  38. :checked="lists[k]"
  39. @change="handleInput(index, item.fd_logictype.split(';').length, k)">{{ list }}
  40. </label>
  41. </div>
  42. </div>
  43. <div class="form-group" v-if="item.fd_type === 'D'">
  44. <div class="col-xs-2 input-label">{{ item.fd_caption }}:</div>
  45. <div class="col-xs-10">
  46. <el-date-picker
  47. v-model="modelData[index]"
  48. type="datetime"
  49. format="yyyy-MM-dd HH:mm:ss"
  50. value-format="yyyy-MM-dd HH:mm:ss"
  51. :picker-options="pickerDate"
  52. default-time="item.fd_defaultvalue"/>
  53. </div>
  54. </div>
  55. <div class="form-group" v-if="item.fd_type === 'RG'">
  56. <div class="col-xs-2 input-label">{{ item.fd_caption }}:</div>
  57. <div class="col-xs-10">
  58. <label class="radio-inline" v-for="list in item.fd_logictype.split(';')">
  59. <input
  60. type="radio"
  61. :name="item.fd_id"
  62. :value="list"
  63. v-model="radioData"
  64. @change="handleInputRadio(index)"
  65. :checked="item.fd_defaultvalue.search(list)>=0">{{ list }}
  66. </label>
  67. </div>
  68. </div>
  69. <div class="form-group" v-if="item.fd_type === 'FF'">
  70. <div class="col-xs-2 input-label">{{ item.fd_caption }}:</div>
  71. <div class="col-xs-10" style="padding-right:410px;margin-top:10px;">
  72. <div class="file-box">
  73. <el-upload
  74. action="/zuul/city/thxz/api/serve/uploadAttach.action"
  75. accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png"
  76. list-type="picture-card"
  77. :on-remove="(file, fileList)=>{return handleRemove(file, fileList, index)}"
  78. :on-success="(res)=>{return handleSuccess(res, index)}">
  79. <i class="el-icon-plus"/>
  80. </el-upload>
  81. </div>
  82. <div class="file-title">
  83. <p>上传文档说明: </p>
  84. <span>为方便物业维修师傅上门服务,您可以在此上传需要维修的图片, 文件大小不超过3M</span>
  85. </div>
  86. </div>
  87. </div>
  88. </form>
  89. </div>
  90. <div class="repairs-btn text-right">
  91. <button class="btn text-right" @click="submitForm($event)">提交申请</button>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. export default {
  98. name: 'Repairs',
  99. layout: 'town',
  100. fetch ({ store, route }) {
  101. return Promise.all([
  102. store.dispatch('loadFormData', { serve_id: route.params.id, operate_type: 'Add', client_type: 'cc', cityId: store.state.option.user.data.currentCity ? store.state.option.user.data.currentCity.id : null})
  103. ])
  104. },
  105. data () {
  106. return {
  107. pickerDate: {
  108. disabledDate (time) {
  109. return time.getTime() < Date.now()
  110. }
  111. },
  112. keys: {},
  113. operateid: '',
  114. fd_fiedid: '',
  115. operateurl: '',
  116. modelData: [],
  117. checkboxData: [],
  118. radioData: '',
  119. fileData: []
  120. }
  121. },
  122. computed: {
  123. user () {
  124. return this.$store.state.option.user.data
  125. },
  126. formData () {
  127. return this.$store.state.formConfig.formData.data.data
  128. },
  129. lists () {
  130. let listsData = []
  131. for (let i = 0; i < this.formData.formdetail.length; i++) {
  132. if (this.formData.formdetail[i].fd_type === 'CBG') {
  133. let lists = this.formData.formdetail[i].fd_logictype.split(';')
  134. let defaultList = this.formData.formdetail[i].fd_defaultvalue
  135. for (let j = 0; j < lists.length; j++) {
  136. listsData[j] = false
  137. if (defaultList.search(lists[j]) >= 0) {
  138. listsData[j] = true
  139. }
  140. }
  141. }
  142. }
  143. return listsData
  144. },
  145. titleData () {
  146. return this.$store.state.formConfig.formData.data
  147. }
  148. },
  149. methods: {
  150. handleSuccess (res, index) {
  151. if (this.fileData.indexOf(res.id) === -1) {
  152. this.fileData.push(res.id)
  153. this.modelData[index] = this.fileData.join(';')
  154. }
  155. },
  156. handleRemove (file, fileList, index) {
  157. this.fileData = []
  158. for (let i = 0; i < fileList.length; i++) {
  159. this.fileData.push(fileList[i].response.id)
  160. }
  161. this.modelData[index] = this.fileData.join(';')
  162. },
  163. handleInput (index, w, k) {
  164. let _self = this
  165. _self.lists[k] = !_self.lists[k]
  166. for (let i = 0; i <= w; i++) {
  167. if (_self.lists[i] === true) {
  168. _self.checkboxData[i] = 1
  169. }
  170. if (_self.lists[i] === false) {
  171. _self.checkboxData[i] = 0
  172. }
  173. }
  174. _self.modelData[index] = _self.checkboxData.join(';')
  175. },
  176. handleInputRadio (index) {
  177. let _self = this
  178. _self.modelData[index] = _self.radioData
  179. },
  180. submitForm (event) {
  181. event.preventDefault()
  182. let _self = this
  183. let datalist = _self.$store.state.formConfig.formData.data
  184. _self.operateid = datalist.operateid
  185. _self.operateurl = datalist.operateurl
  186. for (let [index, value] of datalist.data.formdetail.entries()) {
  187. _self.keys[value.fd_field] = _self.modelData[index]
  188. }
  189. let params = new FormData()
  190. params.append('data' , JSON.stringify(_self.keys))
  191. params.append('operate_id' , this.operateid)
  192. params.append('client_type' , 'cc')
  193. params.append('cityId' , this.user.currentCity ? this.user.currentCity.id : null)
  194. let config = {
  195. headers: {'Content-Type': 'multipart/form-data'}
  196. }
  197. // let config = {
  198. // headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  199. // transformRequest: [function (data) {
  200. // let ret = ''
  201. // for (let it in data) {
  202. // ret += encodeURIComponent(encodeURIComponent(it)) + '=' +
  203. // encodeURIComponent(encodeURIComponent(data[it])) + '&'
  204. // }
  205. // return ret
  206. // }]
  207. // }
  208. this.$http.post('/' + this.operateurl, params, config)
  209. // this.$http.post('/' + this.operateurl, { data: JSON.stringify(_self.keys), operate_id: this.operateid, client_type: 'cc', cityId: this.user.currentCity ? this.user.currentCity.id : null })
  210. .then(response => {
  211. if (response.data.success) {
  212. this.$message({
  213. message: '申请提交成功',
  214. type: 'success'
  215. })
  216. let _self = this
  217. _self.$router.push('/repairs/' + _self.$route.params.id + '/historicalInfo')
  218. }
  219. }, err => {
  220. console.log(err)
  221. this.$message.error('申请提交失败')
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style>
  228. .el-date-editor.el-input{
  229. width:100%;
  230. }
  231. .el-input__icon+.el-input__inner{
  232. border:1px solid #cbcbcb;
  233. }
  234. .repairs{
  235. margin-top:54px;
  236. width:100%;
  237. border-bottom: 8px solid #cbcbcb;
  238. padding-bottom:111px;
  239. background: #fff;
  240. }
  241. .container{
  242. width:1180px;
  243. padding-right:0;
  244. }
  245. .repairs .repairs-title{
  246. padding-top:40px;
  247. margin-bottom:40px;
  248. width:100%;
  249. display:inline-flex;
  250. justify-content:space-between;
  251. }
  252. .repairs .repairs-title .title-left p{
  253. font-size: 14px;
  254. color:#000;
  255. font-weight: bold;
  256. line-height: 14px;
  257. }
  258. .repairs .repairs-title .title-left span{
  259. font-size: 14px;
  260. color:#000;
  261. }
  262. .repairs .repairs-title .title-right a{
  263. color:#333;
  264. }
  265. .repairs .repairs-title .title-right a i{
  266. color:#5280e3;
  267. margin-right:10px;
  268. }
  269. .repairs .repairs-title .title-right a:hover{
  270. cursor:pointer;
  271. color:#d82128;
  272. }
  273. .repairs .repairs-flow{
  274. width:100%;
  275. display: inline-flex;
  276. margin-bottom:43px;
  277. }
  278. .repairs .repairs-flow ul li{
  279. height:50px;
  280. padding:0;
  281. }
  282. .repairs .repairs-flow ul li span{
  283. display: inline-block;
  284. width:150px;
  285. height:50px;
  286. line-height: 50px;
  287. border-radius:30px;
  288. text-align: center;
  289. font-size: 18px;
  290. color:#fff;
  291. }
  292. .repairs .repairs-flow ul li:hover span{
  293. cursor:pointer;
  294. }
  295. .repairs .repairs-flow ul li:nth-child(1){
  296. width:150px;
  297. }
  298. .repairs .repairs-flow ul li:nth-child(1) span{
  299. background: #62cde0;
  300. }
  301. .repairs .repairs-flow ul li:nth-child(2) span{
  302. background: #62afe0;
  303. }
  304. .repairs .repairs-flow ul li:nth-child(3) span{
  305. background: #6289e0;
  306. }
  307. .repairs .repairs-flow ul li:nth-child(4) span{
  308. background: #8662e0;
  309. }
  310. .repairs .repairs-flow ul li:nth-child(5) span{
  311. background: #c162e0;
  312. }
  313. .repairs .repairs-flow ul li:nth-child(6) span{
  314. background: #e062a3;
  315. }
  316. .repairs .repairs-flow ul li i{
  317. display: inline-block;
  318. padding:0 4px;
  319. font-size: 45px;
  320. color:#cacaca;
  321. position:relative;
  322. top:12px;
  323. }
  324. .repairs .repairs-form{
  325. width:1164px;
  326. margin:0 auto;
  327. border:1px solid #e6e6e6;
  328. margin-bottom:5px;
  329. padding:30px 50px 0 30px;
  330. color:#333;
  331. }
  332. .repairs .repairs-form .input-label{
  333. line-height: 34px;
  334. font-size: 14px;
  335. color:#666;
  336. text-align: right;
  337. }
  338. .repairs .repairs-btn button{
  339. width:228px;
  340. height:80px;
  341. color:#fff;
  342. font-size: 18px;
  343. text-align: center;
  344. background: #2f95dd;
  345. }
  346. .repairs .repairs-form .checkbox-inline{
  347. margin-right:10px;
  348. }
  349. .repairs .repairs-form .file-box {
  350. display: inline-block;
  351. position: relative;
  352. text-align: center;
  353. cursor: pointer;
  354. overflow: hidden;
  355. }
  356. .repairs .repairs-form .el-upload-list--picture-card .el-upload-list__item{
  357. width:120px;
  358. height:120px;
  359. }
  360. .repairs .repairs-form .el-upload--picture-card{
  361. width:120px;
  362. height:120px;
  363. line-height: 120px;
  364. border:2px solid #cbcbcb;
  365. }
  366. .repairs .repairs-form .file-box input
  367. {
  368. position: absolute;
  369. width: 0px;
  370. height: 0px;
  371. opacity: 0;
  372. filter: "alpha(opacity=0)";
  373. filter: alpha(opacity=0);
  374. -moz-opacity: 0;
  375. left: 0px;
  376. bottom:-15px;
  377. cursor: pointer;
  378. z-index: 2;
  379. }
  380. .repairs .repairs-form .file-title{
  381. display: inline-block;
  382. color:#333;
  383. font-weight: bold;
  384. width:410px;
  385. position:relative;
  386. top:-40px;
  387. left:25px;
  388. margin-right:-410px;
  389. }
  390. .repairs .repairs-form .file-title span{
  391. font-weight: normal;
  392. color:#cbcbcb;
  393. }
  394. .repairs .repairs-form .radio-inline{
  395. margin-right:10px;
  396. }
  397. </style>