Commit ce314d4b0dc417e2b5af34eb53c3dfbaf3e528d8

Authored by zhangzzzz
1 parent 10999751

职员信息新增图片上传及展示;

src/assets/user.svg 0 → 100644
  1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1761015843458" class="icon" viewBox="0 0 1170 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1570" xmlns:xlink="http://www.w3.org/1999/xlink" width="228.515625" height="200"><path d="M461.268114 545.835886c-15.901257 72.235886-23.844571 113.415314-23.844571 123.523657 0 15.169829 6.495086 67.189029 80.193828 127.853714 49.122743 40.462629 73.684114 69.354057 73.684115 86.703543 23.113143-34.669714 46.957714-63.575771 71.504457-86.688914 36.849371-34.669714 82.358857-84.523886 82.358857-127.868343 0-28.891429-6.495086-70.070857-19.499886-123.523657H461.268114z" fill="#FBCEB9" p-id="1571"></path><path d="M374.5792 285.769143v47.674514c-33.236114-36.132571-49.854171-36.132571-49.854171 0s19.514514 63.575771 58.514285 82.358857c14.453029 82.358857 29.622857 135.080229 45.509486 158.193372 23.844571 34.669714 82.358857 82.358857 153.877943 86.688914 71.519086 4.344686 119.296-38.794971 158.208-86.688914 25.936457-31.919543 44.719543-84.655543 56.349257-158.193372 34.669714-18.783086 52.004571-46.226286 52.004571-82.358857 0-36.132571-17.334857-36.132571-52.004571 0v-47.689143c-54.754743-57.782857-116.150857-86.674286-184.2176-86.674285-49.7664 0-131.510857-6.7584-184.2176 19.499885-12.9024 6.436571-30.968686 28.832914-54.1696 67.189029z" fill="#FFE5D0" p-id="1572"></path><path d="M396.097829 678.312229c-108.032 30.661486-192.043886 61.322971-252.050286 91.999085C53.994057 816.303543 0 941.173029 0 1020.021029c586.093714 0.424229 623.806171 0.424229 1170.285714 0-32.855771-136.104229-72.016457-210.285714-198.0416-275.997258-84.026514-43.812571-154.024229-65.813943-209.993143-65.989485L593.466514 840.557714 396.097829 678.326857z" fill="#568EFF" p-id="1573"></path><path d="M445.600914 632.949029c0.980114 8.864914 5.412571 21.694171 13.312 38.517028 8.367543 17.832229 16.4864 35.240229 43.037257 69.851429 13.4144 17.481143 41.589029 49.269029 84.523886 95.349028l-84.523886 34.669715c-25.790171-29.066971-46.738286-55.076571-62.844342-78.014172-16.120686-22.9376-37.7856-57.607314-65.024-104.023771-5.924571-12.302629 3.861943-25.307429 29.359542-39.0144 25.512229-13.692343 39.555657-19.470629 42.159543-17.334857zM738.669714 632.949029c-0.980114 8.864914-5.412571 21.694171-13.312 38.517028-8.367543 17.832229-16.4864 35.240229-43.037257 69.851429-13.429029 17.481143-41.589029 49.269029-84.523886 95.349028l84.523886 34.669715c25.775543-29.066971 46.738286-55.076571 62.844343-78.014172 16.120686-22.9376 37.7856-57.607314 65.024-104.023771 5.924571-12.302629-3.861943-25.307429-29.374171-39.0144-25.4976-13.692343-39.555657-19.470629-42.144915-17.334857z" fill="#0C2E4C" p-id="1574"></path><path d="M584.791771 831.8976h14.628572v143.038171h-14.628572z" fill="#0C2E4C" p-id="1575"></path><path d="M616.360229 885.130971m-14.628572 0a14.628571 14.628571 0 1 0 29.257143 0 14.628571 14.628571 0 1 0-29.257143 0Z" fill="#FFFFFF" p-id="1576"></path><path d="M616.360229 947.712m-14.628572 0a14.628571 14.628571 0 1 0 29.257143 0 14.628571 14.628571 0 1 0-29.257143 0Z" fill="#FFFFFF" p-id="1577"></path><path d="M745.1648 870.912m14.628571 0l144.120686 0q14.628571 0 14.628572 14.628571l0 79.096686q0 14.628571-14.628572 14.628572l-144.120686 0q-14.628571 0-14.628571-14.628572l0-79.096686q0-14.628571 14.628571-14.628571Z" fill="#FFFFFF" p-id="1578"></path><path d="M794.360686 931.167086c9.493943 0 17.217829-7.68 17.217828-17.115429 0-9.450057-7.723886-17.130057-17.217828-17.130057-9.479314 0-17.2032 7.68-17.2032 17.115429 0 9.450057 7.723886 17.115429 17.2032 17.115428z m7.094857 1.6384h-12.887772c-11.995429 0-21.723429 9.698743-21.723428 21.6064v1.287314c0 6.231771 9.581714 6.231771 21.723428 6.231771h12.887772c11.658971 0 21.723429 0 21.723428-6.231771v-1.287314c0-11.907657-9.742629-21.6064-21.723428-21.6064z" fill="#ACC8FF" p-id="1579"></path><path d="M775.050971 105.940114c-41.866971-80.515657-119.954286-115.126857-234.2912-103.862857-171.490743 16.910629-140.097829 70.0416-234.2912 103.862857-12.478171 4.476343 2.750171 21.547886 0 28.9792-3.2768 8.850286-16.413257 7.811657-12.0832 21.738057 4.344686 13.941029 20.260571 11.000686 28.993829 45.4656 5.807543 22.981486 12.258743 65.653029 19.309714 128.014629 4.373943 16.6912 8.3968 29.578971 12.0832 38.648686 5.5296 13.604571 17.027657 24.400457 21.972115 23.171657 4.944457-1.2288-2.633143-14.336-2.647772-27.999086-0.087771-59.655314 16.910629-74.166857 22.147657-91.194514 6.436571-20.933486 31.729371-34.669714 75.849143-41.179429 52.750629-6.7584 102.209829-10.1376 148.3776-10.1376 46.153143 0 71.826286 1.930971 77.019429 5.807543 23.113143 2.881829 43.344457 20.216686 60.679314 52.004572 26.0096 47.689143 17.876114 91.326171 26.0096 101.858742 8.118857 10.532571 9.142857-13.604571 17.437257-29.242514 5.544229-10.415543 11.995429-23.054629 19.397486-37.931886 10.678857-62.6688 12.273371-111.864686 4.768914-147.616914-7.519086-35.752229-24.429714-55.881143-50.731886-60.386743z" fill="#584C43" p-id="1580"></path></svg>
