FileDetails.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  1. <template>
  2. <view>
  3. <view class="filedetails">
  4. <view class="cardBox" @click="selectCustomer"
  5. style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 12rpx 12rpx 0 0;">
  6. <!-- @click="pickerShowfun('KH')" -->
  7. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  8. <view style="display: flex;align-items: center;">
  9. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  10. <u-icon name="account" color="#FD4B09" size="18"></u-icon>
  11. <text style="font-size: 30rpx; margin-left: 10rpx;">客户</text>
  12. </view>
  13. <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="客户" border="none"
  14. v-model="form.corpName">
  15. </u--input>
  16. </view>
  17. </view>
  18. <view class="filedetails_right">
  19. <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
  20. </view>
  21. </view>
  22. <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
  23. <!-- <view class="filedetails_left">
  24. <view>
  25. <u--input prefixIcon="account"
  26. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  27. placeholder="联系人" border="none"
  28. v-model="form.contacts">
  29. </u--input>
  30. </view>
  31. </view>
  32. -->
  33. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  34. <view style="display: flex;align-items: center;">
  35. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  36. <u-icon name="account" color="#FD4B09" size="18"></u-icon>
  37. <text style="font-size: 30rpx; margin-left: 10rpx;">联系人</text>
  38. </view>
  39. <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
  40. placeholderStyle="fontSize:34rpx;" placeholder="联系人" border="none" v-model="form.contacts">
  41. </u--input>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
  46. <!-- <view class="filedetails_left">
  47. <view>
  48. <u--input prefixIcon="phone"
  49. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  50. placeholder="电话" border="none"
  51. v-model="form.contactsTel">
  52. </u--input>
  53. </view>
  54. </view> -->
  55. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  56. <view style="display: flex;align-items: center;">
  57. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  58. <u-icon name="account" color="#FD4B09" size="18"></u-icon>
  59. <text style="font-size: 30rpx; margin-left: 10rpx;">电话</text>
  60. </view>
  61. <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
  62. placeholderStyle="fontSize:34rpx;" placeholder="电话" border="none"
  63. v-model="form.contactsTel">
  64. </u--input>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="cardBox" style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
  69. <!-- <view class="filedetails_left">
  70. <view>
  71. <u--input prefixIcon="home"
  72. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  73. placeholder="地址" border="none"
  74. v-model="form.address">
  75. </u--input>
  76. </view>
  77. </view> -->
  78. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  79. <view style="display: flex;align-items: center;">
  80. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  81. <u-icon name="account" color="#FD4B09" size="18"></u-icon>
  82. <text style="font-size: 30rpx; margin-left: 10rpx;">地址</text>
  83. </view>
  84. <u--input inputAlign="right" prefixIconStyle="fontSize:50rpx;"
  85. placeholderStyle="fontSize:34rpx;" placeholder="地址" border="none" v-model="form.address">
  86. </u--input>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="cardBox" @click="calendarShowfun(1,1)"
  91. style="margin-bottom: 0; border-bottom: 4rpx solid #f5f5f5; border-radius: 0;">
  92. <!-- <view class="filedetails_left">
  93. <view>
  94. <u--input prefixIcon="calendar"
  95. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  96. disabled disabledColor="#fff" placeholder="请选择合同起" border="none"
  97. v-model="form.signingDateStart">
  98. </u--input>
  99. </view>
  100. </view>
  101. <view class="filedetails_right" @click="calendarShowfun(1,1)">
  102. <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
  103. </view> -->
  104. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  105. <view style="display: flex;align-items: center;">
  106. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  107. <u-icon name="calendar" color="#FD4B09" size="18"></u-icon>
  108. <text style="font-size: 30rpx; margin-left: 10rpx;">合同日期起</text>
  109. </view>
  110. <!-- <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="合同日期起" border="none"
  111. v-model="form.signingDateStart">
  112. </u--input> -->
  113. <uni-datetime-picker type="date" placeholder="合同日期起" @change="calendarConfirm" v-model="form.signingDateStart" :border="false"/>
  114. </view>
  115. </view>
  116. <!-- <view class="filedetails_right">
  117. <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
  118. </view> -->
  119. </view>
  120. <view class="cardBox" style="border-bottom: 4rpx solid #f5f5f5; border-radius: 0 0 12rpx 12rpx;">
  121. <!-- <view class="filedetails_left">
  122. <view>
  123. <u--input prefixIcon="calendar"
  124. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  125. disabled disabledColor="#fff" placeholder="请选择合同止" border="none"
  126. v-model="form.signingDateEnd">
  127. </u--input>
  128. </view>
  129. </view>
  130. <view class="filedetails_right" @click="calendarShowfun(1,2)">
  131. <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
  132. </view> -->
  133. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;"
  134. @click="calendarShowfun(1,2)">
  135. <view style="display: flex;align-items: center;">
  136. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  137. <u-icon name="calendar" color="#FD4B09" size="18"></u-icon>
  138. <text style="font-size: 30rpx; margin-left: 10rpx;">合同日期止</text>
  139. </view>
  140. <!-- <u--input inputAlign="right" disabled disabledColor="#fff" placeholder="合同日期止" border="none"
  141. v-model="form.signingDateEnd">
  142. </u--input> -->
  143. <uni-datetime-picker type="date" placeholder="合同日期止" @change="calendarConfirm" v-model="form.signingDateEnd" :border="false"/>
  144. </view>
  145. </view>
  146. <!-- <view class="filedetails_right">
  147. <u-icon name="arrow-right" color="#101010" size="22"></u-icon>
  148. </view> -->
  149. </view>
  150. <view class="cardBox">
  151. <u-upload :fileList="form.filesList" @afterRead="afterRead($event,1)" @delete="deletePic($event,1)"
  152. name="1" multiple :maxCount="10"></u-upload>
  153. </view>
  154. <view class="cardBox" style="display: flex;align-items: center;">
  155. <!-- <view class="filedetails_left">
  156. <view>
  157. <u--input prefixIcon="file-text"
  158. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  159. disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
  160. </u--input>
  161. </view>
  162. </view>
  163. <view class="filedetails_right" @click="EquipmentAddition">
  164. <u-icon name="list-dot" color="#101010" size="22"></u-icon>
  165. </view> -->
  166. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  167. <view style="display: flex;align-items: center;">
  168. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  169. <u-icon name="list-dot" color="#FD4B09" size="18"></u-icon>
  170. <text
  171. style="font-size: 30rpx; margin-left: 10rpx;">设备列表({{form.corpEquipmentArchivesItemList.length}})</text>
  172. </view>
  173. <!-- <u--input
  174. inputAlign="right"
  175. disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
  176. </u--input> -->
  177. </view>
  178. </view>
  179. <!-- <view class="filedetails_right" @click="EquipmentAddConfirm = true"> -->
  180. <!-- <u-icon name="file-text" color="#101010" size="22"></u-icon> -->
  181. <!-- <view style="font-size: 30rpx;
  182. width: 150rpx;
  183. height: 44rpx;
  184. background-color: #FD4B09;
  185. border-radius:44rpx;
  186. color: #fff;
  187. padding: 10rpx" @click="pickerShowfun('CP',null)">+添加设备</view> -->
  188. <!-- EquipmentAddConfirm = true -->
  189. <!-- </view> -->
  190. </view>
  191. <view class="cardBox" v-for="(item,index) in form.corpEquipmentArchivesItemList" :key="item.id"
  192. v-if="form.corpEquipmentArchivesItemList.length">
  193. <view class="listbox">
  194. <view class="listbox_title">
  195. <view class="listbox_titleXh">
  196. 设备{{index+1}}
  197. </view>
  198. <view class="listbox_titleDe" @click="DeleteWindow(item,index)">删除</view>
  199. </view>
  200. <view class="inputbox" @click="pickerShowfun('CP',index)">
  201. <!-- <view class="shebetext">设备名称:</view> -->
  202. <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;" disabled
  203. disabledColor="#fff" placeholder="请选择设备名称" border="bottom" v-model="item.cname">
  204. <!-- <template slot="suffix">
  205. <u-icon @click="pickerShowfun('CP',index)" name="arrow-right" color="#101010" size="20"></u-icon>
  206. </template> -->
  207. </u--input>
  208. </view>
  209. <view class="inputbox">
  210. <!-- <view class="shebetext">设备编号:</view> -->
  211. <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;"
  212. disabledColor="#fff" placeholder="请输入设备编号" border="bottom" v-model="item.code">
  213. </u--input>
  214. </view>
  215. <view class="inputbox">
  216. <!-- <view class="shebetext">设备描述:</view> -->
  217. <u--textarea v-model="item.equipmentDescribe" placeholderStyle="fontSize:30rpx;"
  218. placeholder="请输入设备描述">
  219. </u--textarea>
  220. </view>
  221. <view class="inputbox" @click="calendarShowfun(2,1,index)">
  222. <!-- <view class="shebetext">出厂日期:</view> -->
  223. <!-- <u--input prefixIconStyle="fontSize:60rpx;" placeholderStyle="fontSize:30rpx;" disabled
  224. disabledColor="#fff" placeholder="请选择出厂日期" border="bottom" v-model="item.exitDate"> -->
  225. <!-- <template slot="suffix">
  226. <u-icon @click="calendarShowfun(2,1,index)" name="arrow-right" color="#101010" size="20"></u-icon>
  227. </template> -->
  228. <!-- </u--input> -->
  229. <uni-datetime-picker type="date" placeholder="请选择出厂日期"
  230. v-model="item.exitDate" :border="false"/>
  231. </view>
  232. <view class="inputbox" @click="calendarShowfun(2,2,index)">
  233. <uni-datetime-picker type="date" placeholder="请选择保养日期"
  234. v-model="item.maintenanceDate" :border="false"/>
  235. </view>
  236. <view class="inputbox" @click="calendarShowfun(2,3,index)">
  237. <uni-datetime-picker type="date" placeholder="请选择安装日期"
  238. v-model="item.installDate" :border="false"/>
  239. </view>
  240. <view class="inputbox">
  241. <u--input
  242. prefixIconStyle="fontSize:60rpx;color:#215476"
  243. placeholderStyle="fontSize:30rpx;"
  244. disabledColor="#fff" placeholder="请输入规格" border="bottom"
  245. v-model="item.specs">
  246. </u--input>
  247. </view>
  248. <view class="inputbox" @click="pickerShowfun('PP',index)">
  249. <u--input
  250. prefixIconStyle="fontSize:60rpx;color:#215476"
  251. placeholderStyle="fontSize:30rpx;"
  252. disabled disabledColor="#fff" placeholder="请选择品牌" border="bottom"
  253. v-model="item.brand">
  254. <template slot="suffix">
  255. <u-icon name="arrow-right" color="#101010" size="20"></u-icon>
  256. </template>
  257. </u--input>
  258. </view>
  259. <view class="inputbox" style="margin-top: 20rpx;">
  260. <!-- <view class="shebetext">图片:</view> -->
  261. <u-upload :fileList="item.filesList" @afterRead="afterRead($event,2,index)"
  262. @delete="deletePic($event,2,index)" name="1" multiple :maxCount="10"></u-upload>
  263. </view>
  264. <!-- <view class="binahao">设备编号:{{item.code}}</view>
  265. <view class="bottombox">
  266. <view class="bottombox_img">
  267. <image :src="item.url" mode="widthFix"></image>
  268. </view>
  269. <view class="bottombox_text">
  270. <view class="bottombox_textleft">
  271. <view class="bottombox_textTitle">{{item.cname}}</view>
  272. <view>出厂日期:{{item.exitDate?item.exitDate.slice(0,10):''}}</view>
  273. <view>报修日期:{{item.repairReportDate?item.repairReportDate.slice(0,10):''}}</view>
  274. </view>
  275. <view class="bottombox_textRight">
  276. <u-icon name="arrow-right" color="#101010" size="20"></u-icon>
  277. </view>
  278. </view>
  279. </view> -->
  280. </view>
  281. </view>
  282. <view class="cardBox" style="display: flex;align-items: center;">
  283. <!-- <view class="filedetails_left">
  284. <view>
  285. <u--input prefixIcon="file-text"
  286. prefixIconStyle="fontSize:50rpx;" placeholderStyle="fontSize:34rpx;"
  287. disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
  288. </u--input>
  289. </view>
  290. </view>
  291. <view class="filedetails_right" @click="EquipmentAddition">
  292. <u-icon name="list-dot" color="#101010" size="22"></u-icon>
  293. </view> -->
  294. <view class="filedetails_left" style="width: 100%; margin-right: 20rpx;">
  295. <view style="display: flex;align-items: center;">
  296. <view class="shebetext" style="display: flex;align-items: center; color: #FD4B09;">
  297. <u-icon name="list-dot" color="#FD4B09" size="18"></u-icon>
  298. <text
  299. style="font-size: 30rpx; margin-left: 10rpx;">设备</text>
  300. </view>
  301. <!-- <u--input
  302. inputAlign="right"
  303. disabled disabledColor="#fff" :placeholder="`设备列表(${form.corpEquipmentArchivesItemList.length})`" border="none">
  304. </u--input> -->
  305. </view>
  306. </view>
  307. <view class="filedetails_right" @click="EquipmentAddConfirm = true">
  308. <!-- <u-icon name="file-text" color="#101010" size="22"></u-icon> -->
  309. <view style="font-size: 30rpx;
  310. width: 150rpx;
  311. background-color: #FD4B09;
  312. border-radius:44rpx;
  313. color: #fff;
  314. padding: 10rpx" @click="pickerShowfun('CP',null)">+添加设备</view>
  315. <!-- EquipmentAddConfirm = true -->
  316. </view>
  317. </view>
  318. </view>
  319. <view style="height: 100rpx;"></view>
  320. <view class="bottomButton">
  321. <view class="savebutton" @click="savefun">保存档案</view>
  322. </view>
  323. <u-picker :show="pickerShow" :columns="pickerColumns" keyName="cname" @confirm="pickerConfirm"
  324. @cancel="pickerCancel"></u-picker>
  325. <!-- 日期 -->
  326. <!-- <u-calendar :show="calendarShow" @confirm="calendarConfirm" @close="calendarClose"></u-calendar> -->
  327. <!-- 提示 -->
  328. <u-toast ref="uToast"></u-toast>
  329. <!-- 添加设备弹框 -->
  330. <!-- <u-modal :show="EquipmentAddConfirm" title="提示" showCancelButton @confirm="EquipmentAddition"
  331. @cancel="EquipmentAddConfirm = false">
  332. <view class="slot-content">
  333. <view class="inputbox" @click="pickerShowfun('CP',index)">
  334. <u--input
  335. prefixIconStyle="fontSize:60rpx;"
  336. placeholderStyle="fontSize:30rpx;"
  337. disabled disabledColor="#fff" placeholder="请选择设备名称" border="bottom"
  338. v-model="machine.cname" >
  339. </u--input>
  340. </view>
  341. <view class="inputbox">
  342. <u--input
  343. prefixIconStyle="fontSize:60rpx;"
  344. placeholderStyle="fontSize:30rpx;"
  345. disabledColor="#fff" placeholder="请输入设备编号" border="bottom"
  346. v-model="machine.code">
  347. </u--input>
  348. </view>
  349. <view class="inputbox">
  350. <u--textarea v-model="machine.equipmentDescribe"
  351. placeholderStyle="fontSize:30rpx;" placeholder="请输入设备描述" >
  352. </u--textarea>
  353. </view>
  354. <view class="inputbox" @click="calendarShowfun(machine.exitDate,2,1,index)">
  355. <u--input
  356. prefixIconStyle="fontSize:60rpx;"
  357. placeholderStyle="fontSize:30rpx;"
  358. disabled disabledColor="#fff" placeholder="请选择出厂日期" border="bottom"
  359. v-model="machine.exitDate">
  360. </u--input>
  361. </view>
  362. <view class="inputbox" @click="calendarShowfun(machine.maintenanceDate,2,2,index)">
  363. <u--input
  364. prefixIconStyle="fontSize:60rpx;"
  365. placeholderStyle="fontSize:30rpx;"
  366. disabled disabledColor="#fff" placeholder="请选择保养日期" border="bottom"
  367. v-model="machine.maintenanceDate">
  368. </u--input>
  369. </view>
  370. <view class="inputbox" style="margin-top: 20rpx;">
  371. <view class="shebetext">图片:</view>
  372. <u-upload
  373. :fileList="machine.filesList"
  374. @afterRead="afterRead($event,2,index)"
  375. @delete="deletePic($event,2,index)"
  376. name="1"
  377. multiple
  378. :maxCount="10"
  379. ></u-upload>
  380. </view>
  381. </view>
  382. </u-modal> -->
  383. <!-- 删除弹框 -->
  384. <u-modal :show="EquipmentDeleteConfirm" title="提示" showCancelButton @confirm="DeleteDevicefun"
  385. @cancel="EquipmentDeleteConfirm = false">
  386. <view class="slot-content">
  387. <rich-text nodes="确定要删除该设备吗?"></rich-text>
  388. </view>
  389. </u-modal>
  390. <!-- <u-datetime-picker :show="calendarShow" @confirm="calendarConfirm" @close="calendarShow = false" v-model="optionDate"
  391. mode="date"></u-datetime-picker> -->
  392. <!-- <u-calendar :show="calendarShow" @confirm="calendarConfirm" @close="calendarClose"></u-calendar> -->
  393. <u-loading-page style="z-index: 999;" bgColor="rgba(0,0,0,.5)" :loading="loading"></u-loading-page>
  394. </view>
  395. </template>
  396. <script>
  397. import {
  398. corpequipmentarchivesDetail,
  399. corpequipmentarchivesSubmit,
  400. goodsdescDescList,
  401. corpequipmentarchivesitemRemove,
  402. corpequipmentarchivesfilesRemove,
  403. brandDescListAll
  404. } from '@/api/device/index.js'
  405. import {
  406. corpsDescList
  407. } from '@/api/views/sale/index.js'
  408. import {
  409. queryDetail
  410. } from '@/api/views/customer/index.js'
  411. import http from '@/http/api.js'
  412. import {
  413. clientId,
  414. clientSecret
  415. } from '@/common/setting'
  416. export default {
  417. data() {
  418. return {
  419. loading:false,
  420. // 弹框
  421. // 设备添加
  422. EquipmentAddConfirm: false,
  423. // 设备删除
  424. EquipmentDeleteConfirm: false,
  425. EquipmentDeleteRow: {},
  426. EquipmentDeleteIndex: -1,
  427. // 传递过来的id
  428. id: null,
  429. // 绑定的数据
  430. form: {
  431. corpEquipmentArchivesItemList: [],
  432. filesList: []
  433. },
  434. // 弹窗的开启和管理
  435. pickerShow: false,
  436. // 弹窗的数据配置 数组嵌套
  437. pickerColumns: [],
  438. // 日期弹窗
  439. calendarShow: false,
  440. // 当前打开弹窗的状态
  441. calendarType: {
  442. type: null,
  443. sort: null,
  444. index: null
  445. },
  446. // 当前打开的弹窗的状态
  447. pickerType: {},
  448. // 设备弹窗
  449. machine: {},
  450. optionDate: 0
  451. }
  452. },
  453. onLoad(e) {
  454. this.id = e.id
  455. if (e.id) {
  456. this.corpequipmentarchivesDetailfun()
  457. }
  458. },
  459. onShow() {
  460. },
  461. methods: {
  462. disabledDate(time) {
  463. return time.getTime() > Date.now() - 8.64e7
  464. },
  465. // 保存新增
  466. savefun() {
  467. if (!this.form.corpName) {
  468. return this.$refs.uToast.show({
  469. type: 'warning',
  470. message: '客户名称不能为空',
  471. })
  472. }
  473. if (!this.form.contacts) {
  474. return this.$refs.uToast.show({
  475. type: 'warning',
  476. message: '联系人不能为空',
  477. })
  478. }
  479. if (!this.form.contactsTel) {
  480. return this.$refs.uToast.show({
  481. type: 'warning',
  482. message: '电话不能为空',
  483. })
  484. }
  485. if (!this.form.address) {
  486. return this.$refs.uToast.show({
  487. type: 'warning',
  488. message: '地址不能为空',
  489. })
  490. }
  491. // if (!this.form.corpEquipmentArchivesItemList.length > 0){
  492. // return this.$refs.uToast.show({
  493. // type: 'warning',
  494. // message: '请添加一条设备',
  495. // })
  496. // }
  497. this.form.corpEquipmentArchivesItemList.map(item => {
  498. if (!item.cname) {
  499. if (!item.equipmentDescribe) {
  500. return this.$refs.uToast.show({
  501. type: 'warning',
  502. message: '请维护设备描述',
  503. })
  504. }
  505. return
  506. }
  507. item.id = item.id ? item.id : null
  508. item.exitDate = item.exitDate ? item.exitDate + ' 00:00:00' : null
  509. item.repairReportDate = item.repairReportDate ? item.repairReportDate + ' 00:00:00' : null
  510. item.maintenanceDate = item.maintenanceDate ? item.maintenanceDate + ' 00:00:00' : null
  511. })
  512. const obj = {
  513. ...this.form,
  514. id: this.form.id ? this.form.id : null,
  515. sysNo: this.form.sysNo ? this.form.sysNo : null,
  516. equipmentNumber: this.form.corpEquipmentArchivesItemList.length,
  517. maintenanceSecond: this.form.maintenanceSecond ? this.form.maintenanceSecond : null,
  518. signingDateStart: this.form.signingDateStart ? this.form.signingDateStart + ' 00:00:00' : null,
  519. signingDateEnd: this.form.signingDateEnd ? this.form.signingDateEnd + ' 00:00:00' : null,
  520. remarks: this.form.remarks ? this.form.remarks : null
  521. }
  522. this.loading = true
  523. this.corpequipmentarchivesSubmitfun(obj)
  524. // setTimeout(()=>{
  525. // this.corpequipmentarchivesSubmitfun(obj)
  526. // }, 1000);
  527. },
  528. // 保存数据接口
  529. corpequipmentarchivesSubmitfun(obj) {
  530. corpequipmentarchivesSubmit(obj).then(res => {
  531. this.loading = false
  532. if (res.code == 200) {
  533. this.$refs.uToast.show({
  534. type: 'success',
  535. message: '操作成功',
  536. })
  537. this.form = res.data
  538. this.form.corpEquipmentArchivesItemList.map(item=>{
  539. item.exitDate = item.exitDate ? item.exitDate.slice(0,10) : null
  540. item.repairReportDate = item.repairReportDate ? item.repairReportDate.slice(0,10) : null
  541. item.maintenanceDate = item.maintenanceDate ? item.maintenanceDate.slice(0,10) : null
  542. })
  543. } else {
  544. this.$refs.uToast.show({
  545. type: 'error',
  546. message: res.msg,
  547. })
  548. }
  549. })
  550. },
  551. // 跳转选择用户
  552. selectCustomer() {
  553. this.$u.route('/pages/views/salesSlip/selectCustomer', {
  554. corpType: 'KH'
  555. });
  556. },
  557. // 选中用户赋值
  558. otherFun(user) {
  559. console.log(user);
  560. queryDetail({
  561. id: user.id
  562. }).then(res => {
  563. this.$set(this.form, 'address', res.data.corpsAddrList[0].detailedAddress)
  564. this.form.corpId = user.id
  565. this.form.corpName = res.data.cname
  566. this.form.contacts = res.data.attn
  567. this.form.contactsTel = res.data.tel
  568. })
  569. },
  570. // 设备新增
  571. EquipmentAddition() {
  572. this.form.corpEquipmentArchivesItemList.push({
  573. cname: '',
  574. cname: '',
  575. code: '',
  576. brand: '',
  577. specs: '',
  578. category: '',
  579. categoryitem: '',
  580. url: '',
  581. goodsTypeId: '',
  582. exitDate: '',
  583. repairReportDate: '',
  584. brandId: '',
  585. maintenanceDate: '',
  586. factoryId: '',
  587. factoryName: '',
  588. equipmentDescribe: '',
  589. maintenanceSecond: '',
  590. filesList: [],
  591. })
  592. this.EquipmentAddConfirm = false
  593. },
  594. // 弹窗的开启
  595. pickerShowfun(type, index) {
  596. this.pickerColumns = []
  597. if (type == 'KH') {
  598. this.pickerType.type = type
  599. this.pickerType.index = null
  600. corpsDescList({
  601. corpType: 'KH'
  602. }).then(res => {
  603. this.pickerColumns = [res.data]
  604. })
  605. this.pickerShow = true
  606. } else if (type == 'CP') {
  607. if (index == null) {
  608. this.pickerType.type = type
  609. this.pickerType.index = this.form.corpEquipmentArchivesItemList.length
  610. this.form.corpEquipmentArchivesItemList.push({
  611. cname: '',
  612. cname: '',
  613. code: '',
  614. brand: '',
  615. specs: '',
  616. category: '',
  617. categoryitem: '',
  618. url: '',
  619. goodsTypeId: '',
  620. exitDate: '',
  621. repairReportDate: '',
  622. brandId: '',
  623. maintenanceDate: '',
  624. factoryId: '',
  625. factoryName: '',
  626. equipmentDescribe: '',
  627. maintenanceSecond: '',
  628. filesList: [],
  629. })
  630. this.$u.route('/pages/device/FileDetails/selectMachine', {
  631. corpType: 'KH'
  632. });
  633. } else {
  634. this.pickerType.type = type
  635. this.pickerType.index = index
  636. this.$u.route('/pages/device/FileDetails/selectMachine', {
  637. corpType: 'KH'
  638. });
  639. }
  640. }else if (type == 'PP') {
  641. this.pickerType.type = type
  642. this.pickerType.index = index
  643. this.loading = true
  644. brandDescListAll({type: type}).then(res=>{
  645. this.loading = false
  646. this.pickerColumns = [res.data]
  647. this.pickerShow = true
  648. }).finally(err=>{
  649. this.loading = false
  650. })
  651. }else {}
  652. },
  653. machineOtherFun(form) {
  654. this.form.corpEquipmentArchivesItemList[this.pickerType.index].cname = form.cname
  655. // this.form.corpEquipmentArchivesItemList[this.pickerType.index].code = form.code
  656. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brand = form.brand
  657. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brandId = form.brandId
  658. this.form.corpEquipmentArchivesItemList[this.pickerType.index].specs = form.specs
  659. this.form.corpEquipmentArchivesItemList[this.pickerType.index].remarks = form.remarks
  660. this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeId = form.goodsTypeId
  661. this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeName = form.goodsTypeName
  662. this.form.corpEquipmentArchivesItemList[this.pickerType.index].maintenanceSecond = form.maintenanceSecond ?
  663. form.maintenanceSecond : null
  664. this.form.corpEquipmentArchivesItemList[this.pickerType.index].repairReportDate = form.repairReportDate
  665. this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryId = form.factoryId ? form
  666. .factoryId : null
  667. this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryName = form.factoryName ? form
  668. .factoryName : null
  669. this.form.corpEquipmentArchivesItemList[this.pickerType.index].categoryitem = form.categoryitem
  670. // this.form.corpEquipmentArchivesItemList[this.pickerType.index].equipmentDescribe = form.cname
  671. this.pickerType.index = null
  672. },
  673. // 弹窗点击确认按钮
  674. pickerConfirm(val) {
  675. if (this.pickerType.type == 'KH') {
  676. this.form.corpId = val.value[0].id
  677. this.form.corpName = val.value[0].cname
  678. queryDetail({
  679. id: val.value[0].id
  680. }).then(res => {
  681. this.$set(this.form, 'address', res.data.corpsAddrList[0].detailedAddress)
  682. this.form.contacts = res.data.attn
  683. this.form.contactsTel = res.data.tel
  684. })
  685. } else if (this.pickerType.type == 'CP') {
  686. this.form.corpEquipmentArchivesItemList[this.pickerType.index].cname = val.value[0].cname
  687. // this.form.corpEquipmentArchivesItemList[this.pickerType.index].code = val.value[0].code
  688. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brand = val.value[0].brand
  689. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brandId = val.value[0].brandId
  690. this.form.corpEquipmentArchivesItemList[this.pickerType.index].specs = val.value[0].specs
  691. this.form.corpEquipmentArchivesItemList[this.pickerType.index].remarks = val.value[0].remarks
  692. this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeId = val.value[0].goodsTypeId
  693. this.form.corpEquipmentArchivesItemList[this.pickerType.index].goodsTypeName = val.value[0]
  694. .goodsTypeName
  695. this.form.corpEquipmentArchivesItemList[this.pickerType.index].maintenanceSecond = val.value[0]
  696. .maintenanceSecond ? val.value[0].maintenanceSecond : null
  697. this.form.corpEquipmentArchivesItemList[this.pickerType.index].repairReportDate = val.value[0]
  698. .repairReportDate
  699. this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryId = val.value[0].factoryId ? val
  700. .value[0].factoryId : null
  701. this.form.corpEquipmentArchivesItemList[this.pickerType.index].factoryName = val.value[0].factoryName ?
  702. val.value[0].factoryName : null
  703. this.form.corpEquipmentArchivesItemList[this.pickerType.index].categoryitem = val.value[0].categoryitem
  704. // this.form.corpEquipmentArchivesItemList[this.pickerType.index].equipmentDescribe = val.value[0].cname
  705. } else if(this.pickerType.type == 'PP') {
  706. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brand = val.value[0].cname
  707. this.form.corpEquipmentArchivesItemList[this.pickerType.index].brandId = val.value[0].id
  708. }else {}
  709. this.pickerShow = false
  710. },
  711. // 弹窗点击取消按钮
  712. pickerCancel() {
  713. this.pickerShow = false
  714. },
  715. // 日历弹窗的开启
  716. calendarShowfun(type, sort, index) {
  717. // if (date != null && date != "") {
  718. // console.log("赋值");
  719. // console.log(date);
  720. // this.optionDate = Date.parse(date);
  721. // console.log(this.optionDate);
  722. // }
  723. this.calendarType.type = type
  724. this.calendarType.sort = sort
  725. this.calendarType.index = index
  726. this.calendarShow = true
  727. },
  728. // 日历关闭触发
  729. calendarClose() {
  730. this.calendarShow = false
  731. },
  732. // 日历选择完成触发
  733. calendarConfirm(val) {
  734. // var timer = new Date(val.value)
  735. //
  736. // const year = timer.getFullYear()
  737. // const month = timer.getMonth() + 1 // 由于月份从0开始,因此需加1
  738. // const day = timer.getDate()
  739. // const hour = timer.getHours()
  740. // const minute = timer.getMinutes()
  741. // const second = timer.getSeconds()
  742. // var data = `${this.pad(year, 4)}-${this.pad(month)}-${this.pad(day)}`
  743. if (this.calendarType.type == 1) {
  744. if (this.calendarType.sort == 1) {
  745. this.form.signingDateStart = val[0]
  746. } else {
  747. this.form.signingDateEnd = val[0]
  748. }
  749. } else {
  750. if (this.calendarType.sort == 1) {
  751. this.form.corpEquipmentArchivesItemList[this.calendarType.index].exitDate = val[0]
  752. } else {
  753. this.form.corpEquipmentArchivesItemList[this.calendarType.index].maintenanceDate = val[0]
  754. }
  755. }
  756. this.calendarShow = false
  757. },
  758. pad(timeEl, total = 2, str = '0') {
  759. return timeEl.toString().padStart(total, str)
  760. },
  761. // 详情接口
  762. corpequipmentarchivesDetailfun() {
  763. corpequipmentarchivesDetail({
  764. id: this.id
  765. }).then(res => {
  766. this.form = res.data
  767. this.form.corpEquipmentArchivesItemList.map(item=>{
  768. item.maintenanceDate = item.maintenanceDate.slice(0,10)
  769. item.exitDate = item.exitDate.slice(0,10)
  770. item.brand = item.brand?item.brand:''
  771. item.specs = item.specs?item.specs:''
  772. })
  773. })
  774. },
  775. // 删除弹窗
  776. DeleteWindow(row, index) {
  777. this.EquipmentDeleteRow = row;
  778. this.EquipmentDeleteIndex = index;
  779. this.EquipmentDeleteConfirm = true;
  780. },
  781. // 删除设备
  782. DeleteDevicefun() {
  783. var row = this.EquipmentDeleteRow
  784. var index = this.EquipmentDeleteIndex
  785. if (row.id) {
  786. this.form.corpEquipmentArchivesItemList.splice(index, 1)
  787. this.corpequipmentarchivesitemRemovefun(row.id)
  788. } else {
  789. this.form.corpEquipmentArchivesItemList.splice(index, 1)
  790. }
  791. this.EquipmentDeleteRow = null;
  792. this.EquipmentDeleteIndex = -1;
  793. this.EquipmentDeleteConfirm = false;
  794. },
  795. // 删除接口
  796. corpequipmentarchivesitemRemovefun(id) {
  797. corpequipmentarchivesitemRemove({
  798. ids: id
  799. }).then(res => {
  800. this.$refs.uToast.show({
  801. type: 'success',
  802. message: '操作成功',
  803. })
  804. })
  805. },
  806. // 新增图片
  807. async afterRead(event, type, index) {
  808. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  809. let lists = [].concat(event.file)
  810. console.log(event);
  811. console.log(lists, 394);
  812. if (type == 1) {
  813. let fileListLen = this.form.filesList.length
  814. lists.map((item) => {
  815. this.form.filesList.push({
  816. ...item,
  817. })
  818. })
  819. let sort = this.form.filesList.length
  820. for (let i = 0; i < lists.length; i++) {
  821. const result = await this.uploadFilePromise(lists[i].url)
  822. let item = this.form.filesList[fileListLen]
  823. this.form.filesList.splice(fileListLen, 1, Object.assign(item, {
  824. sort: sort,
  825. fileName: JSON.parse(result).data.originalName,
  826. url: JSON.parse(result).data.link,
  827. typeFiles:this.form.filesList.length == 1? '主图' : '附图'
  828. }))
  829. fileListLen++
  830. }
  831. } else if (type == 2) {
  832. let fileListLen = this.form.corpEquipmentArchivesItemList[index].filesList.length
  833. lists.map((item) => {
  834. this.form.corpEquipmentArchivesItemList[index].filesList.push({
  835. ...item,
  836. })
  837. })
  838. let sort = this.form.corpEquipmentArchivesItemList[index].filesList.length
  839. for (let i = 0; i < lists.length; i++) {
  840. const result = await this.uploadFilePromise(lists[i].url)
  841. let item = this.form.corpEquipmentArchivesItemList[index].filesList[fileListLen]
  842. this.form.corpEquipmentArchivesItemList[index].filesList.splice(fileListLen, 1, Object.assign(
  843. item, {
  844. sort: sort,
  845. fileName: JSON.parse(result).data.originalName,
  846. url: JSON.parse(result).data.link,
  847. typeFiles:this.form.corpEquipmentArchivesItemList[index].filesList.length == 1? '主图' : '附图'
  848. }))
  849. fileListLen++
  850. }
  851. } else {}
  852. },
  853. // 上传附件接口
  854. uploadFilePromise(url) {
  855. return new Promise((resolve, reject) => {
  856. let a = uni.uploadFile({
  857. url: http.config.baseURL +
  858. '/blade-resource/oss/endpoint/put-file', // 仅为示例,非真实的接口地址
  859. filePath: url,
  860. name: 'file',
  861. formData: {
  862. user: 'test'
  863. },
  864. header: {
  865. // 客户端认证参数
  866. 'Authorization': 'Basic ' + Base64.encode(clientId + ':' + clientSecret),
  867. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken')
  868. },
  869. success: (res) => {
  870. setTimeout(() => {
  871. resolve(res.data)
  872. }, 1000)
  873. }
  874. });
  875. })
  876. },
  877. // 删除图片
  878. deletePic(e, type, index) {
  879. if (type == 1) {
  880. this.form.filesList.splice(e.index, 1)
  881. this.corpequipmentarchivesfilesRemovefun(e.file)
  882. } else if (type == 2) {
  883. this.form.corpEquipmentArchivesItemList[index].filesList.splice(e.index, 1)
  884. this.corpequipmentarchivesfilesRemovefun(e.file)
  885. } else {}
  886. },
  887. // 附件删除接口
  888. corpequipmentarchivesfilesRemovefun(row){
  889. this.loading = true
  890. corpequipmentarchivesfilesRemove({ids:row.id}).then(res=>{
  891. this.loading = false
  892. this.$refs.uToast.show({
  893. type: 'success',
  894. message: '删除成功',
  895. })
  896. })
  897. }
  898. }
  899. }
  900. </script>
  901. <style lang="scss" scoped>
  902. .filedetails {
  903. padding: 20rpx;
  904. box-sizing: border-box;
  905. .listbox {
  906. width: 100%;
  907. .inputbox {
  908. display: flex;
  909. align-items: center;
  910. .shebetext {
  911. width: 140rpx;
  912. font-size: 32rpx;
  913. color: #215476;
  914. text-align: right;
  915. margin-right: 10rpx;
  916. }
  917. }
  918. .listbox_title {
  919. display: flex;
  920. align-items: center;
  921. justify-content: space-between;
  922. margin-bottom: 20rpx;
  923. .listbox_titleXh {
  924. font-size: 28rpx;
  925. background: #dd451b;
  926. width: 90rpx;
  927. height: 90rpx;
  928. color: #fff;
  929. text-align: center;
  930. line-height: 90rpx;
  931. border-radius: 50%;
  932. }
  933. .listbox_titleDe {
  934. font-size: 30rpx;
  935. border: 2rpx solid #dd451b;
  936. border-radius: 12rpx;
  937. padding: 5rpx 20rpx;
  938. color: #dd451b;
  939. }
  940. }
  941. .binahao {
  942. font-size: 30rpx;
  943. color: #101010;
  944. margin-bottom: 10rpx;
  945. }
  946. .bottombox {
  947. width: 100%;
  948. display: flex;
  949. align-content: center;
  950. .bottombox_img {
  951. // width: 35%;
  952. width: 220rpx;
  953. height: 220rpx;
  954. }
  955. .bottombox_text {
  956. margin-left: 20rpx;
  957. width: 65%;
  958. display: flex;
  959. align-items: center;
  960. justify-content: space-between;
  961. .bottombox_textleft {
  962. font-size: 30rpx;
  963. .bottombox_textTitle {
  964. font-size: 34rpx;
  965. color: #2d4a6a;
  966. font-weight: 500;
  967. margin-bottom: 20rpx;
  968. width: 400rpx;
  969. overflow: hidden;
  970. white-space: nowrap;
  971. text-overflow: ellipsis;
  972. }
  973. }
  974. .bottombox_textRight {}
  975. }
  976. }
  977. }
  978. }
  979. .cardBox {
  980. background: #fff;
  981. border-radius: 12rpx;
  982. width: 100%;
  983. padding: 20rpx 30rpx;
  984. box-sizing: border-box;
  985. display: flex;
  986. align-content: center;
  987. justify-content: space-between;
  988. margin-bottom: 20rpx;
  989. }
  990. .bottomButton {
  991. position: fixed;
  992. bottom: 0;
  993. width: 100%;
  994. padding: 20rpx 30rpx;
  995. background: #fff;
  996. display: flex;
  997. justify-content: center;
  998. align-items: center;
  999. box-sizing: border-box;
  1000. z-index: 98;
  1001. .savebutton {
  1002. border-radius: 30rpx;
  1003. // color: #3f7cef;
  1004. color: #fff;
  1005. font-size: 34rpx;
  1006. // border: 2rpx solid #3f7cef;
  1007. border: 2rpx solid #FD4B09;
  1008. background: #FD4B09;
  1009. padding: 10rpx 40rpx;
  1010. font-weight: 500;
  1011. }
  1012. }
  1013. image {
  1014. width: 100%;
  1015. }
  1016. </style>