Browse Source

项目报价新增编辑更新

qymljy 2 years ago
parent
commit
9397e4a45c

+ 286 - 33
src/Form/QuotedPrice/edit.vue

@@ -2,9 +2,9 @@
   <div>
   <div>
     <el-button size="mini" :disabled="data.status !== '新建'"  :type="btnType?btnType:'text'"  @click="onShow" >编 辑</el-button>
     <el-button size="mini" :disabled="data.status !== '新建'"  :type="btnType?btnType:'text'"  @click="onShow" >编 辑</el-button>
     <el-drawer
     <el-drawer
-        title="创建报价单"
+        title="编辑报价单"
         :visible.sync="drawer"
         :visible.sync="drawer"
-        size="50%"
+        size="70%"
         direction="rtl"
         direction="rtl"
         append-to-body
         append-to-body
         @close="onClose">
         @close="onClose">
@@ -23,7 +23,54 @@
             </el-col>
             </el-col>
             <el-col :span="11" v-if="isQuotedPrice">
             <el-col :span="11" v-if="isQuotedPrice">
               <el-form-item label="项目名称:" label-width="90px" prop="projectname">
               <el-form-item label="项目名称:" label-width="90px" prop="projectname">
-                <el-input  v-model="form.projectname" autocomplete="off" placeholder="请选择项目" @focus="project" @projectList="projectList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="projectList">
+                  <el-table :data="project.projectData">
+                    <el-table-column
+                        label="项目编号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.projectnum?scope.row.projectnum:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="项目名称"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.projectname?scope.row.projectname:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="projectData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeProject"
+                        @current-change="handleCurrentChangeProject"
+                        :current-page="project.currentPage"
+                        :total="project.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.projectname" autocomplete="off" placeholder="请选择项目"  @input="selectProject"></el-input>
+                </el-popover>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11" v-if="isQuotedPrice">
             <el-col :offset="2" :span="11" v-if="isQuotedPrice">
@@ -33,7 +80,61 @@
             </el-col>
             </el-col>
             <el-col :span="11">
             <el-col :span="11">
               <el-form-item label="客户:" label-width="90px" prop="enterprisename">
               <el-form-item label="客户:" label-width="90px" prop="enterprisename">
-                <el-input  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @focus="customer" @customerList="customerList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="customerList">
+                  <el-table :data="customer.customerData">
+                    <el-table-column
+                        label="客户编号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.sa_customersid?scope.row.sa_customersid:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="客户"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.enterprisename?scope.row.enterprisename:'--'}}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="省市县"
+                        width="230">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.province?scope.row.province + '-' + scope.row.city + '-' + scope.row.county:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="customerData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeCustomer"
+                        @current-change="handleCurrentChangeCustomer"
+                        :current-page="customer.currentPage"
+                        :total="customer.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @input="selectCustomer"></el-input>
+                </el-popover>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11">
             <el-col :offset="2" :span="11">
@@ -64,7 +165,61 @@
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11">
             <el-col :offset="2" :span="11">
               <el-form-item label="联系人:" label-width="90px" prop="contactsname">
               <el-form-item label="联系人:" label-width="90px" prop="contactsname">
-                <el-input  v-model="form.contactsname" autocomplete="off" placeholder="联系人" @focus="contacts" @contactsList="contactsList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="contactsList">
+                  <el-table :data="contacts.contactsData">
+                    <el-table-column
+                        label="姓名"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.name?scope.row.name:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="手机号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.phonenumber?scope.row.phonenumber:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="邮箱"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.email?scope.row.email:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="contactsData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeContacts"
+                        @current-change="handleCurrentChangeContacts"
+                        :current-page="contacts.currentPage"
+                        :total="contacts.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.contactsname" autocomplete="off" placeholder="请选择联系人"  @input="selectContacts"></el-input>
+                </el-popover>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="11">
             <el-col :span="11">
