p__生态系统碳汇平台__系统管理员__方法学管理__MethodList.6b0b9369.async.js 17 KB

1
  1. (self["webpackChunk"]=self["webpackChunk"]||[]).push([[604],{69094:function(e){e.exports={preview:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-preview",previewBox:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-previewBox",detailBox:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-detailBox",colStyle:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-colStyle",pass:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-pass",refuse:"antd-pro-pages-\u751f\u6001\u7cfb\u7edf\u78b3\u6c47\u5e73\u53f0-news-modal-refuse"}},40031:function(e,t,n){"use strict";n.d(t,{wo:function(){return i},FO:function(){return a},uD:function(){return l},Ye:function(){return o},b5:function(){return r}});var i={labelCol:{span:6},wrapperCol:{span:18}},a={labelCol:{span:7},wrapperCol:{span:16}},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=null;return function(i){n&&clearTimeout(n),n=setTimeout(e,t,i)}},o="#52c41a",r="#d9d9d9"},63544:function(e,t,n){"use strict";n.d(t,{Vp:function(){return a},vU:function(){return l}});n(68059);var i=n(94966),a=function(e){i.default.success({message:e})},l=function(e){i.default.error({message:e})}},7515:function(e,t,n){"use strict";n.d(t,{K1:function(){return a},FI:function(){return i},Vd:function(){return l}});var i=function(e){return sessionStorage.setItem("globalSize",e)},a=function(){return sessionStorage.getItem("globalSize")||10},l=["10","20","30","40","100","200","300","500","1000"]},41611:function(e,t,n){"use strict";n.d(t,{us:function(){return i},bt:function(){return a},aH:function(){return l}});var i=[{required:!0,message:"\u5fc5\u9009\uff01"}],a=[{required:!0,message:"\u5fc5\u586b\uff01"}],l=/^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/},68587:function(e,t,n){"use strict";n(26780);var i=n(49283),a=n(11849),l=(n(83557),n(23521)),o=(n(33827),n(50190)),r=n(69610),s=n(54941),d=n(81306),c=n(80017),u=n(67294),h=n(63544),p=(n(45375),n(85893)),f=function(e){(0,d.Z)(n,e);var t=(0,c.Z)(n);function n(e){var i;return(0,r.Z)(this,n),i=t.call(this,e),i.beforeUpload=function(e){var t="image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type||"image/gif"===e.type;t||(0,h.vU)("\u8bf7\u4e0a\u4f20\u683c\u5f0f\u6b63\u786e\u7684\u56fe\u7247");var n=e.size/1024/1024<5;if(n||(0,h.vU)("\u56fe\u7247\u5927\u5c0f\u8bf7\u4f4e\u4e8e5M"),"bgcImg"===i.props.type){var a=1920,l=180;return new Promise((function(t,n){var i=new FileReader;i.addEventListener("load",(function(){var e=new Image;e.src=i.result,e.onload=function(){e.width<a||e.height<l?((0,h.vU)("\u8bf7\u4e0a\u4f20\u5bbd\u9ad8\u5c0f\u4e8e\u7b49\u4e8e 1920*180 \u7684\u5934\u90e8\u80cc\u666f\u56fe\uff01"),n(new Error("\u8bf7\u4e0a\u4f20\u5bbd\u9ad8\u5c0f\u4e8e\u7b49\u4e8e 1920*180 \u7684\u5934\u90e8\u80cc\u666f\u56fe\uff01"))):t()}}),!1),i.readAsDataURL(e)}))}return t&&n},i.uploadChange=function(e){var t=e.file,n=e.fileList;if("error"===t.status)return(0,h.vU)("\u4e0a\u4f20\u5931\u8d25\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u56fe\u7247\u5e76\u4e0a\u4f20"),i.setState({fileList:[],picUrl:""}),void i.props.onChange([],"");if(t.status){var a=[{uid:n[0]&&n[0].uid||Math.random(),url:window.server+(null===t||void 0===t?void 0:t.response)}];i.setState({fileList:a,picUrl:(null===t||void 0===t?void 0:t.response)||""}),t.response&&i.props.onChange(a,null===t||void 0===t?void 0:t.response)}},i.uploadRemove=function(){i.setState({fileList:[],picUrl:""},(function(){i.props.onChange([],"")}))},i.handlePreview=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];i.setState({previewVisible:e})},i.state={fileList:i.props.fileList,previewVisible:!1,picUrl:i.props.picUrl},i}return(0,s.Z)(n,[{key:"render",value:function(){var e=this,t=this.state,n=t.fileList,r=t.previewVisible,s=t.picUrl,d=(0,p.jsxs)("div",{children:[(0,p.jsx)(o.Z,{type:"plus"}),(0,p.jsx)("div",{className:"ant-upload-text",children:"\u4e0a\u4f20\u56fe\u7247"}),(0,p.jsx)("div",{children:"bgcImg"===this.props.type&&"(1920*180)"})]}),c=/.*XSRF-TOKEN=([^;.]*).*$/,u=null===document.cookie.match(c)?null:document.cookie.match(c)[1],h={action:"".concat(window.server,"/api/file/upload"),accept:".jpg,.jpeg,.png,.gif",data:{fileCategoryCode:this.props.type},listType:"picture-card",fileList:n,headers:{Authorization:"Bearer ".concat(sessionStorage.getItem("token")),"x-xsrf-token":u},onChange:this.uploadChange,onPreview:this.handlePreview,onRemove:this.uploadRemove,beforeUpload:this.beforeUpload};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(l.Z,(0,a.Z)((0,a.Z)({},h),{},{children:n.length>=1?null:d})),(0,p.jsx)(i.Z,{visible:r,footer:null,onCancel:function(){return e.handlePreview(!1)},children:(0,p.jsx)("img",{alt:"example",style:{width:"100%"},src:window.server+s})})]})}}]),n}(u.Component);t["Z"]=f},31403:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return B}});n(29585);var i=n(92527),a=(n(13753),n(60287)),l=(n(67604),n(67329)),o=(n(68137),n(11718)),r=(n(12284),n(28930)),s=(n(33827),n(50190)),d=(n(14943),n(74356)),c=n(11849),u=n(69610),h=n(54941),p=n(81306),f=n(80017),v=(n(97140),n(90407)),g=n(67294),m=n(7515),x=n(63544),Z=n(45375),j=(n(26780),n(49283)),w=(n(83557),n(23521)),C=n(40031),b=n(13245),S=n(41611),y=n(68587),I=n(85893),k=v.Z.Option,U=function(e){(0,p.Z)(n,e);var t=(0,f.Z)(n);function n(e){var i;return(0,u.Z)(this,n),i=t.call(this,e),i.getDetail=function(e){(0,Z.U2)("methodology/".concat(e)).then((function(e){var t,n,a,l,o;i.props.form.setFieldsValue((0,c.Z)({},e.data));var r=null===(t=e.data)||void 0===t?void 0:t.attachment,s=r.substring(r.lastIndexOf("/")+1);i.setState({detailInfo:e.data,fileList:[{uid:"-1",status:"done",url:window.server+(null===(n=e.data)||void 0===n?void 0:n.image)}],fuJianList:[{uid:"-1",status:"done",url:window.server+(null===(a=e.data)||void 0===a?void 0:a.attachment),name:s}],picUrl:null===(l=e.data)||void 0===l?void 0:l.image,fjUrl:null===(o=e.data)||void 0===o?void 0:o.attachment})}))},i.handleOk=function(){var e=i.props.editId,t=i.state,n=t.detailInfo,a=t.picUrl,l=t.fjUrl;i.props.form.validateFieldsAndScroll((function(t,o){if(t)return!1;if(i.setState({loading:!0}),e){var r=(0,c.Z)((0,c.Z)((0,c.Z)({},n),o),{},{id:e,attachment:l,image:a});(0,Z.gz)("methodology",r).then((function(e){(0,x.Vp)("\u4fee\u6539\u6210\u529f"),i.handleCancel()})).catch((function(e){i.setState({loading:!1})}))}else{var s=(0,c.Z)((0,c.Z)({},o),{},{attachment:l,image:a});(0,Z.v_)("methodology",s).then((function(e){(0,x.Vp)("\u65b0\u589e\u6210\u529f"),i.handleCancel()})).catch((function(e){i.setState({loading:!1})}))}}))},i.handleCancel=function(){i.setState({loading:!1}),i.props.form.resetFields(),i.props.handleClose()},i.checkFileList=function(e,t,n){t?n():n("\u8bf7\u4e0a\u4f20\u56fe\u7247\uff01")},i.normFile=function(e,t){return t},i.checkFuJian=function(e,t,n){var a;0===(null===(a=i.state.fuJianList)||void 0===a?void 0:a.length)?n("\u8bf7\u4e0a\u4f20\u9644\u4ef6\uff01"):n()},i.uploadChange=function(e){var t=e.file,n=e.fileList;if("error"===t.status)return(0,x.vU)("\u4e0a\u4f20\u5931\u8d25\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u5e76\u4e0a\u4f20"),void i.setState({fuJianList:[],fjUrl:""});t.status&&i.setState({fuJianList:n.length>0?[n.pop()]:[],fjUrl:null===t||void 0===t?void 0:t.response})},i.uploadRemove=function(){i.setState({fuJianList:[],fjUrl:""})},i.beforeUpload=function(e){var t=e.size/1024/1024<10;return t||(0,x.vU)("\u6587\u4ef6\u5927\u5c0f\u8bf7\u4f4e\u4e8e10M"),t},i.state={loading:!1,detailInfo:{},picUrl:"",fileList:[],fuJianList:[],fjUrl:""},i}return(0,h.Z)(n,[{key:"componentDidMount",value:function(){var e=this.props.editId;e&&this.getDetail(e)}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.props,i=n.visible,r=n.editId,s=this.state,d=s.loading,u=s.fuJianList,h=s.fileList,p=r?"\u4fee\u6539":"\u65b0\u589e",f=/.*XSRF-TOKEN=([^;.]*).*$/,g=null===document.cookie.match(f)?null:document.cookie.match(f)[1],m={action:"".concat(window.server,"/api/file/upload"),data:{fileCategoryCode:"extraFile"},headers:{Authorization:"Bearer ".concat(sessionStorage.getItem("token")),"x-xsrf-token":g},onChange:this.uploadChange,onRemove:this.uploadRemove,beforeUpload:this.beforeUpload};return(0,I.jsx)(j.Z,{visible:i,title:p,onOk:this.handleOk,onCancel:this.handleCancel,confirmLoading:d,children:(0,I.jsxs)(l.Z,(0,c.Z)((0,c.Z)({},C.FO),{},{children:[(0,I.jsx)(l.Z.Item,{label:"\u7c7b\u578b",children:t("type",{rules:S.us})((0,I.jsxs)(v.Z,{allowClear:!0,placeholder:"\u8bf7\u9009\u62e9",children:[(0,I.jsx)(k,{value:"CCER",children:"CCER"}),(0,I.jsx)(k,{value:"\u78b3\u666e\u60e0",children:"\u78b3\u666e\u60e0"})]}))}),(0,I.jsx)(l.Z.Item,{label:"\u540d\u79f0",children:t("name",{getValueFromEvent:function(e){return(0,b.bc)(e.target.value)},rules:S.bt})((0,I.jsx)(o.Z,{allowClear:!0,placeholder:"\u8bf7\u8f93\u5165"}))}),(0,I.jsx)(l.Z.Item,{label:"\u56fe\u7247",style:{marginBottom:0},children:t("image",{getValueFromEvent:this.normFile,rules:[{required:!0,validator:this.checkFileList}]})((0,I.jsx)(y.Z,{fileList:h,type:"method",onChange:function(t,n){e.setState({fileList:t,picUrl:n})},picUrl:this.state.picUrl},JSON.stringify(h)))}),(0,I.jsx)(l.Z.Item,{label:"\u7b80\u4ecb",children:t("introduction",{getValueFromEvent:function(e){return(0,b.bc)(e.target.value)},rules:S.bt})((0,I.jsx)(o.Z.TextArea,{rows:"3",allowClear:!0,placeholder:"\u8bf7\u8f93\u5165"}))}),(0,I.jsx)(l.Z.Item,{label:"\u65b9\u6cd5\u5b66\u6587\u4ef6",children:t("attachment",{rules:[{required:!0,validator:this.checkFuJian}]})((0,I.jsx)(w.Z,(0,c.Z)((0,c.Z)({},m),{},{fileList:u,children:(0,I.jsx)(a.Z,{icon:"upload",disabled:(null===u||void 0===u?void 0:u.length)>0,children:"\u4e0a\u4f20\u6587\u4ef6"})})))})]}))})}}]),n}(g.Component),L=l.Z.create()(U),V=(n(5317),n(87555)),F=(n(52222),n(65507)),z=n(69094),N=n.n(z),D=n(56721),M=function(e){(0,p.Z)(n,e);var t=(0,f.Z)(n);function n(e){var i;return(0,u.Z)(this,n),i=t.call(this,e),i.getDetail=function(e){(0,Z.U2)("methodology/".concat(e)).then((function(e){i.setState({detailInfo:e.data})}))},i.handleCancel=function(){i.props.handleClose()},i.state={detailInfo:{},previewVisible:!1},i}return(0,h.Z)(n,[{key:"componentDidMount",value:function(){var e=this.props.editId;e&&this.getDetail(e)}},{key:"render",value:function(){var e=this,t=this.props.visible,n=this.state,i=n.detailInfo,l=n.previewVisible,o=null===i||void 0===i?void 0:i.attachment,r=null===o||void 0===o?void 0:o.substring(o.lastIndexOf("/")+1);return(0,I.jsxs)(j.Z,{visible:t,title:"\u65b9\u6cd5\u5b66\u8be6\u60c5",onOk:this.handleOk,onCancel:this.handleCancel,closable:!0,footer:[(0,I.jsx)(a.Z,{onClick:this.handleCancel,children:"\u5173\u95ed"})],children:[(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u7c7b\u578b\uff1a"}),(0,I.jsx)(F.Z,{span:16,children:null===i||void 0===i?void 0:i.type})]}),(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u540d\u79f0\uff1a"}),(0,I.jsx)(F.Z,{span:16,children:null===i||void 0===i?void 0:i.name})]}),(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u56fe\u7247\uff1a"}),(0,I.jsx)(F.Z,{span:16,onClick:function(){return e.setState({previewVisible:!0})},style:{cursor:"pointer"},children:(0,I.jsx)("img",{src:window.server+(null===i||void 0===i?void 0:i.image),alt:"",style:{maxHeight:200,maxWidth:"100%",overflowX:"hidden"},height:"auto"})})]}),(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u7b80\u4ecb\uff1a"}),(0,I.jsx)(F.Z,{span:16,children:null===i||void 0===i?void 0:i.introduction})]}),(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u6dfb\u52a0\u65f6\u95f4\uff1a"}),(0,I.jsx)(F.Z,{span:16,children:(null===i||void 0===i?void 0:i.addTime)&&(0,D.kY)(null===i||void 0===i?void 0:i.addTime)})]}),(0,I.jsxs)(V.Z,{className:N().detailBox,children:[(0,I.jsx)(F.Z,{span:7,className:N().colStyle,children:"\u65b9\u6cd5\u5b66\u9644\u4ef6\uff1a"}),(0,I.jsx)(F.Z,{span:16,children:(0,I.jsx)("a",{onClick:function(){return(0,b.RU)("".concat(window.server+(null===i||void 0===i?void 0:i.attachment)),"\u65b9\u6cd5\u5b66-".concat(r),null,"GET")},children:r})})]}),(0,I.jsx)(j.Z,{visible:l,footer:null,onCancel:function(){return e.setState({previewVisible:!1})},children:(0,I.jsx)("img",{alt:"example",style:{width:"100%"},src:window.server+(null===i||void 0===i?void 0:i.image)})})]})}}]),n}(g.Component),O=l.Z.create()(M),Y=v.Z.Option,R=function(e){(0,p.Z)(n,e);var t=(0,f.Z)(n);function n(e){var i;return(0,u.Z)(this,n),i=t.call(this,e),i.fetch=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{size:i.state.pagination.pageSize,page:i.state.pagination.current},t=e.page-1||0,n=void 0===e.size?(0,m.K1)():e.size,a={};i.props.form.validateFieldsAndScroll((function(e,t){e||(a=t)})),i.setState({loading:!0});var l=(0,c.Z)({page:t,size:n},a);(0,Z.U2)("methodology",l).then((function(t){var n=i.state.pagination;0===Object.keys(e).length&&0!==n.current&&(n.current=0),n.total=parseInt(t.headers["x-total-count"],10),i.setState({loading:!1,dataSource:t.data,pagination:n})})).catch((function(e){i.setState({loading:!1})}))},i.handleTableChange=function(e){var t=(0,c.Z)({},i.state.pagination);t.current=e.current,t.pageSize=e.pageSize,(0,m.FI)(e.pageSize),i.setState({pagination:t}),i.fetch({size:e.pageSize,page:e.current})},i.qingkong=function(){i.props.form.resetFields();var e=i.state.pagination;e.current=1,i.setState({pagination:e},(function(){i.fetch()}))},i.handleModal=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"\u67e5\u770b"===t?i.setState({editId:e,detailVisible:!0}):i.setState({editId:e,addVisible:!0})},i.handleClose=function(){i.setState({addVisible:!1,detailVisible:!1,editId:""},(function(){i.fetch()}))},i.handleDelete=function(e){(0,Z.IV)("methodology/".concat(e)).then((function(e){(0,x.Vp)("\u5220\u9664\u6210\u529f"),i.handleClose()}))},i.state={dataSource:[{id:1}],loading:!1,pagination:{current:1,showQuickJumper:!0,showSizeChanger:!0,showTotal:function(e){return"\u5171 ".concat(e," \u6761 ")},size:"default",pageSizeOptions:m.Vd,defaultPageSize:(0,m.K1)()},addVisible:!1,editId:"",detailVisible:!1},i}return(0,h.Z)(n,[{key:"componentDidMount",value:function(){this.fetch()}},{key:"render",value:function(){var e=this,t=this.props.form.getFieldDecorator,n=this.state,u=n.dataSource,h=n.loading,p=n.pagination,f=n.addVisible,g=n.editId,m=n.detailVisible,x=[{title:"\u7c7b\u578b",align:"center",dataIndex:"type",render:function(e){return e||(0,I.jsx)(d.Z,{})}},{title:"\u540d\u79f0",dataIndex:"name",ellipsis:!0,render:function(e){return e||(0,I.jsx)(d.Z,{})}},{title:"\u56fe\u7247",align:"center",dataIndex:"image",render:function(e){return e?(0,I.jsx)("img",{src:window.server+e,height:30}):(0,I.jsx)(d.Z,{})}},{title:"\u7b80\u4ecb",align:"center",dataIndex:"introduction",width:300,ellipsis:!0,render:function(e){return e||(0,I.jsx)(d.Z,{})}},{title:"\u6dfb\u52a0\u65f6\u95f4",align:"center",dataIndex:"addTime",render:function(e){return(0,D.kY)(e)||(0,I.jsx)(d.Z,{})}},{title:"\u64cd\u4f5c",dataIndex:"operation",width:180,render:function(t,n){var i=(0,I.jsx)("a",{className:"tb_a_btn",onClick:function(){e.handleModal(n.id,"\u67e5\u770b")},children:"\u67e5\u770b"}),a=(0,I.jsx)("a",{className:"tb_a_btn",onClick:function(){e.handleModal(n.id,"\u4fee\u6539")},children:"\u4fee\u6539"}),l=(0,I.jsx)(r.Z,{title:"\u786e\u5b9a\u5220\u9664\u5417\uff1f",onConfirm:function(){return e.handleDelete(n.id)},icon:(0,I.jsx)(s.Z,{type:"delete",style:{color:"red"}}),children:(0,I.jsx)("a",{className:"tb_a_btn red",children:"\u5220\u9664"})});return(0,I.jsxs)("span",{children:[i,a,l]})}}];return(0,I.jsxs)("div",{className:"content-box",children:[(0,I.jsxs)(l.Z,{layout:"inline",children:[(0,I.jsx)(l.Z.Item,{className:"formStyle",label:"\u540d\u79f0",children:t("name")((0,I.jsx)(o.Z,{allowClear:!0,style:{width:200},placeholder:"\u8bf7\u8f93\u5165"}))}),(0,I.jsx)(l.Z.Item,{className:"formStyle",label:"\u7c7b\u578b",children:t("type")((0,I.jsxs)(v.Z,{allowClear:!0,style:{width:200},placeholder:"\u8bf7\u9009\u62e9",children:[(0,I.jsx)(Y,{value:"CCER",children:"CCER"}),(0,I.jsx)(Y,{value:"\u78b3\u666e\u60e0",children:"\u78b3\u666e\u60e0"})]}))}),(0,I.jsxs)(l.Z.Item,{children:[(0,I.jsx)(a.Z,{type:"primary",onClick:function(){e.setState({pagination:(0,c.Z)((0,c.Z)({},e.state.pagination),{},{current:1,pageSize:10})},(function(){e.fetch()}))},children:"\u67e5\u8be2"}),(0,I.jsx)(a.Z,{onClick:this.qingkong,style:{margin:"0 10px"},children:"\u91cd\u7f6e"})]}),(0,I.jsx)("br",{}),(0,I.jsx)(a.Z,{type:"primary",icon:"plus",style:{margin:"20px 0"},onClick:function(){return e.handleModal("","\u65b0\u5efa")},children:"\u65b0\u5efa"})]}),(0,I.jsx)(i.Z,{dataSource:u,columns:x,rowKey:function(e){return e.id},pagination:p,loading:h,onChange:this.handleTableChange}),f&&(0,I.jsx)(L,{visible:f,handleClose:this.handleClose,editId:g},f),m&&(0,I.jsx)(O,{visible:m,handleClose:this.handleClose,editId:g},m)]})}}]),n}(g.Component),B=l.Z.create()(R)},56721:function(e,t,n){"use strict";n.d(t,{Pv:function(){return o},kY:function(){return l},Hw:function(){return r}});var i=n(56051),a=n.n(i);function l(e){return a()(e).format("YYYY-MM-DD HH:mm:ss")}function o(e){return a()(e).format("YYYY-MM-DD")}function r(e){return a()(e).format("YYYY-MM-DD")}}}]);