finance.vue 92 KB

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