From ce314d4b0dc417e2b5af34eb53c3dfbaf3e528d8 Mon Sep 17 00:00:00 2001
From: zhangzhen <525765282@qq.com>
Date: Tue, 21 Oct 2025 11:31:50 +0800
Subject: [PATCH] 职员信息新增图片上传及展示;
---
src/assets/user.svg | 1 +
src/components/Common/CommonNewBill.js | 20 +++++++++++++++++---
src/components/Common/CommonNewBillEvent.js | 31 +++++++++++++++----------------
src/components/Common/CommonView/index.js | 4 ++--
src/components/Common/ToolBar/ToolBarNew.js | 40 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 75 insertions(+), 21 deletions(-)
create mode 100644 src/assets/user.svg
diff --git a/src/assets/user.svg b/src/assets/user.svg
new file mode 100644
index 0000000..5cbee6f
--- /dev/null
+++ b/src/assets/user.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Common/CommonNewBill.js b/src/components/Common/CommonNewBill.js
index 601515f..83eea6e 100644
--- a/src/components/Common/CommonNewBill.js
+++ b/src/components/Common/CommonNewBill.js
@@ -35,6 +35,7 @@ import CommonViewDragable from "@/components/Common/CommonViewDragable";
import CommonExamInfo from "@/components/Common/CommonExamInfo";
import JsonFormatter from "@/components/Common/Json/JsonFormatter";
import lodash from "lodash";
+import userImgs from "@/assets/user.svg";
// import ProcessIcon from '../../assets/process.svg';
// import DisableProcessIcon from '../../assets/disableprocess.svg';
@@ -2747,8 +2748,21 @@ const BillComponent = Form.create({
backgroundColor: "#fff",
}}
>
-
-
+
+
+
+
+ {
+ ["contacts"].includes(props.sModelsType) && (
+

{
+ event.target.src = userImgs;
+ }}
+ />
+ )
+ }
{props.sModelsType === "element/workcalendar" ? (
@@ -2767,7 +2781,7 @@ const BillComponent = Form.create({
}}
>
{commonUtils.isNotEmptyArr(diliverConfigTypeArr1)
diff --git a/src/components/Common/CommonNewBillEvent.js b/src/components/Common/CommonNewBillEvent.js
index d448248..b386524 100644
--- a/src/components/Common/CommonNewBillEvent.js
+++ b/src/components/Common/CommonNewBillEvent.js
@@ -1700,21 +1700,21 @@ export default ChildComponent => {
// }
// })
// })
- const tableData = this.props.slaveData.sort((a, b) => {
- const hasA = a.hasOwnProperty("sName") && a.sName != null;
- const hasB = b.hasOwnProperty("sName") && b.sName != null;
- if (hasA && !hasB) return -1;
- if (!hasA && hasB) return 1;
-
- // 2. bVisible 为 true 的在前
- const visA = a.bVisible === true;
- const visB = b.bVisible === true;
- if (visA && !visB) return -1;
- if (!visA && visB) return 1;
-
- // 3. 最后按 iOrder 升序
- return a.iOrder - b.iOrder;
- });
+ const tableData = this.props.slaveData?.sort((a, b) => {
+ const hasA = a.hasOwnProperty("sName") && a.sName != null;
+ const hasB = b.hasOwnProperty("sName") && b.sName != null;
+ if (hasA && !hasB) return -1;
+ if (!hasA && hasB) return 1;
+
+ // 2. bVisible 为 true 的在前
+ const visA = a.bVisible === true;
+ const visB = b.bVisible === true;
+ if (visA && !visB) return -1;
+ if (!visA && visB) return 1;
+
+ // 3. 最后按 iOrder 升序
+ return a.iOrder - b.iOrder;
+ });
params.data.forEach(item=>{
if (item.name === "slave") {
const isSettingFunctions = item.column.some(col => col.isSettingFunctions);
@@ -1727,7 +1727,6 @@ export default ChildComponent => {
}
}
})
- console.log("params", this.props);
const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
if (commonUtils.isNotEmptyObject(returnData)) {
diff --git a/src/components/Common/CommonView/index.js b/src/components/Common/CommonView/index.js
index 7ef8a65..e2f1cff 100644
--- a/src/components/Common/CommonView/index.js
+++ b/src/components/Common/CommonView/index.js
@@ -47,8 +47,8 @@ export default class CommonView extends Component {
randomId: commonUtils.createSid(),
previewVisible: false, /* 图片预览弹窗 */
previewImage: '', /* 预览图片地址 */
- expanded: false,
- bShowArrow: true,
+ expanded: ["contacts"].includes(this.props.sModelsType),
+ bShowArrow: !["contacts"].includes(props.sModelsType),
};
this.showConfigEnabledJson = {};
}
diff --git a/src/components/Common/ToolBar/ToolBarNew.js b/src/components/Common/ToolBar/ToolBarNew.js
index a786f06..a91b0f0 100644
--- a/src/components/Common/ToolBar/ToolBarNew.js
+++ b/src/components/Common/ToolBar/ToolBarNew.js
@@ -2178,6 +2178,46 @@ class ToolBarComponent extends Component {
this.props.onSaveState({
visibleOtherFilfile: true,
});
+ } else if (key.indexOf("BtnUpload_") > -1) {
+ const targetField = key.replace("BtnUpload_", "");
+ const fileInput = document.createElement('input');
+ fileInput.type = 'file';
+ fileInput.accept = 'image/*';
+ fileInput.style.position = 'fixed';
+ fileInput.style.left = '-9999px';
+ document.body.appendChild(fileInput);
+
+ fileInput.addEventListener('change', (e) => {
+ const file = e.target.files[0];
+ const formData = new FormData();
+ formData.append('file', file);
+
+ const { formId } = this.props;
+ const { token } = this.props.app;
+ const url = `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`;
+ fetch(url, {
+ method: 'POST',
+ body: formData,
+ }).then(res => res.json()).then(response => {
+ if (response.code === 1) {
+ const imgUrl = response.dataset.rows[0].savePathStr;
+ const { masterData = {} } = this.props;
+ this.props.onSaveState({
+ masterData: {
+ ...masterData,
+ [targetField]: imgUrl,
+ handleType: masterData.handleType || 'update'
+ }
+ });
+ } else {
+ this.props.getServiceError(response);
+ }
+ })
+
+ document.body.removeChild(fileInput);
+ });
+
+ fileInput.click();
} else if (key.indexOf("BtnUpload") > -1) {
/* 上传 */
const { slaveSelectedRowKeys } = this.props;
--
libgit2 0.22.2