Files
JY1.0/src/views/PurchasingCenter/MaterialMProcure/index.vue
sujiaqi 244db8d7c4 a
2020-02-10 10:26:17 +08:00

700 lines
26 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card>
<el-row v-if="false">
<el-select
v-model="MaterialCategoryValue"
placeholder="物料类别"
size="small"
clearable
@change="searchMaterialVariety">
<el-option
v-for="item in MaterialCategory"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select
v-model="MaterialVarietyValue"
placeholder="物料品种"
size="small"
clearable
@change="searchMaterial">
<el-option
v-for="item in MaterialVariety"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="MaterialName" placeholder="物料名称" size="small" clearable />
<el-input
v-model="FullNameOfMaterial"
placeholder="物料全称"
size="small"
clearable/>
<el-input
v-model="MaterialSpecification"
placeholder="物料规格"
size="small"
clearable/>
<el-input
v-model="MaterialModel"
placeholder="物料型号"
size="small"
clearable/>
<el-select
v-model="MeasurementUnitValue"
placeholder="计算单位"
size="small"
style="width: 80px"
clearable>
<el-option
v-for="item in MeasurementUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select
v-model="MaterialSourceValue"
placeholder="物料来源"
size="small"
clearable>
<el-option
v-for="item in MaterialSource"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select
v-model="GonghuoshangValue"
placeholder="供货商"
filterable
size="small"
clearable>
<el-option
v-for="item in Gonghuoshang"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
icon="el-icon-search"
size="small"
style="margin-left: 10px"
@click="pageCurrent=1;searchMaterial()">查询</el-button>
<el-button type="primary" style="margin-bottom: 3px;margin-top: 10px" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd()">新增采购物料申请</el-button>
</el-row>
<el-row>
<el-input v-model="MaterialName" placeholder="物料名称" size="small" clearable/>
<el-input v-model="MaterialSpecification" placeholder="物料规格" size="small" clearable/>
<el-input v-model="MaterialModel" placeholder="物料型号" size="small" clearable/>
<el-button type="primary" icon="el-icon-search" size="small" plain style="margin-left: 10px" @click="pageCurrent=1;searchMaterial()">查询</el-button>
<el-button type="warning" style="margin-bottom: 3px;margin-top: 10px" icon="el-icon-circle-plus-outline" plain size="small" @click="handleAdd()">新增采购物料申请</el-button>
</el-row>
</el-card>
<el-card>
<el-table
:data="tableData"
style="width: 100%;margin-top: 3px"
height="600"
size="mini"
highlight-current-row
border
stripe>
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商">
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column align="center" label="审核状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.是否通过===0" type="primary" size="small">未审核</el-tag>
<el-tag v-if="scope.row.是否通过===1" type="success" size="small">已通过</el-tag>
<el-tag v-if="scope.row.是否通过===2" type="danger" size="small">未通过</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="打回原因">
<template slot-scope="scope">
{{ scope.row.打回原因 ? scope.row.打回原因 : '——' }}
</template>
</el-table-column>
<!--<el-table-column label="操作" fixed="right" align="center" width="150">-->
<!--<template slot-scope="scope">-->
<!--<el-tooltip :open-delay="1000" effect="dark" content="编辑">-->
<!--<div style="display: inline-block">-->
<!--<el-button-->
<!--:disabled="token !== 11 && token !== 36"-->
<!--size="mini"-->
<!--type="text"-->
<!--icon="el-icon-edit-outline"-->
<!--@click="handleEdit(scope.row)"/>-->
<!--</div>-->
<!--</el-tooltip>-->
<!--<el-tooltip effect="dark" content="删除" placement="top">-->
<!--<div style="display: inline-block">-->
<!--<el-button-->
<!--:disabled="token !== 11 && token !== 36"-->
<!--size="mini"-->
<!--type="text"-->
<!--style="margin-left: 20px"-->
<!--icon="el-icon-delete"-->
<!--@click="handleDelete(scope.row)"/>-->
<!--</div>-->
<!--</el-tooltip>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible1" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="物料类别" prop="物料类别流水号">
<el-select
v-model="form.物料类别流水号"
style="width:200px"
placeholder="请选择"
size="small"
clearable
@change="searchMaterialVariety1">
<el-option
v-for="item in MaterialCategory1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料品种" prop="物料品种流水号">
<el-select v-model="form.物料品种流水号" style="width:200px" placeholder="请选择" size="small" clearable>
<el-option
v-for="item in MaterialVariety1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料名称" prop="物料名称">
<el-input v-model="form.物料名称" placeholder="物料名称" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料全名" prop="物料全名">
<el-input v-model="form.物料全名" placeholder="物料全名" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料规格" prop="物料规格">
<el-input v-model="form.物料规格" placeholder="物料规格" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料型号" prop="物料型号">
<el-input v-model="form.物料型号" placeholder="物料型号" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="计量单位" prop="计量单位流水号">
<el-select v-model="form.计量单位流水号" style="width:200px" placeholder="请选择" size="small">
<el-option
v-for="item in MeasurementUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料来源" prop="物料来源流水号">
<el-select v-model="form.物料来源流水号" style="width:200px" placeholder="请选择" size="small">
<el-option
v-for="item in MaterialSource"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="供货商" prop="GonghuoshangValue">
<el-select
v-model="form.GonghuoshangValue"
placeholder="请选择"
filterable
style="width:200px"
size="small"
clearable>
<el-option
v-for="item in Gonghuoshang2"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!--<el-input-->
<!--v-model="form.供货商"-->
<!--placeholder="供货商"-->
<!--size="small"-->
<!--clearable-->
<!--style="width:200px"-->
<!--@click.native="param=1;openSupplier()"/>-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="常用符号">
Φ × μ δ ±
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取消</el-button>
<el-button v-show="title==='新增物料申请'" type="primary" @click="submitAdd('form')">提交技术审核</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getSupplier1,
AddGonghuoshang,
initDepartmentName,
initMaterialCategory,
initMaterialVariety,
initMeasurementUnit,
initMaterialSource,
searchmaterial,
getSupplier,
addData,
editData,
deleteData,
searchCategory,
searchVarieties,
editCategory,
addCategory,
deleteCategory,
editVariety,
addVariety,
deleteVariety
} from '@/api/PurchasingCenter/MaterialMProcure'
import { mapGetters } from 'vuex'
export default {
data() {
return {
Gonghuoshang: [],
Gonghuoshang2: [],
GonghuoshangValue: '',
form3: {
供货商名称: ''
},
rules3: {
供货商名称: [{ required: true, message: '请输入供货商名称', trigger: 'blur' }]
},
dialogFormVisible3: false,
DepartmentValue: '', // 部门名称
Department: [], // 部门数组
MaterialCategoryValue: '', // 物料类别
MaterialCategory: [], // 物料类别数组
MaterialVarietyValue: '', // 物料品种
MaterialVariety: [], // 物料品种数组
MaterialName: '', // 物料名称
FullNameOfMaterial: '', // 物料全称
MaterialSpecification: '', // 物料规格
MaterialModel: '', // 物料型号
MeasurementUnitValue: '', // 计量单位
MeasurementUnit: [], // 计量单位数组
MaterialSourceValue: '', // 物料来源
MaterialSource: [], // 物料来源数组
supplier: '', // 供货商
supplier1: '', // 供货商(弹框)
supplierValue: '', // 供货商流水号
ReferencePrice: '', // 参考价格
supplierValue1: '',
MaterialCategory1: [],
MaterialVariety1: [],
MaterialCategory2: '', // 物料类别
CategoryNumber: '', // 类别编号
VarietyNumber: '', // 品种编号
MaterialVariety2: '', // 物料品种
Specifications1: '', // 规格1
Specifications2: '', // 规格2
MaterialCategoryNum: '', // 物料类别流水号
MaterialVarietyNum: '', // 物料品种流水号
param: 0,
tableData: [],
pageCurrent: 1,
pageSize: 30,
total: null,
tableData1: [],
pageCurrent1: 1,
pageSize1: 10,
total1: null,
tableData2: [],
tableData3: [],
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
check1: '',
check2: '',
check3: '',
check4: '',
check5: '',
check6: '',
check7: '',
check8: '',
check9: '',
check10: '',
title: '',
form: {
物料流水号: '',
物料类别流水号: '',
物料品种流水号: '',
物料名称: '',
物料全名: '',
物料规格: '',
物料型号: '',
计量单位流水号: '',
物料来源流水号: '',
GonghuoshangValue: ''
},
rules: {
物料名称: [{ required: true, message: '请输入物料名称', trigger: 'blur' }],
GonghuoshangValue: [{ required: true, message: '请选择供货商', trigger: 'change' }],
物料类别流水号: [{ required: true, message: '请选择物料类别', trigger: 'change' }],
物料品种流水号: [{ required: true, message: '请选择物料品种', trigger: 'change' }],
计量单位流水号: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
物料来源流水号: [{ required: true, message: '请选择物料来源', trigger: 'change' }]
}
}
},
computed: {
...mapGetters([
'name',
'id',
'token'
])
},
created() {
this.fetchData()
this.searchMaterialCategory()
this.getGonghuoshang()
this.searchMaterial()
},
methods: {
getGonghuoshang() { // 供货商初始化查询
this.Gonghuoshang = []
this.Gonghuoshang2 = []
getSupplier1(0, 0).then(response => {
response.data.map(v => {
this.Gonghuoshang.push({
label: v.供货商,
value: v.供货商流水号
})
this.Gonghuoshang2.push({
label: v.供货商,
value: v.供货商流水号
})
})
})
},
open() {
if (this.$refs['form3'] !== undefined) {
this.$refs['form3'].resetFields()
}
this.form3.供货商名称 = ''
this.dialogFormVisible3 = true
},
AddGonghuoshang(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
AddGonghuoshang(this.form3.供货商名称).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.dialogFormVisible3 = false
} else {
this.dialogFormVisible3 = false
this.$message.error('添加失败')
}
})
}
})
},
fetchData() {
this.getSelect(initDepartmentName, ['物料部门名称', '物料部门流水号'], 'Department') // 物料部门
this.getSelect(initMeasurementUnit, ['计量单位', '计量单位流水号'], 'MeasurementUnit') // 计量单位
this.getSelect(initMaterialSource, ['物料来源', '物料来源流水号'], 'MaterialSource') // 物料来源
},
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)
},
searchMaterial() { // 物料查询
this.MaterialName !== '' ? this.check1 = 1 : this.check1 = 0 // 物料名称
this.FullNameOfMaterial !== '' ? this.check2 = 1 : this.check2 = 0 // 物料全称
this.MaterialSpecification !== '' ? this.check3 = 1 : this.check3 = 0 // 物料规格
this.MaterialModel !== '' ? this.check4 = 1 : this.check4 = 0 // 物料型号
this.MaterialCategoryValue !== '' ? this.check5 = 1 : this.check5 = 0 // 物料类别
this.MaterialVarietyValue !== '' ? this.check6 = 1 : this.check6 = 0 // 物料品种
this.MeasurementUnitValue !== '' ? this.check7 = 1 : this.check7 = 0 // 计量单位
this.MaterialSourceValue !== '' ? this.check8 = 1 : this.check8 = 0 // 物料来源
this.GonghuoshangValue !== '' ? this.check9 = 1 : this.check9 = 0 // 供货商
searchmaterial(this.check1, this.MaterialName, this.check2, this.FullNameOfMaterial, this.check3, this.MaterialSpecification, this.check4, this.MaterialModel, this.pageCurrent, this.pageSize, this.check5, this.MaterialCategoryValue, this.check6, this.MaterialVarietyValue, this.check7, this.MeasurementUnitValue, this.check8, this.MaterialSourceValue, this.check9, this.GonghuoshangValue).then(response => {
this.tableData = response.data.result
this.total = parseInt(response.data.output[0].ItemCount)
})
},
openSupplier() {
this.dialogFormVisible = true
this.supplier1 = ''
this.check10 = 0
this.pageCurrent1 = 1
this.pageSize1 = 10
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
searchSupplier() {
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
selectSupplier(row) {
if (this.param === 0) {
this.supplierValue = row.供货商流水号
} else if (this.param === 1) {
this.supplierValue1 = row.供货商流水号
}
this.supplier1 = row.供货商
},
submitSupplier() {
if (this.param === 0) {
this.supplier = this.supplier1
} else if (this.param === 1) {
this.form.供货商 = this.supplier1
}
this.dialogFormVisible = false
},
cancel() { // 取消
this.dialogFormVisible1 = false
},
searchMaterialVariety1() { // 物料品种
this.MaterialVariety1 = []
this.form.物料品种流水号 = ''
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety1', this.form.物料类别流水号)
},
handleEdit(row) {
this.supplierValue1 = ''
this.MaterialCategory1 = []
this.MaterialVariety1 = []
this.supplierValue1 = row.供货商流水号
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory1')
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety1', row.物料类别流水号)
this.editForm(row, 'form', [this.title = '编辑', this.dialogFormVisible1 = true])
},
submitEdit() {
this.editTable(editData, [this.form.物料流水号, this.form.物料品种流水号, this.form.物料名称, this.form.物料全名, this.form.物料规格, this.form.物料型号, this.form.计量单位流水号, this.form.物料来源流水号, this.supplierValue1], 'form', function() {
this.searchMaterial()
this.dialogFormVisible1 = false
})
},
handleAdd() {
this.supplierValue1 = ''
this.MaterialCategory1 = []
this.MaterialVariety1 = []
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory1')
this.addForm('form', [this.dialogFormVisible1 = true, this.title = '新增物料申请'])
},
submitAdd() { // 提交增加
this.addTable(addData, [this.form.物料品种流水号, this.form.物料名称, this.form.物料全名, this.form.物料规格, this.form.物料型号, this.form.计量单位流水号, this.form.物料来源流水号, this.form.GonghuoshangValue], 'form', function() {
this.dialogFormVisible1 = false
this.searchMaterial()
})
},
handleDelete(row) { // 删除
this.deleteRow(deleteData, row.物料流水号, function() {
this.searchMaterial()
})
},
CategoryMaintenance() {
this.dialogFormVisible2 = true
this.getData(searchCategory, 'tableData2')
},
selectMaterialCategory(row) {
this.MaterialCategory2 = row.物料类别
this.CategoryNumber = row.类别编号
this.MaterialCategoryNum = row.物料类别流水号
this.getData(searchVarieties, 'tableData3', row.物料类别流水号)
},
selectMaterialVariety(row) {
this.MaterialVarietyNum = row.物料品种流水号
this.VarietyNumber = row.品种编号
this.MaterialVariety2 = row.物料品种
this.Specifications1 = row.规格1
this.Specifications2 = row.规格2
},
handleEdit1() {
editCategory(this.MaterialCategoryNum, this.MaterialCategory2, this.CategoryNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('编辑失败')
}
})
},
handleAdd1() {
addCategory(this.MaterialCategory2, this.CategoryNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('增加失败')
}
})
},
handleDelete1(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCategory(row.物料类别流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleEdit2() {
editVariety(this.MaterialVarietyNum, this.MaterialCategoryNum, this.MaterialVariety2, this.VarietyNumber, this.Specifications1, this.Specifications2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('编辑失败')
}
})
},
handleAdd2() {
addVariety(this.MaterialCategoryNum, this.MaterialVariety2, this.VarietyNumber, this.Specifications1, this.Specifications2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('增加失败')
}
})
},
handleDelete2(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteVariety(row.物料品种流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.searchMaterial()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchMaterial()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
}
}
}
</script>
<style scoped>
.el-select{
width:150px;
margin-right: 10px;
}
.el-input{
width:150px;
margin-right: 10px;
}
</style>