Explorar o código

报价单新建调整,以及画像涉及报价金额字段调整

qymljy hai 1 ano
pai
achega
f9d87a791c

+ 17 - 5
src/Form/QuotedPrice/edit.vue

@@ -74,16 +74,16 @@
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group >
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
                 </el-button-group>
-                <el-input v-model="phonenumber" disabled placeholder="请输入手机号" style="width: 100%;margin-top: 10px" @input="telephoneChange('手机')"></el-input>
+                <el-input v-model="phonenumber" disabled placeholder="请输入手机号" style="width: 100%;margin-top: 10px" ></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="!isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group disabled>
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
@@ -95,6 +95,11 @@
                 </div>
               </el-form-item>
             </el-col>
+            <el-col  :span="24" >
+              <el-form-item label="报价金额:" label-width="100px" prop="quotedpriceamount">
+                <el-input  v-model="form.quotedpriceamount" autocomplete="off" placeholder="报价金额" :disabled="data.iseditamount == 0" @change="quotedpriceamountChange(form.quotedpriceamount)"></el-input>
+              </el-form-item>
+            </el-col>
             <el-col  :span="24">
               <el-form-item label="报价日期:" label-width="100px">
                 <el-date-picker
@@ -305,9 +310,13 @@ export default {
         discountrate:[
           { required: false, validator: discountrate, trigger: 'change'},
         ],
-       /* name:[
+        quotedpriceamount:[
+          { required: true, message: '请填写报价金额', trigger: 'blur'},
+          { pattern:/^[0-9]+\.{0,1}[0-9]{0,4}$/,message: '输入不合法,请输入数值',trigger: 'blur'},
+        ],
+        name:[
           { required: true, message: '请选择联系人', trigger: 'change'},
-        ]*/
+        ]
       },
       itemtype:[],
       isPhone:true,
@@ -628,6 +637,9 @@ export default {
         this.telephone = ''
       }
     },
