expense.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  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;">
  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: {ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }]},
  469. isAuditList: false,
  470. statusTxt:["审核通过","待审核", "已驳回", "已撤销"],
  471. user: JSON.parse(sessionStorage.getItem("user")),
  472. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  473. allExpList:[],
  474. expenseTypeList:[],
  475. tian:{a: null,b: null,c: null,d: null,e: null,f: null,g: null,h: null,},
  476. feeType:["一般费用","差旅费用","外包费用"],
  477. typeInvoic: ['增值税专用发票', '增值税普通发票'],
  478. listLoading:false,
  479. tableHeight:0,
  480. list:[],
  481. total:0,
  482. code:null,
  483. date:null,
  484. type:null,
  485. ownerId: null,
  486. users: [], // 人员信息
  487. displayTable: false,
  488. getLists: [],
  489. ProjectList: [], // 项目列表
  490. companyId: [], // 人员的id
  491. dialogVisible: false,
  492. code: null,
  493. addForm:{code:null,ownerId:null,createDate: null, ticketNum:1,type:0,remark:null,totalAmount:0,},
  494. page: 1,
  495. size:20,
  496. form: {happenDate: null,invoiceType:null,amount:null,invoiceNo:null,taxPercent:null,taxValue:null,remark:null},
  497. invoiceList: [],
  498. kkk: null, //
  499. ddId: null,
  500. dldl: [],
  501. isOK: false,
  502. z : null,
  503. value: null,
  504. dialog: false, // 单据查看展示
  505. ParticularsList: [],
  506. projectIdName: [], // 点击查看的项目名
  507. flg: false, // 是否禁用
  508. shuz: ['一般费用填报', '差旅费用填报', '外包费用填报'],
  509. ins: 0,
  510. apl: '',
  511. diz: 'http://worktime.ttkuaiban.com',
  512. importDialog: false,
  513. importingData: false
  514. };
  515. },
  516. computed: {
  517. totalCost : function(){
  518. let num = 0
  519. for(let i in this.invoiceList){
  520. if(this.invoiceList[i].amount){
  521. num += this.invoiceList[i].amount*1
  522. }
  523. }
  524. return num
  525. }
  526. },
  527. watch: {},
  528. created() {
  529. let height = window.innerHeight;
  530. this.tableHeight = height - 195;
  531. const that = this;
  532. window.onresize = function temp() {
  533. that.tableHeight = window.innerHeight - 195;
  534. };
  535. },
  536. mounted() {
  537. this.getNextCode();
  538. this.getUsers() // 获取人员信息
  539. this.getList() // 获取单据列表
  540. this.getProjectList();
  541. this.getExpList();
  542. },
  543. filters: {
  544. numberToCurrency(value) {
  545. if (!value) return '0.00'
  546. // console.log('v=='+value);
  547. value = value.toFixed(2)
  548. const intPart = Math.trunc(value)
  549. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  550. let floatPart = '.00'
  551. const valueArray = value.toString().split('.')
  552. if (valueArray.length === 2) { // 有小数部分
  553. floatPart = valueArray[1].toString() // 取得小数部分
  554. return intPartFormat + '.' + floatPart
  555. }
  556. return intPartFormat + floatPart
  557. }
  558. },
  559. methods: {
  560. submitUpload(){
  561. this.importDialog = true
  562. },
  563. fileListAdd(file,fileList){
  564. let str = file.name.split(".");
  565. let format = str[str.length - 1];
  566. if (format != "xls" && format != "xlsx") {
  567. this.$message({
  568. message: "请选择.xls或.xlsx文件",
  569. type: "error"
  570. });
  571. fileList.splice(fileList.length-1)
  572. }
  573. this.fileList = fileList
  574. },
  575. fileListDel(file,fileList){
  576. this.fileList = fileList
  577. },
  578. fileListClear(){
  579. this.$refs.upload.clearFiles();
  580. this.fileList = []
  581. },
  582. submitUploadSure(){
  583. this.$confirm('确认上传?','提示',{
  584. confirmButtonText: '确定',
  585. cancelButtonText: '取消',
  586. type: 'success'
  587. }).then(()=>{
  588. let formData = new FormData();
  589. for(let i in this.fileList){
  590. formData.append("files", this.fileList[i].raw);
  591. }
  592. this.importingData = true
  593. // console.log(formData,this.fileList);
  594. // return
  595. this.http.uploadFile( '/expense-sheet/importData', formData,
  596. res => {
  597. if (res.code == "ok") {
  598. this.importingData = false
  599. this.$refs.upload.clearFiles();
  600. this.fileList = []
  601. this.$message({
  602. message: "上传成功",
  603. type: "success"
  604. });
  605. } else {
  606. this.importingData = false
  607. this.$message({
  608. message: res.msg,
  609. type: "error"
  610. });
  611. }
  612. },error => {
  613. this.importingData = false
  614. this.$message({
  615. message: error,
  616. type: "error"
  617. });
  618. });
  619. }).catch(()=>{})
  620. },
  621. restrictNumber(targetId) {
  622. let inpu = document.getElementById(targetId);
  623. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  624. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  625. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  626. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  627. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  628. inpu.value = parseFloat(inpu.value);
  629. }
  630. },
  631. approve(item) {
  632. //审核通过
  633. this.http.post('/expense-sheet/approve', {id:item.id
  634. },
  635. res => {
  636. if (res.code == "ok") {
  637. this.getList();
  638. } else {
  639. this.$message({
  640. message: res.msg,
  641. type: "error"
  642. });
  643. }
  644. },
  645. error => {
  646. this.$message({
  647. message: error,
  648. type: "error"
  649. });
  650. });
  651. },
  652. deny(item) {
  653. //审核驳回
  654. this.http.post('/expense-sheet/deny', {id:item.id
  655. },
  656. res => {
  657. if (res.code == "ok") {
  658. this.getList();
  659. } else {
  660. this.$message({
  661. message: res.msg,
  662. type: "error"
  663. });
  664. }
  665. },
  666. error => {
  667. this.$message({
  668. message: error,
  669. type: "error"
  670. });
  671. });
  672. },
  673. getExpList() {
  674. this.http.post('/expense-type/getList', {
  675. },
  676. res => {
  677. if (res.code == "ok") {
  678. this.allExpList = res.data;
  679. this.expenseTypeList = this.allExpList.filter(a=>a.mainType == 0);
  680. } else {
  681. this.$message({
  682. message: res.msg,
  683. type: "error"
  684. });
  685. }
  686. },
  687. error => {
  688. this.$message({
  689. message: error,
  690. type: "error"
  691. });
  692. });
  693. },
  694. // 单据查看
  695. downloadByA(val) {
  696. this.dialog = true
  697. this.flg = true;
  698. this.getParticulars(val.id);
  699. this.expenseTypeList = this.allExpList.filter(a=>a.mainType == val.type);
  700. },
  701. // 单据编辑
  702. showEditName(val) {
  703. this.dialog = true,
  704. this.flg = false,
  705. delete val.invoiceList
  706. this.getParticulars(val.id)
  707. this.expenseTypeList = this.allExpList.filter(a=>a.mainType == val.type);
  708. },
  709. staffs(key, keyPath) { // 控制员工费用报表
  710. if (keyPath[0] == '1') {
  711. this.displayTable = false;
  712. } else {
  713. this.displayTable = true;
  714. this.getList();
  715. }
  716. },
  717. bills(audit) { // 控制
  718. this.isAuditList = audit;
  719. this.getList();
  720. this.displayTable = true;
  721. },
  722. present(){
  723. this.dialog = false
  724. this.adds();
  725. },
  726. // 删除操作
  727. delec(ids) {
  728. // console.log('删除操作', ids);
  729. this.ParticularsList.invoiceList.splice(ids, 1)
  730. this.kan()
  731. },
  732. adds() {
  733. // happenDate
  734. // console.log(this.ParticularsList.invoiceList, '123')
  735. var spl = this.ParticularsList.invoiceList
  736. for(var i in spl) {
  737. if(spl[i].pic) {
  738. if(spl[i].pic[0].name) {
  739. spl[i].pic = spl[i].pic[0].name
  740. }
  741. }
  742. }
  743. // console.log(spl)
  744. // return
  745. this.ParticularsList.items = JSON.stringify(this.ParticularsList.invoiceList)//这里要传发票列表的json转string
  746. delete this.ParticularsList.invoiceList
  747. this.http.post('/expense-sheet/add', this.ParticularsList,
  748. res => {
  749. if (res.code == "ok") {
  750. this.bills(this.isAuditList);
  751. this.$message({
  752. message: '编辑成功',
  753. type: "success"
  754. });
  755. } else {
  756. this.$message({
  757. message: res.msg,
  758. type: "error"
  759. });
  760. }
  761. },
  762. error => {
  763. this.$message({
  764. message: error,
  765. type: "error"
  766. });
  767. });
  768. },
  769. // 获取人员信息
  770. getUsers() {
  771. this.http.post(this.port.manage.list, {
  772. departmentId: -1,
  773. pageIndex: 1,
  774. pageSize: 99999
  775. },
  776. res => {
  777. if (res.code == "ok") {
  778. this.users = res.data.records;
  779. if (!this.permissions.costAudit) {
  780. this.addForm.ownerId = this.user.id;
  781. this.addForm.status = 1;
  782. }
  783. } else {
  784. this.$message({
  785. message: res.msg,
  786. type: "error"
  787. });
  788. }
  789. },
  790. error => {
  791. this.$message({
  792. message: error,
  793. type: "error"
  794. });
  795. });
  796. },
  797. // 提交事件
  798. submits() {
  799. this.$refs.mainAddForm.validate(valid => {
  800. if (valid) {
  801. if (this.invoiceList.length == 0) {
  802. this.$message({
  803. message: '请添加发票',
  804. type: "error"
  805. });
  806. return;
  807. }
  808. this.add();
  809. this.addForm = {code:null,ownerId:null,createDate: null,type:this.z, ticketNum:1,remark:null,totalAmount:0,}
  810. this.invoiceList = []
  811. }
  812. });
  813. },
  814. // 点击新增
  815. addxz() {
  816. this.form = {happenDate: null,invoiceType:null,amount:null,invoiceNo:null,taxPercent:null,taxValue:null,remark:null,pic: null},
  817. this.invoiceList.push(this.form)
  818. },
  819. //获取项目列表
  820. getProjectList() {
  821. this.http.post( this.port.project.list, {},
  822. res => {
  823. if (res.code == "ok") {
  824. this.projectList = res.data;
  825. } else {
  826. this.$message({
  827. message: res.msg,
  828. type: "error"
  829. });
  830. }
  831. },
  832. error => {
  833. this.$message({
  834. message: error,
  835. type: "error"
  836. });
  837. });
  838. },
  839. //获取单据列表
  840. getList() {
  841. // console.log(this.date)
  842. var stat = ''
  843. var end = ''
  844. if(this.date) {
  845. stat = this.date[0]
  846. end = this.date[1]
  847. }
  848. var param = {pageIndex: this.page,
  849. pageSize: this.size,
  850. code: this.code,
  851. // createDate: this.date,
  852. startDate: stat,
  853. endDate: end,
  854. ownerId:this.ownerId,
  855. type:this.type,
  856. };
  857. if (this.isAuditList) {
  858. param.status = 1;
  859. }
  860. this.list = [];
  861. this.total = 0;
  862. this.http.post('/expense-sheet/list', param,
  863. res => {
  864. if (res.code == "ok") {
  865. this.list = res.data.records;
  866. this.total = res.data.total;
  867. } else {
  868. this.$message({
  869. message: res.msg,
  870. type: "error"
  871. });
  872. }
  873. },
  874. error => {
  875. this.$message({
  876. message: error,
  877. type: "error"
  878. });
  879. });
  880. },
  881. //删除单据
  882. deletes(id) {
  883. this.http.post('/expense-sheet/delete', {id: id},
  884. res => {
  885. if (res.code == "ok") {
  886. this.getList()
  887. this.$message({
  888. message: '删除成功',
  889. type: "success"
  890. });
  891. } else {
  892. this.$message({
  893. message: res.msg,
  894. type: "error"
  895. });
  896. }
  897. },
  898. error => {
  899. this.$message({
  900. message: error,
  901. type: "error"
  902. });
  903. });
  904. },
  905. //创建单据
  906. add() {
  907. // happenDate
  908. this.addForm.items = JSON.stringify(this.invoiceList)//这里要传发票列表的json转string
  909. this.addForm.totalAmount = this.totalCost
  910. this.http.post('/expense-sheet/add', this.addForm,
  911. res => {
  912. if (res.code == "ok") {
  913. this.$message({
  914. message: '填报成功',
  915. type: "success"
  916. });
  917. } else {
  918. this.$message({
  919. message: res.msg,
  920. type: "error"
  921. });
  922. }
  923. },
  924. error => {
  925. this.$message({
  926. message: error,
  927. type: "error"
  928. });
  929. });
  930. },
  931. //获取单据编码
  932. getNextCode() {
  933. this.http.post('/expense-sheet/getNextCode', {
  934. },
  935. res => {
  936. if (res.code == "ok") {
  937. this.addForm.code = res.data;
  938. } else {
  939. this.$message({
  940. message: res.msg,
  941. type: "error"
  942. });
  943. }
  944. },
  945. error => {
  946. this.$message({
  947. message: error,
  948. type: "error"
  949. });
  950. });
  951. },
  952. // 获取查看单据的数据
  953. getParticulars(id) {
  954. this.http.post('/expense-sheet/getDetail', {id: id},
  955. res => {
  956. if (res.code == "ok") {this
  957. // this.ParticularsList = res.data
  958. var s = []
  959. // var b = []
  960. for(var i in res.data.invoiceList) {
  961. if(res.data.invoiceList[i].pic) {
  962. var b = []
  963. var j = {}
  964. var img = this.diz + '/upload/' + res.data.invoiceList[i].pic
  965. j.url = img
  966. j.title = '报销凭证',
  967. j.name = res.data.invoiceList[i].pic
  968. b.push(j)
  969. res.data.invoiceList[i].pic = b
  970. // console.log(res.data.invoiceList[i].pic)
  971. }
  972. }
  973. this.ParticularsList = res.data
  974. for(var i = 0; i <= this.ParticularsList.invoiceList.length - 1; i++) {
  975. s.push(this.ParticularsList.invoiceList[i].projectId)
  976. }
  977. this.projectIdName = this.projectList.filter( item => {return s.indexOf(item.id) !== -1})
  978. // this.projectIdName = this.projectList.filter(p => p.id == this.ParticularsList.invoiceList[0].projectId)[0].projectName
  979. // console.log(res.data, '查看当前状态');
  980. // console.log(this.ParticularsList)
  981. } else {
  982. this.$message({
  983. message: res.msg,
  984. type: "error"
  985. });
  986. }
  987. },
  988. error => {
  989. this.$message({
  990. message: error,
  991. type: "error"
  992. });
  993. })
  994. },
  995. //分页
  996. handleCurrentChange(val) {
  997. this.page = val;
  998. this.getList();
  999. },
  1000. handleSizeChange(val) {
  1001. this.size = val;
  1002. this.getList();
  1003. },
  1004. deleteItem(item) {
  1005. this.$confirm("确认要删除吗?", "提示", {
  1006. //type: 'warning'
  1007. }).then(() => {
  1008. this.http.post('/expense-sheet/delete', {id:item.id},
  1009. res => {
  1010. if (res.code == "ok") {
  1011. this.getList();
  1012. } else {
  1013. this.$message({
  1014. message: res.msg,
  1015. type: "error"
  1016. });
  1017. }
  1018. },
  1019. error => {
  1020. this.$message({
  1021. message: error,
  1022. type: "error"
  1023. });
  1024. });
  1025. });
  1026. },
  1027. // 点击删除
  1028. chanc(k) {
  1029. this.invoiceList.splice(k, 1)
  1030. },
  1031. // 双击
  1032. dbclick(row, event, column){
  1033. this.isOK = true
  1034. },
  1035. oosk(s){
  1036. this.isOK = false
  1037. },
  1038. ssl(index) {
  1039. this.z = index
  1040. this.addForm.type = index
  1041. this.ins = index;
  1042. this.expenseTypeList = this.allExpList.filter(a=>a.mainType == this.ins);
  1043. this.addForm.ownerId = this.user.id;
  1044. this.getNextCode();
  1045. },
  1046. // 点击侧边栏事件
  1047. side() {
  1048. if(this.$refs.side.style.left < '0px') {
  1049. this.$refs.sidebars.style.width = '1px'
  1050. this.$refs.sid.style.left = '1px'
  1051. this.$refs.side.style.left = '1px'
  1052. this.$refs.sideI.className = 'el-icon-arrow-right'
  1053. this.$refs.staff.style.margin = '20px 20px 0 20px'
  1054. this.$refs.staff.style.width = '95%'
  1055. this.$refs.xiaomian.style.width = '100%'
  1056. this.$refs.headHe.style.paddingLeft = '20px'
  1057. } else {
  1058. this.$refs.sidebars.style.width = '200px'
  1059. this.$refs.sid.style.left = '200px'
  1060. this.$refs.side.style.left = '-19px'
  1061. this.$refs.sideI.className = 'el-icon-arrow-left'
  1062. this.$refs.staff.style.margin = '20px 20px 0 220px'
  1063. this.$refs.staff.style.width = '81%'
  1064. this.$refs.xiaomian.style.width = '85%'
  1065. this.$refs.headHe.style.paddingLeft = '220px'
  1066. }
  1067. },
  1068. // 费用金额失去焦点时触发
  1069. shiqu(){
  1070. this.addForm.totalAmount = this.invoiceList.reduce((prev, next) => {
  1071. return prev + parseFloat(next.amount);
  1072. }, 0)
  1073. },
  1074. kan(){
  1075. this.ParticularsList.totalAmount = this.ParticularsList.invoiceList.reduce((prev, next) => {
  1076. return prev + parseFloat(next.amount)
  1077. }, 0)
  1078. },
  1079. zhi(e) {
  1080. // console.log('看看值', e)
  1081. var i = e
  1082. if(this.invoiceList[i].amount == null || this.invoiceList[i].amount == 'null' || this.invoiceList[i].taxPercent == null || this.invoiceList[i].taxPercent == 'null') {
  1083. return
  1084. }
  1085. this.invoiceList[i].taxValue = this.invoiceList[i].amount * this.invoiceList[i].taxPercent / 100
  1086. // console.log(this.invoiceList[i].amount, this.invoiceList[i].taxPercent)
  1087. var shui = this.invoiceList[i].taxPercent / 100 // 税率
  1088. var zhi = this.invoiceList[i].amount / (1 + shui) * shui
  1089. this.invoiceList[i].taxValue = zhi.toFixed(2)
  1090. },
  1091. zhiNum(i, val) {
  1092. // console.log('看看值', i, val)
  1093. // console.log(this.ParticularsList.invoiceList)
  1094. 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') {
  1095. return
  1096. }
  1097. var shui = this.ParticularsList.invoiceList[i].taxPercent / 100
  1098. var zhi = this.ParticularsList.invoiceList[i].amount / (1 + shui) * shui
  1099. this.ParticularsList.invoiceList[i].taxValue = zhi.toFixed(2)
  1100. },
  1101. zhis(e) {
  1102. var i = e
  1103. this.invoiceList[i].taxValue = this.invoiceList[i].taxValue.toFixed(2)
  1104. },
  1105. fileonLoad(item) {
  1106. //首先判断文件类型
  1107. let str = item.file.name.split(".");
  1108. let format = str[str.length - 1];
  1109. if (format != "jpg" && format != "png") {
  1110. this.$message({
  1111. message: "请选择图片",
  1112. type: "error"
  1113. });
  1114. } else {
  1115. this.listLoading = true;
  1116. let formData = new FormData();
  1117. formData.append("multipartFile", item.file);
  1118. this.http.uploadFile('/common/uploadFile', formData,
  1119. res => {
  1120. this.listLoading = false;
  1121. if (res.code == "ok") {
  1122. this.$message({
  1123. message: "上传成功",
  1124. type: "success"
  1125. });
  1126. // this.getList();
  1127. this.invoiceList[this.apl].pic = res.data
  1128. // console.log(this.invoiceList)
  1129. } else {
  1130. this.$message({
  1131. message: res.msg,
  1132. type: "error"
  1133. });
  1134. }
  1135. },
  1136. error => {
  1137. this.listLoading = false;
  1138. this.$message({
  1139. message: error,
  1140. type: "error"
  1141. });
  1142. });
  1143. }
  1144. },
  1145. abl(e) {
  1146. this.apl = e
  1147. },
  1148. beforeRemove(file, fileList) {
  1149. var that = this
  1150. setTimeout(function () {
  1151. that.invoiceList[that.apl].pic = null
  1152. }, 200)
  1153. },
  1154. fileonLoads(item) {
  1155. //首先判断文件类型
  1156. let str = item.file.name.split(".");
  1157. let format = str[str.length - 1];
  1158. if (format != "jpg" && format != "png") {
  1159. this.$message({
  1160. message: "请选择图片",
  1161. type: "error"
  1162. });
  1163. } else {
  1164. this.listLoading = true;
  1165. let formData = new FormData();
  1166. formData.append("multipartFile", item.file);
  1167. this.http.uploadFile('/common/uploadFile', formData,
  1168. res => {
  1169. this.listLoading = false;
  1170. if (res.code == "ok") {
  1171. this.$message({
  1172. message: "上传成功",
  1173. type: "success"
  1174. });
  1175. // this.getList();
  1176. this.ParticularsList.invoiceList[this.apl].pic = res.data
  1177. // console.log(this.invoiceList)
  1178. } else {
  1179. this.$message({
  1180. message: res.msg,
  1181. type: "error"
  1182. });
  1183. }
  1184. },
  1185. error => {
  1186. this.listLoading = false;
  1187. this.$message({
  1188. message: error,
  1189. type: "error"
  1190. });
  1191. });
  1192. }
  1193. },
  1194. beforeRemoves(file, fileList) {
  1195. var that = this
  1196. setTimeout(function () {
  1197. // this.ParticularsList.invoiceList
  1198. that.ParticularsList.invoiceList[that.apl].pic = null
  1199. }, 200)
  1200. },
  1201. imgUrl(img) {
  1202. // var imgss = this.diz + '/upload/' + img
  1203. // var sp = []
  1204. // var is = {}
  1205. // is.url = imgss
  1206. // is.title = 1
  1207. // sp.push(is)
  1208. // this.imgs = sp
  1209. // console.log(imgss)
  1210. // console.log(this.$refs.imgsa)
  1211. // this.$refs.imgsa.click()
  1212. // console.log(location.protocol, location.host)
  1213. // console.log(location.protocol + '//' + location.host + imgs)
  1214. },
  1215. // 合计
  1216. getSummaries(param) {
  1217. const { columns, data } = param;
  1218. const sums = [];
  1219. columns.forEach((column, index) => {
  1220. if (index === 0) {
  1221. sums[index] = '合计';
  1222. return;
  1223. }
  1224. if(index === 1) {
  1225. const values = data.map(item => Number(item[column.property]));
  1226. if (!values.every(value => isNaN(value))) {
  1227. sums[index] = values.reduce((prev, curr) => {
  1228. const value = Number(curr);
  1229. if (!isNaN(value)) {
  1230. return prev + curr;
  1231. } else {
  1232. return prev;
  1233. }
  1234. }, 0);
  1235. var zhi = +sums[index] + 0
  1236. var sl = zhi.toFixed(2)
  1237. sl += ' 元';
  1238. } else {
  1239. sums[index] = 'N/A';
  1240. }
  1241. } else {
  1242. sums[index] = 'N/A';
  1243. }
  1244. });
  1245. // console.log(sums, 123)
  1246. this.$nextTick(()=>{ this.$refs.tab.doLayout()})
  1247. return sums;
  1248. }
  1249. },
  1250. };
  1251. </script>
  1252. <style scoped>
  1253. .tups {
  1254. width: 100%;
  1255. height: 25px;
  1256. position: relative;
  1257. z-index: 99;
  1258. overflow: hidden;
  1259. }
  1260. .tups img {
  1261. height: 25px !important;
  1262. position: relative;
  1263. z-index: 99;
  1264. }
  1265. .viewer-canvas {
  1266. position: absolute;
  1267. z-index: 9 !important;
  1268. }
  1269. .icl {
  1270. margin-top: -25px !important;
  1271. }
  1272. /* 费用报销标题 */
  1273. .headine {
  1274. width: 100%;
  1275. height: 46.4px;
  1276. line-height: 46.4px;
  1277. background: #fff;
  1278. box-sizing: border-box;
  1279. }
  1280. .headine h3 {
  1281. margin: 0;
  1282. display: inline-block;
  1283. box-sizing: border-box;
  1284. color: #999;
  1285. }
  1286. .headine p {
  1287. display: inline-block;
  1288. margin: 0;
  1289. }
  1290. /* /费用报销标题 */
  1291. .sidebars {
  1292. height: 100%;
  1293. position: absolute;
  1294. border-right: 1px solid #E6E6E6;
  1295. z-index: 2;
  1296. top: 0;
  1297. }
  1298. .sidebars h3 {
  1299. margin: 0;
  1300. line-height: 45px;
  1301. background: #ffffff;
  1302. font-weight: normal;
  1303. color: #666;
  1304. padding-left: 20px;
  1305. }
  1306. .sidebars .el-col-12 {
  1307. width: 100%
  1308. }
  1309. .public {
  1310. height: 180px;
  1311. border-bottom: 1px solid #ddd;
  1312. }
  1313. .public .el-form-item {
  1314. display: inline-block;
  1315. }
  1316. .pu_button {
  1317. text-align: right;
  1318. width: 100%;
  1319. padding: 24px 30px;
  1320. box-sizing: border-box;
  1321. }
  1322. .pu_bu_x .pu_bu_t {
  1323. display: inline-block;
  1324. }
  1325. .pu_bu_x {
  1326. margin-right: 20px;
  1327. color: #20A0F7;
  1328. cursor: pointer;
  1329. }
  1330. .pu_bu_t {
  1331. color: #20A0F7;
  1332. cursor: pointer;
  1333. display: block;
  1334. float: right;
  1335. position:
  1336. relative;
  1337. top: -20px;
  1338. right: 63px;
  1339. }
  1340. .pu_table {
  1341. margin-left: 10px;
  1342. }
  1343. .pu_bu_t:hover {
  1344. color: #7bbcff;
  1345. }
  1346. .pu_bu_x:hover {
  1347. color: #7bbcff;
  1348. }
  1349. /* 我的单据报销凭证 */
  1350. .staff{
  1351. border-left: 1px solid #fff;
  1352. border-top: 1px solid #fff;
  1353. border-right: 1px solid #fff;
  1354. background: #fff;
  1355. }
  1356. /* */
  1357. .sdat{
  1358. display: inline-block;
  1359. width: 260px;
  1360. margin-left: 13px;
  1361. }
  1362. .messages .el-form-item{
  1363. display: inline-block;
  1364. }
  1365. .messages .el-date-editor.el-input, .el-date-editor.el-input__inner{
  1366. width: 190px;
  1367. }
  1368. /* 我的报销凭证 */
  1369. .search {
  1370. position: relative;
  1371. top: 20px;
  1372. left: 20px;
  1373. }
  1374. .tables {
  1375. margin-top: 50px;
  1376. box-sizing: border-box;
  1377. padding: 10px;
  1378. }
  1379. .informant .el-form-item {
  1380. display: inline-block;
  1381. }
  1382. /* 侧边栏收索 */
  1383. .side {
  1384. position: absolute;
  1385. z-index: 2;
  1386. border-right: 2px solid #DDDDDD;
  1387. height: 100%;
  1388. top: 0;
  1389. width: 0;
  1390. }
  1391. .side .spans {
  1392. width: 20px;
  1393. height: 30px;
  1394. border: 1px solid #DDDDDD;
  1395. box-sizing: border-box;
  1396. position: absolute;
  1397. top: 50%;
  1398. margin-top: -50%;
  1399. text-align: center;
  1400. z-index: 1;
  1401. background: #fff;
  1402. }
  1403. .side .spans i{
  1404. margin-top: 7px;
  1405. color: #C0BFBF
  1406. }
  1407. .side:hover {
  1408. border-right: 2px solid #20A0FF;
  1409. }
  1410. .side:hover .spans {
  1411. border: 1px solid #20A0FF;
  1412. background: #20A0FF;
  1413. }
  1414. .side:hover .spans i{
  1415. color: #fff;
  1416. }
  1417. /* 右边整体页面 */
  1418. .contents {
  1419. height: 100%;
  1420. /* padding: 30px; */
  1421. background: #F7F7F7;
  1422. /* position: absolute; */
  1423. }
  1424. .submits {
  1425. margin-left: 50%;
  1426. }
  1427. .waiting {
  1428. color:orange;
  1429. }
  1430. .rejected {
  1431. color:red;
  1432. }
  1433. </style>