Explorar el Código

正常和软著 第三方信息和付款节点

mentoswzq hace 4 años
padre
commit
8fe06bca16

+ 6 - 2
js/component/manageCenter/components/checkProject/applyPaymentModal.js

@@ -39,6 +39,7 @@ class ApplyPaymentModal extends Component{
     //申请付款
     handleSubmit(e){
         e.preventDefault();
+        console.log(this.props.previewPayInfor)
         this.props.form.validateFieldsAndScroll((err, values) => {
             if (err) {
                 return;
@@ -173,7 +174,7 @@ class ApplyPaymentModal extends Component{
                                 label="已付(万元):"
                             >
                                 {getFieldDecorator('totalPrice', {
-                                    initialValue: parseFloat(previewPayInfor.partyAmount),
+                                    initialValue: previewPayInfor.partyAmount ? parseFloat(previewPayInfor.partyAmount) : 0,
                                     rules: [{ required: false, message: '请输入已付金额!' }],
                                 })(
                                     <Input disabled={true} style={{ width: '200px' }} placeholder="请输入已付金额" type={'number'}/>
@@ -187,7 +188,10 @@ class ApplyPaymentModal extends Component{
                                 label="本次申请支付金额(万元):"
                             >
                                 {getFieldDecorator('applicationAmount', {
-                                    initialValue: parseFloat(previewPayInfor.totalAmount) - parseFloat(previewPayInfor.partyAmount),
+                                    initialValue:
+                                        previewPayInfor.partyAmount ?
+                                            parseFloat(previewPayInfor.totalAmount) - parseFloat(previewPayInfor.partyAmount) :
+                                            parseFloat(previewPayInfor.totalAmount),
                                     rules: [{ required: true, message: '请输入本次申请支付金额!' }],
                                 })(
                                     <Input style={{ width: '200px' }} placeholder="请输入本次申请支付金额" type={'number'}/>

+ 52 - 7
js/component/manageCenter/components/checkProject/index.jsx

@@ -8,7 +8,7 @@ import {
   Upload,
   Input,
   Button, message,
-  Row,
+  Row, Popconfirm,
 } from 'antd'
 import {getProjectStatus,} from '@/tools'
 import { getMaterialStatus, getUrgentStatus } from '@/tools'
@@ -100,7 +100,7 @@ class CheckProject extends Component {
           title: '操作',
           dataIndex: 'action',
           key: 'action',
-          render: (text, record) => {
+          render: (ext, record, index) => {
             return (
               <div>
                 {/*外包审核通过后,咨询师/咨询经理可申请付款*/}
@@ -118,6 +118,28 @@ class CheckProject extends Component {
                       申请付款
                     </Button>
                 }
+                <Popconfirm
+                    title="是否删除?"
+                    onConfirm={() => {
+                      this.confirmDeletNew(record)
+                    }}
+                    okText="删除"
+                    cancelText="不删除"
+                >
+                  <Button
+                      onClick={(e) => {
+                        e.stopPropagation()
+                      }}
+                      style={{
+                        marginLeft: '10px',
+                        color: '#ffffff',
+                        background: '#f00',
+                        border: 'none',
+                      }}
+                  >
+                    删除
+                  </Button>
+                </Popconfirm>
               </div>
             )
           },
@@ -228,10 +250,6 @@ class CheckProject extends Component {
     }
   }
 
-  componentDidUpdate(prevProps, prevState, snapshot) {
-
-  }
-
   onChange() {
     this.setState({
       value: e.target.value,
@@ -313,6 +331,33 @@ class CheckProject extends Component {
     }
   }
 
+  // 删除供应商信息
+  confirmDeletNew(index) {
+    this.setState({
+      loading: true,
+      ThirdListVisible: false,
+    })
+    $.ajax({
+      url: globalConfig.context + '/api/admin/company/deleteCompany',
+      method: 'post',
+      data: {
+        id: index.id,
+      },
+    }).done(
+        function (data) {
+          this.setState({
+            loading: false,
+          })
+          if (!data.error.length) {
+            message.success('删除成功!')
+            this.props.onRefresh()
+          } else {
+            message.warning(data.error[0].message)
+          }
+        }.bind(this)
+    )
+  }
+
   render() {
     return (
       <div className="App">
@@ -324,7 +369,7 @@ class CheckProject extends Component {
           {
             parseInt(this.props.startType) === 0 ?
                 <div>
-                  <div>供应商信息(外包派单,不走总部)</div>
+                  <div>外包(外包派单,不走总部)</div>
                   <div className="tipsText">提示高于总部价格,费用个人承担</div>
                 </div> :
                 <div>供应商信息(普通单)</div>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 513 - 312
js/component/manageCenter/project/task/myTask.jsx


+ 366 - 0
js/component/manageCenter/project/task/newSupplier.js

@@ -0,0 +1,366 @@
+import React,{Component} from 'react';
+import {AutoComplete, Button, Form, Input, message, Modal, Select, Spin} from "antd";
+import {
+    getMaterialStatus,
+    getUrgentStatus,
+} from '@/tools'
+import $ from "jquery";
+
+const { Option } = Select
+const { TextArea } = Input
+
+const formItemLayout = {
+    labelCol: { span: 8 },
+    wrapperCol: { span: 14 },
+}
+
+class NewSupplier extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            thirdCompanyName: props.thirdCompanyName && props.thirdCompanyName.split('-')[0],
+            thirdUnitPrice: props.thirdUnitPrice,
+            thirdQuantity: props.thirdQuantity,
+            thirdRemarks: props.thirdRemarks,
+            thirdMaterial: props.thirdMaterial,
+            thirdUrgent: props.thirdUrgent,
+            customerArr: [],
+            loading: false,
+        }
+    }
+
+    componentDidMount() {
+        if(this.props.ThirdId){
+            this.supervisor(this.state.thirdCompanyName)
+        }
+    }
+
+    //服务值改变时请求供应商名称
+    httpChange(e) {
+        if (e.length >= 1) {
+            this.supervisor(e)
+        }
+        this.props.otherOperations && this.props.otherOperations({
+            thirdMaterial: this.state.thirdMaterial,
+            thirdUrgent: this.state.thirdUrgent,
+            customerArr: this.state.customerArr,
+            thirdCompanyName: e,
+        });
+        this.setState({
+            thirdCompanyName: e,
+        })
+    }
+
+    //加载(自动补全)
+    supervisor(e) {
+        $.ajax({
+            method: 'get',
+            dataType: 'json',
+            crossDomain: false,
+            url: globalConfig.context + '/api/admin/company/selectVague',
+            data: {
+                name: e,
+                type: this.props.projectType === 2 ? 0 : 1
+            },
+            success: function (data) {
+                let thedata = data.data
+                if (!thedata) {
+                    if (data.error && data.error.length) {
+                        message.warning(data.error[0].message)
+                    }
+                    thedata = {}
+                }
+                this.setState({
+                    customerArr: thedata,
+                })
+                this.props.otherOperations && this.props.otherOperations({
+                    thirdMaterial: this.state.thirdMaterial,
+                    thirdUrgent: this.state.thirdUrgent,
+                    customerArr: thedata,
+                    thirdCompanyName: this.state.thirdCompanyName,
+                });
+            }.bind(this),
+        }).always(
+            function () {
+                this.setState({
+                    loading: false,
+                })
+            }.bind(this)
+        )
+    }
+
+    // 第三方信息自动计算总金额
+    calculatedAmount() {
+        let currentTotalPrice
+        currentTotalPrice = this.state.thirdUnitPrice * this.state.thirdQuantity
+        currentTotalPrice = currentTotalPrice.toFixed(4)
+        this.setState({
+            currentTotalPrice: currentTotalPrice,
+        })
+    }
+
+    // 保存供应商信息
+    handleCancelq() {
+        let api
+        if (this.props.ThirdId) {
+            //修改
+            api = '/api/admin/company/updateCompany'
+        } else {
+            //新增
+            api = '/api/admin/company/addCompany'
+        }
+        let customerId = 0;
+        let isHave =this.state.customerArr.some((value)=>{
+            if(value.companyName === this.state.thirdCompanyName){
+                customerId = value.id
+                return true;
+            }
+        });
+        //软著  必须要使用查询出来第三方名称和对应id
+        if(!isHave && this.props.projectType === 2){   //projectType   0正常 1专利 2软著
+            message.warning('请输入正确的供应商名称')
+            return;
+        }
+        this.setState({
+            loading: true,
+        })
+        // material: this.state.thirdMaterial, //材料
+        // urgent: this.state.thirdUrgent, //加急
+        // unitPrice: this.state.thirdUnitPrice, //单价
+        let data = {
+            id: this.props.ThirdId,                     //id
+            tid: this.props.tid,                        //订单编号
+            companyName: this.state.thirdCompanyName,   //第三方名称
+            quantity: this.state.thirdQuantity,         //数量
+            remarks: this.state.thirdRemarks,           //备注
+            unitPrice: this.state.thirdUnitPrice,       //单价
+        }
+        if(isHave){
+            data.cid = customerId     //公司id            只有软著类要传cid,其他类型都是非必填的
+        }
+        if(this.props.projectType === 2){
+            data.material = this.state.thirdMaterial    //材料
+            data.urgent = this.state.thirdUrgent        //加急
+            data.calculation = 1;                       //0 其他 1软著
+        }else{                                          //非软著类需要传总金额
+            data.totalAmount = this.state.thirdQuantity * this.state.thirdUnitPrice;
+        }
+        $.ajax({
+            url: globalConfig.context + api,
+            method: 'post',
+            dataType: 'json',
+            crossDomain: false,
+            data: data,
+        }).done(
+            function (data) {
+                this.setState({
+                    loading: false,
+                })
+                if (!data.error.length) {
+                    message.success('保存成功!')
+                    this.setState({
+                        thirdCompanyName: '', //第三方名称
+                        thirdUnitPrice: '', //单价
+                        thirdQuantity: '', //数量
+                        currentTotalPrice: '', //总价
+                        thirdRemarks: '',
+                        thirdUrgent: 0,
+                    })
+                    this.props.onCancel();
+                } else {
+                    message.warning(data.error[0].message)
+                }
+            }.bind(this)
+        )
+    }
+
+    render() {
+        return(
+            <Modal
+                visible={this.props.visible}
+                onCancel={this.props.onCancel}
+                width={800}
+                title={this.props.ThirdId ? "修改供应商" : "新增供应商"}
+                footer=""
+                className="admin-desc-content"
+            >
+                <Form
+                    layout="horizontal"
+                    style={{ paddingBottom: '40px' }}
+                >
+                    <Spin spinning={this.state.loading}>
+                        <div className="clearfix">
+                            <div className="clearfix">
+                                <Form.Item {...formItemLayout} label="供应商名称">
+                                    <AutoComplete
+                                        className="certain-category-search"
+                                        dropdownClassName="certain-category-search-dropdown"
+                                        dropdownMatchSelectWidth={false}
+                                        dropdownStyle={{ width: 220 }}
+                                        style={{ width: '220px' }}
+                                        dataSource={(this.state.customerArr || []).map((group) => (
+                                            <Select.Option key={group.id} value={group.companyName}>
+                                                {group.companyName}
+                                            </Select.Option>
+                                        ))}
+                                        placeholder="请输入供应商名称"
+                                        value={this.state.thirdCompanyName}
+                                        onChange={(e)=>{
+                                            this.httpChange(e)
+                                        }}
+                                        filterOption={true}
+                                        required="required"
+                                    />
+                                    <span className="mandatory">*</span>
+                                </Form.Item>
+                            </div>
+                            {this.props.projectType !== 2 ?<div className="clearfix">
+                                <Form.Item {...formItemLayout} label="单价(万元)">
+                                    <Input
+                                        value={this.state.thirdUnitPrice}
+                                        placeholder="请输入金额(必填项)"
+                                        required="required"
+                                        type={'number'}
+                                        onBlur={this.calculatedAmount}
+                                        onChange={(e) => {
+                                            this.setState({
+                                                thirdUnitPrice: e.target.value,
+                                            })
+                                        }}
+                                        style={{ width: '220px' }}
+                                    />
+                                    <span className="mandatory">*</span>
+                                </Form.Item>
+                            </div> : <div/>}
+                            <div className="clearfix">
+                                <Form.Item {...formItemLayout} label="数量">
+                                    <Input
+                                        value={this.state.thirdQuantity}
+                                        placeholder="请输入数量(必填项)"
+                                        required="required"
+                                        onBlur={this.calculatedAmount}
+                                        type={'number'}
+                                        onChange={(e) => {
+                                            this.setState({
+                                                thirdQuantity: e.target.value,
+                                            })
+                                        }}
+                                        style={{ width: '220px' }}
+                                    />
+                                    <span className="mandatory">*</span>
+                                </Form.Item>
+                            </div>
+                            {this.props.projectType !== 2 ?<div className="clearfix">
+                                <Form.Item {...formItemLayout} label="总价(万元)">
+                                    <span>{this.state.thirdQuantity * this.state.thirdUnitPrice}</span>
+                                </Form.Item>
+                            </div> : <div/>}
+                            {this.props.projectType === 2 ? <div>
+                                <div className="clearfix">
+                                    <Form.Item {...formItemLayout} label="材料">
+                                        <Select
+                                            value={getMaterialStatus(this.state.thirdMaterial)}
+                                            onChange={(val) => {
+                                                this.setState({
+                                                    thirdMaterial: val,
+                                                })
+                                                this.props.otherOperations && this.props.otherOperations({
+                                                    thirdMaterial: val,
+                                                    thirdUrgent: this.state.thirdUrgent,
+                                                    customerArr: this.state.customerArr,
+                                                    thirdCompanyName: this.state.thirdCompanyName,
+                                                });
+                                            }}
+                                            style={{ width: '220px' }}
+                                            defaultValue="0"
+                                        >
+                                            <Option value="1">有材料</Option>
+                                            <Option value="0">无材料</Option>
+                                        </Select>
+                                        <span className="mandatory">*</span>
+                                    </Form.Item>
+                                </div>
+                                <div className="clearfix">
+                                    <Form.Item {...formItemLayout} label="加急">
+                                        <Select
+                                            value={getUrgentStatus(this.state.thirdUrgent)}
+                                            onChange={(val) => {
+                                                this.setState({
+                                                    thirdUrgent: val,
+                                                })
+                                                this.props.otherOperations && this.props.otherOperations({
+                                                    thirdMaterial: this.state.thirdMaterial,
+                                                    thirdUrgent: val,
+                                                    customerArr: this.state.customerArr,
+                                                    thirdCompanyName: this.state.thirdCompanyName
+                                                });
+                                            }}
+                                            style={{ width: '220px' }}
+                                            defaultValue="0"
+                                        >
+                                            <Option value="0">无加急</Option>
+                                            <Option value="1">加急3天</Option>
+                                            <Option value="2">加急4天</Option>
+                                            <Option value="3">加急5-10天</Option>
+                                            <Option value="4">加急11-15天</Option>
+                                            <Option value="5">加急16-20天</Option>
+                                            <Option value="6">加急21-25天</Option>
+                                            <Option value="7">加急26-30天</Option>
+                                        </Select>
+                                        <span className="mandatory">*</span>
+                                    </Form.Item>
+                                </div>
+                            </div>:<div/>}
+                            <div className="clearfix">
+                                <Form.Item
+                                    style={{ height: 'auto' }}
+                                    labelCol={{ span: 4 }}
+                                    wrapperCol={{ span: 18 }}
+                                    label="备注"
+                                >
+                                    <TextArea
+                                        rows={4}
+                                        placeholder="请输入备注"
+                                        ref="signTotalAmount"
+                                        style={{ width: '95%' }}
+                                        value={this.state.thirdRemarks}
+                                        onChange={(e) => {
+                                            this.setState({
+                                                thirdRemarks: e.target.value,
+                                            })
+                                        }}
+                                    />
+                                </Form.Item>
+                            </div>
+                            <div className="clearfix">
+                                <div className="addSave" style={{ marginTop: '15px' }}>
+                                    <Button
+                                        className="cancel"
+                                        type="primary"
+                                        onClick={()=>{
+                                            this.handleCancelq();
+                                        }}
+                                        style={{ marginLeft: '300px' }}
+                                        htmlType="submit"
+                                    >
+                                        保存
+                                    </Button>
+                                    <Button
+                                        className="cancel"
+                                        type="ghost"
+                                        onClick={this.props.onCancel}
+                                        style={{ marginLeft: '50px' }}
+                                    >
+                                        取消
+                                    </Button>
+                                </div>
+                            </div>
+                        </div>
+                    </Spin>
+                </Form>
+            </Modal>
+        )
+    }
+}
+
+export default NewSupplier;