+    quotedpriceamountChange(data){
+      this.form.quotedpriceamount = Math.round(data * 100)/100
+    }
    /* async mainData(val) {
       const res = await this.$api.requested({
         "id": 20220930103501,

+ 1 - 1
src/HDrpManagement/contactProfile/modules/detail.vue

@@ -254,7 +254,7 @@
                 :list="
               [
                 {title:'报价次数',value:$refs.quotationRef && $refs.quotationRef.total,bg:'#F3F9FC',color:'#3874F6'},
-                {title:'最近报价金额',value:unitCompile($refs.quotationRef && $refs.quotationRef.list[0] && $refs.quotationRef.list[0].sumamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
+                {title:'最近报价金额',value:unitCompile($refs.quotationRef && $refs.quotationRef.list[0] && $refs.quotationRef.list[0].quotedpriceamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
                 {title:'最近报价时间',value:$refs.quotationRef && $refs.quotationRef.list[0] && $refs.quotationRef.list[0].submitdate || '--',bg:'#F9F2E5',color:'#FF7603'},
               ]"
             >

+ 1 - 1
src/HDrpManagement/customerPortrait/modules/detail.vue

@@ -182,7 +182,7 @@
               :list="
               [
                 {title:'报价次数',value:$refs.baojiadan && $refs.baojiadan.total,bg:'#F3F9FC',color:'#3874F6'},
-                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].sumamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
+                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].quotedpriceamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
                 {title:'最近报价时间',value:$refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].submitdate || '--',bg:'#F9F2E5',color:'#FF7603'},
               ]"
             ></myCard>

+ 64 - 7
src/HDrpManagement/projectChange/modules/modules/quotation/modules/add.vue

@@ -94,7 +94,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group >
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
@@ -103,7 +103,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="!isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group disabled>
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
@@ -115,6 +115,11 @@
                 </div>
               </el-form-item>
             </el-col>
+            <el-col  :span="24" >
+              <el-form-item label="报价金额:" label-width="100px" prop="quotedpriceamount">
+                <el-input  v-model="form.quotedpriceamount" autocomplete="off" placeholder="报价金额" @change="quotedpriceamountChange(form.quotedpriceamount)"></el-input>
+              </el-form-item>
+            </el-col>
             <el-col  :span="24">
               <el-form-item label="报价日期:" label-width="100px">
                 <el-date-picker
@@ -178,12 +183,17 @@
                 <el-input  v-model="form.remarks" autocomplete="off" placeholder="请输入备注信息" type="textarea" autosize></el-input>
               </el-form-item>
             </el-col>
+            <el-col  :span="24">
+              <el-form-item label="附件上传:" label-width="100px" prop="remarks">
+                <upload @uploadGet="loading = true" ref="uploadRef" class="inline-16" :folderid="folderid" :bindData="{ ownertable: 'sa_quotedprice', ownerid: ownerid, usetype: 'default' }" title="上传报价清单至附件" @onSuccess="uploadSuccess"></upload>
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-row>
       </div>
       <div class="fixed__btn__panel">
-        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
-        <el-button  size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
+        <el-button size="small" @click="onClose" class="normal-btn-width" :disabled="loading">取 消</el-button>
+        <el-button  size="small" type="primary" @click="getSubmit" class="normal-btn-width" :loading="loading">确 定</el-button>
       </div>
     </el-drawer>
   </div>
@@ -192,11 +202,11 @@
 <script>
 import quotedPriceProduct from '@/SDrpManagement/QuotedPrice/components/quotedPriceProduct'
 import contactsNewTemplate from '@/template/contactsNewTemplate/index1'
-
+import upload from '@/template/upload/index'
 export default {
   name: "add",
   props:["data","flagTag"],
-  components:{quotedPriceProduct,contactsNewTemplate},
+  components:{quotedPriceProduct,contactsNewTemplate,upload},
   data(){
     var discountrate = (rule,value,callback) =>{
       if (this.form.discountrate < 0 || this.form.discountrate > 100){
@@ -206,6 +216,9 @@ export default {
       }
     }
     return {
+      ownerid:'',
+      loading:false,
+      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
       dialogFormVisible:false,
       projectShow:false,
       customerShow:false,
@@ -305,7 +318,8 @@ export default {
           "1、报价为含税13%税率,含运费",
           "2、报价有限期 2023-02-02 13:16:47至2023-02-22 13:16:47",
         ],
-        source:1
+        source:1,
+        iscreatenewid:0
       },
       rules:{
         projectname:[
@@ -323,6 +337,13 @@ export default {
         discountrate:[
           { required: false, validator: discountrate, trigger: 'change'},
         ],
+        quotedpriceamount:[
+          { required: true, message: '请填写报价金额', trigger: 'blur'},
+          { pattern:/^[0-9]+\.{0,1}[0-9]{0,4}$/,message: '输入不合法,请输入数值',trigger: 'blur'},
+        ],
+        name:[
+          { required: true, message: '请选择联系人', trigger: 'change'},
+        ]
       },
       itemtype:[],
       isPhone:true,
@@ -338,6 +359,7 @@ export default {
         this.$message.error('当前项目报备审核未通过,不可创建报价单');
       }else {
         this.dialogFormVisible = true
+        this.queryID()
       }
     },
     onClose(){
@@ -402,6 +424,7 @@ export default {
     /*提交*/
     getSubmit(){
       this.dialogFormVisible = false
+      this.loading = true
       if (this.form.date.length === 0){
         this.form.begdate = ''
         this.form.enddate = ''
@@ -413,11 +436,16 @@ export default {
       this.$refs.form.validate(async (valid) => {
         if (!valid) return false
         this.form.discountrate = this.form.discountrate / 100
+        this.form.sa_quotedpriceid = this.ownerid
         const res = await this.$api.requested({
           "id": 20221020164803,
           "content": this.form
         })
+        if (res.code == 0){
+          this.loading = false
+        }
         this.tool.showMessage(res,() => {
+          this.loading = false
           /*this.changeData(this.productObj)*/
           this.$emit('addSuccess')
           let route = this.$route
@@ -583,6 +611,35 @@ export default {
         this.telephone = ''
       }
     },
+    async queryID(){
+      const res = await this.$api.requested({
+        "id": 202400904102104,
+        "content": {}
+      })
+      this.ownerid = res.data
+    },
+    async uploadSuccess(){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sa_quotedprice',
+          "ownerid": this.ownerid,
+          "usetype":""
+        }
+      })
+      this.$refs.uploadRef.listFile = res.data.map(item=>{
+        return {
+          "name":item.document,
+          "url":item.url
+        }
+
+      })
+      this.loading = false
+    },
+    quotedpriceamountChange(data){
+      this.form.quotedpriceamount = Math.round(data * 100)/100
+    }
   },
   mounted() {
     const date = new Date()

+ 1 - 1
src/HDrpManagement/projectPortrait/modules/detail.vue

@@ -269,7 +269,7 @@
               :list="
               [
                 {title:'报价次数',value:$refs.baojiadan && $refs.baojiadan.total,bg:'#F3F9FC',color:'#3874F6'},
-                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].sumamount || 0),bg:'#E8F7EC',color:'#78B32B'},
+                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].quotedpriceamount || 0),bg:'#E8F7EC',color:'#78B32B'},
                 {title:'最近报价时间',value:$refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].submitdate || '--',bg:'#F9F2E5',color:'#FF7603'},
               ]"
             ></myCard>