@@ -86,16 +241,10 @@
         <el-button size="small" type="warning" @click="getSubmit" class="normal-btn-width">保 存</el-button>
         <el-button size="small" type="warning" @click="getSubmit" class="normal-btn-width">保 存</el-button>
       </div>
       </div>
     </el-drawer>
     </el-drawer>
-    <project_table v-if="projectDrawer" :projectDrawer="projectDrawer" @projectData="projectData" @projectList="projectList"></project_table>
-    <customer_table v-if="customerDrawer" :customerDrawer="customerDrawer" :id="form.sa_projectid" :isQuotedPrice="isQuotedPrice" @customerData="customerData"  @customerList="customerList"></customer_table>
-    <contacts_table v-if="contactsDrawer" :contactsDrawer="contactsDrawer" :id="form.sys_enterpriseid" @contactsData="contactsData" @contactsList="contactsList"></contacts_table>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import project_table from "@/SDrpManagement/QuotedPrice/components/projectTable";
-import customer_table from "@/SDrpManagement/QuotedPrice/components/customerTable";
-import contacts_table from "@/SDrpManagement/QuotedPrice/components/contactsTable";
 import quoted_price_product from "@/SDrpManagement/QuotedPrice/components/quotedPriceProduct";
 import quoted_price_product from "@/SDrpManagement/QuotedPrice/components/quotedPriceProduct";
 
 
 export default {
 export default {
@@ -103,15 +252,67 @@ export default {
   props:['data','btnType'],
   props:['data','btnType'],
   data(){
   data(){
     return {
     return {
+      projectParam:{
+        "id": 20221020143502,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 5,
+          "type":0, //  1:我负责的;2:我参与的;3:我下属负责的;4:我下属参与的
+          "where": {
+            "condition": "",
+            "startdate": "",
+            "enddate": "",
+            "status":"",//跟进中、已成交、已失败
+            "projecttype":"",
+            "stagename":"",
+            "tag":""
+          }
+        },
+      },
+      project:{
+        projectData:[],
+        total:0,
+        currentPage:0,
+      },
+      customerParam:{
+        "id": 20220920083901,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 5,
+          "where": {
+            "condition": "",
+            "type":4,
+            "sa_projectid":""
+          }
+        }
+      },
+      customer:{
+        customerData:[],
+        total:0,
+        currentPage:0,
+      },
+      contactsParam:{
+        "id": "20221022165503",
+        "version": 1,
+        "content": {
+          "sys_enterpriseid":"",
+          "where": {
+            "condition": "",
+            "workaddress": 0//0表示人,1表示地址
+          }
+        }
+      },
+      contacts:{
+        contactsData:[],
+        total:0,
+        currentPage:0,
+      },
       pickerOptions: {
       pickerOptions: {
         disabledDate(time) {
         disabledDate(time) {
           return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
           return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
         },
         },
       },
       },
       drawer:false,
       drawer:false,
-      projectDrawer:false,
-      customerDrawer:false,
-      contactsDrawer:false,
       isQuotedPrice:false,
       isQuotedPrice:false,
       date:[],
       date:[],
       form:{
       form:{
@@ -147,7 +348,7 @@ export default {
       },
       },
     }
     }
   },
   },
-  components:{project_table,customer_table,contacts_table,quoted_price_product},
+  components:{quoted_price_product},
   methods:{
   methods:{
     onShow(){
     onShow(){
       this.drawer = true
       this.drawer = true
@@ -155,7 +356,7 @@ export default {
       this.form = this.data
       this.form = this.data
       this.date[0] = this.form.begdate
       this.date[0] = this.form.begdate
       this.date[1] = this.form.enddate
       this.date[1] = this.form.enddate
-      if (this.form.typeData === '项目报价'){
+      if (this.form.quotedpricetype === '项目报价'){
         this.isQuotedPrice = true
         this.isQuotedPrice = true
       }else {
       }else {
         this.isQuotedPrice = false
         this.isQuotedPrice = false
@@ -213,36 +414,59 @@ export default {
         })
         })
       })
       })
     },
     },
