view.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <el-dialog title="社保人员信息" v-model="visible" width="80%" append-to-body draggable @close="close" :close-on-click-modal = "false">
  3. <div v-loading="loading">
  4. <!-- 功能按钮 -->
  5. <div style="padding: 8px 24px 16px 24px" >
  6. <el-form size="small" label-width="100px" v-model="form">
  7. <el-row :gutter="30">
  8. <el-col :span="12">
  9. <el-form-item label="客户名称">
  10. <div>{{ form.companyName }}</div>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="12">
  14. <el-form-item label="所属月份">
  15. <div>{{ form.year }}-{{ form.month }}</div>
  16. </el-form-item>
  17. </el-col>
  18. <el-col v-if="form.status === 4" :span="12">
  19. <el-form-item label="驳回原因">
  20. <div>{{ form.feedbackContent }}</div>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="12">
  24. <el-form-item label="政务网账号" required class="edit-label">
  25. <template #label>
  26. <div>政务网账号</div>
  27. </template>
  28. <el-input v-if="form.isFirstSocialSecurity === 0 || editStatus" v-model="form.governmentAccountNo"
  29. placeholder="请输入政务网账号" />
  30. <div v-else>{{ form.governmentAccountNo }}</div>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="12">
  34. <el-form-item label="政务网密码" required class="edit-label">
  35. <template #label>
  36. <div>政务网密码</div>
  37. </template>
  38. <el-input v-if="form.isFirstSocialSecurity === 0 || editStatus" v-model="form.governmentPassword"
  39. placeholder="请输入政务网密码" @blur="
  40. (value) => passwordCheckHandler(value, 'governmentPassword')
  41. " />
  42. <div v-else>{{ form.governmentPassword }}</div>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="12">
  46. <el-form-item label="社保账号" required class="edit-label">
  47. <template #label>
  48. <div>社保账号</div>
  49. </template>
  50. <el-input v-if="form.isFirstSocialSecurity === 0 || editStatus" v-model="form.socialSecurityAccountNo"
  51. placeholder="请输入社保账号" />
  52. <div v-else>{{ form.socialSecurityAccountNo }}</div>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="12">
  56. <el-form-item label="社保密码" required class="edit-label">
  57. <template #label>
  58. <div>社保密码</div>
  59. </template>
  60. <el-input v-if="form.isFirstSocialSecurity === 0 || editStatus" v-model="form.socialSecurityPassword"
  61. placeholder="请输入社保密码" @blur="
  62. (value) =>
  63. passwordCheckHandler(value, 'socialSecurityPassword')
  64. " />
  65. <div v-else>{{ form.socialSecurityPassword }}</div>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="12">
  69. <el-form-item label="用工密码" required class="edit-label">
  70. <template #label>
  71. <div>用工密码</div>
  72. </template>
  73. <el-input v-if="form.isFirstSocialSecurity === 0 || editStatus" v-model="form.employeePassword"
  74. placeholder="请输入用工密码" @blur="
  75. (value) => passwordCheckHandler(value, 'employeePassword')
  76. " />
  77. <div v-else>{{ form.employeePassword }}</div>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="24" class="details-container">
  81. <!--操作按钮 开始-->
  82. <div class="details-head">
  83. <div class="title">
  84. <i class="fa fa-th-list" aria-hidden="true" /> 人员信息
  85. <el-button class="button-class" size="small" @click="printSalary" icon="printer"
  86. type="primary">打印</el-button>
  87. <el-button class="button-class" size="small" @click="exportSalary" icon="download"
  88. type="info">导出</el-button>
  89. </div>
  90. </div>
  91. <div class="details-body">
  92. <div>
  93. <el-table ref="sourceTable" :data="form.details" size="small" max-height="260px" border
  94. highlight-current-row header-row-class-name="list-header-row" :row-class-name="tableRowClassName"
  95. @selection-change="handleCheckChange" @current-change="handleCurrentChange">
  96. <!-- <el-table-column type="selection" width="40" align="center" /> -->
  97. <el-table-column type="index" label="序号" width="55" align="center" />
  98. <el-table-column label="姓名" width="80" align="center">
  99. <template #default="scope">
  100. <div>
  101. {{ scope.row.employeeName }}
  102. </div>
  103. <span style="
  104. color: red;
  105. position: absolute;
  106. z-index: 10;
  107. top: 4px;
  108. right: 6px;
  109. ">*</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="电话号" width="130" align="center">
  113. <template #default="scope">
  114. <div>
  115. {{ scope.row.phone }}
  116. </div>
  117. <span style="
  118. color: red;
  119. position: absolute;
  120. z-index: 10;
  121. top: 4px;
  122. right: 6px;
  123. ">*</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="身份证正面" width="120" align="center">
  127. <template #default="scope">
  128. <div class="show-image" style="display: flex; justify-content: center">
  129. <img class="img" :src="baseUrl + '/' + scope.row.idCardImage" alt=""
  130. @click="handleImageView(scope.row.idCardImage)" />
  131. </div>
  132. <span style="
  133. color: red;
  134. position: absolute;
  135. z-index: 10;
  136. top: 4px;
  137. right: 6px;
  138. ">*</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="身份证反面" width="120" align="center">
  142. <template #default="scope">
  143. <div class="show-image" style="display: flex; justify-content: center">
  144. <img class="img" :src="baseUrl + '/' + scope.row.idCardImageBack" alt=""
  145. @click="handleImageView(scope.row.idCardImageBack)" />
  146. </div>
  147. <span style="
  148. color: red;
  149. position: absolute;
  150. z-index: 10;
  151. top: 4px;
  152. right: 6px;
  153. ">*</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="采暖费" width="100" align="center">
  157. <template #default="scope">
  158. <div>
  159. {{ rowNum(scope.row.heatingFee) }}
  160. </div>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="基数" width="100" align="center">
  164. <template #default="scope">
  165. <div>
  166. {{ rowNum(scope.row.cardinalNumber) }}
  167. </div>
  168. <span style="
  169. color: red;
  170. position: absolute;
  171. z-index: 10;
  172. top: 4px;
  173. right: 6px;
  174. ">*</span>
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="医疗基数" width="100" align="center">
  178. <template #default="scope">
  179. <div>
  180. {{ rowNum(scope.row.medicalCardinalNumber) }}
  181. </div>
  182. <span style="
  183. color: red;
  184. position: absolute;
  185. z-index: 10;
  186. top: 4px;
  187. right: 6px;
  188. ">*</span>
  189. </template>
  190. </el-table-column>
  191. <!-- <el-table-column label="签名" width="100" header-align="center" required>
  192. </el-table-column> -->
  193. <el-table-column label="备注" header-align="center">
  194. <template #default="scope">
  195. <div>
  196. {{ scope.row.remark }}
  197. </div>
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. </div>
  202. </div>
  203. </el-col>
  204. <el-col :span="24">
  205. <el-divider />
  206. </el-col>
  207. <el-col :span="24">
  208. <el-form-item label="是否变更">
  209. {{ form.isChanged === 1 ? "是" : "否" }}
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="24">
  213. <el-form-item label="备注">
  214. {{ form.content }}
  215. </el-form-item>
  216. </el-col>
  217. <el-col v-if="showVerify()" :span="24">
  218. <el-divider />
  219. </el-col>
  220. <el-col :span="24">
  221. <el-form-item label="审核备注">
  222. <el-input v-if="showVerify()" v-model.trim="form.verifyContent" maxlength="200" show-word-limit
  223. type="textarea" rows="2" />
  224. <div v-else>{{ form.verifyContent }}</div>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. </el-form>
  229. </div>
  230. <div class="form-btns-container" style="height: 40px">
  231. <el-button v-if="showVerify()" type="danger" size="small" icon="back" style="float: right; margin-left: 12px"
  232. @click="handleVerify(4)">
  233. 驳回</el-button>
  234. <el-button v-if="showVerify()" type="primary" size="small" icon="check" style="float: right; margin-left: 12px"
  235. @click="handleVerify(3)">审核通过</el-button>
  236. <el-button v-if="verifiable() && form.status === 3" type="warning" size="small" icon="back"
  237. style="float: right; margin-left: 12px" @click="returnStatus()">退回</el-button>
  238. </div>
  239. <feedback-dialog ref="feedbackDialogView" :verify="verify" />
  240. <el-image-viewer v-if="showViewer" :url-list="currentFileList" @close="closeImages" :initial-index="showIndex" />
  241. <!-- <print-dialog ref="printDialog" /> -->
  242. </div>
  243. </el-dialog>
  244. </template>
  245. <script setup>
  246. import {
  247. getDetail,
  248. verifyDetail,
  249. turnBackDetail,
  250. exportSocialSecurityEmployee,
  251. exportSocialSecurityPdf,
  252. } from "@/api/business/production/socialSecurityConfirm";
  253. import { rowNum } from "@/utils/index";
  254. import feedbackDialog from "../feedbackDialog.vue";
  255. import useUserStore from "@/store/modules/user";
  256. import { ref } from "vue";
  257. const { proxy } = getCurrentInstance();
  258. const visible = ref(false);
  259. const width = ref(800);
  260. const selections = ref([]);
  261. const currentSource = ref(null);
  262. const loading = ref(false);
  263. const showViewer = ref(false);
  264. const currentFileList = ref([]);
  265. const showIndex = ref(0);
  266. const editStatus = ref(false);
  267. const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
  268. const permissions = useUserStore().permissions;
  269. const all_permission = "*:*:*";
  270. const feedbackDialogView = ref(null);
  271. const confirmChoices = ref([
  272. {
  273. label: "是",
  274. value: 1,
  275. },
  276. {
  277. label: "否",
  278. value: 0,
  279. },
  280. ]);
  281. const props = defineProps({
  282. getList: {
  283. type: Function,
  284. default: () => { },
  285. },
  286. });
  287. const { getList } = toRefs(props);
  288. const total = ref(0);
  289. const employeeEmptyData = {
  290. id: null,
  291. title: "",
  292. remark: "",
  293. employeeName: "",
  294. departmentName: "",
  295. idCode: "",
  296. salaryAmount: "",
  297. bonusAmount: "",
  298. allowanceAmount: "",
  299. subsidyAmount: "",
  300. absenceCut: "",
  301. planSalary: 0,
  302. actuallySalary: 0,
  303. endowmentInsurance: 0,
  304. medicalInsurance: 0,
  305. unemploymentBenefit: 0,
  306. seriousIllnessInsurance: 0,
  307. housingFund: 0,
  308. otherCut: 0,
  309. cumulativeIncome: 0,
  310. cumulativeSpecialCut: 0,
  311. cumulativeChildEduCut: 0,
  312. cumulativeHouseLoanInterestCut: 0,
  313. cumulativeHouseRentCut: 0,
  314. cumulativeSupportElderCut: 0,
  315. cumulativeContinuingEduCut: 0,
  316. cumulativeBabyCareCut: 0,
  317. sumSpecialCumulativeCut: 0,
  318. cumulativeOtherCut: 0,
  319. cumulativeIndividualIncomeTax: 0,
  320. cumulativeHasPaidIit: 0,
  321. currentIndividualIncomeTax: 0,
  322. idiograph: "",
  323. details: [],
  324. editStatus: true,
  325. };
  326. const form = ref({
  327. amount: null,
  328. details: [],
  329. });
  330. const emptyForm = {
  331. details: [],
  332. };
  333. function open(detail) {
  334. console.log(detail);
  335. visible.value = true;
  336. loading.value = true;
  337. form.value = detail;
  338. loadData();
  339. }
  340. function loadData() {
  341. getDetail(form.value).then((res) => {
  342. form.value = { ...proxy.deepClone(emptyForm), ...res.data };
  343. computeTotal();
  344. }).finally(() => loading.value = false);
  345. }
  346. function close() {
  347. visible.value = false;
  348. reset();
  349. }
  350. function reset() {
  351. form.value = proxy.deepClone(emptyForm);
  352. total.value = 0;
  353. }
  354. //人员信息打印
  355. function printSalary() {
  356. exportSocialSecurityPdf(form.value.id);
  357. }
  358. //人员信息导出
  359. function exportSalary() {
  360. exportSocialSecurityEmployee(form.value.id);
  361. }
  362. function showVerify() {
  363. if (
  364. form.value.id == null ||
  365. form.value.status === 0 ||
  366. form.value.status === 3 ||
  367. form.value.status === 4
  368. ) {
  369. return false;
  370. } else if (verifiable()) {
  371. return true;
  372. } else {
  373. return false;
  374. }
  375. }
  376. function verifiable() {
  377. return (
  378. permissions.includes(all_permission) ||
  379. permissions.includes("business:socialSecurityConfirm:verify")
  380. );
  381. }
  382. function handleCurrentChange(row) {
  383. currentSource.value = row;
  384. }
  385. function handleCheckChange(selection) {
  386. selections.value = selection.map((item) => item);
  387. }
  388. function getSummaries(param) {
  389. const { columns, data } = param;
  390. const sums = [];
  391. columns.forEach((column, index) => {
  392. if (index === 0) {
  393. sums[index] = "合计";
  394. return;
  395. } else if (index === 1) {
  396. sums[index] = "";
  397. return;
  398. }
  399. const values = data.map((item) => Number(item[column.property]));
  400. if (!values.every((value) => isNaN(value))) {
  401. sums[index] = values.reduce((prev, curr) => {
  402. const value = Number(curr);
  403. if (!isNaN(value)) {
  404. return (Number(prev) + Number(curr)).toFixed(2);
  405. } else {
  406. return Number(prev).toFixed(2);
  407. }
  408. }, 0);
  409. } else {
  410. sums[index] = "";
  411. }
  412. });
  413. return sums;
  414. }
  415. function handleImageView(fileUrl) {
  416. window.open(`${baseUrl.value}${fileUrl}`);
  417. }
  418. function handleVerify(status) {
  419. if (status === 4) {
  420. const saveValue = proxy.deepClone(form.value);
  421. saveValue.status = status;
  422. feedbackDialogView.value.open(saveValue);
  423. } else {
  424. proxy.$modal
  425. .confirm("确认审核么?")
  426. .then((_) => {
  427. const saveValue = proxy.deepClone(form.value);
  428. saveValue.status = status;
  429. verify(saveValue);
  430. })
  431. .catch((_) => {
  432. proxy.$modal.msg("已取消审核");
  433. });
  434. }
  435. }
  436. function verify(data) {
  437. verifyDetail(data).then((res) => {
  438. reset();
  439. getList.value();
  440. close();
  441. });
  442. }
  443. function rowChangeSum(row) {
  444. let actuallySalary = 0;
  445. actuallySalary += row.planSalary == null ? 0 : row.planSalary;
  446. actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
  447. actuallySalary -= row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
  448. actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
  449. actuallySalary -=
  450. row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
  451. actuallySalary -=
  452. row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
  453. actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
  454. if (form.value.hasIndividualIncomeTax === 1) {
  455. actuallySalary -=
  456. row.individualIncomeTaxConfirm == null
  457. ? 0
  458. : row.individualIncomeTaxConfirm;
  459. } else {
  460. actuallySalary -=
  461. row.currentIndividualIncomeTax == null
  462. ? 0
  463. : row.currentIndividualIncomeTax;
  464. }
  465. actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
  466. row.actuallySalary = actuallySalary;
  467. computeTotal();
  468. }
  469. function computeTotal() {
  470. let totalSalay = 0;
  471. form.value.details.forEach((l) => {
  472. totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
  473. });
  474. form.value.amount = totalSalay.toFixed(2);
  475. }
  476. function returnStatus(status) {
  477. proxy.$modal
  478. .confirm("确认退回么?")
  479. .then((_) => {
  480. turnBackDetail(form.value).then((res) => {
  481. // if (res.data.successStatus = true) {
  482. // reset()
  483. // getList.value()
  484. // close()
  485. // } else {
  486. // proxy.$modal.msg(res.data.message)
  487. // }
  488. reset();
  489. getList.value();
  490. close();
  491. });
  492. })
  493. .catch((_) => {
  494. proxy.$modal.msg("已取消退回");
  495. });
  496. }
  497. function changeIndividual(arg) {
  498. // if (arg === 1) {
  499. form.value.details.forEach((row) => {
  500. let actuallySalary = 0;
  501. actuallySalary += row.planSalary == null ? 0 : row.planSalary;
  502. actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
  503. actuallySalary -=
  504. row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
  505. actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
  506. actuallySalary -=
  507. row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
  508. actuallySalary -=
  509. row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
  510. actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
  511. if (arg === 1) {
  512. actuallySalary -=
  513. row.individualIncomeTaxConfirm == null
  514. ? 0
  515. : row.individualIncomeTaxConfirm;
  516. } else {
  517. actuallySalary -=
  518. row.currentIndividualIncomeTax == null
  519. ? 0
  520. : row.currentIndividualIncomeTax;
  521. }
  522. actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
  523. row.actuallySalary = actuallySalary;
  524. });
  525. computeTotal();
  526. }
  527. function passwordCheckHandler(value, field) {
  528. // console.log(value)
  529. if (!passwordCheck(form.value[field])) {
  530. proxy.$modal.msgError("请输入正确密码");
  531. }
  532. }
  533. function closeImages() {
  534. showViewer.value = false;
  535. }
  536. function tableRowClassName({ row, index }) {
  537. if (row.changeStatus === 1) {
  538. return "list-row add-row";
  539. } else if (row.changeStatus === 2) {
  540. return "list-row delete-row";
  541. } else {
  542. return "list-row";
  543. }
  544. }
  545. // 暴露给父组件的方法
  546. defineExpose({
  547. open,
  548. });
  549. </script>
  550. <style scoped>
  551. .img {
  552. width: 23px;
  553. height: 23px;
  554. display: flex;
  555. justify-content: center;
  556. align-items: center;
  557. }
  558. ::v-deep(.el-upload) {
  559. display: flex;
  560. text-align: center;
  561. justify-content: center;
  562. cursor: pointer;
  563. outline: 0;
  564. }
  565. .button-class {
  566. margin-top: 10px;
  567. margin-bottom: 10px;
  568. }
  569. .required::after {
  570. content: "*";
  571. color: red;
  572. }
  573. </style>
  574. <style>
  575. .el-table .delete-row {
  576. background-color: rgb(251, 159, 173);
  577. }
  578. .el-table .add-row {
  579. background-color: rgb(184, 234, 147);
  580. }
  581. </style>