expense.vue 97 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585
  1. <template>
  2. <section>
  3. <div class="sidebars" ref="sidebars" style="width: 200px;display: block;background: #fff;">
  4. <div ref="abbisd" style="width: 100%;overflow: hidden;">
  5. <h3><i class="iconfont firerock-iconbaoxiao" style="padding-right: 10px"></i>{{ $t('expensereimbursementmodule')
  6. }}</h3>
  7. <el-divider></el-divider>
  8. <el-col :span="12">
  9. <el-menu default-active="1-1" class="el-menu-vertical-demo" @select="staffs" background-color="#ffffff"
  10. text-color="#666666" active-text-color="#20A0FF" style="width:100%">
  11. <el-submenu index="1">
  12. <template slot="title">
  13. <i class="iconfont firerock-icontianbao"></i>
  14. <span>{{ $t('fillinthestaffexpenses') }}</span>
  15. </template>
  16. <el-menu-item index="1-1">
  17. <p> {{ $t('expenses') }}</p>
  18. </el-menu-item>
  19. <!-- <el-menu-item index="1-2"><p @click="ssl(1)">{{ $t('travelexpensess') }}</p></el-menu-item>
  20. <el-menu-item index="1-3"><p @click="ssl(2)">{{ $t('outsourcingcostshouldbereported') }}</p></el-menu-item> -->
  21. </el-submenu>
  22. <el-submenu index="2">
  23. <template slot="title">
  24. <i class="iconfont firerock-iconbaoxiaodan"></i>
  25. <span>{{ permissions.costAll ? $t('listofreimbursementvouchers') : $t('myexpensevoucher') }}</span>
  26. </template>
  27. <el-menu-item index="2-1">
  28. <p @click="bills(false)">{{ $t('documentlist') }}</p>
  29. </el-menu-item>
  30. <el-menu-item index="2-2">
  31. <p @click="bills(true)">{{ $t('documentreview') }}</p>
  32. </el-menu-item>
  33. </el-submenu>
  34. <!-- <el-menu-item index="3" @select="bills" @click="bills(false)" v-if="user.role == 0">
  35. <i class="iconfont firerock-iconbaoxiaodan"></i>
  36. <span slot="title">{{user.role == 0?"我的报销凭证":"报销凭证列表"}}</span>
  37. </el-menu-item> -->
  38. </el-menu>
  39. </el-col>
  40. </div>
  41. <div class="side" @click="side" ref="sid" style="left: 200px">
  42. <div class="spans" ref="side" style="left: -19px;"><i ref="sideI" class="el-icon-arrow-left"></i></div>
  43. </div>
  44. </div>
  45. <!-- 侧边栏点击事件 -->
  46. <!-- <div class="side" @click="side" ref="sid" style="left: 430px">
  47. <div class="spans" ref="side" style="left: -19px;"><i ref="sideI" class="el-icon-arrow-left"></i></div>
  48. </div> -->
  49. <!-- 内容主体区域 -->
  50. <div class="contents">
  51. <div v-if="!displayTable" class="headine" ref="headine">
  52. <!-- <h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3> -->
  53. <h3 ref="headHe" style="padding-left: 220px">费用填报</h3>
  54. <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits" size="mini">{{
  55. $t('btn.submit') }}</el-button></p>
  56. <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submitUpload" size="mini">{{
  57. $t('batchupload') }}</el-button></p>
  58. <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="customTypeOp" size="mini"
  59. v-if="permissions.costAll">{{ $t('expensetypemanagement') }}</el-button></p>
  60. <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="expenseTypeOp" size="mini"
  61. v-if="permissions.costAll">费用主类型管理</el-button></p>
  62. </div>
  63. <!-- 上面部分 -->
  64. <div ref="staff" style="margin: 20px 20px 0 220px; width: 81.5%">
  65. <div class="staff" v-if="!displayTable">
  66. <!-- 公共 -->
  67. <div class="public">
  68. <el-form :model="addForm" ref="mainAddForm" label-width="100px" :rules="addFormRules">
  69. <!-- <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> -->
  70. <!-- 报销人 -->
  71. <el-form-item :label="$t('peopleconcerned')" prop="ownerId">
  72. <!--普通员工只能自己填报自己的 -->
  73. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="addForm.ownerId"
  74. :placeholder="$t('pleaseselecttheapplicant')" style="width: 150px" :disabled="!permissions.costAudit"
  75. filterable="true">
  76. <span v-for="(item, index) in users" :key="index">
  77. <el-option :label="item.name" :value="item.id"></el-option>
  78. </span>
  79. </el-select>
  80. <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'150'" :distinction="'1'"
  81. :subject="users" :disabled="!permissions.costAudit" :subjectId="addForm.ownerId" ref="selectCat"
  82. @selectCal="selectCal"></selectCat>
  83. </el-form-item>
  84. <!-- 填报日期 -->
  85. <el-form-item :label="$t('fillinthedate')" style="position: relative;top: 38px;">
  86. <el-col :span="11">
  87. <el-date-picker type="date" :placeholder="$t('optiondate')" v-model="addForm.createDate"
  88. value-format="yyyy-MM-dd" style="width: 200px;"></el-date-picker>
  89. </el-col>
  90. </el-form-item>
  91. <!-- 发票张数 -->
  92. <el-form-item :label="$t('invoicenumber')" v-if="this.user.timeType.easyExpense == 0">
  93. <el-input v-model="addForm.ticketNum" style="width: 150px"></el-input>
  94. </el-form-item>
  95. <!-- 费用主类型 -->
  96. <el-form-item :label="'费用主类型'">
  97. <el-select v-model="expenseMainTypeValue" style="width: 150px" @change="this.getExpList">
  98. <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name"
  99. :value="item.id"></el-option>
  100. </el-select>
  101. </el-form-item>
  102. <!-- 备注 -->
  103. <el-form-item :label="$t('bei-zhu')" style="display: block; width: 70%; float: left;">
  104. <el-input type="textarea" v-model="addForm.remark" :autosize="{ minRows: 2, maxRows: 2 }"
  105. maxlength="100"></el-input>
  106. </el-form-item>
  107. <!-- 总费用 -->
  108. <!-- <div style="float: left; line-height: 55px;margin-left:20px">总费用 <el-link disabled v-model="addForm.totalAmount">{{addForm.totalAmount}}</el-link> 元</div> -->
  109. </el-form>
  110. </div>
  111. <!-- 按钮 -->
  112. <div class="pu_button">
  113. <span v-if="totalCost <= 0" style="color:#606266;">{{ $t('totalcostos') }} {{ totalCost }} {{ $t('yuan')
  114. }}</span>
  115. <span v-else style="color:#606266;">{{ $t('totalcostos') }} ¥{{ totalCost | numberToCurrency }} {{ $t('yuan')
  116. }}</span>
  117. <span class="pu_bu_x" style="margin-left:10px;" @click="addxz"> <i class="el-icon-circle-plus-outline"></i> {{
  118. $t('newinvoice') }}</span>
  119. </div>
  120. <!-- 表格 -->
  121. <div class="pu_table">
  122. <el-table :data="invoiceList" border style="width: 100%;height:100%" height="386px" @row-dblclick="dbclick">
  123. <el-table-column prop="projectName" :label="$t('subordinatetotheproject')" width="180">
  124. <template slot-scope="scope">
  125. <el-select size="small" v-model="scope.row.projectId" :placeholder="$t('other.project')"
  126. style="width: 150px" filterable popper-class="projectSelectPopperClass">
  127. <el-option v-for="(item, index) in projectList" :key="index"
  128. :label="item.projectName + item.projectCode" :value="item.id" @click="ok(item)">
  129. <span style="float: left;color: #8492a6; font-size: 13px">{{ item.projectCode }}</span>
  130. <span style="float: right;">{{ item.projectName }}</span>
  131. </el-option>
  132. </el-select>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="happenDate" :label="$t('forthedate')" width="170px">
  136. <template slot-scope="scope">
  137. <el-date-picker size="small" v-model="scope.row.happenDate" type="date" style=" width: 145px"
  138. value-format="yyyy-MM-dd" :placeholder="$t('optiondate')">
  139. </el-date-picker>
  140. </template>
  141. </el-table-column>
  142. <el-table-column :label="$t('invoices')" width="175px" v-if="this.user.timeType.easyExpense == 0">
  143. <template slot-scope="scope">
  144. <el-select size="small" v-model="scope.row.invoiceType" :placeholder="$t('pleaseselectthetypeoffee')"
  145. style="width: 150px;">
  146. <el-option :label="$t('vATspecialinvoice')" value="0"></el-option>
  147. <el-option :label="$t('vATgeneralinvoice')" value="1"></el-option>
  148. </el-select>
  149. </template>
  150. </el-table-column>
  151. <el-table-column :label="$t('costtype')" width="175px">
  152. <template slot-scope="scope">
  153. <el-select size="small" v-model="scope.row.expenseType" :placeholder="$t('costtype')"
  154. style="width: 150px">
  155. <el-option v-for="(item, index) in expenseTypeList" :key="index" :label="item.typeName"
  156. :value="item.typeName"></el-option>
  157. </el-select>
  158. </template>
  159. </el-table-column>
  160. <el-table-column :label="this.user.timeType.easyExpense == 0 ? $t('amountoffees') : '费用金额'" width="135px">
  161. <template slot-scope="scope">
  162. <el-input size="small" :id="'upam' + scope.$index" v-model="scope.row.amount" @input="zhi(scope.$index)"
  163. @change="shiqu(scope.row.amount)" @keyup.native="restrictNumber('upam' + scope.$index)"></el-input>
  164. </template>
  165. </el-table-column>
  166. <el-table-column prop="invoiceNo" :label="$t('invoiceno')" width="135px"
  167. v-if="this.user.timeType.easyExpense == 0">
  168. <template slot-scope="scope">
  169. <el-input size="small" v-model.number="scope.row.invoiceNo"></el-input>
  170. </template>
  171. </el-table-column>
  172. <el-table-column :label="$t('shui-shuai')" width="135px" v-if="this.user.timeType.easyExpense == 0">
  173. <template slot-scope="scope">
  174. <el-input size="small" type="number" v-model="scope.row.taxPercent"
  175. @input="zhi(scope.$index)"></el-input>
  176. </template>
  177. </el-table-column>
  178. <el-table-column :label="$t('taxs')" width="135px" v-if="this.user.timeType.easyExpense == 0">
  179. <template slot-scope="scope">
  180. <el-input size="small" v-model="scope.row.taxValue" @input="zhis(scope.$index)"></el-input>
  181. </template>
  182. </el-table-column>
  183. <el-table-column :label="$t('bei-zhu')" width="135px">
  184. <template slot-scope="scope">
  185. <el-input size="small" v-model="scope.row.remark"></el-input>
  186. </template>
  187. </el-table-column>
  188. <el-table-column :label="$t('expensereimbursementvoucher')" width="135px">
  189. <template slot-scope="scope">
  190. <div @click="abl(scope.$index)">
  191. <el-upload :class="!scope.row.pic ? 'upload-demo' : 'upload-demo icl'" :before-remove="beforeRemove"
  192. :http-request="fileonLoad" limit="1" name="multipartFile">
  193. <el-button size="small" type="primary" v-if="!scope.row.pic">{{ $t('clickupload') }}</el-button>
  194. </el-upload>
  195. </div>
  196. </template>
  197. </el-table-column>
  198. <el-table-column fixed="right" :label="$t('operation')">
  199. <template slot-scope="scope">
  200. <el-button type="default" size="mini" style="display: inline-block;margin-left:0;margin-top: 3px"
  201. @click="chanc(scope.$index)">{{ $t('btn.delete') }}</el-button>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. </div>
  206. <!-- <el-button class="submits" type="warning" @click="submits">提交</el-button> -->
  207. </div>
  208. </div>
  209. </div>
  210. <!-- 下面部分 -->
  211. <div class="xiamian" ref="xiaomian"
  212. :style="'width: ' + (xiamianWidth - 400) + 'px;float:right;background: #fff;position: relative;'">
  213. <div v-if="displayTable">
  214. <div style="padding-left:10px;padding-right:10px;">
  215. <div>
  216. <el-form label-width="100px" inline>
  217. <!-- 报销人 -->
  218. <el-form-item :label="$t('peopleconcerned')">
  219. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="ownerId" size="small" clearable
  220. :placeholder="$t('selecttheapplicant')" style="width: 120px" :disabled="!permissions.costAudit"
  221. filterable="true">
  222. <span v-for="(item, index) in users" :key="index">
  223. <el-option :label="item.name" :value="item.id"></el-option>
  224. </span>
  225. </el-select>
  226. <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'small'" :widthStr="'120'" :distinction="'2'"
  227. :clearable="true" :subject="users" :disabled="!permissions.costAudit" :subjectId="ownerId"
  228. ref="selectCat" @selectCal="selectCal"></selectCat>
  229. </el-form-item>
  230. <!-- 单据编号 -->
  231. <el-form-item :label="$t('receiptnumber')">
  232. <el-input v-model="code" size="small" :placeholder="$t('receiptnumber')" clearable="true"
  233. style="width: 120px"></el-input>
  234. </el-form-item>
  235. <!-- 费用主类型 -->
  236. <el-form-item :label="'费用主类型'">
  237. <el-select size="small" v-model="queryExpenseMainType" style="width: 150px" clearable placeholder="全部类型">
  238. <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name"
  239. :value="item.id"></el-option>
  240. <!-- <el-option :label="$t('yi-ban')" :value="0"></el-option>
  241. <el-option :label="$t('cha-lv')" :value="1"></el-option>
  242. <el-option :label="$t('wai-bao')" :value="2"></el-option> -->
  243. </el-select>
  244. </el-form-item>
  245. <el-form-item :label="'发放状态'" v-if="permissions.costExpenseRelease">
  246. <el-select v-model="sendState" size="small" style="width: 150px"
  247. clearable>
  248. <el-option :label="'未发放'" :value="0"></el-option>
  249. <el-option :label="'已发放'" :value="1"></el-option>
  250. </el-select>
  251. </el-form-item>
  252. <!-- 填报日期 -->
  253. <div style="display: inline-block;padding-left: 15px">
  254. <el-form-item :label="$t('fillinthedate')">
  255. <el-date-picker v-model="date" type="daterange" value-format="yyyy-MM-dd" size="small"
  256. :range-separator="$t('other.to')" :start-placeholder="$t('time.startDate')"
  257. :end-placeholder="$t('time.endDate')" style="width: 280px">
  258. </el-date-picker>
  259. </el-form-item>
  260. <el-form-item>
  261. <el-button @click="getList" size="small">{{ $t('find') }}</el-button>
  262. </el-form-item>
  263. <el-form-item v-if="currentClick == '2-1'">
  264. <el-button @click="exportDocument()" size="small">单据导出</el-button>
  265. </el-form-item>
  266. <el-form-item v-if="currentClick == '2-1' && permissions.costExpenseRelease">
  267. <el-button @click="documentIssuance(1)" size="small">发放</el-button>
  268. </el-form-item>
  269. <el-form-item v-if="currentClick == '2-1' && permissions.costExpenseRelease">
  270. <el-button @click="documentIssuance(0)" size="small">取消发放</el-button>
  271. </el-form-item>
  272. <!-- <span>审核模式:{{ auditTypeItem.auditType }}</span> -->
  273. </div>
  274. </el-form>
  275. </div>
  276. <el-divider></el-divider>
  277. <!--列表-->
  278. <el-table ref="tab" :data="list" @selection-change="handleSelectionChange" highlight-current-row
  279. v-loading="listLoading" :height="tableHeight - currentClickNum" style="width: 100%;"
  280. :summary-method="getSummaries" show-summary>
  281. <el-table-column type="selection" width="55"></el-table-column>
  282. <el-table-column prop="code" :label="$t('ticketnumber')"></el-table-column>
  283. <el-table-column prop="totalAmount" :label="$t('amountof') + '(' + $t('yuan') + ')'" align="center">
  284. <template slot-scope="scope">
  285. <span style="float:right;margin-right:20px">{{ scope.row.totalAmount ? scope.row.totalAmount.toFixed(2) :
  286. '0' }}</span>
  287. </template>
  288. </el-table-column>
  289. <el-table-column prop="ownerName" :label="$t('peopleconcerned')">
  290. <template slot-scope="scope">
  291. <div>
  292. <span v-if="user.userNameNeedTranslate != 1">
  293. {{ scope.row.ownerName }}
  294. </span>
  295. <span v-if="user.userNameNeedTranslate == 1">
  296. <ww-open-data type='userName' :openid='scope.row.ownerName'></ww-open-data>
  297. </span>
  298. </div>
  299. </template>
  300. </el-table-column>
  301. <el-table-column prop="createDate" :label="$t('fillinthedate')"></el-table-column>
  302. <el-table-column prop="ticketNum" :label="$t('invoicenumber')"
  303. v-if="this.user.timeType.easyExpense == 0"></el-table-column>
  304. <el-table-column prop="type" :label="$t('ppertype')" v-if="this.user.timeType.easyExpense == 0">
  305. <template slot-scope="scope">
  306. {{ scope.row.expenseMainTypeName }}
  307. </template>
  308. </el-table-column>
  309. <el-table-column prop="remark" :label="$t('bei-zhu')" width="180">
  310. <template slot-scope="scope">
  311. <span style="font-size:12px;">{{ scope.row.remark }}</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column prop="status" :label="$t('state.states')" width="80">
  315. <template slot-scope="scope">
  316. <span v-if="scope.row.status == 1" class="waiting">{{ statusTxt[scope.row.status] }}</span>
  317. <span v-if="scope.row.status == 2" class="rejected">{{ statusTxt[scope.row.status] }}</span>
  318. <span v-if="scope.row.status == 0 || scope.row.status == 3">{{ statusTxt[scope.row.status] }}</span>
  319. </template>
  320. </el-table-column>
  321. <!-- <el-table-column prop="denyReason" :label="$t('dismissreason')" width="180">
  322. <template slot-scope="scope">
  323. <span style="font-size:12px;">{{scope.row.denyReason}}</span>
  324. </template>
  325. </el-table-column> -->
  326. <el-table-column prop="sendState" label="发放状态" width="80" v-if="permissions.costExpenseRelease">
  327. <template slot-scope="scope">
  328. <span :style="`color: ${scope.row.sendState == 0 ? '#FFA500' : ''}`">{{ scope.row.sendState == 1 ? '已发放' :
  329. '未发放' }}</span>
  330. </template>
  331. </el-table-column>
  332. <el-table-column fixed="right" :label="$t('operation')" :width="isAuditList ? 220 : 160">
  333. <template slot-scope="scope">
  334. <div v-if="!isAuditList">
  335. <el-button icon="el-icon-view" circle size="mini"
  336. @click.stop.native="downloadByA(scope.row)"></el-button>
  337. <el-button icon="el-icon-edit" circle size="mini" style="margin-left:10px;"
  338. @click.stop.native="showEditName(scope.row)"
  339. v-show="permissions.costAudit || scope.row.status == 1 || scope.row.status == 2"></el-button>
  340. <el-button icon="el-icon-delete" circle size="mini" style="margin-left:10px;"
  341. @click.stop.native="deleteItem(scope.row)"
  342. v-show="permissions.costAudit || scope.row.status == 1 || scope.row.status == 2"></el-button>
  343. </div>
  344. <div v-if="isAuditList">
  345. <div v-if="auditTypeItem.auditType == 0">
  346. <el-button size="mini" @click.stop.native="downloadByA(scope.row)">{{ $t('cha-kan') }}</el-button>
  347. <el-button size="mini" style="margin-left:5px;" @click.stop.native="approve(scope.row)">{{
  348. $t('btn.through') }}</el-button>
  349. <el-button size="mini" style="margin-left:5px;" @click.stop.native="denyReason(scope.row)">{{
  350. $t('btn.rejected') }}</el-button>
  351. </div>
  352. <div v-if="auditTypeItem.auditType == 1">
  353. <el-button size="mini" @click.stop.native="approve(scope.row)">审核</el-button>
  354. </div>
  355. </div>
  356. </template>
  357. </el-table-column>
  358. </el-table>
  359. <!--工具条-->
  360. <el-col :span="24" class="toolbar">
  361. <el-pagination key="expenseListTblPager" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  362. :page-sizes="[20, 50, 80, 100]" :page-size="20" :current-page.sync="page"
  363. layout="total, sizes, prev, pager, next" :total="total" style="float:right;"></el-pagination>
  364. </el-col>
  365. </div>
  366. </div>
  367. </div>
  368. <!-- 我的单据报销展示 -->
  369. <el-dialog title="报销凭证详情" :visible.sync="dialog" width="1000px">
  370. <!-- 内容主体 -->
  371. <div class="informant"><!-- 报销人 -->
  372. <el-form :model="ParticularsList" label-width="80px">
  373. <el-form-item :label="$t('peopleconcerned')" style="width: 270px"
  374. :rules="{ required: true, message: $t('pleaseselecttheapplicant'), trigger: 'blur' }">
  375. <el-input v-model="ParticularsList.ownerName"
  376. :disabled="flg || ParticularsList.ownerId == ParticularsList.operatorId"
  377. v-if="user.userNameNeedTranslate != '1'"></el-input>
  378. <!-- <el-select v-model="ParticularsList.ownerId" :placeholder="$t('pleaseselecttheapplicant')" style="width: 150px" :disabled="flg || ParticularsList.ownerId == ParticularsList.operatorId">
  379. <span v-for="(item, index) in users" :key="index">
  380. <el-option :label="item.name" :value="item.id"></el-option>
  381. </span>
  382. </el-select> -->
  383. <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :widthStr="'150'" :distinction="'3'"
  384. :subject="users" :disabled="flg || ParticularsList.ownerId == ParticularsList.operatorId"
  385. :subjectId="ParticularsList.ownerId" ref="selectCat" @selectCal="selectCal"></selectCat>
  386. </el-form-item>
  387. <el-form-item :label="$t('fillinthedate')">
  388. <!-- <el-input v-model="ParticularsList.createDate" :disabled="flg"></el-input> -->
  389. <el-date-picker type="date" :disabled="flg" :placeholder="$t('optiondate')"
  390. v-model="ParticularsList.createDate" value-format="yyyy-MM-dd" style="width: 200px;"></el-date-picker>
  391. </el-form-item>
  392. <el-form-item :label="$t('invoicenumber')">
  393. <el-input v-enter-number v-model="ParticularsList.ticketNum" :disabled="flg"></el-input>
  394. </el-form-item>
  395. <el-form-item :label="$t('costtype')" style="width: 270px">
  396. <el-select size="small" v-model="expenseMainTypeValue" style="width: 150px" :disabled="flg">
  397. <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
  398. </el-select>
  399. </el-form-item>
  400. <el-form-item :label="$t('bei-zhu')" style="width: 280px">
  401. <el-input v-model="ParticularsList.remark" :disabled="flg" maxlength="100"></el-input>
  402. </el-form-item>
  403. <el-form-item :label="$t('totalcostos')">
  404. ¥{{ ParticularsList.totalAmount | numberToCurrency }}&nbsp;&nbsp;{{ $t('yuan') }}
  405. </el-form-item>
  406. </el-form>
  407. <div style="height:0;position:relative;" v-if="!flg">
  408. <span class="newInvoice" @click="addNewInvoice"> <i class="el-icon-circle-plus-outline"></i> {{ $t('newinvoice')
  409. }}</span>
  410. </div>
  411. <el-table :data="ParticularsList.invoiceList" border style="width: 100%">
  412. <el-table-column prop="status" label="审核状态" width="172" v-if="auditTypeItem.auditType == 1">
  413. <template slot-scope="scope">
  414. <span v-if="scope.row.status == 1" class="waiting">{{ statusTxt[scope.row.status] }}</span>
  415. <span v-if="scope.row.status == 2" class="rejected">{{ statusTxt[scope.row.status] }}</span>
  416. <span v-if="scope.row.status == 0 || scope.row.status == 3">{{ statusTxt[scope.row.status] }}</span>
  417. </template>
  418. </el-table-column>
  419. <el-table-column v-if="auditTypeItem.auditType == 1" width="172" label="审核人">
  420. <template slot-scope="scope">
  421. <span v-if="user.userNameNeedTranslate == 1">
  422. <ww-open-data type='userName' :openid='scope.row.projectManagerName'></ww-open-data>
  423. </span>
  424. <span v-else>{{ scope.row.projectManagerName }}</span>
  425. </template>
  426. </el-table-column>
  427. <el-table-column prop="projectId" :label="$t('other.project')" width="155">
  428. <template slot-scope="scope">
  429. <el-select size="small" v-if="!flg" v-model="scope.row.projectId" :placeholder="$t('other.project')"
  430. style="width: 130px">
  431. <el-option v-for="(item, index) in projectList" :key="index" :label="item.projectName + item.projectCode"
  432. :value="item.id" @click="ok(item)">
  433. <span style="float: left;color: #8492a6; font-size: 13px">{{ item.projectCode }}</span>
  434. <span style="float: right;margin-left: 20px">{{ item.projectName }}</span>
  435. </el-option>
  436. </el-select>
  437. <div v-else>
  438. <span>{{ scope.row.projectName }}</span>
  439. </div>
  440. </template>
  441. </el-table-column>
  442. <el-table-column prop="happenDate" :label="$t('forthedate')" width="172">
  443. <template slot-scope="scope">
  444. <el-date-picker size="small" v-if="!flg" v-model="scope.row.happenDate" type="date" style=" width: 145px"
  445. value-format="yyyy-MM-dd" :placeholder="$t('optiondate')">
  446. </el-date-picker>
  447. <span v-else>{{ scope.row.happenDate }}</span>
  448. </template>
  449. </el-table-column>
  450. <el-table-column prop="invoiceType" :label="$t('invoices')" width="172"
  451. v-if="this.user.timeType.easyExpense == 0">
  452. <template slot-scope="scope">
  453. <el-select size="small" v-if="!flg" v-model="scope.row.invoiceType"
  454. :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px;">
  455. <el-option :label="$t('vATspecialinvoice')" :value="0"></el-option>
  456. <el-option :label="$t('vATgeneralinvoice')" :value="1"></el-option>
  457. </el-select>
  458. <span v-else>{{ typeInvoic[scope.row.invoiceType] }}</span>
  459. </template>
  460. </el-table-column>
  461. <el-table-column prop="invoiceType" :label="$t('costtype')" width="172">
  462. <template slot-scope="scope">
  463. <el-select v-if="!flg" size="small" v-model="scope.row.expenseType"
  464. :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px">
  465. <el-option v-for="(item, index) in expenseTypeList" :key="index" :label="item.typeName"
  466. :value="item.typeName"></el-option>
  467. </el-select>
  468. <span v-else>{{ scope.row.expenseType }}</span>
  469. </template>
  470. </el-table-column>
  471. <el-table-column prop="amount" :label="this.user.timeType.easyExpense == 0 ? $t('amountoffees') : '费用金额'"
  472. width="172">
  473. <template slot-scope="scope">
  474. <el-input size="small" v-if="!flg" :id="'am' + scope.$index" v-model="scope.row.amount"
  475. @input="zhiNum(scope.$index, scope)" @change="kan"
  476. @keyup.native="restrictNumber('am' + scope.$index)"></el-input>
  477. <span v-else>¥{{ scope.row.amount }}</span>
  478. </template>
  479. </el-table-column>
  480. <el-table-column prop="invoiceNo" :label="$t('invoiceno')" width="172"
  481. v-if="this.user.timeType.easyExpense == 0">
  482. <template slot-scope="scope">
  483. <el-input size="small" v-if="!flg" v-model.number="scope.row.invoiceNo"></el-input>
  484. <span v-else>{{ scope.row.invoiceNo }}</span>
  485. </template>
  486. </el-table-column>
  487. <el-table-column prop="taxPercent" :label="$t('shui-shuai')" width="172"
  488. v-if="this.user.timeType.easyExpense == 0">
  489. <template slot-scope="scope">
  490. <el-input size="small" v-if="!flg" v-model="scope.row.taxPercent"
  491. @input="zhiNum(scope.$index, scope)"></el-input>
  492. <span v-else>{{ scope.row.taxPercent }}</span>
  493. </template>
  494. </el-table-column>
  495. <el-table-column prop="taxValue" :label="$t('taxs') + '(' + $t('yuan') + ')'" width="172"
  496. v-if="this.user.timeType.easyExpense == 0">
  497. <template slot-scope="scope">
  498. <el-input size="small" v-if="!flg" v-model="scope.row.taxValue"></el-input>
  499. <span v-else>¥{{ scope.row.taxValue }}</span>
  500. </template>
  501. </el-table-column>
  502. <el-table-column prop="remark" :label="$t('bei-zhu')" width="300">
  503. <template slot-scope="scope">
  504. <el-input size="small" v-if="!flg" v-model="scope.row.remark" maxlength="100"></el-input>
  505. <span v-else>{{ scope.row.remark }}</span>
  506. </template>
  507. </el-table-column>
  508. <el-table-column prop="pic" :label="$t('expensereimbursementvoucher')" width="300">
  509. <template slot-scope="scope">
  510. <div v-if="!flg">
  511. <div @click="abl(scope.$index)" style="height: 35px;overflow: hidden;">
  512. <el-upload :class="!scope.row.pic ? 'upload-demo' : 'upload-demo icl'" :file-list="scope.row.pic"
  513. :before-remove="beforeRemoves" :http-request="fileonLoads" limit="1" name="multipartFile">
  514. <el-button size="small" type="primary" v-if="!scope.row.pic">{{ $t('clickupload') }}</el-button>
  515. </el-upload>
  516. </div>
  517. </div>
  518. <div v-else>
  519. <span v-if="scope.row.pic">
  520. <div class="tups">
  521. <viewer :images="scope.row.pic">
  522. <img ref="imgsa" v-for="src in scope.row.pic" :src="src.url" :key="src.title">
  523. </viewer>
  524. </div>
  525. </span>
  526. <span v-else>{{ $t('nodocuments') }}</span>
  527. </div>
  528. </template>
  529. </el-table-column>
  530. <!-- 删除 -->
  531. <el-table-column fixed="right" :label="$t('operation')" v-if="!flg">
  532. <template slot-scope="scope">
  533. <el-button type="default" size="mini" style="display: inline-block;margin-left:0;margin-top: 3px"
  534. @click="delec(scope.$index)">{{ $t('btn.delete') }}</el-button>
  535. </template>
  536. </el-table-column>
  537. <el-table-column prop="status" label="审核" width="172" v-if="auditTypeItem.auditType == 1 && showSingleAudit"
  538. fixed="right">
  539. <template slot-scope="scope">
  540. <el-button v-if="scope.row.isIncharger && scope.row.status == 1"
  541. @click="approveSingle(scope.row)">通过</el-button><el-button
  542. v-if="scope.row.isIncharger && scope.row.status == 1" @click="denySingle(scope.row)">驳回</el-button>
  543. </template>
  544. </el-table-column>
  545. </el-table>
  546. </div>
  547. <!-- <viewer :images="imgs">
  548. <img ref="imgsa" v-for="src in imgs" :src="src.url" :key="src.title">
  549. </viewer> -->
  550. <!-- 取消和确定 -->
  551. <span slot="footer" class="dialog-footer">
  552. <!-- <el-button @click="print()">打印</el-button> -->
  553. <el-button @click="dialog = false">{{ $t('btn.cancel') }}</el-button>
  554. <el-button v-if="!flg" type="primary" @click="present()">{{ $t('btn.determine') }}</el-button>
  555. <el-button v-else type="primary" @click="dialog = false">{{ $t('btn.determine') }}</el-button>
  556. </span>
  557. </el-dialog>
  558. <!-- 批量上传 -->
  559. <el-dialog :title="$t('batchupload')" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth"
  560. width="500px">
  561. <p>1. {{ $t('other.download') }}
  562. <span>{{ $t('expensereimbursementimporttemplate') }}</span>
  563. <el-link type="primary" style="margin-left:5px;" :underline="false"
  564. :href="'./upload/' + $t('expensereimbursementimporttemplate') + '.xlsx'"
  565. :download="$t('expensereimbursementimporttemplate') + '.xlsx'">{{ $t('expensereimbursementimporttemplate')
  566. }}.xlsx</el-link>
  567. </p>
  568. <p>2. {{ $t('exceltemplateanduploadit') }}。</p>
  569. <div style="padding-bottom:1em;">
  570. <div style="width:300px;margin:0 auto">
  571. <el-upload ref="upload" action="#" :auto-upload="false" multiple :on-change="fileListAdd"
  572. :on-remove="fileListDel">
  573. <el-button slot="trigger" size="small" type="primary" style="">{{ $t('selecthefile') }}</el-button>
  574. <el-button type="primary" size="small" style="margin-left:30px" :underline="false" :loading="importingData"
  575. @click="submitUploadSure" :disabled="fileList.length == 0">{{ $t('toupload') }}</el-button>
  576. <el-button size="small" style="margin-left:30px" @click="fileListClear">{{ $t('clears') }}</el-button>
  577. </el-upload>
  578. </div>
  579. </div>
  580. </el-dialog>
  581. <!-- 主费用类型自定义 -->
  582. <el-dialog title="费用类型大类管理" v-if="expenseTypeDialog" :visible.sync="expenseTypeDialog" customClass="customWidth"
  583. width="600px">
  584. <el-table :data="expenseMainTypes" style="width:100%" height="400" :loading="expenseTypeListLoading">
  585. <el-table-column :label="'类型名称'" min-width="150">
  586. <template slot-scope="scope">
  587. <span>{{ scope.row.name }}</span>
  588. </template>
  589. </el-table-column>
  590. <el-table-column :label="'对应成本项'" min-width="150">
  591. <template slot-scope="scope">
  592. <span>{{ scope.row.basecostSettingName }}</span>
  593. </template>
  594. </el-table-column>
  595. <el-table-column :label="$t('operation')" width="150">
  596. <template slot-scope="scope">
  597. <el-button @click="expenseTypeEditOp(scope.row)" size="small" type="primary">{{ $t('bian-ji') }}</el-button>
  598. <el-button @click="expenseTypeEditDelete(scope.row)" size="small" type="danger">{{ $t('btn.delete')
  599. }}</el-button>
  600. </template>
  601. </el-table-column>
  602. </el-table>
  603. <span slot="footer" class="dialog-footer">
  604. <el-button @click="expenseTypeDialog = false" size="medium">{{ $t('btn.cancel') }}</el-button>
  605. <el-button type="primary" @click="expenseTypeEditOp()" size="medium">{{ $t('newtype') }}</el-button>
  606. </span>
  607. <!-- 新增/编辑费用类型 -->
  608. <el-dialog :title="$t('addeditfeetypes')" v-if="expenseTypeEditDialog" :visible.sync="expenseTypeEditDialog"
  609. customClass="customWidth" width="400px" append-to-body>
  610. <el-form label-width="100px" :rules="editExpenseTypeDataRules" ref="editExpenseTypeDataForm"
  611. :model="editExpenseTypeData">
  612. <el-form-item :label="$t('typename ')" style="margin:30px 0" prop="typeName">
  613. <el-input id="editExpenseTypeDataInput" size="medium" v-model="editExpenseTypeData.name"
  614. :placeholder="$t('customizethfeetypename')" style="width:90%"
  615. @keyup.native="editExpenseTypeDataInput('editExpenseTypeDataInput')"></el-input>
  616. </el-form-item>
  617. <el-form-item label="对应成本项" style="margin:30px 0" prop="basecostSettingId">
  618. <el-select v-model="editExpenseTypeData.basecostSettingId" size="medium" style="width:90%" clearable>
  619. <el-option v-for="item in basecostSettingList" :key="item.id" :label="item.name" :value="item.id"
  620. :disabled="item.alarmType == 1"></el-option>
  621. </el-select>
  622. </el-form-item>
  623. </el-form>
  624. <span slot="footer" class="dialog-footer">
  625. <el-button @click="expenseTypeEditDialog = false" size="medium">{{ $t('btn.cancel') }}</el-button>
  626. <el-button type="primary" @click="expenseTypeEditSure" size="medium">{{ $t('btn.determine') }}</el-button>
  627. </span>
  628. </el-dialog>
  629. </el-dialog>
  630. <!-- 费用类型自定义 -->
  631. <el-dialog :title="$t('expensetypemanagement')" v-if="customTypeDialog" :visible.sync="customTypeDialog"
  632. customClass="customWidth" width="600px">
  633. <el-table :data="customTypeList" style="width:100%" height="400" :loading="customTypeListLoading">
  634. <el-table-column prop="typeName" :label="$t('costofname')" min-width="150"></el-table-column>
  635. <el-table-column :label="$t('costtype')" min-width="150">
  636. <template slot-scope="scope">
  637. <span>{{ scope.row.expenseMainTypeName }}</span>
  638. </template>
  639. </el-table-column>
  640. <el-table-column :label="$t('operation')" width="150">
  641. <template slot-scope="scope">
  642. <el-button @click="customTypeEditOp(scope.row)" size="small" type="primary">{{ $t('bian-ji') }}</el-button>
  643. <el-button @click="customTypeEditDelete(scope.row)" size="small" type="danger">{{ $t('btn.delete')
  644. }}</el-button>
  645. </template>
  646. </el-table-column>
  647. </el-table>
  648. <span slot="footer" class="dialog-footer">
  649. <el-button @click="customTypeDialog = false" size="medium">{{ $t('btn.cancel') }}</el-button>
  650. <el-button type="primary" @click="customTypeEditOp()" size="medium">{{ $t('newtype') }}</el-button>
  651. </span>
  652. <!-- 新增/编辑费用类型 -->
  653. <el-dialog :title="$t('addeditfeetypes')" v-if="customTypeEditDialog" :visible.sync="customTypeEditDialog"
  654. customClass="customWidth" width="400px" append-to-body>
  655. <el-form label-width="80px" :rules="editTypeDataRules" ref="editTypeDataForm" :model="editTypeData">
  656. <el-form-item :label="$t('belongstype')" style="margin:30px 0">
  657. <el-select v-model="editTypeData.mainType" size="medium" style="width:90%">
  658. <el-option v-for="item in expenseMainTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
  659. </el-select>
  660. </el-form-item>
  661. <el-form-item :label="$t('typename ')" style="margin:30px 0" prop="typeName">
  662. <el-input id="editTypeDataInput" size="medium" v-model="editTypeData.typeName"
  663. :placeholder="$t('customizethfeetypename')" style="width:90%"
  664. @keyup.native="editTypeDataInput('editTypeDataInput')"></el-input>
  665. </el-form-item>
  666. </el-form>
  667. <span slot="footer" class="dialog-footer">
  668. <el-button @click="customTypeEditDialog = false" size="medium">{{ $t('btn.cancel') }}</el-button>
  669. <el-button type="primary" @click="customTypeEditSure" size="medium">{{ $t('btn.determine') }}</el-button>
  670. </span>
  671. </el-dialog>
  672. </el-dialog>
  673. <!-- 驳回弹出框 -->
  674. <el-dialog :title="$t('defaultText.pleaseEnterTheReason')" v-if="denyReasonDialog" :visible.sync="denyReasonDialog"
  675. :close-on-click-modal="false" customClass="customWidth" width="500px">
  676. <div>
  677. <el-input type="textarea" v-model="denyForm.reason" rows="2" :placeholder="$t('reasonforyourdecisiontoreject')" />
  678. </div>
  679. <div slot="footer" class="dialog-footer">
  680. <el-button @click="denyReasonDialog = false">{{ $t('btn.cancel') }}</el-button>
  681. <el-button type="primary" @click="deny()">{{ $t('btn.determine') }}</el-button>
  682. </div>
  683. </el-dialog>
  684. <!-- 详情查看弹出框 -->
  685. <el-dialog title="报销凭证详情" :visible.sync="detailDialog" width="1000px" :before-close="handleClose">
  686. <div ref="printContent" class="printContent">
  687. <div class="printContent-detail">
  688. <div class="detail-item">
  689. <span class="detail-item-title"> <span class="printBox">报销人</span> </span>
  690. <span class="detail-item-content">
  691. <span v-if="user.userNameNeedTranslate == 1">
  692. <ww-open-data type='userName' :openid='ParticularsList.ownerName'></ww-open-data>
  693. </span>
  694. <span v-else>{{ ParticularsList.ownerName }}</span>
  695. </span>
  696. </div>
  697. <div class="detail-item">
  698. <span class="detail-item-title"><span class="printBox">填报时间</span></span>
  699. <span class="detail-item-content">{{ ParticularsList.createDate }}</span>
  700. </div>
  701. <div class="detail-item">
  702. <span class="detail-item-title"><span class="printBox">发票张数</span></span>
  703. <span class="detail-item-content">{{ ParticularsList.ticketNum }} 张</span>
  704. </div>
  705. <div class="detail-item">
  706. <span class="detail-item-title"><span class="printBox">费用类型:</span></span>
  707. <span class="detail-item-content">{{ detaExpenseMainTypeName }}</span>
  708. </div>
  709. <div class="detail-item">
  710. <span class="detail-item-title"><span class="printBox">总费用</span></span>
  711. <span class="detail-item-content">¥ {{ ParticularsList.totalAmount | numberToCurrency }}</span>
  712. </div>
  713. <div class="detail-item" style="width: 100%">
  714. <span class="detail-item-title"><span class="printBox">备注</span></span>
  715. <span class="detail-item-content">{{ ParticularsList.remark }}</span>
  716. </div>
  717. </div>
  718. <!-- <el-table :data="ParticularsList.invoiceList" border style="width: 100%">
  719. <el-table-column prop="projectId" :label="$t('other.project')" width="155">
  720. <el-table-column prop="status" label="审核状态" width="172" v-if="auditTypeItem.auditType == 1">
  721. <template slot-scope="scope">
  722. <span v-if="scope.row.status == 1" class="waiting">{{ statusTxt[scope.row.status] }}</span>
  723. <span v-if="scope.row.status == 2" class="rejected">{{ statusTxt[scope.row.status] }}</span>
  724. <span v-if="scope.row.status == 0 || scope.row.status == 3">{{ statusTxt[scope.row.status] }}</span>
  725. </template>
  726. </el-table-column>
  727. <template slot-scope="scope">
  728. <el-select size="small" v-if="!flg" v-model="scope.row.projectId" :placeholder="$t('other.project')"
  729. style="width: 130px">
  730. <el-option v-for="(item, index) in projectList" :key="index" :label="item.projectName + item.projectCode"
  731. :value="item.id" @click="ok(item)">
  732. <span style="float: left;color: #8492a6; font-size: 13px">{{ item.projectCode }}</span>
  733. <span style="float: right;margin-left: 20px">{{ item.projectName }}</span>
  734. </el-option>
  735. </el-select>
  736. <div v-else>
  737. <div v-for="(item, index) in projectIdName" :key="index">
  738. <span v-if="item.id == scope.row.projectId">{{ item.projectName }}</span>
  739. </div>
  740. </div>
  741. </template>
  742. </el-table-column>
  743. <el-table-column prop="happenDate" :label="$t('forthedate')" width="172">
  744. <template slot-scope="scope">
  745. <el-date-picker size="small" v-if="!flg" v-model="scope.row.happenDate" type="date" style=" width: 145px"
  746. value-format="yyyy-MM-dd" :placeholder="$t('optiondate')">
  747. </el-date-picker>
  748. <span v-else>{{ scope.row.happenDate }}</span>
  749. </template>
  750. </el-table-column>
  751. <el-table-column prop="invoiceType" :label="$t('invoices')" width="172"
  752. v-if="this.user.timeType.easyExpense == 0">
  753. <template slot-scope="scope">
  754. <el-select size="small" v-if="!flg" v-model="scope.row.invoiceType"
  755. :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px;">
  756. <el-option :label="$t('vATspecialinvoice')" :value="0"></el-option>
  757. <el-option :label="$t('vATgeneralinvoice')" :value="1"></el-option>
  758. </el-select>
  759. <span v-else>{{ typeInvoic[scope.row.invoiceType] }}</span>
  760. </template>
  761. </el-table-column>
  762. <el-table-column prop="invoiceType" :label="$t('costtype')" width="172">
  763. <template slot-scope="scope">
  764. <el-select v-if="!flg" size="small" v-model="scope.row.expenseType"
  765. :placeholder="$t('pleaseselectthetypeoffee')" style="width: 150px">
  766. <el-option v-for="(item, index) in expenseTypeList" :key="index" :label="item.typeName"
  767. :value="item.typeName"></el-option>
  768. </el-select>
  769. <span v-else>{{ scope.row.expenseType }}</span>
  770. </template>
  771. </el-table-column>
  772. <el-table-column prop="amount" :label="this.user.timeType.easyExpense == 0 ? $t('amountoffees') : '费用金额'"
  773. width="172">
  774. <template slot-scope="scope">
  775. <el-input size="small" v-if="!flg" :id="'am' + scope.$index" v-model="scope.row.amount"
  776. @input="zhiNum(scope.$index, scope)" @change="kan"
  777. @keyup.native="restrictNumber('am' + scope.$index)"></el-input>
  778. <span v-else>¥{{ scope.row.amount }}</span>
  779. </template>
  780. </el-table-column>
  781. <el-table-column prop="invoiceNo" :label="$t('invoiceno')" width="172"
  782. v-if="this.user.timeType.easyExpense == 0">
  783. <template slot-scope="scope">
  784. <el-input size="small" v-if="!flg" v-model.number="scope.row.invoiceNo"></el-input>
  785. <span v-else>{{ scope.row.invoiceNo }}</span>
  786. </template>
  787. </el-table-column>
  788. <el-table-column prop="taxPercent" :label="$t('shui-shuai')" width="172"
  789. v-if="this.user.timeType.easyExpense == 0">
  790. <template slot-scope="scope">
  791. <el-input size="small" v-if="!flg" v-model="scope.row.taxPercent"
  792. @input="zhiNum(scope.$index, scope)"></el-input>
  793. <span v-else>{{ scope.row.taxPercent }}</span>
  794. </template>
  795. </el-table-column>
  796. <el-table-column prop="taxValue" :label="$t('taxs') + '(' + $t('yuan') + ')'" width="172"
  797. v-if="this.user.timeType.easyExpense == 0">
  798. <template slot-scope="scope">
  799. <el-input size="small" v-if="!flg" v-model="scope.row.taxValue"></el-input>
  800. <span v-else>¥{{ scope.row.taxValue }}</span>
  801. </template>
  802. </el-table-column>
  803. <el-table-column prop="remark" :label="$t('bei-zhu')" width="300">
  804. <template slot-scope="scope">
  805. <el-input size="small" v-if="!flg" v-model="scope.row.remark" maxlength="100"></el-input>
  806. <span v-else>{{ scope.row.remark }}</span>
  807. </template>
  808. </el-table-column>
  809. <el-table-column prop="pic" :label="$t('expensereimbursementvoucher')" width="300">
  810. <template slot-scope="scope">
  811. <div v-if="!flg">
  812. <div @click="abl(scope.$index)" style="height: 35px;overflow: hidden;">
  813. <el-upload :class="!scope.row.pic ? 'upload-demo' : 'upload-demo icl'" :file-list="scope.row.pic"
  814. :before-remove="beforeRemoves" :http-request="fileonLoads" limit="1" name="multipartFile">
  815. <el-button size="small" type="primary" v-if="!scope.row.pic">{{ $t('clickupload') }}</el-button>
  816. </el-upload>
  817. </div>
  818. </div>
  819. <div v-else>
  820. <span v-if="scope.row.pic">
  821. <div class="tups">
  822. <viewer :images="scope.row.pic">
  823. <img ref="imgsa" v-for="src in scope.row.pic" :src="src.url" :key="src.title">
  824. </viewer>
  825. </div>
  826. </span>
  827. <span v-else>{{ $t('nodocuments') }}</span>
  828. </div>
  829. </template>
  830. </el-table-column>
  831. <el-table-column fixed="right" :label="$t('operation')" v-if="!flg">
  832. <template slot-scope="scope">
  833. <el-button type="default" size="mini" style="display: inline-block;margin-left:0;margin-top: 3px"
  834. @click="delec(scope.$index)">{{ $t('btn.delete') }}</el-button>
  835. </template>
  836. </el-table-column>
  837. </el-table> -->
  838. <!-- 卡片列表 -->
  839. <div class="conter-box">
  840. <div class="conter-border" v-for="item, index in ParticularsList.invoiceList" :key="index">
  841. <div class="detail-item" v-if="auditTypeItem.auditType != 1">
  842. <span class="detail-item-title"> <span class="printBox">项目</span> </span>
  843. <span class="detail-item-content">
  844. <el-select size="small" v-if="!flg" v-model="item.projectId" :placeholder="$t('other.project')"
  845. style="width: 130px">
  846. <el-option v-for="(item, index) in projectList" :key="index"
  847. :label="item.projectName + item.projectCode" :value="item.id" @click="ok(item)">
  848. <span style="float: left;color: #8492a6; font-size: 13px">{{ item.projectCode }}</span>
  849. <span style="float: right;margin-left: 20px">{{ item.projectName }}</span>
  850. </el-option>
  851. </el-select>
  852. <div v-else>
  853. <div v-for="(item, index) in projectIdName" :key="index">
  854. <span v-if="item.id == item.projectId">{{ item.projectName }}</span>
  855. </div>
  856. </div>
  857. </span>
  858. </div>
  859. <div class="detail-item" v-if="auditTypeItem.auditType == 1">
  860. <span class="detail-item-title"> <span class="printBox">项目(审核状态)</span> </span>
  861. <span class="detail-item-content">
  862. <span v-if="item.status == 1" class="waiting">{{ statusTxt[item.status] }}</span>
  863. <span v-if="item.status == 2" class="rejected">{{ statusTxt[item.status] }}</span>
  864. <span v-if="item.status == 0 || item.status == 3">{{ statusTxt[item.status] }}</span>
  865. </span>
  866. </div>
  867. <div class="detail-item">
  868. <span class="detail-item-title"> <span class="printBox">费用日期</span> </span>
  869. <span class="detail-item-content">{{ item.happenDate }}</span>
  870. </div>
  871. <div class="detail-item">
  872. <span class="detail-item-title"> <span class="printBox">发票种类</span> </span>
  873. <span class="detail-item-content">{{ typeInvoic[item.invoiceType] }}</span>
  874. </div>
  875. <div class="detail-item">
  876. <span class="detail-item-title"> <span class="printBox">费用类型</span> </span>
  877. <span class="detail-item-content">{{ item.expenseType }}</span>
  878. </div>
  879. <div class="detail-item">
  880. <span class="detail-item-title single"> <span class="printBox">费用金额(含税)</span> </span>
  881. <span class="detail-item-content">{{ item.amount }}</span>
  882. </div>
  883. <div class="detail-item">
  884. <span class="detail-item-title"> <span class="printBox">发票号</span> </span>
  885. <span class="detail-item-content">{{ item.invoiceNo }}</span>
  886. </div>
  887. <div class="detail-item">
  888. <span class="detail-item-title"> <span class="printBox">税率%</span> </span>
  889. <span class="detail-item-content">{{ item.taxValue }}</span>
  890. </div>
  891. <div class="detail-item">
  892. <span class="detail-item-title"> <span class="printBox">税额</span> </span>
  893. <span class="detail-item-content">{{ item.taxValue ? `¥${item.taxValue}` : '' }}</span>
  894. </div>
  895. <div class="detail-item">
  896. <span class="detail-item-title"> <span class="printBox">备注</span> </span>
  897. <span class="detail-item-content">{{ item.remark }}</span>
  898. </div>
  899. <div class="detail-item">
  900. <span class="detail-item-title"> <span class="printBox">报销凭证</span> </span>
  901. <span class="detail-item-content">
  902. <span v-if="item.pic" style="width: 100px;display: inline-block;">
  903. <div class="tups">
  904. <viewer :images="item.pic">
  905. <img ref="imgsa" v-for="src in item.pic" :src="src.url" :key="src.title">
  906. </viewer>
  907. </div>
  908. </span>
  909. </span>
  910. </div>
  911. </div>
  912. </div>
  913. </div>
  914. <span slot="footer" class="dialog-footer">
  915. <el-button @click="print()">打 印</el-button>
  916. <el-button @click="detailDialog = false">关 闭</el-button>
  917. </span>
  918. </el-dialog>
  919. </section>
  920. </template>
  921. <script>
  922. // 自定义select组件
  923. import selectCat from "@/components/select.vue"
  924. // 引入自定义级联组件
  925. import vueCascader from "@/components/cascader.vue"
  926. export default {
  927. name: "expense",
  928. components: {
  929. selectCat,
  930. vueCascader
  931. },
  932. props: {},
  933. data() {
  934. return {
  935. showSingleAudit: false,
  936. auditTypeItem: { auditType: 0 },
  937. queryExpenseMainType: null,
  938. denyReasonDialog: false,
  939. denyForm: {
  940. reason: '',
  941. id: null
  942. },
  943. basecostSettingList: [],
  944. fileList: [],
  945. muHeight: document.documentElement.clientHeight || document.body.clientHeight,
  946. xiamianWidth: document.documentElement.clientWidth || document.body.clientWidth,
  947. imgs: [],
  948. addFormRules: {
  949. ownerId: [{ required: true, message: this.$t('pleaseselecttheapplicant'), trigger: "blur" }],
  950. createDate: [{ required: true, message: this.$t('pleaseselectadate'), trigger: "blur" }],
  951. },
  952. isAuditList: false,
  953. statusTxt: [this.$t('state.approved'), this.$t('state.WaitingAudit'), this.$t('state.rejected'), this.$t('state.undone')],
  954. user: JSON.parse(sessionStorage.getItem("user")),
  955. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  956. allExpList: [],
  957. expenseTypeList: [],
  958. tian: { a: null, b: null, c: null, d: null, e: null, f: null, g: null, h: null, },
  959. typeInvoic: [this.$t('vATspecialinvoice'), this.$t('vATgeneralinvoice')],
  960. listLoading: false,
  961. tableHeight: 0,
  962. list: [],
  963. total: 0,
  964. code: null,
  965. date: null,
  966. type: null,
  967. ownerId: null,
  968. users: [], // 人员信息
  969. displayTable: false,
  970. getLists: [],
  971. ProjectList: [], // 项目列表
  972. companyId: [], // 人员的id
  973. dialogVisible: false,
  974. code: null,
  975. addForm: { code: null, ownerId: null, createDate: null, ticketNum: 1, type: 0, remark: null, totalAmount: 0, },
  976. page: 1,
  977. size: 20,
  978. form: { happenDate: null, invoiceType: null, amount: null, invoiceNo: null, taxPercent: null, taxValue: null, remark: null },
  979. invoiceList: [],
  980. kkk: null, //
  981. ddId: null,
  982. dldl: [],
  983. isOK: false,
  984. z: null,
  985. value: null,
  986. dialog: false, // 单据查看展示
  987. ParticularsList: [],
  988. projectIdName: [], // 点击查看的项目名
  989. flg: false, // 是否禁用
  990. shuz: [this.$t('generalexpenses'), this.$t('travelexpensess'), this.$t('outsourcingcostshouldbereported')],
  991. ins: 0,
  992. apl: '',
  993. diz: 'http://worktime.ttkuaiban.com',
  994. importDialog: false,
  995. importingData: false,
  996. currentClick: '',
  997. currentClickNum: 0,
  998. // 费用类型自定义
  999. customTypeDialog: false,
  1000. customTypeList: [],
  1001. customTypeListLoading: false,
  1002. customTypeEditDialog: false,
  1003. editTypeData: {},
  1004. editTypeDataRules: {
  1005. typeName: [{ required: true, message: this.$t('pleaseentercustomfeetypename'), trigger: "blur" }],
  1006. },
  1007. expenseMainTypes: [],
  1008. expenseMainTypeValue: '',
  1009. expenseTypeDialog: false,
  1010. expenseTypeListLoading: false,
  1011. expenseTypeEditDialog: false,
  1012. editExpenseTypeData: {},
  1013. editExpenseTypeDataRules: {
  1014. name: [{ required: true, message: this.$t('pleaseentercustomfeetypename'), trigger: "blur" }],
  1015. },
  1016. // 详情弹出框
  1017. detailDialog: false,
  1018. detaExpenseMainTypeName: '',
  1019. multipleSelection: [],
  1020. sendState: '',
  1021. };
  1022. },
  1023. computed: {
  1024. totalCost: function () {
  1025. let num = 0
  1026. for (let i in this.invoiceList) {
  1027. if (this.invoiceList[i].amount) {
  1028. num += this.invoiceList[i].amount * 1
  1029. }
  1030. }
  1031. return num
  1032. }
  1033. },
  1034. watch: {},
  1035. created() {
  1036. let height = window.innerHeight;
  1037. this.tableHeight = height - 195;
  1038. const that = this;
  1039. window.onresize = function temp() {
  1040. that.tableHeight = window.innerHeight - 195;
  1041. };
  1042. },
  1043. mounted() {
  1044. this.getNextCode();
  1045. this.getUsers() // 获取人员信息
  1046. this.getList() // 获取单据列表
  1047. this.getProjectList();
  1048. this.getExpensMainTypes();
  1049. this.getExpList();
  1050. this.getBasecostItemList();
  1051. this.getAuditType();
  1052. },
  1053. filters: {
  1054. numberToCurrency(value) {
  1055. if (!value) return '0.00'
  1056. // console.log('v=='+value);
  1057. value = value.toFixed(2)
  1058. const intPart = Math.trunc(value)
  1059. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  1060. let floatPart = '.00'
  1061. const valueArray = value.toString().split('.')
  1062. if (valueArray.length === 2) { // 有小数部分
  1063. floatPart = valueArray[1].toString() // 取得小数部分
  1064. return intPartFormat + '.' + floatPart
  1065. }
  1066. return intPartFormat + floatPart
  1067. }
  1068. },
  1069. methods: {
  1070. getBasecostItemList() {
  1071. this.http.post('/project-basecost-setting/list', {},
  1072. res => {
  1073. if (res.code == 'ok') {
  1074. this.basecostSettingList = res.data;
  1075. } else {
  1076. this.$message({
  1077. message: res.msg,
  1078. type: 'error'
  1079. })
  1080. }
  1081. }, err => {
  1082. this.$message({
  1083. message: err,
  1084. type: 'error'
  1085. })
  1086. })
  1087. },
  1088. // 费用类型自定义
  1089. customTypeOp() {
  1090. this.customTypeDialog = true
  1091. this.customTypeListLoading = true
  1092. },
  1093. customTypeEditOp(row) {
  1094. this.customTypeEditDialog = true
  1095. if (row) {
  1096. this.editTypeData = row
  1097. } else {
  1098. this.editTypeData = {
  1099. mainType: '',
  1100. typeName: '',
  1101. companyId: this.user.companyId
  1102. }
  1103. }
  1104. },
  1105. customTypeEditSure() {
  1106. this.$refs.editTypeDataForm.validate(valid => {
  1107. if (valid) {
  1108. this.http.post('/expense-type/addOrMod', this.editTypeData,
  1109. res => {
  1110. if (res.code == 'ok') {
  1111. this.customTypeEditDialog = false
  1112. this.customTypeOp()
  1113. this.getExpList()
  1114. } else {
  1115. this.$message({
  1116. message: res.msg,
  1117. type: 'error'
  1118. })
  1119. }
  1120. }, err => {
  1121. this.$message({
  1122. message: err,
  1123. type: 'error'
  1124. })
  1125. })
  1126. }
  1127. })
  1128. },
  1129. customTypeEditDelete(row) {
  1130. this.$confirm(this.$t('operationmaycausedatalossAreyousuredeletethedata'), this.$t('other.prompts'), {
  1131. confirmButtonText: this.$t('btn.determine'),
  1132. cancelButtonText: this.$t('btn.cancel'),
  1133. type: 'warning'
  1134. }).then(() => {
  1135. this.http.post('/expense-type/delete', {
  1136. id: row.id
  1137. },
  1138. res => {
  1139. if (res.code == 'ok') {
  1140. this.customTypeEditDialog = false
  1141. this.customTypeOp()
  1142. this.getExpList()
  1143. } else {
  1144. this.$message({
  1145. message: res.msg,
  1146. type: 'error'
  1147. })
  1148. }
  1149. }, err => {
  1150. this.$message({
  1151. message: err,
  1152. type: 'error'
  1153. })
  1154. })
  1155. }).catch(() => {
  1156. this.$message({
  1157. type: 'info',
  1158. message: this.$t('thedeletionhasbeencancelled')
  1159. })
  1160. })
  1161. },
  1162. editTypeDataInput(typeName) {
  1163. let inpu = document.getElementById(typeName);
  1164. inpu.value = inpu.value.replace(/^\s*|\s*$/g, '')
  1165. },
  1166. // 费用主类型自定义
  1167. expenseTypeOp() {
  1168. this.expenseTypeDialog = true
  1169. this.customTypeListLoading = true
  1170. },
  1171. expenseTypeEditOp(row) {
  1172. this.expenseTypeEditDialog = true
  1173. if (row) {
  1174. this.editExpenseTypeData = row
  1175. } else {
  1176. this.editExpenseTypeData = {
  1177. isSystem: 0,
  1178. name: '',
  1179. companyId: this.user.companyId
  1180. }
  1181. }
  1182. },
  1183. expenseTypeEditSure() {
  1184. this.$refs.editExpenseTypeDataForm.validate(valid => {
  1185. if (valid) {
  1186. this.http.post('/expense-main-type/addOrMod', this.editExpenseTypeData,
  1187. res => {
  1188. if (res.code == 'ok') {
  1189. this.expenseTypeEditDialog = false
  1190. this.expenseTypeOp()
  1191. this.getExpensMainTypes()
  1192. this.getExpList()
  1193. } else {
  1194. this.$message({
  1195. message: res.msg,
  1196. type: 'error'
  1197. })
  1198. }
  1199. }, err => {
  1200. this.$message({
  1201. message: err,
  1202. type: 'error'
  1203. })
  1204. })
  1205. }
  1206. })
  1207. },
  1208. expenseTypeEditDelete(row) {
  1209. this.$confirm(this.$t('operationmaycausedatalossAreyousuredeletethedata'), this.$t('other.prompts'), {
  1210. confirmButtonText: this.$t('btn.determine'),
  1211. cancelButtonText: this.$t('btn.cancel'),
  1212. type: 'warning'
  1213. }).then(() => {
  1214. this.http.post('/expense-main-type/delete', {
  1215. id: row.id
  1216. },
  1217. res => {
  1218. if (res.code == 'ok') {
  1219. this.expenseTypeEditDialog = false
  1220. this.expenseTypeOp()
  1221. this.getExpensMainTypes()
  1222. } else {
  1223. this.$message({
  1224. message: res.msg,
  1225. type: 'error'
  1226. })
  1227. }
  1228. }, err => {
  1229. this.$message({
  1230. message: err,
  1231. type: 'error'
  1232. })
  1233. })
  1234. }).catch(() => {
  1235. this.$message({
  1236. type: 'info',
  1237. message: this.$t('thedeletionhasbeencancelled')
  1238. })
  1239. })
  1240. },
  1241. expenseTypeDataInput(typeName) {
  1242. let inpu = document.getElementById(typeName);
  1243. inpu.value = inpu.value.replace(/^\s*|\s*$/g, '')
  1244. },
  1245. editExpenseTypeDataInput(name) {
  1246. let inpu = document.getElementById(name);
  1247. inpu.value = inpu.value.replace(/^\s*|\s*$/g, '')
  1248. },
  1249. submitUpload() {
  1250. this.importDialog = true
  1251. },
  1252. fileListAdd(file, fileList) {
  1253. let str = file.name.split(".");
  1254. let format = str[str.length - 1];
  1255. if (format != "xls" && format != "xlsx") {
  1256. this.$message({
  1257. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1258. type: "error"
  1259. });
  1260. fileList.splice(fileList.length - 1)
  1261. }
  1262. this.fileList = fileList
  1263. },
  1264. fileListDel(file, fileList) {
  1265. this.fileList = fileList
  1266. },
  1267. fileListClear() {
  1268. this.$refs.upload.clearFiles();
  1269. this.fileList = []
  1270. },
  1271. submitUploadSure() {
  1272. this.$confirm(this.$t('confirmtoupload'), this.$t('other.prompts'), {
  1273. confirmButtonText: this.$t('btn.determine'),
  1274. cancelButtonText: this.$t('btn.cancel'),
  1275. type: 'success'
  1276. }).then(() => {
  1277. let formData = new FormData();
  1278. for (let i in this.fileList) {
  1279. formData.append("files", this.fileList[i].raw);
  1280. }
  1281. this.importingData = true
  1282. // console.log(formData,this.fileList);
  1283. // return
  1284. this.http.uploadFile('/expense-sheet/importData', formData,
  1285. res => {
  1286. if (res.code == "ok") {
  1287. this.importingData = false
  1288. this.$refs.upload.clearFiles();
  1289. this.fileList = []
  1290. this.$message({
  1291. message: this.$t('uploadedsuccessfully'),
  1292. type: "success"
  1293. });
  1294. } else {
  1295. this.importingData = false
  1296. this.$message({
  1297. message: res.msg,
  1298. type: "error"
  1299. });
  1300. }
  1301. }, error => {
  1302. this.importingData = false
  1303. this.$message({
  1304. message: error,
  1305. type: "error"
  1306. });
  1307. });
  1308. }).catch(() => { })
  1309. },
  1310. restrictNumber(targetId) {
  1311. let inpu = document.getElementById(targetId);
  1312. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1313. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1314. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g, '').replace('$#*', '.');//去除其他"."
  1315. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  1316. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  1317. inpu.value = parseFloat(inpu.value);
  1318. }
  1319. },
  1320. approveSingle(item) {
  1321. this.http.post('/expense-sheet/approveSingleProject', {
  1322. id: item.id
  1323. },
  1324. res => {
  1325. if (res.code == "ok") {
  1326. this.getList();
  1327. // this.dialog = false;
  1328. this.getParticulars(item.expenseId);
  1329. } else {
  1330. this.$message({
  1331. message: res.msg,
  1332. type: "error"
  1333. });
  1334. }
  1335. },
  1336. error => {
  1337. this.$message({
  1338. message: error,
  1339. type: "error"
  1340. });
  1341. });
  1342. },
  1343. approve(item) {
  1344. if (this.auditTypeItem.auditType == 0) {
  1345. //默认模式,按有审核权限的人直接审核
  1346. this.showSingleAudit = false;
  1347. //审核通过
  1348. this.http.post('/expense-sheet/approve', {
  1349. id: item.id
  1350. },
  1351. res => {
  1352. if (res.code == "ok") {
  1353. this.getList();
  1354. } else {
  1355. this.$message({
  1356. message: res.msg,
  1357. type: "error"
  1358. });
  1359. }
  1360. },
  1361. error => {
  1362. this.$message({
  1363. message: error,
  1364. type: "error"
  1365. });
  1366. });
  1367. } else {
  1368. //项目经理按项目逐条审核
  1369. this.showSingleAudit = true;
  1370. this.downloadByA(item);
  1371. }
  1372. },
  1373. denySingle(item) {
  1374. //项目经理审核模式
  1375. this.http.post('/expense-sheet/denySingleProject', {
  1376. id: item.id
  1377. },
  1378. res => {
  1379. if (res.code == "ok") {
  1380. this.dialog = false;
  1381. this.showSingleAudit = false;
  1382. this.getList();
  1383. } else {
  1384. this.$message({
  1385. message: res.msg,
  1386. type: "error"
  1387. });
  1388. }
  1389. },
  1390. error => {
  1391. this.$message({
  1392. message: error,
  1393. type: "error"
  1394. });
  1395. });
  1396. },
  1397. denyReason(item) {
  1398. if (this.auditTypeItem.auditType == 0) {
  1399. this.denyForm.id = item.id
  1400. this.denyForm.reason = ''
  1401. // this.denyReasonDialog = true
  1402. this.deny()
  1403. } else {
  1404. this.downloadByA(item);
  1405. this.showSingleAudit = true;
  1406. }
  1407. },
  1408. deny() {
  1409. //审核驳回
  1410. this.http.post('/expense-sheet/deny', {
  1411. id: this.denyForm.id,
  1412. denyReason: this.denyForm.reason
  1413. },
  1414. res => {
  1415. if (res.code == "ok") {
  1416. this.denyReasonDialog = false
  1417. this.getList();
  1418. } else {
  1419. this.$message({
  1420. message: res.msg,
  1421. type: "error"
  1422. });
  1423. }
  1424. },
  1425. error => {
  1426. this.$message({
  1427. message: error,
  1428. type: "error"
  1429. });
  1430. });
  1431. },
  1432. getExpList() {
  1433. this.http.post('/expense-type/getList', {
  1434. },
  1435. res => {
  1436. this.customTypeListLoading = false
  1437. if (res.code == "ok") {
  1438. this.allExpList = res.data;
  1439. this.customTypeList = res.data
  1440. this.addForm.type = this.expenseMainTypeValue
  1441. this.expenseTypeList = this.allExpList.filter(a => a.mainType == this.expenseMainTypeValue);
  1442. this.invoiceList = []
  1443. if (!res.data != res.data.length == 0) {
  1444. this.http.post('/company/settingExpenseType', {}, res => {
  1445. if (res.code == 'ok') { } else { this.$message({ message: res.msg, type: 'error' }) }
  1446. }, err => { this.$message({ message: err, type: 'error' }) })
  1447. }
  1448. for (let i in this.invoiceList) {
  1449. this.invoiceList[i].expenseType = ''
  1450. }
  1451. } else {
  1452. this.$message({
  1453. message: res.msg,
  1454. type: "error"
  1455. });
  1456. }
  1457. },
  1458. error => {
  1459. this.customTypeListLoading = false
  1460. this.$message({
  1461. message: error,
  1462. type: "error"
  1463. });
  1464. });
  1465. },
  1466. getExpensMainTypes() {
  1467. this.http.post('/expense-main-type/list', {
  1468. },
  1469. res => {
  1470. if (res.code == "ok") {
  1471. this.expenseMainTypes = res.data
  1472. this.expenseMainTypeValue = this.expenseMainTypes[0].id
  1473. } else {
  1474. this.$message({
  1475. message: res.msg,
  1476. type: "error"
  1477. });
  1478. }
  1479. },
  1480. error => {
  1481. this.$message({
  1482. message: error,
  1483. type: "error"
  1484. });
  1485. });
  1486. },
  1487. // 单据查看
  1488. downloadByA(val) {
  1489. if (val.status == 0) {
  1490. this.detailDialog = true
  1491. } else {
  1492. this.dialog = true
  1493. }
  1494. console.log(val, '看看数据来源')
  1495. this.detaExpenseMainTypeName = val.expenseMainTypeName
  1496. this.flg = true;
  1497. this.getParticulars(val.id);
  1498. this.expenseTypeList = this.allExpList.filter(a => a.mainType == val.type);
  1499. },
  1500. // 单据编辑
  1501. showEditName(val) {
  1502. this.dialog = true,
  1503. this.flg = false,
  1504. delete val.invoiceList
  1505. this.getParticulars(val.id)
  1506. this.expenseTypeList = this.allExpList.filter(a => a.mainType == val.type);
  1507. },
  1508. staffs(key, keyPath) { // 控制员工费用报表
  1509. if (keyPath[0] == '1') {
  1510. this.displayTable = false;
  1511. } else {
  1512. this.displayTable = true;
  1513. this.getList();
  1514. }
  1515. // currentClick
  1516. // console.log(key, keyPath)
  1517. this.currentClick = key
  1518. key == '2-1' ? this.currentClickNum = 70 : this.currentClickNum = 0
  1519. },
  1520. bills(audit) { // 控制
  1521. this.isAuditList = audit;
  1522. this.displayTable = true;
  1523. },
  1524. present() {
  1525. this.adds();
  1526. },
  1527. // 删除操作
  1528. delec(ids) {
  1529. // console.log('删除操作', ids);
  1530. this.ParticularsList.invoiceList.splice(ids, 1)
  1531. this.ParticularsList.ticketNum = this.ParticularsList.invoiceList.length
  1532. this.kan()
  1533. },
  1534. adds() {
  1535. var paramData = JSON.parse(JSON.stringify(this.ParticularsList));
  1536. var spl = paramData.invoiceList
  1537. for (var i in spl) {
  1538. if (spl[i].pic) {
  1539. if (spl[i].pic[0].name) {
  1540. spl[i].pic = spl[i].pic[0].name
  1541. }
  1542. }
  1543. }
  1544. paramData.items = JSON.stringify(paramData.invoiceList)//这里要传发票列表的json转string
  1545. delete paramData.invoiceList
  1546. this.http.post('/expense-sheet/add', paramData,
  1547. res => {
  1548. if (res.code == "ok") {
  1549. this.dialog = false;
  1550. this.bills(this.isAuditList);
  1551. this.$message({
  1552. message: this.$t('editsuccess'),
  1553. type: "success"
  1554. });
  1555. } else {
  1556. this.$message({
  1557. message: res.msg,
  1558. type: "error"
  1559. });
  1560. }
  1561. },
  1562. error => {
  1563. this.$message({
  1564. message: error,
  1565. type: "error"
  1566. });
  1567. });
  1568. },
  1569. // 获取人员信息
  1570. getUsers() {
  1571. // this.http.post(this.port.manage.list, {
  1572. // departmentId: -1,
  1573. // pageIndex: 1,
  1574. // // pageSize: 99999
  1575. // pageSize: -1
  1576. // },
  1577. this.http.post('/user/getSimpleActiveUserList', {},
  1578. res => {
  1579. if (res.code == "ok") {
  1580. // this.users = res.data.records;
  1581. this.users = res.data;
  1582. if (!this.permissions.costAudit) {
  1583. this.addForm.ownerId = this.user.id;
  1584. this.addForm.status = 1;
  1585. this.$forceUpdate()
  1586. }
  1587. } else {
  1588. this.$message({
  1589. message: res.msg,
  1590. type: "error"
  1591. });
  1592. }
  1593. },
  1594. error => {
  1595. this.$message({
  1596. message: error,
  1597. type: "error"
  1598. });
  1599. });
  1600. },
  1601. // 提交事件
  1602. submits() {
  1603. this.$refs.mainAddForm.validate(valid => {
  1604. if (valid) {
  1605. if (this.invoiceList.length == 0) {
  1606. this.$message({
  1607. message: this.$t('pleaseaddtheinvoice'),
  1608. type: "error"
  1609. });
  1610. return;
  1611. }
  1612. let strObj = {
  1613. project: '',
  1614. datas: '',
  1615. fptype: '',
  1616. fyType: '',
  1617. rmb: '',
  1618. flg: false
  1619. }
  1620. for (var i in this.invoiceList) {
  1621. if (!this.invoiceList[i].projectId) {
  1622. strObj.project = '所属项目'
  1623. strObj.flg = true
  1624. }
  1625. // if(!this.invoiceList[i].invoiceType || this.invoiceList[i].invoiceType == '') {
  1626. // strObj.fptype = '发票种类'
  1627. // strObj.flg = true
  1628. // }
  1629. if (!this.invoiceList[i].expenseType || this.invoiceList[i].expenseType == '') {
  1630. strObj.fyType = '费用类型'
  1631. strObj.flg = true
  1632. }
  1633. if (!this.invoiceList[i].happenDate || this.invoiceList[i].happenDate == '') {
  1634. strObj.datas = '费用日期'
  1635. strObj.flg = true
  1636. }
  1637. if (!this.invoiceList[i].amount || this.invoiceList[i].amount == '') {
  1638. strObj.rmb = '费用金额'
  1639. strObj.flg = true
  1640. }
  1641. }
  1642. if (strObj.flg) {
  1643. this.$message({
  1644. message: `${strObj.project} ${strObj.fptype} ${strObj.fyType} ${strObj.datas} ${strObj.rmb} 请填写完整`,
  1645. type: "error"
  1646. });
  1647. return;
  1648. }
  1649. // return
  1650. this.add();
  1651. }
  1652. });
  1653. },
  1654. // 点击新增
  1655. addxz() {
  1656. this.form = { happenDate: null, invoiceType: null, amount: null, invoiceNo: null, taxPercent: null, taxValue: null, remark: null, pic: null },
  1657. this.invoiceList.push(this.form)
  1658. },
  1659. addNewInvoice() {
  1660. this.form = { happenDate: null, invoiceType: null, amount: null, invoiceNo: null, taxPercent: null, taxValue: null, remark: null, pic: null },
  1661. this.ParticularsList.invoiceList.push(this.form)
  1662. this.ParticularsList.ticketNum = this.ParticularsList.invoiceList.length
  1663. },
  1664. //获取项目列表
  1665. getProjectList() {
  1666. this.http.post(this.port.project.list, {},
  1667. res => {
  1668. if (res.code == "ok") {
  1669. this.projectList = res.data;
  1670. } else {
  1671. this.$message({
  1672. message: res.msg,
  1673. type: "error"
  1674. });
  1675. }
  1676. },
  1677. error => {
  1678. this.$message({
  1679. message: error,
  1680. type: "error"
  1681. });
  1682. });
  1683. },
  1684. //获取审核模式
  1685. getAuditType() {
  1686. this.http.post('/expense-audit-setting/get', {},
  1687. res => {
  1688. if (res.code == "ok") {
  1689. this.auditTypeItem = res.data;
  1690. } else {
  1691. this.$message({
  1692. message: res.msg,
  1693. type: "error"
  1694. });
  1695. }
  1696. },
  1697. error => {
  1698. this.$message({
  1699. message: error,
  1700. type: "error"
  1701. });
  1702. });
  1703. },
  1704. //获取单据列表
  1705. getList() {
  1706. // console.log(this.date)
  1707. var stat = ''
  1708. var end = ''
  1709. if (this.date) {
  1710. stat = this.date[0]
  1711. end = this.date[1]
  1712. }
  1713. var param = {
  1714. pageIndex: this.page,
  1715. pageSize: this.size,
  1716. code: this.code,
  1717. // createDate: this.date,
  1718. startDate: stat,
  1719. endDate: end,
  1720. ownerId: this.ownerId,
  1721. type: this.queryExpenseMainType,
  1722. };
  1723. if (this.isAuditList) {
  1724. param.status = 1;
  1725. }
  1726. if (this.permissions.costExpenseRelease) {
  1727. param.sendState = this.sendState
  1728. }
  1729. this.list = [];
  1730. // this.total = 0;
  1731. this.http.post('/expense-sheet/list', param,
  1732. res => {
  1733. if (res.code == "ok") {
  1734. this.list = res.data.records;
  1735. this.total = res.data.total || 0;
  1736. } else {
  1737. this.$message({
  1738. message: res.msg,
  1739. type: "error"
  1740. });
  1741. }
  1742. },
  1743. error => {
  1744. this.$message({
  1745. message: error,
  1746. type: "error"
  1747. });
  1748. });
  1749. },
  1750. //删除单据
  1751. deletes(id) {
  1752. this.http.post('/expense-sheet/delete', { id: id },
  1753. res => {
  1754. if (res.code == "ok") {
  1755. this.getList()
  1756. this.$message({
  1757. message: this.$t('message.successfullyDeleted'),
  1758. type: "success"
  1759. });
  1760. } else {
  1761. this.$message({
  1762. message: res.msg,
  1763. type: "error"
  1764. });
  1765. }
  1766. },
  1767. error => {
  1768. this.$message({
  1769. message: error,
  1770. type: "error"
  1771. });
  1772. });
  1773. },
  1774. //创建单据
  1775. add() {
  1776. // happenDate
  1777. this.addForm.items = JSON.stringify(this.invoiceList)//这里要传发票列表的json转string
  1778. this.addForm.totalAmount = this.totalCost
  1779. this.http.post('/expense-sheet/add', this.addForm,
  1780. res => {
  1781. if (res.code == "ok") {
  1782. this.$message({
  1783. message: this.$t('message.fillinsuccessfully'),
  1784. type: "success"
  1785. });
  1786. this.addForm = {
  1787. code: null,
  1788. ownerId: this.user.id,
  1789. createDate: null,
  1790. type: this.expenseMainTypeValue,
  1791. ticketNum: 1, remark: null, totalAmount: 0,
  1792. }
  1793. this.invoiceList = []
  1794. this.getNextCode()
  1795. } else {
  1796. this.$message({
  1797. message: res.msg,
  1798. type: "error"
  1799. });
  1800. }
  1801. },
  1802. error => {
  1803. this.$message({
  1804. message: error,
  1805. type: "error"
  1806. });
  1807. });
  1808. },
  1809. //获取单据编码
  1810. getNextCode() {
  1811. this.http.post('/expense-sheet/getNextCode', {
  1812. },
  1813. res => {
  1814. if (res.code == "ok") {
  1815. this.addForm.code = res.data;
  1816. } else {
  1817. this.$message({
  1818. message: res.msg,
  1819. type: "error"
  1820. });
  1821. }
  1822. },
  1823. error => {
  1824. this.$message({
  1825. message: error,
  1826. type: "error"
  1827. });
  1828. });
  1829. },
  1830. // 获取查看单据的数据
  1831. getParticulars(id) {
  1832. this.http.post('/expense-sheet/getDetail', { id: id },
  1833. res => {
  1834. if (res.code == "ok") {
  1835. this
  1836. // this.ParticularsList = res.data
  1837. var s = []
  1838. // var b = []
  1839. for (var i in res.data.invoiceList) {
  1840. if (res.data.invoiceList[i].pic) {
  1841. var b = []
  1842. var j = {}
  1843. var img = this.diz + '/upload/' + res.data.invoiceList[i].pic
  1844. j.url = img
  1845. j.title = this.$t('expensereimbursementvoucher'),
  1846. j.name = res.data.invoiceList[i].pic
  1847. b.push(j)
  1848. res.data.invoiceList[i].pic = b
  1849. // console.log(res.data.invoiceList[i].pic)
  1850. }
  1851. }
  1852. this.ParticularsList = res.data
  1853. for (var i = 0; i <= this.ParticularsList.invoiceList.length - 1; i++) {
  1854. s.push(this.ParticularsList.invoiceList[i].projectId)
  1855. }
  1856. this.projectIdName = this.projectList.filter(item => { return s.indexOf(item.id) !== -1 })
  1857. // this.projectIdName = this.projectList.filter(p => p.id == this.ParticularsList.invoiceList[0].projectId)[0].projectName
  1858. // console.log(res.data, '查看当前状态');
  1859. // console.log(this.ParticularsList)
  1860. } else {
  1861. this.$message({
  1862. message: res.msg,
  1863. type: "error"
  1864. });
  1865. }
  1866. },
  1867. error => {
  1868. this.$message({
  1869. message: error,
  1870. type: "error"
  1871. });
  1872. })
  1873. },
  1874. //分页
  1875. handleCurrentChange(val) {
  1876. this.page = val;
  1877. console.log('page=======', this.page);
  1878. this.getList();
  1879. },
  1880. handleSizeChange(val) {
  1881. this.size = val;
  1882. this.getList();
  1883. },
  1884. deleteItem(item) {
  1885. this.$confirm(this.$t('yousureyouwanttodelete'), this.$t('other.prompts'), {
  1886. //type: 'warning'
  1887. }).then(() => {
  1888. this.http.post('/expense-sheet/delete', { id: item.id },
  1889. res => {
  1890. if (res.code == "ok") {
  1891. this.getList();
  1892. } else {
  1893. this.$message({
  1894. message: res.msg,
  1895. type: "error"
  1896. });
  1897. }
  1898. },
  1899. error => {
  1900. this.$message({
  1901. message: error,
  1902. type: "error"
  1903. });
  1904. });
  1905. });
  1906. },
  1907. // 点击删除
  1908. chanc(k) {
  1909. this.invoiceList.splice(k, 1)
  1910. },
  1911. // 双击
  1912. dbclick(row, event, column) {
  1913. this.isOK = true
  1914. },
  1915. oosk(s) {
  1916. this.isOK = false
  1917. },
  1918. ssl(index) {
  1919. this.z = index
  1920. this.addForm.type = index
  1921. this.ins = index;
  1922. this.expenseTypeList = this.allExpList.filter(a => a.mainType == this.ins);
  1923. this.addForm.ownerId = this.user.id;
  1924. this.getNextCode();
  1925. },
  1926. // 点击侧边栏事件
  1927. side() {
  1928. if (this.$refs.side.style.left < '0px') {
  1929. this.$refs.sidebars.style.width = '1px'
  1930. this.$refs.sid.style.left = '1px'
  1931. this.$refs.side.style.left = '1px'
  1932. this.$refs.sideI.className = 'el-icon-arrow-right'
  1933. this.$refs.staff.style.margin = '20px 20px 0 20px'
  1934. this.$refs.staff.style.width = '95%'
  1935. this.$refs.xiaomian.style.width = '100%'
  1936. this.$refs.headHe.style.paddingLeft = '20px'
  1937. this.currentClickNum = 0
  1938. } else {
  1939. this.$refs.sidebars.style.width = '200px'
  1940. this.$refs.sid.style.left = '200px'
  1941. this.$refs.side.style.left = '-19px'
  1942. this.$refs.sideI.className = 'el-icon-arrow-left'
  1943. this.$refs.staff.style.margin = '20px 20px 0 220px'
  1944. this.$refs.staff.style.width = '81%'
  1945. this.$refs.xiaomian.style.width = '85%'
  1946. this.$refs.headHe.style.paddingLeft = '220px'
  1947. this.currentClickNum = 70
  1948. }
  1949. },
  1950. // 费用金额失去焦点时触发
  1951. shiqu() {
  1952. this.addForm.totalAmount = this.invoiceList.reduce((prev, next) => {
  1953. return prev + parseFloat(next.amount);
  1954. }, 0)
  1955. },
  1956. kan() {
  1957. this.ParticularsList.totalAmount = this.ParticularsList.invoiceList.reduce((prev, next) => {
  1958. return prev + parseFloat(next.amount)
  1959. }, 0)
  1960. },
  1961. zhi(e) {
  1962. // console.log('看看值', e)
  1963. var i = e
  1964. if (this.invoiceList[i].amount == null || this.invoiceList[i].amount == 'null' || this.invoiceList[i].taxPercent == null || this.invoiceList[i].taxPercent == 'null') {
  1965. return
  1966. }
  1967. this.invoiceList[i].taxValue = this.invoiceList[i].amount * this.invoiceList[i].taxPercent / 100
  1968. // console.log(this.invoiceList[i].amount, this.invoiceList[i].taxPercent)
  1969. var shui = this.invoiceList[i].taxPercent / 100 // 税率
  1970. var zhi = this.invoiceList[i].amount / (1 + shui) * shui
  1971. this.invoiceList[i].taxValue = zhi.toFixed(2)
  1972. },
  1973. zhiNum(i, val) {
  1974. // console.log('看看值', i, val)
  1975. // console.log(this.ParticularsList.invoiceList)
  1976. if (this.ParticularsList.invoiceList[i].amount == null || this.ParticularsList.invoiceList[i].amount == 'null' || this.ParticularsList.invoiceList[i].taxPercent == null || this.ParticularsList.invoiceList[i].taxPercent == 'null') {
  1977. return
  1978. }
  1979. var shui = this.ParticularsList.invoiceList[i].taxPercent / 100
  1980. var zhi = this.ParticularsList.invoiceList[i].amount / (1 + shui) * shui
  1981. this.ParticularsList.invoiceList[i].taxValue = zhi.toFixed(2)
  1982. },
  1983. zhis(e) {
  1984. var i = e
  1985. this.invoiceList[i].taxValue = this.invoiceList[i].taxValue.toFixed(2)
  1986. },
  1987. fileonLoad(item) {
  1988. //首先判断文件类型
  1989. let str = item.file.name.split(".");
  1990. let format = str[str.length - 1];
  1991. if (format != "jpg" && format != "png" && format != "pdf") {
  1992. this.$message({
  1993. message: this.$t('pleaseselectpictures'),
  1994. type: "error"
  1995. });
  1996. } else {
  1997. this.listLoading = true;
  1998. let formData = new FormData();
  1999. formData.append("multipartFile", item.file);
  2000. this.http.uploadFile('/common/uploadFile', formData,
  2001. res => {
  2002. this.listLoading = false;
  2003. if (res.code == "ok") {
  2004. this.$message({
  2005. message: this.$t('uploadedsuccessfully'),
  2006. type: "success"
  2007. });
  2008. // this.getList();
  2009. this.invoiceList[this.apl].pic = res.data
  2010. // console.log(this.invoiceList)
  2011. } else {
  2012. this.$message({
  2013. message: res.msg,
  2014. type: "error"
  2015. });
  2016. }
  2017. },
  2018. error => {
  2019. this.listLoading = false;
  2020. this.$message({
  2021. message: error,
  2022. type: "error"
  2023. });
  2024. });
  2025. }
  2026. },
  2027. abl(e) {
  2028. this.apl = e
  2029. },
  2030. beforeRemove(file, fileList) {
  2031. var that = this
  2032. setTimeout(function () {
  2033. that.invoiceList[that.apl].pic = null
  2034. }, 200)
  2035. },
  2036. fileonLoads(item) {
  2037. //首先判断文件类型
  2038. let str = item.file.name.split(".");
  2039. let format = str[str.length - 1];
  2040. if (format != "jpg" && format != "png" && format != "pdf") {
  2041. this.$message({
  2042. message: this.$t('pleaseselectpictures'),
  2043. type: "error"
  2044. });
  2045. } else {
  2046. this.listLoading = true;
  2047. let formData = new FormData();
  2048. formData.append("multipartFile", item.file);
  2049. this.http.uploadFile('/common/uploadFile', formData,
  2050. res => {
  2051. this.listLoading = false;
  2052. if (res.code == "ok") {
  2053. this.$message({
  2054. message: this.$t('uploadedsuccessfully'),
  2055. type: "success"
  2056. });
  2057. // this.getList();
  2058. this.ParticularsList.invoiceList[this.apl].pic = res.data
  2059. // console.log(this.invoiceList)
  2060. } else {
  2061. this.$message({
  2062. message: res.msg,
  2063. type: "error"
  2064. });
  2065. }
  2066. },
  2067. error => {
  2068. this.listLoading = false;
  2069. this.$message({
  2070. message: error,
  2071. type: "error"
  2072. });
  2073. });
  2074. }
  2075. },
  2076. beforeRemoves(file, fileList) {
  2077. var that = this
  2078. setTimeout(function () {
  2079. // this.ParticularsList.invoiceList
  2080. that.ParticularsList.invoiceList[that.apl].pic = null
  2081. }, 200)
  2082. },
  2083. imgUrl(img) {
  2084. // var imgss = this.diz + '/upload/' + img
  2085. // var sp = []
  2086. // var is = {}
  2087. // is.url = imgss
  2088. // is.title = 1
  2089. // sp.push(is)
  2090. // this.imgs = sp
  2091. // console.log(imgss)
  2092. // console.log(this.$refs.imgsa)
  2093. // this.$refs.imgsa.click()
  2094. // console.log(location.protocol, location.host)
  2095. // console.log(location.protocol + '//' + location.host + imgs)
  2096. },
  2097. // 合计
  2098. getSummaries(param) {
  2099. const { columns, data } = param;
  2100. const sums = [];
  2101. columns.forEach((column, index) => {
  2102. if (index === 1) {
  2103. sums[index] = '本页金额合计';//this.$t('other.totals');
  2104. return;
  2105. }
  2106. if (index === 2) {
  2107. const values = data.map(item => Number(item[column.property]));
  2108. if (!values.every(value => isNaN(value))) {
  2109. sums[index] = values.reduce((prev, curr) => {
  2110. const value = Number(curr);
  2111. if (!isNaN(value)) {
  2112. return prev + curr;
  2113. } else {
  2114. return prev;
  2115. }
  2116. }, 0);
  2117. var zhi = +sums[index] + 0
  2118. var sl = zhi.toFixed(2)
  2119. sl += this.$t('yuan');
  2120. sums[index] = sl;
  2121. } else {
  2122. sums[index] = '';
  2123. }
  2124. } else {
  2125. sums[index] = '';
  2126. }
  2127. });
  2128. // console.log(sums, 123)
  2129. this.$nextTick(() => { this.$refs.tab.doLayout() })
  2130. return sums;
  2131. },
  2132. // 自定义组件事件
  2133. selectCal(obj) {
  2134. if (obj.distinction == '1') {
  2135. this.addForm.ownerId = obj.id
  2136. } else if (obj.distinction == '2') {
  2137. this.ownerId = obj.id
  2138. } else if (obj.distinction == '3') {
  2139. this.ParticularsList.ownerId = obj.id
  2140. }
  2141. },
  2142. // 单据导出
  2143. exportDocument() {
  2144. var stat = ''
  2145. var end = ''
  2146. if (this.date) {
  2147. stat = this.date[0]
  2148. end = this.date[1]
  2149. }
  2150. this.http.post('/expense-sheet/exportList', {
  2151. code: this.code,
  2152. startDate: stat,
  2153. endDate: end,
  2154. ownerId: this.ownerId,
  2155. type: this.type,
  2156. },
  2157. res => {
  2158. if (res.code == "ok") {
  2159. var filePath = res.data;
  2160. const a = document.createElement('a'); // 创建a标签
  2161. a.setAttribute('download', '费用报销单据列表');// download属性
  2162. a.setAttribute('href', filePath);// href链接
  2163. a.click(); //自执行点击事件
  2164. a.remove();
  2165. } else {
  2166. this.$message({
  2167. message: res.msg,
  2168. type: "error"
  2169. });
  2170. }
  2171. },
  2172. error => {
  2173. this.$message({
  2174. message: error,
  2175. type: "error"
  2176. });
  2177. });
  2178. },
  2179. // 单据发放
  2180. documentIssuance(type) {
  2181. const newList = this.multipleSelection.filter(item => item.status == 1 || item.status == 2);
  2182. const unissueds = this.multipleSelection.filter(item => item.status != 1 && item.status != 2 && item.sendState == 0).map(item => item.id);
  2183. const Issueds = this.multipleSelection.filter(item => item.status != 1 && item.status != 2 && item.sendState == 1).map(item => item.id);
  2184. const showMessage = (msg, messageType) => {
  2185. this.$message({
  2186. message: msg,
  2187. type: messageType
  2188. });
  2189. };
  2190. if (newList.length > 0) {
  2191. showMessage('存在待审核或已驳回的单据', 'warning');
  2192. return;
  2193. }
  2194. if (type == 1 && unissueds.length == 0) {
  2195. showMessage('请选择未发放的单据', 'warning');
  2196. return;
  2197. }
  2198. if (type == 0 && Issueds.length == 0) {
  2199. showMessage('请选择已发放的单据', 'warning');
  2200. return;
  2201. }
  2202. this.callingInterface(type, type == 1 ? unissueds : Issueds);
  2203. },
  2204. callingInterface(type, ids) {
  2205. this.http.post('/expense-sheet/editSendExpense', {
  2206. expenseIds: ids.join(','),
  2207. sendState: type
  2208. },
  2209. res => {
  2210. if (res.code == "ok") {
  2211. this.$message({
  2212. message: '操作成功',
  2213. type: "success"
  2214. });
  2215. this.getList()
  2216. } else {
  2217. this.$message({
  2218. message: res.msg,
  2219. type: "error"
  2220. });
  2221. }
  2222. },
  2223. error => {
  2224. this.$message({
  2225. message: error,
  2226. type: "error"
  2227. });
  2228. });
  2229. },
  2230. handleSelectionChange(val) {
  2231. this.multipleSelection = val;
  2232. },
  2233. // 打印
  2234. print() {
  2235. // let printContent = this.$refs.printContent;
  2236. // let newWindow = window.open('', '_blank');
  2237. // newWindow.document.write(printContent.innerHTML);
  2238. // newWindow.document.close();
  2239. // newWindow.focus();
  2240. // newWindow.print();
  2241. // newWindow.close();
  2242. this.$print(this.$refs.printContent)
  2243. }
  2244. },
  2245. beforeDestroy() {
  2246. }
  2247. };
  2248. </script>
  2249. <style scoped lang="scss">
  2250. .tups {
  2251. width: 100%;
  2252. height: 25px;
  2253. position: relative;
  2254. z-index: 99;
  2255. overflow: hidden;
  2256. }
  2257. .tups img {
  2258. height: 25px !important;
  2259. position: relative;
  2260. z-index: 99;
  2261. }
  2262. .viewer-canvas {
  2263. position: absolute;
  2264. z-index: 9 !important;
  2265. }
  2266. .icl {
  2267. margin-top: -25px !important;
  2268. }
  2269. /* 费用报销标题 */
  2270. .headine {
  2271. width: 100%;
  2272. height: 46.4px;
  2273. line-height: 46.4px;
  2274. background: #fff;
  2275. box-sizing: border-box;
  2276. }
  2277. .headine h3 {
  2278. margin: 0;
  2279. display: inline-block;
  2280. box-sizing: border-box;
  2281. color: #999;
  2282. }
  2283. .headine p {
  2284. display: inline-block;
  2285. margin: 0;
  2286. }
  2287. /* /费用报销标题 */
  2288. .sidebars {
  2289. height: 100%;
  2290. position: absolute;
  2291. border-right: 1px solid #E6E6E6;
  2292. z-index: 2;
  2293. top: 0;
  2294. }
  2295. .sidebars h3 {
  2296. margin: 0;
  2297. line-height: 45px;
  2298. background: #ffffff;
  2299. font-weight: normal;
  2300. color: #666;
  2301. padding-left: 20px;
  2302. }
  2303. .sidebars .el-col-12 {
  2304. width: 100%
  2305. }
  2306. .public {
  2307. height: 180px;
  2308. border-bottom: 1px solid #ddd;
  2309. }
  2310. .public .el-form-item {
  2311. display: inline-block;
  2312. }
  2313. .pu_button {
  2314. text-align: right;
  2315. width: 100%;
  2316. padding: 24px 30px;
  2317. box-sizing: border-box;
  2318. }
  2319. .pu_bu_x .pu_bu_t {
  2320. display: inline-block;
  2321. }
  2322. .pu_bu_x {
  2323. margin-right: 20px;
  2324. color: #20A0F7;
  2325. cursor: pointer;
  2326. }
  2327. .pu_bu_t {
  2328. color: #20A0F7;
  2329. cursor: pointer;
  2330. display: block;
  2331. float: right;
  2332. position:
  2333. relative;
  2334. top: -20px;
  2335. right: 63px;
  2336. }
  2337. .pu_table {
  2338. margin-left: 10px;
  2339. }
  2340. .pu_bu_t:hover {
  2341. color: #7bbcff;
  2342. }
  2343. .pu_bu_x:hover {
  2344. color: #7bbcff;
  2345. }
  2346. /* 我的单据报销凭证 */
  2347. .staff {
  2348. border-left: 1px solid #fff;
  2349. border-top: 1px solid #fff;
  2350. border-right: 1px solid #fff;
  2351. background: #fff;
  2352. }
  2353. /* */
  2354. .sdat {
  2355. display: inline-block;
  2356. width: 260px;
  2357. margin-left: 13px;
  2358. }
  2359. .messages .el-form-item {
  2360. display: inline-block;
  2361. }
  2362. .messages .el-date-editor.el-input,
  2363. .el-date-editor.el-input__inner {
  2364. width: 190px;
  2365. }
  2366. /* 我的报销凭证 */
  2367. .search {
  2368. position: relative;
  2369. top: 20px;
  2370. left: 20px;
  2371. }
  2372. .tables {
  2373. margin-top: 50px;
  2374. box-sizing: border-box;
  2375. padding: 10px;
  2376. }
  2377. .informant .el-form-item {
  2378. display: inline-block;
  2379. }
  2380. /* 侧边栏收索 */
  2381. .side {
  2382. position: absolute;
  2383. z-index: 2;
  2384. border-right: 2px solid #DDDDDD;
  2385. height: 100%;
  2386. top: 0;
  2387. width: 0;
  2388. }
  2389. .side .spans {
  2390. width: 20px;
  2391. height: 30px;
  2392. border: 1px solid #DDDDDD;
  2393. box-sizing: border-box;
  2394. position: absolute;
  2395. top: 50%;
  2396. margin-top: -50%;
  2397. text-align: center;
  2398. z-index: 1;
  2399. background: #fff;
  2400. }
  2401. .side .spans i {
  2402. margin-top: 7px;
  2403. color: #C0BFBF
  2404. }
  2405. .side:hover {
  2406. border-right: 2px solid #20A0FF;
  2407. }
  2408. .side:hover .spans {
  2409. border: 1px solid #20A0FF;
  2410. background: #20A0FF;
  2411. }
  2412. .side:hover .spans i {
  2413. color: #fff;
  2414. }
  2415. /* 右边整体页面 */
  2416. .contents {
  2417. height: 100%;
  2418. /* padding: 30px; */
  2419. background: #F7F7F7;
  2420. /* position: absolute; */
  2421. }
  2422. .submits {
  2423. margin-left: 50%;
  2424. }
  2425. .waiting {
  2426. color: orange;
  2427. }
  2428. .rejected {
  2429. color: red;
  2430. }
  2431. .newInvoice {
  2432. position: absolute;
  2433. right: 10px;
  2434. top: -20px;
  2435. height: 20px;
  2436. line-height: 20px;
  2437. cursor: pointer;
  2438. color: #20a0f7;
  2439. font-size: 14px;
  2440. }
  2441. .newInvoice:hover {
  2442. color: #7bbcff;
  2443. }
  2444. /* 新增打印的费用报销类型 */
  2445. .printContent {
  2446. .printContent-detail {
  2447. display: flex;
  2448. flex-wrap: wrap;
  2449. }
  2450. .detail-item {
  2451. width: 33%;
  2452. font-size: 16px;
  2453. margin-bottom: 10px;
  2454. color: #000;
  2455. .detail-item-title {
  2456. color: #999;
  2457. }
  2458. .single {
  2459. font-size: 14px;
  2460. }
  2461. .printBox {
  2462. display: inline-block;
  2463. width: 125px;
  2464. text-align-last: justify;
  2465. box-sizing: border-box;
  2466. padding-right: 10px;
  2467. }
  2468. }
  2469. .conter-box {
  2470. .conter-border {
  2471. width: 100%;
  2472. box-sizing: border-box;
  2473. padding: 15px;
  2474. border: 1px solid #ddd;
  2475. border-radius: 4px;
  2476. display: flex;
  2477. flex-wrap: wrap;
  2478. margin-top: 20px;
  2479. .detail-item {
  2480. width: 50%;
  2481. margin-top: 10px;
  2482. }
  2483. }
  2484. }
  2485. }
  2486. </style>