From a2c6ab01da27db0cccc42d3fac598ef96dff71f6 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Tue, 20 Feb 2024 18:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=B7=A5=E8=89=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/database/goods/goodsInfo/service.js | 5 +- .../goods/goodsbom/components/CreateBom.jsx | 16 +- .../goodstechnology/components/EditFrom.jsx | 6 +- .../components/goodstechnologymaken.jsx | 129 +++++---- .../database/goods/goodstypemanage/index.jsx | 2 +- src/pages/device/deviceInfo/services.js | 2 +- .../technology/components/ActionForm.jsx | 173 ++++++++++++ .../technology/components/CreateAction.jsx | 246 ++++++++++++++++++ .../technology/components/CreateForm.jsx | 89 +++++++ .../technology/components/technologylist.jsx | 148 +++++++++++ src/pages/device/technology/index.jsx | 68 ++--- src/pages/device/technology/services.js | 5 + 12 files changed, 797 insertions(+), 92 deletions(-) create mode 100644 src/pages/device/technology/components/ActionForm.jsx create mode 100644 src/pages/device/technology/components/CreateAction.jsx create mode 100644 src/pages/device/technology/components/CreateForm.jsx create mode 100644 src/pages/device/technology/components/technologylist.jsx diff --git a/src/pages/database/goods/goodsInfo/service.js b/src/pages/database/goods/goodsInfo/service.js index 9a14a2e..24df24e 100644 --- a/src/pages/database/goods/goodsInfo/service.js +++ b/src/pages/database/goods/goodsInfo/service.js @@ -112,9 +112,8 @@ export async function getbyidgoods (data) { }); } export async function GetGoodsTechnology(data) { - return request(getDataBaseUrl()+`/api/goodstechnology/GetGoodsTechnology`, { - method: 'Post', - data: data, + return request(getDataBaseUrl()+`/api/technology/gettechnologylist?deviceId=`+data, { + method: 'Get', }); } export async function GetTechnologyactionList(data) { diff --git a/src/pages/database/goods/goodsbom/components/CreateBom.jsx b/src/pages/database/goods/goodsbom/components/CreateBom.jsx index 93392d6..9b3b4a3 100644 --- a/src/pages/database/goods/goodsbom/components/CreateBom.jsx +++ b/src/pages/database/goods/goodsbom/components/CreateBom.jsx @@ -47,11 +47,17 @@ const GoodsbomFrom = (props) => { } useEffect(() => { - console.log("props.Bomdata",props.Bomdata) + var ty=form.getFieldValue("type"); + console.log("props.Bomdata",form.getFieldValue("type")) console.log(props.goodsname) - setdisaenumbled('block') - setdisnewd("none"); - setbomcheckRules([{ required: true, message: '请选择配方' }]) + if(ty!=0){ + setdisaenumbled('block') + setdisnewd("none"); + setbomcheckRules([{ required: true, message: '请选择配方' }]) + setbomNameRules( [{ required: false}]) + setbomTypeListRules([{ required: false}]) + } + // form.setFieldsValue({ // bomName: props.goodsname, // // bomType:1 @@ -71,7 +77,7 @@ const GoodsbomFrom = (props) => { setEditableRowKeys(soredata.map((item) => item.id)) setDataSource(soredata); } - },[]) + },[props]) const columns=[ { title: '物料名称', diff --git a/src/pages/database/goods/goodstechnology/components/EditFrom.jsx b/src/pages/database/goods/goodstechnology/components/EditFrom.jsx index af59d9a..5df4e2f 100644 --- a/src/pages/database/goods/goodstechnology/components/EditFrom.jsx +++ b/src/pages/database/goods/goodstechnology/components/EditFrom.jsx @@ -12,8 +12,8 @@ const EditFrom = (props) => { useEffect(() => { //setfromdata(props.fromdata) //props.fromdata=fromdata - console.log("增加编辑状态值",props.UpdataStatus) - console.log("props.fromdata",props.fromdata) + console.log("增加编辑状态值",props.technologyattralldata) + console.log("props.fromdata",props.goodstechnologydata) if(props.fromdata.length==0){ setfromdata([]) }else{ @@ -80,7 +80,7 @@ const EditFrom = (props) => { const onHandleChange = (value, option, index) => { console.log(fromdata) console.log(index) - var sd = props.technologyattralldata.filter(x => x.productFunctionId == value); + var sd = props.technologyattralldata.filter(x => x.technologyId == value); var newdata = fromdata.map(x => { if (x.index == index) { diff --git a/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx b/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx index 0a2d9eb..dee6c1e 100644 --- a/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx +++ b/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx @@ -92,9 +92,9 @@ const goodstechnologymaken = (props) => { // setgoodstechnologydata(sd) // } // }); - GetTechnologyActionListAll().then((r) => { - setTechnologyattralldata(r.data) - }) + // GetTechnologyActionListAll().then((r) => { + // setTechnologyattralldata(r.data) + // }) GetGoodsTechnologyAction(props.goodsid).then((r) => { if (r.data.length > 0) { setgoodstechnolog(r.data) @@ -156,39 +156,13 @@ const goodstechnologymaken = (props) => { setopreaction("update") if (UpdataStatus != "add") { setdefaultValue(item.deviceId) - handleChange(item.deviceId) - let attr = []; - item.data.forEach(item => { - const obj = {}; - let propsdatanew = []; - let propsdata = technologyattralldata.filter(x => x.productFunctionId == item.chnologyId) - obj.stepName = item.stepName; - obj.id = item.id; - obj.chnologyId = item.chnologyId; - obj.sort = item.sort; - obj.actionJson = item.actionJson - obj.optiondata = JSON.parse(item.actionJson) - propsdata.forEach(x => { - let sd = { - id: x.id, - actionName: x.actionName, - actionType: x.actionType, - actionValue: x.actionValue, - goodstechnologyId: x.productFunctionId, - isBatch: x.isBatch, - sort: x.sort, - goddteid: item.id - } - propsdatanew.push(sd) - }) - obj.propsdata = propsdatanew; - obj.isBatch = item.isBatch; - obj.typeName = item.stepName; - - attr.push(obj) - }) - console.log("attr", attr) - setfromdata(attr) + //handleChange(item.deviceId) + setdefaultValue(item.deviceId) + setddevideId(item.deviceId) + GetGoodsTechnologyvalue(item.deviceId,"edit",item) + + //console.log("attr", attr) + setUpdataStatus("update") } else { message.error("请保存当前数据后在编辑"); @@ -196,6 +170,63 @@ const goodstechnologymaken = (props) => { //setTechnologyattrdata(attr) } + const editfrom=(item,Technologyacton)=>{ + let attr = []; + item.data.forEach(item => { + const obj = {}; + let propsdatanew = []; + let propsdata = Technologyacton.filter(x => x.technologyId == item.chnologyId) + obj.stepName = item.stepName; + obj.id = item.id; + obj.chnologyId = item.chnologyId; + obj.sort = item.sort; + obj.actionJson = item.actionJson + obj.optiondata = JSON.parse(item.actionJson) + propsdata.forEach(x => { + let sd = { + id: x.id, + actionName: x.actionName, + actionType: x.actionType, + actionValue: x.actionValue, + goodstechnologyId: x.technologyId, + isBatch: x.isBatch, + sort: x.sort, + goddteid: item.id + } + propsdatanew.push(sd) + }) + obj.propsdata = propsdatanew; + obj.isBatch = item.isBatch; + obj.typeName = item.stepName; + + attr.push(obj) + }) + setfromdata(attr) + } + const GetGoodsTechnologyvalue=(value,va,item)=>{ + let godata=[] + GetGoodsTechnology(value).then((r)=>{ + if (r.data.length > 0) { + var Technologyacton=[]; + godata = r.data.map(x => { + + if(x.technologyActionInfo.length>0){ + x.technologyActionInfo.forEach(p=>{ + Technologyacton.push(p); + }) + } + return { value: x.id, label: x.name } + }) + setTechnologyattralldata(Technologyacton) + setgoodstechnologydata(godata) + } + //setfromdata([]) + if(va=="edit"){ + editfrom(item,Technologyacton) + } + }) + + } //删除单个工艺 const onClickdele = (e, item, action) => { DeleteGoodsTechnologyAction(item.id).then((res) => { @@ -244,20 +275,20 @@ const goodstechnologymaken = (props) => { console.log("进来了", value) setdefaultValue(value) setddevideId(value) - let godata=[] - let sd = DeviceTechnologydata.find(x => x.id == value); - if (sd) { - if (sd.goodsTechnologyInfo.length > 0) { - godata = sd.goodsTechnologyInfo.map(x => { - return { value: x.deviceTechnologyId, label: x.name } - }) + GetGoodsTechnologyvalue(value,"",null) + // let sd = DeviceTechnologydata.find(x => x.id == value); + // if (sd) { + // if (sd.goodsTechnologyInfo.length > 0) { + // godata = sd.goodsTechnologyInfo.map(x => { + // return { value: x.deviceTechnologyId, label: x.name } + // }) - setgoodstechnologydata(godata) - } - setfromdata([]) - } - console.log("godata", godata) - setgoodstechnologydata(godata) + // setgoodstechnologydata(godata) + // } + // setfromdata([]) + // } + // console.log("godata", godata) + // setgoodstechnologydata(godata) } const onUpdataStatus = (val) => { setUpdataStatus(val) diff --git a/src/pages/database/goods/goodstypemanage/index.jsx b/src/pages/database/goods/goodstypemanage/index.jsx index 2db11fe..e4fc5fb 100644 --- a/src/pages/database/goods/goodstypemanage/index.jsx +++ b/src/pages/database/goods/goodstypemanage/index.jsx @@ -160,7 +160,7 @@ const handleAdd = async (fields) => { }, { title: '排序', - dataIndex: 'goodsType_Sort', + dataIndex: 'sort', hideInSearch: true, }, { diff --git a/src/pages/device/deviceInfo/services.js b/src/pages/device/deviceInfo/services.js index 82d638a..9cc2af4 100644 --- a/src/pages/device/deviceInfo/services.js +++ b/src/pages/device/deviceInfo/services.js @@ -54,7 +54,7 @@ export async function GetDeviceType() { } /** 添加设备标签 */ export async function AddDeviceType(data) { - return request(`​/saasbase/api/device/adddevicetype`, { + return request(getDataBaseUrl()+`​/api/device/adddevicetype`, { method: 'POST', data: data, }); diff --git a/src/pages/device/technology/components/ActionForm.jsx b/src/pages/device/technology/components/ActionForm.jsx new file mode 100644 index 0000000..2bcfebd --- /dev/null +++ b/src/pages/device/technology/components/ActionForm.jsx @@ -0,0 +1,173 @@ +import ProTable from '@ant-design/pro-table'; +import { Modal,Space, Form,Button,Select,message,Popconfirm} from 'antd'; +import { PlusOutlined } from '@ant-design/icons'; +import React, { useState,useRef } from 'react'; +import CreateAction from './CreateAction'; + +const { Option, OptGroup } = Select; + + +const ActionForm = (props) => { + const [currentRow , setcurrentRow ] = useState([]);; + const [dataSource, setDataSource] = useState([]); + const actionRef = useRef(); + const [form] = Form.useForm(); + const [actionValueName,setactionValueName]=useState(); + const [createModalVisible, handleModalVisible] = useState(false); + const options = { + text:{value:'text',text: `文本框`}, + select:{ value: `select`, text: `下拉框`}, + // money:{ value: `money`, text: `金额输入`}, + textarea:{ value: `textarea`, text: `文本域`}, + // date:{ value: `date`, text: `日期`}, + // dateTime:{ value: `dateTime`, text: `日期时间`}, + // radio:{ value: `radio`, text: `单选框`}, + // radioButton:{ value: `radioButton`, text: `按钮单选框`}, + digit:{ value: `digit`, text: `数字输入框`}, + switch:{ value: `switch`, text: `开关`}, + } + const columns= [ + { + title: '模型名称', + dataIndex: 'actionName', + width: '15%', + }, + + { + title: '输入类型', + key: 'actionType', + dataIndex: 'actionType', + valueType: 'select', + width: '15%', + valueEnum:options, + + }, + // { + // title: '类型值', + // dataIndex: 'actionValue', + // width: '15%', + // valueType:'select', + // valueEnum: { + // text:{ + // text: '文本框', + // status: 'text', + // }, + // select:{ + // text: '下拉框', + // status: 'select', + // } + // } + // }, + // { + // title: '单位', + // dataIndex: 'unit', + // width: '8%', + // }, + // { + // title: '是否绑定物料', + // dataIndex: 'isBatch', + // width: '15%', + // valueEnum: { + // true:{ + // text: '是', + // status: 'Success', + // }, + // false:{ + // text: '否', + // status: 'Processing', + // } + // } + // }, + { + title: '排序', + dataIndex: 'sort', + valueType:'digit', + width: '8%', + }, + { + title: '操作', + valueType: 'option', + width: 200, + render: (text, record, _, action) => [ + { + handleModalVisible(true); + setcurrentRow(record); + }} + > + 查看 + , + // { + // handleRemove([record.id]); + // actionRef.current?.reloadAndRest(); + // }} + // onCancel={() => { }} + // > + // 删除 + // ,, + ], + }, + ] + return ( + <> + { + props?.onCancel(); + }} + destroyOnClose + maskClosable={false} + > + + + { + var success = false; + console.log(value) + console.log(value.actionValue) + value.goodstechnologyId=props.values.id; + + if (value.id) { + success = await handleUpdate(value); + } else { + success = await onFinish(value); + } + if (success) { + handleModalVisible(false); + if (actionRef.current) { + actionRef.current.reload(); + } + } + }} + onCancel={() => { + setcurrentRow(undefined); + handleModalVisible(false); + }} + createModalVisible={createModalVisible} + actionValueName={actionValueName} + values={currentRow || {}} + /> + + + ); +}; +export default ActionForm; \ No newline at end of file diff --git a/src/pages/device/technology/components/CreateAction.jsx b/src/pages/device/technology/components/CreateAction.jsx new file mode 100644 index 0000000..f2ba192 --- /dev/null +++ b/src/pages/device/technology/components/CreateAction.jsx @@ -0,0 +1,246 @@ +import { Modal,Input, Form,Button,Select,message,Switch,Divider,Space,progress,percent} from 'antd'; +import { BetaSchemaForm, ProFormSelect,ProFormDependency } from '@ant-design/pro-form'; +import React, { useState,useEffect } from 'react'; +import { PlusOutlined } from '@ant-design/icons'; +const CreateAction = (props) => { + const [form] = Form.useForm(); + const formRef = React.useRef(null); + const [valueType, setValueType] = useState('text'); + const [layoutType, setLayoutType] = useState('Form'); + const [optionitem,setoptionitem]=useState([]) + const [modalVisit, setModalVisit] = useState(false); + const [shuUpdate, setshuUpdate] = useState(false); + useEffect(() => { + formRef.current?.setFieldsValue(props.values); + if(props.createModalVisible){ + if(props.values.actionType==null){ + formRef.current?.setFieldsValue({ + actionType: 'text', + }); + props.values.actionType="text"; + setValueType("text"); + setLayoutType('Form'); + setoptionitem([]); + }else{ + formRef.current?.setFieldsValue({ + actionType: props.values.actionType, + }); + setValueType(props.values.actionType) + if(props.values.actionType=="select"){ + setLayoutType('ModalForm'); + let ary=[]; + let op=JSON.parse(props.values.actionValue) + for (let t = 0; t < op.length; t++) { + ary.push({actionValueName:op[t].actionValueName}) + } + setoptionitem(ary); + }else{ + setValueType(props.values.actionType); + setLayoutType('Form'); + setoptionitem([]); + } + } + + } +}, [props.createModalVisible]); +const handleChange=(value)=>{ + console.log(JSON.stringify(value)) + if(value){ + formRef.current?.setFieldsValue({ + actionValue:JSON.stringify(value) + }) + } + setModalVisit(false); + message.success("保存成功") +} + const options = [ + {value:'text',label: `文本框`}, + { value: `select`, label: `下拉框`}, + // { value: `money`, label: `金额输入`}, + { value: `textarea`, label: `文本域`}, + // { value: `date`, label: `日期`}, + // { value: `dateTime`, label: `日期时间`}, + // { value: `radio`, label: `单选框`}, + // { value: `radioButton`, label: `按钮单选框`}, + { value: `digit`, label: `数字输入框`}, + { value: `switch`, label: `开关`}, + ] + const columns=[ + { + dataIndex: 'actionValue', + valueType:'dependency', + name: ['valueType'], + columns: ({ actionType }) => { + console.log(valueType) + switch(valueType) + { + case 'select': + return [ + { + dataIndex: 'list', + valueType: 'formList', + initialValue:optionitem, + columns: [ + { + valueType: 'group', + columns: [ + { + title: '选项名称', + dataIndex: 'actionValueName', + width: 'md', + disabled:true, + formItemProps: { + rules: [ + { + required: true, + message: '此项为必填项', + }, + ], + + }, + } + ] + } + ], + }, + { + renderFormItem: (schema,config,form) => { + return [ +
+ {/* */} +
+ ]; + }, + } + ]; + case 'text': + return [ + { + dataIndex: 'actionValue', + valueType: 'text', + renderFormItem: () => + }, + ]; + default: + return [{ + dataIndex: 'actionValue', + valueType: valueType, + fieldProps:{ + disabled:true + } + }]; + } + } + }, + ] + + // const handleChange=(value)=>{ + + // } + // const onNameChange = (event) => { + // settypename(event.target.value); + // }; + // const addItem = async (e) => { + // e.preventDefault(); + // setItems([...items, {label:typename,value:index++} || `New item ${index++}`]); + // settypename(''); + // setTimeout(() => { + // inputRef.current?.focus(); + // }, 0); + // console.log(items) + // } + return ( + <> + { + props?.onCancel(); + }} + destroyOnClose + maskClosable={false} + > +
+ + + + + + + + { + if(e=='select'){ + setLayoutType('ModalForm'); + }else{ + setLayoutType('Form') + + } + setValueType(e); + }, + }}/> + + + setModalVisit(true)}>查看选项} + columns={columns} + layoutType={layoutType} + visible={modalVisit} + modalProps={{ + forceRender: true,//切换显示模式后强制渲染其他模式表单 + onCancel:()=>setModalVisit(false) + }} + onVisibleChange={(vis)=>{ + setshuUpdate(vis) + }} + width={420} + shouldUpdate={shuUpdate} + submitter={false} + style={{padding:'40px 10px 1px 10px;' }} + /> + + + {/* + + + + + */} + + + + {/* + */} + +
+
+ + ) +} +export default CreateAction; \ No newline at end of file diff --git a/src/pages/device/technology/components/CreateForm.jsx b/src/pages/device/technology/components/CreateForm.jsx new file mode 100644 index 0000000..97f356b --- /dev/null +++ b/src/pages/device/technology/components/CreateForm.jsx @@ -0,0 +1,89 @@ +import React, { useState } from 'react'; +import { Modal, Form, Input, Button, Select } from 'antd'; +// import { +// GetDeviceVesion +// } from '../services'; +const CreateForm = (props) => { + const { Option, OptGroup } = Select; + const [DeviceVesionData, setDeviceVesionData] = useState([]); + const handleChange=(value)=>{ + GetDeviceVesion(value).then((res)=>{ + setDeviceVesionData(res.data) + }) + } + return ( + { + props?.onCancel(); + }} + destroyOnClose + maskClosable={false} + > +
+ + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; + +export default CreateForm; diff --git a/src/pages/device/technology/components/technologylist.jsx b/src/pages/device/technology/components/technologylist.jsx new file mode 100644 index 0000000..90f45ef --- /dev/null +++ b/src/pages/device/technology/components/technologylist.jsx @@ -0,0 +1,148 @@ +import { DropboxOutlined, PlusOutlined,UploadOutlined } from '@ant-design/icons'; +import { Button, message, Input, Upload, Modal, Popconfirm } from 'antd'; +import React, { useState, useRef, useEffect } from 'react'; +import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +// import CreateForm from './CreateForm'; +import ActionForm from './ActionForm'; + +//页面 相当于 class +const bomtechnology = (props) => { + /** 新建/更新窗口的弹窗 */ + const [createModalVisible, handleModalVisible] = useState(false); + /** 分布更新窗口的弹窗 */ + + const [actionFormModalVisible, setactionFormModalVisible] = useState(false); + const [showDetail, setShowDetail] = useState(false); + //绑定 + const actionRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + //选中的行 + const [selectedRowsState, setSelectedRows] = useState([]); + const [DeviceVesionData, setDeviceVesionData] = useState([]); + /** 国际化配置 */ + const [DictData, setDictData] = useState([]); + const columns = [ + { + title: '主键', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + render: (dom, entity) => { + return ( + { + setCurrentRow(entity); + setShowDetail(true); + }} + > + {dom} + + ); + }, + }, + { + title: '名称', + dataIndex: 'name', + valueType: 'textarea', + ellipsis: true, + search: true, + }, + + { + title: '创建时间', + dataIndex: 'createAt', + valueType: 'date', + hideInSearch: true, + }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + render: (_, record) => [ + + { + setactionFormModalVisible(true); + setCurrentRow(record.technologyActionInfo); + actionRef.current?.reloadAndRest?.(); + }} + > + 模型配置 + , + // { + // handleRemove([record.id]); + // actionRef.current?.reloadAndRest(); + // }} + // onCancel={() => {}} + // > + // 删除 + // , + ], + }, + ]; + useEffect(() => { + // GetDicList('DeviceClientType').then((r) => { + // var arr = r.data; + // let data = {}; + // if (r.succeeded) { + // var list = []; + // arr.forEach((item) => { + // data[item.code] = { text: item.code }; + // list.push({ + // code: item.code, + // value: item.code, + // }); + // }); + // //setDicDataAny(data); + // setDictData(list); + // } + // }); + }, []) + return ( + { + props.onCancel(); + }} + maskClosable={false} + destroyOnClose + > + + { + setCurrentRow(undefined); + setactionFormModalVisible(false); + }} + /> + + ); +}; + +export default bomtechnology; diff --git a/src/pages/device/technology/index.jsx b/src/pages/device/technology/index.jsx index 3550e15..379111c 100644 --- a/src/pages/device/technology/index.jsx +++ b/src/pages/device/technology/index.jsx @@ -4,13 +4,12 @@ import React, { useState, useRef, useEffect } from 'react'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import { PlusOutlined } from '@ant-design/icons'; import ProTable from '@ant-design/pro-table'; -import {GetTechnologyPage,GetProductList,GetDeviceVesionList } from "./services" +import {GetTechnologyPage,GetProductList,GetDeviceVesionList,DeleteTechnology } from "./services" import { history } from 'umi'; +import { getDataBaseUrl } from '@/global_data'; +import Technologylist from './components/technologylist' +import useFetchData from '@ant-design/pro-descriptions/lib/useFetchData'; const key = 'message'; - - - - const GoodsTypeManage = () => { const [createModalVisible, handleModalVisible] = useState(false); const actionRef = useRef(); @@ -21,6 +20,10 @@ const GoodsTypeManage = () => { const [isModalOpen, setIsModalOpen] = useState(false); const [isAddGoodsTemplate,setIsAddGoodsTemplate]=useState(false); const [form] = Form.useForm(); + const [ProductVesionId, setProductVesionId] = useState(''); + const [deviceTypeKey, setdeviceTypeKey] = useState(''); + const [version, setversion] = useState(''); + const props = { beforeUpload: (file) => { if ( @@ -29,18 +32,31 @@ const GoodsTypeManage = () => { ) { message.error(`${file.name} 不是 exelce 文件`); } + if(ProductVesionId.length==0){ + message.error(`请选择产品`); + Upload.LIST_IGNORE + return Upload.LIST_IGNORE; + } + if(deviceTypeKey.length==0){ + message.error(`请选择版本`); + + return Upload.LIST_IGNORE; + } return file.type == 'application/vnd.ms-excel' || file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ? true : Upload.LIST_IGNORE; }, + name: 'file', - data: { "id": currentRow?.id, "deviceClientType": currentRow?.deviceTypeKey, "version": currentRow?.vesion,"isAddGoodsTemplate":isAddGoodsTemplate}, - action: '/saasbase/api/goods/goodstemplateexport', + data: { "id": ProductVesionId, "deviceClientType": deviceTypeKey, "version": version,"isAddGoodsTemplate":isAddGoodsTemplate}, + action: getDataBaseUrl()+'/api/goods/goodstemplateexport', headers: { - Authorization: 'Bearer ' + localStorage.getItem('token') + Authorization: 'Bearer ' + localStorage.getItem('token'), + // 'Content-Type':'application/json' }, onChange(info) { + console.log(info) if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } @@ -74,8 +90,9 @@ const GoodsTypeManage = () => { }, { title: '时间', - dataIndex: 'createTime', + dataIndex: 'createAt', valueType: 'textarea', + search:false }, // { // title: '是否存在模板', @@ -99,16 +116,12 @@ const GoodsTypeManage = () => { key="config" onClick={() => { handleModalVisible(true); - setCurrentRow(record); + setCurrentRow(record.technologyInfo); // form.setFielsValue(record) }} > 详情, { - handleModalVisible(true); - setCurrentRow(record); - // form.setFielsValue(record) - }} > 下载, + href={record.templatePath}> 下载, { okText="是" cancelText="否" onConfirm={() => { - DelDeviceVesion([record.id]).then((r) => { - + DeleteTechnology(record.id).then((r) => { if (r.data) { message.success('删除成功'); actionRef.current.reload(); @@ -150,18 +162,7 @@ const GoodsTypeManage = () => { // href={record.templatePath} // > 下载工艺模板, - { - history.push({ - pathname: '/device/productmanage', - query: { - isAdd: false, - values: record, - tabStatus: 'basis' - }, - }); - }} > 管理, + ], }, ]; @@ -184,6 +185,7 @@ const GoodsTypeManage = () => { }, []) const handleChange = (value) => { console.log(`selected ${value}`); + setdeviceTypeKey(value) GetDeviceVesionList(value).then((r)=>{ var arr = r.data; if (r.succeeded) { @@ -202,6 +204,12 @@ const GoodsTypeManage = () => { }; const handleVisChange=(value)=>{ console.log(`selected ${value}`); + setProductVesionId(value) + var sd=DeviceVesionData.find(x=>x.id==value); + setversion(sd?.label) + } + const onCancel=()=>{ + handleModalVisible(false); } return ( { - + ); }; diff --git a/src/pages/device/technology/services.js b/src/pages/device/technology/services.js index 2fe9f05..eaf32ec 100644 --- a/src/pages/device/technology/services.js +++ b/src/pages/device/technology/services.js @@ -15,4 +15,9 @@ export async function GetTechnologyPage(data) { return request(getDataBaseUrl()+`/api/devicevesion/getdevicevesion?productId=`+data, { method: 'Get', }); + } + export async function DeleteTechnology(data) { + return request(getDataBaseUrl()+`/api/technology/delete?id=`+data, { + method: 'Get', + }); } \ No newline at end of file