+
+
+ rowKey="id"
+ controlled
+ editableFormRef={editactionformRef}
+ actionRef={editactionRef}
+ columns={[
+ {
+ title: '物料名称',
+ dataIndex: 'materialId',
+ valueType: 'select',
+ ellipsis: true,
+ request: async () => {
+ const res: MyResponse.Content = await MaterialsInfoAPI.List();
+ const myData: any[] = [];
+ if (res.statusCode === 200) {
+ setSelectMateriallist(res.data)
+ res.data.map((item: MaterialsTypes.Info) => (
+ myData.push({
+ label: `${item.name}[${item.unit}]`,
+ value: item.id,
+ })
+ ))
+ }
+ return myData;
+ },
+ formItemProps: () => {
+ return {
+ rules: [{ required: true, message: '此项为必填项' }]
+ };
+ },
+ },
+ {
+ title: '重量',
+ dataIndex: 'weight',
+ valueType: 'text',
+ ellipsis: true,
+ formItemProps: () => {
+ return {
+ rules: [{ required: true, message: '此项为必填项' }],
+ };
+ },
+ },
+ {
+ title: '重量误差(±)',
+ dataIndex: 'errorWeight',
+ valueType: 'text',
+ ellipsis: true,
+ formItemProps: () => {
+ return {
+ rules: [{ required: true, message: '此项为必填项' }],
+ };
+ },
+ },
+ {
+ title: '操作',
+ valueType: 'option',
+ render: (_, row) => [
+ ,
+
+ ],
+ },
+ ]}
+ value={materiallist}
+
+ recordCreatorProps={{
+ record: () => (
+ {
+ id: Date.now().toString(),
+ materialId: '',
+ finalId: '',
+ weight: '',
+ })
+ ,
+ }
+ }
+ editable={{
+ form: formRef,
+ type: 'single',
+ onValuesChange: (record, recordList: finalMaterialTypes.output[]) => {
+ console.log(selectMateriallist);
+ if (!recordList) {
+ materiallist.push(record);
+ setMateriallist(materiallist);
+ } else {
+ setMateriallist(recordList);
+ }
+ console.log('materiallist', materiallist);
+
+ },
+ actionRender: (row, _, dom) => {
+ return [dom.delete, dom.save, dom.cancel];
+ },
+ }}
+ />
+
+
+