-    project(){
-      this.projectDrawer = true
+    async projectList(){
+      const res = await this.$api.requested(this.projectParam)
+      console.log(res)
+      this.project.projectData = res.data
+      this.project.total = res.total
+      this.project.currentPage = res.pageNumber
     },
     },
-    customer(){
-      console.log("客户弹出")
-      console.log(this.customerDrawer)
-      this.customerDrawer = true
+    async selectProject(){
+      console.log(this.form.projectname)
+      this.projectParam.content.where.condition = this.form.projectname
+      this.projectList()
     },
     },
-    contacts(){
-      this.contactsDrawer = true
+    async customerList(){
+      if (this.form.quotedpricetype === '普通报价'){
+        this.customerParam.content.where.sa_projectid = 0
+        this.customerParam.content.where.type = 2
+      }else {
+        this.customerParam.content.where.type = 4
+        this.customerParam.content.where.sa_projectid = this.form.sa_projectid
+      }
+      const res = await this.$api.requested(this.customerParam)
+      this.customer.customerData = res.data
+      this.customer.total = res.total
+      this.customer.currentPage = res.pageNumber
     },
     },
-    customerList(){
-      this.customerDrawer = false
+    selectCustomer(){
+      this.customerParam.content.where.condition = this.form.enterprisename
+      this.customerList()
     },
     },
-    projectList(){
-      this.projectDrawer = false
+    async contactsList(){
+      this.contactsParam.content.sys_enterpriseid = this.form.sys_enterpriseid
+      const res = await this.$api.requested(this.contactsParam)
+      this.contacts.contactsData = res.data
+      this.contacts.total = res.total
+      this.contacts.currentPage = res.pageNumber
     },
     },
