finance.vue 89 KB

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