FileDetails.vue 28 KB

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