离线物料请购

This commit is contained in:
lixin
2018-12-08 17:57:45 +08:00
parent edc0d229f8
commit 4a65c762a3
2 changed files with 176 additions and 470 deletions

View File

@@ -0,0 +1,88 @@
import request from '@/utils/request'
// 请购单查询
export function searchRequestCard(pageCurrent, pageSize, card_check, card) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_离线请购单_请购单查询',
param: '请购单编号_check=' + card_check + '&请购单编号=' + card,
Pagination: pageCurrent + '&' + pageSize
}
})
}
// 请购单增加
export function addRequestCard(peoplenumber, housenumber) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: 'dbo.库存管理_离线请购单_请购单增加',
param: '请购人编号=' + peoplenumber + '&仓库流水号=' + housenumber
}
})
}
// 查询仓库
export function initWarehouse() {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_货位仓库_仓库_查询数据'
}
})
}
// 查询库存数
export function searchInventoryNum(pageCurrent, pageSize, check1, name, check2, state1) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_离线物料_物料余量_查询数据',
param: `物料名称_check=${check1}&物料名称=${name}&库存状态_check=${check2}&库存状态=${state1}`,
Pagination: pageCurrent + '&' + pageSize
}
})
}
// 查询请购单明细
export function SeeDetail(data) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_离线请购单_请购单明细查询',
param: '离线请购单流水号=' + data
}
})
}
// 请购单明细增加
export function addRequestCardDetail(data1, data2) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '库存管理_离线请购单_请购单明细增加',
param: '离线请购单流水号=' + data1 + '&物料流水号组=' + data2
}
})
}
// 请购单明细增加
export function alterNumber(data1, data2) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '库存管理_离线请购单_请购单明细修改',
param: '离线请购单明细流水号=' + data1 + '&数量=' + data2
}
})
}

View File

