expense.vue 77 KB

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