FileDetails.vue 28 KB

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