0 \ No newline at end of file 2 \ No newline at end of file
src/components/Common/CommonNewBill.js
@@ -35,6 +35,7 @@ import CommonViewDragable from &quot;@/components/Common/CommonViewDragable&quot;; @@ -35,6 +35,7 @@ import CommonViewDragable from &quot;@/components/Common/CommonViewDragable&quot;;
35 import CommonExamInfo from "@/components/Common/CommonExamInfo"; 35 import CommonExamInfo from "@/components/Common/CommonExamInfo";
36 import JsonFormatter from "@/components/Common/Json/JsonFormatter"; 36 import JsonFormatter from "@/components/Common/Json/JsonFormatter";
37 import lodash from "lodash"; 37 import lodash from "lodash";
  38 +import userImgs from "@/assets/user.svg";
38 39
39 // import ProcessIcon from '../../assets/process.svg'; 40 // import ProcessIcon from '../../assets/process.svg';
40 // import DisableProcessIcon from '../../assets/disableprocess.svg'; 41 // import DisableProcessIcon from '../../assets/disableprocess.svg';
@@ -2747,8 +2748,21 @@ const BillComponent = Form.create({ @@ -2747,8 +2748,21 @@ const BillComponent = Form.create({
2747 backgroundColor: "#fff", 2748 backgroundColor: "#fff",
2748 }} 2749 }}
2749 > 2750 >
2750 - <div className="bill-search-group">  
2751 - <CommonView {...props} /> 2751 + <div className="bill-search-group" style={{ display: 'flex' }}>
  2752 + <div style={{ flex: 1 }}>
  2753 + <CommonView {...props} />
  2754 + </div>
  2755 + {
  2756 + ["contacts"].includes(props.sModelsType) && (
  2757 + <img
  2758 + style={{ width: 202/1.336, height: 202, margin: '5px 5px 0 -40px' }}
  2759 + src={`${commonConfig.file_host}file/download?savePathStr=${props.masterData?.sPicturePath}&sModelsId=100&token=${props.token}`}
  2760 + onError={event => {
  2761 + event.target.src = userImgs;
  2762 + }}
  2763 + />
  2764 + )
  2765 + }