+ 1 - 1
src/HDrpManagement/salerPortrait/modules/detail.vue

@@ -363,7 +363,7 @@
               :list="
               [
                 {title:'报价次数',value:$refs.baojiadan && $refs.baojiadan.total,bg:'#F3F9FC',color:'#3874F6'},
-                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].sumamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
+                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].quotedpriceamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
                 {title:'最近报价时间',value:$refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].submitdate || '--',bg:'#F9F2E5',color:'#FF7603'},
               ]"
             ></myCard>

+ 21 - 21
src/HManagement/marketing2/saler/area/detail/modules/Prortraitdetail.vue

@@ -42,7 +42,7 @@
               <myRadio :value1="param1.content" key1="type" @clickBtn="getPerformance" :btnOptions="[{label:'本年',value:3},{label:'本季',value:2},{label:'本月',value:1}]">
               </myRadio>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {custom:'dingdan',data:performance,title:'订单目标',value2descript:'差额',value:performance.orderCR,value2:unitCompile(performance.amount - performance.target_l),bg:'#F3F9FC',color:'#3874F6'},
@@ -85,7 +85,7 @@
                 <el-option :label="item.value" :value="item.value" v-for="(item,index) in orderTypeList" :key="index"></el-option>
               </el-select>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {title:'订单数量',value:$refs.dingdan && $refs.dingdan.list && $refs.dingdan.list[0] && $refs.dingdan.list[0].allOrderQty,bg:'#F3F9FC',color:'#3874F6'},
@@ -97,7 +97,7 @@
               ]"
             ></myCard>
             <showIsNone title="订单明细">
-            <pageTable 
+            <pageTable
               ref="dingdan"
               :tablecols="tool.tabelCol($route.name).orderTable.tablecols"
               :param="param2"
@@ -136,7 +136,7 @@
               <myRadio :value1="param3.content" key1="type" @clickBtn="refreshTable('param3','xiansuo');param8.content.type=param3.content.type;refreshTable('param8','fllow')" :btnOptions="[{label:'本年',value:3},{label:'本季',value:2},{label:'本月',value:1}]">
               </myRadio>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {title:'线索数',value:$refs.xiansuo && $refs.xiansuo.list[0] && $refs.xiansuo.list[0].orderclueSize,bg:'#F3F9FC',color:'#3874F6'},
@@ -148,7 +148,7 @@
             >
             </myCard>
             <showIsNone title="销售线索明细">
-            <pageTable 
+            <pageTable
               ref="xiansuo"
               :tablecols="tool.tabelCol($route.name).orderclueList.tablecols"
               :param="param3"
