Merge branch 'master' of http://192.168.0.112:10010/r/高精2.0
This commit is contained in:
@@ -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 (response.data[0].result === '1') {
|
||||
this.$message.success('选入成功')
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('选入失败') }
|
||||
})
|
||||
},
|
||||
deleteMateriel(row) { // 移除物料
|
||||
this.$confirm('确定移除该物料?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteMateriel(row.离线合同明细流水号).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 => {
|
||||
this.$message.success('选入成功')
|
||||
SeeDetail(this.purchasecardnumber).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('移除失败') }
|
||||
} 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].单价)
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
532
src/views/PurchasingCenter/CreatePurchaseContract/index.vue
Normal file
532
src/views/PurchasingCenter/CreatePurchaseContract/index.vue
Normal file
@@ -0,0 +1,532 @@
|
||||
<template>
|
||||
<div class="components-container">
|
||||
<el-card>
|
||||
<el-form label-width="90px" label-position="right">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="合同编号:">
|
||||
<el-select v-model="contractNumValue" filterable size="small" placeholder="合同编号" style="width:100%" @change="contractChange">
|
||||
<el-option
|
||||
v-for="item in contractNums"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="供应商:">
|
||||
<el-input v-model="supplierName" size="small" readonly/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="合同名称:">
|
||||
<el-input v-model="contractName" size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="是否含税:">
|
||||
<el-input v-model="taxRate" size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<el-tooltip :content="haTtax" placement="top">
|
||||
<el-switch
|
||||
v-model="haTtax"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="含税"
|
||||
inactive-value="未税"
|
||||
style="margin: 10px"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="支付日期:">
|
||||
<el-input v-model="payDate" size="small" type="textarea" rows="1"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="支付方式:">
|
||||
<el-input v-model="payMethod" size="small" type="textarea" rows="1"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开票信息:">
|
||||
<el-input v-model="invoiceInfo" size="small" type="textarea" rows="1"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="其他说明:">
|
||||
<el-input v-model="otherInfo" size="small" type="textarea" rows="1"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-table :data="tableData1" border style="margin-bottom: 10px;max-height: 300px;" height="300px" size="mini" show-summary>
|
||||
<el-table-column label="序号" align="center" width="50" type="index"/>
|
||||
<el-table-column label="物料计划到货时间" align="center" min-width="130">
|
||||
<template slot-scope="scope">
|
||||
<el-date-picker
|
||||
v-model="scope.row.物料计划到货时间"
|
||||
size="mini"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 130px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料规格型号" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料规格 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订货数量" align="center" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.订货数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-show="haTtax==='未税'" label="单价(未税)" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-show="haTtax==='未税'" v-model="scope.row.未税单价" size="mini" style="width:70px"/>
|
||||
<span v-show="haTtax!=='未税'">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-show="haTtax==='含税'" label="单价(含税)" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-show="haTtax==='含税'" v-model="scope.row.含税单价" size="mini" style="width:70px"/>
|
||||
<span v-show="haTtax!=='含税'">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总额(未税)" align="center" min-width="100" prop="未税总额">
|
||||
<template slot-scope="scope">
|
||||
{{ haTtax==='未税' ? scope.row.未税总额 = (Number(scope.row.订货数量) * Number(scope.row.未税单价)).toFixed(2) : scope.row.未税总额 = (scope.row.含税总额 / (1+taxRate)).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总额(含税)" align="center" min-width="100" prop="含税总额">
|
||||
<template slot-scope="scope">
|
||||
{{ haTtax==='含税' ? scope.row.含税总额 = (Number(scope.row.订货数量) * Number(scope.row.含税单价)).toFixed(2) : scope.row.含税总额 = (scope.row.未税总额 * (1+taxRate)).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<span>合同模板:</span>
|
||||
<el-radio-group v-model="demoRadio" size="small" @change="demoChange">
|
||||
<el-radio-button label="模板1"/>
|
||||
<el-radio-button label="模板2"/>
|
||||
<el-radio-button label="模板3"/>
|
||||
<el-radio-button label="自定义"/>
|
||||
</el-radio-group>
|
||||
<el-button type="primary" plain size="small" style="margin-left:10px;" @click="editContract()">调整合同</el-button>
|
||||
<el-button type="success" size="small" @click="generateContract()">生成合同</el-button>
|
||||
<div style="float: right">
|
||||
<span>合同总额:</span>
|
||||
<el-input v-model="actualTotal" size="small" style="width: 100px"/>
|
||||
<el-button type="primary" size="small" @click="submitTotal()">确定总额</el-button>
|
||||
</div>
|
||||
<hr>
|
||||
<!--html代码-->
|
||||
<div v-show="false">{{ content }}</div>
|
||||
<!--富文本编辑器-->
|
||||
<div v-show="!preview" id="tinymce" style="height:650px;">
|
||||
<tinymce ref="tinymce" :height="500" v-model="contentNew" style="width:800px;margin: 0 auto"/>
|
||||
</div>
|
||||
<!--网页预览-->
|
||||
<div v-show="preview" class="editor-content" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="content"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Tinymce from '@/components/Tinymce'
|
||||
import QRCode from 'qrcode'
|
||||
import { searchInquirySheet, searchSheetContract } from '@/api/PurchasingCenter/CreatePurchaseContract'
|
||||
import { convertCurrency } from '@/vendor/int2Chinese'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: { Tinymce },
|
||||
data() {
|
||||
return {
|
||||
haTtax: '未税',
|
||||
taxRate: 0.16,
|
||||
preview: false, // 预览
|
||||
demoRadio: '自定义', // 模板radio
|
||||
content: ``, // 合同格式模板
|
||||
contentNew: ``, // tinymce的
|
||||
contractName: '采购合同', // 合同名称
|
||||
contractNum: '', // 合同编号
|
||||
contractNums: [], // 合同编号数组
|
||||
contractNumValue: '', // 合同流水号
|
||||
supplierName: '', // 供应商名称
|
||||
supplierAddress: '', // 供应商地址
|
||||
untaxTotal: '', // 未税合计
|
||||
tax: '', // 税额
|
||||
taxTotal: '', // 含税合计
|
||||
actualTotal: '', // 实际金额
|
||||
actualTotal_zh: '', // 实际金额大写
|
||||
payDate: '', // 支付日期
|
||||
payMethod: '', // 支付方式
|
||||
invoiceInfo: '', // 开票信息
|
||||
otherInfo: '', // 其他说明
|
||||
tableData1: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'avatar',
|
||||
'name',
|
||||
'id'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
searchInquirySheet(0, 0, 0, 0, 1, this.id).then(response => { // 初始化询价单号
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.contractNums.push({
|
||||
value: response.data[i].询价单流水号,
|
||||
label: response.data[i].询价单编号,
|
||||
supplierName: response.data[i].供应商名称
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
submitTotal() { // 确定合同总额
|
||||
this.$refs.tinymce.destroyTinymce()
|
||||
document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal
|
||||
document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal
|
||||
document.getElementById('actualTotal_zh').innerHTML = convertCurrency(this.actualTotal)
|
||||
this.contentNew = document.getElementsByClassName('editor-content')[0].innerHTML
|
||||
this.$refs.tinymce.initTinymce()
|
||||
},
|
||||
contractChange() { // 选择合同select
|
||||
for (let i = 0; i < this.contractNums.length; i++) {
|
||||
if (this.contractNums[i].value === this.contractNumValue) {
|
||||
this.supplierName = this.contractNums[i].supplierName
|
||||
this.contractNum = this.contractNums[i].label
|
||||
}
|
||||
}
|
||||
this.searchContractDetail()
|
||||
},
|
||||
searchContractDetail() { // 查询合同明细
|
||||
this.tableData1 = []
|
||||
searchSheetContract(this.contractNumValue).then(response => {
|
||||
console.log(response.data)
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.tableData1.push({
|
||||
物料计划到货时间: response.data[i].物料计划到货时间,
|
||||
物料名称: response.data[i].物料名称,
|
||||
物料规格: response.data[i].物料规格,
|
||||
订货数量: response.data[i].订货数量,
|
||||
未税单价: 0,
|
||||
未税总额: 0,
|
||||
含税单价: 0,
|
||||
含税总额: 0
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.tableData1)
|
||||
},
|
||||
demoChange() { // 模板change
|
||||
switch (this.demoRadio) {
|
||||
case '模板1':
|
||||
this.demo1()
|
||||
break
|
||||
case '模板2':
|
||||
this.demo2()
|
||||
break
|
||||
case '模板3':
|
||||
this.demo3()
|
||||
break
|
||||
case '自定义':
|
||||
this.customization()
|
||||
break
|
||||
}
|
||||
},
|
||||
demo1() { // 选择合同模板1
|
||||
this.content = `
|
||||
<h1 style="text-align: center;">
|
||||
<strong>采购合同</strong>
|
||||
</h1>
|
||||
<table style="border-collapse: collapse; width: 100%;" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 25%; text-align: center;" rowspan="2">
|
||||
<h1>
|
||||
<strong>GAOJING</strong>
|
||||
</h1>
|
||||
</td>
|
||||
<td style="width: 25%;">
|
||||
<h4 style="text-align: center;">合同名称:</h4>
|
||||
</td>
|
||||
<td id="contractName" style="width: 25%;"> </td>
|
||||
<td style="width: 25%;" rowspan="2"><img id="qrCode"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">
|
||||
<h4 style="text-align: center;">合同编号:</h4>
|
||||
</td>
|
||||
<td id="contractNum" style="width: 25%;"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="border-collapse: collapse; width: 100%;" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 25%;">买方:</td>
|
||||
<td style="width: 25%;">江苏高精机电装配有限公司</td>
|
||||
<td style="width: 25%;">卖方:</td>
|
||||
<td id="supplierName" style="width: 25%;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">地址:</td>
|
||||
<td style="width: 25%;">盐城市开放大道666号</td>
|
||||
<td style="width: 25%;">地址:</td>
|
||||
<td id="supplierAddress" style="width: 25%;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">法定代表人:</td>
|
||||
<td style="width: 25%;">徐秀兵</td>
|
||||
<td style="width: 25%;">法定代表人:</td>
|
||||
<td style="width: 25%;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">电话:</td>
|
||||
<td style="width: 25%;"> </td>
|
||||
<td style="width: 25%;">电话:</td>
|
||||
<td style="width: 25%;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">传真:</td>
|
||||
<td style="width: 25%;"> </td>
|
||||
<td style="width: 25%;">传真:</td>
|
||||
<td style="width: 25%;"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>根据中华人民共和国合同法及相关法律法规,经买卖双方平等协商,就卖方向买方出售合同项下产品事宜达成一致,签订本合同(明细表及合同通用条款)如下:</p>
|
||||
<table style="border-collapse: collapse; width: 100%;"
|
||||
border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 25%;">合同总额(人民币含税):</td>
|
||||
<td class="actualTotal" style="width: 25%;"></td>
|
||||
<td style="width: 25%;">大写:</td>
|
||||
<td id="actualTotal_zh" style="width: 25%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">交货日期:</td>
|
||||
<td style="width: 25%;" colspan="3"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;" rowspan="3">交货地点:</td>
|
||||
<td style="width: 25%;">地址:</td>
|
||||
<td style="width: 25%;" colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">联系人:</td>
|
||||
<td style="width: 25%;" colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">联系电话:</td>
|
||||
<td style="width: 25%;" colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">开票信息:</td>
|
||||
<td style="width: 25%;" colspan="3">
|
||||
<p id="invoiceInfo"> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">支付日期:</td>
|
||||
<td style="width: 25%;" colspan="3">
|
||||
<p id="payDate"> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">支付方式:</td>
|
||||
<td style="width: 25%;" colspan="3">
|
||||
<p id="payMethod"> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 25%;">其他说明:</td>
|
||||
<td style="width: 25%;" colspan="3">
|
||||
<p id="otherInfo"> </p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="border-collapse: collapse; width: 100%;" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 50%;">
|
||||
<p>买方:</p>
|
||||
<p>(盖章)</p>
|
||||
<p>授权代表人:_______________</p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
</td>
|
||||
<td style="width: 50%;">
|
||||
<p>卖方:</p>
|
||||
<p>(盖章)</p>
|
||||
<p>授权代表人:_______________ </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="text-align: right;">日期:______年______月______日</p>
|
||||
<hr />
|
||||
<p style="text-align: center;">
|
||||
<strong>明细表</strong>
|
||||
</p>
|
||||
<table style="border-collapse: collapse; width: 100%;" border="1">
|
||||
<tbody id="tbody">
|
||||
<tr id="tableHead">
|
||||
<td style="width: 5%;">序号</td>
|
||||
<td style="width: 10%;">图号</td>
|
||||
<td style="width: 10%;">名称</td>
|
||||
<td style="width: 10%;">规格型号</td>
|
||||
<td style="width: 5%;">数量</td>
|
||||
<td style="width: 10%;">单价金额</td>
|
||||
<td style="width: 10%;">合计金额</td>
|
||||
<td style="width: 12%;">交货时间</td>
|
||||
<td style="width: 10%;">备注</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<span>未税合计:</span><span id="untaxTotal"></span><br><br>
|
||||
<span>税额:</span><span id="tax"></span><br><br>
|
||||
<span>含税总价(税率17%):</span><span id="taxTotal"></span><br><br>
|
||||
<span>优惠后含税总价:</span><span class="actualTotal"></span><br><br>
|
||||
`
|
||||
},
|
||||
editContract() { // 选择一个询价单,整成合同明细
|
||||
this.$refs.tinymce.destroyTinymce()
|
||||
const opts = {
|
||||
errorCorrectionLevel: 'H',
|
||||
type: 'image/jpeg',
|
||||
rendererOpts: {
|
||||
quality: 0.3
|
||||
}
|
||||
}
|
||||
const str = this.contractNumValue.toString()
|
||||
QRCode.toDataURL(str, opts, function(err, url) {
|
||||
if (err) throw err
|
||||
if (document.getElementById('qrCode')) {
|
||||
const img = document.getElementById('qrCode')
|
||||
img.src = url
|
||||
}
|
||||
})
|
||||
this.supplierAddress = '无锡市新区新畅南路3号'
|
||||
document.getElementById('contractName') ? document.getElementById('contractName').innerHTML = this.contractName : ''
|
||||
document.getElementById('contractNum') ? document.getElementById('contractNum').innerHTML = this.contractNum : ''
|
||||
document.getElementById('supplierName') ? document.getElementById('supplierName').innerHTML = this.supplierName : ''
|
||||
document.getElementById('supplierAddress') ? document.getElementById('supplierAddress').innerHTML = this.supplierAddress : ''
|
||||
document.getElementById('payDate') ? document.getElementById('payDate').innerHTML = this.payDate : ''
|
||||
document.getElementById('payMethod') ? document.getElementById('payMethod').innerHTML = this.payMethod : ''
|
||||
document.getElementById('invoiceInfo') ? document.getElementById('invoiceInfo').innerHTML = this.invoiceInfo : ''
|
||||
document.getElementById('otherInfo') ? document.getElementById('otherInfo').innerHTML = this.otherInfo : ''
|
||||
// 明细表
|
||||
// 移出旧数据
|
||||
const children = document.getElementsByClassName('tableData')
|
||||
const parent = document.getElementById('tbody')
|
||||
if (children.length !== 0) {
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
parent.removeChild(children[i])
|
||||
}
|
||||
}
|
||||
// 放入新数据
|
||||
const tr = []
|
||||
for (let i = 0; i < this.tableData1.length; i++) {
|
||||
tr[i] = document.createElement('tr')
|
||||
tr[i].setAttribute('class', 'tableData')
|
||||
tr[i].innerHTML = '<td style="width: 5%;"></td><td style="width: 10%;"></td><td style="width: 10%;"></td><td style="width: 10%;"></td><td style="width: 5%;"></td><td style="width: 10%;"></td><td style="width: 10%;"></td><td style="width: 12%;"></td><td style="width: 10%;"></td>'
|
||||
document.getElementById('tableHead') ? document.getElementById('tableHead').after(tr[i]) : ''
|
||||
}
|
||||
this.actualTotal = 0
|
||||
this.untaxTotal = 0
|
||||
this.taxTotal = 0
|
||||
for (let j = 0; j < this.tableData1.length; j++) {
|
||||
this.actualTotal += Number(this.tableData1[j].含税总额)
|
||||
this.untaxTotal += Number(this.tableData1[j].未税总额)
|
||||
this.taxTotal += Number(this.tableData1[j].含税总额)
|
||||
if (document.getElementsByClassName('tableData')[j]) {
|
||||
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
|
||||
document.getElementsByClassName('tableData')[j].children[1].innerHTML = `图号` + j
|
||||
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData1[j].物料名称
|
||||
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData1[j].物料规格
|
||||
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData1[j].订货数量
|
||||
this.haTtax === '含税' ? document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.tableData1[j].含税单价 : document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.tableData1[j].未税单价
|
||||
document.getElementsByClassName('tableData')[j].children[6].innerHTML = Number(document.getElementsByClassName('tableData')[j].children[5].innerHTML) * Number(this.tableData1[j].订货数量)
|
||||
this.tableData1[j].物料计划到货时间 ? document.getElementsByClassName('tableData')[j].children[7].innerHTML = this.tableData1[j].物料计划到货时间.split(' ')[0] : document.getElementsByClassName('tableData')[j].children[7].innerHTML = ''
|
||||
document.getElementsByClassName('tableData')[j].children[8].innerHTML = `备注` + j
|
||||
}
|
||||
}
|
||||
this.actualTotal = this.actualTotal.toFixed(2)
|
||||
this.actualTotal = this.untaxTotal.toFixed(2)
|
||||
this.actualTotal = this.taxTotal.toFixed(2)
|
||||
this.tax = this.taxTotal - this.untaxTotal
|
||||
document.getElementById('untaxTotal') ? document.getElementById('untaxTotal').innerHTML = this.untaxTotal : ''
|
||||
document.getElementById('tax') ? document.getElementById('tax').innerHTML = this.tax : ''
|
||||
document.getElementById('taxTotal') ? document.getElementById('taxTotal').innerHTML = this.taxTotal : ''
|
||||
document.getElementsByClassName('actualTotal') ? document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal : ''
|
||||
document.getElementsByClassName('actualTotal') ? document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal : ''
|
||||
document.getElementById('actualTotal_zh') ? document.getElementById('actualTotal_zh').innerHTML = this.actualTotal_zh : ''
|
||||
this.contentNew = document.getElementsByClassName('editor-content')[0].innerHTML
|
||||
this.$refs.tinymce.initTinymce()
|
||||
},
|
||||
demo2() {
|
||||
this.content = `demo2`
|
||||
},
|
||||
demo3() {
|
||||
this.content = `demo3`
|
||||
},
|
||||
customization() { // 自定义
|
||||
this.content = `自定义`
|
||||
},
|
||||
generateContract() { // 生成采购合同
|
||||
this.content = this.contentNew // 更新tinymce中的东西到html中,后续会用到
|
||||
if (this.contractNumValue) {
|
||||
this.$confirm('此操作将生成采购合同,确认完成编辑?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('请先选择合同进行编辑')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.editor-content{
|
||||
margin-top: 20px;
|
||||
}
|
||||
span{
|
||||
margin: 0 0 0 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -3,30 +3,61 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="16">
|
||||
<el-card>
|
||||
<span style="margin:0">项目名称:</span>
|
||||
<el-select v-model="projectValue" placeholder="项目名称" size="small" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in project"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span>物料名称:</span>
|
||||
<el-input v-model="materialName" placeholder="物料名称" style="width:170px" size="small" clearable/>
|
||||
<span>分配情况:</span>
|
||||
<el-select v-model="allocateStateValue" placeholder="分配情况" size="small" style="width: 100px">
|
||||
<el-option
|
||||
v-for="item in allocateState"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
icon="el-icon-search"
|
||||
style="margin-left: 10px"
|
||||
@click="pageCurrent1=1;pageSize1=20;total1=0;searchTable1()">查询</el-button>
|
||||
<el-row style="margin-bottom: 10px">
|
||||
<span style="margin-left: 0">物料类别:</span>
|
||||
<el-select
|
||||
v-model="MaterialCategoryValue"
|
||||
style="width:150px"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
clearable
|
||||
@change="searchMaterialVariety">
|
||||
<el-option
|
||||
v-for="item in MaterialCategory"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span>物料品种:</span>
|
||||
<el-select
|
||||
v-model="MaterialVarietyValue"
|
||||
style="width:150px"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
clearable>
|
||||
<el-option
|
||||
v-for="item in MaterialVariety"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span>物料名称:</span>
|
||||
<el-input v-model="materialName" placeholder="物料名称" style="width:170px" size="small" clearable/>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
icon="el-icon-search"
|
||||
style="margin-left: 10px"
|
||||
@click="pageCurrent1=1;pageSize1=20;total1=0;searchTable1()">查询</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<span style="margin-left: 0">项目名称:</span>
|
||||
<el-select v-model="projectValue" placeholder="项目名称" size="small" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in project"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span>分配情况:</span>
|
||||
<el-select v-model="allocateStateValue" placeholder="分配情况" size="small" style="width: 100px">
|
||||
<el-option
|
||||
v-for="item in allocateState"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -71,27 +102,42 @@
|
||||
{{ scope.row.项目名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料名称" min-width="150px">
|
||||
<el-table-column align="center" label="物料类别" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
{{ scope.row.物料类别 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料型号" min-width="150px">
|
||||
<el-table-column align="center" label="物料品种" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料品种 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="图号" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料型号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="物料规格" min-width="150px">
|
||||
<el-table-column align="center" label="名称" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="规格" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料规格 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="零件数量" min-width="80px">
|
||||
<el-table-column align="center" label="数量" min-width="80px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="供货商" min-width="150px">
|
||||
<el-table-column align="center" label="备注" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.备注 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="供货商" min-width="100px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.供货商 }}
|
||||
</template>
|
||||
@@ -123,13 +169,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { initProject, initBuyer, searchTable1, allocateTask, executeReturn } from '@/api/PurchasingCenter/PurchaseTaskAllocate'
|
||||
import { initMaterialCategory, initMaterialVariety, initProject, initBuyer, searchTable1, allocateTask, executeReturn } from '@/api/PurchasingCenter/PurchaseTaskAllocate'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: '', // 采购任务分配
|
||||
data() {
|
||||
return {
|
||||
MaterialCategoryValue: '', // 物料类别
|
||||
MaterialCategory: [], // 物料类别数组
|
||||
MaterialVarietyValue: '', // 物料品种
|
||||
MaterialVariety: [], // 物料品种数组
|
||||
projectValue: '',
|
||||
project: [],
|
||||
materialName: '',
|
||||
@@ -152,6 +202,8 @@ export default {
|
||||
person: [],
|
||||
check1: 0,
|
||||
check2: 0,
|
||||
check3: 0,
|
||||
check4: 0,
|
||||
tableData1: [],
|
||||
standardAndPurchase: [],
|
||||
groupAndPart: [],
|
||||
@@ -170,6 +222,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
this.searchMaterialCategory()
|
||||
},
|
||||
methods: {
|
||||
fetchData() { // 初始化
|
||||
@@ -191,11 +244,24 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
searchMaterialCategory() { // 获取物料类别
|
||||
this.MaterialCategory = []
|
||||
this.MaterialVariety = []
|
||||
this.MaterialCategoryValue = ''
|
||||
this.MaterialVarietyValue = ''
|
||||
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory', [0, this.DepartmentValue])
|
||||
},
|
||||
searchMaterialVariety() { // 初始化物料品种
|
||||
this.MaterialVariety = []
|
||||
this.MaterialVarietyValue = ''
|
||||
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety', this.MaterialCategoryValue)
|
||||
},
|
||||
searchTable1() { // 查询
|
||||
this.projectValue ? this.check1 = 1 : this.check1 = 0
|
||||
this.materialName ? this.check2 = 1 : this.check2 = 0
|
||||
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.projectValue, this.check2, this.materialName, this.allocateStateValue).then(response => {
|
||||
console.log(response.data)
|
||||
this.MaterialCategoryValue ? this.check1 = 1 : this.check1 = 0
|
||||
this.MaterialVarietyValue ? this.check2 = 1 : this.check2 = 0
|
||||
this.projectValue ? this.check3 = 1 : this.check3 = 0
|
||||
this.materialName ? this.check4 = 1 : this.check4 = 0
|
||||
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.MaterialCategoryValue, this.check2, this.MaterialVarietyValue, this.check3, this.projectValue, this.check4, this.materialName, this.allocateStateValue).then(response => {
|
||||
this.tableData1 = response.data.rows
|
||||
this.total1 = response.data.total
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user