finance.vue 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <!-- <el-form-item label="财务核算成本 | 月份选择" style="margin-top:5px;"> -->
  7. <el-form-item :label="this.$t('Selectmonth')" >
  8. <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonth" :clearable="false" type="month" :placeholder="$t('Selectmonth')" style="margin-right: 20px"></el-date-picker>
  9. <el-link type="primary" :underline="false" @click="audits()" v-if="user.timeType.financeAudit == '1'">{{revaelse}}</el-link>
  10. </el-form-item>
  11. <!-- <el-radio-group v-model="radio" @change="switchList" style="margin-left:160px;margin-top:5px;"> -->
  12. <el-radio-group size="small" v-model="radio" @change="switchList" style="margin-left:150px;margin-top:5px;">
  13. <el-radio-button :label="$t('lable.allStaff')" >{{$t('lable.allStaff')}}({{allFinanceList.length}})</el-radio-button>
  14. <el-radio-button :label="$t('projectworker')">{{$t('projectworker')}}({{noReportUserList.length}})</el-radio-button>
  15. </el-radio-group>
  16. <el-form-item v-if="permissions.financialProportion" style="margin-left:5px;">
  17. <el-link type="primary" :underline="false" @click="showSettingDialog()" >{{ $t('Apportionmentratesetting') }}</el-link>
  18. </el-form-item>
  19. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  20. <el-link type="primary" :underline="false" @click="getTemplate()" >{{ $t('Downloadthetemplate') }}</el-link>
  21. </el-form-item>
  22. <!-- <el-form-item style="float:right;">
  23. <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false">
  24. <el-link type="primary" :underline="false" >财务数据上传</el-link>
  25. </el-upload>
  26. </el-form-item> -->
  27. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  28. <el-link type="primary" :underline="false" @click="importDialog = true;isUploading=false;">{{ $t('Dataupload') }}</el-link>
  29. </el-form-item>
  30. <el-form-item style="float:right;" v-if="permissions.financialExport">
  31. <el-link type="primary" :underline="false" @click="exportDialog = true;exportMonth = date;">{{ $t('Exportdata') }}</el-link>
  32. </el-form-item>
  33. <el-form-item style="float:right;" v-if="permissions.financialCustom">
  34. <el-link type="primary" :underline="false" @click="showItemDialog()">{{ $t('Customizesalaryitems') }}</el-link>
  35. </el-form-item>
  36. <el-form-item style="float:right;" v-if="user.timeType.financeAudit == '1' && permissions.setFinanceAuditor">
  37. <el-link type="primary" :underline="false" @click="reviewerVisible = true">{{ $t('Setupauditor') }}</el-link>
  38. </el-form-item>
  39. </el-form>
  40. </el-col>
  41. <!-- 上传记录 -->
  42. <el-dialog :title="$t('Salaryuploadrecord')" :visible.sync="xzImportVisible" width="1100px" :before-close="handleClose">
  43. <div>
  44. <el-table :data="xzList" style="width: 100%" :height="400">
  45. <el-table-column prop="userName" :label="$t('other.operator')">
  46. <template slot-scope="scope">
  47. <div>
  48. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data></span>
  49. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.userName}}</span>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="ymonth" :label="$t('BelongsIn')"></el-table-column>
  54. <el-table-column prop="fileName" :label="$t('filename')">
  55. <template slot-scope="scope">
  56. <div>
  57. <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  62. <template slot-scope="scope">
  63. <div>
  64. {{scope.row.recoverReport == 1? $t('state.yes') : $t('state.no')}}
  65. </div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')" width="150">
  69. <template slot-scope="scope">
  70. <div>
  71. {{scope.row.recoverMonthcost == 1? $t('state.yes') : $t('state.no')}}
  72. </div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="indate" :label="$t('Uploadtime')"></el-table-column>
  76. <!-- <el-table-column prop="date" label="操作" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id || user.role == 1 || user.role == 2)">
  77. <template slot-scope="scope">
  78. <div>
  79. <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">通过</el-button>
  80. <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">驳回</el-button>
  81. <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">撤销</el-button>
  82. </div>
  83. </template>
  84. </el-table-column> -->
  85. </el-table>
  86. </div>
  87. </el-dialog>
  88. <!-- 财务报表审核 -->
  89. <el-dialog :title="shenhe" :visible.sync="importVisible" width="1100px" :before-close="handleClose">
  90. <div>
  91. <el-radio-group v-model="tabPosition" style="margin-bottom: 20px;" @change="operationalData()">
  92. <el-radio-button label="1">{{ $t('state.alreadyPassed') }}</el-radio-button>
  93. <el-radio-button label="0">{{ $t('state.WaitingAudit') }}</el-radio-button>
  94. <el-radio-button label="2">{{ $t('state.rejected') }}</el-radio-button>
  95. <el-radio-button label="-1">{{ $t('state.undone') }}</el-radio-button>
  96. </el-radio-group>
  97. <el-table :data="reviewLis" style="width: 100%" :height="400">
  98. <el-table-column prop="userName" :label="$t('other.operator')">
  99. <template slot-scope="scope">
  100. <div>
  101. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data></span>
  102. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.userName}}</span>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="ymonth" :label="$t('BelongsIn')"></el-table-column>
  107. <el-table-column prop="fileName" :label="$t('filename')">
  108. <template slot-scope="scope">
  109. <div>
  110. <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  115. <template slot-scope="scope">
  116. <div>
  117. {{scope.row.recoverReport == 1? $t('state.yes') : $t('state.no')}}
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')" width="150">
  122. <template slot-scope="scope">
  123. <div>
  124. {{scope.row.recoverMonthcost == 1? $t('state.yes') : $t('state.no')}}
  125. </div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column prop="indate" :label="$t('Uploadtime')"></el-table-column>
  129. <el-table-column prop="date" :label="$t('operation')" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id)">
  130. <template slot-scope="scope">
  131. <div>
  132. <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">{{ $t('btn.through') }}</el-button>
  133. <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">{{ $t('btn.rejected') }}</el-button>
  134. <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">{{ $t('btn.undo') }}</el-button>
  135. </div>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. </el-dialog>
  141. <!-- 设置审核人弹窗 -->
  142. <el-dialog :title="$t('Setupauditor')" :visible.sync="reviewerVisible" width="350px" :before-close="handleCloses">
  143. <el-form :model="reviewerRuleForm" ref="reviewerRuleForm" label-width="100px" class="demo-ruleForm">
  144. <el-form-item :label="$t('SelectionofAuditor')" prop="auditorId" :rules="{required: true, message: $t('reviewercannotbeempty'), trigger: 'blur'}">
  145. <el-select v-model="reviewerRuleForm.auditorId" clearable :placeholder="$t('SelectionofAuditor')" v-if="user.userNameNeedTranslate != '1'" >
  146. <el-option v-for="(item, index) in people" :key="index" :label="item.name" :value="item.id"></el-option>
  147. </el-select>
  148. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="people" :subjectId="reviewerRuleForm.auditorId" :distinction="'1'" :size="'mini'"></selectCat>
  149. </el-form-item>
  150. <el-form-item>
  151. <el-button type="primary" @click="submitreviewerRuleForm('reviewerRuleForm')">{{ $t('btn.submit') }}</el-button>
  152. </el-form-item>
  153. </el-form>
  154. </el-dialog>
  155. <el-dialog :title="$t('Exportoffinancialdata')" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="400px">
  156. <el-form ref="form3" >
  157. <el-form-item :label="$t('Intheexport')" >
  158. <!-- <div style="color:orange;">{{date}}</div> -->
  159. <el-date-picker v-model="exportMonth" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM" value-format="yyyy-MM" style="width:280px;"></el-date-picker>
  160. </el-form-item>
  161. </el-form>
  162. <div slot="footer" class="dialog-footer">
  163. <el-button type="primary" style="width:100%;" :loading="isUploading" @click="exportFinance">{{ $t('export.export') }}</el-button>
  164. </div>
  165. </el-dialog>
  166. <!--列表-->
  167. <!-- 222 -->
  168. <el-table :data="list" highlight-current-row v-loading="listLoading"
  169. :show-summary='user.timeType.isSecretSalary==0?true:false'
  170. ref="table"
  171. :summary-method="getSummaries"
  172. @selection-change="deleteSel"
  173. :height="300" style="width: 100%;">
  174. <el-table-column type="selection" width="80" fixed="left"></el-table-column>
  175. <el-table-column prop="jobNumber" v-if="user.timeType.financeJobnumEnabled==1" :label="$t('Worknumber')" sortable width="100" fixed="left"></el-table-column>
  176. <el-table-column prop="name" :label="$t('lable.name')" sortable width="150" fixed="left">
  177. <template slot-scope="scope">
  178. <div>
  179. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.name'></ww-open-data></span>
  180. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.name}}</span>
  181. </div>
  182. </template>
  183. </el-table-column>
  184. <template v-if="user.timeType.isSecretSalary==0">
  185. <el-table-column :prop="headerCols[index]" :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="right">
  186. <template slot-scope="scope">
  187. <div style="padding-right:5px;">{{scope.row[headerCols[index]]==null?'0.00':scope.row[headerCols[index]].toFixed(2)}}</div>
  188. </template>
  189. </el-table-column>
  190. </template>
  191. <template v-if="user.timeType.isSecretSalary==1">
  192. <el-table-column :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="center">
  193. <template slot-scope="scope" >
  194. * <span v-if="scope.row"></span>
  195. </template>
  196. </el-table-column>
  197. </template>
  198. <el-table-column prop="totalCost" width="150" align="right" :label="$t('totalcost')" fixed="right">
  199. <template slot-scope="scope" >
  200. <div style="padding-right:5px;">{{user.timeType.isSecretSalary==0?scope.row.totalCost:'*'}}</div>
  201. </template>
  202. </el-table-column>
  203. </el-table>
  204. <div style="padding:5px 0 0 10px" v-if="permissions.financialUpload">
  205. <el-button @click="deleteUsers" size="mini" type="primary" :disabled="deleteSelList.length == 0">{{ $t('Batchdelete') }}</el-button>
  206. </div>
  207. <el-form :inline="true" >
  208. <el-form-item >
  209. <!-- <el-checkbox style="margin-left:10px;" v-model="assignNoProUser" @click="assignToProject">均摊无项目人员成本</el-checkbox> -->
  210. <!-- <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=false;assignToProject();" style="margin-left:10px;">分摊已填工时人员成本</el-button>
  211. <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=true;assignToProject();" style="margin-left:10px;">分摊全部人员成本</el-button> -->
  212. <el-radio-group size="small" v-model="costListRadio" @change="switchCostList" style="margin-left:5px;margin-top:5px;">
  213. <el-radio-button label="1" >{{ $t('Apportionmentofpersonnelcosts') }}</el-radio-button>
  214. <el-radio-button label="2">{{ $t('Spreadallpersonnelcosts') }}</el-radio-button>
  215. </el-radio-group>
  216. </el-form-item>
  217. <el-form-item style="float:right;margin-right:20px;" v-if="permissions.financialShare">
  218. <el-link type="primary" :underline="false" @click="exportFinanceDialog=true">{{ $t('ExportingtheAllocationData') }}</el-link>
  219. </el-form-item>
  220. <!-- <el-form-item style="float:right;margin-right:30px;" v-if="hasNoProjectUsers">
  221. <el-link type="primary" :underline="false" @click="showNoProjectUsers">查看无项目数据</el-link>
  222. </el-form-item> -->
  223. </el-form>
  224. <!-- 图表 -->
  225. <!-- <div id="container" :style="'height:300px;width:'+ widthHtval+'px;'"></div> -->
  226. <div id="clearfix" :style="'overflow-x: auto;width:100%;padding-bottom: 100px; position: relative; height:300px;'">
  227. <div id="container" :style="'height: 300px;width:100%;'"></div>
  228. </div>
  229. <!--新增界面-->
  230. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="600px">
  231. <el-form ref="form1" :model="addForm" :rules="rules" label-width="100px">
  232. <el-form-item :label="$t('Itemno')" >
  233. <el-input v-model="addForm.code" :placeholder="$t('Pleaseentertheprojectnumber')" clearable></el-input>
  234. </el-form-item>
  235. <el-form-item :label="$t('headerTop.projectName')" prop="name">
  236. <el-input v-model="addForm.name" :placeholder="$t('Pleaseenteraprojectname')" clearable></el-input>
  237. </el-form-item>
  238. <el-form-item :label="$t('Allparticipants')">
  239. <el-select v-model="addForm.userId" multiple filterable :placeholder="$t('Pleaseselectparticipants')" style="width:100%;" @change="changeParticipator">
  240. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  241. </el-select>
  242. </el-form-item>
  243. <el-form-item :label="$t('Principalpersoninharge')" >
  244. <el-select v-model="addForm.inchargerId" :disabled="addForm.userId.length==0" filterable :placeholder="$t('Pleaseselectthepersonincharge')" style="width:100%;" @change="changeIncharger">
  245. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  246. </el-select>
  247. </el-form-item>
  248. </el-form>
  249. <div slot="footer" class="dialog-footer">
  250. <el-button @click.native="addFormVisible = false">{{ $t('btn.cancel') }}</el-button>
  251. <el-button type="primary" @click="submitInsert" :loading="addLoading">{{ $t('btn.submit') }}</el-button>
  252. </div>
  253. </el-dialog>
  254. <!--用户详细信息弹出框-->
  255. <el-dialog :title="$t('Checkthedetails')" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  256. <div class="line"><span>{{ $t('lable.name') }}</span>
  257. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='userDetail.name'></ww-open-data></span>
  258. <span v-if="user.userNameNeedTranslate != '1'">{{userDetail.name}}</span>
  259. </div>
  260. <div class="line"><span>{{ $t('Worknumber') }}</span><span>{{userDetail.jobNumber}}</span></div>
  261. <div class="line"><span>{{ $t('lable.phone') }}</span><span>{{userDetail.phone}}</span></div>
  262. <div class="line"><span>{{ $t('lable.department') }}</span>
  263. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='departmentName' :openid='userDetail.departmentName'></ww-open-data></span>
  264. <span v-if="user.userNameNeedTranslate != '1'">{{userDetail.departmentName}}</span>
  265. </div>
  266. <div class="line"><span>{{ $t('costof') }}</span><span>{{userDetail.cost}}{{$t('Yuananhour')}}</span></div>
  267. <div slot="footer" class="dialog-footer">
  268. <el-button type="primary" @click="userDetailVisible = false" >{{ $t('btn.determine') }}</el-button>
  269. </div>
  270. </el-dialog>
  271. <!--导入时的设置界面 -->
  272. <el-dialog :title="$t('Financialdataimport')" v-if="importDialog" :visible.sync="importDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  273. <el-form ref="form3" :model="importParam" >
  274. <el-form-item :label="$t('Itheimport')" >
  275. <!-- <div style="color:orange;">{{date}}</div> -->
  276. <el-date-picker v-model="date" type="month" placeholder="$t('Selectmonth')" format="yyyy-MM" value-format="yyyy-MM"></el-date-picker>
  277. </el-form-item>
  278. <el-form-item prop="syncHistoryReport" >
  279. <el-checkbox :label="$t('Recalculatereportedcostsforthemonth')" v-model="importParam.syncHistoryReport"></el-checkbox>
  280. </el-form-item>
  281. <el-form-item prop="syncUserCost" >
  282. <el-checkbox :label="$t('Synchronizeemployeemonthlycosttorganizationalstructure')" v-model="importParam.syncUserCost" ></el-checkbox>
  283. </el-form-item>
  284. </el-form>
  285. <div slot="footer" class="dialog-footer">
  286. <el-link v-if="user.timeType.financeAudit == '0'"
  287. style="float:left;"
  288. type="primary" :underline="false" @click="xzjl(),xzImportVisible = true">{{ $t('Viewtheimporthistory') }}</el-link>
  289. <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false" >
  290. <el-button type="primary" style="width:100%;" :loading="isUploading" >{{ $t('Selectthefilendstartimporting') }}</el-button>
  291. </el-upload>
  292. </div>
  293. </el-dialog>
  294. <!--无项目人员列表-->
  295. <!-- <el-dialog title="无项目人员列表" v-if="showNPDialog" :visible.sync="showNPDialog" :close-on-click-modal="false" customClass="customWidth" width="1200px">
  296. <el-table :data="npUserList" highlight-current-row v-loading="listLoading"
  297. show-summary=true
  298. ref="table"
  299. :height="400" style="width: 100%;">
  300. <el-table-column prop="name" label="姓名" sortable width="150"></el-table-column>
  301. <el-table-column prop="monthCost" label="工资" width="150"></el-table-column>
  302. <el-table-column prop="bonus" label="奖金" ></el-table-column>
  303. <el-table-column prop="allowance" label="津贴" ></el-table-column>
  304. <el-table-column prop="insuranceOld" label="养老保险" ></el-table-column>
  305. <el-table-column prop="insuranceMedical" label="医疗保险" ></el-table-column>
  306. <el-table-column prop="insuranceLosejob" label="失业保险" ></el-table-column>
  307. <el-table-column prop="insuranceInjury" label="工伤保险" ></el-table-column>
  308. <el-table-column prop="houseFund" label="住房公积金" ></el-table-column>
  309. <el-table-column prop="others" label="其他" ></el-table-column>
  310. <el-table-column :label="item.fieldName" v-for="(item, index) in customCols" :key="item.id" :prop="index==0?'customField1':(index==1?'customField2':(index==2?'customField3':''))">
  311. <template slot-scope="scope">
  312. {{index==0?scope.row.customField1:(index==1?scope.row.customField2:(index==2?scope.row.customField3:''))}}
  313. </template>
  314. </el-table-column>
  315. <el-table-column prop="totalCost" label="总成本" ></el-table-column>
  316. </el-table>
  317. <div slot="footer" class="dialog-footer">
  318. <div style="float:left;color:#ff9900;">*以上人员当月尚无投入的项目,请提醒他们填写日报。</div>
  319. <el-button type="primary" @click="showNPDialog = false" >关闭</el-button>
  320. </div>
  321. </el-dialog> -->
  322. <el-dialog :title="$t('Customizesalaryitems')" show-header="false" v-if="itemDialog" :visible.sync="itemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" top="20px">
  323. <div style="margin-left:30px;">
  324. <!-- 111 -->
  325. <p><el-input size="medium" v-model.trim="customCols.monthCost" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  326. <template v-if="customCols.monthCost != null && customCols.monthCost != ''">
  327. {{ $t('Addttotalcost') }}
  328. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  329. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  330. </template>
  331. </p>
  332. <p><el-input size="medium" v-model.trim="customCols.bonus" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  333. <template v-if="customCols.bonus != null && customCols.bonus != ''">
  334. {{ $t('Addttotalcost') }}
  335. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  336. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  337. </template>
  338. </p>
  339. <p><el-input size="medium" v-model.trim="customCols.allowance" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  340. <template v-if="customCols.allowance != null && customCols.allowance != ''">
  341. {{ $t('Addttotalcost') }}
  342. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  343. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  344. </template>
  345. </p>
  346. <p><el-input size="medium" v-model.trim="customCols.insuranceOld" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  347. <template v-if="customCols.insuranceOld != null && customCols.insuranceOld != ''">
  348. {{ $t('Addttotalcost') }}
  349. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  350. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  351. </template>
  352. </p>
  353. <p><el-input size="medium" v-model.trim="customCols.insuranceMedical" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  354. <template v-if="customCols.insuranceMedical != null && customCols.insuranceMedical != ''">
  355. {{ $t('Addttotalcost') }}
  356. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  357. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  358. </template>
  359. </p>
  360. <p><el-input size="medium" v-model.trim="customCols.insuranceLosejob" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  361. <template v-if="customCols.insuranceLosejob != null && customCols.insuranceLosejob != ''">
  362. {{ $t('Addttotalcost') }}
  363. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  364. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  365. </template>
  366. </p>
  367. <p><el-input size="medium" v-model.trim="customCols.insuranceInjury" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  368. <template v-if="customCols.insuranceInjury != null && customCols.insuranceInjury != ''">
  369. {{ $t('Addttotalcost') }}
  370. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  371. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  372. </template>
  373. </p>
  374. <p><el-input size="medium" v-model.trim="customCols.houseFund" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  375. <template v-if="customCols.houseFund != null && customCols.houseFund != ''">
  376. {{ $t('Addttotalcost') }}
  377. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  378. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  379. </template>
  380. </p>
  381. <p><el-input size="medium" v-model.trim="customCols.field1" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem1')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  382. <template v-if="customCols.field1 != null && customCols.field1 != ''">
  383. {{ $t('Addttotalcost') }}
  384. <el-radio size="medium" v-model="customCols.field1Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  385. <el-radio size="medium" v-model="customCols.field1Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  386. </template>
  387. </p>
  388. <p><el-input size="medium" v-model.trim="customCols.field2" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem2')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  389. <template v-if="customCols.field2 != null && customCols.field2 != ''">
  390. {{ $t('Addttotalcost') }}
  391. <el-radio size="medium" v-model="customCols.field2Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  392. <el-radio size="medium" v-model="customCols.field2Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  393. </template>
  394. </p>
  395. <p><el-input size="medium" v-model.trim="customCols.field3" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem3')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  396. <template v-if="customCols.field3 != null && customCols.field3 != ''">
  397. {{ $t('Addttotalcost') }}
  398. <el-radio size="medium" v-model="customCols.field3Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  399. <el-radio size="medium" v-model="customCols.field3Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  400. </template>
  401. </p>
  402. </div>
  403. <div slot="footer" class="dialog-footer">
  404. <el-button type="primary" @click="itemDialog = false" >{{ $t('Shutdown') }}</el-button>
  405. <el-button type="primary" @click="saveItems()" >{{ $t('save') }}</el-button>
  406. </div>
  407. </el-dialog>
  408. <el-dialog :title="date+$t('weekDay.month')+' ' + $t('Noallocationratioofprojectworkinghoursisset')" show-header="false" v-if="settingDialog" :visible.sync="settingDialog"
  409. :close-on-click-modal="false" customClass="customWidth" width="1200px">
  410. <div>
  411. <div>
  412. <el-button :disabled="multipleSelection.length==0" @click="setPercent(true, null)">{{ $t('BatchSettingProportion') }}</el-button>
  413. <el-button :disabled="projectCols.length==0 || userCostSettingList.length == 0" @click="getLastMonthSetting">{{ $t('UselastmonthscaleSettings') }}</el-button>
  414. <!-- <el-button @click="showSelectProjectDialog">{{date}} 月待分摊项目设置</el-button> -->
  415. <el-button @click="showSelectProjectDialog">{{date}}{{ $t('Monthlyprojecttobeapportioned') }}</el-button>
  416. <el-button @click="intoAmortizationRatio">{{ $t('Importallocationratio') }}</el-button>
  417. </div>
  418. <el-table :data="userCostSettingList" highlight-current-row v-loading="costSettingLoading"
  419. ref="settingTable" @selection-change="handleSelectionChange"
  420. :height="400" style="width: 100%;">
  421. <el-table-column type="selection" width="55"></el-table-column>
  422. <el-table-column prop="name" :label="$t('lable.name')" sortable width="90" fixed="left">
  423. <template slot-scope="scope">
  424. <div>
  425. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.name'></ww-open-data></span>
  426. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.name}}</span>
  427. </div>
  428. </template>
  429. </el-table-column>
  430. <el-table-column :label="item.projectName" v-for="(item) in projectCols" width="180" size="small"
  431. :key="item.id" align="center">
  432. <template slot-scope="scope">
  433. <span>{{scope.row[item.projectId]}}</span>%
  434. </template>
  435. </el-table-column>
  436. <el-table-column :label="$t('Settheproportion')" width="80" fixed="right">
  437. <template slot-scope="scope">
  438. <el-button size="small" @click="setPercent(false,scope.row)">{{ $t('setup') }}</el-button>
  439. </template>
  440. </el-table-column>
  441. </el-table>
  442. </div>
  443. <div slot="footer" class="dialog-footer">
  444. <el-button type="primary" @click="settingDialog = false" >{{ $t('Shutdown') }}</el-button>
  445. <el-button type="primary" @click="saveMonthSetting()" >{{ $t('save') }}</el-button>
  446. </div>
  447. </el-dialog>
  448. <el-dialog :title="date + $t('projectstobe assessed')" show-header="false" v-if="projectsDialog" :visible.sync="projectsDialog"
  449. :close-on-click-modal="false" customClass="customWidth" width="1000px">
  450. <el-select v-model="chosenProjects" multiple filterable clearable style="width:100%">
  451. <el-option v-for="item in allProjectList" :label="item.projectName" :key="item.id" :value="item.id"></el-option>
  452. </el-select>
  453. <el-checkbox v-model="chosenProjectsChecked" @change="chosenProjectsCheckedClick" style="margin: 20px 0;">{{chosenProjectsChecked ? $t('Deselectallitems') : $t('Selectallitems')}}</el-checkbox>
  454. <div slot="footer" class="dialog-footer">
  455. <el-button type="default" @click="projectsDialog = false" >{{ $t('Shutdown') }}</el-button>
  456. <el-button type="primary" @click="saveProjectSetting()" >{{ $t('btn.determine') }}</el-button>
  457. </div>
  458. </el-dialog>
  459. <el-dialog title="$t('allocationdata')" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog" customClass="customWidth" width="500px">
  460. <p>{{'1.' + $t('other.download')}}
  461. <el-link type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/'+$t('allocationImporttemplates')+'.xlsx'" :download="$t('allocationImporttemplates') + '.xlsx'">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
  462. </p>
  463. <p>{{'2.' + $t('other.projectsAndPeopleInThetemplate') }}</p>
  464. <p style="display: flex;justify-content: center;padding:1em 0">
  465. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  466. <el-button type="primary" :underline="false" :loading="importingData">{{ $t('other.startImporting') }}</el-button>
  467. </el-upload>
  468. </p>
  469. </el-dialog>
  470. <el-dialog :title="$t('eachitemofemployeecost')" show-header="false" v-if="setPercentDialog" :visible.sync="setPercentDialog"
  471. :close-on-click-modal="false" customClass="customWidth" width="600px" >
  472. <div style="margin:0px 10px 10px 10px;">
  473. <span>{{ $t('Selecttheemployee') }}</span>
  474. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="chosenNoReportUserIds" multiple filterable clearable style="width:330px;" collapse-tags>
  475. <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id" :value="item.userId"></el-option>
  476. </el-select>
  477. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList" :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'mini'"></selectCat>
  478. <el-button @click="averageCost" >{{ $t('Automaticallocation') }}</el-button>
  479. </div>
  480. <el-divider ></el-divider>
  481. <!--项目列表 -->
  482. <el-form v-model="curPercentVal" label-width="365px" style="margin-top:10px;">
  483. <div class="nameList">
  484. <el-form-item v-for="item in projectCols" :label="item.projectName" :key="item.projectId" >
  485. {{ $t('Accountedfor') + ':' }}<el-input v-model="curPercentVal[item.projectId]" style="width:100px;" @input="updatePercentValue"></el-input>&nbsp;%
  486. </el-form-item>
  487. </div>
  488. <el-form-item >
  489. {{ $t('totalpercentage') + ':' }}{{totalPercent}}&nbsp;%
  490. </el-form-item>
  491. </el-form>
  492. <div slot="footer" class="dialog-footer">
  493. <el-button type="default" @click="setPercentDialog = false" >{{ $t('Shutdown') }}</el-button>
  494. <el-button type="primary" @click="setPercentSetting()" >{{ $t('btn.determine') }}</el-button>
  495. </div>
  496. </el-dialog>
  497. <!-- 导入结果说明 -->
  498. <el-dialog :title="$t('importingtheallocationratio')" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
  499. <div>
  500. <span>{{importResultMsg}}</span>
  501. </div>
  502. <span slot="footer" class="dialog-footer">
  503. <el-button type="primary" @click="showImportResult=false">{{ $t('btn.determine') }}</el-button>
  504. </span>
  505. </el-dialog>
  506. <el-dialog :title="$t('AmortizedDataExport')" v-if="exportFinanceDialog" :visible.sync="exportFinanceDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  507. <div style="margin:30px;">
  508. <el-radio-group v-model="groupByCategory" >
  509. <el-radio :label="0">{{ $t('Exportbyproject') }}</el-radio>
  510. <el-radio :label="1">{{ $t('Exportbprojectcategory') }}</el-radio>
  511. </el-radio-group>
  512. </div>
  513. <div slot="footer" class="dialog-footer">
  514. <el-button @click="exportData" :loading="exportDataProcessing" type="primary">{{ $t('export.export') }}</el-button>
  515. </div>
  516. </el-dialog>
  517. </section>
  518. </template>
  519. <style scoped>
  520. .line {
  521. padding:10px;
  522. }
  523. .line span{
  524. font-size:18px;
  525. }
  526. .line span:nth-child(even){
  527. float:right;
  528. }
  529. </style>
  530. <style>
  531. .customWidth .el-dialog__body{
  532. padding-top: 0;
  533. padding-bottom: 0;
  534. }
  535. </style>
  536. <script>
  537. import { error } from 'dingtalk-jsapi';
  538. import util from "../../common/js/util";
  539. // 自定义select组件
  540. import selectCat from "@/components/select.vue"
  541. export default {
  542. components: {
  543. selectCat
  544. },
  545. data() {
  546. return {
  547. groupByCategory:0,
  548. exportFinanceDialog:false,
  549. exportMonth:null,
  550. exportDialog:false,
  551. headerCols:['monthCost','bonus', 'allowance', 'insuranceOld', 'insuranceMedical', 'insuranceLosejob', 'insuranceInjury', 'houseFund', 'customField1','customField2','customField3'],
  552. tblCols:[],
  553. costListRadio: 0,
  554. costSettingLoading: false,
  555. chosenNoReportUserIds:[],
  556. curPercentVal:{},
  557. setPercentDialog: false,
  558. chosenProjects:[],
  559. projectsDialog: false,
  560. projectCols:[],
  561. allProjectList:[],
  562. multipleSelection:[],
  563. userCostSettingList: [],
  564. settingDialog: false,
  565. radio:this.$t('lable.allStaff'),
  566. noReportUserList:[],
  567. allFinanceList:[],
  568. assignNoProUser: false,
  569. customFieldList:[],
  570. itemDialog: false,
  571. customCols:{},
  572. customColsi:{},
  573. // showNPDialog: false,
  574. npUserList:[],
  575. hasNoProjectUsers: false,
  576. isUploading:false,
  577. importDialog: false,
  578. importParam:{syncUserCost:true, syncHistoryReport:true},
  579. user: JSON.parse(sessionStorage.getItem("user")),
  580. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  581. userDetailVisible: false,
  582. userDetail:{},
  583. date: null,
  584. tableHeight: 0,
  585. listLoading: false,
  586. list: [],
  587. addLoading: false,
  588. myChart: null,
  589. params: null,
  590. totalPercent:0,
  591. importVisible: false,
  592. shenhe: '',
  593. tabPosition: '0',
  594. reviewerVisible: false,
  595. reviewerRuleForm: {
  596. auditorId: ''
  597. },
  598. people: [],
  599. revaelse: '',
  600. reviewLis: [],
  601. ovReviewLis: [],
  602. xzImportVisible: false,
  603. xzList: [],
  604. intoAmortizationDialog : false ,
  605. importingData: false,
  606. importResultMsg:null,
  607. showImportResult:false,
  608. widthHtval: document.body.clientWidth - 230,
  609. deleteSelList: [],
  610. chosenProjectsChecked: false
  611. };
  612. },
  613. methods: {
  614. chosenProjectsCheckedClick() {
  615. console.log(this.chosenProjects, '数据')
  616. if(this.chosenProjectsChecked) {
  617. let arr = []
  618. for(let i in this.allProjectList) {
  619. arr.push(this.allProjectList[i].id)
  620. }
  621. this.chosenProjects = arr
  622. } else {
  623. this.chosenProjects = []
  624. }
  625. },
  626. deleteSel(sel){
  627. this.deleteSelList = sel
  628. // console.log(sel);
  629. },
  630. deleteUsers(){
  631. this.$confirm(this.$t(this.$t('doyouwanttodeleteit')),this.$t('other.prompts'),{
  632. confirmButtonText: this.$t('btn.determine'),
  633. cancelButtonText: this.$t('btn.cancel'),
  634. type: 'warning'
  635. }).then(()=>{
  636. let ids = ''
  637. for(let i in this.deleteSelList){
  638. ids += this.deleteSelList[i].id + ','
  639. }
  640. ids = ids.substring(0,ids.length - 1)
  641. this.http.post('/finance/batchRemove',{
  642. ids: ids
  643. },res => {
  644. if(res.code == 'ok'){
  645. this.getList()
  646. this.$message({
  647. message: this.$t('message.successfullyDeleted'),
  648. type: 'success'
  649. })
  650. }else {
  651. this.$message({
  652. message: res.msg,
  653. type: 'error'
  654. })
  655. }
  656. },err => {
  657. this.$message({
  658. message: err,
  659. type: 'error'
  660. })
  661. })
  662. }).catch(()=>{
  663. this.$message({
  664. type: 'info',
  665. message: this.$t('thedeletionhasbeencancelled')
  666. })
  667. })
  668. },
  669. exportFinance() {
  670. this.isUploading = true;
  671. this.http.post('/finance/exportFinance', {
  672. date: this.exportMonth
  673. },res =>{
  674. this.isUploading = false;
  675. if(res.code == 'ok') {
  676. this.downloadByA({name:this.exportMonth+this.$t('financialdata') + '.xls', url: res.data});
  677. }
  678. },error => {
  679. this.$message({
  680. message: error,
  681. type: "error"
  682. });
  683. })
  684. },
  685. arrter() {
  686. this.http.post('/user/getEmployeeList', {
  687. departmentId: '-1',
  688. pageIndex: 1,
  689. // pageSize: 99999
  690. pageSize: -1
  691. },res =>{
  692. if(res.code == 'ok') {
  693. this.people = res.data.records
  694. }
  695. },error => {
  696. this.$message({
  697. message: error,
  698. type: "error"
  699. });
  700. })
  701. },
  702. addreviewer() {
  703. this.http.post('/finance-auditor/get', {
  704. companyId: this.user.companyId
  705. },
  706. res => {
  707. if (res.code == "ok") {
  708. // console.log(res.data, '数据')
  709. if(res.data) {
  710. this.reviewerRuleForm.auditorId = res.data.auditorId
  711. } else {
  712. this.reviewerRuleForm.auditorId = ''
  713. }
  714. }
  715. },error => {
  716. this.$message({
  717. message: error,
  718. type: "error"
  719. });
  720. }
  721. );
  722. },
  723. // 提交审核人
  724. submitreviewerRuleForm(formName) {
  725. this.$refs[formName].validate((valid) => {
  726. if (valid) {
  727. this.reviewerRuleForm.companyId = this.user.companyId
  728. this.http.post('/finance-auditor/save', this.reviewerRuleForm,
  729. res =>{
  730. if(res.code == 'ok') {
  731. this.$message({
  732. message: this.$t('operationissuccessful'),
  733. type: "success"
  734. });
  735. this.addreviewer()
  736. } else {
  737. this.$message({
  738. message: this.$t('operationfailure'),
  739. type: "error"
  740. });
  741. }
  742. },error => {
  743. this.$message({
  744. message: error,
  745. type: "error"
  746. });
  747. })
  748. this.reviewerVisible = false
  749. } else {
  750. return false;
  751. }
  752. });
  753. },
  754. handleCloses(done) {
  755. var formName = 'reviewerRuleForm'
  756. this.$refs[formName].resetFields();
  757. done()
  758. },
  759. // 审核
  760. audits() {
  761. this.shenhe = this.$t('importtheaudits')
  762. this.importVisible = true
  763. },
  764. switchCostList() {
  765. //已填日报的人员成本
  766. if (this.costListRadio == 1) {
  767. this.assignNoProUser=false;
  768. this.assignToProject();
  769. } else if (this.costListRadio == 2) {
  770. //全部人员成本
  771. this.assignNoProUser=true;
  772. this.assignToProject();
  773. }
  774. },
  775. getLastMonthSetting() {
  776. this.costSettingLoading = true;
  777. var dataArr = this.date.split('-');
  778. var year = dataArr[0];
  779. var month = dataArr[1];
  780. if (parseInt(month) == 1) {
  781. year = parseInt(year) -1;
  782. month = 12;
  783. } else {
  784. month = parseInt(month) -1;
  785. if (month < 10) {
  786. month = '0'+month;
  787. }
  788. }
  789. var lastMonth = year + '-' + month;
  790. this.http.post('/project-percentage/getMonthSetting', {ymonth: lastMonth},
  791. res => {
  792. this.costSettingLoading = false;
  793. if (res.code == "ok") {
  794. this.projectCols = res.data.financeProjects;
  795. this.allProjectList = res.data.allProjectList;
  796. this.userCostSettingList = res.data.userCostSetting;
  797. //上次如果没有配置过,需要初始化
  798. for (var i=0;i<this.noReportUserList.length; i++) {
  799. var rUser = this.noReportUserList[i];
  800. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  801. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  802. var item = {name: rUser.name, id: rUser.userId};
  803. this.projectCols.forEach(p=>{
  804. item[p.projectId] = 0;
  805. });
  806. this.userCostSettingList.push(item);
  807. }
  808. }
  809. this.$nextTick(()=>{
  810. this.$refs.settingTable.doLayout();
  811. })
  812. } });
  813. },
  814. //获取当月的无项目工时人员的分配比例设置
  815. getMonthSetting() {
  816. this.costSettingLoading = true;
  817. this.http.post('/project-percentage/getMonthSetting', {ymonth: this.date},
  818. res => {
  819. this.costSettingLoading = false;
  820. if (res.code == "ok") {
  821. this.projectCols = res.data.financeProjects;
  822. this.allProjectList = res.data.allProjectList;
  823. this.userCostSettingList = res.data.userCostSetting;
  824. //上次如果没有配置过,需要初始化
  825. for (var i=0;i<this.noReportUserList.length; i++) {
  826. var rUser = this.noReportUserList[i];
  827. // console.log('userId====='+rUser.userId);
  828. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  829. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  830. var item = {name: rUser.name, id: rUser.userId};
  831. this.projectCols.forEach(p=>{
  832. item[p.projectId] = 0;
  833. });
  834. this.userCostSettingList.push(item);
  835. }
  836. }
  837. this.$nextTick(()=>{
  838. this.$refs.settingTable.doLayout();
  839. })
  840. } });
  841. },
  842. //提交无工时人员的分配设置
  843. saveMonthSetting() {
  844. //检查数据是否都分配到100%了,防止由于修改了项目列而导致之前的数据不正确的情况
  845. var errorList = this.userCostSettingList.filter(u=>{
  846. let totalPercent = 0.0;
  847. this.projectCols.forEach(p=>{
  848. totalPercent += parseFloat(u[p.projectId]);
  849. });
  850. totalPercent = totalPercent.toFixed(1);
  851. if (totalPercent != 100) {
  852. return true;
  853. } else {
  854. return false;
  855. }
  856. });
  857. if (errorList.length > 0) {
  858. var nameList = errorList.map(e=>e.name);
  859. this.$message({type:'error', message:this.$t('proportionofassignedpersonnelisnot ')+'100%:'+nameList});
  860. return;
  861. }
  862. this.http.post('/project-percentage/saveMonthSetting', {projectCols: JSON.stringify(this.projectCols),
  863. ymonth: this.date, userSettings: JSON.stringify(this.userCostSettingList)},
  864. res => {
  865. if (res.code == "ok") {
  866. this.$message({type:'success', message:this.$t('savesuccess')});
  867. this.settingDialog = false;
  868. } else {
  869. this.$message({type:'error', message:this.$t('erroroccurred')+':'+res.msg});
  870. }});
  871. },
  872. updatePercentValue() {
  873. var total = 0.0;
  874. this.projectCols.forEach(p=>{
  875. total += parseFloat(this.curPercentVal[p.projectId]);
  876. })
  877. this.totalPercent = total.toFixed(1);
  878. this.$forceUpdate();
  879. },
  880. averageCost() {
  881. var avg = (100/this.projectCols.length).toFixed(1);
  882. //最后一个用100减去前面的总和,保证最终合计为100
  883. for (var i=0;i<this.projectCols.length; i++) {
  884. if (i < this.projectCols.length -1) {
  885. this.curPercentVal[this.projectCols[i].projectId] = avg;
  886. } else {
  887. this.curPercentVal[this.projectCols[i].projectId] = (100-avg*(this.projectCols.length-1)).toFixed(1);
  888. }
  889. }
  890. this.updatePercentValue();
  891. this.$forceUpdate();
  892. },
  893. setPercent(isBatch, row) {
  894. this.setPercentDialog = true;
  895. this.chosenNoReportUserIds = [];
  896. if (!isBatch) {
  897. this.chosenNoReportUserIds.push(row.id);
  898. //获取当前比例
  899. this.projectCols.forEach(p=>{
  900. this.curPercentVal[p.projectId] = row[p.projectId];
  901. });
  902. } else {
  903. //批量处理
  904. this.multipleSelection.forEach(m=>{
  905. this.chosenNoReportUserIds.push(m.id);
  906. })
  907. //批量时获取第一条的比例进行加载
  908. this.projectCols.forEach(p=>{
  909. this.curPercentVal[p.projectId] = this.multipleSelection[0][p.projectId];
  910. });
  911. }
  912. this.updatePercentValue();
  913. },
  914. //确认设置的项目列
  915. saveProjectSetting() {
  916. this.projectsDialog = false;
  917. this.projectCols = [];
  918. this.chosenProjects.forEach(c=>{
  919. var item = this.allProjectList.filter(a=>a.id == c)[0];
  920. this.projectCols.push({projectId: item.id, projectName: item.projectName, projectCode: item.projectCode});
  921. });
  922. this.$nextTick(()=>{
  923. this.$refs.settingTable.doLayout();
  924. })
  925. },
  926. handleProjectSelectionChange(val) {
  927. this.projectSelection = val;
  928. },
  929. showSelectProjectDialog() {
  930. //设置选中状态
  931. this.chosenProjects = [];
  932. this.chosenProjectsChecked = false
  933. this.projectCols.forEach(item=>{
  934. this.chosenProjects.push(item.projectId);
  935. })
  936. this.projectsDialog = true;
  937. },
  938. setPercentSetting() {
  939. //检测是否填写的情况下,是否达到100%
  940. if (this.totalPercent != 100) {
  941. this.$message({
  942. message: this.$t('sumoftheallocationsmustbe'),
  943. type: "error"
  944. });
  945. return;
  946. }
  947. this.setPercentDialog = false;
  948. this.chosenNoReportUserIds.forEach(u=>{
  949. var targetU = this.userCostSettingList.filter(a=>a.id == u)[0];
  950. //遍历项目
  951. this.projectCols.forEach(p=>{
  952. targetU[p.projectId] = this.curPercentVal[p.projectId];
  953. })
  954. });
  955. this.userCostSettingList.splice(1,0);
  956. },
  957. showSettingDialog() {
  958. this.settingDialog = true;
  959. this.getMonthSetting();
  960. },
  961. handleSelectionChange(val) {
  962. this.multipleSelection = val;
  963. },
  964. switchList() {
  965. if (this.radio == this.$t('lable.allStaff')) {
  966. this.list = this.allFinanceList;
  967. } else {
  968. this.list = this.noReportUserList;
  969. }
  970. },
  971. downloadByA(row) {
  972. const a = document.createElement('a'); // 创建a标签
  973. a.setAttribute('download', row.name);// download属性
  974. // console.log(row.url);
  975. a.setAttribute('href', row.url);// href链接
  976. a.click();// 自执行点击事件
  977. a.remove();
  978. },
  979. getTemplate() {
  980. this.http.post('/finance/getTemplate', {companyId: this.user.companyId},
  981. res => {
  982. if (res.code == "ok") {
  983. if (res.data.indexOf('xlsx') > 0) {
  984. this.downloadByA({name:this.$t('financialcoststatement')+ '.xlsx', url:res.data});
  985. } else {
  986. this.downloadByA({name:this.$t('financialcoststatement')+ '.xls', url:res.data});
  987. }
  988. }});
  989. },
  990. saveItems() {
  991. // let savefields = {
  992. // monthCost : this.customCols.monthCost,
  993. // bonus : this.customCols.bonus,
  994. // allowance : this.customCols.allowance,
  995. // insuranceOld : this.customCols.insuranceOld,
  996. // insuranceMedical : this.customCols.insuranceMedical,
  997. // insuranceLosejob : this.customCols.insuranceLosejob,
  998. // insuranceInjury : this.customCols.insuranceInjury,
  999. // houseFund : this.customCols.houseFund,
  1000. // field1 : this.customCols.field1,
  1001. // field2 : this.customCols.field2,
  1002. // field3 : this.customCols.field3
  1003. // }
  1004. if(this.customCols.field1 != null && this.customCols.field1 != ''){
  1005. if(this.customCols.field1Calculate == null){
  1006. this.$message({
  1007. message: this.$t('choosewhethertoincludethetotalcost'),
  1008. type: 'warning'
  1009. })
  1010. return
  1011. }
  1012. }
  1013. if(this.customCols.field2 != null && this.customCols.field2 != ''){
  1014. if(this.customCols.field1Calculate == null){
  1015. this.$message({
  1016. message: this.$t('choosewhethertoincludethetotalcost'),
  1017. type: 'warning'
  1018. })
  1019. return
  1020. }
  1021. }
  1022. if(this.customCols.field3 != null && this.customCols.field3 != ''){
  1023. if(this.customCols.field1Calculate == null){
  1024. this.$message({
  1025. message: this.$t('choosewhethertoincludethetotalcost'),
  1026. type: 'warning'
  1027. })
  1028. return
  1029. }
  1030. }
  1031. this.http.post('/finance-tblcuscol/save', this.customCols,
  1032. res => {
  1033. if (res.code == "ok") {
  1034. this.itemDialog = false;
  1035. this.getCustomColumn();
  1036. }});
  1037. this.$forceUpdate();
  1038. },
  1039. showItemDialog() {
  1040. // console.log(this.customColsi, '后台纯的')
  1041. // console.log(this.customCols, '用来编辑的')
  1042. this.customCols = JSON.parse(JSON.stringify(this.customColsi))
  1043. // console.log(this.customColsi, '后台纯的')
  1044. // console.log(this.customCols, '用来编辑的')
  1045. this.itemDialog = true;
  1046. // this.customFieldList = {field1:null,field2:null, field3:null};
  1047. // if (this.customCols.field1 !== undefined) {
  1048. // this.customFieldList.field1 = this.customCols.field1;
  1049. // } else if (this.customCols.field2 !== undefined) {
  1050. // this.customFieldList.field2 = this.customCols.field2;
  1051. // } else if (this.customCols.field3 !== undefined) {
  1052. // this.customFieldList.field3 = this.customCols.field3;
  1053. // }
  1054. },
  1055. //获取自定义的字段
  1056. getCustomColumn() {
  1057. this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
  1058. res => {
  1059. if (res.code == "ok") {
  1060. // console.log("获取自定义字段",res.data);
  1061. this.customColsi = res.data;
  1062. this.tblCols = [];
  1063. this.tblCols.push(this.customColsi.monthCost);
  1064. this.tblCols.push(this.customColsi.bonus);
  1065. this.tblCols.push(this.customColsi.allowance);
  1066. this.tblCols.push(this.customColsi.insuranceOld);
  1067. this.tblCols.push(this.customColsi.insuranceMedical);
  1068. this.tblCols.push(this.customColsi.insuranceLosejob);
  1069. this.tblCols.push(this.customColsi.insuranceInjury);
  1070. this.tblCols.push(this.customColsi.houseFund);
  1071. if (this.customColsi.field1 != null) {
  1072. this.tblCols.push(this.customColsi.field1);
  1073. }
  1074. if (this.customColsi.field2 != null) {
  1075. this.tblCols.push(this.customColsi.field2);
  1076. }
  1077. if (this.customColsi.field3 != null) {
  1078. this.tblCols.push(this.customColsi.field3);
  1079. }
  1080. }});
  1081. },
  1082. // },
  1083. // getProjects() {
  1084. // this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
  1085. // res => {
  1086. // if (res.code == "ok") {
  1087. // this.projectCols = res.data.financeProjects;
  1088. // this.allProjectList = res.data.allProjectList;
  1089. // }});
  1090. // },
  1091. // showNoProjectUsers() {
  1092. // this.showNPDialog = true;
  1093. // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
  1094. // res => {
  1095. // if (res.code == "ok") {
  1096. // this.npUserList = res.data;
  1097. // }});
  1098. // },
  1099. assignToProject(){
  1100. var _this = this;
  1101. this.http.post('/finance/getTimeCost', {yearMonth: this.date, assignNoProUser: this.assignNoProUser},
  1102. res => {
  1103. if (res.code == "ok") {
  1104. // 待会删除
  1105. // var lll = res.data.costList
  1106. // var arrLists = []
  1107. // for(var i = 0; i < 50; i++) {
  1108. // arrLists.push(lll[1])
  1109. // }
  1110. // res.data.costList = arrLists
  1111. // 待会删除
  1112. for(var i in res.data.costList) {
  1113. if(i>20) {
  1114. this.widthHtval = +this.widthHtval + 40
  1115. } else {
  1116. this.widthHtval = document.body.clientWidth - 230
  1117. }
  1118. }
  1119. // console.log(res.data, '图表数据', this.widthHtval)
  1120. var xList = [], yList = [], list = res.data.costList,
  1121. totalMoneyCost = res.data.totalMoneyCost;
  1122. var nopCost = 0;
  1123. if (res.data.noProjectItem.project != null) {
  1124. this.hasNoProjectUsers = true;
  1125. nopCost = res.data.noProjectItem.cost;
  1126. } else {
  1127. this.hasNoProjectUsers = false;
  1128. }
  1129. for(var i in list) {
  1130. xList.push(list[i].project);
  1131. yList.push({
  1132. "value": list[i].cost,
  1133. "id": list[i].id,
  1134. "time": list[i].workingTime
  1135. });
  1136. }
  1137. var myChart = echarts.init(document.getElementById("container"));
  1138. // 设置图表
  1139. myChart.resize({
  1140. width: this.widthHtval
  1141. })
  1142. _this.myChart = myChart;
  1143. var option = {
  1144. title: {
  1145. text: this.assignNoProUser?this.$t('costintotal') + totalMoneyCost + this.$t('yuan')
  1146. +(this.hasNoProjectUsers?","+$t('projectpersonnelcostincluded') + nopCost+this.$t('yuan'):"")
  1147. :this.$t('costintotal') + totalMoneyCost + this.$t('yuan'),
  1148. left:'left',
  1149. },
  1150. grid : {
  1151. top : 40, //距离容器上边界40像素
  1152. // bottom: 100, //距离容器下边界30像素
  1153. bottom: 40, //距离容器下边界30像素
  1154. left: 100,
  1155. right: 100
  1156. },
  1157. // 工具箱
  1158. toolbox: {
  1159. show: true,
  1160. feature:{
  1161. saveAsImage:{
  1162. show:true
  1163. },
  1164. restore:{
  1165. show:true
  1166. },
  1167. magicType:{
  1168. type:['line','bar']
  1169. },
  1170. }
  1171. },
  1172. tooltip:{
  1173. trigger:'axis',
  1174. formatter: function (params,ticket,callback) {
  1175. var res = params[0].name + "<br/>"+this.$t('workcost')+" : " + params[0].data.value
  1176. + this.$t('yuan')+"<br/>"+this.$t('screening.workTime')+" : " + params[0].data.time + this.$t('time.hour');
  1177. _this.params = params;
  1178. return res;
  1179. }
  1180. },
  1181. xAxis: {
  1182. data: xList,
  1183. axisLabel: {
  1184. interval:0,rotate:20
  1185. }
  1186. },
  1187. yAxis: [{
  1188. type : 'value',
  1189. axisLabel: {
  1190. formatter:'{value} ('+this.$t('yuan')+')'
  1191. }
  1192. }],
  1193. series: [{
  1194. name: this.$t('screening.workTime')+'(h)',
  1195. type: 'bar',
  1196. barMaxWidth: 30,
  1197. data: yList,
  1198. }]
  1199. };
  1200. option && myChart.setOption(option,{notMerge: true});
  1201. // myChart.getZr().on('click', params => {
  1202. // const pointInPixel = [params.offsetX, params.offsetY];
  1203. // if (myChart.containPixel('grid', pointInPixel)) {
  1204. // console.log(_this.params)
  1205. // if(_this.radio=='项目') {
  1206. // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1207. // }
  1208. // }
  1209. // });
  1210. } else {
  1211. this.$message({
  1212. message: res.msg,
  1213. type: "error"
  1214. });
  1215. }
  1216. },
  1217. error => {
  1218. this.$message({
  1219. message: error,
  1220. type: "error"
  1221. });
  1222. });
  1223. },
  1224. //导出财务数据
  1225. exportData() {
  1226. this.exportDataProcessing = true;
  1227. this.http.post('/finance/exportData', {
  1228. date: this.date, assignNoProUser: this.assignNoProUser, groupByCategory: this.groupByCategory
  1229. },
  1230. res => {
  1231. this.exportDataProcessing = false;
  1232. if (res.code == "ok") {
  1233. this.exportFinanceDialog = false;
  1234. var aTag = document.createElement('a');
  1235. aTag.download = this.$t('financialcoststatisticss')+".xls";
  1236. aTag.href = res.data;
  1237. aTag.click();
  1238. } else {
  1239. this.$message({
  1240. message: res.msg,
  1241. type: "error"
  1242. });
  1243. }
  1244. },
  1245. error => {
  1246. this.listLoading = false;
  1247. this.$message({
  1248. message: error,
  1249. type: "error"
  1250. });
  1251. });
  1252. },
  1253. getSummaries(param) {
  1254. const { columns, data } = param;
  1255. const sums = [];
  1256. columns.forEach((column, index) => {
  1257. if (index === 0) {
  1258. sums[index] = this.$t('zongjia');
  1259. return;
  1260. }
  1261. if (index === 1 || index === 2){
  1262. sums[index] = ''
  1263. return
  1264. }
  1265. const values = data.map(item => Number(item[column.property]));
  1266. if (!values.every(value => isNaN(value))) {
  1267. sums[index] = values.reduce((prev, curr) => {
  1268. const value = Number(curr);
  1269. if (!isNaN(value)) {
  1270. return prev + curr;
  1271. } else {
  1272. return prev;
  1273. }
  1274. }, 0);
  1275. sums[index] = sums[index].toFixed(2) + this.$t('yuan');
  1276. } else {
  1277. sums[index] = 'N/A';
  1278. }
  1279. });
  1280. return sums;
  1281. },
  1282. changeMonth() {
  1283. //改变月份
  1284. this.getList();
  1285. this.assignToProject();
  1286. this.getMonths()
  1287. },
  1288. // 批量导入人员
  1289. importFinance(item) {
  1290. //首先判断文件类型
  1291. let str = item.file.name.split(".");
  1292. let format = str[str.length - 1];
  1293. if (format != "xls" && format != "xlsx") {
  1294. this.$message({
  1295. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1296. type: "error"
  1297. });
  1298. } else {
  1299. this.listLoading = true;
  1300. let formData = new FormData();
  1301. formData.append("file", item.file);
  1302. formData.append("companyId", this.user.companyId);
  1303. formData.append("yearMonth", this.date);
  1304. formData.append("syncUserCost", this.importParam.syncUserCost);
  1305. formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
  1306. this.isUploading = true;
  1307. let urls = ''
  1308. if(this.user.timeType.financeAudit == '1') {
  1309. urls = '/finance-import/submitImport'
  1310. } else {
  1311. urls = '/finance/importData'
  1312. }
  1313. // this.http.uploadFile('/finance/importData', formData,
  1314. this.http.uploadFile(urls, formData,
  1315. res => {
  1316. // console.log(this.user.timeType.financeAudit, '看看数据')
  1317. this.$refs.upload.clearFiles();
  1318. this.listLoading = false;
  1319. this.isUploading = false;
  1320. if (res.code == "ok") {
  1321. if (this.user.timeType.financeAudit == 1 ) {
  1322. this.$message({
  1323. message: this.$t('waiforverification'),
  1324. type: "warning"
  1325. });
  1326. this.getMonths();
  1327. } else {
  1328. this.$message({
  1329. message: this.$t('other.importSuccess'),
  1330. type: "success"
  1331. });
  1332. }
  1333. this.importDialog = false;
  1334. //重新读取列表
  1335. this.getList();
  1336. } else {
  1337. this.$message({
  1338. message: res.msg,
  1339. type: "error"
  1340. });
  1341. }
  1342. },
  1343. error => {
  1344. this.$refs.upload.clearFiles();
  1345. this.listLoading = false;
  1346. this.$message({
  1347. message: error,
  1348. type: "error"
  1349. });
  1350. });
  1351. }
  1352. },
  1353. // 导入提交审核
  1354. // submitReview(formData) {
  1355. // this.http.uploadFile(' /finance-import/submitImport', formData,
  1356. // res => {
  1357. // if (res.code == "ok") {
  1358. // console.log(res.data, '来的数据')
  1359. // } else {
  1360. // this.$message({
  1361. // message: res.msg,
  1362. // type: "error"
  1363. // });
  1364. // }
  1365. // },
  1366. // error => {
  1367. // this.$refs.upload.clearFiles();
  1368. // this.listLoading = false;
  1369. // this.$message({
  1370. // message: error,
  1371. // type: "error"
  1372. // });
  1373. // });
  1374. // },
  1375. //获取项目列表
  1376. getList() {
  1377. this.listLoading = true;
  1378. this.http.post('/finance/getByMonth', {
  1379. companyId: this.user.companyId,
  1380. yearMonth: this.date
  1381. },
  1382. res => {
  1383. this.listLoading = false;
  1384. if (res.code == "ok") {
  1385. var list = res.data;
  1386. this.allFinanceList = list;
  1387. this.noReportUserList = list.filter(r=>r.hasReport == 0);
  1388. if(this.radio == this.$t('lable.allStaff')){
  1389. this.list = this.allFinanceList;
  1390. }else{
  1391. this.list = this.noReportUserList
  1392. }
  1393. } else {
  1394. this.$message({
  1395. message: res.msg,
  1396. type: "error"
  1397. });
  1398. }
  1399. },
  1400. error => {
  1401. this.listLoading = false;
  1402. this.$message({
  1403. message: error,
  1404. type: "error"
  1405. });
  1406. });
  1407. },
  1408. // 获取当月的审核状态
  1409. getMonths() {
  1410. this.http.post('/finance-import/getStatus', {
  1411. companyId: this.user.companyId,
  1412. yearMonth: this.date
  1413. },
  1414. res => {
  1415. this.listLoading = false;
  1416. if (res.code == "ok") {
  1417. // console.log(res.data, '审核状态')
  1418. if(res.data) {
  1419. if(res.data.state == '0') {
  1420. this.revaelse = this.$t('state.WaitingAudit')
  1421. this.tabPosition = '0'
  1422. } else if(res.data.state == '1') {
  1423. this.revaelse = this.$t('Auditrecords')
  1424. this.tabPosition = '1'
  1425. }else if (res.data.state == '2') {
  1426. this.revaelse = this.$t('state.rejected')
  1427. this.tabPosition = '2'
  1428. } else if (res.data.state == '3') {
  1429. this.revaelse = this.$t('state.undone')
  1430. this.tabPosition = '-1'
  1431. }
  1432. this.getReviewList()
  1433. } else {
  1434. this.revaelse = ''
  1435. }
  1436. } else {
  1437. this.$message({
  1438. message: res.msg,
  1439. type: "error"
  1440. });
  1441. }
  1442. },
  1443. error => {
  1444. this.listLoading = false;
  1445. this.$message({
  1446. message: error,
  1447. type: "error"
  1448. });
  1449. });
  1450. },
  1451. // 获取审核列表
  1452. getReviewList() {
  1453. this.http.post('/finance-import/list', {
  1454. companyId: this.user.companyId,
  1455. },
  1456. res => {
  1457. if (res.code == "ok") {
  1458. // console.log(res.data, '拿到的数据')
  1459. this.ovReviewLis = res.data
  1460. if(this.tabPosition == 0) {
  1461. this.reviewLis = res.data.pendingList
  1462. } else if(this.tabPosition == 1) {
  1463. this.reviewLis = res.data.passList
  1464. } else if(this.tabPosition == 2) {
  1465. this.reviewLis = res.data.rejectList
  1466. } else {
  1467. this.reviewLis = res.data.cancelList
  1468. }
  1469. // console.log(this.reviewLis, '数据')
  1470. } else {
  1471. this.$message({
  1472. message: res.msg,
  1473. type: "error"
  1474. });
  1475. }
  1476. },
  1477. error => {
  1478. this.$message({
  1479. message: error,
  1480. type: "error"
  1481. });
  1482. });
  1483. },
  1484. // 操作数据
  1485. operationalData () {
  1486. var sss = this.ovReviewLis
  1487. if(this.tabPosition == 0) {
  1488. this.reviewLis = sss.pendingList
  1489. } else if(this.tabPosition == 1) {
  1490. this.reviewLis = sss.passList
  1491. } else if(this.tabPosition == 2) {
  1492. this.reviewLis = sss.rejectList
  1493. } else {
  1494. this.reviewLis = sss.cancelList
  1495. }
  1496. // console.log(this.reviewLis, '数据')
  1497. },
  1498. // 审核操作
  1499. operationList(zhi, id) {
  1500. let urls
  1501. if(zhi == 0) {
  1502. urls = '/finance-import/agree'
  1503. } else if(zhi == 1){
  1504. urls = '/finance-import/deny'
  1505. } else {
  1506. urls = '/finance-import/cancel'
  1507. }
  1508. this.http.post(urls, {
  1509. id: id,
  1510. },
  1511. res => {
  1512. if (res.code == "ok") {
  1513. this.$message({
  1514. message: this.$t('operationissuccessful'),
  1515. type: "success"
  1516. });
  1517. this.getReviewList()
  1518. } else {
  1519. this.$message({
  1520. message: res.msg,
  1521. type: "error"
  1522. });
  1523. }
  1524. },
  1525. error => {
  1526. this.$message({
  1527. message: error,
  1528. type: "error"
  1529. });
  1530. });
  1531. },
  1532. // 获取薪资上传记录
  1533. xzjl() {
  1534. this.http.post('/finance-import/list', {
  1535. companyId: this.user.companyId,
  1536. // pageIndex:1,
  1537. // pageSize: 9999
  1538. },
  1539. res => {
  1540. if (res.code == "ok") {
  1541. // console.log('123',res.data)
  1542. this.xzList = res.data.passList
  1543. } else {
  1544. this.$message({
  1545. message: res.msg,
  1546. type: "error"
  1547. });
  1548. }
  1549. },
  1550. error => {
  1551. this.$message({
  1552. message: error,
  1553. type: "error"
  1554. });
  1555. });
  1556. },
  1557. //导入分摊比例
  1558. intoAmortizationRatio(){
  1559. this.intoAmortizationDialog = true;
  1560. },
  1561. batchImportData(item) {
  1562. //首先判断文件类型
  1563. let str = item.file.name.split(".");
  1564. let format = str[str.length - 1];
  1565. if (format != "xls" && format != "xlsx") {
  1566. this.$message({
  1567. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1568. type: "error"
  1569. });
  1570. } else {
  1571. this.importingData = true;
  1572. let formData = new FormData();
  1573. formData.append("file", item.file);
  1574. formData.append("companyId", this.user.companyId);
  1575. formData.append('ymonth',this.date)
  1576. this.http.uploadFile('/project-percentage/importData', formData,
  1577. res => {
  1578. this.$refs.upload.clearFiles();
  1579. this.importingData = false;
  1580. this.showImportResult = true;
  1581. if (res.code == "ok") {
  1582. //换成弹出框,以免有人等了半天回来啥也没看到
  1583. this.importResultMsg = this.$t('other.importSuccess')+res.data+this.$t('apportionmentratiodata')+'。'+(res.msg?res.msg:"");
  1584. this.showSettingDialog();
  1585. } else {
  1586. this.importResultMsg = this.$t('export.Importfailure')+":"+res.msg;
  1587. }
  1588. },
  1589. error => {
  1590. this.$refs.upload.clearFiles();
  1591. this.importingData = false;
  1592. this.$message({
  1593. message: error,
  1594. type: "error"
  1595. });
  1596. });
  1597. }
  1598. },
  1599. // 左右滚动
  1600. scrollFunction () {
  1601. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1602. if (this.domObj.attachEvent) { // IE
  1603. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1604. } else if (this.domObj.addEventListener) {
  1605. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1606. }
  1607. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1608. },
  1609. mouseScroll(event) { // google 浏览器下
  1610. let detail = event.wheelDelta || event.detail
  1611. let moveForwardStep = -1
  1612. let moveBackStep = 1
  1613. let step = 0
  1614. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1615. event.preventDefault() // 阻止浏览器默认事件
  1616. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1617. },
  1618. // 自定义组件事件
  1619. selectCal(obj) {
  1620. if(obj.distinction == '1') {
  1621. this.reviewerRuleForm.auditorId = obj.id
  1622. } else if(obj.distinction == '2') {
  1623. this.chosenNoReportUserIds = obj.id
  1624. }
  1625. }
  1626. },
  1627. created() {
  1628. var d = new Date();
  1629. this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
  1630. },
  1631. mounted() {
  1632. let height = window.innerHeight;
  1633. this.tableHeight = height - 245;
  1634. const that = this;
  1635. window.onresize = function temp() {
  1636. that.tableHeight = window.innerHeight - 245;
  1637. };
  1638. this.getCustomColumn();
  1639. this.getList();
  1640. // this.getProjects();
  1641. this.addreviewer();
  1642. this.arrter()
  1643. this.getMonths()
  1644. this.scrollFunction()
  1645. },
  1646. updated() {
  1647. this.$nextTick(() => {
  1648. this.$refs['table'].doLayout();
  1649. })
  1650. }
  1651. };
  1652. </script>
  1653. <style lang="scss" scoped>
  1654. .nameList {
  1655. height: 400px;
  1656. overflow: auto;
  1657. }
  1658. </style>