Pārlūkot izejas kodu

图片组件添加 上传功能

mentoswzq 4 gadi atpakaļ
vecāks
revīzija
ea7420f139

+ 63 - 13
js/component/common/imgList/index.js

@@ -1,5 +1,5 @@
 import React,{Component} from 'react';
-import {Spin, Upload} from 'antd';
+import {Icon, Spin, Upload} from 'antd';
 import './index.less';
 import Viewer from 'viewerjs';
 import 'viewerjs/dist/viewer.css';
@@ -7,6 +7,14 @@ import PropTypes from 'prop-types';
 
 // const url1 = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601012352754&di=d33308119328f5ed987bd90031f98cfa&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F27%2F81%2F01200000194677136358818023076.jpg';
 // const url2 = 'https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1601001245&di=60b5e1a42beb791524b46d7e3677f1f4&src=http://a2.att.hudong.com/13/86/01300001285722131043860050752.jpg';
+
+const uploadButton = (
+    <div>
+        <Icon type="plus" />
+        <div className="ant-upload-text">点击上传</div>
+    </div>
+);
+
 class ImgList extends Component{
     constructor(props) {
         super(props);
@@ -17,14 +25,29 @@ class ImgList extends Component{
             imgLoadNum: 0,
         }
         this.imgLoading = this.imgLoading.bind(this);
+        this.setTimeOutObj = null;
+    }
+
+    componentDidMount() {
+        this.setTimeOutObj = setTimeout(()=>{
+            this.setState({
+                gallery: new Viewer(document.getElementById(this.props.domId))
+            },()=>{
+                this.setState({
+                    loading: false
+                })
+            })
+        },10000)
     }
 
     imgLoading(){
         let num = this.state.imgLoadNum + 1;
         if(num >= this.props.fileList.length){
+            this.state.gallery && this.state.gallery.destroy();
             this.setState({
                 gallery: new Viewer(document.getElementById(this.props.domId))
             },()=>{
+                this.setTimeOutObj && clearTimeout(this.setTimeOutObj);
                 this.setState({
                     loading: false
                 })
@@ -35,35 +58,58 @@ class ImgList extends Component{
         })
     }
 
+    componentWillUnmount() {
+        this.setTimeOutObj && clearTimeout(this.setTimeOutObj);
+    }
+
     render() {
         const {fileList} = this.props;
-        if(!fileList || !Array.isArray(fileList) || fileList.length <= 0){
+        if(!fileList || !Array.isArray(fileList)){
             return null;
         }
-        const list = fileList.map((v,i)=>{
-            v.index = i;
-            // v.url = i%2 ? url1 : url2;
-            return v
-        });
         return (
             <div className='ImgListComponent'>
                 <div className='ImgList'>
-                    <Spin spinning={fileList.length === 0 ? false : this.state.loading}>
+                    <Spin spinning={fileList.length === 0 ? false : this.state.loading} tip="图片加载中...">
                         <Upload
+                            {...this.props.uploadConfig}
                             className="demandDetailShow-upload"
                             listType="picture-card"
                             fileList={
-                                this.state.seeMore?
-                                    list :
-                                    list.slice(0,10)
+                                Object.keys(this.props.uploadConfig).length !== 0 ?
+                                    (
+                                        fileList.map((v,i)=>{
+                                            v.index = i;
+                                            // v.url = i%2 ? url1 : url2;
+                                            return v
+                                        })
+                                    ) : (
+                                        this.state.seeMore?
+                                            fileList.map((v,i)=>{
+                                                v.index = i;
+                                                // v.url = i%2 ? url1 : url2;
+                                                return v
+                                            }) :
+                                            fileList.map((v,i)=>{
+                                                v.index = i;
+                                                // v.url = i%2 ? url1 : url2;
+                                                return v
+                                            }).slice(0,10)
+                                    )
                             }
                             onPreview={(file) => {
                                 this.state.gallery.view(file.index).show();
                             }}
-                        />
+                            onChange={(infor)=>{
+                                this.state.gallery && this.state.gallery.destroy();
+                                this.props.onChange(infor)
+                            }}
+                        >
+                            {Object.keys(this.props.uploadConfig).length === 0 ? "" : uploadButton}
+                        </Upload>
                     </Spin>
                 </div>
-                {fileList.length > 10 ? <div className='seeMore' onClick={()=>{this.setState({seeMore:!this.state.seeMore})}}>
+                {fileList.length > 10 && Object.keys(this.props.uploadConfig).length === 0 ? <div className='seeMore' onClick={()=>{this.setState({seeMore:!this.state.seeMore})}}>
                     {this.state.seeMore ? '收起' : '查看更多'}
                 </div> : <div/>}
                 <ul id={this.props.domId} style={{display:'none',zIndex:-1,}}>
@@ -85,11 +131,15 @@ class ImgList extends Component{
 ImgList.propTypes = {
     domId : PropTypes.string,                            //如果一个界面有多个该组件,需要传入自定义id名称,用于图片列表显示
     fileList: PropTypes.array.isRequired,                //图片文件列表
+    uploadConfig: PropTypes.object,                      //上传图片配置参数(需要上传图片时需要,存在与否,用于区分是否为上传或者为查看)
+    onChange: PropTypes.func,                        //选择图片
 }
 
 ImgList.defaultProps = {
     domId: 'images',
     fileList: [],
+    uploadConfig: {},
+    onChange:()=>{}
 }
 
 export default ImgList;

+ 2 - 1
js/component/manageCenter/achievement/crmAchievement.jsx

@@ -119,9 +119,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': this.props.pictureSign }}
                     listType="picture-card"
                     fileList={fileList}
+                    multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 5 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/achievement/techAchievementAudit/auditDesc.jsx

@@ -119,9 +119,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': this.props.pictureSign }}
                     listType="picture-card"
                     fileList={fileList}
+                    multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 5 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/achievement/techAchievementRelease/auditDesc.jsx

@@ -119,9 +119,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': this.props.pictureSign }}
                     listType="picture-card"
                     fileList={fileList}
+                    multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 5 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/customer/customerData/companyCustomer.jsx

@@ -53,9 +53,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': '' }}
                     listType="picture-card"
                     fileList={fileList}
+					multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 1 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/customer/customerData/myClient.jsx

@@ -52,9 +52,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': '' }}
                     listType="picture-card"
                     fileList={fileList}
+					multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 1 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/customer/customerManagement/organizationManages.jsx

@@ -53,9 +53,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': '' }}
                     listType="picture-card"
                     fileList={fileList}
+					multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 1 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 2 - 1
js/component/manageCenter/customer/individualCustomer/individualCustomer.jsx

@@ -54,9 +54,10 @@ const PicturesWall = React.createClass({
                     data={{ 'sign': '' }}
                     listType="picture-card"
                     fileList={fileList}
+					multiple={true}
                     onPreview={this.handlePreview}
                     onChange={this.handleChange} >
-                    {fileList.length >= 1 ? null : uploadButton}
+                    {uploadButton}
                 </Upload>
                 <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                     <img alt="example" style={{ width: '100%' }} src={previewImage} />

+ 4 - 2
js/component/manageCenter/order/orderNew/addService.jsx

@@ -6593,7 +6593,7 @@ const NewService = Form.create()(
               </Spin>
             </Form>
           </Modal>
-          <Modal
+          {this.state.lookVisible ? <Modal
             maskClosable={false}
             visible={this.state.lookVisible}
             onOk={this.noCancel}
@@ -6612,6 +6612,7 @@ const NewService = Form.create()(
                     label="终止合同"
                   >
                     <Picture
+                      domId={'addService1'}
                       fileList={(e) => {
                         this.setState({ contractUrl: e });
                       }}
@@ -6632,6 +6633,7 @@ const NewService = Form.create()(
                     label="退单申请表"
                   >
                     <Picture
+                      domId={'addService2'}
                       fileList={(e) => {
                         this.setState({ applicationUrl: e });
                       }}
@@ -6683,7 +6685,7 @@ const NewService = Form.create()(
                 </div>
               </Spin>
             </Form>
-          </Modal>
+          </Modal> : <div/>}
           <Modal
             title="修改项目金额及数量"
             visible={this.state.editProVisible}

+ 4 - 2
js/component/manageCenter/order/orderNew/addorders.js

@@ -3237,7 +3237,7 @@ const Addorders = Form.create()(
               </Spin>
             </Form>
           </Modal>
-          <Modal
+          {this.state.lookVisible ? <Modal
             maskClosable={false}
             visible={this.state.lookVisible}
             onOk={this.noCancel}
@@ -3256,6 +3256,7 @@ const Addorders = Form.create()(
                     label="终止合同"
                   >
                     <Picture
+                      domId={'addorders1'}
                       fileList={(e) => {
                         this.setState({ contractUrl: e });
                       }}
@@ -3276,6 +3277,7 @@ const Addorders = Form.create()(
                     label="退单申请表"
                   >
                     <Picture
+                      domId={'addorders2'}
                       fileList={(e) => {
                         this.setState({ applicationUrl: e });
                       }}
@@ -3327,7 +3329,7 @@ const Addorders = Form.create()(
                 </div>
               </Spin>
             </Form>
-          </Modal>
+          </Modal> : <div/>}
           <Modal
             visible={this.state.rizhivisible}
             className="admin-desc-content"

+ 12 - 23
js/component/manageCenter/order/orderNew/changeComponent/orderDetail.js

@@ -423,12 +423,7 @@ class OrderDetail extends Component {
     const data = this.props.orderData;
     const propsList = this.props.contactList || [];
     return (
-      <div
-        className="clearfix"
-        ref={(e) => {
-          this.refs = e;
-        }}
-      >
+      <div className="clearfix">
         {this.state.resVisible ? (
           <ResolutionDetail
             cancel={this.resCancel}
@@ -548,15 +543,15 @@ class OrderDetail extends Component {
             {/*    });*/}
             {/*  }}*/}
             {/*/>*/}
-            {this.props.orderData && this.props.orderData.contractPictureUrl ? <ImgList fileList={
-              this.props.orderData.contractPictureUrl
-                  ? splitUrl(
-                  this.props.orderData.contractPictureUrl,
-                  ",",
-                  globalConfig.avatarHost + "/upload"
-                  )
-                  : []
-            } domId={'orderDetail1'}/> : <div/> }
+            {this.props.orderData && data.contractPictureUrl ?
+                <ImgList
+                    domId={'orderDetail1'}
+                    fileList={
+                      data.contractPictureUrl ? splitUrl(data.contractPictureUrl, ",", globalConfig.avatarHost + "/upload") : []
+                    }
+                /> :
+                <div/>
+            }
             <Modal
               maskClosable={false}
               footer={null}
@@ -652,14 +647,8 @@ class OrderDetail extends Component {
               <ImgList
                   domId={'orderDetail2'}
                   fileList={
-                data.agreementUrl
-                    ? splitUrl(
-                    data.agreementUrl,
-                    ",",
-                    globalConfig.avatarHost + "/upload"
-                    )
-                    : []
-              }/>
+                    data.agreementUrl ? splitUrl(data.agreementUrl, ",", globalConfig.avatarHost + "/upload") : []
+                  }/>
             </div>
             <Modal
               maskClosable={false}

+ 1 - 1
js/component/manageCenter/order/orderNew/chargeback.jsx

@@ -1526,6 +1526,7 @@ const IntentionCustomer = Form.create()(
                           label="终止合同"
                         >
                           <Picture
+                            domId={'chargeback4'}
                             fileList={(e) => {
                               this.setState({ contractUrl: e });
                             }}
@@ -1534,7 +1535,6 @@ const IntentionCustomer = Form.create()(
                             data={{
                               sign: "order_refund_file",
                               url: "/api/admin/newOrder/uploadRefundOrderFile",
-                              number: 8,
                             }}
                           />
                         </FormItem>

+ 36 - 32
js/component/manageCenter/order/orderNew/contractCwzj.js

@@ -456,32 +456,36 @@ const contractChange = Form.create()(
 
     //订单详情
     xiangqing(orderNos) {
-      $.ajax({
-        method: "get",
-        dataType: "json",
-        crossDomain: false,
-        url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
-        data: {
-          orderNo: orderNos
-        },
-        success: function (data) {
-          if (data.error.length || data.data.list == "") {
-            if (data.error && data.error.length) {
-              message.warning(data.error[0].message);
+      this.setState({
+        orderData: {}
+      },()=>{
+        $.ajax({
+          method: "get",
+          dataType: "json",
+          crossDomain: false,
+          url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
+          data: {
+            orderNo: orderNos
+          },
+          success: function (data) {
+            if (data.error.length || data.data.list == "") {
+              if (data.error && data.error.length) {
+                message.warning(data.error[0].message);
+              }
+            } else {
+              let thisdata = data.data;
+              this.setState({
+                userName: thisdata.userName,
+                primaryOrderNo: thisdata.primaryOrder,
+                additionalOrder: thisdata.additionalOrder,
+                contractNo: thisdata.contractNo,
+                // arrears: thisdata.arrears,
+                orderData: thisdata,
+                isAddition: thisdata.additionalOrder ? true : false
+              });
             }
-          } else {
-            let thisdata = data.data;
-            this.setState({
-              userName: thisdata.userName,
-              primaryOrderNo: thisdata.primaryOrder,
-              additionalOrder: thisdata.additionalOrder,
-              contractNo: thisdata.contractNo,
-              // arrears: thisdata.arrears,
-              orderData: thisdata,
-              isAddition: thisdata.additionalOrder ? true : false
-            });
-          }
-        }.bind(this)
+          }.bind(this)
+        });
       });
     },
 
@@ -1159,7 +1163,7 @@ const contractChange = Form.create()(
                 />
               </Spin>
             </div>
-            {this.state.visible ? <Modal
+            <Modal
               className="customeDetails"
               footer=""
               maskClosable={false}
@@ -1168,7 +1172,7 @@ const contractChange = Form.create()(
               onOk={this.visitOk}
               onCancel={this.visitCancel}
             >
-              <Tabs
+              {this.state.visible ? <Tabs
                 activeKey={this.state.activeKey}
                 onChange={this.callback}
                 type="card"
@@ -1271,7 +1275,7 @@ const contractChange = Form.create()(
                           style={{ paddingBottom: "40px" }}
                         >
                           <Spin spinning={this.state.loading}>
-                            <OrderDetail
+                            {this.state.visible ? <OrderDetail
                               orderData={this.state.primaryOrderData}
                               getOrderLog={this.getOrderLog}
                               dataSourceX={this.state.dataSourceX}
@@ -1280,7 +1284,7 @@ const contractChange = Form.create()(
                               isCaiWu={true}
                               totalCui={this.state.totalCui}
                               contactListNew={this.state.contactListNew}
-                            />
+                            /> : <div/>}
                           </Spin>
                         </Form> : <div/>}
                       </TabPane>
@@ -1292,7 +1296,7 @@ const contractChange = Form.create()(
                 {this.state.status === 4 && this.state.isAddition ? (
                   this.state.type === 4 || this.state.type === 5 ? (
                     <TabPane tab="附加订单" key="c">
-                      {this.state.activeKey === "c" ? <OrderDetail
+                      {this.state.activeKey === "c" && this.state.visible ? <OrderDetail
                         orderData={this.state.additionalOrderData}
                         getOrderLog={this.getOrderLog}
                         dataSourceX={this.state.dataSourceX}
@@ -1309,8 +1313,8 @@ const contractChange = Form.create()(
                 ) : (
                     ""
                   )}
-              </Tabs>
-            </Modal> : <div/>}
+              </Tabs> : <div/>}
+            </Modal>
             <Modal
               maskClosable={false}
               visible={this.state.addnextVisible}

+ 2 - 0
js/component/manageCenter/order/orderNew/outsourcingPro.jsx

@@ -1019,6 +1019,8 @@ const outsourcingPro = Form.create()(
       //获取支付节点信息表格
       this.payNodeTable(record.tid);
 
+      let url = window.location.href.substring(7);
+
       $.ajax({
         method: "get",
         dataType: "json",

+ 26 - 46
js/component/manageCenter/project/task/myTask.jsx

@@ -59,22 +59,9 @@ const { MonthPicker, RangePicker } = DatePicker
 const PicturesWall = React.createClass({
   getInitialState() {
     return {
-      previewVisible: false,
-      previewImage: '',
       fileList: [],
     }
   },
-  handleCancel() {
-    this.setState({
-      previewVisible: false,
-    })
-  },
-  handlePreview(file) {
-    this.setState({
-      previewImage: file.url || file.thumbUrl,
-      previewVisible: true,
-    })
-  },
   handleChange(info) {
     let fileList = info.fileList
     this.setState({
@@ -87,36 +74,22 @@ const PicturesWall = React.createClass({
     this.state.pojectApplicationUrl = undefined
   },
   render() {
-    const { previewVisible, previewImage, fileList } = this.state
-    const uploadButton = (
-      <div>
-        <Icon type="plus" />
-        <div className="ant-upload-text">点击上传</div>
-      </div>
-    )
+    const { fileList } = this.state
     return (
       <div style={{ display: 'inline-block' }}>
-        <Upload
-          action={
-            globalConfig.context + '/api/admin/outsourceOrg/uploadOutsourceFile'
-          }
-          multiple
-          data={{ sign: 'order_outsource' }}
-          listType="picture-card"
-          fileList={fileList}
-          onPreview={this.handlePreview}
-          onChange={this.handleChange}
-        >
-          {uploadButton}
-        </Upload>
-        <Modal
-          maskClosable={false}
-          visible={previewVisible}
-          footer={null}
-          onCancel={this.handleCancel}
-        >
-          <img alt="example" style={{ width: '100%' }} src={previewImage} />
-        </Modal>
+        <ImgList
+            domId={this.props.domId}
+            uploadConfig={{
+              action:globalConfig.context + '/api/admin/outsourceOrg/uploadOutsourceFile',
+              multiple:true,
+              data:{ sign: 'order_outsource' },
+              listType:"picture-card",
+            }}
+            onChange={(infor)=>{
+              this.handleChange(infor)
+            }}
+            fileList={fileList}
+        />
       </div>
     )
   },
@@ -2466,15 +2439,17 @@ const Task = React.createClass({
     this.setState({
       activeKey: key,
     })
-    if (key == 3) {
+    if (key === '3') {
       this.orderDetailData(this.state.orderNo)
       this.xiangmu(this.state.orderNo)
       this.jiedian(this.state.orderNo)
       this.jiedianNew(this.state.orderNo)
-    }
-    if (key == 2) {
+    }else if (key === '2') {
       this.waiDetail()
+    }else if(key === "1"){
+      this.xiangqing(this.state.tid);
     }
+
   },
   //节点列表
   jiedian(orderNos) {
@@ -3416,11 +3391,13 @@ const Task = React.createClass({
             activeKey={this.state.activeKey}
             onChange={(e) => {
               this.callback(e)
-              if (e == 2) {
+              if (e === "2") {
                 this.waiDetail();
                 this.thirdTable(this.state.tid);
                 this.payNodeTable(this.state.tid);
                 this.getSelectOutsourceLog(this.state.tid);
+              }else if(e === "1"){
+                this.xiangqing(this.state.tid);
               }
             }}
           >
@@ -4131,6 +4108,7 @@ const Task = React.createClass({
                         label="附件"
                       >
                         <Picture
+                          domId={'myTask1'}
                           fileList={(e) => {
                             this.setState({ attachmentUrl: e })
                           }}
@@ -4568,6 +4546,7 @@ const Task = React.createClass({
                       }
                     >
                       <PicturesWall
+                        domId={'myTask3'}
                         fileList={this.getOrgCodeUrlWai}
                         pictureUrl={this.state.pictureUrl}
                       />
@@ -5363,6 +5342,7 @@ const Task = React.createClass({
                   label="附件"
                 >
                   <Picture
+                    domId={'myTask2'}
                     fileList={(e) => {
                       this.setState({ attachmentUrl: e })
                     }}
@@ -5371,7 +5351,6 @@ const Task = React.createClass({
                     data={{
                       sign: 'order_task_file',
                       url: '/api/admin/orderProject/uploadOrderTaskFile',
-                      number: 8,
                     }}
                   />
                 </FormItem>
@@ -5821,6 +5800,7 @@ const Task = React.createClass({
                           }
                       >
                         <PicturesWall
+                            domId={'myTask4'}
                             fileList={this.getOrgCodeUrlWai}
                             pictureUrl={this.state.pictureUrl}
                         />

+ 6 - 4
js/component/manageCenter/project/task/myTaskOutsource.jsx

@@ -2198,7 +2198,7 @@ const MyTaskOutsource = React.createClass({
           flag={this.state.flag}
           isZhuan={this.state.isZhuan} //是否转交
         />
-        <Modal
+        {this.state.visible ? <Modal
           className="customeDetails"
           footer=""
           title=""
@@ -2229,7 +2229,7 @@ const MyTaskOutsource = React.createClass({
               }
           >
             <TabPane tab="项目概况" key="1">
-              <Form
+              {this.state.modKey === "1" ? <Form
                 layout="horizontal"
                 onSubmit={this.handleSubmit}
                 id="demand-form"
@@ -2900,6 +2900,7 @@ const MyTaskOutsource = React.createClass({
                         label="附件"
                       >
                         <Picture
+                          domId={'myTaskOutsource1'}
                           fileList={(e) => {
                             this.setState({ attachmentUrl: e });
                           }}
@@ -2981,7 +2982,7 @@ const MyTaskOutsource = React.createClass({
                     </div>
                   </div>
                 </Spin>
-              </Form>
+              </Form> : <div/>}
             </TabPane>
             <TabPane tab="外包/供应商信息" key="2">
               {this.state.visible && this.state.modKey === '2'?<CheckProject
@@ -3027,7 +3028,7 @@ const MyTaskOutsource = React.createClass({
               ""
             )}
           </Tabs>
-        </Modal>
+        </Modal> : <div/>}
         <Modal
           maskClosable={false}
           visible={this.state.lookVisible}
@@ -3534,6 +3535,7 @@ const MyTaskOutsource = React.createClass({
                   label="附件"
                 >
                   <Picture
+                    domId={'myTaskOutsource2'}
                     fileList={(e) => {
                       this.setState({ attachmentUrl: e });
                     }}

+ 44 - 34
js/component/manageCenter/project/task/taskQuery.jsx

@@ -33,6 +33,7 @@ import {
 const FormItem =Form.Item;
 const {TabPane} = Tabs
 import ShowModalDiv from "@/showModal.jsx";
+import ImgList from "../../../common/imgList";
 
 const Task = React.createClass({
   loadData(pageNo) {
@@ -1093,7 +1094,7 @@ const Task = React.createClass({
           specially={0}
           roleName={this.state.nub}
         />
-        <Modal
+        {this.state.visible ? <Modal
           className="customeDetails"
           footer=""
           title=""
@@ -1104,7 +1105,7 @@ const Task = React.createClass({
         >
           <Tabs activeKey={this.state.activeKey} onChange={this.orderChange}>
             <TabPane tab="项目概况" key="1">
-              <Form
+              {this.state.activeKey === "1" ? <Form
                 layout="horizontal"
                 onSubmit={this.handleSubmit}
                 id="demand-form"
@@ -1342,7 +1343,7 @@ const Task = React.createClass({
                         className="half-item"
                         {...formItemLayout}
                         label=""
-                      ></FormItem>
+                      />
                       <FormItem className="half-item" {...formItemLayout}>
                         <span style={{ paddingLeft: "12em" }}>
                           {this.state.postalAddress}
@@ -1530,17 +1531,20 @@ const Task = React.createClass({
                         wrapperCol={{ span: 18 }}
                         label="附件"
                       >
-                        <Upload
-                          className="demandDetailShow-upload"
-                          listType="picture-card"
-                          fileList={this.state.attachmentUrl}
-                          onPreview={(file) => {
-                            this.setState({
-                              previewImage: file.url || file.thumbUrl,
-                              previewVisible: true,
-                            });
-                          }}
-                        ></Upload>
+                        {/*<Upload*/}
+                        {/*  className="demandDetailShow-upload"*/}
+                        {/*  listType="picture-card"*/}
+                        {/*  fileList={this.state.attachmentUrl}*/}
+                        {/*  onPreview={(file) => {*/}
+                        {/*    this.setState({*/}
+                        {/*      previewImage: file.url || file.thumbUrl,*/}
+                        {/*      previewVisible: true,*/}
+                        {/*    });*/}
+                        {/*  }}*/}
+                        {/*/>*/}
+                        {this.state.visible && this.state.attachmentUrl && this.state.activeKey === "1" ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
+                          <ImgList fileList={this.state.attachmentUrl} domId={'taskQuery1'}/>
+                        </div> : <div/>}
                         <Modal
                           maskClosable={false}
                           footer={null}
@@ -1598,11 +1602,11 @@ const Task = React.createClass({
                     </div>
                   </div>
                 </Spin>
-              </Form>
+              </Form> : <div/>}
             </TabPane>
             {!this.props.isZxs || (this.state.isHuiyuan && this.props.isZxs) ? (
               <TabPane tab="订单详情" key="2">
-                <Spin spinning={this.state.loading}>
+                {this.state.activeKey === "2" ? <Spin spinning={this.state.loading}>
                   <OrderDetail
                     orderData={this.state.orderData}
                     getOrderLog={this.getOrderLog}
@@ -1613,13 +1617,13 @@ const Task = React.createClass({
                     contactListNew={this.state.jiedianNew}
                     pictureUrl={this.state.contractPictureUrl}
                   />
-                </Spin>
+                </Spin> : <div/>}
               </TabPane>
             ) : (
               ""
             )}
           </Tabs>
-        </Modal>
+        </Modal> : <div/>}
         <Modal
           maskClosable={false}
           visible={this.state.addnextVisible}
@@ -1686,7 +1690,7 @@ const Task = React.createClass({
             </Spin>
           </div>
         </Modal>
-        <Modal
+        {this.state.speVisible ? <Modal
           maskClosable={false}
           visible={this.state.speVisible}
           onOk={this.visitOk}
@@ -1698,6 +1702,8 @@ const Task = React.createClass({
         >
           <Tabs activeKey={this.state.activeKey} onChange={this.orderChange}>
             <TabPane tab="项目概况" key="1">
+              {this.state.activeKey === "1" ?
+                  <div>
               <div className="clearfix">
                 <FormItem
                   className="half-item"
@@ -1892,7 +1898,7 @@ const Task = React.createClass({
                   className="half-item"
                   {...formItemLayout}
                   label=""
-                ></FormItem>
+                />
                 <FormItem className="half-item" {...formItemLayout} label="">
                   <span style={{ paddingLeft: "12em" }}>
                     {this.state.postalAddress}
@@ -1939,17 +1945,20 @@ const Task = React.createClass({
                   wrapperCol={{ span: 18 }}
                   label="附件"
                 >
-                  <Upload
-                    className="demandDetailShow-upload"
-                    listType="picture-card"
-                    fileList={this.state.attachmentUrl}
-                    onPreview={(file) => {
-                      this.setState({
-                        previewImage: file.url || file.thumbUrl,
-                        previewVisible: true,
-                      });
-                    }}
-                  ></Upload>
+                  {/*<Upload*/}
+                  {/*  className="demandDetailShow-upload"*/}
+                  {/*  listType="picture-card"*/}
+                  {/*  fileList={this.state.attachmentUrl}*/}
+                  {/*  onPreview={(file) => {*/}
+                  {/*    this.setState({*/}
+                  {/*      previewImage: file.url || file.thumbUrl,*/}
+                  {/*      previewVisible: true,*/}
+                  {/*    });*/}
+                  {/*  }}*/}
+                  {/*/>*/}
+                  {this.state.speVisible && this.state.attachmentUrl && this.state.activeKey === "1" ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
+                    <ImgList fileList={this.state.attachmentUrl} domId={'taskQuery1'}/>
+                  </div> : <div/>}
                   <Modal
                     maskClosable={false}
                     footer={null}
@@ -2054,10 +2063,11 @@ const Task = React.createClass({
                   </Spin>
                 </div>
               </div>
+             </div>:<div/>}
             </TabPane>
             {!this.props.isZxs || (this.state.isHuiyuan && this.props.isZxs) ? (
               <TabPane tab="订单详情" key="2">
-                <Spin spinning={this.state.loading}>
+                {this.state.activeKey === "2" ? <Spin spinning={this.state.loading}>
                   <OrderDetail
                     orderData={this.state.orderData}
                     getOrderLog={this.getOrderLog}
@@ -2068,13 +2078,13 @@ const Task = React.createClass({
                     contactListNew={this.state.jiedianNew}
                     pictureUrl={this.state.contractPictureUrl}
                   />
-                </Spin>
+                </Spin> : <div/>}
               </TabPane>
             ) : (
               ""
             )}
           </Tabs>
-        </Modal>
+        </Modal> : <div/>}
         <Modal
           width="800px"
           visible={this.state.visibleA}

+ 27 - 12
js/component/manageCenter/publicComponent/picture.jsx

@@ -1,6 +1,7 @@
 
 import React from 'react';
 import {Icon,Upload,Modal} from 'antd';
+import ImgList from "../../common/imgList";
 
 const PicturesWall = React.createClass({
     getInitialState() {
@@ -20,6 +21,7 @@ const PicturesWall = React.createClass({
         });
     },
     handleChange(info) {
+        console.log(info)
         let fileList = info.fileList;
         this.setState({ fileList });
         this.props.fileList(fileList);
@@ -37,19 +39,32 @@ const PicturesWall = React.createClass({
         );
         return (
             <div className="clearfix">
-                <Upload
-                    action={globalConfig.context + this.props.data.url}
-                    data={{ 'sign': this.props.data.sign }}
-                    listType="picture-card"
+                <ImgList
+                    domId={this.props.domId}
+                    uploadConfig={{
+                        action:globalConfig.context + this.props.data.url,
+                        data:{ 'sign': this.props.data.sign },
+                        listType:"picture-card",
+                        multiple:true,
+                    }}
+                    onChange={(infor)=>{
+                        this.handleChange(infor)
+                    }}
                     fileList={fileList}
-                    multiple={true}
-                    onPreview={this.handlePreview}
-                    onChange={this.handleChange} >
-                    {uploadButton}
-                </Upload>
-                <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
-                    <img alt="example" style={{ width: '100%' }} src={previewImage} />
-                </Modal>
+                />
+                {/*<Upload*/}
+                {/*    action={globalConfig.context + this.props.data.url}*/}
+                {/*    data={{ 'sign': this.props.data.sign }}*/}
+                {/*    listType="picture-card"*/}
+                {/*    fileList={fileList}*/}
+                {/*    multiple={true}*/}
+                {/*    onPreview={this.handlePreview}*/}
+                {/*    onChange={this.handleChange} >*/}
+                {/*    {uploadButton}*/}
+                {/*</Upload>*/}
+                {/*<Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>*/}
+                {/*    <img alt="example" style={{ width: '100%' }} src={previewImage} />*/}
+                {/*</Modal>*/}
             </div>
         );
     }

+ 2 - 1
js/component/manageCenter/statistics/personnel/picturesWall.js

@@ -56,10 +56,11 @@ class PicturesWall extends Component {
           data={{ sign: this.props.sign }}
           listType="picture-card"
           fileList={fileList}
+          multiple={true}
           onPreview={this.handlePreview}
           onChange={this.handleChange}
         >
-          {fileList.length >= 1 ? null : uploadButton}
+          {uploadButton}
         </Upload>
         <Modal
           maskClosable={false}

+ 43 - 36
js/component/project.jsx

@@ -33,6 +33,7 @@ const project = React.createClass({
       visible: false,
       record: this.props.record,
       paginations: false,
+      tabsKey: "1",
       columnsX: [
         {
           title: '业务项目名称',
@@ -599,6 +600,9 @@ const project = React.createClass({
     )
   },
   tabChange(e) {
+    this.setState({
+      tabsKey:e
+    })
     if (e == 2) {
       this.waiDetail()
     } else if (e == 3) {
@@ -633,7 +637,7 @@ const project = React.createClass({
       },
     }
     return (
-      <Modal
+        this.state.visible ? <Modal
         className="customeDetails"
         footer=""
         title=""
@@ -641,6 +645,9 @@ const project = React.createClass({
         visible={this.state.visible}
         // onOk={this.visitOk}
         onCancel={(e) => {
+          this.setState({
+            tabsKey: "1"
+          })
           this.props.cancel()
         }}
       >
@@ -654,9 +661,9 @@ const project = React.createClass({
         ) : (
           ''
         )}
-        <Tabs defaultActiveKey="1" onChange={this.tabChange}>
+        <Tabs defaultActiveKey="1" activeKey={this.state.tabsKey} onChange={this.tabChange}>
           <TabPane tab="项目概况" key="1">
-            <Form
+            {this.state.tabsKey === "1" ? <Form
               layout="horizontal"
               onSubmit={this.handleSubmit}
               id="demand-form"
@@ -885,7 +892,7 @@ const project = React.createClass({
                       className="half-item"
                       {...formItemLayout}
                       label=""
-                    ></FormItem>
+                    />
                     <FormItem className="half-item" {...formItemLayout}>
                       <span style={{ paddingLeft: '12em' }}>
                         {this.state.postalAddress}
@@ -1053,20 +1060,20 @@ const project = React.createClass({
                       wrapperCol={{ span: 18 }}
                       label="附件"
                     >
-                      <Upload
-                        className="demandDetailShow-upload"
-                        listType="picture-card"
-                        fileList={this.state.attachmentUrl}
-                        onPreview={(file) => {
-                          this.setState({
-                            previewImage: file.url || file.thumbUrl,
-                            previewVisible: true,
-                          })
-                        }}
-                      />
-                      {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
-                      {/*  <ImgList fileList={this.state.attachmentUrl} ItemWidth={'96px'}/>*/}
-                      {/*</div>*/}
+                      {/*<Upload*/}
+                      {/*  className="demandDetailShow-upload"*/}
+                      {/*  listType="picture-card"*/}
+                      {/*  fileList={this.state.attachmentUrl}*/}
+                      {/*  onPreview={(file) => {*/}
+                      {/*    this.setState({*/}
+                      {/*      previewImage: file.url || file.thumbUrl,*/}
+                      {/*      previewVisible: true,*/}
+                      {/*    })*/}
+                      {/*  }}*/}
+                      {/*/>*/}
+                      {this.state.attachmentUrl && this.state.visible && this.state.tabsKey === "1" ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
+                        <ImgList fileList={this.state.attachmentUrl} ItemWidth={'96px'}/>
+                      </div> : <div/>}
                       <Modal
                         maskClosable={false}
                         footer={null}
@@ -1124,11 +1131,11 @@ const project = React.createClass({
                   </div>
                 </div>
               </Spin>
-            </Form>
+            </Form> : <div/>}
           </TabPane>
           {this.props.record && this.props.record.outsource == 1 ? (
             <TabPane tab="外包审核信息" key="2">
-              <Spin spinning={this.state.loading}>
+              {this.state.tabsKey === "2" ? <Spin spinning={this.state.loading}>
                 <div>
                   <div className="clearfix">
                     <FormItem
@@ -1181,20 +1188,20 @@ const project = React.createClass({
                       wrapperCol={{ span: 18 }}
                       label="合同/协议扫描件"
                     >
-                      <Upload
-                        className="demandDetailShow-upload"
-                        listType="picture-card"
-                        fileList={this.state.pictureUrl}
-                        onPreview={(file) => {
-                          this.setState({
-                            previewImage: file.url || file.thumbUrl,
-                            previewVisible: true,
-                          })
-                        }}
-                      />
-                      {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
-                      {/*  <ImgList fileList={this.state.pictureUrl} ItemWidth={'96px'}/>*/}
-                      {/*</div>*/}
+                      {/*<Upload*/}
+                      {/*  className="demandDetailShow-upload"*/}
+                      {/*  listType="picture-card"*/}
+                      {/*  fileList={this.state.pictureUrl}*/}
+                      {/*  onPreview={(file) => {*/}
+                      {/*    this.setState({*/}
+                      {/*      previewImage: file.url || file.thumbUrl,*/}
+                      {/*      previewVisible: true,*/}
+                      {/*    })*/}
+                      {/*  }}*/}
+                      {/*/>*/}
+                      {this.state.tabsKey === "2" && this.state.pictureUrl && this.state.visible ? <div style={{paddingTop:'10px',paddingBottom:'10px'}}>
+                        <ImgList fileList={this.state.pictureUrl} ItemWidth={'96px'}/>
+                      </div> : <div/>}
                       <Modal
                         maskClosable={false}
                         footer={null}
@@ -1253,7 +1260,7 @@ const project = React.createClass({
                     </FormItem>
                   </div>
                 </div>
-              </Spin>
+              </Spin> : <div/>}
             </TabPane>
           ) : (
             ''
@@ -1300,7 +1307,7 @@ const project = React.createClass({
             </Spin>
           </div>
         </Modal>
-      </Modal>
+      </Modal> : <div/>
     )
   },
 })

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.1.49",
+  "version": "1.1.50",
   "description": "",
   "main": "index.js",
   "scripts": {