salaryDetails.vue 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251
  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 v-if="permissions.financialBonusDetails"><i class="fa fa-align-justify" @click.prevent="switchMenu"
  7. style="cursor: pointer;"></i></el-form-item>
  8. <!-- <el-form-item label="财务核算成本 | 月份选择" style="margin-top:5px;"> -->
  9. <el-form-item :label="this.$t('Selectmonth')">
  10. <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM"
  11. value-format="yyyy-MM" @change="loadMonthData" :clearable="false" type="month"
  12. :placeholder="$t('Selectmonth')" style="margin-right: 20px;width: 120px"></el-date-picker>
  13. <el-link type="primary" :underline="false" @click="audits()"
  14. v-if="user.timeType.financeAudit == '1'">{{ revaelse }}</el-link>
  15. </el-form-item>
  16. <el-form-item label="部门">
  17. <el-cascader v-model="departmentId" :placeholder="$t('qing-xuan-ze-bu-men')" style="width: 160px" @change="loadMonthData"
  18. :options="departmentArray" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable v-if="user.userNameNeedTranslate != 1" size="small"></el-cascader>
  19. <vueCascader :size="'small'" :widthStr="'160'" :clearable="true && user.userNameNeedTranslate != 1" :subject="departmentArray" :subjectId="departmentId" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1" ></vueCascader>
  20. </el-form-item>
  21. <!-- <el-radio-group v-model="radio" @change="switchList" style="margin-left:160px;margin-top:5px;"> -->
  22. <el-radio-group size="small" v-model="radio" @change="switchList"
  23. style="margin-left:150px;margin-top:5px;">
  24. <el-radio-button :label="$t('lable.allStaff')">{{ $t('lable.allStaff') }}({{ allFinanceList.length
  25. }})</el-radio-button>
  26. <el-radio-button :label="$t('projectworker')">{{ $t('projectworker') }}({{ noReportUserList.length
  27. }})</el-radio-button>
  28. </el-radio-group>
  29. <el-form-item v-if="permissions.financialProportion" style="margin-left:5px;">
  30. <el-link type="primary" :underline="false" @click="showProjSettingDialog()"
  31. v-if="user.companyId == 88">{{ $t('ApportionmentProjsetting') }}</el-link>
  32. <el-link type="primary" :underline="false" @click="showSettingDialog()" style="margin-left:50px;">{{
  33. $t('Apportionmentratesetting') }}</el-link>
  34. </el-form-item>
  35. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  36. <el-link type="primary" :underline="false" @click="getTemplate()">{{ $t('Downloadthetemplate')
  37. }}</el-link>
  38. </el-form-item>
  39. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  40. <el-link type="primary" :underline="false" @click="importDialog = true; isUploading = false;">{{
  41. $t('Dataupload') }}</el-link>
  42. </el-form-item>
  43. <el-form-item style="float:right;" v-if="permissions.financialExport">
  44. <el-link type="primary" :underline="false" @click="exportDialog = true; exportMonth = date;">{{
  45. $t('Exportdata') }}</el-link>
  46. </el-form-item>
  47. <el-form-item style="float:right;" v-if="permissions.financialCustom">
  48. <el-link type="primary" :underline="false" @click="showItemDialog()">{{
  49. $t('Customizesalaryitems')
  50. }}</el-link>
  51. </el-form-item>
  52. <el-form-item style="float:right;">
  53. <el-link type="primary" :underline="false" @click="notParticipatingInSharedProjects()">
  54. 不参与分摊项目设置
  55. </el-link>
  56. </el-form-item>
  57. <el-form-item style="float:right;"
  58. v-if="user.timeType.financeAudit == '1' && permissions.setFinanceAuditor">
  59. <el-link type="primary" :underline="false" @click="reviewerVisible = true">{{ $t('Setupauditor')
  60. }}</el-link>
  61. </el-form-item>
  62. </el-form>
  63. </el-col>
  64. <!-- 上传记录 -->
  65. <el-dialog :title="$t('Salaryuploadrecord')" :visible.sync="xzImportVisible" width="1100px"
  66. :before-close="handleClose">
  67. <div>
  68. <el-table :data="xzList" style="width: 100%" :height="400">
  69. <el-table-column prop="userName" :label="$t('other.operator')">
  70. <template slot-scope="scope">
  71. <div>
  72. <span v-if="user.userNameNeedTranslate == '1'">
  73. <TranslationOpenDataText type='userName' :openid='scope.row.userName'>
  74. </TranslationOpenDataText>
  75. </span>
  76. <span v-if="user.userNameNeedTranslate != '1'">{{ scope.row.userName }}</span>
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="ymonth" :label="$t('BelongsIn')"></el-table-column>
  81. <el-table-column prop="fileName" :label="$t('filename')">
  82. <template slot-scope="scope">
  83. <div>
  84. <el-link type="primary"
  85. @click="downloadByA({ name: scope.row.fileName, url: scope.row.serverName })">
  86. {{ scope.row.fileName }}</el-link>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  91. <template slot-scope="scope">
  92. <div>
  93. {{ scope.row.recoverReport == 1 ? $t('state.yes') : $t('state.no') }}
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')"
  98. width="150">
  99. <template slot-scope="scope">
  100. <div>
  101. {{ scope.row.recoverMonthcost == 1 ? $t('state.yes') : $t('state.no') }}
  102. </div>
  103. </template>
  104. </el-table-column>
  105. <el-table-column prop="indate" :label="$t('Uploadtime')"></el-table-column>
  106. <!-- <el-table-column prop="date" label="操作" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id || user.role == 1 || user.role == 2)">
  107. <template slot-scope="scope">
  108. <div>
  109. <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">通过</el-button>
  110. <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">驳回</el-button>
  111. <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">撤销</el-button>
  112. </div>
  113. </template>
  114. </el-table-column> -->
  115. </el-table>
  116. </div>
  117. </el-dialog>
  118. <!-- 财务报表审核 -->
  119. <el-dialog :title="shenhe" :visible.sync="importVisible" width="1100px" :before-close="handleClose">
  120. <div>
  121. <el-radio-group v-model="tabPosition" style="margin-bottom: 20px;" @change="operationalData()">
  122. <el-radio-button label="1">{{ $t('state.alreadyPassed') }}</el-radio-button>
  123. <el-radio-button label="0">{{ $t('state.WaitingAudit') }}</el-radio-button>
  124. <el-radio-button label="2">{{ $t('state.rejected') }}</el-radio-button>
  125. <el-radio-button label="-1">{{ $t('state.undone') }}</el-radio-button>
  126. </el-radio-group>
  127. <el-table :data="reviewLis" style="width: 100%" :height="400">
  128. <el-table-column prop="userName" :label="$t('other.operator')" width="100">
  129. <template slot-scope="scope">
  130. <div>
  131. <span v-if="user.userNameNeedTranslate == '1'">
  132. <TranslationOpenDataText type='userName' :openid='scope.row.userName'>
  133. </TranslationOpenDataText>
  134. </span>
  135. <span v-if="user.userNameNeedTranslate != '1'">{{ scope.row.userName }}</span>
  136. </div>
  137. </template>
  138. </el-table-column>
  139. <el-table-column prop="ymonth" :label="$t('BelongsIn')" width="100"></el-table-column>
  140. <el-table-column prop="fileName" :label="$t('filename')">
  141. <template slot-scope="scope">
  142. <div>
  143. <el-link type="primary"
  144. @click="downloadByA({ name: scope.row.fileName, url: scope.row.serverName })">
  145. {{ scope.row.fileName }}</el-link>
  146. </div>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  150. <template slot-scope="scope">
  151. <div>
  152. {{ scope.row.recoverReport == 1 ? $t('state.yes') : $t('state.no') }}
  153. </div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')"
  157. width="150">
  158. <template slot-scope="scope">
  159. <div>
  160. {{ scope.row.recoverMonthcost == 1 ? $t('state.yes') : $t('state.no') }}
  161. </div>
  162. </template>
  163. </el-table-column>
  164. <el-table-column prop="indate" :label="$t('Uploadtime')" width="150"></el-table-column>
  165. <el-table-column prop="date" :label="$t('operation')"
  166. v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id)"
  167. :width="tabPosition == 0 ? 210 : 120">
  168. <template slot-scope="scope">
  169. <div>
  170. <el-button type="primary" size="small" :loading="operating" v-if="tabPosition == 0"
  171. @click="operationList(0, scope.row.id)">{{ $t('btn.through') }}</el-button>
  172. <el-button type="warning" size="small" :loading="operating" v-if="tabPosition == 0"
  173. @click="operationList(1, scope.row.id)">{{ $t('btn.rejected') }}</el-button>
  174. <el-button type="warning" size="small" :loading="operating" v-if="tabPosition == 1"
  175. @click="operationList(2, scope.row.id)">{{ $t('btn.undo') }}</el-button>
  176. </div>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. </div>
  181. </el-dialog>
  182. <!-- 设置审核人弹窗 -->
  183. <el-dialog :title="$t('Setupauditor')" :visible.sync="reviewerVisible" width="350px"
  184. :before-close="handleCloses">
  185. <el-form :model="reviewerRuleForm" ref="reviewerRuleForm" label-width="100px" class="demo-ruleForm">
  186. <el-form-item :label="$t('SelectionofAuditor')" prop="auditorId"
  187. :rules="{ required: true, message: $t('reviewercannotbeempty'), trigger: 'blur' }">
  188. <el-select v-model="reviewerRuleForm.auditorId" clearable :placeholder="$t('SelectionofAuditor')"
  189. v-if="user.userNameNeedTranslate != '1'">
  190. <el-option v-for="(item, index) in people" :key="index" :label="item.name"
  191. :value="item.id"></el-option>
  192. </el-select>
  193. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="people"
  194. :subjectId="reviewerRuleForm.auditorId" :distinction="'1'" :size="'mini'"></selectCat>
  195. </el-form-item>
  196. <el-form-item>
  197. <el-button type="primary" @click="submitreviewerRuleForm('reviewerRuleForm')">{{ $t('btn.submit')
  198. }}</el-button>
  199. </el-form-item>
  200. </el-form>
  201. </el-dialog>
  202. <el-dialog :title="$t('Exportoffinancialdata')" v-if="exportDialog" :visible.sync="exportDialog"
  203. :close-on-click-modal="false" customClass="customWidth" width="400px">
  204. <el-form ref="form3">
  205. <el-form-item :label="$t('Intheexport')">
  206. <!-- <div style="color:orange;">{{date}}</div> -->
  207. <el-date-picker v-model="exportMonth" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM"
  208. value-format="yyyy-MM" style="width:280px;"></el-date-picker>
  209. </el-form-item>
  210. </el-form>
  211. <div slot="footer" class="dialog-footer">
  212. <el-button type="primary" style="width:100%;" :loading="isUploading" @click="exportFinance">{{
  213. $t('export.export') }}</el-button>
  214. </div>
  215. </el-dialog>
  216. <el-dialog :title="`${notParticipatingInSharedProjectsTitle}月 不参与分摊项目设置`"
  217. v-if="notParticipatingInSharedProjectsVisable" :visible.sync="notParticipatingInSharedProjectsVisable"
  218. :close-on-click-modal="false" customClass="customWidth" width="1000px">
  219. <el-form ref="form3">
  220. <el-form-item :label="''">
  221. <el-select v-model="notParticipatingInSharedProjectsValue" placeholder="请选择项目" filterable multiple
  222. :disabled="notParticipatingInSharedProjectDisabled" style="width: 100%;" clearable>
  223. <el-option v-for="item in projectAllList" :key="item.id" :label="item.projectName"
  224. :value="item.id">
  225. </el-option>
  226. </el-select>
  227. </el-form-item>
  228. <el-form-item :label="''">
  229. <el-link type="warning" :underline="false">*设置后请重新导入该月人员薪资</el-link>
  230. </el-form-item>
  231. </el-form>
  232. <div slot="footer" class="dialog-footer">
  233. <el-button type="primary" style="width:100%;" :loading="notParticipatingInSharedProjectsLoading"
  234. @click="submitNotParticipatingInSharedProject()">确定</el-button>
  235. </div>
  236. </el-dialog>
  237. <!--列表-->
  238. <!-- 222 -->
  239. <el-table :data="list" highlight-current-row v-loading="listLoading"
  240. :show-summary='user.timeType.isSecretSalary == 0 ? true : false' ref="table" :summary-method="getSummaries"
  241. @selection-change="deleteSel" :height="300" style="width: 100%;">
  242. <el-table-column type="selection" width="80" fixed="left"></el-table-column>
  243. <el-table-column prop="jobNumber" v-if="user.timeType.financeJobnumEnabled == 1" :label="$t('Worknumber')"
  244. sortable width="100" fixed="left"></el-table-column>
  245. <el-table-column prop="name" :label="$t('lable.name')" sortable width="150" fixed="left">
  246. <template slot-scope="scope">
  247. <div>
  248. <!-- <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='scope.row.name'></TranslationOpenDataText></span>
  249. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.name}}</span> -->
  250. {{ scope.row.name }}
  251. </div>
  252. </template>
  253. </el-table-column>
  254. <template v-if="user.timeType.isSecretSalary == 0">
  255. <el-table-column :prop="headerCols[index]" :label="item" sortable show-overflow-tooltip
  256. v-for="(item, index) in tblCols" :key="index" width="130px" align="right">
  257. <template slot-scope="scope">
  258. <div style="padding-right:5px;">
  259. {{ scope.row[headerCols[index]] == null ? '0.00' :
  260. scope.row[headerCols[index]].toFixed(2) }}</div>
  261. </template>
  262. </el-table-column>
  263. </template>
  264. <template v-if="user.timeType.isSecretSalary == 1">
  265. <el-table-column :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols"
  266. :key="index" width="130px" align="center">
  267. <template slot-scope="scope">
  268. * <span v-if="scope.row"></span>
  269. </template>
  270. </el-table-column>
  271. </template>
  272. <el-table-column prop="totalCost" width="150" align="right" :label="$t('totalcost')" fixed="right">
  273. <template slot-scope="scope">
  274. <div style="padding-right:5px;">{{ user.timeType.isSecretSalary == 0 ? scope.row.totalCost : '*'
  275. }}</div>
  276. </template>
  277. </el-table-column>
  278. </el-table>
  279. <div style="padding:5px 0 0 10px" v-if="permissions.financialUpload">
  280. <el-button @click="deleteUsers" size="mini" type="primary" :disabled="deleteSelList.length == 0">{{
  281. $t('Batchdelete') }}</el-button>
  282. </div>
  283. <el-form :inline="true">
  284. <el-form-item>
  285. <!-- <el-checkbox style="margin-left:10px;" v-model="assignNoProUser" @click="assignToProject">均摊无项目人员成本</el-checkbox> -->
  286. <!-- <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=false;assignToProject();" style="margin-left:10px;">分摊已填工时人员成本</el-button>
  287. <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=true;assignToProject();" style="margin-left:10px;">分摊全部人员成本</el-button> -->
  288. <el-radio-group size="small" v-model="costListRadio" @change="switchCostList"
  289. style="margin-left:5px;margin-top:5px;">
  290. <el-radio-button label="1">{{ $t('Apportionmentofpersonnelcosts') }}</el-radio-button>
  291. <el-radio-button label="2">{{ $t('Spreadallpersonnelcosts') }}</el-radio-button>
  292. </el-radio-group>
  293. <span v-if="missingFinanceUserList.length > 0" style="color:red;">{{ $t('jianCeDaoYou') }} <el-link
  294. @click="showMissingDialog = true">&nbsp;{{ missingFinanceUserList.length }}&nbsp;</el-link> {{
  295. $t('mingYiTianGongShiRenYuanZaiXinZiBiaoZhongWuJiLuBuCanYuChengBenFenTan') }}</span>
  296. </el-form-item>
  297. <el-form-item style="float:right;margin-right:20px;" v-if="permissions.financialShare">
  298. <el-link type="primary" :underline="false" @click="uploadTest()" v-if="user.companyId == 936"
  299. style="margin-right:10px">{{ $t('shangChuan') }}</el-link>
  300. <el-link type="primary" :underline="false"
  301. @click="exportFinanceDialog = true, personnelAllocation = true">{{
  302. $t('ExportingtheAllocationData') }}</el-link>
  303. </el-form-item>
  304. </el-form>
  305. <!-- 图表 -->
  306. <div id="clearfix"
  307. :style="'overflow-x: auto;width:100%;padding-bottom: 100px; position: relative; height:300px;'">
  308. <div id="container" :style="'height: 300px;width:100%;'"></div>
  309. </div>
  310. <!--新增界面-->
  311. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false"
  312. customClass="customWidth" width="600px">
  313. <el-form ref="form1" :model="addForm" :rules="rules" label-width="100px">
  314. <el-form-item :label="user.companyId == '7030' ? '项目令号' : $t('Itemno')">
  315. <el-input v-model="addForm.code" :placeholder="$t('Pleaseentertheprojectnumber')"
  316. clearable></el-input>
  317. </el-form-item>
  318. <el-form-item :label="$t('headerTop.projectName')" prop="name">
  319. <el-input v-model="addForm.name" :placeholder="$t('Pleaseenteraprojectname')" clearable></el-input>
  320. </el-form-item>
  321. <el-form-item :label="$t('Allparticipants')">
  322. <el-select v-model="addForm.userId" multiple filterable
  323. :placeholder="$t('Pleaseselectparticipants')" style="width:100%;" @change="changeParticipator">
  324. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  325. </el-select>
  326. </el-form-item>
  327. <el-form-item :label="$t('Principalpersoninharge')">
  328. <el-select v-model="addForm.inchargerId" :disabled="addForm.userId.length == 0" filterable
  329. :placeholder="$t('Pleaseselectthepersonincharge')" style="width:100%;"
  330. @change="changeIncharger">
  331. <el-option v-for="item in participator" :key="item.id" :label="item.name"
  332. :value="item.id"></el-option>
  333. </el-select>
  334. </el-form-item>
  335. </el-form>
  336. <div slot="footer" class="dialog-footer">
  337. <el-button @click.native="addFormVisible = false">{{ $t('btn.cancel') }}</el-button>
  338. <el-button type="primary" @click="submitInsert" :loading="addLoading">{{ $t('btn.submit') }}</el-button>
  339. </div>
  340. </el-dialog>
  341. <!--用户详细信息弹出框-->
  342. <el-dialog :title="$t('Checkthedetails')" v-if="userDetailVisible" :visible.sync="userDetailVisible"
  343. :close-on-click-modal="false" customClass="customWidth" width="400px">
  344. <div class="line"><span>{{ $t('lable.name') }}</span>
  345. <span v-if="user.userNameNeedTranslate == '1'">
  346. <TranslationOpenDataText type='userName' :openid='userDetail.name'></TranslationOpenDataText>
  347. </span>
  348. <span v-if="user.userNameNeedTranslate != '1'">{{ userDetail.name }}</span>
  349. </div>
  350. <div class="line"><span>{{ $t('Worknumber') }}</span><span>{{ userDetail.jobNumber }}</span></div>
  351. <div class="line"><span>{{ $t('lable.phone') }}</span><span>{{ userDetail.phone }}</span></div>
  352. <div class="line"><span>{{ $t('lable.department') }}</span>
  353. <span v-if="user.userNameNeedTranslate == '1'">
  354. <TranslationOpenDataText type='departmentName' :openid='userDetail.departmentName'>
  355. </TranslationOpenDataText>
  356. </span>
  357. <span v-if="user.userNameNeedTranslate != '1'">{{ userDetail.departmentName }}</span>
  358. </div>
  359. <div class="line"><span>{{ $t('costof') }}</span><span>{{ userDetail.cost }}{{ $t('Yuananhour') }}</span>
  360. </div>
  361. <div slot="footer" class="dialog-footer">
  362. <el-button type="primary" @click="userDetailVisible = false">{{ $t('btn.determine') }}</el-button>
  363. </div>
  364. </el-dialog>
  365. <!--导入时的设置界面 -->
  366. <el-dialog :title="$t('Financialdataimport')" v-if="importDialog" :visible.sync="importDialog"
  367. :close-on-click-modal="false" customClass="customWidth" width="550px">
  368. <el-form ref="form3" :model="importParam">
  369. <el-form-item :label="$t('Itheimport')">
  370. <!-- <div style="color:orange;">{{date}}</div> -->
  371. <el-date-picker v-model="date" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM"
  372. value-format="yyyy-MM"></el-date-picker>
  373. </el-form-item>
  374. <el-form-item prop="syncHistoryReport">
  375. <el-checkbox :label="$t('Recalculatereportedcostsforthemonth')"
  376. v-model="importParam.syncHistoryReport"></el-checkbox>
  377. <span v-if="user.companyId == '936'">&nbsp;[ 按每月 {{ $t(user.timeType.monthDays) }} 天 * 每天
  378. {{ $t(user.timeType.allday) }} 小时计算时薪 ]</span>
  379. </el-form-item>
  380. <el-form-item prop="syncUserCost">
  381. <el-checkbox :label="$t('Synchronizeemployeemonthlycosttorganizationalstructure')"
  382. v-model="importParam.syncUserCost"></el-checkbox>
  383. </el-form-item>
  384. </el-form>
  385. <div slot="footer" class="dialog-footer">
  386. <el-link v-if="user.timeType.financeAudit == '0'" style="float:left;" type="primary" :underline="false"
  387. @click="xzjl(), xzImportVisible = true">{{ $t('Viewtheimporthistory') }}</el-link>
  388. <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false">
  389. <el-button type="primary" style="width:100%;" :loading="isUploading">{{
  390. $t('Selectthefilendstartimporting')
  391. }}</el-button>
  392. </el-upload>
  393. </div>
  394. </el-dialog>
  395. <!--无薪资人员列表-->
  396. <el-dialog :title="$t('wuXinZiRenYuanLieBiao')" v-if="showMissingDialog" :visible.sync="showMissingDialog"
  397. :close-on-click-modal="false" customClass="customWidth" width="600px">
  398. <el-table :data="missingFinanceUserList" highlight-current-row v-loading="listLoading" :height="400"
  399. style="width: 100%;">
  400. <el-table-column type="index"></el-table-column>
  401. <el-table-column prop="jobNumber" :label="$t('Worknumber')" sortable></el-table-column>
  402. <el-table-column prop="name" :label="$t('lable.name')">
  403. <template slot-scope="scope">
  404. <span v-if="user.userNameNeedTranslate == '1'">
  405. <TranslationOpenDataText type='userName' :openid='scope.row.name'></TranslationOpenDataText>
  406. </span>
  407. <span v-if="user.userNameNeedTranslate != '1'">{{ scope.row.name }}</span>
  408. </template>
  409. </el-table-column>
  410. </el-table>
  411. <div slot="footer" class="dialog-footer">
  412. <div style="float:left;color:#ff9900;">{{
  413. $t('yiShangRenYuanDangYueYiTianXieGongShiQingDaoRuTaMenDeXinZi') }}
  414. </div>
  415. <el-button type="primary" @click="showMissingDialog = false">{{ $t('Shutdown') }}</el-button>
  416. </div>
  417. </el-dialog>
  418. <el-dialog :title="$t('Customizesalaryitems')" show-header="false" v-if="itemDialog" :visible.sync="itemDialog"
  419. :close-on-click-modal="false" customClass="customWidth" width="500px" top="20px">
  420. <div style="margin-left:30px;">
  421. <!-- 111 -->
  422. <p><el-input size="medium" v-model.trim="customCols.monthCost"
  423. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  424. maxlength="8"></el-input>
  425. <template v-if="customCols.monthCost != null && customCols.monthCost != ''">
  426. {{ $t('Addttotalcost') }}
  427. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="1"
  428. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  429. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="0">{{ $t('state.no')
  430. }}</el-radio>
  431. </template>
  432. </p>
  433. <p><el-input size="medium" v-model.trim="customCols.bonus"
  434. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  435. maxlength="8"></el-input>
  436. <template v-if="customCols.bonus != null && customCols.bonus != ''">
  437. {{ $t('Addttotalcost') }}
  438. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="1"
  439. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  440. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="0">{{ $t('state.no')
  441. }}</el-radio>
  442. </template>
  443. </p>
  444. <p><el-input size="medium" v-model.trim="customCols.allowance"
  445. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  446. maxlength="8"></el-input>
  447. <template v-if="customCols.allowance != null && customCols.allowance != ''">
  448. {{ $t('Addttotalcost') }}
  449. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="1"
  450. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  451. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="0">{{ $t('state.no')
  452. }}</el-radio>
  453. </template>
  454. </p>
  455. <p><el-input size="medium" v-model.trim="customCols.insuranceOld"
  456. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  457. maxlength="8"></el-input>
  458. <template v-if="customCols.insuranceOld != null && customCols.insuranceOld != ''">
  459. {{ $t('Addttotalcost') }}
  460. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="1"
  461. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  462. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="0">{{ $t('state.no')
  463. }}</el-radio>
  464. </template>
  465. </p>
  466. <p><el-input size="medium" v-model.trim="customCols.insuranceMedical"
  467. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  468. maxlength="8"></el-input>
  469. <template v-if="customCols.insuranceMedical != null && customCols.insuranceMedical != ''">
  470. {{ $t('Addttotalcost') }}
  471. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="1"
  472. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  473. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="0">{{
  474. $t('state.no') }}</el-radio>
  475. </template>
  476. </p>
  477. <p><el-input size="medium" v-model.trim="customCols.insuranceLosejob"
  478. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  479. maxlength="8"></el-input>
  480. <template v-if="customCols.insuranceLosejob != null && customCols.insuranceLosejob != ''">
  481. {{ $t('Addttotalcost') }}
  482. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="1"
  483. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  484. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="0">{{
  485. $t('state.no') }}</el-radio>
  486. </template>
  487. </p>
  488. <p><el-input size="medium" v-model.trim="customCols.insuranceInjury"
  489. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  490. maxlength="8"></el-input>
  491. <template v-if="customCols.insuranceInjury != null && customCols.insuranceInjury != ''">
  492. {{ $t('Addttotalcost') }}
  493. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="1"
  494. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  495. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="0">{{
  496. $t('state.no') }}</el-radio>
  497. </template>
  498. </p>
  499. <p><el-input size="medium" v-model.trim="customCols.houseFund"
  500. :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px"
  501. maxlength="8"></el-input>
  502. <template v-if="customCols.houseFund != null && customCols.houseFund != ''">
  503. {{ $t('Addttotalcost') }}
  504. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="1"
  505. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  506. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="0">{{ $t('state.no')
  507. }}</el-radio>
  508. </template>
  509. </p>
  510. <p><el-input size="medium" v-model.trim="customCols.field1"
  511. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem1')" style="width:200px;margin-right:20px"
  512. maxlength="8"></el-input>
  513. <template v-if="customCols.field1 != null && customCols.field1 != ''">
  514. {{ $t('Addttotalcost') }}
  515. <el-radio size="medium" v-model="customCols.field1Calculate" :label="1"
  516. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  517. <el-radio size="medium" v-model="customCols.field1Calculate" :label="0">{{ $t('state.no')
  518. }}</el-radio>
  519. </template>
  520. </p>
  521. <p><el-input size="medium" v-model.trim="customCols.field2"
  522. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem2')" style="width:200px;margin-right:20px"
  523. maxlength="8"></el-input>
  524. <template v-if="customCols.field2 != null && customCols.field2 != ''">
  525. {{ $t('Addttotalcost') }}
  526. <el-radio size="medium" v-model="customCols.field2Calculate" :label="1"
  527. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  528. <el-radio size="medium" v-model="customCols.field2Calculate" :label="0">{{ $t('state.no')
  529. }}</el-radio>
  530. </template>
  531. </p>
  532. <p><el-input size="medium" v-model.trim="customCols.field3"
  533. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem3')" style="width:200px;margin-right:20px"
  534. maxlength="8"></el-input>
  535. <template v-if="customCols.field3 != null && customCols.field3 != ''">
  536. {{ $t('Addttotalcost') }}
  537. <el-radio size="medium" v-model="customCols.field3Calculate" :label="1"
  538. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  539. <el-radio size="medium" v-model="customCols.field3Calculate" :label="0">{{ $t('state.no')
  540. }}</el-radio>
  541. </template>
  542. </p>
  543. <p><el-input size="medium" v-model.trim="customCols.field4"
  544. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem4')" style="width:200px;margin-right:20px"
  545. maxlength="8"></el-input>
  546. <template v-if="customCols.field4 != null && customCols.field4 != ''">
  547. {{ $t('Addttotalcost') }}
  548. <el-radio size="medium" v-model="customCols.field4Calculate" :label="1"
  549. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  550. <el-radio size="medium" v-model="customCols.field4Calculate" :label="0">{{ $t('state.no')
  551. }}</el-radio>
  552. </template>
  553. </p>
  554. <p><el-input size="medium" v-model.trim="customCols.field5"
  555. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem5')" style="width:200px;margin-right:20px"
  556. maxlength="8"></el-input>
  557. <template v-if="customCols.field5 != null && customCols.field5 != ''">
  558. {{ $t('Addttotalcost') }}
  559. <el-radio size="medium" v-model="customCols.field5Calculate" :label="1"
  560. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  561. <el-radio size="medium" v-model="customCols.field5Calculate" :label="0">{{ $t('state.no')
  562. }}</el-radio>
  563. </template>
  564. </p>
  565. <p><el-input size="medium" v-model.trim="customCols.field6"
  566. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem6')" style="width:200px;margin-right:20px"
  567. maxlength="8"></el-input>
  568. <template v-if="customCols.field6 != null && customCols.field6 != ''">
  569. {{ $t('Addttotalcost') }}
  570. <el-radio size="medium" v-model="customCols.field6Calculate" :label="1"
  571. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  572. <el-radio size="medium" v-model="customCols.field6Calculate" :label="0">{{ $t('state.no')
  573. }}</el-radio>
  574. </template>
  575. </p>
  576. <p><el-input size="medium" v-model.trim="customCols.field7"
  577. :placeholder="$t('Pleaseenterthenameofcustomsalaryitem7')" style="width:200px;margin-right:20px"
  578. maxlength="8"></el-input>
  579. <template v-if="customCols.field7 != null && customCols.field7 != ''">
  580. {{ $t('Addttotalcost') }}
  581. <el-radio size="medium" v-model="customCols.field7Calculate" :label="1"
  582. style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  583. <el-radio size="medium" v-model="customCols.field7Calculate" :label="0">{{ $t('state.no')
  584. }}</el-radio>
  585. </template>
  586. </p>
  587. </div>
  588. <div slot="footer" class="dialog-footer">
  589. <el-button type="primary" @click="itemDialog = false">{{ $t('Shutdown') }}</el-button>
  590. <el-button type="primary" @click="saveItems()">{{ $t('save') }}</el-button>
  591. </div>
  592. </el-dialog>
  593. <el-dialog :title="date + $t('weekDay.month') + ' ' + $t('Noallocationratioofprojectworkinghoursisset')"
  594. show-header="false" v-if="settingDialog" :visible.sync="settingDialog" :close-on-click-modal="false"
  595. customClass="customWidth" width="1200px">
  596. <div>
  597. <div>
  598. <el-button :disabled="multipleSelection.length == 0" @click="setPercent(true, null)">{{
  599. $t('BatchSettingProportion') }}</el-button>
  600. <el-button :disabled="projectCols.length == 0 || userCostSettingList.length == 0"
  601. @click="getLastMonthSetting">{{ $t('UselastmonthscaleSettings') }}</el-button>
  602. <!-- <el-button @click="showSelectProjectDialog">{{date}} 月待分摊项目设置</el-button> -->
  603. <el-button @click="showSelectProjectDialog">{{ date }}{{ $t('Monthlyprojecttobeapportioned')
  604. }}</el-button>
  605. <el-button @click="intoAmortizationRatio">{{ $t('Importallocationratio') }}</el-button>
  606. </div>
  607. <el-table :data="userCostSettingList" highlight-current-row v-loading="costSettingLoading"
  608. ref="settingTable" @selection-change="handleSelectionChange" :height="400" style="width: 100%;">
  609. <el-table-column type="selection" width="55"></el-table-column>
  610. <el-table-column prop="name" :label="$t('lable.name')" sortable width="90" fixed="left">
  611. <template slot-scope="scope">
  612. <div>
  613. <span v-if="user.userNameNeedTranslate == '1'">
  614. <TranslationOpenDataText type='userName' :openid='scope.row.name'>
  615. </TranslationOpenDataText>
  616. </span>
  617. <span v-if="user.userNameNeedTranslate != '1'">{{ scope.row.name }}</span>
  618. </div>
  619. </template>
  620. </el-table-column>
  621. <el-table-column :label="item.projectCode + '/' + item.projectName" v-for="(item) in projectCols"
  622. width="180" size="small" :key="item.id" align="center">
  623. <template slot-scope="scope">
  624. <span>{{ scope.row[item.projectId] }}</span>%
  625. </template>
  626. </el-table-column>
  627. <el-table-column :label="$t('Settheproportion')" width="80" fixed="right">
  628. <template slot-scope="scope">
  629. <el-button size="small" @click="setPercent(false, scope.row)">{{ $t('setup') }}</el-button>
  630. </template>
  631. </el-table-column>
  632. </el-table>
  633. </div>
  634. <div slot="footer" class="dialog-footer">
  635. <el-button type="primary" @click="settingDialog = false">{{ $t('Shutdown') }}</el-button>
  636. <el-button type="primary" @click="saveMonthSetting()">{{ $t('save') }}</el-button>
  637. </div>
  638. </el-dialog>
  639. <el-dialog :title="date + $t('projectstobe assessed')" show-header="false" v-if="projectsDialog"
  640. :visible.sync="projectsDialog" :close-on-click-modal="false" customClass="customWidth" width="1000px">
  641. <el-select v-model="chosenProjects" multiple filterable clearable style="width:100%">
  642. <el-option v-for="item in allProjectList" :label="item.projectName" :key="item.id"
  643. :value="item.id"></el-option>
  644. </el-select>
  645. <el-checkbox v-model="chosenProjectsChecked" @change="chosenProjectsCheckedClick" style="margin: 20px 0;">{{
  646. chosenProjectsChecked ? $t('Deselectallitems') :
  647. $t('Selectallitems') }}</el-checkbox>
  648. <div slot="footer" class="dialog-footer">
  649. <el-button type="default" @click="projectsDialog = false">{{ $t('Shutdown') }}</el-button>
  650. <el-button type="primary" @click="saveProjectSetting()">{{ $t('btn.determine') }}</el-button>
  651. </div>
  652. </el-dialog>
  653. <el-dialog :title="proSetting.ymonth + $t('projectstobe assessed')" show-header="false" v-if="projSettingDialog"
  654. :visible.sync="projSettingDialog" :close-on-click-modal="false" customClass="customWidth" width="1000px">
  655. <el-radio-group v-model="proSetting.settingType" style="margin-top:15px;">
  656. <el-radio :label=0>{{ $t('quanBuYiTianBaoXiangMu') }}</el-radio>
  657. <el-radio :label=1>{{ $t('xuanZeBuFenXiangMu') }}</el-radio>
  658. <el-radio :label=2>{{ $t('paiChuBuFenXiangMu') }}</el-radio>
  659. </el-radio-group>
  660. <el-select v-model="proSettingChosenProjects" multiple filterable clearable
  661. style="width:100%;margin-top:10px;" v-show="proSetting.settingType > 0" @change="updateChosenView()">
  662. <el-option v-for="item in allProjectList" :key="item.id"
  663. :label="item.projectName + '/' + item.projectCode" :value="item.id">
  664. <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
  665. <span style="float: right;font-size: 13px;">{{ item.projectName }}</span>
  666. </el-option>
  667. </el-select>
  668. <div slot="footer" class="dialog-footer">
  669. <el-button type="default" @click="projSettingDialog = false">{{ $t('Shutdown') }}</el-button>
  670. <el-button type="primary" @click="saveCostProjectSetting()">{{ $t('btn.determine') }}</el-button>
  671. </div>
  672. </el-dialog>
  673. <el-dialog :title="$t('allocationdata')" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog"
  674. customClass="customWidth" width="500px">
  675. <p>{{ '1.' + $t('other.download') }}
  676. <el-link v-if="financialFlg" type="primary" style="margin-left:5px;" :underline="false"
  677. :href="'./upload/' + $t('allocationImporttemplates') + '.xlsx'"
  678. :download="$t('allocationImporttemplates') + '.xlsx'">{{ $t('allocationImporttemplates') + '.xlsx'
  679. }}</el-link>
  680. <el-link v-else type="primary" style="margin-left:5px;" :underline="false" @click="financialClick()">{{
  681. $t('allocationImporttemplates') + '.xlsx' }}</el-link>
  682. </p>
  683. <p>{{ '2.' + $t('other.projectsAndPeopleInThetemplate') }}</p>
  684. <p style="display: flex;justify-content: center;padding:1em 0">
  685. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  686. <el-button type="primary" :underline="false" :loading="importingData">{{ $t('other.startImporting')
  687. }}</el-button>
  688. </el-upload>
  689. </p>
  690. </el-dialog>
  691. <el-dialog :title="$t('eachitemofemployeecost')" show-header="false" v-if="setPercentDialog"
  692. :visible.sync="setPercentDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  693. <div style="margin:0px 10px 10px 10px;">
  694. <span>{{ $t('Selecttheemployee') }}</span>
  695. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="chosenNoReportUserIds" multiple filterable
  696. clearable style="width:330px;" collapse-tags>
  697. <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id"
  698. :value="item.userId"></el-option>
  699. </el-select>
  700. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList"
  701. :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'small'"></selectCat>
  702. <el-button @click="averageCost">{{ $t('Automaticallocation') }}</el-button>
  703. </div>
  704. <el-divider></el-divider>
  705. <!--项目列表 -->
  706. <el-form v-model="curPercentVal" label-width="365px" style="margin-top:10px;">
  707. <div class="nameList">
  708. <el-form-item v-for="item in projectCols" :label="item.projectName" :key="item.projectId">
  709. {{ $t('Accountedfor') + ':' }}<el-input v-model="curPercentVal[item.projectId]"
  710. style="width:100px;" @input="updatePercentValue"></el-input>&nbsp;%
  711. </el-form-item>
  712. </div>
  713. <el-form-item>
  714. {{ $t('totalpercentage') + ':' }}{{ totalPercent }}&nbsp;%
  715. </el-form-item>
  716. </el-form>
  717. <div slot="footer" class="dialog-footer">
  718. <el-button type="default" @click="setPercentDialog = false">{{ $t('Shutdown') }}</el-button>
  719. <el-button type="primary" @click="setPercentSetting()">{{ $t('btn.determine') }}</el-button>
  720. </div>
  721. </el-dialog>
  722. <!-- 导入结果说明 -->
  723. <el-dialog :title="$t('importingtheallocationratio')" v-if="showImportResult" :visible.sync="showImportResult"
  724. customClass="customWidth" width="500px">
  725. <div>
  726. <span>{{ importResultMsg }}</span>
  727. </div>
  728. <span slot="footer" class="dialog-footer">
  729. <el-button type="primary" @click="showImportResult = false">{{ $t('btn.determine') }}</el-button>
  730. </span>
  731. </el-dialog>
  732. <el-dialog :title="$t('AmortizedDataExport')" v-if="exportFinanceDialog" :visible.sync="exportFinanceDialog"
  733. :close-on-click-modal="false" customClass="customWidth" width="500px">
  734. <div style="margin:30px;">
  735. <el-radio-group v-model="groupByCategory">
  736. <el-radio :label="0">{{ $t('Exportbyproject') }}</el-radio>
  737. <el-radio :label="1">{{ $t('Exportbprojectcategory') }}</el-radio>
  738. </el-radio-group>
  739. <div style="margin-top: 20px;">
  740. <el-checkbox v-model="personnelAllocation">含人员分摊明细</el-checkbox>
  741. </div>
  742. </div>
  743. <div slot="footer" class="dialog-footer">
  744. <el-button @click="exportData" :loading="exportDataProcessing" type="primary">{{ $t('export.export')
  745. }}</el-button>
  746. </div>
  747. </el-dialog>
  748. </section>
  749. </template>
  750. <style scoped>
  751. .line {
  752. padding: 10px;
  753. }
  754. .line span {
  755. font-size: 18px;
  756. }
  757. .line span:nth-child(even) {
  758. float: right;
  759. }
  760. </style>
  761. <style>
  762. .customWidth .el-dialog__body {
  763. padding-top: 0;
  764. padding-bottom: 0;
  765. }
  766. </style>
  767. <script>
  768. import { error } from 'dingtalk-jsapi';
  769. import util from "../../../common/js/util";
  770. // 自定义select组件
  771. import selectCat from "@/components/select.vue"
  772. // 引入自定义级联组件
  773. import vueCascader from "@/components/cascader.vue"
  774. import dayjs from 'dayjs';
  775. export default {
  776. components: {
  777. selectCat,
  778. vueCascader
  779. },
  780. props: {
  781. typeOfFunds: {
  782. type: String,
  783. default: () => 'FINANCIAL_DETAILS'
  784. }
  785. },
  786. data() {
  787. return {
  788. proSettingChosenProjects: [],
  789. proSetting: {
  790. ymonth: null, settingType: 0,
  791. },
  792. projSettingDialog: false,
  793. operating: false,
  794. showMissingDialog: false,
  795. missingFinanceUserList: [],
  796. groupByCategory: 0,
  797. personnelAllocation: true,
  798. exportFinanceDialog: false,
  799. exportMonth: null,
  800. exportDialog: false,
  801. headerCols: ['monthCost', 'bonus', 'allowance', 'insuranceOld', 'insuranceMedical', 'insuranceLosejob', 'insuranceInjury', 'houseFund', 'customField1', 'customField2', 'customField3', 'customField4', 'customField5', 'customField6', 'customField7'],
  802. tblCols: [],
  803. costListRadio: 1,
  804. costSettingLoading: false,
  805. chosenNoReportUserIds: [],
  806. curPercentVal: {},
  807. setPercentDialog: false,
  808. chosenProjects: [],
  809. projectsDialog: false,
  810. projectCols: [],
  811. allProjectList: [],
  812. multipleSelection: [],
  813. userCostSettingList: [],
  814. settingDialog: false,
  815. radio: this.$t('lable.allStaff'),
  816. noReportUserList: [],
  817. allFinanceList: [],
  818. assignNoProUser: false,
  819. customFieldList: [],
  820. itemDialog: false,
  821. customCols: {},
  822. customColsi: {},
  823. // showNPDialog: false,
  824. npUserList: [],
  825. hasNoProjectUsers: false,
  826. isUploading: false,
  827. importDialog: false,
  828. importParam: { syncUserCost: true, syncHistoryReport: true },
  829. user: JSON.parse(sessionStorage.getItem("user")),
  830. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  831. userDetailVisible: false,
  832. userDetail: {},
  833. date: null,
  834. tableHeight: 0,
  835. listLoading: false,
  836. list: [],
  837. addLoading: false,
  838. myChart: null,
  839. params: null,
  840. totalPercent: 0,
  841. importVisible: false,
  842. shenhe: '',
  843. tabPosition: '0',
  844. reviewerVisible: false,
  845. reviewerRuleForm: {
  846. auditorId: ''
  847. },
  848. people: [],
  849. revaelse: '',
  850. reviewLis: [],
  851. ovReviewLis: [],
  852. xzImportVisible: false,
  853. xzList: [],
  854. intoAmortizationDialog: false,
  855. importingData: false,
  856. importResultMsg: null,
  857. showImportResult: false,
  858. widthHtval: document.body.clientWidth - 230,
  859. deleteSelList: [],
  860. chosenProjectsChecked: false,
  861. exportDataProcessing: false,
  862. financialFlg: false,
  863. projectAllList: [], // 全部项目
  864. selectProjectList: [], // 分摊选中的项目
  865. notParticipatingInSharedProjectsValue: [],
  866. notParticipatingInSharedProjectsVisable: false,
  867. notParticipatingInSharedProjectsTitle: '',
  868. notParticipatingInSharedProjectsLoading: false,
  869. notParticipatingInSharedAllProject: false,
  870. notParticipatingInSharedProjectDisabled: false,
  871. departmentId: '',
  872. departmentArray: []
  873. };
  874. },
  875. methods: {
  876. // 获取部门列表
  877. getDepartment() {
  878. this.http.post(
  879. this.port.manage.depList,
  880. {},
  881. (res) => {
  882. if (res.code == "ok") {
  883. var list = res.data,
  884. list1 = JSON.parse(JSON.stringify(res.data));
  885. list.splice(0, 0, {
  886. id: -1,
  887. label: this.$t('lable.allStaff'),
  888. });
  889. list.push({
  890. id: 0,
  891. label: this.$t('lable.unassigned'),
  892. });
  893. this.departmentArray = this.changeArr(list1);
  894. } else {
  895. this.$message({
  896. message: res.msg,
  897. type: "error",
  898. });
  899. }
  900. },
  901. (error) => {
  902. this.$message({
  903. message: error,
  904. type: "error",
  905. });
  906. }
  907. );
  908. },
  909. // 修改数组
  910. changeArr(arr) {
  911. for (var i = 0; i < arr.length; i++) {
  912. if (arr[i].id != -1 && arr[i].id != 0) {
  913. if (arr[i].children != null && arr[i].children.length > 0) {
  914. arr[i].children = this.changeArr(arr[i].children);
  915. }
  916. arr[i].id && (arr[i].value = arr[i].id);
  917. delete arr[i].id;
  918. }
  919. }
  920. for (var i in arr) {
  921. if (arr[i].id == -1 || arr[i].id == 0) {
  922. arr.splice(i, 1);
  923. }
  924. }
  925. return arr;
  926. },
  927. switchMenu() {
  928. this.$emit('switchMenu')
  929. },
  930. selectAllItems() {
  931. if (this.notParticipatingInSharedAllProject) {
  932. this.notParticipatingInSharedProjectDisabled = true
  933. } else {
  934. this.notParticipatingInSharedProjectDisabled = false
  935. }
  936. },
  937. getTheCurrentMonth() {
  938. const d = new Date();
  939. const data = d.getFullYear() + '-' + ((d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1);
  940. return data
  941. },
  942. getAllocateSelectedItems() {
  943. this.http.get(`/financeExcludeProject/getProjects?useYM=${this.date || this.getTheCurrentMonth()}`, res => {
  944. const { isAll = 0, projectList } = res.data
  945. this.selectProjectList = projectList || []
  946. this.notParticipatingInSharedAllProject = isAll ? true : false
  947. })
  948. },
  949. getAllProjectList() {
  950. this.http.post('/project/getProjectList', {
  951. pageIndex: -1,
  952. pageSize: -1
  953. }, res => {
  954. this.projectAllList = res.data
  955. })
  956. },
  957. submitNotParticipatingInSharedProject() {
  958. // if((!this.notParticipatingInSharedProjectsValue || this.notParticipatingInSharedProjectsValue.length <= 0) && !this.notParticipatingInSharedAllProject) {
  959. // this.$message({
  960. // message: '请选择项目',
  961. // type: 'warning'
  962. // })
  963. // return
  964. // }
  965. this.notParticipatingInSharedProjectsLoading = true
  966. this.http.post('/financeExcludeProject/addOrUpdateProjects', {
  967. projects: this.notParticipatingInSharedProjectsValue,
  968. useYM: this.date,
  969. isAll: this.notParticipatingInSharedAllProject ? 1 : 0
  970. }, res => {
  971. this.notParticipatingInSharedProjectsLoading = false
  972. if (res.code == 'ok') {
  973. this.$message({
  974. message: '操作成功',
  975. type: 'success'
  976. })
  977. this.notParticipatingInSharedProjectsVisable = false
  978. this.loadMonthData()
  979. // this.getAllocateSelectedItems()
  980. } else {
  981. this.$message({
  982. message: res.msg,
  983. type: 'error'
  984. })
  985. }
  986. }, err => {
  987. this.notParticipatingInSharedProjectsLoading = false
  988. this.$message({
  989. message: err,
  990. type: 'error'
  991. })
  992. })
  993. },
  994. getMonthProjSetting() {
  995. this.http.post('/cost-project-setting/get', { companyId: this.user.companyId, ymonth: this.date }, res => {
  996. if (res.code == 'ok') {
  997. if (res.data.setting != null) {
  998. this.proSetting = res.data.setting;
  999. this.proSettingChosenProjects = JSON.parse(this.proSetting.projectJson);
  1000. }
  1001. if (this.allProjectList == null || this.allProjectList.length == 0) {
  1002. this.allProjectList = res.data.allProjectList;
  1003. }
  1004. } else {
  1005. this.$message({
  1006. message: res.msg,
  1007. type: 'error'
  1008. })
  1009. }
  1010. }, err => {
  1011. this.$message({
  1012. message: err,
  1013. type: 'error'
  1014. })
  1015. })
  1016. },
  1017. saveCostProjectSetting() {
  1018. //处理选中的项目
  1019. if (this.proSetting.settingType == 0) {
  1020. this.proSetting.projectJson = '[]';
  1021. } else {
  1022. this.proSetting.projectJson = JSON.stringify(this.proSettingChosenProjects);
  1023. }
  1024. this.http.post('/cost-project-setting/save', this.proSetting, res => {
  1025. if (res.code == 'ok') {
  1026. this.$message({
  1027. message: this.$t('savesuccess'),
  1028. type: 'success'
  1029. })
  1030. this.projSettingDialog = false;
  1031. //刷新分摊数据显示
  1032. this.assignToProject();
  1033. } else {
  1034. this.$message({
  1035. message: res.msg,
  1036. type: 'error'
  1037. })
  1038. }
  1039. }, err => {
  1040. this.$message({
  1041. message: er,
  1042. type: 'error'
  1043. })
  1044. })
  1045. },
  1046. uploadTest() {
  1047. this.http.post('/report/uploadThirdReportData', {
  1048. yearMonth: this.date
  1049. }, res => {
  1050. if (res.code == 'ok') {
  1051. this.$message({
  1052. message: this.$t('uploadedsuccessfully'),
  1053. type: 'success'
  1054. })
  1055. } else {
  1056. this.$message({
  1057. message: res.msg,
  1058. type: 'error'
  1059. })
  1060. }
  1061. }, err => {
  1062. this.$message({
  1063. message: er,
  1064. type: 'error'
  1065. })
  1066. })
  1067. },
  1068. chosenProjectsCheckedClick() {
  1069. if (this.chosenProjectsChecked) {
  1070. let arr = []
  1071. for (let i in this.allProjectList) {
  1072. arr.push(this.allProjectList[i].id)
  1073. }
  1074. this.chosenProjects = arr
  1075. } else {
  1076. this.chosenProjects = []
  1077. }
  1078. },
  1079. deleteSel(sel) {
  1080. this.deleteSelList = sel
  1081. // console.log(sel);
  1082. },
  1083. deleteUsers() {
  1084. this.$confirm(this.$t(this.$t('doyouwanttodeleteit')), this.$t('other.prompts'), {
  1085. confirmButtonText: this.$t('btn.determine'),
  1086. cancelButtonText: this.$t('btn.cancel'),
  1087. type: 'warning'
  1088. }).then(() => {
  1089. let ids = ''
  1090. for (let i in this.deleteSelList) {
  1091. ids += this.deleteSelList[i].id + ','
  1092. }
  1093. ids = ids.substring(0, ids.length - 1)
  1094. this.http.post('/finance/batchRemove', {
  1095. ids: ids
  1096. }, res => {
  1097. if (res.code == 'ok') {
  1098. this.getList()
  1099. this.$message({
  1100. message: this.$t('message.successfullyDeleted'),
  1101. type: 'success'
  1102. })
  1103. } else {
  1104. this.$message({
  1105. message: res.msg,
  1106. type: 'error'
  1107. })
  1108. }
  1109. }, err => {
  1110. this.$message({
  1111. message: err,
  1112. type: 'error'
  1113. })
  1114. })
  1115. }).catch(() => {
  1116. this.$message({
  1117. type: 'info',
  1118. message: this.$t('thedeletionhasbeencancelled')
  1119. })
  1120. })
  1121. },
  1122. exportFinance() {
  1123. this.isUploading = true;
  1124. this.http.post('/finance/exportFinance', {
  1125. date: this.exportMonth,
  1126. deptId: this.departmentId[this.departmentId.length - 1]
  1127. }, res => {
  1128. this.isUploading = false;
  1129. if (res.code == 'ok') {
  1130. this.downloadByA({ name: this.exportMonth + this.$t('financialdata') + '.xlsx', url: res.data });
  1131. }
  1132. }, error => {
  1133. this.$message({
  1134. message: error,
  1135. type: "error"
  1136. });
  1137. })
  1138. },
  1139. arrter() {
  1140. this.http.post('/user/getEmployeeList', {
  1141. departmentId: '-1',
  1142. pageIndex: 1,
  1143. // pageSize: 99999
  1144. pageSize: -1
  1145. }, res => {
  1146. if (res.code == 'ok') {
  1147. this.people = res.data.records
  1148. }
  1149. }, error => {
  1150. this.$message({
  1151. message: error,
  1152. type: "error"
  1153. });
  1154. })
  1155. },
  1156. addreviewer() {
  1157. this.http.post('/finance-auditor/get', {
  1158. companyId: this.user.companyId
  1159. },
  1160. res => {
  1161. if (res.code == "ok") {
  1162. // console.log(res.data, '数据')
  1163. if (res.data) {
  1164. this.reviewerRuleForm.auditorId = res.data.auditorId
  1165. } else {
  1166. this.reviewerRuleForm.auditorId = ''
  1167. }
  1168. }
  1169. }, error => {
  1170. this.$message({
  1171. message: error,
  1172. type: "error"
  1173. });
  1174. }
  1175. );
  1176. },
  1177. // 提交审核人
  1178. submitreviewerRuleForm(formName) {
  1179. this.$refs[formName].validate((valid) => {
  1180. if (valid) {
  1181. this.reviewerRuleForm.companyId = this.user.companyId
  1182. this.http.post('/finance-auditor/save', this.reviewerRuleForm,
  1183. res => {
  1184. if (res.code == 'ok') {
  1185. this.$message({
  1186. message: this.$t('operationissuccessful'),
  1187. type: "success"
  1188. });
  1189. this.addreviewer()
  1190. } else {
  1191. this.$message({
  1192. message: this.$t('operationfailure'),
  1193. type: "error"
  1194. });
  1195. }
  1196. }, error => {
  1197. this.$message({
  1198. message: error,
  1199. type: "error"
  1200. });
  1201. })
  1202. this.reviewerVisible = false
  1203. } else {
  1204. return false;
  1205. }
  1206. });
  1207. },
  1208. handleCloses(done) {
  1209. var formName = 'reviewerRuleForm'
  1210. this.$refs[formName].resetFields();
  1211. done()
  1212. },
  1213. // 审核
  1214. audits() {
  1215. this.shenhe = this.$t('importtheaudits')
  1216. this.importVisible = true
  1217. },
  1218. switchCostList() {
  1219. //已填日报的人员成本
  1220. if (this.costListRadio == 1) {
  1221. this.assignNoProUser = false;
  1222. this.assignToProject();
  1223. } else if (this.costListRadio == 2) {
  1224. //全部人员成本
  1225. this.assignNoProUser = true;
  1226. this.assignToProject();
  1227. }
  1228. },
  1229. getLastMonthSetting() {
  1230. this.costSettingLoading = true;
  1231. var dataArr = this.date.split('-');
  1232. var year = dataArr[0];
  1233. var month = dataArr[1];
  1234. if (parseInt(month) == 1) {
  1235. year = parseInt(year) - 1;
  1236. month = 12;
  1237. } else {
  1238. month = parseInt(month) - 1;
  1239. if (month < 10) {
  1240. month = '0' + month;
  1241. }
  1242. }
  1243. var lastMonth = year + '-' + month;
  1244. this.http.post('/project-percentage/getMonthSetting', { ymonth: lastMonth },
  1245. res => {
  1246. this.costSettingLoading = false;
  1247. if (res.code == "ok") {
  1248. this.projectCols = res.data.financeProjects;
  1249. this.allProjectList = res.data.allProjectList;
  1250. this.userCostSettingList = res.data.userCostSetting;
  1251. //上次如果没有配置过,需要初始化
  1252. for (var i = 0; i < this.noReportUserList.length; i++) {
  1253. var rUser = this.noReportUserList[i];
  1254. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  1255. if (this.userCostSettingList.filter(c => c.id == rUser.userId).length == 0) {
  1256. var item = { name: rUser.name, id: rUser.userId };
  1257. this.projectCols.forEach(p => {
  1258. item[p.projectId] = 0;
  1259. });
  1260. this.userCostSettingList.push(item);
  1261. }
  1262. }
  1263. this.$nextTick(() => {
  1264. this.$refs.settingTable.doLayout();
  1265. })
  1266. }
  1267. });
  1268. },
  1269. // 补齐注释,一月三十号
  1270. financialClick() {
  1271. this.http.post('/project-percentage/getTemplate', { ymonth: this.date },
  1272. res => {
  1273. if (res.code == "ok") {
  1274. let fName = this.$t('allocationImporttemplates') + '.xlsx'
  1275. var filePath = res.data;
  1276. const a = document.createElement('a'); // 创建a标签
  1277. a.setAttribute('download', fName);// download属性
  1278. a.setAttribute('href', filePath);// href链接
  1279. a.click(); //自执行点击事件
  1280. a.remove();
  1281. } else {
  1282. this.$message({
  1283. message: res.msg,
  1284. type: "error"
  1285. });
  1286. }
  1287. });
  1288. },
  1289. //获取当月的无项目工时人员的分配比例设置
  1290. getMonthSetting() {
  1291. this.costSettingLoading = true;
  1292. this.http.post('/project-percentage/getMonthSetting', { ymonth: this.date },
  1293. res => {
  1294. this.costSettingLoading = false;
  1295. if (res.code == "ok") {
  1296. this.projectCols = res.data.financeProjects;
  1297. this.allProjectList = res.data.allProjectList;
  1298. this.userCostSettingList = res.data.userCostSetting;
  1299. if (res.data.financeProjects.length <= 0 && res.data.userCostSetting <= 0) {
  1300. this.financialFlg = true
  1301. } else {
  1302. this.financialFlg = false
  1303. }
  1304. //上次如果没有配置过,需要初始化
  1305. for (var i = 0; i < this.noReportUserList.length; i++) {
  1306. var rUser = this.noReportUserList[i];
  1307. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  1308. if (this.userCostSettingList.filter(c => c.id == rUser.userId).length == 0) {
  1309. var item = { name: rUser.name, id: rUser.userId };
  1310. this.projectCols.forEach(p => {
  1311. item[p.projectId] = 0;
  1312. });
  1313. this.userCostSettingList.push(item);
  1314. }
  1315. }
  1316. this.$nextTick(() => {
  1317. this.$refs.settingTable.doLayout();
  1318. })
  1319. }
  1320. });
  1321. },
  1322. //提交无工时人员的分配设置
  1323. saveMonthSetting() {
  1324. //检查数据是否都分配到100%了,防止由于修改了项目列而导致之前的数据不正确的情况
  1325. var errorList = this.userCostSettingList.filter(u => {
  1326. let totalPercent = 0.00;
  1327. this.projectCols.forEach(p => {
  1328. totalPercent += parseFloat(u[p.projectId]);
  1329. });
  1330. totalPercent = totalPercent.toFixed(2);
  1331. if (totalPercent != 100) {
  1332. return true;
  1333. } else {
  1334. return false;
  1335. }
  1336. });
  1337. if (errorList.length > 0) {
  1338. var nameList = errorList.map(e => e.name);
  1339. this.$message({ type: 'error', message: this.$t('proportionofassignedpersonnelisnot ') + '100%:' + nameList });
  1340. return;
  1341. }
  1342. this.http.post('/project-percentage/saveMonthSetting', {
  1343. projectCols: JSON.stringify(this.projectCols),
  1344. ymonth: this.date, userSettings: JSON.stringify(this.userCostSettingList)
  1345. },
  1346. res => {
  1347. if (res.code == "ok") {
  1348. this.$message({ type: 'success', message: this.$t('savesuccess') });
  1349. this.settingDialog = false;
  1350. } else {
  1351. this.$message({ type: 'error', message: this.$t('erroroccurred') + ':' + res.msg });
  1352. }
  1353. });
  1354. },
  1355. updatePercentValue() {
  1356. var total = 0.0;
  1357. this.projectCols.forEach(p => {
  1358. total += parseFloat(this.curPercentVal[p.projectId]);
  1359. })
  1360. this.totalPercent = total.toFixed(2);
  1361. this.$forceUpdate();
  1362. },
  1363. averageCost() {
  1364. var avg = (100 / this.projectCols.length).toFixed(1);
  1365. //最后一个用100减去前面的总和,保证最终合计为100
  1366. for (var i = 0; i < this.projectCols.length; i++) {
  1367. if (i < this.projectCols.length - 1) {
  1368. this.curPercentVal[this.projectCols[i].projectId] = avg;
  1369. } else {
  1370. this.curPercentVal[this.projectCols[i].projectId] = (100 - avg * (this.projectCols.length - 1)).toFixed(1);
  1371. }
  1372. }
  1373. this.updatePercentValue();
  1374. this.$forceUpdate();
  1375. },
  1376. setPercent(isBatch, row) {
  1377. this.setPercentDialog = true;
  1378. this.chosenNoReportUserIds = [];
  1379. if (!isBatch) {
  1380. this.chosenNoReportUserIds.push(row.id);
  1381. //获取当前比例
  1382. this.projectCols.forEach(p => {
  1383. this.curPercentVal[p.projectId] = row[p.projectId];
  1384. });
  1385. } else {
  1386. //批量处理
  1387. this.multipleSelection.forEach(m => {
  1388. this.chosenNoReportUserIds.push(m.id);
  1389. })
  1390. //批量时获取第一条的比例进行加载
  1391. this.projectCols.forEach(p => {
  1392. this.curPercentVal[p.projectId] = this.multipleSelection[0][p.projectId];
  1393. });
  1394. }
  1395. this.updatePercentValue();
  1396. },
  1397. //确认设置的项目列
  1398. saveProjectSetting() {
  1399. this.projectsDialog = false;
  1400. this.projectCols = [];
  1401. this.chosenProjects.forEach(c => {
  1402. var item = this.allProjectList.filter(a => a.id == c)[0];
  1403. this.projectCols.push({ projectId: item.id, projectName: item.projectName, projectCode: item.projectCode });
  1404. });
  1405. this.$nextTick(() => {
  1406. this.$refs.settingTable.doLayout();
  1407. })
  1408. },
  1409. handleProjectSelectionChange(val) {
  1410. this.projectSelection = val;
  1411. },
  1412. showSelectProjectDialog() {
  1413. //设置选中状态
  1414. this.chosenProjects = [];
  1415. this.chosenProjectsChecked = false
  1416. this.projectCols.forEach(item => {
  1417. this.chosenProjects.push(item.projectId);
  1418. })
  1419. this.projectsDialog = true;
  1420. },
  1421. setPercentSetting() {
  1422. //检测是否填写的情况下,是否达到100%
  1423. if (this.totalPercent != 100) {
  1424. this.$message({
  1425. message: this.$t('sumoftheallocationsmustbe'),
  1426. type: "error"
  1427. });
  1428. return;
  1429. }
  1430. this.setPercentDialog = false;
  1431. this.chosenNoReportUserIds.forEach(u => {
  1432. var targetU = this.userCostSettingList.filter(a => a.id == u)[0];
  1433. //遍历项目
  1434. this.projectCols.forEach(p => {
  1435. // targetU[p.projectId] = this.curPercentVal[p.projectId];
  1436. this.$set(targetU, p.projectId, this.curPercentVal[p.projectId]);
  1437. })
  1438. });
  1439. this.userCostSettingList.splice(1, 0);
  1440. },
  1441. showSettingDialog() {
  1442. this.settingDialog = true;
  1443. this.getMonthSetting();
  1444. },
  1445. showProjSettingDialog() {
  1446. this.projSettingDialog = true;
  1447. this.proSetting.ymonth = this.date;
  1448. this.proSetting.companyId = this.user.companyId;
  1449. this.getMonthProjSetting();
  1450. },
  1451. handleSelectionChange(val) {
  1452. this.multipleSelection = val;
  1453. },
  1454. switchList() {
  1455. if (this.radio == this.$t('lable.allStaff')) {
  1456. this.list = this.allFinanceList;
  1457. } else {
  1458. this.list = this.noReportUserList;
  1459. }
  1460. },
  1461. downloadByA(row) {
  1462. const a = document.createElement('a'); // 创建a标签
  1463. a.setAttribute('download', row.name);// download属性
  1464. if (row.url.indexOf('upload/') == -1) {
  1465. row.url = '/upload/' + row.url;
  1466. }
  1467. a.setAttribute('href', row.url);// href链接
  1468. a.click();// 自执行点击事件
  1469. a.remove();
  1470. },
  1471. getTemplate() {
  1472. this.http.post('/finance/getTemplate', { companyId: this.user.companyId },
  1473. res => {
  1474. if (res.code == "ok") {
  1475. if (res.data.indexOf('xlsx') > 0) {
  1476. this.downloadByA({ name: this.$t('financialcoststatement') + '.xlsx', url: res.data });
  1477. } else {
  1478. this.downloadByA({ name: this.$t('financialcoststatement') + '.xls', url: res.data });
  1479. }
  1480. }
  1481. });
  1482. },
  1483. saveItems() {
  1484. // let savefields = {
  1485. // monthCost : this.customCols.monthCost,
  1486. // bonus : this.customCols.bonus,
  1487. // allowance : this.customCols.allowance,
  1488. // insuranceOld : this.customCols.insuranceOld,
  1489. // insuranceMedical : this.customCols.insuranceMedical,
  1490. // insuranceLosejob : this.customCols.insuranceLosejob,
  1491. // insuranceInjury : this.customCols.insuranceInjury,
  1492. // houseFund : this.customCols.houseFund,
  1493. // field1 : this.customCols.field1,
  1494. // field2 : this.customCols.field2,
  1495. // field3 : this.customCols.field3
  1496. // }
  1497. if (this.customCols.field1 != null && this.customCols.field1 != '') {
  1498. if (this.customCols.field1Calculate == null) {
  1499. this.$message({
  1500. message: this.$t('choosewhethertoincludethetotalcost'),
  1501. type: 'warning'
  1502. })
  1503. return
  1504. }
  1505. }
  1506. if (this.customCols.field2 != null && this.customCols.field2 != '') {
  1507. if (this.customCols.field1Calculate == null) {
  1508. this.$message({
  1509. message: this.$t('choosewhethertoincludethetotalcost'),
  1510. type: 'warning'
  1511. })
  1512. return
  1513. }
  1514. }
  1515. if (this.customCols.field3 != null && this.customCols.field3 != '') {
  1516. if (this.customCols.field1Calculate == null) {
  1517. this.$message({
  1518. message: this.$t('choosewhethertoincludethetotalcost'),
  1519. type: 'warning'
  1520. })
  1521. return
  1522. }
  1523. }
  1524. this.http.post('/finance-tblcuscol/save', this.customCols,
  1525. res => {
  1526. if (res.code == "ok") {
  1527. this.itemDialog = false;
  1528. this.getCustomColumn();
  1529. }
  1530. });
  1531. this.$forceUpdate();
  1532. },
  1533. showItemDialog() {
  1534. this.customCols = JSON.parse(JSON.stringify(this.customColsi))
  1535. this.itemDialog = true;
  1536. },
  1537. notParticipatingInSharedProjects() {
  1538. this.notParticipatingInSharedProjectsValue = (this.selectProjectList || []).map(item => item.projectId)
  1539. this.notParticipatingInSharedProjectsTitle = this.date
  1540. this.selectAllItems()
  1541. this.notParticipatingInSharedProjectsVisable = true
  1542. },
  1543. //获取自定义的字段
  1544. getCustomColumn() {
  1545. this.http.post('/finance-tblcuscol/getAll', { companyId: this.user.companyId },
  1546. res => {
  1547. if (res.code == "ok") {
  1548. this.customColsi = res.data;
  1549. this.tblCols = [];
  1550. this.tblCols.push(this.customColsi.monthCost);
  1551. this.tblCols.push(this.customColsi.bonus);
  1552. this.tblCols.push(this.customColsi.allowance);
  1553. this.tblCols.push(this.customColsi.insuranceOld);
  1554. this.tblCols.push(this.customColsi.insuranceMedical);
  1555. this.tblCols.push(this.customColsi.insuranceLosejob);
  1556. this.tblCols.push(this.customColsi.insuranceInjury);
  1557. this.tblCols.push(this.customColsi.houseFund);
  1558. if (this.customColsi.field1 != null) {
  1559. this.tblCols.push(this.customColsi.field1);
  1560. }
  1561. if (this.customColsi.field2 != null) {
  1562. this.tblCols.push(this.customColsi.field2);
  1563. }
  1564. if (this.customColsi.field3 != null) {
  1565. this.tblCols.push(this.customColsi.field3);
  1566. }
  1567. if (this.customColsi.field4 != null) {
  1568. this.tblCols.push(this.customColsi.field4);
  1569. }
  1570. if (this.customColsi.field5 != null) {
  1571. this.tblCols.push(this.customColsi.field5);
  1572. }
  1573. if (this.customColsi.field6 != null) {
  1574. this.tblCols.push(this.customColsi.field6);
  1575. }
  1576. if (this.customColsi.field7 != null) {
  1577. this.tblCols.push(this.customColsi.field7);
  1578. }
  1579. }
  1580. });
  1581. },
  1582. // },
  1583. getProjects() {
  1584. this.http.post('/project/getSimpleProjectList', { companyId: this.user.companyId },
  1585. res => {
  1586. if (res.code == "ok") {
  1587. this.allProjectList = res.data.allProjectList;
  1588. }
  1589. });
  1590. },
  1591. // showNoProjectUsers() {
  1592. // this.showNPDialog = true;
  1593. // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
  1594. // res => {
  1595. // if (res.code == "ok") {
  1596. // this.npUserList = res.data;
  1597. // }});
  1598. // },
  1599. assignToProject() {
  1600. var _this = this;
  1601. this.http.post('/finance/getTimeCost', {
  1602. yearMonth: this.date,
  1603. assignNoProUser: this.assignNoProUser,
  1604. deptId: this.departmentId[this.departmentId.length - 1]
  1605. },
  1606. res => {
  1607. if (res.code == "ok") {
  1608. for (var i in res.data.costList) {
  1609. if (i > 20) {
  1610. this.widthHtval = +this.widthHtval + 40
  1611. } else {
  1612. this.widthHtval = document.body.clientWidth - 230
  1613. }
  1614. }
  1615. // console.log(res.data, '图表数据', this.widthHtval)
  1616. var xList = [], yList = [], list = res.data.costList, totalMoneyCost = res.data.totalMoneyCost;
  1617. //计算costList合计的成本
  1618. var totalC = 0;
  1619. for (var i = 0; i < list.length; i++) {
  1620. totalC += list[i].cost;
  1621. }
  1622. this.missingFinanceUserList = res.data.missingFinanceUserList;
  1623. var nopCost = 0;
  1624. if (res.data.noProjectItem.project != null) {
  1625. this.hasNoProjectUsers = true;
  1626. nopCost = res.data.noProjectItem.cost;
  1627. } else {
  1628. this.hasNoProjectUsers = false;
  1629. }
  1630. for (var i in list) {
  1631. xList.push(list[i].project);
  1632. yList.push({
  1633. "value": list[i].cost,
  1634. "id": list[i].id,
  1635. "time": list[i].workingTime
  1636. });
  1637. }
  1638. var myChart = echarts.init(document.getElementById("container"));
  1639. // 设置图表
  1640. myChart.resize({
  1641. width: this.widthHtval
  1642. })
  1643. _this.myChart = myChart;
  1644. var option = {
  1645. title: {
  1646. text: _this.assignNoProUser ? _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan')
  1647. + (_this.hasNoProjectUsers ? "," + _this.$t('projectpersonnelcostincluded') + nopCost + _this.$t('yuan') : "")
  1648. : _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan'),
  1649. left: 'left',
  1650. },
  1651. grid: {
  1652. top: 40, //距离容器上边界40像素
  1653. // bottom: 100, //距离容器下边界30像素
  1654. bottom: 40, //距离容器下边界30像素
  1655. left: 100,
  1656. right: 100
  1657. },
  1658. // 工具箱
  1659. toolbox: {
  1660. show: true,
  1661. feature: {
  1662. saveAsImage: {
  1663. show: true
  1664. },
  1665. restore: {
  1666. show: true
  1667. },
  1668. magicType: {
  1669. type: ['line', 'bar']
  1670. },
  1671. }
  1672. },
  1673. tooltip: {
  1674. trigger: 'axis',
  1675. formatter: function (params, ticket, callback) {
  1676. var res = params[0].name + "<br/>" + _this.$t('workcost') + " : " + params[0].data.value
  1677. + _this.$t('yuan') + "<br/>" + _this.$t('screening.workTime') + " : " + params[0].data.time + _this.$t('time.hour');
  1678. _this.params = params;
  1679. return res;
  1680. }
  1681. },
  1682. xAxis: {
  1683. data: xList,
  1684. axisLabel: {
  1685. interval: 0, rotate: 20
  1686. }
  1687. },
  1688. yAxis: [{
  1689. type: 'value',
  1690. axisLabel: {
  1691. formatter: '{value} (' + _this.$t('yuan') + ')'
  1692. }
  1693. }],
  1694. series: [{
  1695. name: _this.$t('screening.workTime') + '(h)',
  1696. type: 'bar',
  1697. barMaxWidth: 30,
  1698. data: yList,
  1699. }]
  1700. };
  1701. option && myChart.setOption(option, { notMerge: true });
  1702. // myChart.getZr().on('click', params => {
  1703. // const pointInPixel = [params.offsetX, params.offsetY];
  1704. // if (myChart.containPixel('grid', pointInPixel)) {
  1705. // console.log(_this.params)
  1706. // if(_this.radio=='项目') {
  1707. // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1708. // }
  1709. // }
  1710. // });
  1711. } else {
  1712. this.$message({
  1713. message: res.msg,
  1714. type: "error"
  1715. });
  1716. }
  1717. },
  1718. error => {
  1719. this.$message({
  1720. message: error,
  1721. type: "error"
  1722. });
  1723. });
  1724. },
  1725. //导出财务数据
  1726. exportData() {
  1727. this.exportDataProcessing = true;
  1728. this.http.post('/finance/exportData', {
  1729. date: this.date,
  1730. assignNoProUser: this.assignNoProUser,
  1731. groupByCategory: this.groupByCategory,
  1732. onlyTotal: this.personnelAllocation ? 1 : 0,
  1733. deptId: this.departmentId[this.departmentId.length - 1]
  1734. },
  1735. res => {
  1736. this.exportDataProcessing = false;
  1737. if (res.code == "ok") {
  1738. this.exportFinanceDialog = false;
  1739. var aTag = document.createElement('a');
  1740. aTag.download = this.$t('financialcoststatisticss') + ".xlsx";
  1741. aTag.href = res.data;
  1742. aTag.click();
  1743. } else {
  1744. this.$message({
  1745. message: res.msg,
  1746. type: "error"
  1747. });
  1748. }
  1749. },
  1750. error => {
  1751. this.exportDataProcessing = false;
  1752. this.$message({
  1753. message: error,
  1754. type: "error"
  1755. });
  1756. });
  1757. },
  1758. getSummaries(param) {
  1759. const { columns, data } = param;
  1760. const sums = [];
  1761. columns.forEach((column, index) => {
  1762. if (index === 0) {
  1763. sums[index] = this.$t('zongjia');
  1764. return;
  1765. }
  1766. if (index === 1) {
  1767. sums[index] = '';
  1768. return
  1769. }
  1770. if (index === 2 && this.user.timeType.financeJobnumEnabled == 1) {
  1771. sums[index] = '';
  1772. return;
  1773. }
  1774. const values = data.map(item => Number(item[column.property]));
  1775. if (!values.every(value => isNaN(value))) {
  1776. sums[index] = values.reduce((prev, curr) => {
  1777. const value = Number(curr);
  1778. if (!isNaN(value)) {
  1779. return prev + curr;
  1780. } else {
  1781. return prev;
  1782. }
  1783. }, 0);
  1784. sums[index] = sums[index].toFixed(2) + this.$t('yuan');
  1785. } else {
  1786. sums[index] = 'N/A';
  1787. }
  1788. });
  1789. return sums;
  1790. },
  1791. loadMonthData() {
  1792. //改变月份
  1793. this.getList();
  1794. this.assignToProject();
  1795. this.getMonths()
  1796. this.getAllocateSelectedItems()
  1797. },
  1798. vueCasader(obj) {
  1799. if(obj.distinction == '1') {
  1800. this.departmentId = [obj.id]
  1801. this.loadMonthData()
  1802. }
  1803. },
  1804. // 批量导入人员薪资
  1805. importFinance(item) {
  1806. //首先判断文件类型
  1807. let str = item.file.name.split(".");
  1808. let format = str[str.length - 1];
  1809. if (format != "xls" && format != "xlsx") {
  1810. this.$message({
  1811. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1812. type: "error"
  1813. });
  1814. } else {
  1815. this.listLoading = true;
  1816. let formData = new FormData();
  1817. formData.append("file", item.file);
  1818. formData.append("companyId", this.user.companyId);
  1819. formData.append("yearMonth", this.date);
  1820. formData.append("syncUserCost", this.importParam.syncUserCost);
  1821. formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
  1822. this.isUploading = true;
  1823. let urls = ''
  1824. if (this.user.timeType.financeAudit == '1') {
  1825. urls = '/finance-import/submitImport'
  1826. } else {
  1827. urls = '/finance/importData'
  1828. }
  1829. // this.http.uploadFile('/finance/importData', formData,
  1830. this.http.uploadFile(urls, formData,
  1831. res => {
  1832. // console.log(this.user.timeType.financeAudit, '看看数据')
  1833. this.$refs.upload.clearFiles();
  1834. this.listLoading = false;
  1835. this.isUploading = false;
  1836. if (res.code == "ok") {
  1837. if (this.user.timeType.financeAudit == 1) {
  1838. this.$message({
  1839. message: this.$t('waiforverification'),
  1840. type: "warning"
  1841. });
  1842. this.loadMonthData();
  1843. } else {
  1844. this.$message({
  1845. message: this.$t('other.importSuccess'),
  1846. type: "success"
  1847. });
  1848. }
  1849. this.importDialog = false;
  1850. //重新读取列表
  1851. this.getList();
  1852. } else {
  1853. this.$message({
  1854. message: res.msg,
  1855. type: "error"
  1856. });
  1857. }
  1858. },
  1859. error => {
  1860. this.$refs.upload.clearFiles();
  1861. this.listLoading = false;
  1862. this.$message({
  1863. message: error,
  1864. type: "error"
  1865. });
  1866. });
  1867. }
  1868. },
  1869. // 导入提交审核
  1870. // submitReview(formData) {
  1871. // this.http.uploadFile(' /finance-import/submitImport', formData,
  1872. // res => {
  1873. // if (res.code == "ok") {
  1874. // console.log(res.data, '来的数据')
  1875. // } else {
  1876. // this.$message({
  1877. // message: res.msg,
  1878. // type: "error"
  1879. // });
  1880. // }
  1881. // },
  1882. // error => {
  1883. // this.$refs.upload.clearFiles();
  1884. // this.listLoading = false;
  1885. // this.$message({
  1886. // message: error,
  1887. // type: "error"
  1888. // });
  1889. // });
  1890. // },
  1891. //获取项目列表
  1892. getList() {
  1893. this.listLoading = true;
  1894. this.http.post('/finance/getByMonth', {
  1895. companyId: this.user.companyId,
  1896. yearMonth: this.date,
  1897. deptId: this.departmentId[this.departmentId.length - 1]
  1898. },
  1899. res => {
  1900. this.listLoading = false;
  1901. if (res.code == "ok") {
  1902. var list = res.data;
  1903. this.allFinanceList = list;
  1904. this.noReportUserList = list.filter(r => r.hasReport == 0);
  1905. if (this.radio == this.$t('lable.allStaff')) {
  1906. this.list = this.allFinanceList;
  1907. } else {
  1908. this.list = this.noReportUserList
  1909. }
  1910. } else {
  1911. this.$message({
  1912. message: res.msg,
  1913. type: "error"
  1914. });
  1915. }
  1916. },
  1917. error => {
  1918. this.listLoading = false;
  1919. this.$message({
  1920. message: error,
  1921. type: "error"
  1922. });
  1923. });
  1924. },
  1925. // 获取当月的审核状态
  1926. getMonths() {
  1927. this.http.post('/finance-import/getStatus', {
  1928. companyId: this.user.companyId,
  1929. yearMonth: this.date
  1930. },
  1931. res => {
  1932. this.listLoading = false;
  1933. if (res.code == "ok") {
  1934. // console.log(res.data, '审核状态')
  1935. if (res.data) {
  1936. if (res.data.state == '0') {
  1937. this.revaelse = this.$t('state.WaitingAudit')
  1938. this.tabPosition = '0'
  1939. } else if (res.data.state == '1') {
  1940. this.revaelse = this.$t('Auditrecords')
  1941. this.tabPosition = '1'
  1942. } else if (res.data.state == '2') {
  1943. this.revaelse = this.$t('state.rejected')
  1944. this.tabPosition = '2'
  1945. } else if (res.data.state == '3') {
  1946. this.revaelse = this.$t('state.undone')
  1947. this.tabPosition = '-1'
  1948. }
  1949. this.getReviewList()
  1950. } else {
  1951. this.revaelse = ''
  1952. }
  1953. } else {
  1954. this.$message({
  1955. message: res.msg,
  1956. type: "error"
  1957. });
  1958. }
  1959. },
  1960. error => {
  1961. this.listLoading = false;
  1962. this.$message({
  1963. message: error,
  1964. type: "error"
  1965. });
  1966. });
  1967. },
  1968. // 获取审核列表
  1969. getReviewList() {
  1970. this.http.post('/finance-import/list', {
  1971. companyId: this.user.companyId,
  1972. },
  1973. res => {
  1974. if (res.code == "ok") {
  1975. // console.log(res.data, '拿到的数据')
  1976. this.ovReviewLis = res.data
  1977. if (this.tabPosition == 0) {
  1978. this.reviewLis = res.data.pendingList
  1979. } else if (this.tabPosition == 1) {
  1980. this.reviewLis = res.data.passList
  1981. } else if (this.tabPosition == 2) {
  1982. this.reviewLis = res.data.rejectList
  1983. } else {
  1984. this.reviewLis = res.data.cancelList
  1985. }
  1986. // console.log(this.reviewLis, '数据')
  1987. } else {
  1988. this.$message({
  1989. message: res.msg,
  1990. type: "error"
  1991. });
  1992. }
  1993. },
  1994. error => {
  1995. this.$message({
  1996. message: error,
  1997. type: "error"
  1998. });
  1999. });
  2000. },
  2001. // 操作数据
  2002. operationalData() {
  2003. var sss = this.ovReviewLis
  2004. if (this.tabPosition == 0) {
  2005. this.reviewLis = sss.pendingList
  2006. } else if (this.tabPosition == 1) {
  2007. this.reviewLis = sss.passList
  2008. } else if (this.tabPosition == 2) {
  2009. this.reviewLis = sss.rejectList
  2010. } else {
  2011. this.reviewLis = sss.cancelList
  2012. }
  2013. // console.log(this.reviewLis, '数据')
  2014. },
  2015. // 审核操作
  2016. operationList(zhi, id) {
  2017. if (this.operating) return;
  2018. let urls
  2019. if (zhi == 0) {
  2020. urls = '/finance-import/agree'
  2021. } else if (zhi == 1) {
  2022. urls = '/finance-import/deny'
  2023. } else {
  2024. urls = '/finance-import/cancel'
  2025. }
  2026. this.operating = true;
  2027. this.http.post(urls, {
  2028. id: id,
  2029. },
  2030. res => {
  2031. if (res.code == "ok") {
  2032. this.operating = false;
  2033. this.$message({
  2034. message: this.$t('operationissuccessful'),
  2035. type: "success"
  2036. });
  2037. this.getReviewList();
  2038. this.loadMonthData();
  2039. } else {
  2040. this.$message({
  2041. message: res.msg,
  2042. type: "error"
  2043. });
  2044. }
  2045. },
  2046. error => {
  2047. this.$message({
  2048. message: error,
  2049. type: "error"
  2050. });
  2051. });
  2052. },
  2053. // 获取薪资上传记录
  2054. xzjl() {
  2055. this.http.post('/finance-import/list', {
  2056. companyId: this.user.companyId,
  2057. // pageIndex:1,
  2058. // pageSize: 9999
  2059. },
  2060. res => {
  2061. if (res.code == "ok") {
  2062. // console.log('123',res.data)
  2063. this.xzList = res.data.passList
  2064. } else {
  2065. this.$message({
  2066. message: res.msg,
  2067. type: "error"
  2068. });
  2069. }
  2070. },
  2071. error => {
  2072. this.$message({
  2073. message: error,
  2074. type: "error"
  2075. });
  2076. });
  2077. },
  2078. //导入分摊比例
  2079. intoAmortizationRatio() {
  2080. this.intoAmortizationDialog = true;
  2081. },
  2082. batchImportData(item) {
  2083. //首先判断文件类型
  2084. let str = item.file.name.split(".");
  2085. let format = str[str.length - 1];
  2086. if (format != "xls" && format != "xlsx") {
  2087. this.$message({
  2088. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  2089. type: "error"
  2090. });
  2091. } else {
  2092. this.importingData = true;
  2093. let formData = new FormData();
  2094. formData.append("file", item.file);
  2095. formData.append("companyId", this.user.companyId);
  2096. formData.append('ymonth', this.date)
  2097. this.http.uploadFile('/project-percentage/importData', formData,
  2098. res => {
  2099. this.$refs.upload.clearFiles();
  2100. this.importingData = false;
  2101. this.showImportResult = true;
  2102. if (res.code == "ok") {
  2103. //换成弹出框,以免有人等了半天回来啥也没看到
  2104. this.importResultMsg = this.$t('other.importSuccess') + res.data + this.$t('apportionmentratiodata') + '。' + (res.msg ? res.msg : "");
  2105. this.showSettingDialog();
  2106. } else {
  2107. this.importResultMsg = this.$t('export.Importfailure') + ":" + res.msg;
  2108. }
  2109. },
  2110. error => {
  2111. this.$refs.upload.clearFiles();
  2112. this.importingData = false;
  2113. this.$message({
  2114. message: error,
  2115. type: "error"
  2116. });
  2117. });
  2118. }
  2119. },
  2120. // 左右滚动
  2121. scrollFunction() {
  2122. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  2123. if (this.domObj.attachEvent) { // IE
  2124. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  2125. } else if (this.domObj.addEventListener) {
  2126. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  2127. }
  2128. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  2129. },
  2130. mouseScroll(event) { // google 浏览器下
  2131. let detail = event.wheelDelta || event.detail
  2132. let moveForwardStep = -1
  2133. let moveBackStep = 1
  2134. let step = 0
  2135. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  2136. event.preventDefault() // 阻止浏览器默认事件
  2137. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  2138. },
  2139. // 自定义组件事件
  2140. selectCal(obj) {
  2141. if (obj.distinction == '1') {
  2142. this.reviewerRuleForm.auditorId = obj.id
  2143. } else if (obj.distinction == '2') {
  2144. this.chosenNoReportUserIds = obj.id
  2145. }
  2146. }
  2147. },
  2148. created() {
  2149. var d = new Date();
  2150. this.date = d.getFullYear() + '-' + ((d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1);
  2151. },
  2152. mounted() {
  2153. let height = window.innerHeight;
  2154. this.tableHeight = height - 245;
  2155. const that = this;
  2156. window.onresize = function temp() {
  2157. that.tableHeight = window.innerHeight - 245;
  2158. };
  2159. this.getCustomColumn();
  2160. this.addreviewer();
  2161. this.arrter()
  2162. this.loadMonthData()
  2163. this.scrollFunction()
  2164. this.getAllProjectList()
  2165. this.getAllocateSelectedItems()
  2166. this.getDepartment()
  2167. },
  2168. updated() {
  2169. this.$nextTick(() => {
  2170. this.$refs['table'].doLayout();
  2171. })
  2172. }
  2173. };
  2174. </script>
  2175. <style lang="scss" scoped>
  2176. .nameList {
  2177. height: 400px;
  2178. overflow: auto;
  2179. }
  2180. .importOfFundDataClass {}
  2181. </style>