-    contactsList(){
-      this.contactsDrawer = false
+    selectContacts(){
+      this.contactsParam.content.where.condition = this.form.name
+      this.contactsList()
     },
     },
     /*项目选择信息*/
     /*项目选择信息*/
     projectData(val){
     projectData(val){
-      this.projectDrawer = false
       this.form.sa_projectid = val.sa_projectid
       this.form.sa_projectid = val.sa_projectid
       this.form.projectname = val.projectname
       this.form.projectname = val.projectname
       this.form.projectnum = val.projectnum
       this.form.projectnum = val.projectnum
+      this.form.sys_enterpriseid = ''
+      this.form.enterprisename = ''
+      this.form.contactsid = ''
+      this.form.contactsname = ''
+      this.form.contactsphonenumber = ''
     },
     },
     /*客户选择信息*/
     /*客户选择信息*/
     customerData(val){
     customerData(val){
-      this.customerDrawer = false
       this.form.sys_enterpriseid = val.sys_enterpriseid
       this.form.sys_enterpriseid = val.sys_enterpriseid
       this.form.enterprisename = val.enterprisename
       this.form.enterprisename = val.enterprisename
       this.form.contactsid = ''
       this.form.contactsid = ''
@@ -251,11 +475,40 @@ export default {
     },
     },
     /*联系人选择信息*/
     /*联系人选择信息*/
     contactsData(val){
     contactsData(val){
-      this.contactsDrawer = false
       this.form.contactsid = val.contactsid
       this.form.contactsid = val.contactsid
       this.form.contactsname = val.name
       this.form.contactsname = val.name
       this.form.contactsphonenumber = val.phonenumber
       this.form.contactsphonenumber = val.phonenumber
     },
     },
+    handleSizeChangeProject(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.projectList()
+    },
+    handleCurrentChangeProject(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.projectList()
+    },
+    handleSizeChangeCustomer(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.customerList()
+    },
+    handleCurrentChangeCustomer(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.customerList()
+    },
+    handleSizeChangeContacts(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.contactsList()
+    },
+    handleCurrentChangeContacts(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.contactsList()
+    },
   },
   },
   mounted() {
   mounted() {
     console.log(this.data,"报价单")
     console.log(this.data,"报价单")

+ 288 - 33
src/SDrpManagement/QuotedPrice/modules/ProjectQuotationAdd.vue

@@ -22,7 +22,55 @@
             </el-col>
             </el-col>
             <el-col :span="11" v-if="isQuotedPrice">
             <el-col :span="11" v-if="isQuotedPrice">
               <el-form-item label="项目名称:" label-width="90px" prop="projectname">
               <el-form-item label="项目名称:" label-width="90px" prop="projectname">
-                <el-input  v-model="form.projectname" autocomplete="off" placeholder="请选择项目" @focus="project" @projectList="projectList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="projectList">
+                  <el-table :data="project.projectData">
+                    <el-table-column
+                        label="项目编号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.projectnum?scope.row.projectnum:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="项目名称"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.projectname?scope.row.projectname:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="projectData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeProject"
+                        @current-change="handleCurrentChangeProject"
+                        :current-page="project.currentPage"
+                        :total="project.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.projectname" autocomplete="off" placeholder="请选择项目"  @input="selectProject"></el-input>
+                </el-popover>
+
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11" v-if="isQuotedPrice">
             <el-col :offset="2" :span="11" v-if="isQuotedPrice">
@@ -32,7 +80,61 @@
             </el-col>
             </el-col>
             <el-col :span="11">
             <el-col :span="11">
               <el-form-item label="客户:" label-width="90px" prop="enterprisename">
               <el-form-item label="客户:" label-width="90px" prop="enterprisename">
-                <el-input  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @focus="customer" @customerList="customerList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="customerList">
+                  <el-table :data="customer.customerData">
+                    <el-table-column
+                        label="客户编号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.sa_customersid?scope.row.sa_customersid:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="客户"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.enterprisename?scope.row.enterprisename:'--'}}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="省市县"
+                        width="230">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.province?scope.row.province + '-' + scope.row.city + '-' + scope.row.county:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="customerData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeCustomer"
+                        @current-change="handleCurrentChangeCustomer"
+                        :current-page="customer.currentPage"
+                        :total="customer.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @input="selectCustomer"></el-input>
+                </el-popover>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11">
             <el-col :offset="2" :span="11">
@@ -63,7 +165,61 @@
             </el-col>
             </el-col>
             <el-col :offset="2" :span="11">
             <el-col :offset="2" :span="11">
               <el-form-item label="联系人:" label-width="90px" prop="name">
               <el-form-item label="联系人:" label-width="90px" prop="name">
-                <el-input  v-model="form.name" autocomplete="off" placeholder="联系人" @focus="contacts" @contactsList="contactsList"></el-input>
+                <el-popover
+                    placement="bottom"
+                    width="580"
+                    trigger="hover"
+                    @show="contactsList">
+                  <el-table :data="contacts.contactsData">
+                    <el-table-column
+                        label="姓名"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.name?scope.row.name:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="手机号"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.phonenumber?scope.row.phonenumber:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="邮箱"
+                        width="180">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.email?scope.row.email:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        label="地址"
+                        width="300">
+                      <template slot-scope="scope">
+                        <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
+                      </template>
+                    </el-table-column>
+                    <el-table-column
+                        fixed="right"
+                        label="操作"
+                        width="60">
+                      <template slot-scope="scope">
+                        <el-button type="text" @click="contactsData(scope.row)">选择</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                  <div class="container normal-panel" style="text-align:right">
+                    <el-pagination
+                        background
+                        small
+                        @size-change="handleSizeChangeContacts"
+                        @current-change="handleCurrentChangeContacts"
+                        :current-page="contacts.currentPage"
+                        :total="contacts.total">
+                    </el-pagination>
+                  </div>
+                  <el-input slot="reference"  v-model="form.name" autocomplete="off" placeholder="请选择联系人"  @input="selectContacts"></el-input>
+                </el-popover>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="11">
             <el-col :span="11">
@@ -85,32 +241,78 @@
         <el-button :disabled="form.sa_quotedpriceid === 0" size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
         <el-button :disabled="form.sa_quotedpriceid === 0" size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
       </div>
       </div>
     </el-drawer>
     </el-drawer>
-    <project_table v-if="projectDrawer" :projectDrawer="projectDrawer" @projectData="projectData" @projectList="projectList"></project_table>
-    <customer_table v-if="customerDrawer" :customerDrawer="customerDrawer" :id="form.sa_projectid" :isQuotedPrice="isQuotedPrice" @customerData="customerData"  @customerList="customerList"></customer_table>
-    <contacts_table v-if="contactsDrawer" :contactsDrawer="contactsDrawer" :id="form.sys_enterpriseid" @contactsData="contactsData" @contactsList="contactsList"></contacts_table>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import project_table from '../components/projectTable'
-import customer_table from '../components/customerTable'
-import contacts_table from '../components/contactsTable'
 import quoted_price_product from '../components/quotedPriceProduct'
 import quoted_price_product from '../components/quotedPriceProduct'
 export default {
 export default {
   name: "ProjectQuotationAdd",
   name: "ProjectQuotationAdd",
   props:["drawerShow","typeData"],
   props:["drawerShow","typeData"],
-  components:{project_table,customer_table,contacts_table,quoted_price_product},
+  components:{quoted_price_product},
   data(){
   data(){
     return {
     return {
+      projectParam:{
+        "id": 20221020143502,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 5,
+          "type":0, //  1:我负责的;2:我参与的;3:我下属负责的;4:我下属参与的
+          "where": {
+            "condition": "",
+            "startdate": "",
+            "enddate": "",
+            "status":"",//跟进中、已成交、已失败
+            "projecttype":"",
+            "stagename":"",
+            "tag":""
+          }
+        },
+      },
+      project:{
+        projectData:[],
+        total:0,
+        currentPage:0,
+      },
+      customerParam:{
+        "id": 20220920083901,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 5,
+          "where": {
+            "condition": "",
+            "type":4,
+            "sa_projectid":""
+          }
+        }
+      },
+      customer:{
+        customerData:[],
+        total:0,
+        currentPage:0,
+      },
+      contactsParam:{
+        "id": "20221022165503",
+        "version": 1,
+        "content": {
+          "sys_enterpriseid":"",
+          "where": {
+            "condition": "",
+            "workaddress": 0//0表示人,1表示地址
+          }
+        }
+      },
+      contacts:{
+        contactsData:[],
+        total:0,
+        currentPage:0,
+      },
       pickerOptions: {
       pickerOptions: {
         disabledDate(time) {
         disabledDate(time) {
           return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
           return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
         },
         },
       },
       },
       drawer:false,
       drawer:false,
-      projectDrawer:false,
-      customerDrawer:false,
-      contactsDrawer:false,
       isQuotedPrice:false,
       isQuotedPrice:false,
       date:[],
       date:[],
       form:{
       form:{
@@ -196,44 +398,99 @@ export default {
       })
       })
 
 
     },
     },
-    project(){
-      this.projectDrawer = true
+    async projectList(){
+      const res = await this.$api.requested(this.projectParam)
+      console.log(res)
+      this.project.projectData = res.data
+      this.project.total = res.total
+      this.project.currentPage = res.pageNumber
     },
     },
-    customer(){
-      this.customerDrawer = true
+    async selectProject(){
+      console.log(this.form.projectname)
+      this.projectParam.content.where.condition = this.form.projectname
+      this.projectList()
     },
     },
-    contacts(){
-      this.contactsDrawer = true
+    async customerList(){
+      if (this.form.sa_projectid === '0' && this.form.type === '普通报价'){
+        this.customerParam.content.where.type = 2
+      }else {
+        this.customerParam.content.where.type = 4
+        this.customerParam.content.where.sa_projectid = this.form.sa_projectid
+      }
+      const res = await this.$api.requested(this.customerParam)
+      this.customer.customerData = res.data
+      this.customer.total = res.total
+      this.customer.currentPage = res.pageNumber
     },
     },
-    customerList(){
-      this.customerDrawer = false
+    selectCustomer(){
+      this.customerParam.content.where.condition = this.form.enterprisename
+      this.customerList()
     },
     },
-    projectList(){
-      this.projectDrawer = false
+    async contactsList(){
+      this.contactsParam.content.sys_enterpriseid = this.form.sys_enterpriseid
+      const res = await this.$api.requested(this.contactsParam)
+      this.contacts.contactsData = res.data
+      this.contacts.total = res.total
+      this.contacts.currentPage = res.pageNumber
     },
     },
-    contactsList(){
-      this.contactsDrawer = false
+    selectContacts(){
+      this.contactsParam.content.where.condition = this.form.name
+      this.contactsList()
     },
     },
-    /*项目选择信息*/
     projectData(val){
     projectData(val){
-      this.projectDrawer = false
       this.form.sa_projectid = val.sa_projectid
       this.form.sa_projectid = val.sa_projectid
       this.form.projectname = val.projectname
       this.form.projectname = val.projectname
       this.form.projectnum = val.projectnum
       this.form.projectnum = val.projectnum
+      this.form.sys_enterpriseid = ''
+      this.form.enterprisename = ''
+      this.form.contactsid = ''
+      this.form.name = ''
+      this.form.phonenumber = ''
     },
     },
-    /*客户选择信息*/
+
     customerData(val){
     customerData(val){
-      this.contactsDrawer = false
       this.form.sys_enterpriseid = val.sys_enterpriseid
       this.form.sys_enterpriseid = val.sys_enterpriseid
       this.form.enterprisename = val.enterprisename
       this.form.enterprisename = val.enterprisename
+      this.form.contactsid = ''
+      this.form.name = ''
+      this.form.phonenumber = ''
     },
     },
     /*联系人选择信息*/
     /*联系人选择信息*/
     contactsData(val){
     contactsData(val){
-      this.contactsDrawer = false
       this.form.contactsid = val.contactsid
       this.form.contactsid = val.contactsid
       this.form.name = val.name
       this.form.name = val.name
       this.form.phonenumber = val.phonenumber
       this.form.phonenumber = val.phonenumber
     },
     },
+    handleSizeChangeProject(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.projectList()
+    },
+    handleCurrentChangeProject(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.projectList()
+    },
+    handleSizeChangeCustomer(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.customerList()
+    },
+    handleCurrentChangeCustomer(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.customerList()
+    },
+    handleSizeChangeContacts(val) {
+      // console.log(`每页 ${val} 条`);
+      this.projectParam.content.pageSize = val
+      this.contactsList()
+    },
+    handleCurrentChangeContacts(val) {
+      // console.log(`当前页: ${val}`);
+      this.projectParam.content.pageNumber = val
+      this.contactsList()
+    },
     /*isSpecial(val){
     /*isSpecial(val){
       console.log("获取")
       console.log("获取")
       console.log(val,'是否特价')
       console.log(val,'是否特价')
@@ -256,9 +513,7 @@ export default {
     console.log(this.form)
     console.log(this.form)
   },
   },
   created() {
   created() {
-    /*if (this.drawerShow){
-      this.drawer = true
-    }*/
+
   }
   }
 }
 }
 </script>
 </script>

