expense.vue 54 KB

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