expense.vue 97 KB

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