index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='故障报修'></cus-header>
  4. <div class="boxs">
  5. <div class="box">
  6. <div class="box_item">
  7. <div class="left">项目订单号</div>
  8. <div class="right select" @tap="handleSelect(1)">
  9. <text>{{orderNo}}</text>
  10. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  11. </div>
  12. </div>
  13. <div class="box_item">
  14. <div class="left">报修地点</div>
  15. <div class="right select" @tap="handleSelect(2)">
  16. <text>{{placeText}}</text>
  17. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  18. </div>
  19. </div>
  20. <div class="box_item">
  21. <div class="left">产品名称</div>
  22. <div class="right select" @tap="handleSelect(3)">
  23. <text>{{productText}}</text>
  24. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  25. </div>
  26. </div>
  27. <div class="box_item">
  28. <div class="left">产品编号</div>
  29. <div class="right select" @tap="handleSelect(4)">
  30. <text>{{productNo}}</text>
  31. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="box">
  36. <div class="box_item">
  37. <div class="left">故障发生时间</div>
  38. <div class="right select" @tap="handleSelect(5)">
  39. <text>{{dateText}}</text>
  40. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  41. </div>
  42. </div>
  43. <div class="box_item">
  44. <div class="left">故障类型</div>
  45. <div class="right select" @tap="handleSelect(6)">
  46. <text>{{typeText}}</text>
  47. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  48. </div>
  49. </div>
  50. <div class="box_item">
  51. <div class="left">报修人员</div>
  52. <div class="right">
  53. <input type="text" placeholder="请输入报修人员" placeholder-class="inp_ph" v-model="dto.ggg">
  54. </div>
  55. </div>
  56. <div class="box_item2">
  57. <div class="top">故障描述</div>
  58. <div class="bottom">
  59. <u--textarea v-model="dto.hhh" placeholder="故障描述" placeholder-class="inp_ph2" border="none" height="110"></u--textarea>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="box">
  64. <div class="box_item2">
  65. <div class="top">故障照片</div>
  66. <div class="bottom" style="padding-top: 24rpx;">
  67. <u-upload width="180" height="180"
  68. :fileList="fileList"
  69. @afterRead="afterRead"
  70. @delete="deletePic"
  71. multiple
  72. :maxCount="5"
  73. ></u-upload>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="bottom_btn">
  79. <div class="btn" @tap="submit">提交</div>
  80. </div>
  81. <u-picker :itemHeight="88" :show="show1" :columns="columns1" keyName="label" title="项目订单号"
  82. @cancel="show1=false" @confirm="e=>confirm(e,1,'orderNo','aaa')" :immediateChange="true"></u-picker>
  83. <u-picker :itemHeight="88" :show="show2" :columns="columns2" keyName="label" title="报修地点"
  84. @cancel="show2=false" @confirm="e=>confirm(e,2,'placeText','bbb')" :immediateChange="true"></u-picker>
  85. <u-picker :itemHeight="88" :show="show3" :columns="columns3" keyName="label" title="产品名称"
  86. @cancel="show3=false" @confirm="e=>confirm(e,3,'productText','ccc')" :immediateChange="true"></u-picker>
  87. <u-picker :itemHeight="88" :show="show4" :columns="columns4" keyName="label" title="产品编号"
  88. @cancel="show4=false" @confirm="e=>confirm(e,4,'productNo','ddd')" :immediateChange="true"></u-picker>
  89. <u-datetime-picker :itemHeight="88" :show="show5" v-model="dto.eee" mode="date" title="故障发生时间"
  90. @cancel="show5=false" @confirm="e=>confirm(e,5)" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
  91. <u-picker :itemHeight="88" :show="show6" :columns="columns6" keyName="label" title="故障类型"
  92. @cancel="show6=false" @confirm="e=>confirm(e,6,'typeText','fff')" :immediateChange="true"></u-picker>
  93. </view>
  94. </template>
  95. <script>
  96. export default {
  97. data(){
  98. return {
  99. dto:{
  100. aaa:'',
  101. bbb:'',
  102. ccc:'',
  103. ddd:'',
  104. eee:'',
  105. fff:'',
  106. ggg:'',
  107. hhh:''
  108. },
  109. fileList:[],
  110. orderNo:'请选择项目订单号',
  111. placeText:'请选择报修地点',
  112. productText:'请选择产品名称',
  113. productNo:'请选择产品编号',
  114. dateText:'请选择故障发生时间',
  115. typeText:'请选择故障类型',
  116. show1:false,
  117. show2:false,
  118. show3:false,
  119. show4:false,
  120. show5:false,
  121. show6:false,
  122. columns1:[[
  123. {value:1,label:'PO20250408001'},
  124. {value:2,label:'PO20250408002'}
  125. ]],
  126. columns2:[[
  127. {value:1,label:'长鑫科技集团股份有限公司'},
  128. {value:2,label:'峻凌电子(合肥)有限公司'}
  129. ]],
  130. columns3:[[
  131. {value:1,label:'产品名称A'},
  132. {value:2,label:'产品名称B'},
  133. ]],
  134. columns4:[[
  135. {value:1,label:'P20250408001'},
  136. {value:2,label:'P20250408002'},
  137. ]],
  138. columns6:[[
  139. {value:1,label:'类型A'},
  140. {value:2,label:'类型B'},
  141. ]],
  142. minDate:'',
  143. maxDate:'',
  144. }
  145. },
  146. onLoad() {
  147. let d = new Date();
  148. this.minDate = new Date(d.getFullYear()-3,d.getMonth()+1,d.getDate()).getTime();
  149. this.maxDate = new Date().getTime();
  150. },
  151. methods:{
  152. handleSelect(type){
  153. this['show'+type] = true;
  154. },
  155. confirm(e,type,param,key){
  156. if(type!=5){
  157. this[param] = e.value[0].label;
  158. this.dto[key] = e.value[0].value;
  159. }else{
  160. this.dateText = new Date(e.value).Format('yyyy-MM-dd');
  161. this.dto.eee = JSON.parse(JSON.stringify(this.dateText));
  162. }
  163. this['show'+type] = false;
  164. },
  165. // 删除图片
  166. deletePic(event) {
  167. this.fileList.splice(event.index, 1);
  168. },
  169. // 新增图片
  170. async afterRead(event) {
  171. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  172. let lists = [].concat(event.file);
  173. let fileListLen = this.fileList.length;
  174. lists.map((item) => {
  175. this.fileList.push({
  176. ...item,
  177. status: "uploading",
  178. message: "上传中",
  179. });
  180. });
  181. for (let i = 0; i < lists.length; i++) {
  182. const result = await this.uploadFilePromise(lists[i].url);
  183. let item = this.fileList[fileListLen];
  184. this.fileList.splice(
  185. fileListLen,
  186. 1,
  187. Object.assign(item, {
  188. status: "success",
  189. message: "",
  190. url: result,
  191. })
  192. );
  193. fileListLen++;
  194. }
  195. },
  196. uploadFilePromise(url) {
  197. return new Promise((resolve, reject) => {
  198. let a = uni.uploadFile({
  199. url: "http://192.168.2.21:7001/upload", // 仅为示例,非真实的接口地址
  200. filePath: url,
  201. name: "file",
  202. formData: {
  203. user: "test",
  204. },
  205. success: (res) => {
  206. setTimeout(() => {
  207. resolve(res.data.data);
  208. }, 1000);
  209. },
  210. });
  211. });
  212. },
  213. submit(){
  214. uni.navigateBack()
  215. }
  216. }
  217. }
  218. </script>
  219. <style>
  220. .inp_ph{
  221. font-family: PingFangSC, PingFang SC;
  222. font-weight: 400;
  223. font-size: 28rpx;
  224. color: #B9C0C8;
  225. line-height: 40rpx;
  226. text-align: right;
  227. }
  228. .inp_ph2{
  229. font-family: PingFangSC, PingFang SC;
  230. font-weight: 400;
  231. font-size: 28rpx;
  232. color: #B9C0C8;
  233. line-height: 40rpx;
  234. text-align: left;
  235. }
  236. </style>
  237. <style scoped lang="less">
  238. ::v-deep .u-radio:last-child{
  239. margin-left: 93rpx !important;
  240. }
  241. ::v-deep .u-upload__button .u-icon__icon{
  242. font-size: 48rpx !important;
  243. }
  244. .page{
  245. padding-bottom: 168rpx;
  246. background: #F4F8FB;
  247. .boxs{
  248. padding: 0 24rpx;
  249. .box{
  250. background: #FFFFFF;
  251. border-radius: 16rpx;
  252. margin-top: 20rpx;
  253. padding: 0 24rpx;
  254. }
  255. }
  256. .box_item{
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  261. padding: 24rpx 0;
  262. .left{
  263. font-family: PingFangSC, PingFang SC;
  264. font-weight: 400;
  265. font-size: 30rpx;
  266. color: #1D2129;
  267. line-height: 42rpx;
  268. }
  269. .right{
  270. input{
  271. font-family: PingFangSC, PingFang SC;
  272. font-weight: 400;
  273. font-size: 28rpx;
  274. color: #4E5969;
  275. line-height: 40rpx;
  276. text-align: right;
  277. }
  278. &.select{
  279. display: flex;
  280. align-items: center;
  281. text{
  282. font-family: PingFangSC, PingFang SC;
  283. font-weight: 400;
  284. font-size: 28rpx;
  285. color: #B9C0C8;
  286. line-height: 40rpx;
  287. }
  288. image{
  289. width: 24rpx;
  290. height: 24rpx;
  291. margin-left: 10rpx;
  292. }
  293. }
  294. }
  295. }
  296. .box_item2{
  297. .top{
  298. font-family: PingFangSC, PingFang SC;
  299. font-weight: 400;
  300. font-size: 30rpx;
  301. color: #1D2129;
  302. line-height: 42rpx;
  303. padding-top: 24rpx;
  304. }
  305. .bottom{
  306. padding-bottom: 24rpx;
  307. input{
  308. font-family: PingFangSC, PingFang SC;
  309. font-weight: 400;
  310. font-size: 28rpx;
  311. color: #4E5969;
  312. line-height: 40rpx;
  313. }
  314. }
  315. }
  316. .bottom_btn{
  317. width: 100%;
  318. height: 148rpx;
  319. padding: 20rpx 48rpx;
  320. box-sizing: border-box;
  321. background: #FFFFFF;
  322. position: fixed;
  323. bottom: 0;
  324. left: 0;
  325. z-index: 9;
  326. .btn{
  327. width: 100%;
  328. height: 88rpx;
  329. background: #2E69EB;
  330. border-radius: 16rpx;
  331. font-family: PingFang-SC, PingFang-SC;
  332. font-weight: bold;
  333. font-size: 32rpx;
  334. color: #FFFFFF;
  335. line-height: 88rpx;
  336. text-align: center;
  337. }
  338. }
  339. }
  340. </style>