@@ -26,7 +26,6 @@
style="margin-left: 10px"
@click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading="loading1"
@@ -104,7 +103,15 @@
<el-card>
<span>请购单号:</span>
<el-input v-model="offlineContract" placeholder="离线合同号" size="small" clearable/>
<el-input v-model="purchasecard" placeholder="请购单号" size="small" clearable/>
<span>仓库:</span>
<el-select v-model="HouseNumber" placeholder="请选择仓库" size="small" @change="searchDemo();payMethodChange()">
<el-option
v-for="item in House"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
@@ -116,7 +123,7 @@
size="small"
icon="el-icon-plus"
style="margin-left: 10px"
@click="addOfflineContract">创建离线请购单</el-button>
@click="addTableData">创建离线请购单</el-button>
<el-button
type="primary"
size="small"
@@ -129,47 +136,34 @@
<el-table v-loading="" :data="tableData2" border style="max-height: 300px;" height="300px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table-column label="请购单状态" align="center" width="80" fixed="left">
<template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.离线合同状态)===1" type="warning" size="small">编辑中</el-tag>
<el-tag v-if="parseInt(scope.row.离线合同状态)===2" type="primary" size="small">采购中</el-tag>
<el-tag v-if="parseInt(scope.row.离线合同状态)===4" type="success" size="small">已到货</el-tag>
<el-tag v-if="parseInt(scope.row.离线合同状态)===5" type="info" size="small">已作废</el-tag>
<el-tag v-if="parseInt(scope.row.是否传递)===0" type="warning" size="small">未传递</el-tag>
<el-tag v-if="parseInt(scope.row.是否传递)===1" type="primary" size="small">已传递</el-tag>
</template>
</el-table-column>
<el-table-column label="请购单编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
{{ scope.row.请购单编号 }}
</template>
</el-table-column>
<el-table-column label="请购单名称" align="center" min-width="150">
<el-table-column label="请购人编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同名称 }}
{{ scope.row.请购人编号 }}
</template>
</el-table-column>
<el-table-column label="请购人" align="center" min-width="250">
<el-table-column label="仓库流水号" align="center" min-width="250">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="仓库" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.采购员 }}
{{ scope.row.仓库流水号 }}
</template>
</el-table-column>
<el-table-column label="请购时间" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.规定到货时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="付款方式" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.付款方式内容 }}
{{ scope.row.请购时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="280" fixed="right">
<template slot-scope="scope">
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="primary" size="mini" icon="el-icon-edit" @click="editOfflineContract(scope.row)">编辑</el-button>
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="danger" size="mini" icon="el-icon-delete" @click="deleteOfflineContract(scope.row)">作废</el-button>
<el-button type="warning" size="mini" icon="el-icon-download">导出</el-button>
<el-button type="warning" size="mini" icon="el-icon-download">传递</el-button>
</template>
</el-table-column>
</el-table>
@@ -185,9 +179,9 @@
@current-change="handleCurrentChange2"/>
</div>
<el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 300px;" height="300px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<el-table-column label="离线请购单编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
{{ scope.row.请购单编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
@@ -210,21 +204,6 @@
<el-input v-model="scope.row.数量" :disabled="disable" size="mini" style="width:70px"/>
</template>
</el-table-column>
<el-table-column label="参考价格" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.参考价格 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="100" prop="单价">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" :disabled="disable" size="mini" style="width:70px"/>
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="100">
<template slot-scope="scope">
<el-button :disabled="disable" type="danger" size="mini" icon="el-icon-delete" @click="deleteMateriel(scope.row)">移除</el-button>
@@ -346,14 +325,15 @@
</template>
<script>
import { searchInventoryNum, searchOfflineContract, searchOfflineContract2, searchSupplier, initPayMethod, initPayTimeNode, addOfflineContract, editOfflineContract, deleteOfflineContract, searchMateriel,
addMateriel, deleteMateriel, doneOfflineContact, searchContractDemo, setSafeValue } from '@/api/PurchasingCenter/OfflineContract'
import { searchRequestCard, initWarehouse, addRequestCard, searchInventoryNum, SeeDetail, addRequestCardDetail } from '@/api/Inventory/OfflinePurchase'
import { mapGetters } from 'vuex'
export default {
name: '', // 离线合同
data() {
return {
purchasecard: '',
purchasecard_check: 1,
loading1: false,
title2: '',
purchaseStateValue: 2, // 采购状态 全部
@@ -372,6 +352,7 @@ export default {
check4: 0,
materialName: '',
inventoryStateValue: '', // 库存状态
inventoryStateValue_check: 1,
inventoryState: [
{
label: '充足',
@@ -398,54 +379,8 @@ export default {
pageSize2: 10,
dialogVisible1: false,
form1: {},
supplierCheck1: 0,
supplierCheck2: 0,
supplierCheck3: 0,
supplierCheck4: 0,
supplierCheck5: 0,
supplierCheck6: 0,
supplierCheck7: 0,
supplierCheck8: 0,
supplierCheck9: 0,
supplierCheck10: 0,
supplierCheck11: 0,
supplierCheck12: 0,
supplierValue: '', // 供应商流水号
goodTime: '', // 货期
enterpriseNature: '', // 企业性质
createDate: '', // 创立日期
registeredCapital: '', // 注册资本
taxNum: '', // 税号
EMail: '', // 电子邮箱
address: '', // 地址
account: '', // 账号
openingBank: '', // 开户行
phone: '', // 电话号码
fax: '', // 传真
tableData01: [],
dialogVisible2: false,
form2: {
离线合同流水号: '',
离线合同编号: '',
离线合同名称: '',
供应商流水号: '',
供应商名称: '',
规定到货时间: '',
运费: '',
付款方式: '',
第一次付款时间: 1,
第二次付款时间: 1,
第三次付款时间: 1,
第四次付款时间: 1
},
rules2: { // 离线合同表单验证规则
离线合同编号: [{ required: true, message: '请填写离线合同编号' }],
离线合同名称: [{ required: true, message: '请填写离线合同名称' }],
供应商名称: [{ required: true, message: '请选择供应商' }],
规定到货时间: [{ required: true, message: '请选择规定到货时间' }],
运费: [{ required: true, message: '请填写运费' }],
付款方式: [{ required: true, message: '请选择付款方式' }]
},
tableData3: [],
textArea: '请选择',
materielGroup: [], // 物料流水号组
@@ -460,7 +395,9 @@ export default {
disable2: true,
disable3: true,
disable4: true,
disable: true // 其他的禁用
disable: true, // 其他的禁用
House: [],
HouseNumber: ''
}
},
computed: {
@@ -476,49 +413,67 @@ export default {
},
methods: {
fetchData() {
initPayMethod().then(response => { // 初始化付款方式
initWarehouse().then(response => { // 初始化仓库
console.log(response)
for (let i = 0; i < response.data.length; i++) {
this.payMethod.push({
label: response.data[i].付款方式内容,
value: response.data[i].付款方式流水号
this.House.push({
label: response.data[i].仓库名称,
value: response.data[i].仓库流水号
})
}
})
initPayTimeNode().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.payTime.push({
label: response.data[i].付款时间节点名称,
value: response.data[i].付款时间节点流水号
})
}
})
searchContractDemo().then(response => { // 初始化合同模板
this.tableData4 = response.data
})
},
searchTable1() { // 查询物料库物料
this.loading1 = true
this.materialName ? this.check1 = 1 : this.check1 = 0
this.inventoryStateValue ? this.check2 = 1 : this.check2 = 0
searchInventoryNum(this.pageCurrent1, this.pageSize1, this.check1, this.materialName, this.check2, this.inventoryStateValue, this.purchaseStateValue).then(response => {
// 查询离线物料请购单
searchTable2() {
if (this.purchasecard === '') {
this.purchasecard_check = 0
}
searchRequestCard(this.pageCurrent2, this.pageSize2, this.purchasecard_check, this.purchasecard).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
// 查询离线物料请购单明细
searchTable3(row) {
this.purchasecardnumber = row.离线请购单流水号
SeeDetail(this.purchasecardnumber).then(response => {
this.tableData3 = response.data
})
},
// 查询离线物料数量
searchTable1() {
if (this.materialName === '') {
this.materialName_check = 0
}
if (this.inventoryStateValue === '') {
this.inventoryStateValue_check = 0
}
searchInventoryNum(this.pageCurrent1, this.pageSize1, this.materialName_check, this.materialName, this.inventoryStateValue_check, this.inventoryStateValue).then(response => {
this.tableData1 = response.data.rows
this.tableData1.map(v => {
this.$set(v, 'changeSafeValue', false)
v.原安全库存量 = v.安全库存量
return v
})
this.total1 = response.data.total
this.loading1 = false
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
handleSizeChange2(val) { // 离线请购单列表分页
this.pageSize2 = val
this.searchTable2()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
handleCurrentChange2(val) { // 离线请购单列表分页
this.pageCurrent2 = val
this.searchTable2()
},
// 增加请购单
addTableData() {
if (this.HouseNumber === '') {
this.$message.error('请选择仓库')
}
console.log(this.id, this.HouseNumber)
addRequestCard(this.id, this.HouseNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.error('添加成功')
} else {
this.$message.error('添加失败')
}
})
},
handleSelectionChange(val) {
this.materielGroup = []
@@ -526,357 +481,20 @@ export default {
this.materielGroup.push(val[i].物料流水号)
}
},
cancelEdit(row) { // 取消设置
row.安全库存量 = row.原安全库存量
row.changeSafeValue = false
this.$message('取消修改')
},
confirmEdit(row) { // 确认设置
Number(row.安全库存量) ? row.安全库存量 = Number(row.安全库存量) : row.安全库存量 = 0
setSafeValue(row.物料流水号, parseInt(row.安全库存量)).then(response => {
if (response.data[0].result === '1') {
row.changeSafeValue = false
this.$message.success('设置成功')
this.searchTable1()
} else {
this.$message.error('设置失败')
}
})
},
searchTable2() { // 查询离线合同列表
this.offlineContract ? this.check3 = 1 : this.check3 = 0
this.supplierName0 ? this.check4 = 1 : this.check4 = 0
searchOfflineContract(this.pageCurrent2, this.pageSize2, this.check3, this.offlineContract, this.check4, this.supplierName0).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) { // 离线合同列表分页
this.pageSize2 = val
this.searchTable2()
},
handleCurrentChange2(val) { // 离线合同列表分页
this.pageCurrent2 = val
this.searchTable2()
},
addOfflineContract() { // 创建离线合同
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.title2 = '创建离线合同'
this.form2.离线合同编号 = ''
this.form2.离线合同名称 = ''
this.form2.供应商流水号 = ''
this.form2.供应商名称 = ''
this.form2.规定到货时间 = ''
this.form2.运费 = ''
this.form2.付款方式 = ''
this.form2.第一次付款时间 = 1
this.form2.第二次付款时间 = 0
this.form2.第三次付款时间 = 0
this.form2.第四次付款时间 = 0
this.dialogVisible2 = true
},
editOfflineContract(row) {
console.log(row)
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.title2 = '编辑离线合同'
this.form2.离线合同流水号 = row.离线合同流水号
this.form2.离线合同编号 = row.离线合同编号
this.form2.离线合同名称 = row.离线合同名称
this.form2.供应商流水号 = row.供应商流水号
this.form2.供应商名称 = row.供应商名称
this.form2.规定到货时间 = row.规定到货时间
this.form2.运费 = row.运费
this.form2.付款方式 = parseInt(row.付款方式流水号)
this.form2.第一次付款时间 = parseInt(row.第一次付款时间节点流水号)
this.form2.第二次付款时间 = parseInt(row.第二次付款时间节点流水号)
this.form2.第三次付款时间 = parseInt(row.第三次付款时间节点流水号)
this.form2.第四次付款时间 = parseInt(row.第四次付款时间节点流水号)
this.payMethodChange()
this.dialogVisible2 = true
},
submitEditOfflineContract() {
this.$refs['form2'].validate((valid) => {
if (valid) {
this.disable2 ? this.form2.第二次付款时间 = 0 : this.form2.第二次付款时间
this.disable3 ? this.form2.第三次付款时间 = 0 : this.form2.第三次付款时间
this.disable4 ? this.form2.第四次付款时间 = 0 : this.form2.第四次付款时间
const numGroup1 = [] // 空数组,放现有的离线合同号
const numGroup2 = [] // 空数组,放现有的离线合同流水号
searchOfflineContract2().then(response => { // 先查询判断是否存在
for (let i = 0; i < response.data.length; i++) {
numGroup1.push(response.data[i].离线合同编号)
numGroup2.push(response.data[i].离线合同流水号)
}
}).then(() => {
if (numGroup1.indexOf(this.form2.离线合同编号) !== -1 && numGroup1.indexOf(this.form2.离线合同编号) !== numGroup2.indexOf(parseInt(this.form2.离线合同流水号))) {
this.$message.error('该离线合同编号已存在')
} else {
editOfflineContract(this.form2.离线合同流水号, this.form2.离线合同编号, this.form2.离线合同名称, this.form2.供应商流水号, this.id, this.form2.规定到货时间, this.form2.运费, this.form2.付款方式, this.form2.第一次付款时间, this.form2.第二次付款时间, this.form2.第三次付款时间, this.form2.第四次付款时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改离线合同成功')
this.searchTable2()
this.dialogVisible2 = false
} else { this.$message.error('修改离线合同失败') }
})
}
})
} else {
console.log('error submit!!')
return false
}
})
},
deleteOfflineContract(row) { // 作废离线合同
this.$confirm('确定作废该合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOfflineContract(row.离线合同流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('作废成功')
this.searchTable2()
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('作废失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消作废'
})
})
},
submitAddOfflineContract() { // 新建离线合同
this.$refs['form2'].validate((valid) => {
if (valid) {
this.disable2 ? this.form2.第二次付款时间 = 0 : this.form2.第二次付款时间
this.disable3 ? this.form2.第三次付款时间 = 0 : this.form2.第三次付款时间
this.disable4 ? this.form2.第四次付款时间 = 0 : this.form2.第四次付款时间
const numGroup1 = [] // 空数组,放现有的询价单号
searchOfflineContract2().then(response => { // 先查询判断是否存在
for (let i = 0; i < response.data.length; i++) {
numGroup1.push(response.data[i].离线合同编号)
}
}).then(() => {
if (numGroup1.indexOf(this.form2.离线合同编号) !== -1) {
this.$message.error('该离线合同编号已存在')
} else {
addOfflineContract(this.form2.离线合同编号, this.form2.离线合同名称, this.form2.供应商流水号, this.id, this.form2.规定到货时间, this.form2.运费, this.form2.付款方式, this.form2.第一次付款时间, this.form2.第二次付款时间, this.form2.第三次付款时间, this.form2.第四次付款时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('新建离线合同成功')
this.searchTable2()
this.dialogVisible2 = false
} else { this.$message.error('新建离线合同失败') }
})
}
})
} else {
console.log('error submit!!')
return false
}
})
},
searchSupplier() { // 查询创立日期和注册资本大于符合条件的数据
this.supplierName ? this.supplierCheck1 = 1 : (this.supplierCheck1 = 0, this.supplierName = '')
this.enterpriseNature ? this.supplierCheck2 = 1 : (this.supplierCheck2 = 0, this.enterpriseNature = '')
this.createDate ? this.supplierCheck3 = 1 : (this.supplierCheck3 = 0, this.createDate = '')
this.registeredCapital ? this.supplierCheck4 = 1 : (this.supplierCheck4 = 0, this.registeredCapital = '')
this.taxNum ? this.supplierCheck5 = 1 : (this.supplierCheck5 = 0, this.taxNum = '')
this.EMail ? this.supplierCheck6 = 1 : (this.supplierCheck6 = 0, this.EMail = '')
this.address ? this.supplierCheck7 = 1 : (this.supplierCheck7 = 0, this.address = '')
this.account ? this.supplierCheck8 = 1 : (this.supplierCheck8 = 0, this.account = '')
this.openingBank ? this.supplierCheck9 = 1 : (this.supplierCheck9 = 0, this.openingBank = '')
this.phone ? this.supplierCheck10 = 1 : (this.supplierCheck10 = 0, this.phone = '')
this.fax ? this.supplierCheck11 = 1 : (this.supplierCheck11 = 0, this.fax = '')
this.goodTime ? this.supplierCheck12 = 1 : (this.supplierCheck12 = 0, this.goodTime = '')
searchSupplier(this.supplierCheck1, this.supplierName, this.supplierCheck2, this.enterpriseNature, this.supplierCheck3, this.createDate, this.supplierCheck4, this.registeredCapital, this.supplierCheck5, this.taxNum, this.supplierCheck6, this.EMail, this.supplierCheck7, this.address, this.supplierCheck8, this.account, this.supplierCheck9, this.openingBank, this.supplierCheck10, this.phone, this.supplierCheck11, this.fax, this.supplierCheck12, this.goodTime).then(response => {
this.tableData01 = response.data
})
},
showSupplierDetail(row) {
this.form2.供应商流水号 = row.供应商流水号
this.form2.供应商名称 = row.供应商名称
this.supplierValue = row.供应商流水号
this.supplierName = row.供应商名称
this.enterpriseNature = row.企业性质
this.createDate = row.创立日期
this.registeredCapital = row.注册资本
this.taxNum = row.税号
this.EMail = row.电子信箱
this.address = row.地址
this.account = row.帐号
this.openingBank = row.开户行
this.phone = row.电话号码
this.fax = row.传真
this.goodTime = row.货期
},
emptySupplierDetail() {
this.supplierValue = ''
this.supplierName = ''
this.enterpriseNature = ''
this.createDate = ''
this.registeredCapital = ''
this.taxNum = ''
this.EMail = ''
this.address = ''
this.account = ''
this.openingBank = ''
this.phone = ''
this.fax = ''
this.goodTime = ''
},
submitSelectSupplier() { // 确定选择供应商
this.dialogVisible1 = false
},
searchTable3(row) { // 查询离线合同明细
this.stipulateArrivalTime = row.规定到货时间.split(' ')[0]
this.payMethodName = row.付款方式内容
this.offlineContractNum = row.离线合同流水号
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
})
this.textArea = row.合同文本
if (parseInt(row.离线合同状态) !== 1) { // 是否未编辑模式
this.disable = true
} else {
this.disable = false
}
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
addMateriel() { // 将物料选入离线合同
addMateriel(this.offlineContractNum, this.materielGroup).then(response => {
if (this.purchasecardnumber === '') {
this.$message.error('请选择请购单')
} else {
addRequestCardDetail(this.purchasecardnumber, this.materielGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('选入成功')
searchMateriel(this.offlineContractNum).then(response => {
SeeDetail(this.purchasecardnumber).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('选入失败') }
})
},
deleteMateriel(row) { // 移除物料
this.$confirm('确定移除该物料?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteMateriel(row.离线合同明细流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移除成功')
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('移除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消移除'
})
})
},
doneOfflineContact() { // 生成离线合同
this.$confirm('确定生成合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.totalPrice = 0
this.partGroup = []
this.numGroup = []
this.priceGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.push(this.tableData3[i].数量)
this.priceGroup.push(this.tableData3[i].单价)
} else {
this.$message.error('选入失败')
}
doneOfflineContact(this.offlineContractNum, this.totalPrice, this.textArea, this.partGroup, this.numGroup, this.priceGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离线合同生成成功')
this.searchTable2()
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('离线合同生成失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
searchDemo(row = this.paramRow) {
for (let i = 0; i < this.payMethod.length; i++) {
if (this.payMethod[i].value === this.payMethodValue) {
this.payMethodName = this.payMethod[i].label
}
}
this.paramRow = row
if (!this.disable) {
searchContractDemo(this.paramRow.合同模板流水号).then(response => {
this.textArea = response.data[0].合同模板内容.replace('stipulateArrivalTime', this.stipulateArrivalTime).replace('payMethodName', this.payMethodName)
})
}
},
payMethodChange() { // 付款方式改变
for (let i = 0; i < this.payMethod.length; i++) {
if (this.payMethod[i].value === this.form2.付款方式) {
this.payMethodName = this.payMethod[i].label
}
}
const payTimeNum = this.payMethodName.split(':')
switch (payTimeNum.length) {
case 1:
this.disable2 = true
this.disable3 = true
this.disable4 = true
break
case 2:
this.disable2 = false
this.disable3 = true
this.disable4 = true
break
case 3:
this.disable2 = false
this.disable3 = false
this.disable4 = true
break
case 4:
this.disable2 = false
this.disable3 = false
this.disable4 = false
break
}
}
}