4 changed files with 727 additions and 3 deletions
-
2src/api/srm/srmSupplier.js
-
15src/api/supplier/purQuotation.js
-
4src/views/modules/srmPart/partInfoList.vue
-
709src/views/modules/supplier/purHeaderList.vue
@ -0,0 +1,15 @@ |
|||
import { createAPI } from '@/utils/httpRequest.js' |
|||
|
|||
export const searchPurHeaderList = (data) => createAPI(`/supplier/getPurHeaderList`, 'post', data) |
|||
export const createPurHeader = (data) => createAPI(`/supplier/savePurHeader`, 'post', data) |
|||
export const updatePurHeader = (data) => createAPI(`/supplier/savePurHeader`, 'post', data) |
|||
export const deletePurHeader = (data) => createAPI(`/supplier/delPurHeader`, 'post', data) |
|||
//询价提交
|
|||
export const updatePurDetailStatus = (data) => createAPI(`/supplier/updatePurDetailStatus`, 'post', data) |
|||
|
|||
|
|||
//询价明细
|
|||
export const searchMaterialList = (data) => createAPI(`/supplier/getPurDetailList`, 'post', data) |
|||
export const createMaterial = (data) => createAPI(`/supplier/savePurDetail`, 'post', data) |
|||
export const updateMaterial = (data) => createAPI(`/supplier/savePurDetail`, 'post', data) |
|||
export const deleteMaterial = (data) => createAPI(`/supplier/delPurDetail`, 'post', data) |
|||
@ -0,0 +1,709 @@ |
|||
<template> |
|||
<div class="customer-css"> |
|||
<!-- 查询条件 --> |
|||
<el-form :inline="true" label-position="top" class="pi-search-form"> |
|||
<el-form-item :label="'询价单号'"> |
|||
<el-input v-model="searchData.orderNo" placeholder="询价单号" style="width:160px" @keyup.enter.native="getList" clearable /> |
|||
</el-form-item> |
|||
<el-form-item :label="'供应商编码'"> |
|||
<el-input v-model="searchData.supplierId" placeholder="供应商编码" style="width:160px" @keyup.enter.native="getList" clearable /> |
|||
</el-form-item> |
|||
<el-form-item :label="'供应商名称'"> |
|||
<el-input v-model="searchData.supplierName" placeholder="供应商名称" style="width:200px" @keyup.enter.native="getList" clearable /> |
|||
</el-form-item> |
|||
<el-form-item :label="'状态'"> |
|||
<el-select v-model="searchData.status" placeholder="请选择" style="width:100px" clearable> |
|||
<el-option label="全部" value="" /> |
|||
<el-option label="已计划" value="已计划" /> |
|||
<el-option label="已下达" value="已下达" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label=" "> |
|||
<el-button type="primary" class="customer-bun-min" @click="getList">查询</el-button> |
|||
<el-button type="primary" class="customer-bun-min" @click="openDialog()">新增</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<!-- 主表:询价单列表 --> |
|||
<el-table :data="dataList" :height="tableHeight" border highlight-current-row @row-click="selectInquiry" v-loading="loading" style="width:100%"> |
|||
<el-table-column fixed="right" label="操作" header-align="center" align="center" width="140"> |
|||
<template slot-scope="scope"> |
|||
<a class="customer-a" @click.stop="openDialog(scope.row)">编辑 |</a> |
|||
<a class="customer-a" @click.stop="handleDelete(scope.row)">删除</a> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="orderNo" label="询价单号" min-width="140" header-align="center" align="left" show-overflow-tooltip fixed="left" /> |
|||
<el-table-column prop="supplierId" label="供应商编码" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="supplierName" label="供应商名称" min-width="180" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="orderDate" label="询价日期" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="wantReplyDate" label="要求报价日期" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="userName" label="录入人" min-width="100" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="buyer" label="采购员" min-width="100" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="paymentTermDesc" label="付款方式" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="deliveryTermDesc" label="交易条款" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="currency" label="货币" min-width="80" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="currencyRate" label="货币汇率" min-width="100" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="taxRate" label="税率" min-width="80" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="otherCondition" label="其他要求" min-width="180" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="phoneNo" label="电话号码" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="faxNo" label="传真" min-width="120" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="contact" label="联系人" min-width="100" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="remark" label="备注" min-width="180" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="status" label="状态" min-width="80" header-align="center" align="center" show-overflow-tooltip /> |
|||
</el-table> |
|||
|
|||
<!-- 分页 --> |
|||
|
|||
<el-pagination |
|||
style="margin-top:5px" |
|||
@size-change="sizeChangeHandle" |
|||
@current-change="currentChangeHandle" |
|||
:current-page="pageIndex" |
|||
:page-sizes="[20,50,100,200]" |
|||
:page-size="pageSize" |
|||
:total="totalPage" |
|||
layout="total, sizes, prev, pager, next, jumper" /> |
|||
|
|||
<!-- 子表:物料明细列表 - 始终显示表头 --> |
|||
<div class="sub-title"> |
|||
物料明细列表 |
|||
<el-button type="primary" class="customer-bun-min" @click="openMaterialDialog()" style="margin-left: 10px;">新增物料</el-button> |
|||
<!-- <el-button type="text" icon="el-icon-plus" @click="openMaterialDialog(null)" style="margin-left: 10px;" :disabled="!currentInquiry">新增物料</el-button> --> |
|||
<!-- <span v-if="!currentInquiry" style="font-size: 12px; color: #909399; margin-left: 10px;">(请先选择一个询价单)</span> --> |
|||
</div> |
|||
|
|||
<el-table |
|||
:data="materialList" |
|||
:height="subTableHeight" |
|||
border |
|||
v-loading="materialLoading" |
|||
style="width:100%"> |
|||
<el-table-column fixed="right" label="操作" header-align="center" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<a class="material-action-btn" @click="openMaterialDialog(scope.row)">编辑</a> |
|||
<a class="material-action-btn" @click="deleteMaterial(scope.row)">删除</a> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="partNo" label="物料编码" min-width="130" header-align="center" align="center" show-overflow-tooltip /> |
|||
<el-table-column prop="partDesc" label="物料名称" min-width="150" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="umid" label="计量单位" min-width="80" header-align="center" align="center" /> |
|||
<el-table-column prop="spec" label="规格型号" min-width="150" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="qty" label="询价数量" min-width="100" header-align="center" align="right"> |
|||
<template slot-scope="scope">{{ scope.row.qty || 0 }}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="remark2" label="特殊要求" min-width="150" header-align="center" align="left" show-overflow-tooltip> |
|||
<template slot-scope="scope">{{ scope.row.remark2 || '-' }}</template> |
|||
</el-table-column> |
|||
<el-table-column prop="status" label="状态" min-width="80" header-align="center" align="center"> |
|||
<template slot-scope="scope">{{ scope.row.status }} |
|||
<!-- <span :class="'status-badge ' + (scope.row.status === 'Y' ? 'status-sent' : 'status-closed')">{{ scope.row.status === 'Y' ? '启用' : '停用' }}</span> --> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!-- 空数据提示 --> |
|||
<div v-if="materialList.length === 0 && !materialLoading" style="margin-top: 8px; color: #909399; font-size: 12px; text-align: center;"> |
|||
{{ currentInquiry ? '暂无物料数据' : '请点击左侧询价单查看物料明细' }} |
|||
</div> |
|||
|
|||
<!-- 新增/编辑 询价单弹窗 --> |
|||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="700px" :close-on-click-modal="false" append-to-body> |
|||
<el-form label-position="top" class="pi-form" :model="form" label-width="120px"> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="12"> |
|||
<el-form-item> |
|||
<span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="javascript:void(0)">供应商编码</a></span> |
|||
<el-input v-model="form.supplierId" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="供应商名称" :required="true"> |
|||
<el-input v-model="form.supplierName" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="询价日期"> |
|||
<el-date-picker v-model="form.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:100%" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="要求报价日期"> |
|||
<el-date-picker v-model="form.wantReplyDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:100%" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="货币汇率"> |
|||
<el-input-number v-model="form.currencyRate" :precision="4" :step="0.1" style="width:100%" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="税率(%)"> |
|||
<el-input-number v-model="form.taxRate" :precision="2" :step="1" style="width:100%" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="6"> |
|||
<el-form-item> |
|||
<span style="cursor: pointer" slot="label" @click="getBaseList(529)"><a href="javascript:void(0)">采购员</a></span> |
|||
<el-input v-model="form.buyer" style="width: 130px" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="付款方式"> |
|||
<el-input v-model="form.paymentTermDesc" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="交易条款"> |
|||
<el-input v-model="form.deliveryTermDesc" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="货币"> |
|||
<el-input v-model="form.currency" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="6"> |
|||
<el-form-item label="电话号码"> |
|||
<el-input v-model="form.phoneNo" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="传真"> |
|||
<el-input v-model="form.faxNo" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="联系人"> |
|||
<el-input v-model="form.contact" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item label="状态"> |
|||
<el-select v-model="form.status"> |
|||
<el-option label="启用" value="Y" /> |
|||
<el-option label="停用" value="N" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="其他要求"> |
|||
<el-input v-model="form.otherCondition" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="备注"> |
|||
<el-input type="textarea" v-model="form.remark" :rows="2" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer" style="margin-top: 20px"> |
|||
<el-button type="primary" @click="submitForm" :loading="submitLoading">保存</el-button> |
|||
<el-button @click="dialogVisible=false">取消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<!-- 物料明细新增/编辑弹窗 --> |
|||
<el-dialog :title="materialDialogTitle" :visible.sync="materialDialogVisible" width="700px" :close-on-click-modal="false" append-to-body> |
|||
<el-form label-position="top" class="pi-form" :model="materialForm"> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="12"> |
|||
<el-form-item > |
|||
<span style="cursor: pointer" slot="label" @click="getBaseList(507)"><a href="#">物料编码</a></span> |
|||
<el-input v-model="materialForm.partNo" placeholder="请输入物料编码" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form-item label="物料名称" required> |
|||
<el-input v-model="materialForm.partDesc" placeholder="请输入物料名称" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="12"> |
|||
<el-form-item label="规格型号"> |
|||
<el-input v-model="materialForm.spec" placeholder="规格型号" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="6"> |
|||
<el-form-item > |
|||
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a href="#">计量单位</a></span> |
|||
<el-input v-model="materialForm.umid" placeholder="计量单位" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="6"> |
|||
<el-form-item label="询价数量"> |
|||
<el-input-number v-model="materialForm.qty" :min="0" :precision="0" style="width:100%" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="24"> |
|||
<el-form-item label="特殊要求"> |
|||
<el-input type="textarea" v-model="materialForm.remark2" :rows="2" placeholder="特殊要求" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer" style="margin-top: 20px"> |
|||
<el-button type="primary" @click="saveMaterial" :loading="materialSubmitLoading">保存</el-button> |
|||
<el-button @click="materialDialogVisible=false">取消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
|
|||
|
|||
<Chooselist ref="baseList" @getBaseData="getBaseData" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|||
import { |
|||
searchPurHeaderList, |
|||
createPurHeader, |
|||
updatePurHeader, |
|||
deletePurHeader, |
|||
searchMaterialList, |
|||
createMaterial, |
|||
updateMaterial, |
|||
deleteMaterial |
|||
} from '@/api/supplier/purQuotation.js' |
|||
|
|||
import { |
|||
getSupplierInfo |
|||
} from '@/api/srm/srmSupplier.js' |
|||
|
|||
|
|||
export default { |
|||
components: { |
|||
Chooselist |
|||
}, |
|||
name: 'InquiryList', |
|||
data() { |
|||
return { |
|||
tableHeight: 200, |
|||
subTableHeight: 200, |
|||
loading: false, |
|||
submitLoading: false, |
|||
materialLoading: false, |
|||
materialSubmitLoading: false, |
|||
dataList: [], |
|||
pageIndex: 1, |
|||
pageSize: 20, |
|||
totalPage: 0, |
|||
searchData: { |
|||
site: this.$store.state.user.site, |
|||
orderNo: '', |
|||
supplierId: '', |
|||
supplierName: '', |
|||
status: '' |
|||
}, |
|||
dialogVisible: false, |
|||
dialogTitle: '新增询价单', |
|||
editMode: false, |
|||
form: { |
|||
paymentTermDesc: '', |
|||
deliveryTermDesc: '', |
|||
currency: '', |
|||
orderNo: '', |
|||
supplierId: '', |
|||
supplierName: '', |
|||
orderDate: '', |
|||
wantReplyDate: '', |
|||
userName: '', |
|||
buyer: '', |
|||
currencyRate: 1, |
|||
taxRate: 0, |
|||
taxCode:'', |
|||
otherCondition: '', |
|||
phoneNo: '', |
|||
faxNo: '', |
|||
contact: '', |
|||
remark: '', |
|||
printed : "N", |
|||
status: '已计划' |
|||
}, |
|||
// 物料子表相关 |
|||
currentInquiry: null, |
|||
materialList: [], |
|||
materialDialogVisible: false, |
|||
materialDialogTitle: '新增物料', |
|||
materialForm: { |
|||
id: null, |
|||
site: this.$store.state.user.site, |
|||
partNo: '', |
|||
partDesc: '', |
|||
umid: '', |
|||
spec: '', |
|||
qty: 0, |
|||
remark2: '', |
|||
status: '待提交' |
|||
}, |
|||
tagNo: null, |
|||
tagNo1: null |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
this.tableHeight = (window.innerHeight - 250) / 2 |
|||
this.subTableHeight = (window.innerHeight - 250) / 2 |
|||
}) |
|||
// this.calcHeight() |
|||
// window.addEventListener('resize', this.calcHeight) |
|||
this.getList() |
|||
}, |
|||
beforeDestroy() { |
|||
// window.removeEventListener('resize', this.calcHeight) |
|||
}, |
|||
methods: { |
|||
// calcHeight() { |
|||
// this.$nextTick(() => { |
|||
// this.tableHeight = window.innerHeight - 360 |
|||
// this.subTableHeight = 220 |
|||
// }) |
|||
// }, |
|||
getBaseList(val, type) { |
|||
this.tagNo = val |
|||
this.tagNo1 = type |
|||
this.$nextTick(() => { |
|||
let strVal = '' |
|||
if (val === 520) { |
|||
if(type == 1) { |
|||
strVal = this.form.supplierId |
|||
} |
|||
} |
|||
if (val === 529) { |
|||
strVal = this.form.buyer |
|||
} |
|||
if(val === 507) { |
|||
strVal = this.form.part_spec |
|||
} |
|||
if (val === 510) { |
|||
strVal = this.form.unit |
|||
} |
|||
this.$refs.baseList.init(val, strVal?strVal:'') |
|||
}) |
|||
}, |
|||
getBaseData(val) { |
|||
if (this.tagNo === 520) { |
|||
this.form.supplierId = val.supplier_no |
|||
this.form.supplierName = val.supplier_name |
|||
this.searchSupplierInfo() |
|||
} |
|||
if (this.tagNo === 529) { |
|||
this.form.buyer = val.UserName |
|||
} |
|||
if(this.tagNo === 507) { |
|||
this.materialForm.partNo = val.part_no |
|||
this.materialForm.partDesc = val.part_desc |
|||
this.materialForm.spec = val.part_spec |
|||
} |
|||
|
|||
if (this.tagNo === 510) { |
|||
this.materialForm.umid = val.UMID |
|||
} |
|||
}, |
|||
searchSupplierInfo() { |
|||
const params = { |
|||
site: this.$store.state.user.site, |
|||
supplierNo: this.form.supplierId |
|||
} |
|||
getSupplierInfo(params).then(({data}) => { |
|||
if (data.code === 0) { |
|||
this.form.supplierId = data.row.supplierId || this.form.supplierId |
|||
this.form.supplierName = data.row.supplierName || this.form.supplierName |
|||
this.form.phoneNo = data.row.phoneNo || this.form.phoneNo |
|||
this.form.faxNo = data.row.faxNo || this.form.faxNo |
|||
this.form.contact = data.row.contact || this.form.contact |
|||
this.form.taxRate = data.row.taxRate || this.form.taxRate |
|||
this.form.taxCode = data.row.taxCode || this.form.taxCode |
|||
this.form.paymentTerm = data.row.paymentTerm || this.form.paymentTerm |
|||
this.form.paymentTermDesc = data.row.paymentTermDesc || this.form.paymentTermDesc |
|||
this.form.deliveryTerm = data.row.deliveryTerm || this.form.deliveryTerm |
|||
this.form.deliveryTermDesc = data.row.deliveryTermDesc || this.form.deliveryTermDesc |
|||
this.form.currency = data.row.currency || this.form.currency |
|||
} else { |
|||
this.$message.error((data && data.msg) || '获取列表失败') |
|||
} |
|||
}).catch(() => { |
|||
this.$message.error('请求失败') |
|||
}) |
|||
}, |
|||
getList() { |
|||
this.loading = true |
|||
const params = { |
|||
...this.searchData, |
|||
limit: this.pageSize, |
|||
page: this.pageIndex |
|||
} |
|||
|
|||
searchPurHeaderList(params).then(({data}) => { |
|||
if (data.code === 0) { |
|||
this.dataList = data.page.list |
|||
this.totalPage = data.page.totalCount |
|||
// 保留选中状态 |
|||
if (this.currentInquiry) { |
|||
const exists = this.dataList.some(item => item.orderNo === this.currentInquiry.orderNo) |
|||
if (exists) { |
|||
this.selectInquiry(this.currentInquiry) |
|||
} else { |
|||
this.materialList = [] |
|||
this.currentInquiry = null |
|||
} |
|||
} else if (this.dataList.length > 0 && !this.currentInquiry) { |
|||
this.selectInquiry(this.dataList[0]) |
|||
} |
|||
} else { |
|||
this.$message.error((data && data.msg) || '获取列表失败') |
|||
} |
|||
this.loading = false |
|||
}).catch(() => { |
|||
this.loading = false |
|||
this.$message.error('请求失败') |
|||
}) |
|||
}, |
|||
sizeChangeHandle(val) { |
|||
this.pageSize = val |
|||
this.pageIndex = 1 |
|||
this.getList() |
|||
}, |
|||
currentChangeHandle(val) { |
|||
this.pageIndex = val |
|||
this.getList() |
|||
}, |
|||
selectInquiry(row) { |
|||
this.currentInquiry = row |
|||
this.loadMaterialList(row.orderNo) |
|||
}, |
|||
// 加载物料列表 |
|||
loadMaterialList(orderNo) { |
|||
this.materialLoading = true |
|||
searchMaterialList({ orderNo: orderNo }).then(({data}) => { |
|||
if (data.code === 0) { |
|||
this.materialList = data.rows || [] |
|||
} else { |
|||
this.materialList = [] |
|||
} |
|||
this.materialLoading = false |
|||
}).catch(() => { |
|||
this.materialList = [] |
|||
this.materialLoading = false |
|||
this.$message.error('获取物料列表失败') |
|||
}) |
|||
}, |
|||
openDialog(row) { |
|||
if (row) { |
|||
this.dialogTitle = '编辑询价单' |
|||
this.editMode = true |
|||
this.form = { ...row } |
|||
} else { |
|||
this.dialogTitle = '新增询价单' |
|||
this.editMode = false |
|||
const today = this.getTodayDate() |
|||
this.form = { |
|||
site: this.$store.state.user.site, |
|||
orderNo: '', |
|||
supplierId: '', |
|||
supplierName: '', |
|||
orderDate: today, |
|||
wantReplyDate: today, |
|||
userName: this.$store.state.user.name, |
|||
buyer: '', |
|||
paymentTermDesc: '', |
|||
deliveryTermDesc: '', |
|||
currency: '', |
|||
currencyRate: 0, |
|||
taxRate: 0, |
|||
taxCode:'', |
|||
otherCondition: '', |
|||
phoneNo: '', |
|||
faxNo: '', |
|||
contact: '', |
|||
remark: '', |
|||
printed : "N", |
|||
status: '已计划' |
|||
} |
|||
} |
|||
this.dialogVisible = true |
|||
}, |
|||
validateForm() { |
|||
if (!this.form.supplierId) { this.$message.warning('供应商编码不能为空'); return false } |
|||
if (!this.form.supplierName) { this.$message.warning('供应商名称不能为空'); return false } |
|||
return true |
|||
}, |
|||
getTodayDate() { |
|||
const today = new Date() |
|||
const year = today.getFullYear() |
|||
const month = String(today.getMonth() + 1).padStart(2, '0') |
|||
const day = String(today.getDate()).padStart(2, '0') |
|||
return `${year}-${month}-${day}` |
|||
}, |
|||
submitForm() { |
|||
if (!this.validateForm()) return |
|||
this.submitLoading = true |
|||
const api = this.editMode ? updatePurHeader : createPurHeader |
|||
api(this.form).then(({data}) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('保存成功') |
|||
this.dialogVisible = false |
|||
this.getList() |
|||
} else { |
|||
this.$message.error((data && data.msg) || '保存失败') |
|||
} |
|||
}).catch(err => { |
|||
this.$message.error('请求失败: ' + err.message) |
|||
}).finally(() => { |
|||
this.submitLoading = false |
|||
}) |
|||
}, |
|||
handleDelete(row) { |
|||
this.$confirm('确定删除询价单: ' + row.orderNo + ' ?', '提示', { type: 'warning' }).then(() => { |
|||
deletePurHeader({ id: row.id }).then(({data}) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('删除成功') |
|||
this.getList() |
|||
} else { |
|||
this.$message.error((data && data.msg) || '删除失败') |
|||
} |
|||
}).catch(err => { |
|||
this.$message.error('删除失败: ' + err.message) |
|||
}) |
|||
}).catch(() => {}) |
|||
}, |
|||
// 物料操作 |
|||
openMaterialDialog(row) { |
|||
if (!this.currentInquiry) { |
|||
this.$message.warning('请先选择一个询价单') |
|||
return |
|||
} |
|||
if (row) { |
|||
this.materialDialogTitle = '编辑物料' |
|||
this.materialForm = { ...row } |
|||
} else { |
|||
this.materialDialogTitle = '新增物料' |
|||
this.materialForm = { |
|||
id: null, |
|||
site: this.$store.state.user.site, |
|||
partNo: '', |
|||
partDesc: '', |
|||
umid: '', |
|||
spec: '', |
|||
qty: 0, |
|||
remark2: '', |
|||
status: '待提交' |
|||
} |
|||
} |
|||
this.materialDialogVisible = true |
|||
}, |
|||
saveMaterial() { |
|||
if (!this.materialForm.partNo) { |
|||
this.$message.warning('物料编码不能为空') |
|||
return |
|||
} |
|||
if (!this.materialForm.partDesc) { |
|||
this.$message.warning('物料名称不能为空') |
|||
return |
|||
} |
|||
if(!this.materialForm.umid){ |
|||
this.$message.warning('请选择计量单位') |
|||
return |
|||
} |
|||
if(this.materialForm.qty <= 0){ |
|||
this.$message.warning('请选择询价数量') |
|||
return |
|||
} |
|||
|
|||
|
|||
this.materialSubmitLoading = true |
|||
const submitData = { |
|||
...this.materialForm, |
|||
orderNo: this.currentInquiry.orderNo |
|||
} |
|||
const api = this.materialForm.id ? updateMaterial : createMaterial |
|||
api(submitData).then(({data}) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('保存成功') |
|||
this.materialDialogVisible = false |
|||
this.loadMaterialList(this.currentInquiry.orderNo) |
|||
} else { |
|||
this.$message.error((data && data.msg) || '保存失败') |
|||
} |
|||
}).catch(err => { |
|||
this.$message.error('保存失败: ' + err.message) |
|||
}).finally(() => { |
|||
this.materialSubmitLoading = false |
|||
}) |
|||
}, |
|||
deleteMaterial(row) { |
|||
this.$confirm('确定删除物料: ' + row.partNo + ' ?', '提示', { type: 'warning' }).then(() => { |
|||
deleteMaterial({ id: row.id }).then(({data}) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('删除成功') |
|||
this.loadMaterialList(this.currentInquiry.orderNo) |
|||
} else { |
|||
this.$message.error((data && data.msg) || '删除失败') |
|||
} |
|||
}).catch(err => { |
|||
this.$message.error('删除失败: ' + err.message) |
|||
}) |
|||
}).catch(() => {}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.pi-search-form { margin-top:0; } |
|||
.pi-form { margin-top:-5px; } |
|||
.customer-a { |
|||
color: #409EFF; |
|||
cursor: pointer; |
|||
text-decoration: none; |
|||
} |
|||
.customer-a:hover { |
|||
text-decoration: underline; |
|||
} |
|||
.customer-bun-min { |
|||
margin-right: 8px; |
|||
} |
|||
.sub-title { |
|||
font-weight: 600; |
|||
margin: 16px 0 8px 0; |
|||
padding-left: 4px; |
|||
border-left: 4px solid #409eff; |
|||
line-height: 1.2; |
|||
color: #303133; |
|||
} |
|||
.status-badge { |
|||
display: inline-block; |
|||
padding: 2px 8px; |
|||
border-radius: 4px; |
|||
font-size: 12px; |
|||
} |
|||
.status-sent { background-color: #e6f7ff; color: #409eff; } |
|||
.status-closed { background-color: #fef0e6; color: #e6a23c; } |
|||
.material-action-btn { |
|||
color: #409EFF; |
|||
cursor: pointer; |
|||
margin: 0 4px; |
|||
} |
|||
.material-action-btn:hover { |
|||
text-decoration: underline; |
|||
} |
|||
.dialog-footer { |
|||
text-align: center; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue