FileDetails.vue 28 KB

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