This commit is contained in:
liushuai
2019-06-15 17:24:39 +08:00
7 changed files with 165 additions and 95 deletions

View File

@@ -9,7 +9,7 @@ export function initSupplier(num) {
type: '3',
name: `SELECT distinct 供应商流水号,供应商名称
FROM 采购管理_询价单_视图
where 询价单编号 not in(select 采购合同编号 from 采购管理_采购合同_采购部 where 是否启用 = 1) and 采购员流水号 = ${num}`
where not EXISTS (select * from 采购管理_采购合同_采购部 where 是否启用 = 1 and 是否未通过 is null and 询价单编号 = 采购合同编号) and 采购员流水号 = ${num}`
}
})
}
@@ -62,17 +62,17 @@ export function searchBaseInfo(id) {
})
}
// 实时保存单价
export function savePrice(price, num1, num2) {
export function savePrice(price, num1, num2, num3, num4, num5) {
return request({
url: '',
method: 'post',
data: {
type: '4',
name: `update 采购管理_询价单明细_视图 set 单价 = ${price} where 物料流水号 = ${num1} and 询价单流水号 = ${num2}`
name: `update 采购管理_询价单明细_视图 set 单价 = ${price} where isnull(物料流水号,0) = isnull('${num1}',0) and 询价单流水号 = ${num2} and isnull(零件名称,'') = '${num3}' and isnull(零件图号,'') = '${num4}' and (isnull(规格,'') = '${num5}' or isnull(物料规格,'') = '${num5}')`
}
})
}
// 实时保存单价
// 实时保存合同头
export function saveContractHeader(...params) {
return request({
url: '',

View File

@@ -23,14 +23,14 @@ export function initBuyer() {
})
}
// 采购合同查询
export function searchTable1(pageCurrent, pageSize, check1, start, end, check2, contract, check3, name, check4, supplier, check5, approval) {
export function searchTable1(pageCurrent, pageSize, check1, start, end, check2, contract, check3, name, check4, supplier, check5, approval, numberCheck, number) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_合同_查询数据_采购部采购',
param: '时间段_check=' + check1 + '&开始时间=' + start + '=datetime&结束时间=' + end + '=datetime&采购合同流水号_check=' + check2 + '&采购合同流水号=' + contract + '&人员编号_check=' + check3 + '&人员编号=' + name + '&供应商名称_check=' + check4 + '&供应商名称=' + supplier + '&审批情况流水号_check=' + check5 + '&审批情况流水号=' + approval,
param: '时间段_check=' + check1 + '&开始时间=' + start + '=datetime&结束时间=' + end + '=datetime&采购合同流水号_check=' + check2 + '&采购合同流水号=' + contract + '&人员编号_check=' + check3 + '&人员编号=' + name + '&供应商名称_check=' + check4 + '&供应商名称=' + supplier + '&审批情况流水号_check=' + check5 + '&审批情况流水号=' + approval + '&采购合同编号_check=' + numberCheck + '&采购合同编号=' + number,
Pagination: pageCurrent + '&' + pageSize
}
})

View File

@@ -656,7 +656,7 @@
<el-input v-model="form2.inquirySheetNum" size="small"/>
</el-form-item>
<el-form-item label="供应商" prop="supplierName">
<el-input v-model="form2.supplierName" size="small" readonly @focus="dialogVisible1=true"/>
<el-input v-model="form2.supplierName" size="small" readonly @focus="dialogVisible1=true;enterpriseNature = '';createDate = '';registeredCapital = '';taxNum = '';EMail = '';address = '';account = '';openingBank = '';phone = '';fax = '';goodTime = ''"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">

View File

@@ -5,7 +5,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="供应商:">
<el-select v-model="supplierValue" clearable filterable size="small" placeholder="供应商" style="width:100%" @change="supplierChange">
<el-select v-model="supplierValue" clearable filterable size="small" placeholder="供应商" style="width:100%" @focus="fetchData" @change="supplierChange">
<el-option
v-for="item in supplier"
:key="item.value"
@@ -129,13 +129,13 @@
</el-table-column>
<el-table-column v-show="hasTax==='未税'" label="单价(未税)" align="center" width="120">
<template slot-scope="scope">
<el-input-number v-show="hasTax==='未税'" :min="0" v-model="scope.row.未税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.未税单价=''" @change="priceChange(scope.row.未税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row)"/>
<el-input-number v-show="hasTax==='未税'" :min="0" v-model="scope.row.未税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.未税单价=''" @change="priceChange(scope.row.未税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row, scope.row.零件名称, scope.row.零件图号, scope.row.规格)"/>
<b v-show="hasTax!=='未税'"></b>
</template>
</el-table-column>
<el-table-column v-show="hasTax==='含税'" label="单价(含税)" align="center" width="120">
<template slot-scope="scope">
<el-input-number v-show="hasTax==='含税'" :min="0" v-model="scope.row.含税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.含税单价=''" @change="priceChange(scope.row.含税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row)"/>
<el-input-number v-show="hasTax==='含税'" :min="0" v-model="scope.row.含税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.含税单价=''" @change="priceChange(scope.row.含税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row, scope.row.零件名称, scope.row.零件图号, scope.row.规格)"/>
<b v-show="hasTax!=='含税'"></b>
</template>
</el-table-column>
@@ -165,10 +165,10 @@
<!--<el-radio-button label="自定义" disabled/>-->
</el-radio-group>
<el-button type="primary" plain size="small" style="margin-left:10px;" @click="editContract()">预览合同</el-button>
<span>②确认合同总额</span>
<el-input v-model="actualTotal" size="small" style="width: 100px"/>
<el-button type="primary" size="small" @click="submitTotal()">确认</el-button>
<span>递交审批</span>
<!--<span>②确认合同总额</span>-->
<!--<el-input v-model="actualTotal" size="small" style="width: 100px"/>-->
<!--<el-button type="primary" size="small" @click="submitTotal()">确认</el-button>-->
<span>递交审批</span>
<el-button type="success" size="small" @click="generateContract()">递交</el-button>
<hr>
<!--html代码-->
@@ -243,7 +243,9 @@ export default {
组件零件基本件流水号组: [],
数量组: [],
单价组: [],
交货期组: []
交货期组: [],
companyAddress: '',
sendAddress: ''
}
},
computed: {
@@ -269,9 +271,17 @@ export default {
}
},
// 价格实时保存
priceChange(price, num1, num2, row) {
priceChange(price, num1, num2, row, num3, num4, num5) {
this.tableData1.map(v => {
if (Number(v.物料流水号) === Number(row.物料流水号) && Number(v.询价单流水号) === Number(row.询价单流水号)) {
v.物料流水号 = v.物料流水号 || ''
v.零件名称 = v.零件名称 || ''
v.零件图号 = v.零件图号 || ''
v.规格 = v.规格 || ''
row.物料流水号 = row.物料流水号 || ''
row.零件名称 = row.零件名称 || ''
row.零件图号 = row.零件图号 || ''
row.规格 = row.规格 || ''
if (Number(v.物料流水号) === Number(row.物料流水号) && Number(v.询价单流水号) === Number(row.询价单流水号) && v.零件名称 === row.零件名称 && v.零件图号 === row.零件图号 && v.规格 === row.规格) {
v.含税单价 = row.含税单价
v.未税单价 = row.未税单价
}
@@ -280,7 +290,11 @@ export default {
this.tableData1 = []
this.tableData1 = group
price = price || 0
savePrice(price, num1, num2).then(res => {
num1 = num1 || ''
num3 = num3 || ''
num4 = num4 || ''
num5 = num5 || ''
savePrice(price, num1, num2, num3, num4, num5).then(res => {
if (res.data[0].result === '1') {
console.log('单价实时保存成功')
} else {
@@ -304,6 +318,8 @@ export default {
}
})
searchBaseInfo(this.id).then(res => {
this.companyAddress = res.data[0] ? res.data[0].公司地址 : ''
this.sendAddress = res.data[0] ? res.data[0].送货地址 : ''
this.fax2 = res.data[0] ? res.data[0].传真 : ''
this.postCode2 = '224053'
this.phone2 = res.data[0] ? res.data[0].手机 + '/' + res.data[0].公司电话 : ''
@@ -333,12 +349,16 @@ export default {
})
},
submitTotal() { // 确定合同总额
this.$refs.tinymce.destroyTinymce()
// this.$refs.tinymce.destroyTinymce()
this.$refs.tinymce.initTinymce()
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()
setTimeout(() => {
this.$refs.tinymce.setContent(this.contentNew)
}, 1000)
// this.$refs.tinymce.initTinymce()
},
supplierChange() {
let check
@@ -398,6 +418,8 @@ export default {
this.tableData1.push({
询价单流水号: response.data[i].询价单流水号,
物料流水号: response.data[i].物料流水号,
零件名称: response.data[i].零件名称,
零件图号: response.data[i].零件图号,
询价单明细流水号: response.data[i].询价单明细流水号,
机床图号: response.data[i].机床图号 || response.data[i].基本件机床图号,
组号: response.data[i].组号 || response.data[i].基本件组号,
@@ -468,7 +490,7 @@ export default {
</tr>
<tr>
<td style="width: 15%;">地址:</td>
<td style="width: 35%;">盐城市开放大道666号</td>
<td style="width: 35%;">${this.companyAddress}</td>
<td style="width: 15%;">地址:</td>
<td id="supplierAddress" style="width: 35%;"></td>
</tr>
@@ -492,7 +514,7 @@ export default {
<tr>
<td style="width: 20%;" rowspan="3">交货地点:</td>
<td style="width: 20%;">地址:</td>
<td style="width: 30%;" colspan="2">盐城市亭湖区新兴镇开放大道666号</td>
<td style="width: 30%;" colspan="2">${this.sendAddress}</td>
</tr>
<tr>
<td style="width: 20%;">联系人:</td>
@@ -588,7 +610,7 @@ export default {
await sleep(0)
if (this.contractNumValue) {
if (this.demoRadio) {
this.$refs.tinymce.destroyTinymce()
// this.$refs.tinymce.destroyTinymce()
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 : ''
@@ -672,8 +694,14 @@ export default {
document.getElementsByClassName('actualTotal')[0] ? document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal : ''
document.getElementsByClassName('actualTotal')[1] ? document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal : ''
document.getElementById('actualTotal_zh') ? document.getElementById('actualTotal_zh').innerHTML = this.actualTotal_zh : ''
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()
setTimeout(() => {
this.$refs.tinymce.setContent(this.contentNew)
}, 1000)
} else {
this.$message.warning('请先选择合同模板,再预览')
}

View File

@@ -326,8 +326,8 @@
</el-table-column>
<el-table-column label="操作" align="center" width="240" fixed="right">
<template slot-scope="scope">
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="primary" size="mini" @click="editOfflineContract(scope.row)">编辑</el-button>
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="danger" size="mini" @click="deleteOfflineContract(scope.row)">删除</el-button>
<el-button :disabled="arrival(scope.row)" type="primary" size="mini" @click="editOfflineContract(scope.row)">编辑</el-button>
<el-button :disabled="arrival(scope.row)" type="danger" size="mini" @click="deleteOfflineContract(scope.row)">删除</el-button>
<el-button type="warning" size="mini" @click="exportExcel(scope.row)">导出</el-button>
</template>
</el-table-column>
@@ -1158,7 +1158,7 @@ export default {
this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
Number(row.离线合同状态) !== 1 ? this.disable = true : this.disable = false // 是否为编辑模式
this.arrival(row) ? this.disable = true : this.disable = false // 是否为编辑模式
},
getSummaries(param) { // 合计
const { columns, data } = param
@@ -1294,6 +1294,11 @@ export default {
})
},
doneOfflineContact() { // 生成离线合同
let judge = true
this.tableData3.map(v => {
judge = judge && v.数量
})
if (judge) {
this.$confirm('确定生成合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -1335,6 +1340,9 @@ export default {
message: '已取消操作'
})
})
} else {
this.$message.error('数量不正确')
}
},
exportExcel(row) {
this.$confirm('确定导出该合同?', '提示', {

View File

@@ -14,16 +14,17 @@
<!--end-placeholder="结束日期"/>-->
<el-row>
<span>合同编号:</span>
<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable>
<el-option
v-for="item in contractNum"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
<!--<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable>-->
<!--<el-option-->
<!--v-for="item in contractNum"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value">-->
<!--<div style="float: left">{{ item.label }}</div>-->
<!--<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>-->
<!--</el-option>-->
<!--</el-select>-->
<el-input v-model="contractNumber" placeholder="合同编号" size="small" clearable style="width:180px"/>
<span>供应商:</span>
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable style="width:180px"/>
<span>采购员:</span>
@@ -194,6 +195,7 @@ import $ from 'jquery'
export default {
data() {
return {
contractNumber: '',
searchView: '', // 图片预览
approval: [{
value: 0,
@@ -335,7 +337,9 @@ export default {
} else {
this.check5 = 1
}
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.startEndDate[0], this.startEndDate[1], this.check2, this.contractNumValue, this.check3, this.personValue, this.check4, this.supplierName, this.check5, this.approvalValue).then(response => {
let check
this.contractNumber ? check = 1 : check = 0
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.startEndDate[0], this.startEndDate[1], this.check2, this.contractNumValue, this.check3, this.personValue, this.check4, this.supplierName, this.check5, this.approvalValue, check, this.contractNumber).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].审批情况内容 === '未审批' ? this.disable.push(false) : this.disable.push(true) // 删除按钮禁用
}

View File

@@ -60,6 +60,16 @@
{{ 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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
@@ -138,6 +148,16 @@
{{ 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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
@@ -221,6 +241,16 @@
{{ 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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
@@ -316,9 +346,9 @@ export default {
searchTable2Export(check1, this.machineNumberValue, check2, this.groupNumberValue).then(res3 => { // 基本件
import('./Export2Excel').then(excel => {
const dataGroup = []
const filterVal1 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名'] // tableData0里的属性名
const filterVal2 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名'] // tableData1里的属性名
const filterVal3 = ['机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '零件数量', '数量', '已到货数量', '供应商名称', '采购合同编号', '姓名'] // tableData2里的属性名
const filterVal1 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData0里的属性名
const filterVal2 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData1里的属性名
const filterVal3 = ['机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '零件数量', '数量', '已到货数量', '供应商名称', '采购合同编号', '姓名', '供货商', '备注'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
@@ -329,13 +359,13 @@ export default {
data1.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[11] = '未分配'
v[13] = '未分配'
} else if (v[6] === '—') {
v[11] = '未采购'
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[11] = '未全部到货'
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[11] = '全部到货'
v[13] = '全部到货'
}
})
dataGroup.push(data1)
@@ -349,13 +379,13 @@ export default {
data2.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[11] = '未分配'
v[13] = '未分配'
} else if (v[6] === '—') {
v[11] = '未采购'
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[11] = '未全部到货'
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[11] = '全部到货'
v[13] = '全部到货'
}
})
dataGroup.push(data2)
@@ -369,19 +399,19 @@ export default {
data3.map(v => {
v.push('') // 物料状态
if (v[11] === '—') {
v[12] = '未分配'
v[14] = '未分配'
} else if (v[7] === '—') {
v[12] = '未采购'
v[14] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[12] = '未全部到货'
v[14] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[12] = '全部到货'
v[14] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '物料状态']]
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,