fileListDialog.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <el-dialog
  3. title="公积金申报信息"
  4. v-model="visible"
  5. :width="width"
  6. append-to-body
  7. draggable
  8. :close-on-click-modal = "false"
  9. @close="close"
  10. >
  11. <!-- 功能按钮 -->
  12. <div style="padding: 8px 24px 16px 24px">
  13. <el-form size="small" label-width="100px" v-model="form">
  14. <el-row :gutter="30">
  15. <el-col :span="12">
  16. <el-form-item label="客户名称">
  17. <div>{{ form.companyName }}</div>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="12">
  21. <el-form-item label="所属月份">
  22. <div>{{ form.year }}-{{ form.month }}</div>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="24" class="details-container">
  26. <!--操作按钮 开始-->
  27. <div class="details-head">
  28. <div class="title">
  29. <i class="fa fa-th-list" aria-hidden="true" /> 文件信息
  30. </div>
  31. </div>
  32. <img style="height: 148px; width: 148px" :src="`${baseUrl}/${form.evidenceFile}`"
  33. class="avatar" @click="openEvidience()" />
  34. <!-- <div class="details-body">
  35. <div>
  36. <el-table
  37. ref="sourceTable"
  38. :data="form.evidenceFiles"
  39. size="small"
  40. max-height="260px"
  41. border
  42. highlight-current-row
  43. header-row-class-name="list-header-row"
  44. row-class-name="list-row"
  45. @selection-change="handleCheckChange"
  46. @current-change="handleCurrentChange"
  47. >
  48. <el-table-column
  49. label="文件名"
  50. prop="originalFileName"
  51. align="center"
  52. show-overflow-tooltip
  53. >
  54. <template #default="scope">
  55. <el-button
  56. size="small"
  57. type="text"
  58. @click="openFile(scope.row)"
  59. >{{
  60. scope.row.originalFileName == ""
  61. ? "打开文件"
  62. : scope.row.originalFileName
  63. }}</el-button
  64. >
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. </div> -->
  70. </el-col>
  71. </el-row>
  72. </el-form>
  73. </div>
  74. <div class="form-btns-container" style="height: 40px"></div>
  75. <!-- <print-dialog ref="printDialog" /> -->
  76. </el-dialog>
  77. </template>
  78. <script setup>
  79. import { getDetail } from "@/api/business/production/housingFundDeclare";
  80. import useUserStore from "@/store/modules/user";
  81. import { ref } from "vue";
  82. const { proxy } = getCurrentInstance();
  83. const visible = ref(false);
  84. const width = ref(800);
  85. const selections = ref([]);
  86. const currentSource = ref(null);
  87. const showViewer = ref(false);
  88. const currentFileList = ref([]);
  89. const showIndex = ref(0);
  90. const editStatus = ref(false);
  91. const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
  92. const permissions = useUserStore().permissions;
  93. const all_permission = "*:*:*";
  94. const feedbackDialogView = ref(null);
  95. const confirmChoices = ref([
  96. {
  97. label: "是",
  98. value: 1,
  99. },
  100. {
  101. label: "否",
  102. value: 0,
  103. },
  104. ]);
  105. const props = defineProps({
  106. getList: {
  107. type: Function,
  108. default: () => {},
  109. },
  110. });
  111. const { getList } = toRefs(props);
  112. const total = ref(0);
  113. const employeeEmptyData = {
  114. id: null,
  115. title: "",
  116. remark: "",
  117. employeeName: "",
  118. departmentName: "",
  119. idCode: "",
  120. salaryAmount: "",
  121. bonusAmount: "",
  122. allowanceAmount: "",
  123. subsidyAmount: "",
  124. absenceCut: "",
  125. planSalary: 0,
  126. actuallySalary: 0,
  127. endowmentInsurance: 0,
  128. medicalInsurance: 0,
  129. unemploymentBenefit: 0,
  130. seriousIllnessInsurance: 0,
  131. housingFund: 0,
  132. otherCut: 0,
  133. cumulativeIncome: 0,
  134. cumulativeSpecialCut: 0,
  135. cumulativeChildEduCut: 0,
  136. cumulativeHouseLoanInterestCut: 0,
  137. cumulativeHouseRentCut: 0,
  138. cumulativeSupportElderCut: 0,
  139. cumulativeContinuingEduCut: 0,
  140. cumulativeBabyCareCut: 0,
  141. sumSpecialCumulativeCut: 0,
  142. cumulativeOtherCut: 0,
  143. cumulativeIndividualIncomeTax: 0,
  144. cumulativeHasPaidIit: 0,
  145. currentIndividualIncomeTax: 0,
  146. idiograph: "",
  147. details: [],
  148. editStatus: true,
  149. };
  150. const form = ref({
  151. amount: null,
  152. details: [],
  153. });
  154. const emptyForm = {
  155. details: [],
  156. };
  157. function open(detail) {
  158. console.log(detail);
  159. visible.value = true;
  160. form.value = detail;
  161. loadData();
  162. console.log(form.value);
  163. }
  164. function loadData() {
  165. getDetail(form.value).then((res) => {
  166. form.value = { ...proxy.deepClone(emptyForm), ...res.data };
  167. form.value.evidenceFile = form.value.evidenceFiles[0].fileUrl;
  168. });
  169. }
  170. function close() {
  171. visible.value = false;
  172. reset();
  173. }
  174. function reset() {
  175. form.value = proxy.deepClone(emptyForm);
  176. total.value = 0;
  177. }
  178. function printSalary() {}
  179. function exportSalary() {}
  180. function showVerify() {
  181. if (
  182. form.value.id == null ||
  183. form.value.status === 0 ||
  184. form.value.status === 3
  185. ) {
  186. return false;
  187. } else if (verifiable()) {
  188. return true;
  189. } else {
  190. return false;
  191. }
  192. }
  193. function openFile(row) {
  194. window.open(`${baseUrl.value}${row.fileUrl}`);
  195. }
  196. function verifiable() {
  197. // console.log(permissions)
  198. // console.log(permissions)
  199. return (
  200. permissions.includes(all_permission) ||
  201. permissions.includes("business:salary:verify")
  202. );
  203. }
  204. function handleCurrentChange(row) {
  205. currentSource.value = row;
  206. }
  207. function handleCheckChange(selection) {
  208. selections.value = selection.map((item) => item);
  209. }
  210. function getSummaries(param) {
  211. const { columns, data } = param;
  212. const sums = [];
  213. columns.forEach((column, index) => {
  214. if (index === 0) {
  215. sums[index] = "合计";
  216. return;
  217. } else if (index === 1) {
  218. sums[index] = "";
  219. return;
  220. }
  221. const values = data.map((item) => Number(item[column.property]));
  222. if (!values.every((value) => isNaN(value))) {
  223. sums[index] = values.reduce((prev, curr) => {
  224. const value = Number(curr);
  225. if (!isNaN(value)) {
  226. return (Number(prev) + Number(curr)).toFixed(2);
  227. } else {
  228. return Number(prev).toFixed(2);
  229. }
  230. }, 0);
  231. } else {
  232. sums[index] = "";
  233. }
  234. });
  235. return sums;
  236. }
  237. function handleVerify(status) {
  238. if (status === 4) {
  239. const saveValue = proxy.deepClone(form.value);
  240. saveValue.status = status;
  241. feedbackDialogView.value.open(saveValue);
  242. } else {
  243. proxy.$modal
  244. .confirm("确认审核么?")
  245. .then((_) => {
  246. const saveValue = proxy.deepClone(form.value);
  247. saveValue.status = status;
  248. verify(saveValue);
  249. })
  250. .catch((_) => {
  251. proxy.$modal.msg("已取消审核");
  252. });
  253. }
  254. }
  255. function openEvidience() {
  256. window.open(`${baseUrl.value}${form.value.evidenceFile}`);
  257. }
  258. function verify(data) {
  259. verifyDetail(data).then((res) => {
  260. reset();
  261. getList.value();
  262. close();
  263. });
  264. }
  265. function rowChangeSum(row) {
  266. let actuallySalary = 0;
  267. actuallySalary += row.planSalary == null ? 0 : row.planSalary;
  268. actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
  269. actuallySalary -= row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
  270. actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
  271. actuallySalary -=
  272. row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
  273. actuallySalary -=
  274. row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
  275. actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
  276. if (form.value.hasIndividualIncomeTax === 1) {
  277. actuallySalary -=
  278. row.individualIncomeTaxConfirm == null
  279. ? 0
  280. : row.individualIncomeTaxConfirm;
  281. } else {
  282. actuallySalary -=
  283. row.currentIndividualIncomeTax == null
  284. ? 0
  285. : row.currentIndividualIncomeTax;
  286. }
  287. actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
  288. row.actuallySalary = actuallySalary;
  289. computeTotal();
  290. }
  291. function computeTotal() {
  292. let totalSalay = 0;
  293. form.value.details.forEach((l) => {
  294. totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
  295. });
  296. form.value.amount = totalSalay.toFixed(2);
  297. }
  298. function returnStatus(status) {
  299. proxy.$modal
  300. .confirm("确认退回么?")
  301. .then((_) => {
  302. turnBackDetail(form.value).then((res) => {
  303. reset();
  304. getList.value();
  305. close();
  306. });
  307. })
  308. .catch((_) => {
  309. proxy.$modal.msg("已取消退回");
  310. });
  311. }
  312. function changeIndividual(arg) {
  313. // if (arg === 1) {
  314. form.value.details.forEach((row) => {
  315. let actuallySalary = 0;
  316. actuallySalary += row.planSalary == null ? 0 : row.planSalary;
  317. actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
  318. actuallySalary -=
  319. row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
  320. actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
  321. actuallySalary -=
  322. row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
  323. actuallySalary -=
  324. row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
  325. actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
  326. if (arg === 1) {
  327. actuallySalary -=
  328. row.individualIncomeTaxConfirm == null
  329. ? 0
  330. : row.individualIncomeTaxConfirm;
  331. } else {
  332. actuallySalary -=
  333. row.currentIndividualIncomeTax == null
  334. ? 0
  335. : row.currentIndividualIncomeTax;
  336. }
  337. actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
  338. row.actuallySalary = actuallySalary;
  339. });
  340. computeTotal();
  341. }
  342. function passwordCheckHandler(value, field) {
  343. // console.log(value)
  344. if (!passwordCheck(form.value[field])) {
  345. proxy.$modal.msgError("请输入正确密码");
  346. }
  347. }
  348. function handleImageView(fileUrl) {
  349. currentFileList.value = [`${baseUrl.value}${fileUrl}`];
  350. showViewer.value = true;
  351. }
  352. function closeImages() {
  353. showViewer.value = false;
  354. }
  355. // 暴露给父组件的方法
  356. defineExpose({
  357. open,
  358. });
  359. </script>
  360. <style scoped>
  361. .img {
  362. width: 23px;
  363. height: 23px;
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. }
  368. ::v-deep(.el-upload) {
  369. display: flex;
  370. text-align: center;
  371. justify-content: center;
  372. cursor: pointer;
  373. outline: 0;
  374. }
  375. .required::after {
  376. content: "*";
  377. color: red;
  378. }
  379. </style>