@@ -169,7 +169,7 @@
             </showIsNone>
 
             <showIsNone title="线索跟进记录明细">
-            <pageTable 
+            <pageTable
               ref="fllow"
               :tablecols="tool.tabelCol($route.name).clueFollow.tablecols"
               :param="param8"
@@ -204,7 +204,7 @@
             >
             </myCard>
             <showIsNone title="客户明细">
-            <pageTable 
+            <pageTable
               ref="kehu"
               :tablecols="tool.tabelCol($route.name).publicCustomerTable.tablecols"
               :param="param4"
@@ -212,10 +212,10 @@
             >
             <template v-slot:custom="scope">
               <div v-if="scope.data.columnname == 'sys_tag'">
-                <el-tag size="mini" v-for="(item,index) in scope.data.data.sys_tag" :key="index">{{ item }}</el-tag>  
+                <el-tag size="mini" v-for="(item,index) in scope.data.data.sys_tag" :key="index">{{ item }}</el-tag>
               </div>
               <div v-else-if="scope.data.columnname == 'industry'">
-                <el-tag size="mini" v-for="(item,index) in scope.data.data.industry" :key="index">{{ item }}</el-tag>  
+                <el-tag size="mini" v-for="(item,index) in scope.data.data.industry" :key="index">{{ item }}</el-tag>
               </div>
               <div v-else>
                 {{ scope.data.data[scope.data.columnname] }}
@@ -225,7 +225,7 @@
             </showIsNone>
 
             <showIsNone title="客户跟进记录明细">
-            <pageTable 
+            <pageTable
               ref="fllowkehu"
               :tablecols="tool.tabelCol($route.name).customerFollow.tablecols"
               :param="param9"
@@ -249,7 +249,7 @@
               <myRadio :value1="param5.content" key1="type" @clickBtn="refreshTable('param5','project');param10.content.type=param5.content.type;refreshTable('param10','projectfllow')" :btnOptions="[{label:'本年',value:3},{label:'本季',value:2},{label:'本月',value:1}]">
               </myRadio>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {title:'项目数',value:$refs.project && $refs.project.list && $refs.project.list[0] && $refs.project.list[0].projectSize,bg:'#F3F9FC',color:'#3874F6'},
@@ -261,7 +261,7 @@
             ></myCard>
 
             <showIsNone title="项目明细">
-            <pageTable 
+            <pageTable
               ref="project"
               :tablecols="tool.tabelCol($route.name).competeProjectsTable.tablecols"
               :param="param5"
@@ -285,7 +285,7 @@
             </showIsNone>
 
             <showIsNone title="项目跟进记录明细">
-            <pageTable 
+            <pageTable
               ref="projectfllow"
               :tablecols="tool.tabelCol($route.name).projectFollow.tablecols"
               :param="param10"
@@ -310,16 +310,16 @@
               <myRadio :value1="param6.content" key1="isAll" @clickBtn="refreshTable('param6','baojiadan')" :btnOptions="[{label:'全部',value:1},{label:'本年',value:0}]">
               </myRadio>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {title:'报价次数',value:$refs.baojiadan && $refs.baojiadan.total,bg:'#F3F9FC',color:'#3874F6'},
-                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].sumamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
+                {title:'最近报价金额',value:unitCompile($refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].quotedpriceamount || '0'),bg:'#E8F7EC',color:'#78B32B'},
                 {title:'最近报价时间',value:$refs.baojiadan && $refs.baojiadan.list && $refs.baojiadan.list[0] && $refs.baojiadan.list[0].submitdate || '--',bg:'#F9F2E5',color:'#FF7603'},
               ]"
             ></myCard>
             <showIsNone title="报价单明细">
-            <pageTable 
+            <pageTable
               ref="baojiadan"
               :tablecols="tool.tabelCol($route.name).quotedPriceTable.tablecols"
               :param="param6"
@@ -357,7 +357,7 @@
                 <el-option :label="item.remarks" :value="item.value" v-for="(item,index) in contractTypeList" :key="index"></el-option>
               </el-select>
             </div>
