details.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. <template>
  2. <div class="edit">
  3. <van-nav-bar title="报销凭证详情" left-text="返回" @click-left="back" fixed left-arrow />
  4. <van-form class="edit_form" label-width="140">
  5. <!-- 报销人 -->
  6. <van-field
  7. label="报销人"
  8. @click="ownerIdShowCli(1)"
  9. readonly
  10. clickable
  11. required
  12. >
  13. <template #input>
  14. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='formshowText.name'></ww-open-data></span>
  15. <span v-else>{{formshowText.name}}</span>
  16. </template>
  17. </van-field>
  18. <div v-if="auditTypeItem.auditType == 2">
  19. <van-field label="第一审核人" @click="ownerIdShowCli(2)" readonly clickable required :disabled="editForm.reviewProcess > 0">
  20. <template #input>
  21. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName'
  22. :openid='firstCheckerText.name'></ww-open-data></span>
  23. <span v-else>{{ firstCheckerText.name }}</span>
  24. </template>
  25. </van-field>
  26. <van-field label="第二审核人" @click="ownerIdShowCli(3)" readonly clickable required :disabled="editForm.reviewProcess > 1">
  27. <template #input>
  28. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName'
  29. :openid='secondCheckerText.name'></ww-open-data></span>
  30. <span v-else>{{ secondCheckerText.name }}</span>
  31. </template>
  32. </van-field>
  33. </div>
  34. <van-popup v-model="ownerIdShow" position="bottom" v-if="false">
  35. <van-picker
  36. value-key="name"
  37. show-toolbar
  38. :columns="userList"
  39. @confirm="ownerIdChange"
  40. @cancel="
  41. ownerIdShow = false;
  42. $forceUpdate();
  43. "
  44. />
  45. </van-popup>
  46. <!-- 填报日期 -->
  47. <van-field
  48. v-model="editForm.createDate"
  49. label="填报日期"
  50. @click="createDateShow = true"
  51. readonly
  52. clickable
  53. required
  54. ></van-field>
  55. <van-popup v-model="createDateShow" position="bottom" v-if="canEdit">
  56. <van-datetime-picker
  57. type="date"
  58. title="选择填报日期"
  59. @confirm="createDateChange"
  60. @cancel="
  61. createDateShow = false;
  62. $forceUpdate();
  63. "
  64. v-model="currentDate1"
  65. :min-date="minDate"
  66. :max-date="maxDate"
  67. />
  68. </van-popup>
  69. <!-- 发票张数 -->
  70. <van-field label="发票张数" :readonly="!canEdit" v-if="user.timeType.easyExpense==0">
  71. <template #input>
  72. <van-stepper v-model="editForm.ticketNum" :disabled="!canEdit" disable-input @plus="ticNumChange(1)" @minus="ticNumChange(0)" />
  73. </template>
  74. </van-field>
  75. <!-- 费用类型 -->
  76. <van-field v-model="editForm.type" label="费用主类型" @click="typeShow = true" readonly clickable>
  77. <template #input>{{expenseMainType.text}}</template>
  78. </van-field>
  79. <van-popup v-model="typeShow" position="bottom" v-if="canEdit">
  80. <van-picker
  81. show-toolbar
  82. :columns="typeList"
  83. @confirm="typeChange"
  84. @cancel="typeShow = false;$forceUpdate();"/>
  85. </van-popup>
  86. <!-- 备注 -->
  87. <van-field v-model="editForm.remark" label="备注" :readonly="!canEdit" type="textarea"></van-field>
  88. <!-- 发票 -->
  89. <van-field label="发票" readonly>
  90. <template #input
  91. >总费用: ¥{{ totalCost }}</template
  92. >
  93. </van-field>
  94. <div class="invoice" v-if="invoiceList.length != 0">
  95. <div
  96. v-for="(item, index) in invoiceList"
  97. :key="item.id"
  98. style="position: relative"
  99. :class="index == 0 ? '' : 'invoice_item'"
  100. >
  101. <van-icon
  102. name="delete-o"
  103. class="deletebtn"
  104. @click="deleteInvoice(index)"
  105. v-if="canEdit && index != 0"
  106. />
  107. <van-field
  108. label="所属项目:"
  109. v-model="item.projectId"
  110. @click="(in_projectShow = true), (invoiceIndex = index)"
  111. readonly
  112. clickable
  113. required
  114. >
  115. <template #input>{{
  116. formshowText.inProjectName[index]
  117. }}</template>
  118. </van-field>
  119. <van-field
  120. label="费用日期:"
  121. v-model="item.happenDate"
  122. @click="(in_dateShow = true), (invoiceIndex = index)"
  123. readonly
  124. clickable
  125. required
  126. ></van-field>
  127. <van-field
  128. label="发票种类:"
  129. v-model="item.invoiceType"
  130. @click="(in_typeShow = true), (invoiceIndex = index)"
  131. readonly
  132. clickable
  133. required
  134. v-if="user.timeType.easyExpense==0"
  135. >
  136. <template #input>{{
  137. inTypeList[item.invoiceType]
  138. }}</template>
  139. </van-field>
  140. <van-field
  141. label="费用类型:"
  142. v-model="item.expenseType"
  143. @click="(in_exTypeShow = true), (invoiceIndex = index)"
  144. readonly
  145. clickable
  146. required
  147. ></van-field>
  148. <van-field
  149. :label="`${user.timeType.easyExpense==0?'费用金额(含税)':'费用金额'}:`"
  150. v-model="item.amount"
  151. type="number"
  152. :readonly="!canEdit"
  153. required
  154. ></van-field>
  155. <van-field
  156. label="发票号:"
  157. v-model="item.invoiceNo"
  158. readonly
  159. v-if="user.timeType.easyExpense==0"
  160. ></van-field>
  161. <van-field
  162. label="税率%:"
  163. v-model="item.taxPercent"
  164. :readonly="!canEdit"
  165. v-if="user.timeType.easyExpense==0"
  166. ></van-field>
  167. <van-field
  168. label="税额:"
  169. readonly
  170. v-if="user.timeType.easyExpense==0"
  171. ><template #input>¥{{getTaxValue(item.amount,item.taxPercent)}}</template></van-field>
  172. <van-field label="备注:" v-model="item.remark" :readonly="!canEdit"></van-field>
  173. <van-field
  174. @click="invoiceIndex = index"
  175. :clickable="!canEdit"
  176. label-width="0em"
  177. >
  178. <template #input>
  179. <div class="imgListVan">
  180. <div>报销凭证:</div>
  181. <div class="vanUploaderImg">
  182. <!-- <van-uploader
  183. v-model="uploader[index]"
  184. :before-read="beforeRead"
  185. :after-read="afterRead"
  186. @delete="item.pic = null"
  187. :max-count="1"
  188. :disabled="!canEdit"
  189. :deletable="canEdit"
  190. /> -->
  191. <van-uploader
  192. v-model="uploader[index]"
  193. :before-read="beforeRead"
  194. :after-read="afterRead"
  195. @delete="(file, Item) => {deteleImg(file, Item, index)}"
  196. :max-count="10"
  197. :disabled="!canEdit"
  198. :deletable="canEdit"
  199. multiple
  200. />
  201. </div>
  202. </div>
  203. </template>
  204. </van-field>
  205. <van-field
  206. label="状态" >
  207. <template #input>
  208. <span :class="statusClass[item.status]">{{
  209. statusList[item.status] }}</span>
  210. </template>
  211. </van-field>
  212. <van-field
  213. label="审核人" v-if="item.projectManagerName">
  214. <template #input>
  215. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='item.projectManagerName'></ww-open-data></span>
  216. <span v-else>{{item.projectManagerName}}</span>
  217. </template>
  218. </van-field>
  219. <van-field
  220. label="操作" v-if="isAudit && item.isIncharger && item.status == 1"
  221. >
  222. <template #input>
  223. <div style="float:right;">
  224. <van-button type="info" :loading="item.approveLoading"
  225. @click.stop="approveSingle(item)">通过</van-button>
  226. <van-button style="margin-left:25px" type="danger" :loading="item.approveLoading"
  227. @click.stop="denySingle(item)">驳回</van-button>
  228. </div>
  229. </template>
  230. </van-field>
  231. </div>
  232. </div>
  233. <div class="addinvoice" v-if="canEdit"><van-button size="small" icon="plus" type="info" plain hairline @click="addInvoice">添加发票</van-button></div>
  234. <!-- 发票-popup -->
  235. <span>
  236. <!-- 所属项目 -->
  237. <van-popup v-model="in_projectShow" position="bottom" v-if="canEdit">
  238. <van-picker
  239. value-key="projectName"
  240. show-toolbar
  241. :columns="inProjectList"
  242. @confirm="inProjectChange"
  243. @cancel="
  244. in_projectShow = false;
  245. $forceUpdate();
  246. "
  247. />
  248. </van-popup>
  249. <!-- 费用日期 -->
  250. <van-popup v-model="in_dateShow" position="bottom" v-if="canEdit">
  251. <van-datetime-picker
  252. type="date"
  253. title="选择费用日期"
  254. v-model="currentDate2"
  255. @confirm="inDateChange"
  256. @cancel="
  257. in_dateShow = false;
  258. $forceUpdate();
  259. "
  260. :min-date="minDate"
  261. :max-date="maxDate"
  262. />
  263. </van-popup>
  264. <!-- 发票种类 -->
  265. <van-popup v-model="in_typeShow" position="bottom" v-if="canEdit && user.timeType.easyExpense==0" >
  266. <van-picker
  267. show-toolbar
  268. :columns="inTypeList"
  269. @confirm="inTypeChange"
  270. @cancel="
  271. in_typeShow = false;
  272. $forceUpdate();
  273. "
  274. />
  275. </van-popup>
  276. <!-- 费用类型 -->
  277. <van-popup v-model="in_exTypeShow" position="bottom" v-if="canEdit">
  278. <van-picker
  279. value-key="typeName"
  280. show-toolbar
  281. :columns="inexTypeList"
  282. @confirm="inexTypeChange"
  283. @cancel="
  284. in_exTypeShow = false;
  285. $forceUpdate();
  286. "
  287. />
  288. </van-popup>
  289. </span>
  290. </van-form>
  291. <!-- 提交 -->
  292. <div class="form_btn" style="position: fixed; bottom: 0px; width: 100%" v-if="canEdit">
  293. <div style="padding-bottom: 10px">
  294. <van-button
  295. square
  296. block
  297. type="info"
  298. @click="submitExpense"
  299. :loading="confirmLoading"
  300. style="width: 100%; float: left"
  301. >提交</van-button
  302. >
  303. </div>
  304. </div>
  305. </div>
  306. </template>
  307. <script>
  308. export default {
  309. data() {
  310. return {
  311. statusList: ['审核通过', '待审核', '已驳回', '已撤销'],
  312. statusClass: ['', 'waiting', 'rejected', ''],
  313. isAudit: false,
  314. user: JSON.parse(localStorage.userInfo),
  315. canEdit: this.$route.params.canEdit,
  316. currentDate1 : new Date(),
  317. currentDate2 : new Date(),
  318. minDate: new Date(2020,0,1),
  319. maxDate: new Date(2025,11,31),
  320. editForm: {
  321. ownerId: '',
  322. createDate: '',
  323. ticketNum: 0,
  324. type: 0,
  325. remark: ''
  326. },
  327. invoiceList: [],
  328. confirmLoading: false,
  329. formshowText: {
  330. name: '',
  331. inProjectName: []
  332. },
  333. ownerIdShow: false,
  334. userList: [],
  335. createDateShow: false,
  336. typeShow: false,
  337. typeList: ['一般','差旅','外包'],
  338. invoiceIndex: 0,
  339. in_projectShow: false,
  340. inProjectList: [],
  341. in_dateShow: false,
  342. in_typeShow: false,
  343. inTypeList: ['增值税专用发票','增值税普通发票'],
  344. in_exTypeShow: false,
  345. allexTypeList: [],
  346. inexTypeList: [],
  347. uploader: [[]],
  348. expenseMainType:{
  349. text:''
  350. },
  351. firstCheckerText: {},
  352. secondCheckerText: {},
  353. auditTypeItem: {}
  354. }
  355. },
  356. computed: {
  357. totalCost(){
  358. let costnum = 0
  359. for(let i in this.invoiceList){
  360. costnum += (this.invoiceList[i].amount ? parseFloat(this.invoiceList[i].amount) : 0)
  361. }
  362. return costnum.toFixed(2)
  363. }
  364. },
  365. filters: {
  366. numtosum(value) {
  367. if (value == undefined || !value) return '0.00'
  368. value = value.toFixed(2)
  369. const intPart = Math.trunc(value)
  370. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  371. let floatPart = '.00'
  372. const valueArray = value.toString().split('.')
  373. if (valueArray.length === 2) { // 有小数部分
  374. floatPart = valueArray[1].toString() // 取得小数部分
  375. return intPartFormat + '.' + floatPart
  376. }
  377. return intPartFormat + floatPart
  378. },
  379. },
  380. mounted() {
  381. console.log(this.$route.params);
  382. this.isAudit = this.$route.params.isAudit;
  383. this.getAuditType()
  384. this.getDetail()
  385. if(this.canEdit){
  386. this.getProjectList()
  387. }
  388. this.getExpensMainTypes()
  389. },
  390. methods: {
  391. back(){
  392. history.back();
  393. },
  394. formatDate(date) {
  395. let mon = date.getMonth() + 1
  396. return `${date.getFullYear()}-${mon<10?'0'+mon:mon}-${date.getDate()<10?'0'+date.getDate():date.getDate()}`;
  397. },
  398. getTaxValue(amount,percent){
  399. let per = percent / 100
  400. let amo = amount / (1 + per)*per
  401. return amo.toFixed(2)
  402. },
  403. // costCount(){
  404. // let costnum = 0
  405. // for(let i in this.invoiceList){
  406. // costnum += this.invoiceList[i].amount*1
  407. // }
  408. // this.totalCost = costnum
  409. // },
  410. ownerIdChange(value,key){
  411. this.editForm.ownerId = value.id
  412. this.formshowText.name = value.name
  413. this.ownerIdShow = false
  414. },
  415. createDateChange(value,key){
  416. this.editForm.createDate = this.formatDate(value)
  417. this.createDateShow = false
  418. },
  419. typeChange(value,key){
  420. this.editForm.type = value.id
  421. this.expenseMainType.text=value.name
  422. this.typeShow = false
  423. for(let i in this.invoiceList){
  424. this.invoiceList[i].expenseType=''
  425. }
  426. console.log(this.editForm.type)
  427. this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
  428. },
  429. ticNumChange(value){
  430. if(value){
  431. this.invoiceList.push({
  432. projectId: '',
  433. happenDate: '',
  434. invoiceType: '',
  435. expenseType: '',
  436. amount: '',
  437. invoiceNo: '',
  438. taxPercent: '',
  439. taxValue: '',
  440. remark: '',
  441. pic: '',
  442. })
  443. }else{
  444. this.invoiceList.pop()
  445. }
  446. },
  447. getExpensMainTypes(){
  448. this.$axios.post("/expense-main-type/list", {})
  449. .then(res => {
  450. if(res.code == "ok") {
  451. for(var i in res.data) {
  452. res.data[i].text = res.data[i].name
  453. }
  454. this.typeList=res.data
  455. this.expenseMainType.text=res.data[0].name
  456. this.editForm.type=res.data[0].id
  457. this.getExTypeList
  458. } else {
  459. this.$toast.fail('获取失败');
  460. }
  461. }).catch(err=> {this.$toast.clear();console.log(err)});
  462. },
  463. addInvoice(){
  464. this.invoiceList.push({
  465. projectId: '',
  466. happenDate: '',
  467. invoiceType: '',
  468. expenseType: '',
  469. amount: '',
  470. invoiceNo: '',
  471. taxPercent: '',
  472. taxValue: '',
  473. remark: '',
  474. pic: '',
  475. })
  476. this.uploader.push([])
  477. this.editForm.ticketNum = this.invoiceList.length
  478. },
  479. deleteInvoice(index){
  480. this.invoiceList.splice(index,1)
  481. this.editForm.ticketNum = this.invoiceList.length
  482. this.uploader.splice(index,1)
  483. },
  484. inProjectChange(value,key){
  485. this.formshowText.inProjectName[this.invoiceIndex] = value.projectName
  486. this.invoiceList[this.invoiceIndex].projectId = value.id
  487. this.in_projectShow = false
  488. },
  489. inDateChange(value,key){
  490. this.invoiceList[this.invoiceIndex].happenDate = this.formatDate(value)
  491. this.in_dateShow = false
  492. },
  493. inTypeChange(value,key){
  494. this.invoiceList[this.invoiceIndex].invoiceType = key
  495. this.in_typeShow = false
  496. },
  497. inexTypeChange(value,key){
  498. this.invoiceList[this.invoiceIndex].expenseType = value.typeName
  499. this.in_exTypeShow = false
  500. },
  501. beforeRead(file){
  502. // if(file.type != 'image/jpeg' && file.type != 'image/png'){
  503. // this.$toast.fail('请选择jpg或png格式的图片')
  504. // return false
  505. // }
  506. // return true
  507. let newFile = Array.isArray(file) ? file : [file]
  508. for(var i in newFile) {
  509. const fileItem = newFile[i]
  510. if (fileItem.type != 'image/jpeg' && fileItem.type != 'image/png' && fileItem.type != 'image/jpg') {
  511. this.$toast.fail('请选择jpg或png格式的图片')
  512. return false
  513. }
  514. }
  515. return true
  516. },
  517. afterRead(file){
  518. // let formData = new FormData();
  519. // formData.append("multipartFile", file.file);
  520. // this.$axios.post("/common/uploadFile", formData)
  521. // .then(res => {
  522. // if(res.code == "ok") {
  523. // this.invoiceList[this.invoiceIndex].pic = res.data
  524. // } else {
  525. // this.$toast.fail('上传失败');
  526. // this.uploader[this.invoiceIndex] = []
  527. // }
  528. // }).catch(err=> {this.$toast.clear();console.log(err);this.uploader[this.invoiceIndex]=[]});
  529. let newFile = Array.isArray(file) ? file : [file]
  530. let formData = new FormData();
  531. for(var i in newFile) {
  532. formData.append("multipartFiles", newFile[i].file);
  533. }
  534. this.$axios.post("/common/uploadFileArray", formData)
  535. .then(res => {
  536. if (res.code == "ok") {
  537. let newPic = this.invoiceList[this.invoiceIndex].pic || []
  538. let newData = res.data.split(';')
  539. this.invoiceList[this.invoiceIndex].pic = [...newPic, ...newData]
  540. console.log(this.invoiceList[this.invoiceIndex].pic, '<=== 合计图片')
  541. } else {
  542. this.$toast.fail('上传失败');
  543. this.uploader[this.invoiceIndex] = []
  544. }
  545. }).catch(err => { this.$toast.clear(); console.log(err); this.uploader[this.invoiceIndex] = [] });
  546. },
  547. // 删除图片
  548. deteleImg(file, item, arrIndex) {
  549. let index = item.index
  550. this.invoiceList[arrIndex].pic = this.invoiceList[arrIndex].pic.filter((item,i) => i != index)
  551. },
  552. submitExpense(){
  553. if(!this.editForm.ownerId){
  554. this.$toast.fail('请选择报销人')
  555. return
  556. }
  557. if(!this.editForm.createDate){
  558. this.$toast.fail('请选择填报日期')
  559. return
  560. }
  561. if(this.auditTypeItem.auditType == 2) {
  562. if(!this.firstCheckerText.id || !this.secondCheckerText.id) {
  563. this.$toast.fail(`${!this.firstCheckerText.id ? '请选择第一审核人' : '请选择第二审核人'}`)
  564. return
  565. } else {
  566. this.editForm.firstCheckerId = this.firstCheckerText.id
  567. this.editForm.secondCheckerId = this.secondCheckerText.id
  568. }
  569. }
  570. let required1 = false
  571. let required2 = false
  572. let required3 = false
  573. let required4 = false
  574. let required5 = false
  575. for(let i in this.invoiceList){
  576. if(!this.invoiceList[i].projectId){
  577. required1 = '所属项目'
  578. }
  579. if(!this.invoiceList[i].happenDate){
  580. required2 = '费用日期'
  581. }
  582. if(!this.invoiceList[i].invoiceType){
  583. required3 = '发票种类'
  584. }
  585. if(!this.invoiceList[i].expenseType){
  586. required4 = '费用类型'
  587. }
  588. if(!this.invoiceList[i].amount){
  589. required5 = '费用金额(含税)'
  590. }
  591. }
  592. if(required1 || required2 || required3 || required4 || required5){
  593. let requiredStr = (required1 ? required1 + '、' : '')
  594. + (required2 ? required2 + '、' : '')
  595. + (required3 ? required3 + '、' : '')
  596. + (required4 ? required4 + '、' : '')
  597. + (required5 ? required5 + '、' : '')
  598. requiredStr = requiredStr.substring(0,requiredStr.length - 1)
  599. this.$toast.fail('请添加发票的[' + requiredStr + ']')
  600. return
  601. }
  602. let newList = JSON.parse(JSON.stringify(this.invoiceList))
  603. for(let i in newList) {
  604. if(newList[i].pic) {
  605. newList[i].pic = newList[i].pic.join(',')
  606. }
  607. }
  608. delete this.editForm.invoiceList
  609. // this.editForm.items = JSON.stringify(this.invoiceList)
  610. this.editForm.items = JSON.stringify(newList)
  611. this.editForm.totalAmount = this.totalCost
  612. this.confirmLoading = true
  613. this.$axios.post("/expense-sheet/add", this.editForm)
  614. .then(res => {
  615. if(res.code == "ok") {
  616. this.$toast.success('提交成功')
  617. this.confirmLoading = false
  618. this.back()
  619. } else {
  620. this.confirmLoading = false
  621. this.$toast.fail(res.msg || res.code || '获取失败');
  622. }
  623. }).catch(err=> {this.confirmLoading = false;this.$toast.clear();console.log(err)});
  624. },
  625. getDetail(){
  626. this.$axios.post("/expense-sheet/getDetail", {id: this.$route.params.id})
  627. .then(res => {
  628. if(res.code == "ok") {
  629. this.editForm = res.data
  630. if(this.canEdit){this.getExTypeList()}
  631. this.formshowText.name = res.data.ownerName
  632. this.totalCost = res.data.totalAmount
  633. this.invoiceList = res.data.invoiceList
  634. if(this.auditTypeItem.auditType == 2) {
  635. this.firstCheckerText = {
  636. id: res.data.firstCheckerId,
  637. name: res.data.firstCheckerName
  638. }
  639. this.secondCheckerText = {
  640. id: res.data.secondCheckerId,
  641. name: res.data.secondCheckerName
  642. }
  643. }
  644. for(let i in res.data.invoiceList){
  645. this.formshowText.inProjectName.push(res.data.invoiceList[i].projectName)
  646. res.data.invoiceList[i].approveLoading = false;
  647. if(res.data.invoiceList[i].pic){
  648. // this.uploader[i] = [{url:'/upload/' + res.data.invoiceList[i].pic}]
  649. let pic = res.data.invoiceList[i].pic
  650. let picArr = pic.split(',').map(item => {
  651. return { url: `/upload/${item}`}
  652. // return { url: `http://47.101.180.183/upload/${item}`}
  653. })
  654. res.data.invoiceList[i].pic = pic.split(',').map(item => item)
  655. this.uploader[i] = picArr
  656. console.log('每一项的图片', picArr)
  657. }else{
  658. this.uploader[i] = []
  659. }
  660. }
  661. } else {
  662. this.$toast.fail(res.msg || res.code || '获取失败');
  663. }
  664. }).catch(err=> {this.$toast.clear();console.log(err)});
  665. },
  666. getUserList(){
  667. this.$axios.post("/user/getSimpleActiveUserList", {})
  668. .then(res => {
  669. if(res.code == "ok") {
  670. this.userList = res.data
  671. } else {
  672. this.$toast.fail(res.msg || res.code || '获取失败');
  673. }
  674. }).catch(err=> {this.$toast.clear();console.log(err)});
  675. },
  676. getProjectList(){
  677. this.$axios.post("/project/getProjectList", {})
  678. .then(res => {
  679. if(res.code == "ok") {
  680. this.inProjectList = res.data
  681. } else {
  682. this.$toast.fail(res.msg || res.code || '获取失败');
  683. }
  684. }).catch(err=> {this.$toast.clear();console.log(err)});
  685. },
  686. getExTypeList(){
  687. this.$axios.post("/expense-type/getList", {})
  688. .then(res => {
  689. if(res.code == "ok") {
  690. this.allexTypeList = res.data
  691. this.inexTypeList = this.allexTypeList.filter(a=>a.mainType == this.editForm.type)
  692. } else {
  693. this.$toast.fail(res.msg || res.code || '获取失败');
  694. }
  695. }).catch(err=> {this.$toast.clear();console.log(err)});
  696. },
  697. // 单据审核
  698. approveSingle(item) {
  699. item.approveLoading = true;
  700. this.$axios.post("/expense-sheet/approveSingleProject", { id: item.id })
  701. .then(res => {
  702. if (res.code == "ok") {
  703. this.$toast.success('已通过')
  704. item.approveLoading = false
  705. this.getDetail();
  706. } else {
  707. this.$toast.fail(res.msg || res.code || '获取失败');
  708. }
  709. }).catch(err => { this.$toast.clear(); console.log(err) });
  710. },
  711. denySingle(item) {
  712. item.approveLoading = true;
  713. this.$axios.post("/expense-sheet/denySingleProject", {id: item.id})
  714. .then(res => {
  715. if (res.code == "ok") {
  716. this.$toast.success('已驳回')
  717. item.approveLoading = false
  718. this.getDetail();
  719. } else {
  720. this.$toast.fail(res.msg || res.code || '获取失败');
  721. }
  722. }).catch(err => { this.$toast.clear(); console.log(err) });
  723. },
  724. getAuditType() {
  725. this.$axios.post("/expense-audit-setting/get", {})
  726. .then(res => {
  727. if (res.code == "ok") {
  728. this.auditTypeItem = res.data;
  729. } else {
  730. this.$message({
  731. message: res.msg,
  732. type: "error"
  733. });
  734. }
  735. }).catch(err => { this.$toast.clear(); console.log(err) });
  736. },
  737. ownerIdShowCli(type) {
  738. this.ownerIdShowType = type
  739. this.userRadio = ''
  740. this.ownerIdShow = true
  741. }
  742. },
  743. };
  744. </script>
  745. <style lang="less" scoped>
  746. .edit{
  747. margin-top: 46px;
  748. overflow: auto;
  749. .form_btn{
  750. z-index: 1000;
  751. }
  752. .edit_form{
  753. .userCheckbox {
  754. padding: 10px;
  755. }
  756. padding-bottom: 46px;
  757. .invoice{
  758. border: 0.5px solid rgb(135, 195, 255);
  759. margin: 0.2rem;
  760. .deletebtn{
  761. position: absolute;
  762. z-index: 1000;
  763. font-size: 24px;
  764. right: 0.08rem;
  765. top: 0.08rem;
  766. color: #c03131;
  767. }
  768. .invoice_item{
  769. border-top: 0.5px solid rgb(135, 195, 255);
  770. }
  771. }
  772. .addinvoice{
  773. padding: 0 0.3rem 0.3rem;
  774. margin-top: 0.2rem;
  775. text-align: right;
  776. }
  777. }
  778. .imgListVan {
  779. display: flex;
  780. flex-direction: column;
  781. }
  782. .vanUploaderImg {
  783. // display: flex;
  784. margin-top: 6px;
  785. /deep/ .van-uploader__preview-image {
  786. width: 70px;
  787. height: 70px;
  788. }
  789. /deep/ .van-uploader__upload {
  790. width: 70px;
  791. height: 70px;
  792. }
  793. }
  794. }
  795. .waiting {
  796. color: orange;
  797. }
  798. .rejected {
  799. color: red;
  800. }
  801. </style>
  802. <style>
  803. .edit_form .invoice .van-field__label{
  804. color: #999;
  805. }
  806. .edit_form .invoice .van-field__control{
  807. color: #999;
  808. }
  809. </style>