form.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <el-dialog title="公积金人员信息" v-model="visible" width="80%" append-to-body draggable @close="close" :close-on-click-modal = "false">
  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="135px" 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 v-if="form.status === 4" :span="12">
  22. <el-form-item label="驳回原因">
  23. <div>{{ form.feedbackContent }}</div>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="12">
  27. <el-form-item label="窗口缴纳:" required class="edit-label">
  28. <template #label>
  29. <div>
  30. 窗口缴纳:<el-button v-if="form.isFirstHousingFund === 1" type="primary" link icon="Edit"
  31. @click="changeEdit" />
  32. </div>
  33. </template>
  34. <el-checkbox v-if="form.isFirstHousingFund === 0 || editStatus" v-model="form.isPayOnWindow"
  35. :true-label="1" :false-label="0" @change="isPayOnWindowChange()">
  36. {{ "" }}</el-checkbox>
  37. <div v-else>{{ form.isPayOnWindow === 1 ? "是" : "否" }}</div>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="12">
  41. <el-form-item label="公积金单位账号:" required class="edit-label">
  42. <template #label>
  43. <div>
  44. 公积金单位账号:<el-button v-if="form.isFirstHousingFund === 1" type="primary" link icon="Edit"
  45. @click="changeEdit" />
  46. </div>
  47. </template>
  48. <el-input v-if="form.isFirstHousingFund === 0 || editStatus" v-model="form.housingFundUnitAccount"
  49. placeholder="公积金单位账号" />
  50. <div v-else>{{ form.housingFundUnitAccount }}</div>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="12">
  54. <el-form-item label="公积金秘钥密码:" :required="form.isPayOnWindow === 0" class="edit-label">
  55. <template #label>
  56. <div>
  57. 公积金秘钥密码:<el-button v-if="form.isFirstHousingFund === 1" type="primary" link icon="Edit"
  58. @click="changeEdit" />
  59. </div>
  60. </template>
  61. <el-input v-if="form.isFirstHousingFund === 0 || editStatus" v-model="form.housingFundPassword"
  62. placeholder="公积金秘钥密码:" @blur="
  63. (value) => passwordCheckHandler(value, 'housingFundPassword')
  64. " />
  65. <div v-else>{{ form.housingFundPassword }}</div>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="12">
  69. <el-form-item label="公积金划款密码:" :required="form.isPayOnWindow === 0" class="edit-label">
  70. <template #label>
  71. <div>
  72. 公积金划款密码:<el-button v-if="form.isFirstHousingFund === 1" type="primary" link icon="Edit"
  73. @click="changeEdit" />
  74. </div>
  75. </template>
  76. <el-input v-if="form.isFirstHousingFund === 0 || editStatus" v-model="form.housingFundDeductionPassword"
  77. placeholder="公积金划款密码:" @blur="
  78. (value) =>
  79. passwordCheckHandler(value, 'housingFundDeductionPassword')
  80. " />
  81. <div v-else>{{ form.housingFundDeductionPassword }}</div>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="24" class="details-container">
  85. <!--操作按钮 开始-->
  86. <div class="details-head" >
  87. <div class="title">
  88. <i class="fa fa-th-list" aria-hidden="true" /> 人员信息
  89. </div>
  90. <el-button type="primary" size="small" icon="plus" @click="handleEmployeeCreate" class="button-class">
  91. 新增</el-button>
  92. <el-button v-if="selections.length > 0" type="danger" size="small" icon="delete" class="button-class"
  93. @click="handleEmployeeBatchDelete">删除
  94. </el-button>
  95. </div>
  96. <div class="details-body">
  97. <div>
  98. <el-table ref="sourceTable" :data="form.details" size="small" max-height="490px" border show-summary
  99. :summary-method="getSummaries" highlight-current-row header-row-class-name="list-header-row"
  100. row-class-name="list-row" class="salary-table" @selection-change="handleCheckChange"
  101. @current-change="handleCurrentChange">
  102. <el-table-column type="selection" width="50" align="center" />
  103. <el-table-column type="index" label="序号" width="50" align="center" />
  104. <el-table-column label="姓名" width="80" align="center">
  105. <template #default="scope">
  106. <div>
  107. <el-input v-model="scope.row.employeeName" size="small" placeholder="姓名" style="width: 100%" />
  108. </div>
  109. <span style="
  110. color: red;
  111. position: absolute;
  112. z-index: 10;
  113. top: 4px;
  114. right: 12px;
  115. ">*</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="电话号" width="130" align="center">
  119. <template #default="scope">
  120. <div>
  121. <el-input v-model="scope.row.phone" size="small" placeholder="电话号码" style="width: 100%" />
  122. </div>
  123. <span style="
  124. color: red;
  125. position: absolute;
  126. z-index: 10;
  127. top: 4px;
  128. right: 12px;
  129. ">*</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="身份证正面" width="120" align="center">
  133. <template #default="scope">
  134. <div>
  135. <!-- <el-upload action="#" :http-request="
  136. (params) => upload(params, scope.row, 'idCardImage')
  137. " :with-credentials="true" :show-file-list="false">
  138. <template v-if="scope.row.idCardImage === ''">
  139. <div class="el-upload__text" style="color: blue">
  140. 点击上传
  141. </div>
  142. </template>
  143. <img v-else class="img" :src="baseUrl + '/' + scope.row.idCardImage" alt="" />
  144. </el-upload> -->
  145. <div>
  146. <div id="preview" v-on:paste="handlePaste($event,scope.row,'idCardImage')"
  147. v-if="scope.row.idCardImage === ''">
  148. <span>将图片粘贴至此</span>
  149. </div>
  150. <div class="image-container" v-else>
  151. <el-image class="img" :src="baseUrl + scope.row.idCardImage" alt=""
  152. preview-teleported="true" fit="contain" :preview-src-list="srcList"
  153. @click="vbs(baseUrl + scope.row.idCardImage)" />
  154. <!-- 删除按钮 -->
  155. <el-icon v-if="scope.row.idCardImage !== ''" @click="scope.row.idCardImage = ''"
  156. class="delete-button">
  157. <Delete />
  158. </el-icon>
  159. </div>
  160. </div>
  161. </div>
  162. <span style="
  163. color: red;
  164. position: absolute;
  165. z-index: 10;
  166. top: 4px;
  167. right: 12px;
  168. ">*</span>
  169. </template>
  170. </el-table-column>
  171. <el-table-column label="身份证反面" width="120" align="center">
  172. <template #default="scope">
  173. <div>
  174. <!-- <el-upload action="#" :http-request="
  175. (params) =>
  176. upload(params, scope.row, 'idCardImageBack')
  177. " :with-credentials="true" :show-file-list="false">
  178. <template v-if="scope.row.idCardImageBack === ''">
  179. <div class="el-upload__text" style="color: blue">
  180. 点击上传
  181. </div>
  182. </template>
  183. <img v-else class="img" :src="baseUrl + '/' + scope.row.idCardImageBack" alt="" />
  184. </el-upload> -->
  185. <div>
  186. <div id="preview2" v-on:paste="handlePaste($event,scope.row,'idCardImageBack')"
  187. v-if="scope.row.idCardImageBack === ''">
  188. <span>将图片粘贴至此</span>
  189. </div>
  190. <div class="image-container" v-else>
  191. <el-image class="img" :src="baseUrl + scope.row.idCardImageBack" alt=""
  192. preview-teleported="true" fit="contain" :preview-src-list="srcListback"
  193. @click="vbsBack(baseUrl + scope.row.idCardImageBack)" />
  194. <!-- 删除按钮 -->
  195. <el-icon v-if="scope.row.idCardImageBack !== ''"
  196. @click="scope.row.idCardImageBack = ''" class="delete-button">
  197. <Delete />
  198. </el-icon>
  199. </div>
  200. </div>
  201. </div>
  202. <span style="
  203. color: red;
  204. position: absolute;
  205. z-index: 10;
  206. top: 4px;
  207. right: 12px;
  208. ">*</span>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="基数" width="100" align="center">
  212. <template #default="scope">
  213. <div>
  214. <el-input v-model="scope.row.cardinalNumber" size="small" placeholder="基数"
  215. @blur="onblur(scope.row, 'cardinalNumber')" />
  216. </div>
  217. <span style="
  218. color: red;
  219. position: absolute;
  220. z-index: 10;
  221. top: 4px;
  222. right: 12px;
  223. ">*</span>
  224. </template>
  225. </el-table-column>
  226. <el-table-column label="比例" width="100" align="center">
  227. <template #default="scope">
  228. <div>
  229. <el-input v-model="scope.row.ratio" size="small" @blur="onblur(scope.row, 'ratio')">
  230. <template #suffix>
  231. <i style="
  232. font-style: normal;
  233. margin-right: 0px;
  234. display: inline-block;
  235. line-height: 20px;
  236. ">%</i>
  237. </template>
  238. </el-input>
  239. </div>
  240. <span style="
  241. color: red;
  242. position: absolute;
  243. z-index: 10;
  244. top: 4px;
  245. right: 12px;
  246. ">*</span>
  247. </template>
  248. </el-table-column>
  249. <!-- <el-table-column label="签名" width="100" header-align="center" required>
  250. </el-table-column> -->
  251. <el-table-column label="备注" header-align="center">
  252. <template #default="scope">
  253. <div>
  254. <el-input v-model="scope.row.remark" size="small" placeholder="备注" />
  255. </div>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. </div>
  260. </div>
  261. </el-col>
  262. <el-col :span="24">
  263. <el-divider />
  264. </el-col>
  265. <el-col :span="24">
  266. <el-form-item label="公积金人员变更">
  267. <el-select v-model="form.isChanged" placeholder="请选择" style="width: 100%">
  268. <el-option v-for="item in yesOrNo" :key="item.label" :label="item.label" :value="item.value" />
  269. </el-select>
  270. </el-form-item>
  271. </el-col>
  272. <el-col :span="24">
  273. <el-form-item label="备注">
  274. <el-input v-model.trim="form.content" maxlength="200" show-word-limit type="textarea" rows="2" />
  275. </el-form-item>
  276. </el-col>
  277. </el-row>
  278. </el-form>
  279. </div>
  280. <div class="form-btns-container" style="height: 40px">
  281. <el-button size="small" @click="close" icon="close"
  282. style="float: right; margin-left: 12px; margin-right: 12px">取消</el-button>
  283. <el-button type="primary" size="small" style="float: right" icon="Finished" @click="handleSave(2)">
  284. 保存</el-button>
  285. <el-button type="warning" size="small" icon="Edit" style="float: right" @click="handleSave(1)">
  286. 待确认</el-button>
  287. </div>
  288. <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
  289. <print-dialog ref="printDialog" :parent="this" /> -->
  290. </el-dialog>
  291. </template>
  292. <script setup>
  293. import {
  294. getDetail,
  295. saveDetail,
  296. updateDetail,
  297. checkEmployees,
  298. } from "@/api/business/production/housingFundConfirm";
  299. import { uploadFile } from "@/api/tool/file";
  300. import { ref } from "vue";
  301. import zTool from '@/utils/zTool'
  302. import { yesOrNo } from "@/utils/default";
  303. const { proxy } = getCurrentInstance();
  304. const visible = ref(false);
  305. const width = ref(900);
  306. const selections = ref([]);
  307. const currentSource = ref(null);
  308. const editStatus = ref(false);
  309. const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
  310. const props = defineProps({
  311. getList: {
  312. type: Function,
  313. default: () => { },
  314. },
  315. });
  316. const { getList } = toRefs(props);
  317. const total = ref(0);
  318. const tempFile = ref(null)
  319. const employeeEmptyData = {
  320. id: null,
  321. title: "",
  322. remark: "",
  323. employeeName: "",
  324. departmentName: "",
  325. idCardImage: "",
  326. idCardImageBack: "",
  327. idiograph: "",
  328. details: [],
  329. editStatus: true,
  330. };
  331. const srcList = ref([
  332. "https://elevator4s-oss.oss-cn-hangzhou.aliyuncs.com/2021/05/07/b632db6a837f46e0950670277fa9e5e5multipartFile.png"
  333. ]);
  334. const srcListback = ref([
  335. "https://elevator4s-oss.oss-cn-hangzhou.aliyuncs.com/2021/05/07/b632db6a837f46e0950670277fa9e5e5multipartFile.png"
  336. ]);
  337. const form = ref({});
  338. const emptyForm = {
  339. details: [],
  340. };
  341. function open(detail) {
  342. visible.value = true;
  343. form.value = detail;
  344. loadData();
  345. }
  346. function vbs(val) {
  347. srcList.value = []
  348. srcList.value.push(val)
  349. }
  350. function vbsBack(val) {
  351. srcListback.value = []
  352. srcListback.value.push(val)
  353. }
  354. function loadData() {
  355. getDetail(form.value).then((res) => {
  356. form.value = { ...proxy.deepClone(emptyForm), ...res.data };
  357. if (form.value.status === 2 || form.value.status === 3) {
  358. proxy.$modal.msgError("该信息已提交待审核");
  359. close();
  360. }
  361. });
  362. }
  363. function close() {
  364. visible.value = false;
  365. reset();
  366. }
  367. function reset() {
  368. editStatus.value = false;
  369. form.value = proxy.deepClone(emptyForm);
  370. }
  371. function printSalary() { }
  372. function exportSalary() { }
  373. function handleCurrentChange(row) {
  374. currentSource.value = row;
  375. }
  376. function handleCheckChange(selection) {
  377. selections.value = selection.map((item) => item);
  378. }
  379. function handleEmployeeCreate() {
  380. // 此处必须进行深拷贝,否则添加的明细,将都指向了一个对象
  381. const _newSource = JSON.parse(JSON.stringify(employeeEmptyData));
  382. form.value.details.push(_newSource);
  383. handleCurrentChange(_newSource);
  384. }
  385. function handleEmployeeBatchDelete() {
  386. proxy.$modal
  387. .confirm("确定删除?")
  388. .then(() => {
  389. form.value.details = form.value.details.filter(
  390. (item) => selections.value.indexOf(item) === -1
  391. );
  392. })
  393. .catch(() => {
  394. proxy.$modal.msg("已取消删除");
  395. });
  396. }
  397. function getSummaries(param) {
  398. const { columns, data } = param;
  399. const sums = [];
  400. columns.forEach((column, index) => {
  401. if (index === 0) {
  402. sums[index] = "合计";
  403. return;
  404. } else if (index === 1) {
  405. sums[index] = "";
  406. return;
  407. }
  408. const values = data.map((item) => Number(item[column.property]));
  409. if (!values.every((value) => isNaN(value))) {
  410. sums[index] = values.reduce((prev, curr) => {
  411. const value = Number(curr);
  412. if (!isNaN(value)) {
  413. return (Number(prev) + Number(curr)).toFixed(2);
  414. } else {
  415. return Number(prev).toFixed(2);
  416. }
  417. }, 0);
  418. } else {
  419. sums[index] = "";
  420. }
  421. });
  422. return sums;
  423. }
  424. async function handleSave(status) {
  425. for (let i = 0; i < form.value.details.length; i++) {
  426. const l = form.value.details[i];
  427. // 数据校验
  428. if (l.employeeName == null || l.employeeName === "") {
  429. proxy.$modal.msgError(`第${i + 1}行姓名不能为空`);
  430. return;
  431. }
  432. if (l.phone == null || l.phone === "") {
  433. proxy.$modal.msgError(`第${i + 1}行电话不能为空`);
  434. return;
  435. }
  436. // 正则表达式匹配身份证号的格式
  437. const regExp = /1[3-9]\d{9}/;
  438. if (!regExp.test(l.phone)) {
  439. proxy.$modal.msgError(`第${i + 1}行请输入正确的电话号码!`);
  440. return;
  441. }
  442. if (!l.idCardImage) {
  443. proxy.$modal.msgError(`第${i + 1}行身份证正面照不能为空`);
  444. return;
  445. }
  446. if (!l.idCardImageBack) {
  447. proxy.$modal.msgError(`第${i + 1}行身份证反面照不能为空`);
  448. return;
  449. }
  450. if (!l.cardinalNumber) {
  451. proxy.$modal.msgError(`第${i + 1}行基数不能为空`);
  452. return;
  453. }
  454. if (!l.ratio) {
  455. proxy.$modal.msgError(`第${i + 1}行比例不能为空`);
  456. return;
  457. }
  458. }
  459. if (form.value.isFirstHousingFund === 0 && form.value.isPayOnWindow === 0) {
  460. if (!form.value.housingFundUnitAccount) {
  461. proxy.$modal.msgError("请输入公积金单位账号");
  462. return;
  463. }
  464. if (!form.value.housingFundPassword) {
  465. proxy.$modal.msgError("请输入公积金秘钥密码");
  466. return;
  467. }
  468. if (!passwordCheck(form.value.housingFundPassword)) {
  469. proxy.$modal.msgError("请输入正确的公积金秘钥密码");
  470. return;
  471. }
  472. if (!form.value.housingFundDeductionPassword) {
  473. proxy.$modal.msgError("请输入公积金划款密码");
  474. return;
  475. }
  476. if (!passwordCheck(form.value.housingFundDeductionPassword)) {
  477. proxy.$modal.msgError("请输入正确的公积金密码");
  478. return;
  479. }
  480. }
  481. const res = await checkEmployees(form.value);
  482. if (!res.data) {
  483. proxy.$modal.confirm("该月公积金人员出现变更确定保存么?").then(() => {
  484. const saveValue = proxy.deepClone(form.value);
  485. saveValue.isChanged = 1;
  486. // saveValue.status = 2;
  487. saveValue.status = status;
  488. if (saveValue.id == null) {
  489. saveDetail(saveValue).then((res) => {
  490. proxy.$modal.msgSuccess("保存成功");
  491. reset();
  492. close();
  493. getList.value();
  494. });
  495. } else {
  496. updateDetail(saveValue).then((res) => {
  497. proxy.$modal.msgSuccess("保存成功");
  498. reset();
  499. close();
  500. getList.value();
  501. });
  502. }
  503. });
  504. } else {
  505. proxy.$modal
  506. .confirm("确认保存么?")
  507. .then(() => {
  508. const saveValue = proxy.deepClone(form.value);
  509. // saveValue.status = 2;
  510. saveValue.status = status;
  511. if (saveValue.id == null) {
  512. saveDetail(saveValue).then((res) => {
  513. proxy.$modal.msgSuccess("保存成功");
  514. reset();
  515. close();
  516. getList.value();
  517. });
  518. } else {
  519. updateDetail(saveValue).then((res) => {
  520. proxy.$modal.msgSuccess("保存成功");
  521. reset();
  522. close();
  523. getList.value();
  524. });
  525. }
  526. })
  527. .catch((err) => {
  528. proxy.$modal.msg("取消保存");
  529. });
  530. }
  531. }
  532. function passwordCheckHandler(value, field) {
  533. // console.log(value)
  534. if (!passwordCheck(form.value[field])) {
  535. proxy.$modal.msgError("请输入正确密码");
  536. }
  537. }
  538. function passwordCheck(value) {
  539. const pattern = /^[A-Za-z0-9~!@#$%^&*()_+-=]*$/;
  540. if (!pattern.test(value)) {
  541. return false;
  542. }
  543. return true;
  544. }
  545. function upload(param, row, field) {
  546. const formData = new FormData();
  547. formData.append("file", param.file);
  548. uploadFile(formData).then((res) => {
  549. if (res.code === 200) {
  550. const file = {};
  551. file.fileType =
  552. res.newFileName.split(".")[res.newFileName.split(".").length - 1];
  553. if (file.fileType !== "png" && file.fileType !== "jpg") {
  554. proxy.$modal.msgError("文件类型错误,只能上传png,jpg格式");
  555. return;
  556. }
  557. file.fileName = res.newFileName;
  558. file.url = res.url;
  559. file.originalFileName = res.originalFilename;
  560. file.fileUrl = res.fileName;
  561. row[field] = file.fileUrl;
  562. }
  563. });
  564. }
  565. function changeEdit() {
  566. editStatus.value = !editStatus.value;
  567. }
  568. function onblur(data, field) {
  569. const reg = /^-?[1-9]\d*\.\d*|0\.\d*[1-9]\d*|[0-9]*/;
  570. const match = data[field].match(reg);
  571. if (isNaN(Number(match[0]))) {
  572. data[field] = "";
  573. return;
  574. }
  575. data[field] = match[0].replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
  576. const previous = data[field];
  577. // // 可以再次通过失焦事件先去除开头的0 再取出末尾的0
  578. data[field] = data[field].replace(/^0+\./g, "0."); // 把小数0开头的多余0去掉
  579. data[field] = data[field].replace(/^[0]+/, ""); // 把整数0开头的多余0去掉
  580. data[field] = data[field].match(/\./) ? parseFloat(data[field]) : data[field]; // 去除小数末尾的0
  581. data[field] = data[field] === "" && previous !== "" ? "0" : data[field];
  582. }
  583. // 监听粘贴操作
  584. function handlePaste(event, row, field) {
  585. const items = (event.clipboardData || window.clipboardData).items;
  586. let file = null;
  587. if (!items || items.length === 0) {
  588. this.$message.error("当前浏览器不支持本地");
  589. return;
  590. }
  591. // 搜索剪切板items
  592. for (let i = 0; i < items.length; i++) {
  593. if (items[i].type.indexOf("image") !== -1) {
  594. file = items[i].getAsFile();
  595. break;
  596. }
  597. }
  598. if (!file) {
  599. this.$message.error("粘贴内容非图片");
  600. return;
  601. }
  602. zTool.addWatermark(file,"仅供公积金申报使用").then(watermarkedFile => {
  603. tempFile.value = watermarkedFile
  604. uploadIdImage2(tempFile, row, field)
  605. })
  606. // tempFile.value = file;
  607. // uploadIdImage2(tempFile, row, field)
  608. }
  609. function uploadIdImage2(tempFile, row, field) {
  610. const formData = new FormData();
  611. formData.append("file", tempFile.value);
  612. uploadFile(formData).then((res) => {
  613. if (res.code === 200) {
  614. const file = {};
  615. file.fileType =
  616. res.newFileName.split(".")[res.newFileName.split(".").length - 1];
  617. if (file.fileType !== "png" && file.fileType !== "jpg") {
  618. proxy.$modal.msgError("文件类型错误,只能上传png,jpg格式");
  619. return;
  620. }
  621. file.fileName = res.newFileName;
  622. file.url = res.url;
  623. file.originalFileName = res.originalFilename;
  624. file.fileUrl = res.fileName;
  625. row[field] = file.fileUrl;
  626. }
  627. });
  628. }
  629. function isPayOnWindowChange() { }
  630. // 暴露给父组件的方法
  631. defineExpose({
  632. open,
  633. });
  634. </script>
  635. <style scoped>
  636. .image-container {
  637. display: flex;
  638. /* 使用Flex布局 */
  639. align-items: center;
  640. /* 垂直居中 */
  641. }
  642. .delete-button {
  643. margin-left: 20px;
  644. cursor: pointer;
  645. }
  646. .img {
  647. width: 23px;
  648. height: 23px;
  649. display: flex;
  650. justify-content: center;
  651. align-items: center;
  652. margin-left: 20px;
  653. }
  654. .button-class{
  655. margin-top: 15px;
  656. margin-bottom: 15px;
  657. }
  658. ::v-deep(.el-upload) {
  659. display: flex;
  660. text-align: center;
  661. justify-content: center;
  662. cursor: pointer;
  663. outline: 0;
  664. }
  665. .required::after {
  666. content: "*";
  667. color: red;
  668. }
  669. </style>