+ 272 - 0
src/SDrpManagement/QuotedPrice/modules/ProjectQuotationAddCopy.vue

@@ -0,0 +1,272 @@
+<template>
+  <div>
+    <el-drawer
+        title="创建项目报价"
+        :visible.sync="drawer"
+        size="70%"
+        direction="rtl"
+        append-to-body
+        @close="onClose">
+      <div class="drawer__panel" style="margin-bottom: 0px">
+        <el-row style="margin-top: 10px">
+          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="right">
+            <el-col :span="11">
+              <el-form-item label="报价类型:" label-width="90px" >
+                <el-input v-model="form.type" autocomplete="off" placeholder="报价类型" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :offset="2" :span="11">
+              <el-form-item label="是否特价:" label-width="90px" >
+                <el-input  v-model="form.specialOffer" autocomplete="off" placeholder="是否特价" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="11" v-if="isQuotedPrice">
+              <el-form-item label="项目名称:" label-width="90px" prop="projectname">
+                <el-input  v-model="form.projectname" autocomplete="off" placeholder="请选择项目" @focus="project" @projectList="projectList"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :offset="2" :span="11" v-if="isQuotedPrice">
+              <el-form-item label="项目编号:" label-width="90px" >
+                <el-input  v-model="form.projectnum" autocomplete="off" placeholder="项目编号" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="11">
+              <el-form-item label="客户:" label-width="90px" prop="enterprisename">
+                <el-input  v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户"  @focus="customer" @customerList="customerList"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :offset="2" :span="11">
+              <el-form-item label="报价日期:" label-width="90px">
+                <el-date-picker
+                    v-model="form.billdate"
+                    style="width: 100%"
+                    type="date"
+                    value-format="yyyy-MM-dd"
+                    placeholder="选择日期"
+                    :picker-options="pickerOptions">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="11">
+              <el-form-item label="有效期:" label-width="90px" >
+                <el-date-picker
+                    v-model="date"
+                    style="width: 100%"
+                    type="daterange"
+                    value-format="yyyy-MM-dd"
+                    range-separator="至"
+                    start-placeholder="开始日期"
+                    end-placeholder="结束日期"
+                    :picker-options="pickerOptions">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :offset="2" :span="11">
+              <el-form-item label="联系人:" label-width="90px" prop="name">
+                <el-input  v-model="form.name" autocomplete="off" placeholder="联系人" @focus="contacts" @contactsList="contactsList"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="11">
+              <el-form-item label="手机号:" label-width="90px" >
+                <el-input  v-model="form.phonenumber" autocomplete="off" placeholder="手机号" disabled></el-input>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+      </div>
+      <div >
+        <el-divider></el-divider>
+      </div>
+      <div style="margin:30px 20px 20px 20px">
+        <quoted_price_product :id="form.sa_projectid" ref="quoterPrice" @checkForm="onSubmit" ></quoted_price_product>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
+        <el-button :disabled="form.sa_quotedpriceid === 0" size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-drawer>
+    <project_table v-if="projectDrawer" :projectDrawer="projectDrawer" @projectData="projectData" @projectList="projectList"></project_table>
+    <customer_table v-if="customerDrawer" :customerDrawer="customerDrawer" :id="form.sa_projectid" :isQuotedPrice="isQuotedPrice" @customerData="customerData"  @customerList="customerList"></customer_table>
+    <contacts_table v-if="contactsDrawer" :contactsDrawer="contactsDrawer" :id="form.sys_enterpriseid" @contactsData="contactsData" @contactsList="contactsList"></contacts_table>
+  </div>
+</template>
+
+<script>
+import project_table from '../components/projectTable'
+import customer_table from '../components/customerTable'
+import contacts_table from '../components/contactsTable'
+import quoted_price_product from '../components/quotedPriceProduct'
+export default {
+  name: "ProjectQuotationAdd",
+  props:["drawerShow","typeData"],
+  components:{project_table,customer_table,contacts_table,quoted_price_product},
+  data(){
+    return {
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
+        },
+      },
+      drawer:false,
+      projectDrawer:false,
+      customerDrawer:false,
+      contactsDrawer:false,
+      isQuotedPrice:false,
+      date:[],
+      form:{
+        type:'',
+        projectnum:'',
+        enterprisename:'',
+        name:'',
+        phonenumber:'',
+        specialOffer:'否',
+        sa_quotedpriceid:0,     //sat_notice_classid<=0时 为新增
+        sys_enterpriseid: "",
+        contactsid:8,
+        sa_projectid: "0",
+        discountrate: 0,
+        remarks: "",
+        invaliddate: "",
+        projectname: "",
+        address: "",
+        billdate:"",
+        enddate:'',
+        begdate:''
+      },
+      rules:{
+        projectname:[
+          { required: true, message: '请选择项目', trigger: 'change'},
+        ],
+        enterprisename:[
+          { required: true, message: '请选择客户', trigger: 'change'},
+        ],
+        name:[
+          { required: true, message: '请选择联系人', trigger: 'change'},
+        ]
+      },
+    }
+  },
+  methods:{
+    onClose(){
+      this.drawer = false
+      this.$emit('addSuccess')
+    },
+    onSubmit(){
+      console.log(this.date)
+      if (this.date.length === 0){
+        this.form.begdate = ''
+        this.form.enddate = ''
+      }else {
+        this.form.begdate = this.date[0]
+        this.form.enddate = this.date[1]
+      }
+      console.log(this.form,"表单")
+      this.$refs.form.validate(async (valid) => {
+        if (!valid) return false
+        const res = await this.$api.requested({
+          "id": 20221020164803,
+          "version":1,
+          "content": this.form
+        })
+        this.$refs.quoterPrice.quoterPrice(res.data.sa_quotedpriceid,this.form.type)
+        this.form.sa_quotedpriceid = res.data.sa_quotedpriceid
+      })
+    },
+    getSubmit(){
+      this.drawer = false
+      console.log(this.data)
+      if (this.date === '' && this.date === 'undefined'){
+        this.form.begdate = ''
+        this.form.enddate = ''
+      }else {
+        this.form.begdate = this.date[0]
+        this.form.enddate = this.date[1]
+      }
+      console.log(this.form,"表单")
+      this.$refs.form.validate(async (valid) => {
+        if (!valid) return false
+        const res = await this.$api.requested({
+          "id": 20221020164803,
+          "version":1,
+          "content": this.form
+        })
+        this.tool.showMessage(res,() => {
+          this.$emit('addSuccess')
+        })
+      })
+
+    },
+    project(){
+      this.projectDrawer = true
+    },
+    customer(){
+      this.customerDrawer = true
+    },
+    contacts(){
+      this.contactsDrawer = true
+    },
+    customerList(){
+      this.customerDrawer = false
+    },
+    projectList(){
+      this.projectDrawer = false
+    },
+    contactsList(){
+      this.contactsDrawer = false
+    },
+    /*项目选择信息*/
+    projectData(val){
+      this.projectDrawer = false
+      this.form.sa_projectid = val.sa_projectid
+      this.form.projectname = val.projectname
+      this.form.projectnum = val.projectnum
+    },
+    /*客户选择信息*/
+    customerData(val){
+      this.contactsDrawer = false
+      this.form.sys_enterpriseid = val.sys_enterpriseid
+      this.form.enterprisename = val.enterprisename
+    },
+    /*联系人选择信息*/
+    contactsData(val){
+      this.contactsDrawer = false
+      this.form.contactsid = val.contactsid
+      this.form.name = val.name
+      this.form.phonenumber = val.phonenumber
+    },
+    /*isSpecial(val){
+      console.log("获取")
+      console.log(val,'是否特价')
+    }*/
+
+
+  },
+  mounted() {
+    if (this.drawerShow){this.drawer = true}
+    console.log(this.typeData)
+    this.form.type = this.typeData
+    if (this.typeData === '项目报价'){
+      this.isQuotedPrice = true
+    }else {
+      this.isQuotedPrice = false
+    }
+    const date = new Date()
+    console.log(date)
+    this.form.billdate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
+    console.log(this.form)
+  },
+  created() {
+    /*if (this.drawerShow){
+      this.drawer = true
+    }*/
+  }
+}
+</script>
+
+<style scoped>
+>>> .el-divider--horizontal {
+  height: 1px;
+  width: 100%;
+  margin: 0px;
+}
+</style>