2752 </div> 2766 </div>
2753 </div> 2767 </div>
2754 {props.sModelsType === "element/workcalendar" ? ( 2768 {props.sModelsType === "element/workcalendar" ? (
@@ -2767,7 +2781,7 @@ const BillComponent = Form.create({ @@ -2767,7 +2781,7 @@ const BillComponent = Form.create({
2767 }} 2781 }}
2768 > 2782 >
2769 <div> 2783 <div>
2770 - <Avatar src={props.imgSrc} /> 2784 + {props.imgSrc && <Avatar src={props.imgSrc} />}
2771 </div> 2785 </div>
2772 <Tabs activeKey={props.currentTab} onChange={props.onTabChange} className={styles.slaveTabs} tabBarStyle={{ margin: "0 8px" }}> 2786 <Tabs activeKey={props.currentTab} onChange={props.onTabChange} className={styles.slaveTabs} tabBarStyle={{ margin: "0 8px" }}>
2773 {commonUtils.isNotEmptyArr(diliverConfigTypeArr1) 2787 {commonUtils.isNotEmptyArr(diliverConfigTypeArr1)
src/components/Common/CommonNewBillEvent.js
@@ -1700,21 +1700,21 @@ export default ChildComponent =&gt; { @@ -1700,21 +1700,21 @@ export default ChildComponent =&gt; {
1700 // } 1700 // }
1701 // }) 1701 // })
1702 // }) 1702 // })
1703 - const tableData = this.props.slaveData.sort((a, b) => {  
1704 - const hasA = a.hasOwnProperty("sName") && a.sName != null;  
1705 - const hasB = b.hasOwnProperty("sName") && b.sName != null;  
1706 - if (hasA && !hasB) return -1;  
1707 - if (!hasA && hasB) return 1;  
1708 -  
1709 - // 2. bVisible 为 true 的在前  
1710 - const visA = a.bVisible === true;  
1711 - const visB = b.bVisible === true;  
1712 - if (visA && !visB) return -1;  
1713 - if (!visA && visB) return 1;  
1714 -  
1715 - // 3. 最后按 iOrder 升序  
1716 - return a.iOrder - b.iOrder;  
1717 - }); 1703 + const tableData = this.props.slaveData?.sort((a, b) => {
  1704 + const hasA = a.hasOwnProperty("sName") && a.sName != null;
  1705 + const hasB = b.hasOwnProperty("sName") && b.sName != null;
  1706 + if (hasA && !hasB) return -1;
  1707 + if (!hasA && hasB) return 1;
  1708 +
  1709 + // 2. bVisible 为 true 的在前
  1710 + const visA = a.bVisible === true;
  1711 + const visB = b.bVisible === true;
  1712 + if (visA && !visB) return -1;
  1713 + if (!visA && visB) return 1;
  1714 +
  1715 + // 3. 最后按 iOrder 升序
  1716 + return a.iOrder - b.iOrder;
  1717 + });
1718 params.data.forEach(item=>{ 1718 params.data.forEach(item=>{
1719 if (item.name === "slave") { 1719 if (item.name === "slave") {
1720 const isSettingFunctions = item.column.some(col => col.isSettingFunctions); 1720 const isSettingFunctions = item.column.some(col => col.isSettingFunctions);
@@ -1727,7 +1727,6 @@ export default ChildComponent =&gt; { @@ -1727,7 +1727,6 @@ export default ChildComponent =&gt; {
1727 } 1727 }
1728 } 1728 }
1729 }) 1729 })
1730 - console.log("params", this.props);  
1731 1730
1732 const returnData = await commonBusiness.saveData({ token, value: params, sModelsId }); 1731 const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
1733 if (commonUtils.isNotEmptyObject(returnData)) { 1732 if (commonUtils.isNotEmptyObject(returnData)) {
src/components/Common/CommonView/index.js
@@ -47,8 +47,8 @@ export default class CommonView extends Component { @@ -47,8 +47,8 @@ export default class CommonView extends Component {
47 randomId: commonUtils.createSid(), 47 randomId: commonUtils.createSid(),
48 previewVisible: false, /* 图片预览弹窗 */ 48 previewVisible: false, /* 图片预览弹窗 */
49 previewImage: '', /* 预览图片地址 */ 49 previewImage: '', /* 预览图片地址 */
50 - expanded: false,  
51 - bShowArrow: true, 50 + expanded: ["contacts"].includes(this.props.sModelsType),
  51 + bShowArrow: !["contacts"].includes(props.sModelsType),
52 }; 52 };
53 this.showConfigEnabledJson = {}; 53 this.showConfigEnabledJson = {};
54 } 54 }
src/components/Common/ToolBar/ToolBarNew.js
@@ -2178,6 +2178,46 @@ class ToolBarComponent extends Component { @@ -2178,6 +2178,46 @@ class ToolBarComponent extends Component {
2178 this.props.onSaveState({ 2178 this.props.onSaveState({
2179 visibleOtherFilfile: true, 2179 visibleOtherFilfile: true,
2180 }); 2180 });
  2181 + } else if (key.indexOf("BtnUpload_") > -1) {
  2182 + const targetField = key.replace("BtnUpload_", "");
  2183 + const fileInput = document.createElement('input');
  2184 + fileInput.type = 'file';
  2185 + fileInput.accept = 'image/*';
  2186 + fileInput.style.position = 'fixed';
  2187 + fileInput.style.left = '-9999px';
  2188 + document.body.appendChild(fileInput);
  2189 +
  2190 + fileInput.addEventListener('change', (e) => {
  2191 + const file = e.target.files[0];
  2192 + const formData = new FormData();
  2193 + formData.append('file', file);
  2194 +
  2195 + const { formId } = this.props;
  2196 + const { token } = this.props.app;
  2197 + const url = `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`;
  2198 + fetch(url, {
  2199 + method: 'POST',
  2200 + body: formData,
  2201 + }).then(res => res.json()).then(response => {
  2202 + if (response.code === 1) {
  2203 + const imgUrl = response.dataset.rows[0].savePathStr;
  2204 + const { masterData = {} } = this.props;
  2205 + this.props.onSaveState({
  2206 + masterData: {
  2207 + ...masterData,
  2208 + [targetField]: imgUrl,
  2209 + handleType: masterData.handleType || 'update'
  2210 + }
  2211 + });
  2212 + } else {
  2213 + this.props.getServiceError(response);
  2214 + }
  2215 + })
  2216 +
  2217 + document.body.removeChild(fileInput);
  2218 + });
  2219 +
  2220 + fileInput.click();
2181 } else if (key.indexOf("BtnUpload") > -1) { 2221 } else if (key.indexOf("BtnUpload") > -1) {
2182 /* 上传 */ 2222 /* 上传 */
2183 const { slaveSelectedRowKeys } = this.props; 2223 const { slaveSelectedRowKeys } = this.props;