expense.vue 63 KB

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