-            <myCard 
+            <myCard
               :list="
               [
                 {title:'合同总数',value:$refs.hetong && $refs.hetong.list && $refs.hetong.list[0] && $refs.hetong.list[0].allQty,bg:'#F3F9FC',color:'#3874F6'},
@@ -371,7 +371,7 @@
               ]"
             ></myCard>
             <showIsNone title="合同明细">
-            <pageTable 
+            <pageTable
               ref="hetong"
               :tablecols="tool.tabelCol($route.name).contractTable.tablecols"
               :param="param7"
@@ -390,9 +390,9 @@
           </el-card>
         </div>
 
-  
+
       </div>
-      
+
     </div>
   </el-drawer>
 </template>
@@ -603,7 +603,7 @@ export default {
 }
 
 /deep/.el-drawer {
-  background:#F5F5F5 !important; 
+  background:#F5F5F5 !important;
 }
 /deep/.el-drawer__header{
   display: none !important;

+ 2 - 2
src/SDrpManagement/QuotedPrice/detail/index.vue

@@ -268,7 +268,7 @@ export default {
         },
         {
           label:'总金额(元)',
-          value:this.mainData.sumamount ? this.tool.formatAmount(this.mainData.sumamount,2) : '--'
+          value:this.mainData.quotedpriceamount ? this.tool.formatAmount(this.mainData.quotedpriceamount,2) : '--'
         },
         {
           label:'客户名称',
@@ -343,7 +343,7 @@ export default {
             },
             {
               label:'总金额(元)',
-              value:this.mainData.sumamount ? this.tool.formatAmount(this.mainData.sumamount,2) : '--'
+              value:this.mainData.quotedpriceamount ? this.tool.formatAmount(this.mainData.quotedpriceamount,2) : '--'
             },
             {
               label:'是否特价',

+ 60 - 17
src/SDrpManagement/QuotedPrice/modules/ProjectQuotationAdd.vue

@@ -74,16 +74,16 @@
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group >
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
                 </el-button-group>
-                <el-input v-model="phonenumber" disabled placeholder="请输入手机号" style="width: 100%;margin-top: 10px" @input="telephoneChange('手机')"></el-input>
+                <el-input v-model="phonenumber" disabled placeholder="请输入手机号" style="width: 100%;margin-top: 10px" ></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="24" v-if="!isPhone">
-              <el-form-item label="联系方式:" label-width="100px" >
+              <el-form-item label="联系方式:" label-width="100px" :rules="{ required: true, message: '请输入联系方式', trigger: 'change'}">
                 <el-button-group disabled>
                   <el-radio v-model="isPhone" :label="true" disabled>手机号</el-radio>
                   <el-radio v-model="isPhone" :label="false" disabled>座机电话</el-radio>
@@ -96,8 +96,8 @@
               </el-form-item>
             </el-col>
             <el-col  :span="24" >
-              <el-form-item label="报价金额:" label-width="100px" >
-                <el-input  v-model="form.quotedpriceamount" autocomplete="off" placeholder="项目编号" disabled></el-input>
+              <el-form-item label="报价金额:" label-width="100px" prop="quotedpriceamount">
+                <el-input  v-model="form.quotedpriceamount" autocomplete="off" placeholder="报价金额" @change="quotedpriceamountChange(form.quotedpriceamount)"></el-input>
               </el-form-item>
             </el-col>
             <el-col  :span="24">
@@ -165,11 +165,16 @@
                 <el-input  v-model="form.remarks" autocomplete="off" placeholder="请输入备注信息" type="textarea" autosize></el-input>
               </el-form-item>
             </el-col>
+            <el-col  :span="24">
+              <el-form-item label="附件上传:" label-width="100px" prop="remarks">
+                <upload @uploadGet="loading = true" ref="uploadRef" class="inline-16" :folderid="folderid" :bindData="{ ownertable: 'sa_quotedprice', ownerid: ownerid, usetype: 'default' }" title="上传报价清单至附件" @onSuccess="uploadSuccess"></upload>
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-row>
       </div>
       <div class="fixed__btn__panel">
-        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" @click="onClose" class="normal-btn-width" :disabled="loading">取 消</el-button>
         <el-button  size="small" type="primary" @click="getSubmit" :loading="loading" class="normal-btn-width">确 定</el-button>
       </div>
     </el-drawer>
@@ -183,10 +188,11 @@ import {mapGetters} from "vuex";
 
 import selectTemplate from '@/template/quotation/index.vue'
 import contactsNewTemplate from '@/template/contactsNewTemplate/index1'
+import upload from '@/template/upload/index'
 export default {
   name: "ProjectQuotationAdd",
   props:["drawerShow","typeData"],
-  components:{quoted_price_product,selectSalesman,selectTemplate,contactsNewTemplate},
+  components:{quoted_price_product,selectSalesman,selectTemplate,contactsNewTemplate,upload},
   data(){
     var discountrate = (rule,value,callback) =>{
       if (this.form.discountrate < 0 || this.form.discountrate > 100){
@@ -196,6 +202,8 @@ export default {
       }
     }
     return {
+      ownerid:'',
+      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
       search:'',
       title:'',
       projectShow:false,
@@ -292,7 +300,8 @@ export default {
           "1、报价为含税13%税率, 含运费 ",
           "2、报价有限期 2023-02-02 13:16:47至2023-02-22 13:16:47",
         ],
-        quotedpriceamount:''
+        quotedpriceamount:'',
+        iscreatenewid:0
       },
       rules:{
         projectname:[
@@ -314,22 +323,23 @@ export default {
           { required: true, message: '请填写报价金额', trigger: 'blur'},
           { pattern:/^[0-9]+\.{0,1}[0-9]{0,4}$/,message: '输入不合法,请输入数值',trigger: 'blur'},
         ],
-        /*name:[
+        name:[
           { required: true, message: '请选择联系人', trigger: 'change'},
-        ]*/
+        ]
       },
       itemtype:[],
       isPhone:true,
       areaCode:'',
       telephone:'',
-      phonenumber:''
+      phonenumber:'',
+      loading:false
     }
   },
-  computed:{
+  /*computed:{
     ...mapGetters({
       loading:'loading'
     })
-  },
+  },*/
   methods:{
     onClose(){
       this.drawer = false
@@ -397,14 +407,20 @@ export default {
 
       this.$refs.form.validate(async (valid) => {
         if (!valid) return false
-        this.$store.commit('setLoading',true)
+        /*this.$store.commit('setLoading',true)*/
+        this.loading = true
         this.form.discountrate = this.form.discountrate?(this.form.discountrate / 100).toFixed(4):''
+        this.form.sa_quotedpriceid = this.ownerid
         const res = await this.$api.requested({
           "id": 20221020164803,
           "content": this.form
         })
+        if (res.code == 0){
+          this.loading = false
+        }
         this.tool.showMessage(res,() => {
-          this.$store.commit('setLoading',false)
+          /*this.$store.commit('setLoading',false)*/
+          this.loading = false
           this.drawer = false
           this.$emit('addSuccess')
           this.$store.dispatch('changeDetailDrawer',true)
@@ -581,9 +597,35 @@ export default {
         this.telephone = ''
       }
     },
+    async queryID(){
+      const res = await this.$api.requested({
+        "id": 202400904102104,
+        "content": {}
+      })
+      this.ownerid = res.data
+    },
+    async uploadSuccess(){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sa_quotedprice',
+          "ownerid": this.ownerid,
+          "usetype":""
+        }
+      })
+      this.$refs.uploadRef.listFile = res.data.map(item=>{
+        return {
+          "name":item.document,
+          "url":item.url
+        }
 
-
-
+      })
+      this.loading = false
+    },
+    quotedpriceamountChange(data){
+      this.form.quotedpriceamount = Math.round(data * 100)/100
+    }
   },
   mounted() {
     if (this.drawerShow){this.drawer = true}
@@ -599,6 +641,7 @@ export default {
     this.form.billdate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
     this.form.sa_quotedpriceid = 0
     this.queryItemType()
+    this.queryID()
   },
   created() {
 

+ 138 - 0
src/template/upload/index.vue

@@ -0,0 +1,138 @@
+<template>
+  <el-upload
+      class="upload-demo"
+      action="#"
+      :on-preview="handlePreview"
+      :on-progress="handleProgress"
+      :on-remove="handleRemove"
+      :before-remove="beforeRemove"
+      :on-change="handleChange"
+      multiple
+      :auto-upload="false"
+      :file-list="listFile">
+    <el-button icon="el-icon-upload2" type="primary" size="mini"  class="inline-16">上传文件</el-button>
+    <span>{{title}}</span>
+  </el-upload>
+</template>
+
+<script>
+export default {
+  name: "index",
+  props:["bindData","folderid",'title'],
+  data() {
+    return {
+      listFile: [],
+      params: {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "getFileName",
+        "content": {
+          "filename": '',
+          "filetype": '',
+          "parentid": ""//归属文件夹ID
+        }
+      },
+      count:0,
+      file: {},
+      filelist: [],
+    };
+  },
+  methods: {
+    handleRemove(file, fileList) {
+    },
+    handleProgress(file,fileList){
+
+    },
+    handlePreview(file) {
+      /*this.fileList = fileList*/
+    },
+    beforeRemove(file, fileList) {
+      return this.$confirm(`确定移除 ${ file.name }?`);
+    },
+    handleChange (file, filelist) {
+      this.$emit('uploadGet')
+      this.count = 0
+      this.filelist = []
+      this.filelist = filelist
+      var index = file.raw.name.lastIndexOf(".");
+      var ext = file.name.substr(index + 1);
+      this.params.content.filename = file.raw.name
+      this.params.content.filetype = ext
+      this.getUploadUrl(file, ext)
+    },
+
+    // 获取华为云上传地址
+    async getUploadUrl (file, ext) {
+      this.params.content.parentid = this.folderid
+      const res = await this.$api.requested(this.params)
+      let url = res.data.uploadurl
+      let obsfilename = res.data.serialfilename
+
+      this.upoladFileToServer(url, file, ext, obsfilename)
+    },
+
+    // 上传到华为云
+    async upoladFileToServer (url, file, ext, obsfilename) {
+      console.log(file)
+      let THIS = this
+      let config = {
+        headers: ext === 'pdf' ? { 'Content-Type': 'application/pdf' } : ext === 'svg'?{ 'Content-Type': 'image/svg+xml' } : { 'Content-Type': 'application/octet-stream' },
+        onUploadProgress: function (progressEvent) {
+          let percent = progressEvent.loaded / progressEvent.total * 100
+          THIS.filelist.forEach(e => {
+            if (e.uid === file.uid) {
+              THIS.$set(e, 'type', ext.toUpperCase());
+              THIS.$set(e, 'progress', percent);
+            }
+          })
+        },
+      }
+      const res = await this.$upload.hw_upload(url, file.raw, config)
+      this.createFileRecord(obsfilename)
+    },
+
+    // 上传成功以后生成附件记录
+    async createFileRecord (obsfilename,attinfos) {
+      let obj = {
+        "serialfilename": obsfilename
+      }
+      obj = Object.assign({},obj,this.bindData)
+      let param = {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "uploadSuccess",
+        "content":obj
+      }
+      const res = await this.$api.requested(param)
+      this.count++
+      if (this.count == this.filelist.length) {
+        this.$emit('onSuccess',res)
+        this.count = 0
+        console.log('触发');
+      }
+      // if (res.code ===  1) {
+      //   this.$emit('onSuccess',res)
+      // }
+    },
+    async uploadSuccess(){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sa_quotedprice',
+          "ownerid": this.ownerid,
+          "usetype":""
+        }
+      })
+      this.$refs.uploadRef.listFile = res.data.map(item=>{
+        return {
+          "name":item.document,
+          "url":item.url
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>