Browse Source

报价

java8
qiezi 1 year ago
parent
commit
e0e3781854
  1. 7
      src/api/customer/customer.js
  2. 4
      src/api/project/project.js
  3. 5
      src/api/project/projectPart.js
  4. 11
      src/assets/scss/_base.scss
  5. 50
      src/components/selector/select/BuSelect.vue
  6. 172
      src/components/selector/table/customerTable.vue
  7. 180
      src/components/selector/table/projectPartTable.vue
  8. 209
      src/components/selector/table/projectTable.vue
  9. 159
      src/views/modules/quote/detail/quoteDetail.vue
  10. 272
      src/views/modules/quote/index.vue
  11. 2
      src/views/modules/quote/primary/quoteSearch.vue
  12. 19
      src/views/modules/quote/primary/quoteTable.vue

7
src/api/customer/customer.js

@ -0,0 +1,7 @@
import {createAPI} from "../../utils/httpRequest";
export const queryCustomerList = (data) => createAPI(`/customer`,'post',data)
export const queryCustomerListByPage = (data) => createAPI(`/customer/${data.no}/${data.size}`,'post',data)

4
src/api/project/project.js

@ -0,0 +1,4 @@
import {createAPI} from "../../utils/httpRequest";
export const queryProjectList = (data) => createAPI("/project", "post", data);
export const queryProjectListByPage = (data) => createAPI(`/project/${data.no}/${data.size}`, "post", data);

5
src/api/project/projectPart.js

@ -0,0 +1,5 @@
import {createAPI} from "../../utils/httpRequest";
export const queryProjectPart = (data) => createAPI(`/project/part`,'post',data)
export const queryProjectPartByPage = (data) => createAPI(`/project/part/${data.no}/${data.size}`,'put',data)

11
src/assets/scss/_base.scss

@ -364,3 +364,14 @@ img {
margin-right: 5px;
}
.el-input-number--medium{
line-height: 1.5px;
width: 100%;
}
.el-input-number .el-input__inner{
text-align: right;
padding-right: 5px !important;
padding-left: 0 !important;
}

50
src/components/selector/select/BuSelect.vue

@ -0,0 +1,50 @@
<script>
import {getSiteAndBuByUserName} from "../../../api/eam/eam";
export default {
name: "buSelect",
data(){
return{
userBuList:[],
}
},
methods:{
handleQueryBu(){
let params = {
username: this.$store.state.user.name,
}
getSiteAndBuByUserName(params).then(({data}) => {
if (data && data.code === 0) {
this.userBuList = data.rows
}else {
this.$message.warning(data.message)
}
}).catch((error)=>{
this.$message.error(error)
})
},
},
created() {
this.handleQueryBu()
}
}
</script>
<template>
<el-select v-on="$listeners" v-bind="$attrs" style="width: 100%">
<el-option
v-for = "i in userBuList"
:key = "i.id"
:label = "i.sitename"
:value = "i.id">
<span style="float: left;width: 100px">{{ i.sitename }}</span>
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 40px">
{{ i.buDesc }}
</span>
</el-option>
</el-select>
</template>
<style scoped>
</style>

172
src/components/selector/table/customerTable.vue

