expense.vue 63 KB

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