housingFundView.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <el-dialog title="公积金信息" v-model="visible" :width="width" append-to-body draggable @close="close" class="dialog-form">
  3. <!-- <div slot="title" class="dialog-title-container">
  4. <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
  5. <i class="el-icon-close" @click="close" />
  6. </div> -->
  7. <!-- 功能按钮 -->
  8. <div style="padding: 8px 24px 16px 24px">
  9. <el-form size="small" label-width="120px" v-model="form">
  10. <el-row :gutter="30">
  11. <el-col :span="12">
  12. <el-form-item label="客户名称">
  13. <div>{{ form.companyName }}</div>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="12">
  17. <el-form-item label="所属月份">
  18. <div>{{ form.year }}-{{ form.month }}</div>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="12">
  22. <el-form-item label="服务状态">
  23. <el-select v-model="form.status" placeholder="请选择">
  24. <el-option v-for="item in selectStatus" :key="item.value" :value="item.value" :label="item.label" />
  25. </el-select>
  26. </el-form-item>
  27. </el-col>
  28. <el-divider content-position="left">社保人员信息</el-divider>
  29. <el-col :span="24" class="details-container">
  30. <!--操作按钮 开始-->
  31. <div class="details-head"></div>
  32. <div class="details-body">
  33. <div>
  34. <el-table ref="sourceTable" :data="form.housingFundConfirm.details" size="small" max-height="490px" border
  35. show-summary :summary-method="getSummaries" highlight-current-row
  36. header-row-class-name="list-header-row" row-class-name="list-row" class="salary-table"
  37. @selection-change="handleCheckChange" @current-change="handleCurrentChange">
  38. <el-table-column type="selection" width="50" align="center" />
  39. <el-table-column type="index" label="序号" width="50" align="center" />
  40. <el-table-column label="姓名" width="80" align="center">
  41. <template #default="scope">
  42. <div>
  43. {{ scope.row.employeeName }}
  44. </div>
  45. <span style="
  46. color: red;
  47. position: absolute;
  48. z-index: 10;
  49. top: 4px;
  50. right: 12px;
  51. ">*</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="电话号" width="130" align="center">
  55. <template #default="scope">
  56. <div>
  57. {{ scope.row.phone }}
  58. </div>
  59. <span style="
  60. color: red;
  61. position: absolute;
  62. z-index: 10;
  63. top: 4px;
  64. right: 12px;
  65. ">*</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="身份证正面" width="120" align="center">
  69. <template #default="scope">
  70. <div class="show-image" style="display: flex; justify-content: center">
  71. <img class="img" :src="baseUrl + '/' + scope.row.idCardImage" alt=""
  72. @click="handleImageView(scope.row.idCardImage)" />
  73. </div>
  74. <span style="
  75. color: red;
  76. position: absolute;
  77. z-index: 10;
  78. top: 4px;
  79. right: 12px;
  80. ">*</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="身份证反面" width="120" align="center">
  84. <template #default="scope">
  85. <div class="show-image" style="display: flex; justify-content: center">
  86. <img class="img" :src="baseUrl + '/' + scope.row.idCardImageBack" alt=""
  87. @click="handleImageView(scope.row.idCardImageBack)" />
  88. </div>
  89. <span style="
  90. color: red;
  91. position: absolute;
  92. z-index: 10;
  93. top: 4px;
  94. right: 12px;
  95. ">*</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="基数" width="100" align="center">
  99. <template #default="scope">
  100. <div>
  101. {{ scope.row.cardinalNumber }}
  102. </div>
  103. <span style="
  104. color: red;
  105. position: absolute;
  106. z-index: 10;
  107. top: 4px;
  108. right: 12px;
  109. ">*</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="比例" width="100" align="center">
  113. <template #default="scope">
  114. <div>{{ scope.row.ratio }}%</div>
  115. <span style="
  116. color: red;
  117. position: absolute;
  118. z-index: 10;
  119. top: 4px;
  120. right: 12px;
  121. ">*</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="备注" header-align="center">
  125. <template #default="scope">
  126. <div>
  127. {{ scope.row.remark }}
  128. </div>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. </div>
  133. </div>
  134. </el-col>
  135. <el-col :span="24">
  136. <el-form-item label="备注">
  137. {{ form.housingFundConfirm.content }}
  138. </el-form-item>
  139. </el-col>
  140. <el-divider content-position="left">社保申报信息</el-divider>
  141. <el-col :span="12">
  142. <el-form-item label="单位缴纳:">
  143. {{ form.housingFundDeclare.unitAmount }}
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="12">
  147. <el-form-item label="个人缴纳:">
  148. {{ form.housingFundDeclare.individualAmount }}
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="12">
  152. <el-form-item label="合计:">
  153. {{ form.housingFundDeclare.amount }}
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span="24">
  157. <el-divider />
  158. </el-col>
  159. <el-col :span="24">
  160. <el-form-item label="备注">
  161. <!-- <el-input v-model.trim="form.housingFundDeclare.content" type="textarea" rows="2" /> -->
  162. {{ form.housingFundDeclare.content }}
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="24">
  166. <el-form-item label="凭证" required>
  167. <el-table ref="dbTable" :data="form.housingFundDeclare.evidenceFiles" size="small" border
  168. header-row-class-name="list-header-row" row-class-name="list-row">
  169. <el-table-column label="文件名" prop="originalFileName" align="center" show-overflow-tooltip>
  170. <template #default="scope">
  171. <el-button size="small" type="text" @click="openFile(scope.row)">{{
  172. scope.row.originalFileName == ""
  173. ? "打开文件"
  174. : scope.row.originalFileName
  175. }}</el-button>
  176. </template>
  177. </el-table-column>
  178. <!-- <el-table-column
  179. label="文件类型"
  180. width="80"
  181. prop="fileType"
  182. align="center"
  183. /> -->
  184. </el-table>
  185. </el-form-item>
  186. </el-col>
  187. </el-row>
  188. </el-form>
  189. </div>
  190. <div class="form-btns-container" style="height: 40px">
  191. <el-button size="small" style="float: right" @click="close" icon="close">取消</el-button>
  192. </div>
  193. <el-image-viewer v-if="showViewer" :url-list="currentFileList" @close="closeImages" :initial-index="showIndex" />
  194. <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
  195. <print-dialog ref="printDialog" :parent="this" /> -->
  196. </el-dialog>
  197. </template>
  198. <script setup>
  199. import {
  200. getDetail,
  201. saveDetail,
  202. updateDetail,
  203. } from "@/api/business/crm/serviceWorkOrder";
  204. import { ref } from "vue";
  205. const { proxy } = getCurrentInstance();
  206. const visible = ref(false);
  207. const width = ref(800);
  208. const selections = ref([]);
  209. const currentSource = ref(null);
  210. const showViewer = ref(false);
  211. const props = defineProps({
  212. getList: {
  213. type: Function,
  214. default: () => { },
  215. },
  216. });
  217. const selectStatus = ref([
  218. {
  219. label: "未开始",
  220. value: 0,
  221. color: "#fff",
  222. },
  223. {
  224. label: "进行中",
  225. value: 1,
  226. color: "#FFB836",
  227. },
  228. {
  229. label: "已完成",
  230. value: 3,
  231. color: "#2FCB81",
  232. },
  233. ]);
  234. const { getList } = toRefs(props);
  235. const total = ref(0);
  236. const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
  237. const employeeEmptyData = {
  238. id: null,
  239. title: "",
  240. remark: "",
  241. employeeName: "",
  242. departmentName: "",
  243. idCardImage: "",
  244. idCardImageBack: "",
  245. idiograph: "",
  246. details: [],
  247. editStatus: true,
  248. };
  249. const form = ref({});
  250. const emptyForm = {
  251. housingFundConfirm: {},
  252. housingFundDeclare: {},
  253. };
  254. function open(detail) {
  255. visible.value = true;
  256. form.value = { ...emptyForm, ...detail };
  257. loadData();
  258. }
  259. function loadData() {
  260. getDetail(form.value).then((res) => {
  261. form.value = { ...proxy.deepClone(emptyForm), ...res.data };
  262. computeTotal();
  263. });
  264. }
  265. function close() {
  266. visible.value = false;
  267. reset();
  268. }
  269. function reset() {
  270. form.value = proxy.deepClone(emptyForm);
  271. }
  272. function printSalary() { }
  273. function exportSalary() { }
  274. function handleCurrentChange(row) {
  275. currentSource.value = row;
  276. }
  277. function handleCheckChange(selection) {
  278. selections.value = selection.map((item) => item);
  279. }
  280. function handleSave() {
  281. proxy.$modal
  282. .confirm("确认保存么?")
  283. .then(() => {
  284. const saveValue = proxy.deepClone(form.value);
  285. saveDetail(saveValue).then((res) => {
  286. proxy.$modal.msgSuccess("保存成功");
  287. reset();
  288. close();
  289. getList.value();
  290. });
  291. })
  292. .catch((err) => {
  293. proxy.$modal.msg("取消保存");
  294. });
  295. }
  296. function getSummaries(param) {
  297. const { columns, data } = param;
  298. const sums = [];
  299. columns.forEach((column, index) => {
  300. if (index === 0) {
  301. sums[index] = "合计";
  302. return;
  303. } else if (index === 1) {
  304. sums[index] = "";
  305. return;
  306. }
  307. const values = data.map((item) => Number(item[column.property]));
  308. if (!values.every((value) => isNaN(value))) {
  309. sums[index] = values.reduce((prev, curr) => {
  310. const value = Number(curr);
  311. if (!isNaN(value)) {
  312. return (Number(prev) + Number(curr)).toFixed(2);
  313. } else {
  314. return Number(prev).toFixed(2);
  315. }
  316. }, 0);
  317. } else {
  318. sums[index] = "";
  319. }
  320. });
  321. return sums;
  322. }
  323. function handleEmployeeCreate() {
  324. // 此处必须进行深拷贝,否则添加的明细,将都指向了一个对象
  325. const _newSource = JSON.parse(JSON.stringify(employeeEmptyData));
  326. form.value.housingFundConfirm.details.push(_newSource);
  327. handleCurrentChange(_newSource);
  328. }
  329. function handleEmployeeBatchDelete() {
  330. proxy.$modal
  331. .confirm("确定删除?")
  332. .then(() => {
  333. form.value.housingFundConfirm.details =
  334. form.value.housingFundConfirm.details.filter(
  335. (item) => selections.value.indexOf(item) === -1
  336. );
  337. })
  338. .catch(() => {
  339. proxy.$modal.msg("已取消删除");
  340. });
  341. }
  342. function upload(param) {
  343. const formData = new FormData();
  344. formData.append("file", param.file);
  345. uploadFile(formData).then((res) => {
  346. if (res.code === 200) {
  347. const file = {};
  348. file.fileName = res.newFileName;
  349. file.url = res.url;
  350. file.originalFileName = res.originalFilename;
  351. file.fileUrl = res.fileName;
  352. form.value.housingFundDeclare.evidenceFiles.push(file);
  353. }
  354. });
  355. }
  356. function openFile(row) {
  357. window.open(`${baseUrl.value}${row.fileUrl}`);
  358. }
  359. function handleDel(row, index) {
  360. proxy.$modal
  361. .confirm("确定删除吗?")
  362. .then((_) => {
  363. form.value.housingFundDeclare.evidenceFiles.splice(index, 1);
  364. })
  365. .catch((_) => {
  366. proxy.$modal.msg("已取消删除");
  367. });
  368. }
  369. function computeTotal() {
  370. let totalSalay = 0;
  371. form.value.housingFundConfirm.details.forEach((l) => {
  372. totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
  373. });
  374. form.value.housingFundConfirm.amount = totalSalay.toFixed(2);
  375. }
  376. function uploadIdImage(param, row, field) {
  377. const formData = new FormData();
  378. formData.append("file", param.file);
  379. uploadFile(formData).then((res) => {
  380. if (res.code === 200) {
  381. const file = {};
  382. file.fileName = res.newFileName;
  383. file.url = res.url;
  384. file.originalFileName = res.originalFilename;
  385. file.fileUrl = res.fileName;
  386. row[field] = file.fileUrl;
  387. }
  388. });
  389. }
  390. function handleImageView(fileUrl) {
  391. currentFileList.value = [`${baseUrl.value}${fileUrl}`];
  392. showViewer.value = true;
  393. }
  394. function closeImages() {
  395. showViewer.value = false;
  396. }
  397. // 暴露给父组件的方法
  398. defineExpose({
  399. open,
  400. });
  401. </script>
  402. <style scoped>
  403. .img {
  404. width: 23px;
  405. height: 23px;
  406. display: flex;
  407. justify-content: center;
  408. align-items: center;
  409. }
  410. ::v-deep(.el-upload) {
  411. display: flex;
  412. text-align: center;
  413. justify-content: center;
  414. cursor: pointer;
  415. outline: 0;
  416. }
  417. .required::after {
  418. content: "*";
  419. color: red;
  420. }
  421. </style>
  422. <style>
  423. .el-table .delete-row {
  424. background-color: rgb(251, 159, 173);
  425. }
  426. .el-table .add-row {
  427. background-color: rgb(184, 234, 147);
  428. }
  429. </style>