@ -0,0 +1,172 @@
<script>
import {queryCustomerList, queryCustomerListByPage} from "../../../api/customer/customer";
export default {
name: "customerTable",
model:{
prop: "visible",
event: "update"
},
props:{
visible: {
type: Boolean,
default: false
},
height: {
type: Number,
default: 300
},
isPage:{
type: Boolean,
default: false
},
customerNo: {
type: String,
default: ""
},
},
data(){
return{
customer:{
customerNo:"",
customerDesc:"",
active:''
},
dataList:[],
no:1,
size:20,
total:0,
queryLoading:false
}
},
methods:{
handleDblClick(row){
this.$emit("dblclick",row)
},
handleQueryCustomerList(){
let params = {
...this.customer,
createBy:this.$store.state.user.name
}
this.queryLoading = true
queryCustomerList(params).then(({data})=>{
if (data && data.code === 0){
this.dataList = data.rows;
}else {
this.$message.warning(data.msg)
}
this.queryLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryLoading = false
})
},
handleQueryCustomerListByPage(){
let params = {
...this.customer,
no:this.no,
size:this.size
}
this.queryLoading = true
queryCustomerListByPage(params).then(({data})=>{
if (data && data.code === 0){
this.dataList = data.rows;
this.total = data.total;
}else {
this.$message.warning(data.msg)
}
this.queryLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryLoading = false
})
},
handleSizeChange(val){
this.size = val
this.handleQueryCustomerListByPage()
},
handlePageChange(val){
this.no = val
this.handleQueryCustomerListByPage()
}
},
watch:{
visible(newVal,oldVal){
if(newVal){
if (this.isPage){
this.handleQueryCustomerListByPage()
}else {
this.handleQueryCustomerList()
}
}
},
customerNo(newVal,oldVal){
this.customer.customerNo = newVal
},
},
computed:{
open:{
get(){
return this.visible
},
set(val){
this.$emit("update",val)
}
}
},
created() {
this.customer.customerNo = this.customerNo
}
}
</script>
<template>
<el-dialog title="客户信息" v-drag :visible.sync="open" modal-append-to-body :close-on-click-modal="false" width="800px">
<el-form :model="customer" label-position="top">
<el-row :gutter="10">
<el-col :span="4">
<el-form-item label="客户编号">
<el-input v-model="customer.customerNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="客户描述">
<el-input v-model="customer.customerDesc"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="是否在用" style="width: 100%;">
<el-select v-model="customer.active">
<el-option label="全部" value=""></el-option>
<el-option label="在用" value="Y"></el-option>
<el-option label="停用" value="N"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label=" ">
<el-button type="primary" v-if="isPage" @click="handleQueryCustomerListByPage">查询</el-button>
<el-button type="primary" v-else @click="handleQueryCustomerList">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table v-loading="queryLoading" :data="dataList" style="width: 100%" :height="height" border @row-dblclick="handleDblClick">
<el-table-column label="客户编号" prop="customerNo"></el-table-column>
<el-table-column label="客户描述" prop="customerDesc"></el-table-column>
<el-table-column label="客户状态" prop="active"></el-table-column>
</el-table>
<el-pagination v-if="isPage" @size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page="no"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="size"
:total="total"
layout="total,sizes, prev, pager, next, jumper">
</el-pagination>
</el-dialog>
</template>
<style scoped>
</style>

180
src/components/selector/table/projectPartTable.vue

