Xiaopeng Zhang 4 ماه پیش
والد
کامیت
c2bf4e102f
5فایلهای تغییر یافته به همراه578 افزوده شده و 43 حذف شده
  1. 130 4
      src/Djcs3.js
  2. 126 5
      src/Qingdan3.js
  3. 152 21
      src/Service.js
  4. 10 8
      src/editor.js
  5. 160 5
      src/utils.js

+ 130 - 4
src/Djcs3.js

@@ -4,7 +4,8 @@ import Table from 'rsuite/Table';
 import 'rsuite/Table/styles/index.css';
 import Checkbox from 'rsuite/Checkbox';
 import 'rsuite/Checkbox/styles/index.css';
-import { CustomProvider } from 'rsuite';
+import { CustomProvider, Input, InputNumber } from 'rsuite';
+import 'rsuite/InputNumber/styles/index.css';
 import zhCN from 'rsuite/locales/zh_CN';
 import Tab from "@mui/material/Tab";
 import TabContext from "@mui/lab/TabContext";
@@ -573,11 +574,23 @@ export default function Djcs3({name, bh, rgde, jxde, clde, beizhu, beizhuFK, cli
                 let keys = Object.keys(beizhu["BZBH"]);
                 for(let i = 0; i < keys.length; i++) {
                     let key = keys[i];
-                    result.push({'id': i+1, 'key': i+1,  '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key]});//序号很重要
+                    result.push({'id': i+1, 'key': i+1,  '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key], '数量': 1});//序号很重要
                 }
-                setFuzhu(result);
+                
                 let newSelect = extractFuzhu(debmRef.current);
-                setCheckedKeys_2(newSelect);
+                setCheckedKeys_2(newSelect.map(x=>x.split("*")[0]).map(x=>Number(x)));
+                for(let i = 0; i < newSelect.length; i++) {
+                    if (newSelect[i].includes('*')) {
+                         let xuhao = Number(newSelect[i].split('*')[0]);
+                         let coef = Number(newSelect[i].split('*')[1]);
+                         for(let j = 0; j < result.length; j++) {
+                              if (result[j]['id'] == xuhao) {
+                                   result[j]['数量'] = coef;
+                              }
+                         }
+                    }
+                  }
+                  setFuzhu(result);
                 
                 
             }
@@ -884,6 +897,111 @@ export default function Djcs3({name, bh, rgde, jxde, clde, beizhu, beizhuFK, cli
       };
 
 
+      const EditableContext = React.createContext({ editingId: null, editingKey: null });
+      const [editingId, setEditingId] = React.useState(null);
+      const [editingKey, setEditingKey] = React.useState(null);
+      const onEdit = (id, dataKey) => {
+           setEditingId(id);
+           setEditingKey(dataKey);
+         };
+ 
+      const onEditFinished = () => {
+           console.log("edit finidhed");
+           setEditingId(null);
+           setEditingKey(null);
+           onSelectChange(checkedKeys);
+         };
+      const styles = `
+ .table-cell-editing .rs-table-cell-content {
+   padding: 4px;
+ }
+ .table-cell-editing .rs-input {
+   width: 100%;
+ }
+ .table-cell:focus {
+   outline: none;
+   box-shadow: inset 0 0 0 1px #007bff;
+ }
+ `;
+ 
+ const fieldMap = {
+      string: Input,
+      number: InputNumber,
+    };
+ 
+    function focus(ref) {
+      setTimeout(() => {
+        if (ref.current?.tagName === 'INPUT' || ref.current?.getAttribute('tabindex') === '0') {
+          ref.current.focus();
+        } else if (ref.current instanceof HTMLElement) {
+          ref.current.querySelector('input').focus();
+        }
+      }, 10);
+    }
+ 
+    const handleChangeFuzhuSL = (id, key, value) => {
+      const nextData = Object.assign([], fuzhu);
+      nextData.find(item => item.id === id)[key] = value;
+  
+      setFuzhu(nextData);
+    };
+
+
+
+
+      const EditableCell = ({ rowData, dataType, dataKey, onChange, ...props }) => {
+          const { editingId, editingKey, onEdit, onEditFinished } = React.useContext(EditableContext);
+          const editing = rowData.id === editingId && dataKey === editingKey;
+          const Field = fieldMap[dataType];
+          const value = rowData[dataKey];
+          const text = value;
+          const inputRef = React.useRef();
+          const cellRef = React.useRef();
+        
+          const handleEdit = () => {
+               if (fuzhuEnable) {
+                  onEdit?.(rowData.id, dataKey);
+                  focus(inputRef);
+               }
+          };
+        
+          const handleFinished = () => {
+            onEditFinished();
+            focus(cellRef);
+          };
+
+          return (
+               <Cell
+                 {...props}
+                 ref={cellRef}
+                 tabIndex={0}
+                 className={editing ? 'table-cell-editing' : 'table-cell'}
+                 onDoubleClick={handleEdit}
+                 
+               >
+                 {editing ? (
+                   <Field
+                     ref={inputRef}
+                     defaultValue={value}
+                     onBlur={handleFinished}
+                     onKeyPress={e => {
+                       if (e.key === 'Enter') {
+                         handleFinished();
+                       }
+                     }}
+                     onChange={value => {
+                       onChange?.(rowData.id, dataKey, value);
+                     }}
+                   />
+                 ) : (
+                   text
+                 )}
+               </Cell>
+             );
+     };
+
+
+
     return (
 
                <Stack spacing={1}>
@@ -989,6 +1107,9 @@ export default function Djcs3({name, bh, rgde, jxde, clde, beizhu, beizhuFK, cli
                        <TabPanel value="3">
                        <Box sx={{maxHeight: `200px`, minHeight: `200px`, height: `200px`}}>
                          <CustomProvider locale={zhCN}>
+                         <EditableContext.Provider value={{ editingId, editingKey, onEdit, onEditFinished }}>
+                         <style>{styles}</style>
+
                         <Table rowHeight={rowData=>{
                          return 40;
                         }}
@@ -1010,11 +1131,16 @@ export default function Djcs3({name, bh, rgde, jxde, clde, beizhu, beizhuFK, cli
                               <HeaderCell style={{ "fontSize": "0.875rem" }}>编号</HeaderCell>
                               <Cell dataKey="编号" style={{ "fontSize": "0.875rem" }}></Cell>
                          </Column>
+                         <Column width={120} align="center">
+                              <HeaderCell style={{ "fontSize": "0.875rem" }}>数量</HeaderCell>
+                              <EditableCell dataKey="数量" dataType="number" style={{ "fontSize": "0.875rem" }} onChange={handleChangeFuzhuSL} />
+                         </Column>
                          <Column fullText width={650} align="center">
                               <HeaderCell style={{ "fontSize": "0.875rem" }}>说明</HeaderCell>
                               <Cell dataKey="说明" style={{ "fontSize": "0.875rem" }}></Cell>
                          </Column>
                         </Table>
+                        </EditableContext.Provider>
                         </CustomProvider>
                        </Box>
                       

+ 126 - 5
src/Qingdan3.js

@@ -4,7 +4,8 @@ import Table from 'rsuite/Table';
 import 'rsuite/Table/styles/index.css';
 import Checkbox from 'rsuite/Checkbox';
 import 'rsuite/Checkbox/styles/index.css';
-import { CustomProvider } from 'rsuite';
+import { CustomProvider, Input, InputNumber } from 'rsuite';
+import 'rsuite/InputNumber/styles/index.css';
 import zhCN from 'rsuite/locales/zh_CN';
 import { Grid } from '@mui/material';
 import Tooltip from '@mui/material/Tooltip';
@@ -1139,11 +1140,23 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
                   let keys = Object.keys(beizhu["BZBH"]);
                   for(let i = 0; i < keys.length; i++) {
                       let key = keys[i];
-                      result.push({'id': i+1, 'key': i+1, '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key]});//序号很重要
+                      result.push({'id': i+1, 'key': i+1, '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key], '数量': 1});//序号很重要
                   }
-                  setFuzhu(result);
+                  
                   let newSelect = extractFuzhu(debmRef.current);
-                  setCheckedKeys_2(newSelect);
+                  setCheckedKeys_2(newSelect.map(x=>x.split('*')[0]).map(x=>Number(x)));
+                  for(let i = 0; i < newSelect.length; i++) {
+                    if (newSelect[i].includes('*')) {
+                         let xuhao = Number(newSelect[i].split('*')[0]);
+                         let coef = Number(newSelect[i].split('*')[1]);
+                         for(let j = 0; j < result.length; j++) {
+                              if (result[j]['id'] == xuhao) {
+                                   result[j]['数量'] = coef;
+                              }
+                         }
+                    }
+                  }
+                  setFuzhu(result);
                   
               }
           }, [beizhu]
@@ -1295,7 +1308,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
                     
                          rcjTable.current = new Tabulator(rcjRef.current, {
                               index: "key",
-                              height: 250,
+                              height: 200,
                             data: rcjhl, //link data to table
                             reactiveData: false, //enable data reactivity
                             dataTreeStartExpanded:false,
@@ -1387,6 +1400,107 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
           }, [valueTab]
         );
 
+     const EditableContext = React.createContext({ editingId: null, editingKey: null });
+     const [editingId, setEditingId] = React.useState(null);
+     const [editingKey, setEditingKey] = React.useState(null);
+     const onEdit = (id, dataKey) => {
+          setEditingId(id);
+          setEditingKey(dataKey);
+        };
+
+     const onEditFinished = () => {
+          console.log("edit finidhed");
+          setEditingId(null);
+          setEditingKey(null);
+          onSelectChange(checkedKeys);
+        };
+     const styles = `
+.table-cell-editing .rs-table-cell-content {
+  padding: 4px;
+}
+.table-cell-editing .rs-input {
+  width: 100%;
+}
+.table-cell:focus {
+  outline: none;
+  box-shadow: inset 0 0 0 1px #007bff;
+}
+`;
+
+const fieldMap = {
+     string: Input,
+     number: InputNumber,
+   };
+
+   function focus(ref) {
+     setTimeout(() => {
+       if (ref.current?.tagName === 'INPUT' || ref.current?.getAttribute('tabindex') === '0') {
+         ref.current.focus();
+       } else if (ref.current instanceof HTMLElement) {
+         ref.current.querySelector('input').focus();
+       }
+     }, 10);
+   }
+
+   const handleChangeFuzhuSL = (id, key, value) => {
+     const nextData = Object.assign([], fuzhu);
+     nextData.find(item => item.id === id)[key] = value;
+ 
+     setFuzhu(nextData);
+   };
+
+
+const EditableCell = ({ rowData, dataType, dataKey, onChange, ...props }) => {
+     const { editingId, editingKey, onEdit, onEditFinished } = React.useContext(EditableContext);
+     const editing = rowData.id === editingId && dataKey === editingKey;
+     const Field = fieldMap[dataType];
+     const value = rowData[dataKey];
+     const text = value;
+     const inputRef = React.useRef();
+     const cellRef = React.useRef();
+   
+     const handleEdit = () => {
+          if (fuzhuEnable) {
+             onEdit?.(rowData.id, dataKey);
+             focus(inputRef);
+          }
+     };
+   
+     const handleFinished = () => {
+       onEditFinished();
+       focus(cellRef);
+     };
+   
+     return (
+       <Cell
+         {...props}
+         ref={cellRef}
+         tabIndex={0}
+         className={editing ? 'table-cell-editing' : 'table-cell'}
+         onDoubleClick={handleEdit}
+         
+       >
+         {editing ? (
+           <Field
+             ref={inputRef}
+             defaultValue={value}
+             onBlur={handleFinished}
+             onKeyPress={e => {
+               if (e.key === 'Enter') {
+                 handleFinished();
+               }
+             }}
+             onChange={value => {
+               onChange?.(rowData.id, dataKey, value);
+             }}
+           />
+         ) : (
+           text
+         )}
+       </Cell>
+     );
+   };
+      
 
     return (
         <Stack spacing={2}>
@@ -1530,6 +1644,8 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
                        <TabPanel sx={{p: 1}} value="4">
                        <Box sx={{maxHeight: `190px`}}>
                        <CustomProvider locale={zhCN}>
+                       <EditableContext.Provider value={{ editingId, editingKey, onEdit, onEditFinished }}>
+                       <style>{styles}</style>
                         <Table rowHeight={rowData=>{
                          return 40;
                         }}
@@ -1551,11 +1667,16 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
                               <HeaderCell style={{ "fontSize": "0.875rem" }}>编号</HeaderCell>
                               <Cell dataKey="编号" style={{ "fontSize": "0.875rem" }}></Cell>
                          </Column>
+                         <Column width={120} align="center">
+                              <HeaderCell style={{ "fontSize": "0.875rem" }}>数量</HeaderCell>
+                              <EditableCell dataKey="数量" dataType="number" style={{ "fontSize": "0.875rem" }} onChange={handleChangeFuzhuSL} />
+                         </Column>
                          <Column fullText width={650} align="center">
                               <HeaderCell style={{ "fontSize": "0.875rem" }}>说明</HeaderCell>
                               <Cell dataKey="说明" style={{ "fontSize": "0.875rem" }}></Cell>
                          </Column>
                         </Table>
+                        </EditableContext.Provider>
                         </CustomProvider>
                        </Box>
                        </TabPanel>

+ 152 - 21
src/Service.js

@@ -13,6 +13,19 @@ class Service{
         this.qufei = [];
         this.qufeiEntry = null;
         this.jiagongcai = [];
+        this.mapper={
+            '99090513' : ['汽车式起重机 50t', 2838.92],
+            '99090509' : ['汽车式起重机 25t', 1174.12],
+            '99090111': ['履带式起重机 提升质量50t', 1755.71],
+            '99090108': ['履带式起重机 提升质量25t', 904.68],
+            '99030306': ['静力压桩机 压力1200kN', 1508.23],
+            '99030124': ['轨道式柴油打桩机 冲击质量2.5t', 1143.91],
+            '99030106' : ['履带式柴油打桩机 冲击质量7t', 2545.82],
+            '10450518' : ['纯铝箔 140×140', 0.35],
+            '10450508' : ['纯银箔 93.3×93.3', 4.5],
+            '04050101' : ['道碴 40~80mm', 47],
+            '04034103' : ['石屑(米砂)', 40]
+        };
         
     }
     
@@ -1446,20 +1459,63 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                 de['dercj'] = copy(de['rcjdg']);
                 for(let j = 1; j < de['rcjdg'].length; j++) {
                     let origin = Number(de['rcjdg'][j][10]);
+                    let bianhao_huan = '';
+                    let name_huan = '';
+                    let new_jia = 0;
                     for(let i = 0; i < de['fuzhu'].length; i++) {
-                        let selected = de['fuzhu'][i];
+                        let selected = de['fuzhu'][i];//selected is 结构化的处理信息
                         let target = selected[0];
                         
                         
-                        if (match_target(de['rcjdg'][j][1], target)) {
-                            if (selected[2] == '系数') {
-                                origin = origin * Number(selected[3]);
+                        if (match_target(de['rcjdg'][j][1], de['rcjdg'][j][2], target, selected[1])) {
+                            if (selected[2] == '系数' || selected[2] == '商品砼系数' || selected[2] == '除此机械外') {
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
 
-                            } else if (selected[2] == '含量') {
+                            } else if (selected[2] == '含量' || selected[2] == '商品砼含量') {
                                 origin = Number(selected[3]);
-                            } else if (selected[2] == '调整') {
-                                origin = origin + Number(selected[3]);
-                            } else {
+                            } else if (selected[2] == '调整' || selected[2] == '商品砼调整') {
+                                origin = origin + Number(selected[3]) * Number(selected[5]);
+                            } else if (selected[2] == '调比') {
+                                origin = origin + Number(selected[3]) * Number(selected[5]) / Number(100);
+                            } else if (selected[2] == '次方') {
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '叠加备注') {
+
+                            } else if (selected[2] == '换机械系数') {
+                                bianhao_huan = selected[4];
+                                name_huan = this.mapper[bianhao_huan][0];
+                                new_jia = this.mapper[bianhao_huan][1];
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '换材料系数') {
+                                bianhao_huan = selected[4];
+                                name_huan = this.mapper[bianhao_huan][0];
+                                new_jia = this.mapper[bianhao_huan][1];
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '使用泵送') {
+                                if (de['rcjdg'][j][2].includes('C20')) {
+                                    bianhao_huan = '80212103';
+                                    name_huan = '(C20泵送商品砼)';
+                                    new_jia = 342;
+                                }
+                                if (de['rcjdg'][j][2].includes('C30')) {
+                                    bianhao_huan = '80212105';
+                                    name_huan = '(C30泵送商品砼)';
+                                    new_jia = 362;
+                                }
+
+                            } else if (selected[2] == '使用非泵送') {
+                                if (de['rcjdg'][j][2].includes('C20')) {
+                                    bianhao_huan = '80212115';
+                                    name_huan = '(C20非泵送商品砼)';
+                                    new_jia = 333;
+                                }
+                                if (de['rcjdg'][j][2].includes('C30')) {
+                                    bianhao_huan = '80212117';
+                                    name_huan = '(C30非泵送商品砼)';
+                                    new_jia = 353;
+                                }
+                            }
+                            else {
                                 throw new Error('无法处理的附注'.concat(selected[2]));
                             }
                             
@@ -1469,12 +1525,28 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                     }
                     for (let k = 0; k < data.length; k++) {
                         if (data[k][16] == de['dercj'][j][16]) {
-                            de['dercj'][j][2] = data[k][2];//名称
-                            de['dercj'][j][1] = data[k][1];//编号
+                            
+                            if (bianhao_huan == '') {
+                                de['dercj'][j][1] = data[k][1];//编号
+                            } else {
+                                de['dercj'][j][1] = bianhao_huan;//编号
+                            }
+                            if (bianhao_huan == '') {
+                                de['dercj'][j][2] = data[k][2];//名称
+                            } else {
+                                de['dercj'][j][1] = name_huan;//编号
+                            }
+                            
+                            
                         }
                     }
+                    if (new_jia > 0) {
+                        de['dercj'][j][5] = new_jia;//jiage
+                    } else {
+                        de['dercj'][j][5] = de['rcjdg'][j][5];//单价
+                    }
+
                     
-                    de['dercj'][j][5] = de['rcjdg'][j][5];//单价
                     de['dercj'][j][10] =  origin;
                     de['dercj'][j][11] = Number(de['dercj'][j][5]) * origin;
                 }
@@ -1661,20 +1733,63 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                 de['dercj'] = copy(de['rcjdg']);
                 for(let j = 1; j < de['rcjdg'].length; j++) {
                     let origin = Number(de['rcjdg'][j][10]);
+                    let bianhao_huan = '';
+                    let name_huan = '';
+                    let new_jia = 0;
                     for(let i = 0; i < de['fuzhu'].length; i++) {
                         let selected = de['fuzhu'][i];//selected is 结构化的处理信息
                         let target = selected[0];
                         
                         
-                        if (match_target(de['rcjdg'][j][1], target)) {
-                            if (selected[2] == '系数') {
-                                origin = origin * Number(selected[3]);
+                        if (match_target(de['rcjdg'][j][1], de['rcjdg'][j][2], target, selected[1])) {
+                            if (selected[2] == '系数' || selected[2] == '商品砼系数' || selected[2] == '除此机械外') {
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
 
-                            } else if (selected[2] == '含量') {
+                            } else if (selected[2] == '含量' || selected[2] == '商品砼含量') {
                                 origin = Number(selected[3]);
-                            } else if (selected[2] == '调整') {
-                                origin = origin + Number(selected[3]);
-                            } else {
+                            } else if (selected[2] == '调整' || selected[2] == '商品砼调整') {
+                                origin = origin + Number(selected[3]) * Number(selected[5]);
+                            } else if (selected[2] == '调比') {
+                                origin = origin + Number(selected[3]) * Number(selected[5]) / Number(100);
+                            } else if (selected[2] == '次方') {
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '叠加备注') {
+
+                            } else if (selected[2] == '换机械系数') {
+                                bianhao_huan = selected[4];
+                                name_huan = this.mapper[bianhao_huan][0];
+                                new_jia = this.mapper[bianhao_huan][1];
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '换材料系数') {
+                                bianhao_huan = selected[4];
+                                name_huan = this.mapper[bianhao_huan][0];
+                                new_jia = this.mapper[bianhao_huan][1];
+                                origin = origin * (Number(selected[3]) ** Number(selected[5]));
+                            } else if (selected[2] == '使用泵送') {
+                                if (de['rcjdg'][j][2].includes('C20')) {
+                                    bianhao_huan = '80212103';
+                                    name_huan = '(C20泵送商品砼)';
+                                    new_jia = 342;
+                                }
+                                if (de['rcjdg'][j][2].includes('C30')) {
+                                    bianhao_huan = '80212105';
+                                    name_huan = '(C30泵送商品砼)';
+                                    new_jia = 362;
+                                }
+
+                            } else if (selected[2] == '使用非泵送') {
+                                if (de['rcjdg'][j][2].includes('C20')) {
+                                    bianhao_huan = '80212115';
+                                    name_huan = '(C20非泵送商品砼)';
+                                    new_jia = 333;
+                                }
+                                if (de['rcjdg'][j][2].includes('C30')) {
+                                    bianhao_huan = '80212117';
+                                    name_huan = '(C30非泵送商品砼)';
+                                    new_jia = 353;
+                                }
+                            }
+                            else {
                                 throw new Error('无法处理的附注'.concat(selected[2]));
                             }
                             
@@ -1684,12 +1799,28 @@ async generateQingdanTuijian(name, bh, bt, bm) {
                     }
                     for (let k = 0; k < data.length; k++) {
                         if (data[k][16] == de['dercj'][j][16]) {
-                            de['dercj'][j][2] = data[k][2];//名称
-                            de['dercj'][j][1] = data[k][1];//编号
+                            
+                            if (bianhao_huan == '') {
+                                de['dercj'][j][1] = data[k][1];//编号
+                            } else {
+                                de['dercj'][j][1] = bianhao_huan;//编号
+                            }
+                            if (bianhao_huan == '') {
+                                de['dercj'][j][2] = data[k][2];//名称
+                            } else {
+                                de['dercj'][j][1] = name_huan;//编号
+                            }
+                            
+                            
                         }
                     }
+                    if (new_jia > 0) {
+                        de['dercj'][j][5] = new_jia;//jiage
+                    } else {
+                        de['dercj'][j][5] = de['rcjdg'][j][5];//单价
+                    }
 
-                    de['dercj'][j][5] = de['rcjdg'][j][5];//单价
+                    
                     de['dercj'][j][10] =  origin;
                     de['dercj'][j][11] = Number(de['dercj'][j][5]) * origin;
                 }

+ 10 - 8
src/editor.js

@@ -135,19 +135,20 @@ export const handleBeizhu = (beizhuFK/**辅库json */, derow, fuzhuSelect/*被
         let entry = fuzhuSelect_[j];
         for(let i = 0; i < fuzhu.length; i++) {
             if (fuzhu[i]['key'] == entry) {
-                bianma.push(fuzhu[i]['编号']);
-                xuhao.push(fuzhu[i]['序号']);
+                bianma.push(fuzhu[i]['编号'].toString().concat('*').concat(fuzhu[i]['数量'].toString()));
+                xuhao.push(fuzhu[i]['序号'].toString().concat("*").concat(fuzhu[i]['数量'].toString()));
             }
         }
     }
     let result = [];
     for(let i = 0; i < bianma.length; i++) {
-        let bh = bianma[i];
+        let bh_ = bianma[i];
+        let bh = bh_.split("*")[0];
         for(let j = 0; j < Object.keys(keys).length; j++) {
             let BZBH_ = Object.keys(keys)[j];
             let BZBH = keys[BZBH_];
             if (BZBH == bh) {
-                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['DW'][BZBH_]]);
+                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['XBH'][BZBH_], Number(bh_.split('*')[1])]);
             }
         }
     }
@@ -165,19 +166,20 @@ export const handleBeizhu_djcs = (beizhuFK, derow, fuzhuSelect, fuzhu ) => {
         let entry = fuzhuSelect_[j];
         for(let i = 0; i < fuzhu.length; i++) {
             if (fuzhu[i]['key'] == entry) {
-                bianma.push(fuzhu[i]['编号']);
-                xuhao.push(fuzhu[i]['序号']);
+                bianma.push(fuzhu[i]['编号'].toString().concat('*').concat(fuzhu[i]['数量'].toString()));
+                xuhao.push(fuzhu[i]['序号'].toString().concat("*").concat(fuzhu[i]['数量'].toString()));
             }
         }
     }
     let result = [];
     for(let i = 0; i < bianma.length; i++) {
-        let bh = bianma[i];
+        let bh_ = bianma[i];
+        let bh = bh_.split("*")[0];
         for(let j = 0; j < Object.keys(keys).length; j++) {
             let BZBH_ = Object.keys(keys)[j];
             let BZBH = keys[BZBH_];
             if (BZBH == bh) {
-                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['DW'][BZBH_]]);
+                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['XBH'][BZBH_], Number(bh_.split('*')[1])]);
             }
         }
     }

+ 160 - 5
src/utils.js

@@ -65,8 +65,14 @@ export const renameDingE = (oldname, xuhao, huan) => {
         raw = oldname.substring(0, index);
     }
     for(let i = 0; i < xuhao.length; i++) {
-        raw = raw.concat("附注");
-        raw = raw.concat(xuhao[i].toString());
+        if (xuhao[i].split('*')[1] == '1') {
+            raw = raw.concat("附注");
+            raw = raw.concat(xuhao[i].split('*')[0]);
+        } else {
+            raw = raw.concat("附注");
+            raw = raw.concat(xuhao[i]);
+        }
+        
     }
     if (huan && raw.indexOf('换') == -1) {
         raw = raw.concat('换');
@@ -94,7 +100,19 @@ export const extractFuzhu = (debm) => {
                 }
             }
             let find = debm.substring(index+2, i);
-            result.push(Number(find));
+            if (debm.substring(i,i+1)=='*') {
+                let j = i + 1;
+                for(j = i+1; j < debm.length; j++) {
+                    if ((debm[j] >= '0' && debm[j] <= '9') || debm[j] == '-') {
+    
+                    } else {
+                        break;
+                    }
+                }
+                find = debm.substring(index + 2, j);
+                i = j;
+            }
+            result.push((find));
             start = i;
 
 
@@ -105,7 +123,7 @@ export const extractFuzhu = (debm) => {
     }
 };
 
-export const match_target = (input ,target) => {
+export const match_target = (input ,input_mc, target, mc) => {
     if (target == '000000') return true;//全部定额
     if (target == '000001') {//普世的人工费
         if(input.startsWith("000")) {
@@ -113,12 +131,65 @@ export const match_target = (input ,target) => {
         } else {
             return false;
         }
-    } else if (target == 'J00000') {//普世机械费
+    } else if (target == 'J00000' && (mc == '全部机械' || mc == '所有机械')) {//普世机械费
         if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
             return true;
         } else {
             return false;
         }
+    } else if (target == 'J00000') {
+        //除此机械外
+        if (mc == '盾构推进机') {
+            if (input_mc.includes('盾构推进机') || input_mc.includes('盾构机')) {
+                return false;
+            }
+            if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
+                return true;
+            } else {
+                return false;
+            }
+
+        }
+        if (mc == '载货汽车') {
+            if (input_mc.includes('载货汽车')) {
+                return false;
+            }
+            if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+        if (mc.includes('交流弧焊机')) {
+            if (input_mc.includes('交流弧焊机')) {
+                return false;
+            }
+            if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+        if (mc.includes('卷扬机带塔')) {
+            if (input_mc.includes('卷扬机带塔')) {
+                return false;
+            }
+            if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+        if (mc.includes('双笼施工电梯')) {
+            if (input_mc.includes('双笼施工电梯')) {
+                return false;
+            }
+            if (input.startsWith('99') || input.startsWith('98') || input.startsWith('J')) {
+                return true;
+            } else {
+                return false;
+            }
+        }
     } else if (target == '100000') {//全部材料
         if (input.startsWith('99')|| input.startsWith('98') || input.startsWith('J')) {
             return false;
@@ -127,6 +198,90 @@ export const match_target = (input ,target) => {
         } else {
             return true;
         }
+    } else if (target == '800101') {//普世的砂浆
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '015103') {//槽铝
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '066121') {//面砖
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '066501') {//地砖
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '066503') {//
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '070101') {//花岗岩
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '070303') {//
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '070902') {//麻石
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '071121') {//
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    }  else if (target == '241503') {//瓷板
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    }  else if (target == '8021') {//
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
+    } else if (target == '80210') {//
+        if (input.startsWith(target)) {
+            return true;
+        } else {
+            return false;
+        }
+
     }
     return input == target;
 };