@ -0,0 +1,180 @@
<script>
import {queryProjectPart, queryProjectPartByPage} from "../../../api/project/projectPart";
export default {
name: "projectPartTable",
model:{
prop: "visible",
event: "update"
},
props:{
visible: {
type: Boolean,
default: false
},
projectNo:{
type: String,
default: ""
},
isPage:{
type: Boolean,
default: false
},
height:{
type: Number,
default: 300
},
partNo:{
type: String,
default: ""
}
},
data(){
return{
no:0,
size:20,
total:0,
queryLoading:false,
projectPartList: [],
projectPart:{
projectNo:"",
projectDesc:"",
partNo:"",
partDesc:"",
},
}
},
methods:{
handleQueryProjectPart(){
let params = {
...this.projectPart,
}
this.queryLoading = true
queryProjectPart(params).then(({data})=>{
if (data && data.code === 0){
this.projectPartList = data.rows
}else {
this.$message.warning(data.msg)
}
this.queryLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryLoading = false
})
},
handleQueryProjectPartByPage(){
let params = {
...this.projectPart,
no: this.no,
size: this.size,
}
queryProjectPartByPage(params).then(({data})=>{
if (data && data.code === 0){
this.projectPartList = data.rows
this.total = data.total
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleDblClick(row){
this.$emit("dblclick", row)
},
handleSizeChange(val){
this.size = val
this.handleQueryProjectPartByPage()
},
handlePageChange(val){
this.no = val
this.handleQueryProjectPartByPage()
}
},
computed:{
open:{
get(){
return this.visible
},
set(val){
this.$emit("update", val)
}
}
},
watch:{
projectNo(newVal,oldVal){
this.projectPart.projectNo = newVal
},
visible(newVal,oldVal){
if(newVal){
if (this.isPage){
this.handleQueryProjectPartByPage()
}else {
this.handleQueryProjectPart()
}
}
},
partNo(newVal,oldVal){
this.projectPart.partNo = newVal
}
},
created() {
this.projectPart.projectNo = this.projectNo
this.projectPart.projectNo = this.partNo
}
}
</script>
<template>
<el-dialog title="项目物料信息" v-drag :visible.sync="open" width="800px" :close-on-click-modal="false" modal-append-to-body>
<el-form :model="projectPart" label-width="100px" label-position="top">
<el-row :gutter="10">
<el-col :span="4" v-if="!projectNo">
<el-form-item label="项目编号">
<el-input v-model="projectPart.projectNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="4" v-if="!projectNo">
<el-form-item label="项目描述">
<el-input v-model="projectPart.projectDesc"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="物料编码">
<el-input v-model="projectPart.partNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="物料描述">
<el-input v-model="projectPart.partDesc"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label=" ">
<el-button type="primary" v-if="isPage" @click="handleQueryProjectPartByPage">查询</el-button>
<el-button type="primary" v-else @click="handleQueryProjectPart">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table v-loading="queryLoading" :data="projectPartList" style="width: 100%" border :height="height" @row-dblclick="handleDblClick">
<el-table-column prop="buDesc" label="BU" ></el-table-column>
<el-table-column prop="projectNo" label="项目编码" ></el-table-column>
<el-table-column prop="projectDesc" label="项目描述"></el-table-column>
<el-table-column prop="partNo" label="物料编码" ></el-table-column>
<el-table-column prop="partDesc" label="物料描述" ></el-table-column>
</el-table>
<el-pagination v-if="isPage" @size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page="no"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="size"
:total="total"
layout="total,sizes, prev, pager, next, jumper">
</el-pagination>
</el-dialog>
</template>
<style scoped>
</style>

209
src/components/selector/table/projectTable.vue

@ -0,0 +1,209 @@
<script>
import BuSelect from "../select/BuSelect.vue";
import {queryProjectList, queryProjectListByPage} from "../../../api/project/project";
export default {
name: "projectTable",
components: {BuSelect},
model:{
prop: "visible",
event: "update"
},
props:{
visible: {
type: Boolean,
default: false
},
customerNo:{
type: String,
default: ""
},
height:{
type: Number,
default: 300
},
isPage:{
type: Boolean,
default: false
},
projectNo:{
type: String,
default: ""
},
buId:{
type: Number,
default: ""
},
width:{
type: Number,
default: 800
}
},
data(){
return{
no:1,
size:20,
total:0,
project:{
buId:"",
projectNo:"",
projectDesc:"",
customerNo: "",
customerDesc: ""
},
dataList:[],
queryLoading: false,
}
},
methods:{
handleDblClick(row){
this.$emit("dblclick",row)
},
handleSizeChange(val){
this.size = val
this.handleQueryProjectListByPage()
},
handlePageChange(val){
this.no = val
this.handleQueryProjectListByPage()
},
handleQueryProjectListByPage(){
let params = {
...this.project,
createBy: this.$store.state.user.name,
no:this.no,
size:this.size
}
this.queryLoading = true
queryProjectListByPage(params).then(({data})=>{
if (data && data.code === 0){
this.dataList = data.rows
this.total = data.total
}else {
this.$message.warning(data.msg)
}
this.queryLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryLoading = false
})
},
handleQueryProjectList(){
let params = {
...this.project,
createBy: this.$store.state.user.name
}
this.queryLoading = true
queryProjectList(params).then(({data})=>{
if (data && data.code === 0){
this.dataList = data.rows
}else {
this.$message.warning(data.msg)
}
this.queryLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryLoading = false
})
},
},
created() {
this.project.buId = this.buId
this.project.customerNo = this.customerNo
this.project.projectNo = this.projectNo
},
watch:{
visible(newVal,oldVal){
if (newVal){
if (this.isPage){
this.handleQueryProjectListByPage();
}else {
this.handleQueryProjectList();
}
}
},
customerNo(newVal,oldVal){
this.project.customerNo = newVal
},
projectNo(newVal,oldVal){
this.project.projectNo = newVal
},
buId(newVal,oldVal){
this.project.buId = newVal
},
},
computed:{
open:{
get(){
return this.visible
},
set(val){
this.$emit("update",val)
}
}
}
}
</script>
<template>
<el-dialog :visible.sync="open" v-drag title="项目信息" :close-on-click-modal="false" modal-append-to-body :width="`${width}px`">
<el-form :model="project" label-position="top" label-width="100px">
<el-row :gutter="20">
<el-col :span="6" v-if="!buId">
<el-form-item label="BU">
<bu-select v-model="project.buId" clearable></bu-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目编号">
<el-input v-model="project.projectNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目名称">
<el-input v-model="project.projectDesc"></el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="!customerNo">
<el-row :gutter="20" >
<el-col :span="6" >
<el-form-item label="客户编码">
<el-input v-model="project.customerNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="客户名称">
<el-input v-model="project.customerDesc"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="4" >
<el-form-item label=" ">
<el-button type="primary" v-if="isPage" @click="handleQueryProjectListByPage">查询</el-button>
<el-button type="primary" v-else @click="handleQueryProjectList">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="dataList" border style="width: 100%" :height="height" v-loading="queryLoading" @row-dblclick="handleDblClick">
<el-table-column label="BU" prop="buDesc"></el-table-column>
<el-table-column label="项目编号" prop="projectNo"></el-table-column>
<el-table-column label="项目名称" prop="projectDesc"></el-table-column>
<el-table-column label="客户编码" prop="customerNo"></el-table-column>
<el-table-column label="客户描述" prop="customerDesc"></el-table-column>
</el-table>
<el-pagination v-if="isPage" @size-change="handleSizeChange"
@current-change="handlePageChange"
:current-page="no"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="size"
:total="total"
layout="total,sizes, prev, pager, next, jumper">
</el-pagination>
</el-dialog>
</template>
<style scoped>
</style>

159
src/views/modules/quote/detail/quoteDetail.vue

@ -0,0 +1,159 @@
<script>
import ProjectPartTable from "../../../../components/selector/table/projectPartTable.vue";
import {queryProjectPart} from "../../../../api/project/projectPart";
export default {
name: "quoteDetail",
components: {ProjectPartTable},
props:{
quote:{
type:Object,
required:true
},
height:{
type:Number,
default:300
},
},
data(){
return{
quoteDetail:{
id:null,
partNo:'',
partDesc:'',
projectNo:'',
projectDesc:'',
qty:null,
remark:'',
},
saveQuoteDetail:{
},
dataList:[],
saveLoading:false,
saveVisible:false,
saveQuoteDetailRules:{
partNo: [{required: true, message: '请输入物料编码', trigger: ['blur','change']}],
partDesc: [{required: true, message: '请输入物料名称', trigger: ['blur','change']}],
qty: [{required: true, message: '请输入数量', trigger: ['blur','change']}],
},
projectPartVisible:false,
}
},
methods:{
handleSaveQuoteDetail(row){
this.$nextTick(()=>{
this.$refs.saveQuoteDetailForm.clearValidate();
})
if (row){
this.saveQuoteDetail = {
...row
}
}else {
this.saveQuoteDetail = {
...this.quoteDetail,
createBy:this.$store.state.user.name,
status:'下达',
active:'Y',
qty:1,
isDetail:false,
}
this.$nextTick(()=>{
this.saveQuoteDetail.projectNo = this.quote.projectNo
})
}
this.saveVisible = true;
},
handleDblClick(row){
this.saveQuoteDetail.partNo = row.partNo;
this.saveQuoteDetail.partDesc = row.partDesc;
this.projectPartVisible = false;
},
handlePartNoBlur(){
let params = {
partNo: this.saveQuoteDetail.partNo,
projectNo: this.quote.projectNo,
}
queryProjectPart(params).then(({data})=>{
if (data && data.code === 0){
if (data.rows.length === 1){
this.saveQuoteDetail.partDesc = data.rows[0].partDesc;
}else {
this.saveQuoteDetail.partDesc = '';
}
}else {
this.$message.warning(data.msg);
}
}).catch((error)=>{
this.$message.error(error);
})
},
},
}
</script>
<template>
<div>
<el-button type="primary" @click="handleSaveQuoteDetail(null)">新增</el-button>
<el-table border :data="dataList" style="width: 100%;margin-top: 5px" :height="height">
</el-table>
<el-dialog :title="`报价明细`" v-drag :visible.sync="saveVisible" :width="`${saveQuoteDetail.id?1200:600}px`" modal-append-to-body :close-on-click-modal="false">
<el-form :model="saveQuoteDetail" ref="saveQuoteDetailForm" :rules="saveQuoteDetailRules" label-position="top" v-if="!saveQuoteDetail.id">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="物料名称" prop="partNo" :show-message="false">
<span slot="label">
<a @click="projectPartVisible = true">物料名称</a>
</span>
<el-input v-model="saveQuoteDetail.partNo" @blur="handlePartNoBlur"></el-input>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="物料描述" prop="partDesc" :show-message="false">
<el-input v-model="saveQuoteDetail.partDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报价数量" prop="qty" :show-message="false">
<el-input-number style="width: 100%;" v-model="saveQuoteDetail.qty" :min="1" :step="0" :precision="0" :controls="false"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="" :show-message="false">
<el-checkbox v-model="saveQuoteDetail.isDetail">保存进入报价页面</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" class="auto" :show-message="false">
<el-input type="textarea" v-model="saveQuoteDetail.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" > </el-button>
<el-button @click="saveVisible = false"> </el-button>
</div>
</el-dialog>
<project-part-table v-if="saveVisible" v-model="projectPartVisible" :project-no="saveQuoteDetail.projectNo" :part-no="saveQuoteDetail.partNo" @dblclick="handleDblClick"></project-part-table>
</div>
</template>
<style scoped>
.el-table /deep/ .cell{
height: auto;
line-height: 1.5;
}
.auto /deep/ .el-form-item__content{
height: auto;
line-height: 1.5;
}
</style>

272
src/views/modules/quote/index.vue

@ -1,52 +1,52 @@
<script>
import QuoteSearch from "./primary/quoteSearch.vue";
import QuoteTable from "./primary/quoteTable.vue";
import {queryQuotePage, saveQuote, updateQuote} from "../../../api/quote/quote";
import {queryQuotePage, removeQuote, saveQuote, updateQuote} from "../../../api/quote/quote";
import {getSiteAndBuByUserName} from "../../../api/eam/eam";
import CustomerTable from "../../../components/selector/table/customerTable.vue";
import BuSelect from "../../../components/selector/select/BuSelect.vue";
import ProjectTable from "../../../components/selector/table/projectTable.vue";
import {queryCustomerList} from "../../../api/customer/customer";
import {queryProjectList} from "../../../api/project/project";
import QuoteDetail from "./detail/quoteDetail.vue";
export default {
name: "quote",
components: {QuoteTable, QuoteSearch},
components: {QuoteDetail, ProjectTable, BuSelect, CustomerTable, QuoteTable, QuoteSearch},
menuId:5011,
quote:{
id: null,
site:"",
quoteNo: "",
customerInquiryNo: "",
insideInquiryNo: "",
buNo: "",
buId: null,
versionNo: "",
status:'',
quoteVersionNo: "",
customerNo: "",
customerDesc: "",
projectNo: "",
projectDesc: "",
currency: "",
quoteDate: "",
quoter: "",
purchase: "",
remark: "",
createBy: "",
createDate: "",
updateBy: "",
updateDate: "",
},
data(){
return{
total: 0,
no:1,
size: 20,
quote:{
id: null,
site:"",
quoteNo: "",
customerInquiryNo: "",
insideInquiryNo: "",
buNo: "",
buId: null,
versionNo: "",
status:'',
quoteVersionNo: "",
customerNo: "",
customerDesc: "",
projectNo: "",
projectDesc: "",
currency: "",
quoteDate: "",
quoter: "",
purchase: "",
remark: "",
createBy: "",
createDate: "",
updateBy: "",
updateDate: "",
},
quoteForm:{
...this.quote,
createBy: this.$store.state.user.name,
},
saveQuote:{
...this.quote,
createBy: this.$store.state.user.name,
status:'草稿',
action:'Y',
},
dataList:[],
columns: [
@ -143,10 +143,10 @@ export default {
{
userId: this.$store.state.user.name,
functionId: 5011,
serialNumber: '5011Table1CustomerName',
serialNumber: '5011Table1CustomerDesc',
tableId: '5011Table1',
tableName: '报价信息表',
columnProp: 'customerName',
columnProp: 'customerDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '客户名称',
@ -178,10 +178,10 @@ export default {
}, {
userId: this.$store.state.user.name,
functionId: 5011,
serialNumber: '5011Table1ProjectName',
serialNumber: '5011Table1ProjectDesc',
tableId: '5011Table1',
tableName: '报价信息表',
columnProp: 'projectName',
columnProp: 'projectDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '项目名称',
@ -380,16 +380,21 @@ export default {
activeName:'detail',
userBuList: [],
saveRules: {
buId:[{required: true, message: '请选择BU', trigger: 'blur'}],
customerNo:[{required: true, message: '请输入客户编码', trigger: 'blur'}],
customerDesc:[{required: true, message: '请输入客户名称', trigger: 'blur'}],
projectNo:[{required: true, message: '请输入项目编码', trigger: 'blur'}],
projectDesc:[{required: true, message: '请输入项目编码', trigger: 'blur'}],
currency:[{required: true, message: '请输入币种', trigger: 'blur'}],
quoteDate:[{required: true, message: '请选择报价日期', trigger: 'blur'}],
quoter:[{required: true, message: '请输入报价专员', trigger: 'blur'}],
purchase:[{required: true, message: '请输入询价专员', trigger: 'blur'}],
buId:[{required: true, message: '请选择BU', trigger: ['blur','change']}],
customerNo:[{required: true, message: '请输入客户编码', trigger: ['blur','change']}],
customerDesc:[{required: true, message: '请输入客户名称', trigger: ['blur','change']}],
projectNo:[{required: true, message: '请输入项目编码', trigger: ['blur','change']}],
projectDesc:[{required: true, message: '请输入项目名称', trigger: ['blur','change']}],
currency:[{required: true, message: '请输入币种', trigger: ['blur','change']}],
quoteDate:[{required: true, message: '请选择报价日期', trigger: ['blur','change']}],
quoter:[{required: true, message: '请输入报价专员', trigger: ['blur','change']}],
purchase:[{required: true, message: '请输入询价专员', trigger: ['blur','change']}],
},
customerVisible:false,
projectVisible:false,
currentQuote:{
}
}
},
methods:{
@ -404,6 +409,9 @@ export default {
if (data && data.code === 0){
this.dataList = data.rows
this.total = data.total
if (this.total > 0){
this.currentQuote = {...this.dataList[0]}
}
}else {
this.$message.error(data.message)
}
@ -414,18 +422,23 @@ export default {
})
},
handleSave(row){
this.$nextTick(()=>{
if (this.$refs.saveForm){
this.$refs.saveForm.clearValidate();
}
})
console.log(row)
if (row){
this.saveQuote = {
...row,
createBy: this.$store.state.user.name,
status:'草稿',
action:'Y',
...row
}
}else {
this.saveQuote = {
...this.quote,
buId: this.userBuList.length > 0? this.userBuList[0].id:undefined,
}
this.$nextTick(()=>{
this.saveQuote.buId = this.userBuList.length > 0? this.userBuList[0].id:null;
})
}
this.saveVisible = true
},
@ -452,8 +465,7 @@ export default {
})
},
handleSaveOrUpdateQuote(){
console.log(this.saveQuote)
this.$refs.saveForm.validate((valid) => {
this.$refs.saveForm.validate((valid,obj) => {
if (valid){
if (this.saveQuote.id){
this.handleUpdateQuote();
@ -461,13 +473,23 @@ export default {
this.handleSaveQuote();
}
}else {
let i = 1;
for (let key in obj){
this.$message.warning(obj[key][0].message)
if (i === 1){
return
}
i++;
}
}
})
},
handleSaveQuote(){
let params = {
...this.saveQuote,
status: '草稿',
action: 'Y',
createBy: this.$store.state.user.name,
}
this.saveLoading = true
saveQuote(params).then(({data})=>{
@ -487,6 +509,7 @@ export default {
handleUpdateQuote(){
let params = {
...this.saveQuote,
updateBy: this.$store.state.user.name,
}
this.saveLoading = true
updateQuote(params).then(({data})=>{
@ -503,9 +526,96 @@ export default {
this.saveLoading = false
})
},
customerDblClick(row){
this.saveQuote.customerNo = row.customerNo
this.saveQuote.customerDesc = row.customerDesc
this.customerVisible = false
},
projectDblClick(row){
this.saveQuote.projectNo = row.projectNo
this.saveQuote.projectDesc = row.projectDesc
this.projectVisible = false
},
handleRemove(row){
console.log(row)
this.$alert('确认删除该报价信息吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.handleRemoveQuote(row)
}).catch(() => {
})
},
handleRemoveQuote(row){
let params = {
id: row.id,
}
removeQuote(params).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg)
this.handleSearch();
}else {
this.$message.warning(data.message)
}
}).catch((error)=>{
this.$message.error(error)
})
},
customerNoBlur(){
let params = {
customerNo: this.saveQuote.customerNo,
createBy: this.$store.state.user.name,
}
queryCustomerList(params).then(({data}) => {
if (data && data.code === 0) {
if (data.rows.length === 1){
this.saveQuote.customerDesc = data.rows[0].customerDesc
}else {
this.saveQuote.projectNo = ''
this.saveQuote.projectDesc = ''
this.saveQuote.customerDesc = ''
}
}else {
this.$message.warning(data.message)
}
}).catch((error) => {
this.$message.error(error)
})
},
projectNoBlur(){
let params = {
projectNo: this.saveQuote.projectNo,
customerNo: this.saveQuote.customerNo,
createBy: this.$store.state.user.name,
buId: this.saveQuote.buId,
}
queryProjectList(params).then(({data})=>{
if (data && data.code === 0) {
if (data.rows.length === 1) {
this.saveQuote.projectDesc = data.rows[0].projectDesc
}else {
this.saveQuote.projectDesc = ''
}
}else {
this.$message.warning(data.message)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleRowClick(row){
this.currentQuote = {...row}
}
},
created() {
this.quoteForm = {
...this.quote,
createBy: this.$store.state.user.name,
}
this.handleQueryBu();// BU
this.handleSearch();//
},
watch:{
'quoteForm.customerNo'(newVal, oldVal){
@ -514,6 +624,15 @@ export default {
'quoteForm.projectNo'(newVal, oldVal){
this.quoteForm.projectNo = newVal.toUpperCase()
},
'quoteForm.quoteNo'(newVal, oldVal){
this.quoteForm.quoteNo = newVal.toUpperCase()
},
'saveQuote.customerNo'(newVal, oldVal){
this.saveQuote.customerNo = newVal.toUpperCase()
},
'saveQuote.projectNo'(newVal, oldVal){
// this.saveQuote.projectNo = newVal.toUpperCase()
},
}
}
</script>
@ -521,7 +640,9 @@ export default {
<template>
<div>
<quote-search v-model:quote="quoteForm" @search="handleSearch" @save="handleSave"></quote-search>
<quote-table v-loading="searchLoading" :columns="columns" style="margin-top: 5px" @save="handleSave" :data-list="dataList" :height="350">
<quote-table v-loading="searchLoading" :current-row="currentQuote" :columns="columns" style="margin-top: 5px"
@save="handleSave" @remove="handleRemove" @rowClick="handleRowClick"
:data-list="dataList" :height="350">
</quote-table>
<el-pagination @size-change="handleSizeChange"
@ -533,26 +654,17 @@ export default {
layout="total,sizes, prev, pager, next, jumper">
</el-pagination>
<el-tabs v-model="activeName" >
<el-tab-pane label="报价明细" name="detail"></el-tab-pane>
<el-tab-pane label="报价明细" name="detail">
<quote-detail :quote="currentQuote"></quote-detail>
</el-tab-pane>
</el-tabs>
<el-dialog :title="saveQuote.id? '报价信息:'+ saveQuote.quoteNo : '报价信息'" v-drag :visible.sync="saveVisible" width="500px" >
<el-dialog :title="saveQuote.id? '报价信息:'+ saveQuote.quoteVersionNo : '报价信息'" v-drag :close-on-click-modal="false" :visible.sync="saveVisible" width="500px" >
<el-form ref="saveForm" :model="saveQuote" :rules="saveRules" label-position="top" label-width="100px">
<el-row :gutter="10">
<el-col :span="16">
<el-form-item label="BU" prop="buId" :show-message="false">
<el-select v-model="saveQuote.buId" style="width: 100%" placeholder="请选择" :disabled="!isNaN(saveQuote.id)">
<el-option
v-for = "i in userBuList"
:key = "i.id"
:label = "i.sitename"
:value = "i.id">
<span style="float: left;width: 100px">{{ i.sitename }}</span>
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
{{ i.buDesc }}
</span>
</el-option>
</el-select>
<bu-select v-model="saveQuote.buId" :disabled="saveQuote.id > 0"></bu-select>
</el-form-item>
</el-col>
</el-row>
@ -571,22 +683,28 @@ export default {
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="客户编码" prop="customerNo" :show-message="false">
<el-input v-model="saveQuote.customerNo"></el-input>
<span slot="label">
<a @click="customerVisible = true">客户编码</a>
</span>
<el-input v-model="saveQuote.customerNo" @blur="customerNoBlur"></el-input>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="客户描述" prop="customerDesc" :show-message="false">
<el-input v-model="saveQuote.customerDesc"></el-input>
<el-input v-model="saveQuote.customerDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="项目编码" prop="projectNo" :show-message="false">
<el-input v-model="saveQuote.projectNo"></el-input>
<span slot="label" v-if="saveQuote.customerNo && saveQuote.customerDesc">
<a @click="projectVisible = true" >项目编码</a>
</span>
<el-input v-model="saveQuote.projectNo" @blur="projectNoBlur"></el-input>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="项目描述" prop="projectDesc" :show-message="false">
<el-input v-model="saveQuote.projectDesc"></el-input>
<el-input v-model="saveQuote.projectDesc" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
@ -623,6 +741,9 @@ export default {
<el-button @click="saveVisible = false"> </el-button>
</div>
</el-dialog>
<customer-table ref="customerTable" v-if="saveVisible" v-model="customerVisible" :height="300" @dblclick="customerDblClick" :customer-no="saveQuote.customerNo"></customer-table>
<project-table ref="projectTable" v-if="saveVisible" v-model="projectVisible" :height="300" @dblclick="projectDblClick" :customer-no="saveQuote.customerNo" :project-no="saveQuote.projectNo" :bu-id="saveQuote.buId"></project-table>
</div>
</template>
@ -631,4 +752,9 @@ export default {
height: auto;
line-height: 1.5;
}
.el-table /deep/ .cell{
height: auto;
line-height: 1.5;
}
</style>

2
src/views/modules/quote/primary/quoteSearch.vue

@ -39,7 +39,7 @@ export default {
</el-col>
<el-col :span="3">
<el-form-item label="报价单号">
<el-input v-model="quote.quote"></el-input>
<el-input v-model="quote.quoteNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">

19
src/views/modules/quote/primary/quoteTable.vue

@ -21,17 +21,27 @@ export default {
},
methods:{
handleRowClick(row, column, event){
this.$emit('row-click',row)
this.$emit('rowClick',row)
},
handleSaveClick(row){
this.$emit('save',row)
}
},
handleRemoveClick(row){
this.$emit('remove',row)
},
rowStyle({row}){
if(this.currentRow && this.currentRow.id === row.id){
return { 'background-color': '#E8F7F6' };
}else {
return {}
}
},
}
}
</script>
<template>
<el-table :data="dataList" border :height="height" @row-click="handleRowClick">
<el-table :data="dataList" border :height="height" :row-style="rowStyle" @row-click="handleRowClick">
<el-table-column
v-for="(item,index) in columns" :key="index"
:sortable="item.columnSortable"
@ -54,7 +64,8 @@ export default {
width="180"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="handleSaveClick(scope.row)">编辑</a>
<a type="text" @click="handleSaveClick(scope.row)">编辑</a>
<a type="text" @click="handleRemoveClick(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>

Loading…
Cancel
Save