2024-09-09 修改了大部分下拉组件为模糊筛选,减轻前端渲染压力

This commit is contained in:
2024-09-09 15:26:17 +08:00
parent fe5d3b70df
commit 563132273c
717 changed files with 107188 additions and 138520 deletions

View File

@@ -0,0 +1,693 @@
<template>
<div class="app-container">
<el-card style="height: 850px;padding: 0">
<el-tabs v-model="PartType" type="border-card">
<el-tab-pane label="产品BOM" name="通用件">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-cascader
ref="cascader"
:options="product"
:show-all-levels="false"
placeholder="产品名称"
clearable
size="small"
@clear="clearData"
@change="getData"/>
<!--<el-select v-model="partTypeValue" style="width:100px" placeholder="类型" size="small" filterable clearable @change="pageCurrent=1;searchTable()">
<el-option
v-for="item in partType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>-->
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
style="margin-left: 10px"
@click="pageCurrent = 1;pageSize = 20;searchTable()">查询
</el-button>
<el-button
type="danger"
plain
icon="el-icon-delete"
size="small"
style="margin-left: 22.7%"
@click="deletePart()">删除
</el-button>
</div>
<div style="margin-top: 10px">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 1141px"
height="710px"
@selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50px"/>
<el-table-column :width="setColumnWidth('序号')" label="序号" type="index" align="center" prop="状态"/>
<el-table-column label="标准" align="center" width="80px" prop="标准">
<template slot-scope="scope">
<el-tag
v-if="scope.row.物料流水号===null || scope.row.物料流水号===''"
type="warning"
size="mini"
style="margin: 0px">非标
</el-tag>
<el-tag
v-if="scope.row.物料流水号!==null && scope.row.物料流水号!==''"
type="primary"
size="mini"
style="margin: 0px">标准
</el-tag>
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="170px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column label="图号/型号" align="center" width="140px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="材料" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="单重" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.单件重量 }}
</template>
</el-table-column>
<el-table-column label="零件备注" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
</el-table>
</div>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-tab-pane>
<el-tab-pane label="订单BOM" name="专机">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-input
v-model="partTool"
clearable
placeholder="产品名称筛选"
size="small"
style="width:200px"
@clear="searchPartsGroup('')">
<el-button slot="append" icon="el-icon-right" @click="searchPartsGroup('')"/>
</el-input>
<el-select
v-model="orderValue"
:remote-method="searchPartsGroup"
style="width:200px"
placeholder="订单编号"
size="small"
filterable
clearable
remote
@change="getGroupName();pageCurrent2=1;searchTable1()">
<el-option
v-for="item in orderArray"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select
v-model="groupNameValue"
style="width:200px"
placeholder="产品名称"
size="small"
filterable
clearable
@change="pageCurrent2=1;searchTable1()">
<el-option
v-for="item in groupName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!--<el-cascader ref="cascader" :options="product" :show-all-levels="false" placeholder="产品名称" clearable size="small" @clear="clearData1" @change="getData1"/>-->
<!--<el-select v-model="partTypeValue1" style="width:100px" placeholder="类型" size="small" filterable clearable @change="pageCurrent2=1;searchTable1()">
<el-option
v-for="item in partType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>-->
<el-button
icon="el-icon-search"
type="primary"
plain
size="small"
style="margin-left: 10px"
@click="pageCurrent2 = 1;searchTable1()">查询
</el-button>
<el-button
type="danger"
plain
icon="el-icon-delete"
size="small"
style="margin-left: 103px"
@click="deletePart1()">删除
</el-button>
</div>
<div style="margin-top: 10px">
<el-table
v-loading="loading"
:data="tableData2"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 1181px"
height="710px"
@selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50px"/>
<el-table-column :width="setColumnWidth('序号')" label="序号" type="index" align="center" prop="状态"/>
<el-table-column label="标准" align="center" width="80px" prop="标准">
<template slot-scope="scope">
<el-tag
v-if="scope.row.物料流水号===null || scope.row.物料流水号===''"
type="warning"
size="mini"
style="margin: 0px">非标
</el-tag>
<el-tag
v-if="scope.row.物料流水号!==null && scope.row.物料流水号!==''"
type="primary"
size="mini"
style="margin: 0px">标准
</el-tag>
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="170px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column label="图号/型号" align="center" width="140px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="材料" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="单重" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.单件重量 }}
</template>
</el-table-column>
<el-table-column label="零件备注" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
</el-table>
</div>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
partTool: '',
numberOfParts: '',
dialogVisible: false,
hadFile: [],
multipleSelection: [],
multipleSelection_variable: [],
multipleSelection1: [],
multipleSelection_variable1: [],
PartType: '通用件',
materialName: '',
materialSpec: '',
materialNumber: '',
materialNew: '',
addmaterial: '',
materialNewValue: '',
materialValue: '',
productNumber: '',
productName: '',
productName1: '',
NumberValue: '',
remarks: '',
productValue: '', // 产品名称
productValue1: '',
product: [], // 产品名称数组
dateRange: '', // 导入时间
partValue: '', // 零件流水号
partTypeValue: '', // 零件类型
partType: [
{
value: 1,
label: '标准'
}, {
value: 2,
label: '外购'
}, {
value: 3,
label: '自制'
}, {
value: 4,
label: '外协'
}
], // 零件类型数组
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
MaterialScience: [],
form: {
数量: '',
材料: '',
单件重量: '',
零件备注: '',
类型: ''
},
rules: {
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }],
类型: [{ required: true, message: '请选择类型', trigger: 'change' }]
},
orderArray: [],
orderValue: '',
orderNumber: '',
groupName: [],
groupNameValue: '',
groupNumber: '',
partTypeValue1: '',
partsType: '',
dateRange1: '',
loading: false, // 数据加载
tableData: [], // 通用件信息表
tableData1: [], // 物料表
tableData2: [], // 专机表
total: 0, // 分页总数
pageCurrent: 1, // 分页当前页
pageSize: 20, // 分页每页显示条数
total1: 0, // 分页总数
pageCurrent1: 1, // 分页当前页
pageSize1: 10, // 分页每页显示条数
total2: 0, // 分页总数
pageCurrent2: 1, // 分页当前页
pageSize2: 20, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
},
methods: {
getGroupNameNEW() {
var param = []
param[0] = ['组件流水号', this.groupNameValue]
var Data = this.CreateData('11', '订单BOM_部件数量_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.numberOfParts = response.data[0].数量
console.log('订单BOM_部件数量_查询数据', response.data)
})
},
searchPartsGroup(query) {
let check
this.partTool ? check = 1 : check = 0
var param = []
param[0] = ['产品名称_check', check]
param[1] = ['产品名称', this.partTool]
param[2] = ['订单编号', query]
var Data = this.CreateData('11', 'BOM查询维护_产品名称_查询_订单编号_BAK', param)
this.ExecDatabase(Data).then(response => {
this.orderArray = []
for (let i = 0; i < response.data.length; i++) {
this.orderArray.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
fetchData() {
this.getTreeData()
this.searchPartsGroup('')
// this.getOrder()
},
getOrder() {
var param = []
var Data = this.CreateData('11', '订单信息_列表_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderArray.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
getGroupName() {
this.groupNameValue = ''
this.groupName = []
if (this.orderValue) {
var param = []
param[0] = ['订单流水号', this.orderValue]
var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupName.push({
label: response.data[i].产品名称,
value: response.data[i].产品名称
})
}
})
}
},
getTreeData() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '产品关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.product = this.tree(data, 0)
})
},
tree(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].父节点 === pid) {
const obj = { label: data[i].节点名称, value: data[i].子节点 }
temp = this.tree(data, data[i].子节点)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
getData(val) {
this.pageCurrent = 1
this.productValue = val[val.length - 1]
var param = []
param[0] = ['产品流水号', this.productValue]
var Data = this.CreateData('11', '产品关系_获取产品名称', param)
this.ExecDatabase(Data).then(response => {
this.productName = response.data[0].产品名称
})
if (this.productName) {
this.searchTable()
} else {
this.tableData = []
this.total = 0
}
},
clearData() {
this.productValue = ''
this.tableData = []
},
searchTable() {
if (this.productName) {
let productValue_check
this.productName ? productValue_check = 1 : productValue_check = 0
var param = []
param[0] = ['组号_check', productValue_check]
param[1] = ['组号', this.productName]
param[2] = ['订单流水号_check', 0]
param[3] = ['订单流水号', '']
var Data = this.CreateData('11', 'PDM_零件明细表_总明细_数据导入保存_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
} else {
this.$message.warning('请选择产品名称')
}
},
searchTable1() {
if (this.orderValue) {
let orderValue_check, groupNameValue_check
this.orderValue ? orderValue_check = 1 : orderValue_check = 0
this.groupNameValue ? groupNameValue_check = 1 : groupNameValue_check = 0
var param = []
param[0] = ['组号_check', groupNameValue_check]
param[1] = ['组号', this.groupNameValue]
param[2] = ['订单流水号_check', orderValue_check]
param[3] = ['订单流水号', this.orderValue]
var Data = this.CreateData('11', 'PDM_零件明细表_总明细_数据导入保存_查询', param, this.pageSize2, this.pageCurrent2)
this.ExecDatabase(Data).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
} else {
this.$message.warning('请选择订单')
}
},
handleSelectionChange(val) {
this.multipleSelection = val
},
deletePart() {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.multipleSelection.length > 0) {
const NumberData = []
const NumberData1 = []
this.multipleSelection_variable = this.multipleSelection
this.multipleSelection = []
for (let i = 0; i < this.multipleSelection_variable.length; i++) {
NumberData[i] = parseInt(this.multipleSelection_variable[i].id)
NumberData1[i] = this.multipleSelection_variable[i].类别
}
var param = []
param[0] = ['id组', NumberData]
param[1] = ['类型组', NumberData1]
var Data = this.CreateData('12', 'PDM_产品明细表_数据导入保存_删除数据_全部', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable()
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择要删除的零件')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消确认'
})
})
},
// handleSelectionChange1(val) {
// this.multipleSelection1 = val
// },
deletePart1() {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.multipleSelection.length > 0) {
const NumberData = []
const NumberData1 = []
this.multipleSelection_variable = this.multipleSelection
this.multipleSelection = []
for (let i = 0; i < this.multipleSelection_variable.length; i++) {
NumberData[i] = parseInt(this.multipleSelection_variable[i].id)
NumberData1[i] = this.multipleSelection_variable[i].类别
}
var param = []
param[0] = ['id组', NumberData]
param[1] = ['类型组', NumberData1]
var Data = this.CreateData('12', 'PDM_产品明细表_数据导入保存_删除数据_全部', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable1()
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择要删除的零件')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消确认'
})
})
},
searchMaterial() {
let materialName_check, materialSpec_check
this.materialName ? materialName_check = 1 : materialName_check = 0
this.materialSpec ? materialSpec_check = 1 : materialSpec_check = 0
var param = []
param[0] = ['名称_check', materialName_check]
param[1] = ['名称', this.materialName]
param[2] = ['代号_check', materialSpec_check]
param[3] = ['代号', this.materialSpec]
var Data = this.CreateData('11', '物料信息_查询', param, this.pageSize1, this.pageCurrent1)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchMaterial()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchMaterial()
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.searchTable1()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable1()
}
}
}
</script>
<style scoped lang="scss">
/deep/ .el-card__body {
padding: 0px !important;
}
</style>
<style scoped>
.wrapper {
width: 90%;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
/*float: left;*/
margin: 10px;
}
.content {
position: relative;
padding: 8px 8px 0 8px;
}
.action {
position: absolute;
top: 2px;
right: 8px;
}
.delete {
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover {
background: -webkit-linear-gradient(top, #0ba9e3, #0099d3);
color: #fff;
}
a {
text-decoration: none;
}
.icon {
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info {
width: 160px;
height: 50px;
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,412 @@
<!--技术确认查询 技术确认查询 技术确认查询-->
<template>
<div class="app-container">
<el-card style="height: 850px">
<el-select v-model="orderNumberValue" style="width:200px" placeholder="订单编号" size="small" filterable clearable @change="pageCurrent = 1;pageSize = 20;searchTable()">
<el-option
v-for="item in orderNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="customerNameValue" style="width:200px" placeholder="买方名称/收货人" size="small" clearable/>
<el-input v-model="AssignorValue" style="width:200px" placeholder="分配人" size="small" clearable/>
<el-button icon="el-icon-search" type="primary" plain size="small" style="margin-left: 10px;margin-right: 25%" @click="pageCurrent = 1;pageSize = 20;searchTable()">查询</el-button>
<el-row>
<el-col style="width: 1148px">
<el-table v-loading="loading" :data="tableData" highlight-current-row border stripe size="small" style="width: 1131px" height="222px" @row-click="searchTable1">
<el-table-column :width="setColumnWidth('日期')" label="订单状态" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.订单状态 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('订单编号')" label="订单编号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('买方')" label="买方" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.买方 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('备注')" label="订单备注" align="center">
<template slot-scope="scope">
{{ scope.row.订单备注 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('姓名')" label="收货人" align="center">
<template slot-scope="scope">
{{ scope.row.收货人 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('日期时间')" label="分配日期" align="center">
<template slot-scope="scope">
{{ scope.row.分配时间 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('姓名')" label="分配人" align="center">
<template slot-scope="scope">
{{ scope.row.被分配人员姓名 }}
</template>
</el-table-column>
<el-table-column label="分配确认日期" align="center">
<template slot-scope="scope">
{{ scope.row.分配确认时间 }}
</template>
</el-table-column>
<el-table-column label="分配完成期限" align="center">
<template slot-scope="scope">
{{ scope.row.分配期限 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
:pager-count="5"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-col>
</el-row>
<el-table v-if="Number(typeValue)!==3" :data="tableData1" :header-cell-style="changeStyle" highlight-current-row border size="small" height="540px" style="width: 1651px">
<el-table-column width="50px" label="序号" type="index" fixed align="center"/>
<el-table-column width="130px" label="部件名称" fixed align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.产品名称 }}
</template>
</el-table-column>
<el-table-column width="70px" label="单位" fixed align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column width="80px" label="数量" fixed align="center">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column width="230px" label="产品详情" align="center" fixed show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.产品详情 }}
</template>
</el-table-column>
<el-table-column width="90px" label="轴承型号" align="center">
<template slot-scope="scope">
{{ scope.row.轴承位置文本 }}
</template>
</el-table-column>
<el-table-column width="80px" label="安装方向" align="center">
<template slot-scope="scope">
{{ scope.row.安装方向名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="电机型号/联接板" align="center">
<template slot-scope="scope">
{{ scope.row.电机位置文本 }}
</template>
</el-table-column>
<el-table-column width="80px" label="传动方式" align="center">
<template slot-scope="scope">
{{ scope.row.传动方式位置文本 }}
</template>
</el-table-column>
<el-table-column width="100px" label="主轴轮" align="center">
<template slot-scope="scope">
{{ scope.row.主轴轮名称 }}
</template>
</el-table-column>
<el-table-column width="100px" label="电机轮" align="center">
<template slot-scope="scope">
{{ scope.row.电机轮名称 }}
</template>
</el-table-column>
<el-table-column width="90px" label="传动带" align="center">
<template slot-scope="scope">
{{ scope.row.皮带轮名称 }}
</template>
</el-table-column>
<el-table-column width="90px" label="其它" align="center">
<template slot-scope="scope">
{{ scope.row.其它 }}
</template>
</el-table-column>
<el-table-column width="80px" label="输出转速" align="center">
<template slot-scope="scope">
{{ scope.row.输出转速 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('中心内冷')" label="中心内冷" align="center">
<template slot-scope="scope">
{{ scope.row.中心内冷名称 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('防护类型')" label="防护类型" align="center">
<template slot-scope="scope">
{{ scope.row.防护类型名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="电机型号" align="center">
<template slot-scope="scope">
{{ scope.row.滑台电机文本 }}
</template>
</el-table-column>
<el-table-column width="120px" label="电机联接板" align="center">
<template slot-scope="scope">
{{ scope.row.电机联接板文本 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('联轴器')" label="联轴器" align="center">
<template slot-scope="scope">
{{ scope.row.联轴器文本 }}
</template>
</el-table-column>
</el-table>
<el-table v-if="Number(typeValue)===3" :data="tableData20" :header-cell-style="{background: '#2283D4',color: 'white'}" highlight-current-row border stripe size="mini" style="width: 651px" height="560px">
<el-table-column width="50px" label="序号" type="index" align="center"/>
<el-table-column width="150px" label="物料名称" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="图号或型号" align="center">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column width="60px" label="单位" align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column width="90px" label="库存" align="center">
<template slot-scope="scope">
{{ scope.row.累计库存 }}
</template>
</el-table-column>
<el-table-column width="90px" label="最低库存" align="center">
<template slot-scope="scope">
{{ scope.row.最低库存 }}
</template>
</el-table-column>
<el-table-column width="90px" label="补货数量" align="center">
<template slot-scope="scope">
{{ scope.row.补货数 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
orderNumberValue: '',
orderNumber: [],
consigneeValue: '',
consignee: [],
acknowledgingTimeValue: '',
typeValue: 1,
AssignorValue: '',
customerNameValue: '', // 买方名称
customerName: [], // 买方名称数组
orderValue: '', // 订单编号s
orderArray: [], // 订单编号数组
dateRange: '', // 下单日期
orderStateValue: '', // 订单状态
orderState: [], // 合同状态数组
loading: false, // 数据加载
hadFile: [],
dialogVisible: false,
materialNameTypeValue: '',
total: 0, // 分页总数
total10: 0, // 分页总数
tableData: [], // 订单信息表
tableData1: [], // 产品信息表
tableData2: [],
tableData3: [],
tableData4: [],
tableData7: [],
tableData10: [],
tableData11: [],
tableData12: [],
tableData13: [],
tableData20: [],
motorModelId: '',
motorModel: [],
motorModelLabel: '',
spindleWheel: [], // 主轴轮数组
motorWheel: [], // 电机轮数组
pulley: [], // 皮带轮数组
orderId: '',
show: false,
show1: false,
bearing: [],
bearingId: '',
bearingLabel: '',
transmissionMode: [],
transmissionModeId: '',
transmissionModeLabel: '',
CentralInternalCooling: [],
TypeOfProtection: [],
installationDirection: [],
pageCurrent: 1, // 分页当前页
pageSize: 10, // 分页每页显示条数
pageCurrent10: 1, // 分页当前页
pageSize10: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.getOrderNumber()
this.searchTable()
},
changeStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 15 || columnIndex === 16 || columnIndex === 17 || columnIndex === 18) {
return 'background:#31384B;color:white'
} else {
return 'background:#2283D4;color:white'
}
},
getOrderNumber() {
var param = []
var Data = this.CreateData('11', '订单信息_分配列表_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderNumber.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
searchTable() {
let AssignorValue_check, customerNameValue_check
if (this.orderNumberValue) { this.orderNumberValue_check = 1 } else { this.orderNumberValue_check = 0 }
if (this.customerNameValue) { customerNameValue_check = 1 } else { customerNameValue_check = 0 }
// this.orderNumberValue ? orderNumberValue_check = 1 : orderNumberValue_check = 0
// this.consigneeValue ? consigneeValue_check = 1 : consigneeValue_check = 0
// this.acknowledgingTimeValue ? acknowledgingTimeValue_check = 1 : acknowledgingTimeValue_check = 0
this.AssignorValue ? AssignorValue_check = 1 : AssignorValue_check = 0
const param = []
param[0] = ['订单编号_check', this.orderNumberValue_check]
param[1] = ['订单流水号', this.orderNumberValue]
param[2] = ['买方名称_check', customerNameValue_check]
param[3] = ['客户', this.customerNameValue]
param[4] = ['分配人_check', AssignorValue_check]
param[5] = ['分配人', this.AssignorValue]
var Data = this.CreateData('11', '订单信息_分配_查询数据', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
},
searchTable1(row) {
this.orderId = row.订单流水号
this.typeValue = row.订单类型
if (row.订单类型 !== 3) {
this.searchTable2()
} else {
this.searchTable3()
}
},
searchTable2() {
this.tableData1 = []
var param = []
param[0] = ['订单流水号', this.orderId]
var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
},
searchTable3() {
this.tableData20 = []
var param = []
param[0] = ['订单流水号', this.orderId]
param[1] = ['订单类型', this.typeValue]
var Data = this.CreateData('11', '订单信息_补货明细_技术确认_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData20 = response.data
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.wrapper{
width: 90%;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
/*float: left;*/
margin: 10px;
}
.content{
position: relative;
padding: 8px 8px 0 8px;
}
.action{
position: absolute;
top: 2px;
right: 8px;
}
.delete{
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover{
background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
color: #fff;
}
a{
text-decoration: none;
}
.icon{
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info{
width: 160px;
height: 50px;
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
</style>

View File

@@ -0,0 +1,944 @@
<template>
<div class="app-container">
<el-card style="height: 850px">
<div style="margin-left: 300px">
<div style="margin-top: 7px; margin-bottom: 7px">
<span style="margin-left: 305px">订单编号</span>
<el-select
v-model="orderValue"
:remote-method="getCustomer"
style="width:200px"
placeholder="订单编号"
size="small"
filterable
clearable
remote
@change="searchProduct()">
<el-option
v-for="item in orderArray"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-checkbox v-model="checked">产品BOM</el-checkbox>
</div>
<upload-excel-component style="margin-left: 195px" @on-selected-file="selected"/>
<div style="margin-left: 395px">
<span v-show="worksheet.length > 1" style="cursor: pointer;width: 50px;" @click="removeAll"><i
class="el-icon-close"/></span>
<el-upload :on-remove="handleRemove" :file-list="itemFile" style="width: 220px" action=""/>
</div>
<div v-if="worksheet.length !== 0" style="margin: 3px 0 0 395px">
<el-button v-if="!checked" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">
导入到数据库
</el-button>
<el-button v-if="checked" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL1">
导入到数据库
</el-button>
</div>
<span v-if="!checked">产品列表</span>
<el-select
v-if="!checked"
v-model="productValue"
style="width:200px"
placeholder="产品列表"
size="small"
filterable
clearable
@change="searchTable()">
<el-option
v-for="item in product"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span v-if="checked">产品列表</span>
<el-cascader
v-if="checked"
ref="cascader"
:options="product1"
:show-all-levels="false"
size="small"
@change="getData"/>
<el-button
v-if="!checked"
:disabled="disabled"
icon="el-icon-upload"
type="success"
style="margin-left: 500px"
plain
size="small"
@click="transferData">上传
</el-button>
<el-button
v-if="checked"
:disabled="disabled"
icon="el-icon-upload"
type="success"
style="margin-left: 500px"
plain
size="small"
@click="transferData1">上传
</el-button>
<el-button v-if="!checked" icon="el-icon-delete" type="danger" plain size="small" @click="allDelete">全部删除
</el-button>
<el-button v-if="checked" icon="el-icon-delete" type="danger" plain size="small" @click="allDelete1">全部删除
</el-button>
<el-table
v-loading="loading"
ref="table"
:data="tableData"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 981px"
height="520px"
@sort-change="sortChange"
@row-click="searchMaterial">
<el-table-column label="序号" align="center" type="index" width="70px"/>
<el-table-column label="标准" align="center" width="80px" prop="标准">
<template slot-scope="scope">
<el-tag
v-if="scope.row.物料流水号===null || scope.row.物料流水号===''"
type="warning"
size="mini"
style="margin: 0px">非标
</el-tag>
<el-tag
v-if="scope.row.物料流水号!==null && scope.row.物料流水号!==''"
type="primary"
size="mini"
style="margin: 0px">标准
</el-tag>
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="170px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column label="图号/型号" align="center" width="140px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="材料" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="单重" width="90" align="center">
<template slot-scope="scope">
{{ scope.row.单件重量 }}
</template>
</el-table-column>
<el-table-column label="零件备注" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</div>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" center width="491px" height="300px">
<el-table
:data="tableData1"
:cell-class-name="cell"
:header-cell-style="{background: '#383E4B',color: 'white'}"
style="width: 100%"
size="mini"
height="530px"
highlight-current-row
border>
<el-table-column width="200px" align="center" label="零件名称" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column width="160px" align="center" label="图号/型号" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80px">
<template slot-scope="scope">
<el-button
v-if="!checked"
size="mini"
type="text"
icon="el-icon-sort"
@click="handle(scope.row)">替换
</el-button>
<el-button
v-if="checked"
size="mini"
type="text"
icon="el-icon-sort"
@click="handle1(scope.row)">替换
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { sleep } from '../../../utils/tool'
import UploadExcelComponent from './UploadExcel/index.vue'
export default {
components: { UploadExcelComponent },
data() {
return {
orderValue: '', // 订单编号
orderArray: [], // 订单编号数组
worksheet: [],
itemFile: [],
unSpecification: [],
checked: false,
dialogFormVisible: false,
NumId: '',
partsType: '',
productName: '',
productValue: '', // 产品名称
product: [], // 产品名称数组
productValue1: '', // 产品名称
product1: [], // 产品名称数组
loading: false, // 数据加载
total: 0, // 分页总数
tableData: [], // 物料信息表
tableData1: [], // 标准库信息表
pageCurrent: 1, // 分页当前页
pageSize: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
]),
disabled() {
if (this.tableData.length === 0) {
return true
}
if (this.unSpecification.data) {
return this.unSpecification.data.length > 0
}
if (this.loading === true) {
return true
}
return true
}
},
watch: {
product(val) {
this.productValue = ''
this.productValue = val.length > 0 ? val[0].value : ''
this.searchTable()
}
},
updated() {
this.$nextTick(() => {
this.$refs['table'].doLayout()
})
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.getCustomer('')
this.getTreeData()
},
getTreeData() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '产品关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.product1 = this.tree(data, 0)
})
},
tree(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].父节点 === pid) {
const obj = { label: data[i].节点名称, value: data[i].子节点 }
temp = this.tree(data, data[i].子节点)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
getData(val) {
this.productValue1 = val[val.length - 1]
var param = []
param[0] = ['产品流水号', this.productValue1]
var Data = this.CreateData('11', '产品关系_获取产品名称', param)
this.ExecDatabase(Data).then(response => {
this.productName = response.data[0].产品名称
}).then(() => {
this.searchTable()
})
},
cell({ row, column, rowIndex, columnIndex }) {
if (row.对比类型 === 1 && columnIndex === 1) {
return 'ContrastMaterial'
}
if (row.对比类型 === 2 && columnIndex === 0) {
return 'ContrastMaterial'
}
},
searchMaterial(row) {
if (row.物料流水号 === null || row.物料流水号 === '') {
this.dialogFormVisible = true
this.NumId = row.id
this.partsType = row.物料类别
var param = []
param[0] = ['图号或者型号', row.代号]
param[1] = ['名称', row.名称]
var Data = this.CreateData('11', 'PDM_零件明细表_标准件和外购件_物料对比', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
}
},
handle(row) {
this.$confirm('是否替换?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['物料流水号', row.物料流水号]
param[1] = ['订单流水号', this.orderValue]
param[2] = ['组号', this.productValue]
var Data = this.CreateData('11', 'PDM_零件明细表_外购件和标准件_数据导入保存_更改物料流水号_验证', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].结果 === 1) {
this.$message.warning('要替换的物料已经存在该分组内,不允许出现相同物料')
} else {
var param = []
param[0] = ['物料流水号', row.物料流水号]
param[1] = ['id', this.NumId]
param[2] = ['物料类别', this.partsType]
var Data = this.CreateData('12', 'PDM_零件明细表_外购件和标准件_数据导入保存_更改物料流水号', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('替换成功')
this.tableData1 = []
this.dialogFormVisible = false
this.searchTable()
} else {
this.$message.error('替换失败')
}
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消替换'
})
})
},
handle1(row) {
this.$confirm('是否替换?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['物料流水号', row.物料流水号]
param[1] = ['组号', this.productName]
var Data = this.CreateData('11', 'PDM_产品明细表_外购件和标准件_数据导入保存_更改物料流水号_验证', param)
this.ExecDatabase(Data).then(response => {
console.log(response.data[0].结果, 1233)
if (response.data[0].结果 === 1) {
this.$message.warning('要替换的物料已经存在该产品内,不允许出现相同物料')
} else {
var param = []
param[0] = ['物料流水号', row.物料流水号]
param[1] = ['id', this.NumId]
param[2] = ['物料类别', this.partsType]
var Data = this.CreateData('12', 'PDM_零件明细表_外购件和标准件_数据导入保存_更改物料流水号', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('替换成功')
this.tableData1 = []
this.dialogFormVisible = false
this.searchTable()
} else {
this.$message.error('替换失败')
}
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消替换'
})
})
},
allDelete() {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.orderValue !== '' && this.productValue !== '') {
var param = []
param[0] = ['订单流水号', this.orderValue]
param[1] = ['产品名称', this.productValue]
var Data = this.CreateData('12', 'PDM_零件明细表_一键删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.searchTable()
this.tableData1 = []
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择好订单产品')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
allDelete1() {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.productName !== '') {
var param = []
param[0] = ['产品名称', this.productName]
var Data = this.CreateData('12', 'PDM_产品明细表_一键删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.searchTable()
this.tableData1 = []
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择好产品')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
getCustomer(query) {
this.orderArray = []
var param = []
param[0] = ['订单编号', query]
var Data = this.CreateData('11', '订单信息_已提交_查询数据_bak', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderArray.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
getProduct() {
var param = []
var Data = this.CreateData('11', '产品信息_基础表_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.product1.push({
label: response.data[i].产品名称,
value: response.data[i].产品名称
})
}
})
},
searchProduct() {
this.product = []
var param = []
param[0] = ['订单流水号', this.orderValue]
var Data = this.CreateData('11', 'PDM_零件明细表_基本件_数据导入保存_产品名称_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.product.push({
label: response.data[i].产品名称,
value: response.data[i].产品名称
})
}
})
},
searchTable() {
this.loading = true
this.total = 0
if (!this.checked) {
var param = []
param[0] = ['订单流水号_check', 1]
param[1] = ['订单流水号', this.orderValue]
param[2] = ['组号_check', 1]
param[3] = ['组号', this.productValue]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', 'PDM_零件明细表_总明细_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
} else {
var param1 = []
param1[0] = ['组号_check', 1]
param1[1] = ['组号', this.productName]
param1[2] = ['排序名称', this.orderName]
param1[3] = ['排序方式', this.order]
var Data1 = this.CreateData('11', 'PDM_产品明细表_总明细_查询', param1, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data1).then(response => {
console.log(response.data.rows, 234546)
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
}
this.searchUnSpecification()
},
searchUnSpecification() {
if (!this.checked) {
var param = []
param[0] = ['订单流水号_check', 1]
param[1] = ['订单流水号', this.orderValue]
param[2] = ['组号_check', 1]
param[3] = ['组号', this.productValue]
var Data = this.CreateData('11', 'PDM_零件明细表_外购件和标准件_不规范数据查询gj', param)
this.ExecDatabase(Data).then(response => {
this.unSpecification = response
})
} else {
var param1 = []
param1[0] = ['组号_check', 1]
param1[1] = ['组号', this.productName]
var Data1 = this.CreateData('11', 'PDM_产品明细表_外购件和标准件_不规范数据查询gj', param1)
this.ExecDatabase(Data1).then(response => {
this.unSpecification = response
})
}
},
async selected(data) { // 选择需要导入的文件
console.log(data, 1111)
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
this.itemFile = data.itemFile
},
handleRemove(file) { // 移除文件
for (let i = 0; i < this.itemFile.length; i++) {
if (this.itemFile[i].name === file.name) {
this.worksheet.splice(i, 1)
this.itemFile.splice(i, 1)
}
}
},
removeAll() {
this.worksheet = []
this.itemFile = []
},
async basicPartsToSQL() {
try {
this.loading = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let groupName,
people,
drawingNum,
name,
number,
material,
weight,
remarks,
type
var param = []
param[0] = ['订单流水号', this.orderValue]
param[1] = ['产品名称', this.worksheet[j].C2.v]
var Data = this.CreateData('11', '组件明细表_导入数据_校验', param)
const response = await this.ExecDatabase(Data)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].C2.v}组件不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else {
this.worksheet[j].C2 ? groupName = this.worksheet[j].C2.v : groupName = ''
this.worksheet[j].H2 ? people = this.worksheet[j].H2.v : people = ''
for (let i = 0; i < 999; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`C${attr}`] ? this.worksheet[j][`C${attr}`].v : ''
number = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
material = this.worksheet[j][`E${attr}`] ? this.worksheet[j][`E${attr}`].v : ''
weight = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
remarks = this.worksheet[j][`G${attr}`] ? this.worksheet[j][`G${attr}`].v : ''
type = this.worksheet[j][`H${attr}`] ? this.worksheet[j][`H${attr}`].v : ''
if (!drawingNum && !name && !number && !material && !weight && !remarks && !type) { // 当图号、名称、数量、材料、备注、类型都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else if (!name) { // 名称不能为空
this.$notify.error(`零件名称不能为空`)
break
} else if (Number(number) <= 0) { // 数量不能为0
this.$notify.error(`数量不能为0`)
break
} else if (!type || (type !== '标准' && type !== '外购' && type !== '外协' && type !== '自制')) { // 类型不能为空
this.$notify.error(`${drawingNum}导入失败,类型错误`)
break
} else {
if (groupName) {
await sleep(50)
await this.insertToSQL(groupName, people, drawingNum, name, number, material, weight, remarks, type)
} else {
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
}
this.itemFile.splice(j, 1)
this.worksheet.splice(j, 1)
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
}
this.loading = false
this.searchProduct()
} catch (e) {
this.err++
this.loading = false
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
console.log(`导入数据错误${e}`)
}
},
async insertToSQL(groupName, people, drawingNum, name, number, material, weight, remarks, type) {
try {
if (type.indexOf('自制') > -1) {
var param = []
param[0] = ['订单流水号', this.orderValue]
param[1] = ['产品名称', groupName]
param[2] = ['编制', people]
param[3] = ['图号', drawingNum]
param[4] = ['名称', name]
param[5] = ['数量', number]
param[6] = ['材料', material]
param[7] = ['单件重量', weight]
param[8] = ['备注', remarks]
param[9] = ['类型', type]
param[10] = ['人员编号', this.id]
param[11] = ['导入类型', '1', 'int', '1']
var Data = this.CreateData('12', '组件明细表_基本件_导入数据', param)
const response = await this.ExecDatabase(Data)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`${drawingNum}${name}${type}存在重复数据`)
}
if (res.output[0].导入类型 === '3') {
this.$notify.warning(`${name}的图号规格至少有一个不为空`)
}
}
} else {
var param1 = []
param1[0] = ['订单流水号', this.orderValue]
param1[1] = ['产品名称', groupName]
param1[2] = ['编制', people]
param1[3] = ['图号', drawingNum]
param1[4] = ['名称', name]
param1[5] = ['数量', number]
param1[6] = ['材料', material]
param1[7] = ['单件重量', weight]
param1[8] = ['备注', remarks]
param1[9] = ['类型', type]
param1[10] = ['人员编号', this.id]
param1[11] = ['导入类型', '1', 'int', '1']
var Data1 = this.CreateData('12', '组件明细表_外购件_导入数据', param1)
const response = await this.ExecDatabase(Data1)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`${drawingNum}${name}${type}存在重复数据`)
}
if (res.output[0].导入类型 === '3') {
this.$notify.warning(`${name}的图号规格至少有一个不为空`)
}
}
}
} catch (e) {
this.err++
this.$message.error(`导入数据错误`)
console.log(`导入数据错误${e}`)
}
},
async basicPartsToSQL1() {
try {
this.loading = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let groupName,
people,
drawingNum,
name,
number,
material,
weight,
remarks,
type
var param = []
param[0] = ['产品名称', this.worksheet[j].C2.v]
var Data = this.CreateData('11', '组件明细表_产品导入数据_校验', param)
const response = await this.ExecDatabase(Data)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].C2.v}产品不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else if (this.productName !== this.worksheet[j].C2.v) {
this.$notify.error(`${this.worksheet[j].C2.v}产品与选中产品不符`)
this.loading = false
this.disabled = false
return
} else {
this.worksheet[j].C2 ? groupName = this.worksheet[j].C2.v : groupName = ''
this.worksheet[j].H2 ? people = this.worksheet[j].H2.v : people = ''
for (let i = 0; i < 999; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`C${attr}`] ? this.worksheet[j][`C${attr}`].v : ''
number = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
material = this.worksheet[j][`E${attr}`] ? this.worksheet[j][`E${attr}`].v : ''
weight = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
remarks = this.worksheet[j][`G${attr}`] ? this.worksheet[j][`G${attr}`].v : ''
type = this.worksheet[j][`H${attr}`] ? this.worksheet[j][`H${attr}`].v : ''
if (!drawingNum && !name && !number && !material && !weight && !remarks && !type) { // 当图号、名称、数量、材料、备注、类型都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else if (!name) { // 名称不能为空
this.$notify.error(`零件名称不能为空`)
break
} else if (Number(number) <= 0) { // 数量不能为0
this.$notify.error(`数量不能为0`)
break
} else if (!type || (type !== '自制' && type !== '外购' && type !== '标准' && type !== '外协')) { // 类型不能为空
this.$notify.error(`类型不能为空或不规范`)
break
} else {
if (groupName) {
await sleep(50)
await this.insertToSQL1(groupName, people, drawingNum, name, number, material, weight, remarks, type)
} else {
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
}
this.itemFile.splice(j, 1)
this.worksheet.splice(j, 1)
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
}
this.searchTable()
this.loading = false
} catch (e) {
this.err++
this.loading = false
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
console.log(`导入数据错误${e}`)
}
},
async insertToSQL1(groupName, people, drawingNum, name, number, material, weight, remarks, type) {
try {
if (type.indexOf('自制') > -1) {
var param = []
param[0] = ['订单流水号', null]
param[1] = ['产品名称', groupName]
param[2] = ['编制', people]
param[3] = ['图号', drawingNum]
param[4] = ['名称', name]
param[5] = ['数量', number]
param[6] = ['材料', material]
param[7] = ['单件重量', weight]
param[8] = ['备注', remarks]
param[9] = ['类型', type]
param[10] = ['人员编号', this.id]
param[11] = ['导入类型', '1', 'int', '1']
var Data = this.CreateData('12', '组件明细表_产品基本件_导入数据', param)
const response = await this.ExecDatabase(Data)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`${drawingNum}${name}${type}存在重复数据`)
}
if (res.output[0].导入类型 === '3') {
this.$notify.warning(`${name}的图号规格至少有一个不为空`)
}
}
} else {
var param1 = []
param1[0] = ['订单流水号', null]
param1[1] = ['产品名称', groupName]
param1[2] = ['编制', people]
param1[3] = ['图号', drawingNum]
param1[4] = ['名称', name]
param1[5] = ['数量', number]
param1[6] = ['材料', material]
param1[7] = ['单件重量', weight]
param1[8] = ['备注', remarks]
param1[9] = ['类型', type]
param1[10] = ['人员编号', this.id]
param1[11] = ['导入类型', '1', 'int', '1']
var Data1 = this.CreateData('12', '组件明细表_产品外购件_导入数据', param1)
const response = await this.ExecDatabase(Data1)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`${drawingNum}${name}${type}存在重复数据`)
}
if (res.output[0].导入类型 === '3') {
this.$notify.warning(`${name}的图号规格至少有一个不为空`)
}
}
}
} catch (e) {
this.err++
this.$message.error(`导入数据错误`)
console.log(`导入数据错误${e}`)
}
},
sortChange(column) {
if (column.prop === '标准') {
this.orderName = 1
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') {
this.order = 2
} else {
this.order = ''
}
this.searchTable()
},
transferData() {
var param = []
param[0] = ['订单流水号', this.orderValue]
param[1] = ['产品名称', this.productValue]
param[2] = ['人员编号', this.id]
var Data = this.CreateData('12', 'PDM_零件明细表_上传', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('上传成功')
this.searchTable()
this.searchProduct()
} else {
this.$message.error('上传失败')
}
})
},
transferData1() {
var param = []
param[0] = ['产品名称', this.productName]
param[1] = ['人员编号', this.id]
var Data = this.CreateData('12', 'PDM_产品明细表_上传', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('上传成功')
this.searchTable()
} else {
this.$message.error('上传失败')
}
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style>
.ContrastMaterial {
background: palevioletred !important;
}
</style>

View File

@@ -1,302 +0,0 @@
<template>
<div class="app-container">
<el-card v-loading="loading">
<!-- <el-col :span="6">-->
<!-- <el-steps :active="5" direction="vertical" style="height: 260px;margin-left: 50px">-->
<!-- <el-step title="选择项目"/>-->
<!-- <el-step title="选择类型"/>-->
<!-- <el-step title="浏览"/>-->
<!-- <el-step title="导入到数据库"/>-->
<!-- <el-step title="传递"/>-->
<!-- </el-steps>-->
<!-- </el-col>-->
<div style="width: 620px;margin: 0px 400px">
<div style="overflow: hidden">
<div style="margin-bottom: 10px;">
<span>项目</span>
<el-select v-model="projectValue" filterable size="small" style="margin-top: 3px" placeholder="项目名称">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">类型</span>
<el-select v-model="groupName" filterable size="small" placeholder="类型">
<el-option
v-for="item in Group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</div>
<upload-excel-component @on-selected-file="selected"/>
</div>
<div>
<el-tooltip content="删除全部" placement="top">
<span v-show="worksheet.length > 1" style="cursor: pointer;float: right;margin: 5px" @click="removeAll"><i class="el-icon-close"/></span>
</el-tooltip>
<el-upload :on-remove="handleRemove" :file-list="itemFile" action=""/>
</div>
<div v-if="worksheet.length !== 0" style="float: right;margin: 20px 0">
<el-tooltip :open-delay="1000" effect="dark" content="将信息存入系统数据库" placement="top">
<el-button :disabled="disabled" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
</el-tooltip>
</div>
</div>
</el-card>
<specification-data1 ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" :group-name="groupName" @machineChange="machineChange"/>
<!--<el-upload-->
<!--class="upload-demo"-->
<!--drag-->
<!--action="http://localhost:8410/submit/uploadImg.ashx?InvoiceNum=1"-->
<!--multiple>-->
<!--<i class="el-icon-upload"/>-->
<!--<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>-->
<!--<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
<!--</el-upload>-->
</div>
</template>
<script>
import UploadExcelComponent from '../ImportParts/UploadExcel/index.vue'
import specificationData1 from './specificationData1'
import { sleep } from '../../../utils/tool'
import { initProject, isExit, importBasics, importPurcharse, searchMachine, searchGroupNum1 } from '../../../api/TechnologyCenter/ImportParts'
export default {
name: 'UploadExcel',
components: { UploadExcelComponent, specificationData1 },
data() {
return {
project: [],
projectValue: '',
groupName: 'MX',
Group: [{
value: 'MX',
name: 'MX'
}, {
value: 'WG',
name: 'WG'
}, {
value: 'BZ',
name: 'BZ'
}],
group: '',
worksheet: [],
itemFile: [],
loading: false,
groupsNames: [],
machineNames: [],
err: 0,
disabled: false
}
},
computed: {
projectName() {
for (let i = 0; i < this.project.length; i++) {
if (this.project[i].value === this.projectValue) {
return this.project[i].label
}
}
}
},
watch: {
projectValue(val) {
if (val) {
this.groupsNames = []
this.machineNames = []
this.projectChange(this.projectName)
}
},
project(val) {
if (val.length > 0) {
this.projectValue = val[0].value
}
}
},
created() {
this.fetchData()
},
methods: {
async test() {
await sleep(10000)
console.log(1)
},
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
// 根据项目获取机床
projectChange(val) {
this.machineNames = []
if (val) {
this.getSelect(searchMachine, ['机床'], 'machineNames', val)
}
},
// 根据机床获取分组
machineChange(val) {
this.groupsNames = []
if (val) {
searchGroupNum1(this.projectName, val).then(response => {
const res = response.data
res.forEach(item => {
this.groupsNames.push({
value: item.组号
})
})
})
}
},
async selected(data) { // 选择需要导入的文件
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
this.itemFile = data.itemFile
},
handleRemove(file) { // 移除文件
for (let i = 0; i < this.itemFile.length; i++) {
if (this.itemFile[i].name === file.name) {
this.worksheet.splice(i, 1)
this.itemFile.splice(i, 1)
}
}
},
removeAll() {
this.worksheet = []
this.itemFile = []
},
async basicPartsToSQL() {
try {
this.loading = true
this.dispatch = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let establishment,
proofread,
review,
date,
machineName,
machineNum,
componentName,
componentNum,
groupNum,
contractNum,
drawingNum,
name,
type,
material,
spareNum,
useNum,
manufacturer,
remarks,
classificationCode
this.group = this.worksheet[j].M2.v.substring(0, this.worksheet[j].M2.v.indexOf('-')) + '组'
if (this.worksheet[j].M2.v.substring(0, 1) === '9' && this.worksheet[j].J2.v.substring(0, 2) === '整改') {
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].F2.v}机床不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else {
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
for (let i = 0; i < 999; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else {
if (machineNum && groupNum) {
await sleep(50)
await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, 1, 1, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
} else {
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
}
this.itemFile.splice(j, 1)
this.worksheet.splice(j, 1)
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
} else {
this.$message.error('只能导入整改组')
}
}
this.loading = false
this.projectChange(this.projectName) // 调用查询机床方法通过watch属性检测变化会自动得到下面表格的值。
} catch (e) {
console.log(e)
this.err++
this.loading = false
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
console.log(`导入数据错误${e}`)
}
},
async insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
try {
if (groupNum.indexOf('MX') > -1) {
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
console.log(res)
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`存在重复数据`)
}
}
} else {
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`存在重复数据`)
}
}
}
} catch (e) {
this.err++
this.$message.error(`导入数据错误`)
console.log(`导入数据错误${e}`)
}
}
}
}
</script>
<style lang="scss" scoped>
.wrapper{
width: 100%;
margin: 0 auto;
}
</style>

View File

@@ -1,816 +0,0 @@
<template>
<div>
<el-card>
<div style="width: 900px;margin-left: 375px">
<span>机床图号:</span>
<el-select v-model="machineValue" filterable clearable size="small" placeholder="机床图号" style="margin-top: 3px;width: 200px;" @change="getGroups">
<el-option
v-for="item in machineNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>分组名称:</span>
<el-select v-model="groupValue" filterable clearable size="small" placeholder="分组名称" style="width: 100px;">
<el-option
v-for="item in groupsNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-tooltip :open-delay="1000" effect="dark" content="将系统中的三表信息传递到零件分配" placement="top">
<el-button :loading="listLoading" :disabled="disabled" type="primary" plain icon="el-icon-d-caret" size="small" style="margin-left: 10px" @click="transferData">传递</el-button>
</el-tooltip>
<el-row style="margin-top: 5px;margin-bottom: 3px">
<span>机床名称:</span>
<el-input v-model="machineName" readonly size="small" placeholder="机床名称" style="width: 200px;margin-right: 10px"/>
<span>机床数量:</span>
<el-input v-model="machineNum" readonly size="small" placeholder="机床数量" style="width: 100px;"/>
<el-tooltip :open-delay="1000" effect="dark" content="删除三表中该组下的所有零件" placement="top">
<el-button type="danger" icon="el-icon-delete" plain size="small" @click="allDelete">一键删除</el-button>
</el-tooltip>
</el-row>
</div>
</el-card>
<el-card>
<el-table
v-loading="listLoading"
:data="tableData"
size="mini"
height="300"
highlight-current-row
border
stripe
@row-click="searchMaterial1">
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column align="center" label="物料状态" min-width="110">
<template slot-scope="scope">
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)===0 && scope.row.分类码===''" type="warning" size="mini" style="margin: 0px">装机数部件数都为0,分类码为空</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)===0 && scope.row.分类码!==''" type="warning" size="mini" style="margin: 0px">装机数部件数都为0</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)!==0 && scope.row.分类码===''" type="warning" size="mini" style="margin: 0px">装机数为0,分类码为空</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)===0 && scope.row.分类码===''" type="warning" size="mini" style="margin: 0px">部件数为0,分类码为空</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)!==0 && scope.row.分类码!==''" type="warning" size="mini" style="margin: 0px">装机数为0</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)===0 && scope.row.分类码!==''" type="warning" size="mini" style="margin: 0px">部件数为0</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)!==0 && scope.row.分类码===''" type="warning" size="mini" style="margin: 0px">分类码为空</el-tag>
<el-tag v-if="scope.row.物料流水号===null" type="warning" size="mini" style="margin: 0px">不存在</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)!==0 && scope.row.分类码!==''" type="primary" size="mini" style="margin: 0px">存在</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="图号" min-width="120">
<template slot-scope="scope">
{{ scope.row.图号或者型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料" width="100">
<template slot-scope="scope">
{{ scope.row.材料或者规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" width="100">
<template slot-scope="scope">
{{ scope.row.规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="备件数量" width="80">
<template slot-scope="scope">
{{ scope.row.备件数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="装机数量" width="80">
<template slot-scope="scope">
{{ scope.row.装机数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="部件数量" width="80">
<template slot-scope="scope">
{{ scope.row.部件数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="制造商" min-width="80">
<template slot-scope="scope">
{{ scope.row.制造商 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="80">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column align="center" label="分类码" width="60">
<template slot-scope="scope">
{{ scope.row.分类码 }}
</template>
</el-table-column>
<el-table-column align="center" label="整改类型" width="300">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.整改类型" @change="submitChangeType(scope.row)" >
<el-radio :label="1" class="radio">新增</el-radio>
<el-radio :label="2" class="radio">替换</el-radio>
<el-radio :label="3" class="radio">补充加工</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column align="center" label="旧图号" >
<template slot-scope="scope">
{{ scope.row.前图号或者型号 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card v-show="groupName!=='MX'">
<el-table
:data="tableData10"
:cell-class-name="cell"
style="width: 100%"
size="mini"
highlight-current-row
height="150"
border>
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<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 label="操作" align="center" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-sort"
@click="handle(scope.row)">替换
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible" 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-input
v-model="form.图号或者型号"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="名称">
<el-input
v-model="form.名称"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="type === 1" label="材料" prop="材料">
<el-select v-model="form.材料流水号" filterable clearable size="small" placeholder="机床名称">
<el-option
v-for="item in materials"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item v-if="type === 2" label="材料" prop="材料">
<el-input v-model="form.物料名称" clearable size="small" style="width: 200px;" placeholder="物料流水号" @dblclick.native="materialShow"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格" prop="规格">
<el-input
v-model="form.规格"
size="small"
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.number="form.备件数量"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装机数量" prop="数量">
<el-input
v-model.number="form.装机数量"
size="small"
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.number="form.部件数量"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="制造商" prop="供货商">
<el-input
v-model.number="form.制造商"
size="small"
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.number="form.分类码"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="备注">
<el-input
v-model.number="form.备注"
type="textarea"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel()">取消</el-button>
<el-button v-show="title==='编辑零件信息'" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogMaterial" title="物料选择">
<el-input v-model="inputMaterial" placeholder="材质" size="small" style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 0 10px 10px" @click="searchMaterial()">查询</el-button>
<el-table
:data="MaterialData"
size="mini"
highlight-current-row
border
@row-click="selectMaterial">
<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>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrentMaterial"
:page-sizes="[10, 20]"
:page-size="pageSizeMaterial"
:total="totalMaterial"
small
layout="sizes, prev, pager, next"
@size-change="handleSizeChangeMaterial"
@current-change="handleCurrentChangeMaterial"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogMaterial=false">提交</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogParts" :title="title1" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" center width="400px">
<span>零件图号</span>
<el-input v-model="PartsValueNum" size="small" placeholder="零件图号" style="width: 200px"/>
<!--<el-select v-model="PartsValueNum" filterable size="small" placeholder="零件图号">-->
<!--<el-option-->
<!--v-for="item in PartsValue"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">提交</el-button>
<el-button type="primary" @click="submitCancel">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { sleep } from '../../../utils/tool'
import { unSpecificationQuery1, updateNum, specificationQuery1, unSpecificationQueryWB1, specificationQueryWB1, deleteBasicParts, deleteBWParts, getMaterial, getMaterialWB, searchMaterialWB, updateRow, updateRowWB, transferMX1, update, searchOldParts, getMachineNames, transferWG1, allDelete, update1, searchMaterial1 } from '../../../api/TechnologyCenter/ImportParts'
import { mapGetters } from 'vuex'
export default {
name: 'SpecificationData',
props: {
groupsNames: {
type: Array,
default: () => []
},
machineNames: {
type: Array,
default: () => []
},
projectName: {
type: String,
default: ''
},
groupName: {
type: String,
default: ''
}
},
data() {
return {
componentNum: '',
groupValue: '',
machineValue: '',
machineName: '',
machineNum: '',
tableData: [],
tableDataAll: [],
tableData10: [],
listLoading: false,
unSpecification: [],
pageCurrent: 1,
pageSize: 10,
total: 0,
title: '',
materials: [],
dialogFormVisible: false,
dialogParts: false,
title1: '',
oldPartsValue: '',
Number: '',
Type: '',
NumId: '', // 物料流水号
PartsValue: [],
PartsValueNum: '',
type: 0, // 零件类型 暂定1为基本件2为外购件和标准件
form: {
id: '',
物料物流号: null, // 当基本件时使用材料流水号,外购件和标准件时,使用物料流水号
物料名称: '',
材料流水号: null,
图号或者型号: '',
名称: '',
材料或者规格: '',
规格: '',
备件数量: '',
装机数量: '',
部件数量: '',
制造商: '',
备注: '',
分类码: ''
},
err: 0,
dialogFormVisibleWB: false,
dialogMaterial: false,
MaterialData: [],
inputMaterial: '',
rules: {
},
rulesWB: {
},
pageCurrentMaterial: 1,
pageSizeMaterial: 10,
totalMaterial: 0,
loadingMaterial: false
}
},
computed: {
disabled() {
if (this.tableDataAll.length === 0) {
return true
}
if (this.unSpecification.data) {
return this.unSpecification.data.length > 0
}
return true
},
materialName() {
for (let i = 0; i < this.materials.length; i++) {
if (this.materials[i].value === this.form.材料流水号) {
return this.materials[i].label
}
}
},
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
watch: {
machineNames(val) {
this.machineName = ''
this.machineNum = ''
this.total = 0
this.machineValue = val.length > 0 ? val[0].value : ''
this.getGroups()
},
machineValue() {
this.getMachineNames()
},
groupsNames(val) {
this.groupValue = val.length > 0 ? val[0].value : ''
},
groupValue(val) {
val ? this.fetchData() : this.tableData = []
},
groupName(val) {
val ? this.fetchData() : this.tableData = []
}
},
mounted() {
this.getSelect(getMaterial, ['材料', '材料流水号'], 'materials')
},
methods: {
cell({ row, column, rowIndex, columnIndex }) {
if (row.对比类型 === 1 && columnIndex === 2) {
return 'ContrastMaterial1'
}
if (row.对比类型 === 3 && columnIndex === 1) {
return 'ContrastMaterial1'
}
if (row.对比类型 === 4 && columnIndex === 3) {
return 'ContrastMaterial1'
}
},
async fetchData() {
console.log(this.$store.state.user.id, 12232434)
this.pageCurrent = 1
this.tableData10 = []
try {
this.listLoading = true
this.total = 0
this.tableDataAll = []
const projectCheck = this.projectName ? 1 : 0
const machineCheck = this.machineValue ? 1 : 0
const groupCheck = this.groupValue ? 1 : 0
console.log(this.groupName)
if (this.groupName.indexOf('MX') > -1) { // 当分组为基本件时,查询基本件规范和不规范数据,否则查询外购件或标准件规范和不规范数据
// 分别查出规范和不规范数据,将规范数据放前面在一个总数组中
this.type = 1
this.unSpecification = await unSpecificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
this.unSpecification.data.forEach(item => {
this.tableDataAll.push(item)
})
const specification = await specificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
specification.data.forEach(item => {
this.tableDataAll.push(item)
})
} else {
this.type = 2
this.unSpecification = await unSpecificationQueryWB1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
console.log(this.unSpecification)
this.unSpecification.data.forEach(item => {
this.tableDataAll.push(item)
})
const specification = await specificationQueryWB1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
specification.data.forEach(item => {
this.tableDataAll.push(item)
})
}
this.total = this.tableDataAll.length
this.pagination(this.pageCurrent, this.pageSize) // 前端分页数据很多生成DOM节点也多分页效果很明显。
this.listLoading = false
} catch (e) {
console.log(`查询零件发生错误:${e}`)
}
},
submitChangeType(row) {
this.Number = row.id
this.Type = row.整改类型
if (this.groupName.indexOf('MX') > -1) {
if (row.整改类型 === 1) {
update(this.projectName, this.machineValue, row.id, row.整改类型).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
}
})
} else if (row.整改类型 === 2) {
this.title1 = '替换'
this.oldPartsValue = row.图号或者型号.split('-')[0] + '-' + row.图号或者型号.split('-')[1].substring(2, 7)
searchOldParts(this.projectName, this.machineValue, this.oldPartsValue).then(response => {
this.PartsValueNum = response.data[0].图号或者型号
})
this.dialogParts = true
} else {
this.title1 = '补充加工'
this.oldPartsValue = row.图号或者型号.split('-')[0] + '-' + row.图号或者型号.split('-')[1].substring(2, 7)
searchOldParts(this.projectName, this.machineValue, this.oldPartsValue).then(response => {
this.PartsValueNum = response.data[0].图号或者型号
})
this.dialogParts = true
}
} else {
update1(row.id, row.整改类型).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
}
})
}
},
searchMaterial1(row) {
console.log(row)
this.NumId = row.id
searchMaterial1(row.图号或者型号, row.名称, row.规格).then(response => {
this.tableData10 = response.data
console.log(response.data)
})
},
allDelete() {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.projectName !== '' && this.machineValue !== '' && this.groupValue !== '') {
allDelete(this.projectName, this.machineValue, this.groupValue).then(response => {
if (response.data[0].result === '1') {
this.tableData = []
this.tableData10 = []
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择好项目机床分组')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
getMachineNames() {
this.machineName = []
this.machineNum = []
getMachineNames(this.machineValue).then(response => {
console.log(response.data, 3333)
if (response.data.length !== 0) {
this.machineName = response.data[0].机床名称
this.machineNum = response.data[0].机床数量
}
})
},
submit() {
this.dialogParts = false
update(this.projectName, this.machineValue, this.Number, this.Type, this.PartsValueNum).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
this.$message.success('关联成功')
} else {
this.$message.error('关联失败')
}
})
},
submitCancel() {
this.dialogParts = false
update(this.projectName, this.machineValue, this.Number, 0).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
this.$message.success('取消成功')
} else {
this.$message.error('取消失败')
}
})
},
getGroups() {
this.$emit('machineChange', this.machineValue)
},
pagination(pageCurrent, pageSize) {
this.tableData = this.tableDataAll.slice((pageCurrent - 1) * pageSize, pageCurrent * pageSize)
},
handleEdit(row) {
this.editForm(row, 'form', [this.title = '编辑零件信息', this.dialogFormVisible = true])
if (this.type === 2) {
this.form.物料名称 = row.材料或者规格
this.form.物料物流号 = row.物料流水号
}
},
submitEdit() {
if (this.type === 1) {
this.editTable(updateRow, [this.form.图号或者型号, this.form.名称, this.form.规格, this.materialName, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.材料流水号, this.form.部件数量], 'form', function() {
this.dialogFormVisible = false
this.fetchData()
})
} else if (this.type === 2) {
this.editTable(updateRowWB, [this.form.图号或者型号, this.form.名称, this.form.规格, this.form.物料名称, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.物料流水号, this.form.部件数量], 'form', function() {
this.dialogFormVisible = false
this.fetchData()
})
} else {
console.log(`编辑类型发生错误`)
}
},
handle(row) {
this.$confirm('是否替换?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateNum(row.物料流水号, this.NumId).then(response => {
if (response.data[0].result === '1') {
this.$message.success('替换成功')
this.tableData10 = []
this.fetchData()
} else {
this.$message.error('替换失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消替换'
})
})
},
cancel() {
this.dialogFormVisible = false
},
handleDelete(row) {
if (this.type === 1) {
this.deleteRow(deleteBasicParts, row.id, function() {
this.fetchData()
})
} else {
this.deleteRow(deleteBWParts, row.id, function() {
this.fetchData()
})
}
},
materialShow() {
this.inputMaterial = ''
this.getMaterialWB()
this.dialogMaterial = true
},
getMaterialWB() {
this.getTable(getMaterialWB, [this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
},
searchMaterial() {
this.getTable(searchMaterialWB, [this.inputMaterial, this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
},
selectMaterial(row) {
this.dialogMaterial = false
this.form.物料流水号 = row.物料流水号
this.form.物料名称 = row.物料名称
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.pagination(this.pageCurrent, this.pageSize)
},
handleCurrentChange(val) {
this.pageCurrent = val
this.pagination(this.pageCurrent, this.pageSize)
},
handleSizeChangeMaterial(val) {
this.pageCurrentMaterial = 1
this.pageSizeMaterial = val
this.getMaterialWB()
},
handleCurrentChangeMaterial(val) {
this.pageCurrentMaterial = val
this.getMaterialWB()
},
async transferData() {
try {
this.err = 0
if (this.groupValue) {
this.listLoading = true
if (this.groupName.indexOf('MX') > -1) {
for (let i = 0; i < this.tableDataAll.length; i++) {
const data = this.tableDataAll[i]
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
const resp = await transferMX1(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.分类码, data.整改类型, data.id, data.前id, data.前图号或者型号, this.id)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
}
}
} else {
for (let i = 0; i < this.tableDataAll.length; i++) {
let dataType
const data = this.tableDataAll[i]
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
if (this.groupName.indexOf('WG') > -1) {
dataType = 2
} else {
dataType = 1
}
console.log(data)
const resp = await transferWG1(data.组件流水号, data.物料流水号, total, data.备注, data.标记, data.设计者编号, data.是否传递, dataType, data.序号, data.id, data.备件数量, data.分类码, data.整改类型, this.id)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
this.$notify.error(`传递零件失败`)
}
}
}
if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失
const index = this.groupsNames.indexOf(this.groupValue)
this.groupsNames.splice(index, 1)
if (this.groupsNames.length === 0) {
const groupIndex = this.machineNames.indexOf(this.machineValue)
this.machineNames.splice(groupIndex, 1)
}
this.$message.success(`传递成功`)
this.tableDataAll = []
this.tableData = []
this.tableData10 = []
} else {
this.$message.error(`${this.err}个零件传递失败`)
}
this.listLoading = false
} else {
this.$message.warning(`请选择分组传递`)
}
} catch (e) {
this.$message.error(`传递发生错误`)
console.log(`${e}`)
}
}
}
}
</script>
<style>
.el-table .warning-row {
background: red;
}
.ContrastMaterial1{
background: palevioletred !important;
}
</style>
<style scoped>
span{
margin: 3px;
}
radio {
margin-left: 3px;
}
</style>

View File

@@ -1,484 +0,0 @@
<template>
<div class="app-container">
<el-card v-loading="loading">
<el-col :span="6">
<div style="width: 650px;margin: 0px 380px ">
<div style="overflow: hidden">
<div style="margin-bottom: 0px;margin-left: 50px">
<span>项目</span>
<el-select v-model="projectValue" filterable size="small" placeholder="项目名称" style="margin-top: 3px;width: 150px">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">类型</span>
<el-select v-model="groupName" filterable size="small" placeholder="类型" style="width: 80px">
<el-option
v-for="item in Group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="distribution" size="small" icon="el-icon-upload2" style="margin-left: 10px" @click="opendialogVisibleMachine()">上传总图</el-button>
</div>
<upload-excel-component @on-selected-file="selected"/>
</div>
<div>
<span v-show="worksheet.length > 1" style="cursor: pointer;width: 50px" @click="removeAll"><i class="el-icon-close"/></span>
<el-upload :on-remove="handleRemove" :file-list="itemFile" action=""/>
</div>
<div v-if="worksheet.length !== 0" style="float: right;margin: 3px 0">
<el-button :disabled="disabled" icon="el-icon-upload2" type="primary" size="small" @click="basicPartsToSQL">导入到数据库</el-button>
</div>
</div>
</el-col>
</el-card>
<specification-data ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" :group-name="groupName" @machineChange="machineChange"/>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogVisibleMachine"
width="30%">
<el-card>
<el-select v-model="machineDrawValue" clearable filterable size="small" placeholder="机床名称" @change="changeMachine">
<el-option
v-for="item in machineDraw"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<div style="float: right;">
<el-upload
:disabled="disabledMachine"
:action="action"
:on-success="uploadSuccess"
:on-error="uploadFailure"
:show-file-list="showFileList"
:file-list="fileList"
class="upload-demo"
multiple>
<el-button :disabled="disabledMachine" size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action">
<a class="delete" @click="deleteFileData(file.id)">删除</a>
</div>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a :href="file.url"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-card>
</el-dialog>
</div>
</template>
<script>
import UploadExcelComponent from './UploadExcel/index.vue'
import specificationData from './specificationData'
import { sleep } from '../../../utils/tool'
import { initProject, isExit, isExit1, importBasics, importPurcharse, searchMachine, searchGroupNum, machineSelect, getFileData, deleteFileData } from '../../../api/TechnologyCenter/ImportParts'
import { uploadFileMachine, downloadFileMachine } from '@/utils/request'
export default {
name: 'UploadExcel',
components: { UploadExcelComponent, specificationData },
data() {
return {
fileList: [],
hadFile: [],
showFileList: true,
projectId: '',
action: '',
disabledMachine: true,
machineDrawValue: '',
machineDraw: [],
dialogVisibleMachine: false,
project: [],
projectValue: '',
worksheet: [],
itemFile: [],
loading: false,
groupsNames: [],
groupName: '',
Group: [{
value: 'MX',
name: 'MX'
}, {
value: 'WG',
name: 'WG'
}, {
value: 'BZ',
name: 'BZ'
}],
group: '',
ceshi: '',
machineNames: [],
err: 0,
disabled: false
}
},
computed: {
projectName() {
for (let i = 0; i < this.project.length; i++) {
if (this.project[i].value === this.projectValue) {
return this.project[i].label
}
}
}
},
watch: {
projectValue(val) {
if (val) {
this.groupsNames = []
this.machineNames = []
this.projectChange(this.projectName)
}
},
project(val) {
if (val.length > 0) {
this.projectValue = val[0].value
}
}
},
created() {
this.fetchData()
},
methods: {
opendialogVisibleMachine() {
this.machineDraw = []
this.machineDrawValue = ''
this.dialogVisibleMachine = true
this.machineDrawValue === '' ? this.disabledMachine = true : this.disabledMachine = false
this.getSelect(machineSelect, ['机床图号', '机床流水号'], 'machineDraw', this.projectValue)
},
changeMachine() {
this.machineDrawValue === '' ? this.disabledMachine = true : this.disabledMachine = false
this.action = `${uploadFileMachine}?&MachineNum=${this.machineDrawValue}`
this.getFileData(this.machineDrawValue)
},
uploadSuccess(res, file, fileList) {
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
this.getFileData(this.machineDrawValue)
}
},
uploadFailure(a, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
},
// 在什么情况下需要查询上传的附件调用this.getFileData()即可根据
getFileData(machineDrawValue) {
this.hadFile = []
getFileData(machineDrawValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${downloadFileMachine}?id=${item.文件标识}.${item.文件后缀}&name=${item.文件名称}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
deleteFileData(id) {
this.deleteRow(deleteFileData, id, function() { this.getFileData(this.machineDrawValue) })
},
async test() {
await sleep(10000)
},
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
// 根据项目获取机床
projectChange(val) {
this.machineNames = []
if (val) {
this.getSelect(searchMachine, ['机床'], 'machineNames', val)
}
},
// 根据机床获取分组
machineChange(val) {
this.groupsNames = []
if (val) {
searchGroupNum(this.projectName, val).then(response => {
const res = response.data
res.forEach(item => {
this.groupsNames.push({
value: item.组号
})
})
})
}
},
async selected(data) { // 选择需要导入的文件
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
this.itemFile = data.itemFile
},
handleRemove(file) { // 移除文件
for (let i = 0; i < this.itemFile.length; i++) {
if (this.itemFile[i].name === file.name) {
this.worksheet.splice(i, 1)
this.itemFile.splice(i, 1)
}
}
},
removeAll() {
this.worksheet = []
this.itemFile = []
},
async basicPartsToSQL() {
try {
this.loading = true
this.dispatch = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let establishment,
proofread,
review,
date,
machineName,
machineNum,
componentName,
componentNum,
groupNum,
contractNum,
drawingNum,
name,
type,
material,
spareNum,
useNum,
manufacturer,
remarks,
classificationCode
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.worksheet[j].F2.v}机床不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else {
if (this.worksheet[j].M2.v === '00-MX') {
this.group = this.worksheet[j].M2.v
if (this.worksheet[j].M2.v.substring(0, 1) !== '9') {
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
for (let i = 0; i < 999; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else {
if (machineNum && groupNum) {
await sleep(50)
await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, 1, 1, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
} else {
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
} else {
this.$notify.error('禁止导入整改组')
break
}
} else {
this.group = this.worksheet[j].M2.v.substring(0, this.worksheet[j].M2.v.indexOf('-')) + '组'
const response = await isExit1(this.projectValue, this.worksheet[j].F2.v, this.group)
const res = response.data
if (res[0].Column1 === 0) {
this.$notify.error(`${this.group}组件不存在,请确认文件是否正确`)
this.loading = false
this.disabled = false
return
} else {
if (this.worksheet[j].M2.v.substring(0, 1) !== '9') {
console.log(this.worksheet[j].P1, 123344)
this.worksheet[j].G1 ? establishment = this.worksheet[j].G1.v : establishment = ''
this.worksheet[j].I1 ? proofread = this.worksheet[j].I1.v : proofread = ''
this.worksheet[j].L1 ? review = this.worksheet[j].L1.v : review = ''
this.worksheet[j].P1 ? date = this.worksheet[j].P1.v : date = ''
this.worksheet[j].C2 ? machineName = this.worksheet[j].C2.v : machineName = ''
this.worksheet[j].F2 ? machineNum = this.worksheet[j].F2.v : machineNum = ''
this.worksheet[j].J2 ? componentName = this.worksheet[j].J2.v : componentName = ''
this.worksheet[j].P2 ? componentNum = this.worksheet[j].P2.v : componentNum = ''
this.worksheet[j].R2 ? contractNum = this.worksheet[j].R2.v : contractNum = ''
this.worksheet[j].M2 ? groupNum = this.worksheet[j].M2.v : groupNum = ''
for (let i = 0; i < 999; i++) {
const attr = i + 4
drawingNum = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
name = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
type = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
material = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
spareNum = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
useNum = this.worksheet[j][`M${attr}`] ? this.worksheet[j][`M${attr}`].v : ''
manufacturer = this.worksheet[j][`O${attr}`] ? this.worksheet[j][`O${attr}`].v : ''
remarks = this.worksheet[j][`Q${attr}`] ? this.worksheet[j][`Q${attr}`].v : ''
classificationCode = this.worksheet[j][`R${attr}`] ? this.worksheet[j][`R${attr}`].v : ''
if (!drawingNum && !name && !type && !material && !spareNum && !useNum && !manufacturer && !remarks && !classificationCode) { // 当图号、名称、规格、材料、备件数量、装机数量、制造商、备注、分类码都为空时,循环终止,防止向数据库中插入多余且无用的数据
break
} else {
if (machineNum && groupNum) {
await sleep(50)
await this.insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, 1, 1, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
} else {
this.loading = false
this.disabled = false
this.$notify.error(`请确认导入文件是否正确`)
return
}
}
}
} else {
this.$notify.error('禁止导入整改组')
break
}
}
}
}
this.itemFile.splice(j, 1)
this.worksheet.splice(j, 1)
this.err === 0 ? this.$message.success(`导入完成`) : this.$message.error(`导入失败零件个数为${this.err},请检查文件是否正确`)
}
this.loading = false
this.projectChange(this.projectName) // 调用查询机床方法通过watch属性检测变化会自动得到下面表格的值。
} catch (e) {
this.err++
this.loading = false
this.$notify.error(`导入数据错误,请检查导入文件是否正确`)
console.log(`导入数据错误${e}`)
}
},
async insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
try {
if (groupNum.indexOf('MX') > -1) {
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`存在重复数据`)
}
}
} else {
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
const res = response.data
if (res.hasOwnProperty('output') === false) {
if (res[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
} else {
if (res.result[0].result === '0') {
this.$notify.error(`${drawingNum}导入失败`)
}
if (res.output[0].导入类型 === '2') {
this.$notify.warning(`存在重复数据`)
}
}
}
} catch (e) {
this.err++
this.$message.error(`导入数据错误`)
console.log(`导入数据错误${e}`)
}
}
}
}
</script>
<style lang="scss" scoped>
/*.wrapper{*/
/*width: 100%;*/
/*margin: 0 auto;*/
/*}*/
.wrapper{
width: 225px;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
float: left;
margin: 10px;
}
.content{
position: relative;
padding: 8px 8px 0 8px;
}
.action{
position: absolute;
top: 4px;
right: 8px;
}
.delete{
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover{
background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
color: #fff;
}
a{
text-decoration: none;
}
.icon{
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info{
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
</style>

View File

@@ -1,688 +0,0 @@
<template>
<div>
<el-card>
<div style="width: 900px;margin-left: 375px">
<span>机床图号:</span>
<el-select v-model="machineValue" filterable clearable size="small" placeholder="机床图号" style="margin-top: 3px;width: 200px;" @change="getGroups">
<el-option
v-for="item in machineNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>分组名称:</span>
<el-select v-model="groupValue" filterable clearable size="small" placeholder="分组名称" style="width: 100px;">
<el-option
v-for="item in groupsNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-tooltip :open-delay="1000" content="将系统中的三表信息传递到零件分配" placement="top" effect="light">
<el-button :loading="listLoading" :disabled="disabled" type="primary" plain icon="el-icon-d-caret" size="small" style="margin-left: 10px" @click="transferData">传递</el-button>
</el-tooltip>
<el-row style="margin-top: 5px;margin-bottom: 3px">
<span>机床名称:</span>
<el-input v-model="machineName" readonly size="small" placeholder="机床名称" style="width: 200px;margin-right: 10px"/>
<span>机床数量:</span>
<el-input v-model="machineNum" readonly size="small" placeholder="机床数量" style="width: 100px;"/>
<el-tooltip :open-delay="1000" effect="dark" content="删除三表中该组下的所有零件" placement="top">
<el-button type="danger" icon="el-icon-delete" plain size="small" @click="allDelete">删除该组</el-button>
</el-tooltip>
</el-row>
</div>
</el-card>
<el-row>
<el-col style="width: 60%">
<el-card>
<el-table
v-loading="listLoading1"
:data="tableData"
size="mini"
border
stripe
style="width: 100%"
height="500px"
highlight-current-row
@row-click="searchMaterial1">
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column align="center" label="物料" min-width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)===0" type="warning" size="mini" style="margin: 0px">装机数部件数都为0</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量===0 && Number(scope.row.部件数量)!==0" type="warning" size="mini" style="margin: 0px">装机数为0</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)===0" type="warning" size="mini" style="margin: 0px">部件数为0</el-tag>
<el-tag v-if="scope.row.物料流水号===null" type="warning" size="mini" style="margin: 0px">不存在</el-tag>
<el-tag v-if="scope.row.物料流水号!==null && scope.row.装机数量!==0 && Number(scope.row.部件数量)!==0" type="primary" size="mini" style="margin: 0px">存在</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="图号" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.图号或者型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料" width="70" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.材料或者规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" width="120" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="备件数" width="70" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备件数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="装机数" width="70" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.装机数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="部件数" width="70" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.部件数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="制造商" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.制造商 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="80" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column align="center" label="分类码" width="80" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.分类码 }}
</template>
</el-table-column>
<!--<el-table-column label="操作" fixed="right" align="center" width="200">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--size="mini"-->
<!--type="primary"-->
<!--icon="el-icon-edit"-->
<!--@click="handleEdit(scope.row)">编辑</el-button>-->
<!--<el-button-->
<!--size="mini"-->
<!--type="danger"-->
<!--icon="el-icon-delete"-->
<!--@click="handleDelete(scope.row)">删除</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</el-col>
<el-col style="width: 40%">
<el-card>
<el-table
:data="tableData10"
:cell-class-name="cell"
style="width: 100%"
size="mini"
height="530px"
highlight-current-row
border>
<el-table-column align="center" label="物料名称" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="80px">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-sort"
@click="handle(scope.row)">替换
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-dialog :title="title" :visible.sync="dialogFormVisible" 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-input
v-model="form.图号或者型号"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="名称">
<el-input
v-model="form.名称"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="type === 1" label="材料" prop="材料">
<el-select v-model="form.材料流水号" filterable clearable size="small" placeholder="机床名称">
<el-option
v-for="item in materials"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item v-if="type === 2" label="规格" prop="规格">
<el-input
v-model="form.规格"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备件数量" prop="数量">
<el-input
v-model.number="form.备件数量"
size="small"
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.number="form.装机数量"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部件数量" prop="数量">
<el-input
v-model.number="form.部件数量"
size="small"
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.number="form.制造商"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分类码" prop="分类码">
<el-input
v-model.number="form.分类码"
size="small"
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.number="form.备注"
type="textarea"
size="small"
style="width: 200px;"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel()">取消</el-button>
<el-button v-show="title==='编辑零件信息'" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { sleep } from '../../../utils/tool'
import { unSpecificationQuery, unSpecificationQueryWB, specificationQueryWB, specificationQuery, deleteBasicParts, deleteBWParts, getMaterial, getMaterialWB, searchMaterialWB, updateRow, updateRowWB, transferMX, transferWG, allDelete, searchMaterial1, getMachineNames, updateNum, verification } from '../../../api/TechnologyCenter/ImportParts'
export default {
name: 'SpecificationData',
props: {
groupsNames: {
type: Array,
default: () => []
},
machineNames: {
type: Array,
default: () => []
},
projectName: {
type: String,
default: ''
},
groupName: {
type: String,
default: ''
}
},
data() {
return {
componentNum: '',
groupValue: '',
machineValue: '',
machineName: '',
machineNum: '',
tableData: [],
tableDataAll: [],
tableData10: [],
listLoading: false,
listLoading1: false,
unSpecification: [],
pageCurrent: 1,
pageSize: 10,
total: 0,
title: '',
NumId: '',
materials: [],
dialogFormVisible: false,
type: 0, // 零件类型 暂定1为基本件2为外购件和标准件
form: {
id: '',
物料物流号: null, // 当基本件时使用材料流水号,外购件和标准件时,使用物料流水号
物料名称: '',
材料流水号: null,
图号或者型号: '',
名称: '',
材料或者规格: '',
规格: '',
备件数量: '',
装机数量: '',
部件数量: '',
制造商: '',
备注: '',
分类码: ''
},
err: 0,
dialogFormVisibleWB: false,
MaterialData: [],
inputMaterial: '',
rules: {
},
rulesWB: {
},
pageCurrentMaterial: 1,
pageSizeMaterial: 10,
totalMaterial: 0,
loadingMaterial: false,
multipleSelection: []
}
},
computed: {
disabled() {
if (this.tableDataAll.length === 0) {
return true
}
if (this.unSpecification.data) {
return this.unSpecification.data.length > 0
}
if (this.listLoading === true) {
return true
}
return true
},
materialName() {
for (let i = 0; i < this.materials.length; i++) {
if (this.materials[i].value === this.form.材料流水号) {
return this.materials[i].label
}
}
}
},
watch: {
machineNames(val) {
this.machineName = ''
this.machineNum = ''
this.total = 0
this.machineValue = val.length > 0 ? val[0].value : ''
this.getGroups()
},
machineValue() {
this.getMachineNames()
},
groupsNames(val) {
this.groupValue = val.length > 0 ? val[0].value : ''
},
groupValue(val) {
val ? this.fetchData() : this.tableData = []
},
groupName(val) {
val ? this.fetchData() : this.tableData = []
}
},
mounted() {
this.getSelect(getMaterial, ['材料', '材料流水号'], 'materials')
},
methods: {
cell({ row, column, rowIndex, columnIndex }) {
if (row.对比类型 === 1 && columnIndex === 1) {
return 'ContrastMaterial'
}
if (row.对比类型 === 3 && columnIndex === 0) {
return 'ContrastMaterial'
}
if (row.对比类型 === 4 && columnIndex === 2) {
return 'ContrastMaterial'
}
},
handle(row) {
this.$confirm('是否替换?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
verification(row.物料流水号, this.projectName, this.machineValue, this.groupValue).then(response => {
console.log(response.data, 111)
if (response.data[0].结果 === 1) {
this.$message.warning('要替换的物料已经存在该分组内,不允许出现相同物料')
} else {
updateNum(row.物料流水号, this.NumId).then(response => {
if (response.data[0].result === '1') {
this.$message.success('替换成功')
this.tableData10 = []
this.fetchData()
} else {
this.$message.error('替换失败')
}
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消替换'
})
})
},
async fetchData() {
this.pageCurrent = 1
this.tableData10 = []
try {
this.listLoading1 = true
this.total = 0
this.tableDataAll = []
const projectCheck = this.projectName ? 1 : 0
const machineCheck = this.machineValue ? 1 : 0
const groupCheck = this.groupValue ? 1 : 0
if (this.groupName.indexOf('MX') > -1) { // 当分组为基本件时,查询基本件规范和不规范数据,否则查询外购件或标准件规范和不规范数据
// 分别查出规范和不规范数据,将规范数据放前面在一个总数组中
this.type = 1
this.unSpecification = await unSpecificationQuery(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
this.unSpecification.data.forEach(item => {
this.tableDataAll.push(item)
})
const specification = await specificationQuery(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
specification.data.forEach(item => {
this.tableDataAll.push(item)
})
} else {
this.type = 2
this.unSpecification = await unSpecificationQueryWB(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
this.unSpecification.data.forEach(item => {
this.tableDataAll.push(item)
})
const specification = await specificationQueryWB(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
specification.data.forEach(item => {
this.tableDataAll.push(item)
})
}
this.total = this.tableDataAll.length
this.pagination(this.pageCurrent, this.pageSize) // 前端分页数据很多生成DOM节点也多分页效果很明显。
this.listLoading1 = false
} catch (e) {
console.log(`查询零件发生错误:${e}`)
}
},
allDelete() {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.projectName !== '' && this.machineValue !== '' && this.groupValue !== '') {
allDelete(this.projectName, this.machineValue, this.groupValue).then(response => {
if (response.data[0].result === '1') {
this.tableData = []
this.total = 0
this.tableData10 = []
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
} else {
this.$message.warning('请选择好项目机床分组')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
getMachineNames() {
getMachineNames(this.machineValue).then(response => {
this.machineName = response.data[0].机床名称
this.machineNum = response.data[0].机床数量
})
},
getGroups() {
this.$emit('machineChange', this.machineValue)
},
pagination(pageCurrent, pageSize) {
this.tableData = this.tableDataAll.slice((pageCurrent - 1) * pageSize, pageCurrent * pageSize)
},
handleEdit(row) {
this.editForm(row, 'form', [this.title = '编辑零件信息', this.dialogFormVisible = true])
if (this.type === 2) {
this.form.物料名称 = row.材料或者规格
this.form.物料流水号 = row.物料流水号
}
},
submitEdit() {
if (this.type === 1) {
this.editTable(updateRow, [this.form.图号或者型号, this.form.名称, this.form.规格, this.materialName, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.材料流水号, this.form.部件数量], 'form', function() {
this.dialogFormVisible = false
this.fetchData()
})
} else if (this.type === 2) {
this.editTable(updateRowWB, [this.form.图号或者型号, this.form.名称, this.form.规格, this.form.物料名称, this.form.备件数量, this.form.装机数量, this.form.制造商, this.form.备注, this.form.分类码, this.form.id, this.form.物料流水号, this.form.部件数量], 'form', function() {
this.dialogFormVisible = false
this.fetchData()
})
} else {
console.log(`编辑类型发生错误`)
}
},
cancel() {
this.dialogFormVisible = false
},
handleDelete(row) {
if (this.type === 1) {
this.deleteRow(deleteBasicParts, row.id, function() {
this.fetchData()
})
} else {
this.deleteRow(deleteBWParts, row.id, function() {
this.fetchData()
})
}
},
searchMaterial1(row) {
this.NumId = row.id
searchMaterial1(row.图号或者型号, row.名称, row.规格).then(response => {
this.tableData10 = response.data
})
},
getMaterialWB() {
this.getTable(getMaterialWB, [this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
},
searchMaterial() {
this.getTable(searchMaterialWB, [this.inputMaterial, this.pageCurrentMaterial, this.pageSizeMaterial], ['MaterialData', 'totalMaterial', 'loadingMaterial'])
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.pagination(this.pageCurrent, this.pageSize)
},
handleCurrentChange(val) {
this.pageCurrent = val
this.pagination(this.pageCurrent, this.pageSize)
},
handleSizeChangeMaterial(val) {
this.pageCurrentMaterial = 1
this.pageSizeMaterial = val
this.getMaterialWB()
},
handleCurrentChangeMaterial(val) {
this.pageCurrentMaterial = val
this.getMaterialWB()
},
async transferData() {
try {
this.err = 0
if (this.groupValue) {
this.listLoading = true
if (this.groupName.indexOf('MX') > -1) {
for (let i = 0; i < this.tableDataAll.length; i++) {
const data = this.tableDataAll[i]
if (this.groupValue.indexOf('00') > -1) {
const index = data.图号或者型号.lastIndexOf('-')
data.图号或者型号 = data.图号或者型号.substring(index + 1)
if (data.图号或者型号.indexOf('组') > -1) {
const total = parseInt(data.备件数量) + parseFloat(data.装机数量) * parseInt(data.部件数量)
const resp = await transferMX(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.id, data.备件数量, '', this.$store.state.user.id)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
}
} else {
const total = parseInt(data.备件数量) + parseFloat(data.装机数量) * parseInt(data.部件数量)
const resp = await transferMX(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.id, data.备件数量, 1)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
}
}
} else {
const total = parseInt(data.备件数量) + parseFloat(data.装机数量) * parseInt(data.部件数量)
const resp = await transferMX(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.id, data.备件数量, '', this.$store.state.user.id)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
}
}
}
} else {
for (let i = 0; i < this.tableDataAll.length; i++) {
let dataType
const data = this.tableDataAll[i]
const total = parseInt(data.备件数量) + parseFloat(data.装机数量) * parseInt(data.部件数量)
if (this.groupName.indexOf('WG') > -1) {
dataType = 2
} else {
dataType = 1
}
const resp = await transferWG(data.组件流水号, data.物料流水号, total, data.备注, data.标记, data.设计者编号, data.是否传递, dataType, data.序号, data.id, data.备件数量, this.$store.state.user.id)
await sleep(10)
if (resp.data[0].result === '0') {
this.err++
this.$notify.error(`传递零件失败`)
}
}
}
if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失
// const index = this.groupsNames.indexOf(this.groupValue)
// this.groupsNames.splice(index, 1)
if (this.groupsNames.length === 0) {
const groupIndex = this.machineNames.indexOf(this.machineValue)
this.machineNames.splice(groupIndex, 1)
}
this.machineValue = ''
this.groupValue = ''
this.machineName = ''
this.machineNum = ''
this.$message.success(`传递成功`)
this.tableDataAll = []
this.tableData = []
this.tableData10 = []
} else {
this.$message.error(`${this.err}个零件传递失败`)
}
setTimeout(() => {
this.listLoading = false
}, 6000)
} else {
this.$message.warning(`请选择分组传递`)
}
} catch (e) {
this.$message.error(`传递发生错误`)
console.log(`${e}`)
}
}
}
}
</script>
<style>
.ContrastMaterial{
background: palevioletred !important;
}
</style>
<style scoped>
span{
margin: 10px;
}
</style>

View File

@@ -1,196 +0,0 @@
import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
// 初始化 项目名称
export function initProject() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_项目名称_查询数据_按时间排序'
}
})
}
// 导入Excel
export function upload(project, machine, group, designer) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '组件明细表_基本件_导入数据',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group + '&设计者=' + designer
}
})
}
// 导入Excel1
export function upload1(designer, time, project, machine, group, num1, num2, name, size, num3, supplier, remark, mark) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '组件明细表_基本件_导入数据1',
param: '设计者=' + designer + '&保存时间=' + time + '&项目=' + project + '&机床=' + machine + '&组号=' + group + '&序号=' + num1 + '&图号或者型号=' + num2 + '=string&名称=' + name + '&材料或者规格=' + size + '&数量=' + num3 + '&供货商=' + supplier + '&备注=' + remark + '&标记=' + mark
}
})
}
// 查询零件(查重)
export function searchPart(project, machine, group) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '导入数据_查询',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group
}
})
}
// 导入Excel外购件
export function outBuyUpload(project, machine, group, designer) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '组件明细表_外购件_导入数据',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group + '&设计者=' + designer
}
})
}
// 导入Excel1外购件
export function outBuyUpload1(designer, time, project, machine, group, num1, num2, name, size, num3, supplier, remark, mark) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '组件明细表_外购件_导入数据1',
param: '设计者=' + designer + '&保存时间=' + time + '&项目=' + project + '&机床=' + machine + '&组号=' + group + '&序号=' + num1 + '&图号或者型号=' + num2 + '&名称=' + name + '&材料或者规格=' + size + '&数量=' + num3 + '&供货商=' + supplier + '&备注=' + remark + '&标记=' + mark
}
})
}
// 查询零件(查重)外购件
export function outBuySearchPart(project, machine, group) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '导入数据_外购件_查询',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group
}
})
}
// 查询零件 基本件
export function searchBasePartDetail(project, machine, group) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_零件明细表_基本件_数据导入保存_查询数据_综合_全部',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group
}
})
}
// 查询零件 基本件
export function searchOutPartDetail(project, machine, group) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_零件明细表_外购件和标准件_数据导入保存_综合_全部',
param: '项目=' + project + '&机床=' + machine + '&组号=' + group
}
})
}
// 删除 基本件
export function deleteTable1(id) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: 'PDM_零件明细表_基本件_数据导入保存_删除数据',
param: 'id=' + id
}
})
}
// 删除 外购件
export function deleteTable2(id) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: 'PDM_零件明细表_外购件和标准件_数据导入保存_删除数据',
param: 'id=' + id
}
})
}
// 初始化规范 备注
export function initStandard1() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_零件明细表_基本件_数据导入保存_查询数据_规范表_备注'
}
})
}
// 初始化规范 材料或者规格
export function initStandard2() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_零件明细表_基本件_数据导入保存_查询数据_规范表_材料或者规格'
}
})
}
// 初始化规范 物料流水号
export function initStandard3() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: 'PDM_零件明细表_基本件_数据导入保存_查询数据_规范表_物料流水号'
}
})
}

View File

@@ -0,0 +1,883 @@
<template>
<div class="app-container">
<el-card style="height: 850px;padding: 0">
<el-tabs
v-model="PartType"
type="border-card"
@tab-click="pageCurrent=1;pageCurrent1=1;searchTable();searchTable1()">
<el-tab-pane label="零件图纸" name="零件图纸">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-input
v-model="partsName"
size="small"
placeholder="零件名称"
clearable
style="float: left;width: 200px"/>
<el-button
type="primary"
plain
icon="el-icon-search"
size="small"
style="float: left;margin-left:10px"
@click="pageCurrent=1;searchTable()">查询
</el-button>
<el-button
type="danger"
style="margin-left: 90px;"
size="small"
icon="el-icon-delete"
plain
@click="deletePart">删除
</el-button>
<el-upload
:action="action"
:on-success="uploadSuccess"
:on-error="uploadFailure"
:show-file-list="showFileList"
:file-list="fileList"
style="float: left;"
class="upload-demo"
multiple>
<el-button
type="primary"
style="margin-left: 10px; width:120px"
size="small"
icon="el-icon-upload2"
plain
@click="batchImportOfDrawings">零件图
</el-button>
</el-upload>
<el-button
type="distribution"
style="margin-left: 10px; width:120px"
size="small"
icon="el-icon-upload2"
plain
@click="openDialog">总图
</el-button>
</div>
<div style="margin-top: 10px">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
stripe
size="small"
style="width: 681px"
height="710px"
@selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50px"/>
<el-table-column :width="setColumnWidth('序号')" type="index" label="序号" align="center"/>
<!--<el-table-column width="170px" label="零件名称" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>-->
<el-table-column width="140px" label="图号/型号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('文件格式')" label="文件格式" align="center">
<template slot-scope="scope">
{{ scope.row.suffix }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('导入时间')" label="导入时间" align="center">
<template slot-scope="scope">
{{ scope.row.导入时间 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('导入人')" label="导入人" align="center">
<template slot-scope="scope">
{{ scope.row.导入人 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-tooltip :open-delay="700" effect="dark" content="查看或删除图纸" placement="top">
<el-button type="text" icon="el-icon-picture-outline" size="mini" @click="getNum(scope.row)"/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-tab-pane>
<el-tab-pane label="产品图纸" name="产品图纸">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-cascader
ref="cascader"
:options="product"
:show-all-levels="false"
placeholder="产品名称"
clearable
style="float: left"
size="small"
@clear="clearData"
@change="getData"/>
<el-upload
:action="action2"
:on-success="uploadSuccess2"
:on-error="uploadFailure2"
:show-file-list="showFileList2"
:file-list="fileList2"
class="upload-demo"
multiple>
<el-button
type="primary"
style="margin-left: 290px; width:120px"
size="small"
icon="el-icon-upload2"
plain
@click="batchImportOfDrawings1">产品图
</el-button>
</el-upload>
</div>
<div style="margin-top: 10px">
<el-table
v-loading="loading"
:data="tableData1"
highlight-current-row
border
stripe
size="small"
style="width: 611px"
height="710px">
<el-table-column :width="setColumnWidth('序号')" label="序号" type="index" align="center"/>
<el-table-column :width="setColumnWidth('产品名称')" label="产品名称" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('文件格式')" label="文件格式" align="center">
<template slot-scope="scope">
{{ scope.row.suffix }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('导入时间')" label="导入时间" align="center">
<template slot-scope="scope">
{{ scope.row.导入时间 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('导入人')" label="导入人" align="center">
<template slot-scope="scope">
{{ scope.row.导入人 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('操作')" label="操作" align="center">
<template slot-scope="scope">
<el-tooltip :open-delay="700" effect="dark" content="查看或删除图纸" placement="top">
<el-button type="text" icon="el-icon-picture-outline" size="mini" @click="getNum1(scope.row)"/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize1"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges1"
@current-change="handleCurrentChanges1"/>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogVisible" width="350px">
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action">
<a v-show="isDeleteShow" class="delete" @click="deleteFileData(file.id)">删除</a>
</div>
<div v-if="file.suffix==='pdf'" class="icon">
<svg-icon icon-class="pdf"/>
</div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon">
<svg-icon icon-class="doc"/>
</div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon">
<svg-icon icon-class="excel"/>
</div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon">
<svg-icon icon-class="ppt"/>
</div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon">
<svg-icon icon-class="pic"/>
</div>
<div v-else class="icon">
<svg-icon icon-class="file"/>
</div>
<a id="appUrl" :href="file.url" target="view_window">
<div class="info">{{ file.name }}</div>
</a>
</div>
</div>
</div>
</el-dialog>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogVisibleMachine"
width="22%">
<span>订单编号</span>
<el-select
v-model="orderValue"
:remote-method="getOrder"
clearable
filterable
size="small"
placeholder="订单编号"
remote
@change="changeOrder">
<el-option
v-for="item in orderArray"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<div style="float: right;margin-right: 20px">
<el-upload
:disabled="disabledMachine"
:action="action1"
:on-success="uploadSuccess1"
:on-error="uploadFailure1"
:show-file-list="showFileList1"
:file-list="fileList1"
class="upload-demo"
multiple>
<el-button :disabled="disabledMachine" size="small" type="shengcheng">点击上传</el-button>
</el-upload>
</div>
<div v-for="(file, key) in hadFile1" :key="key">
<div class="wrapper">
<div class="content">
<div class="action">
<a class="delete" @click="deleteFileData1(file.id)">删除</a>
</div>
<div v-if="file.suffix==='pdf'" class="icon">
<svg-icon icon-class="pdf"/>
</div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon">
<svg-icon icon-class="doc"/>
</div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon">
<svg-icon icon-class="excel"/>
</div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon">
<svg-icon icon-class="ppt"/>
</div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon">
<svg-icon icon-class="pic"/>
</div>
<div v-else class="icon">
<svg-icon icon-class="file"/>
</div>
<a id="appUrl1" :href="file.url" target="view_window">
<div class="info">{{ file.name }}</div>
</a>
</div>
</div>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogVisible1" width="350px">
<div v-for="(file, key) in hadFile2" :key="key">
<div class="wrapper">
<div class="content">
<div class="action">
<a v-show="isDeleteShow1" class="delete" @click="deleteFileData2(file.id)">删除</a>
</div>
<div v-if="file.suffix==='pdf'" class="icon">
<svg-icon icon-class="pdf"/>
</div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon">
<svg-icon icon-class="doc"/>
</div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon">
<svg-icon icon-class="excel"/>
</div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon">
<svg-icon icon-class="ppt"/>
</div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon">
<svg-icon icon-class="pic"/>
</div>
<div v-else class="icon">
<svg-icon icon-class="file"/>
</div>
<a id="appUrl2" :href="file.url" target="view_window">
<div class="info">{{ file.name }}</div>
</a>
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import request, { MESDownloadFile, MESUploadFile, MESUploadFileProduct, uploadFileMachine } from '@/utils/request'
export default {
data() {
return {
PartType: '零件图纸',
action: '',
showFileList: false,
hadFile: [],
fileList: [],
multipleSelection_variable: [],
multipleSelection: [],
dialogVisible: false,
close: false, // 是否显示关闭按钮
isDeleteShow: false,
deleteShow: '1',
action1: '',
showFileList1: false,
hadFile1: [],
fileList1: [],
disabledMachine: true,
dialogVisibleMachine: false,
action2: '',
showFileList2: false,
dialogVisible1: false,
isDeleteShow1: false,
hadFile2: [],
fileList2: [],
orderValue: '',
orderArray: [],
machineToolName: '',
machineTool: [],
productValue: '',
productValue1: '',
product: [],
partsName: '',
loading: false, // 数据加载
total: 0, // 分页总数
total1: 0, // 分页总数
tableData: [],
tableData1: [],
pageCurrent: 1, // 分页当前页
pageSize: 100, // 分页每页显示条数
pageCurrent1: 1, // 分页当前页
pageSize1: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
fetchData() {
this.getTreeData()
this.getOrder()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
deletePart() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请选择要删除的零件图!')
return
}
this.$confirm('此操作将永久删除图纸, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const materialGroup = []
this.multipleSelection_variable = this.multipleSelection
this.multipleSelection = []
for (let i = 0; i < this.multipleSelection_variable.length; i++) {
materialGroup[i] = this.multipleSelection_variable[i].uid
}
var param = []
param[0] = ['uid组', materialGroup]
var Data = this.CreateData('12', '机加工MES_零件图PDF表_删除数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable()
this.$refs.multipleTable.clearSelection()
} else {
this.$message.success('选入失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
getOrder(query) {
this.orderArray = []
var param = []
param[0] = ['订单编号', query]
var Data = this.CreateData('11', '订单信息_列表_查询数据_bak', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.orderArray.push({
label: response.data[i].订单编号,
value: response.data[i].订单流水号
})
}
})
},
getProduct() {
var param = []
var Data = this.CreateData('11', '产品信息_基础表_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.product.push({
label: response.data[i].产品名称,
value: response.data[i].产品名称
})
}
})
},
searchTable() {
let partsName_check
this.partsName ? partsName_check = 1 : partsName_check = 0
var param = []
param[0] = ['零件图号_check', partsName_check]
param[1] = ['零件图号', this.partsName]
var Data = this.CreateData('11', '技术中心_零件图维护_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
},
getTreeData() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '产品关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.product = this.tree(data, 0)
})
},
tree(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].父节点 === pid) {
const obj = { label: data[i].节点名称, value: data[i].子节点 }
temp = this.tree(data, data[i].子节点)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
clearData() {
this.productValue = ''
this.searchTable()
},
getData(val) {
this.productValue1 = val[val.length - 1]
var param = []
param[0] = ['产品流水号', this.productValue1]
var Data = this.CreateData('11', '产品关系_获取产品名称', param)
this.ExecDatabase(Data).then(response => {
this.productValue = response.data[0].产品名称
}).then(() => {
this.searchTable1()
})
},
searchTable1() {
let productValue_check
this.productValue ? productValue_check = 1 : productValue_check = 0
var param = []
param[0] = ['产品名称_check', productValue_check]
param[1] = ['产品名称', this.productValue]
var Data = this.CreateData('11', '技术中心_产品图维护_查询', param, this.pageSize1, this.pageCurrent1)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
batchImportOfDrawings() {
this.action = `${MESUploadFile}?&num=1&tableName=机加工MES_零件图PDF表&type=1&UploaderName=${this.id}`
},
batchImportOfDrawings1() {
this.action2 = `${MESUploadFileProduct}?&num=1&tableName=图纸维护_产品图纸&type=1&UploaderName=${this.id}`
},
uploadSuccess(res, file, fileList) {
this.searchTable()
console.log(res, fileList, 1111)
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.str = res[0].result
this.arr = this.str.split('|')
if (this.arr[1] === '无该零件') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}该零件不存在,请检查上传文件名称是否正确!`,
duration: 0
})
}
if (this.arr[1] === '重复') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}请勿重复上传!`,
duration: 0
})
}
if (this.arr[1] === '零件图号不正确') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}和所选图号不符!`,
duration: 0
})
}
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
}
},
uploadFailure(res, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
},
uploadSuccess2(res, file, fileList) {
this.searchTable1()
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.str = res[0].result
this.arr = this.str.split('|')
if (this.arr[1] === '无该产品') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}该产品不存在,请检查上传文件名称是否正确!`,
duration: 0
})
}
if (this.arr[1] === '重复') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}请勿重复上传!`,
duration: 0
})
}
if (this.arr[1] === '产品名称不正确') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}和所选产品不符!`,
duration: 0
})
}
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
}
},
uploadFailure2(res, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
},
// 查看零件图
getNum(row) {
this.num = row.num
this.dialogVisible = true
this.getFileList(row.name)
},
async getFileList(value) {
this.hadFile = []
this.deleteShow === '1' ? this.isDeleteShow = true : this.isDeleteShow = false
if (value) {
await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 机加工MES_零件图PDF表 where 是否启用 = 1 and name = '${value}'`
}
}).then(data => {
this.suffix = data.data
if (data.data.length > 0) {
const server = `${MESDownloadFile}`.split('/')
data.data.map(item => {
this.hadFile.push({
url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
name: `${item.name}.${item.suffix}`,
suffix: item.suffix,
id: item.uid
})
})
}
})
}
},
// 删除零件图
async deleteFileData(id) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '',
method: 'post',
data: {
type: '3',
name: `delete from 机加工MES_零件图PDF表 where uid = N'${id}'`
}
}).then(response => {
if (response.data.length === 0) {
this.$message.success('删除成功')
this.dialogVisible = false
this.getFileList(this.num)
this.searchTable()
} else {
this.$message.error('删除失败')
this.dialogVisible = false
this.getFileList(this.num)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
getNum1(row) {
this.num = row.num
this.dialogVisible1 = true
this.getFileList1(row.name)
},
async getFileList1(value) {
this.hadFile2 = []
this.deleteShow === '1' ? this.isDeleteShow1 = true : this.isDeleteShow1 = false
if (value) {
await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 图纸维护_产品图纸 where 是否启用 = 1 and name = '${value}'`
}
}).then(data => {
this.suffix = data.data
if (data.data.length > 0) {
const server = `${MESDownloadFile}`.split('/')
data.data.map(item => {
this.hadFile2.push({
url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
name: `${item.name}.${item.suffix}`,
suffix: item.suffix,
id: item.uid
})
})
}
})
}
},
// 删除零件图
async deleteFileData2(id) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '',
method: 'post',
data: {
type: '3',
name: `delete from 图纸维护_产品图纸 where uid = N'${id}'`
}
}).then(response => {
if (response.data.length === 0) {
this.$message.success('删除成功')
this.dialogVisible1 = false
this.getFileList1(this.num)
this.searchTable1()
} else {
this.$message.error('删除失败')
this.dialogVisible1 = false
this.getFileList1(this.num)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
openDialog() {
this.orderValue = []
this.hadFile1 = []
this.disabledMachine = true
this.dialogVisibleMachine = true
},
changeOrder() {
this.orderValue === '' ? this.disabledMachine = true : this.disabledMachine = false
this.action1 = `${uploadFileMachine}?&MachineNum=${this.orderValue}`
this.getFileData(this.orderValue)
},
uploadSuccess1(res, file, fileList) {
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
this.getFileData(this.orderValue)
}
},
uploadFailure1(a, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
},
// 在什么情况下需要查询上传的附件调用this.getFileData()即可根据
getFileData(orderValue) {
this.hadFile1 = []
var param = []
param[0] = ['订单流水号', orderValue]
var Data = this.CreateData('11', 'PDM_机床总图_查询数据', param)
this.ExecDatabase(Data).then(res => {
this.suffix = res.data
if (res.data.length > 0) {
const server = `${MESDownloadFile}`.split('/')
res.data.map(item => {
this.hadFile1.push({
url: `http://${server[2]}/webpage/file/${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
deleteFileData1(id) {
var param = []
param[0] = ['文件标识', id]
var Data = this.CreateData('12', 'PDM_机床总图_删除数据', param)
this.ExecDatabase(Data).then(res => {
if (res.data[0].result === '1') {
this.getFileData(this.orderValue)
this.$message.success('删除成功')
} else {
this.$message.success('删除失败')
}
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
},
handleSizeChanges1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable()
},
handleCurrentChanges1(val) {
this.pageCurrent1 = val
this.searchTable()
}
}
}
</script>
<style scoped lang="scss">
/deep/ .el-card__body {
padding: 0px !important;
}
</style>
<style scoped>
.wrapper {
width: 90%;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
/*float: left;*/
margin: 10px;
}
.content {
position: relative;
padding: 8px 8px 0 8px;
}
.action {
position: absolute;
top: 2px;
right: 8px;
}
.delete {
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover {
background: -webkit-linear-gradient(top, #0ba9e3, #0099d3);
color: #fff;
}
a {
text-decoration: none;
}
.icon {
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info {
width: 160px;
height: 50px;
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,300 +0,0 @@
<template>
<div>
<el-card style="width: 750px">
<el-row style="width: 645px">
<el-input v-model="partNumber" placeholder="零件图号" style="width: 180px" size="small" clearable/>
<el-button icon="el-icon-search" type="primary" plain size="small" @click="pageCurrent = 1;pageSize = 10;getTableData()">查询</el-button>
<el-upload
:disabled="disabled"
:action="action"
:on-success="uploadSuccess"
:on-error="uploadFailure"
:show-file-list="showFileList"
:file-list="fileList"
style="float: right; margin: 0px 50px"
class="upload-demo"
multiple>
<el-button type="primary" size="small" style="float: right;" plain @click="batchImportOfDrawings">图纸导入</el-button>
</el-upload>
</el-row>
</el-card>
<el-card style="width: 750px">
<el-table v-loading="loading" :data="tableData" border size="mini" style="width: 100%" height="550">
<el-table-column label="序号" align="center" type="index" width="70"/>
<el-table-column label="零件图号" align="center" min-width="180px">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="文件格式" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.suffix }}
</template>
</el-table-column>
<el-table-column label="导入时间" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.上传时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="导入人" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.导入人 }}
</template>
</el-table-column>
<el-table-column width="80px" label="零件图纸" align="center">
<template slot-scope="scope">
<el-button circle icon="el-icon-search" size="small" @click="getNum(scope.row)"/>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogVisible" width="350px">
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action">
<a v-show="isDeleteShow" class="delete" @click="deleteFileData(file.id)">删除</a>
</div>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a id="appUrl" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import request from '@/utils/request'
import { getTableData } from '@/api/TechnologyCenter/PartDrawingMaintenance'
import { MESUploadFile, MESDownloadFile } from '@/utils/request'
import { mapGetters } from 'vuex'
export default {
data() {
return {
partNumber: '', // 零件图号
tableData: [],
loading: false,
total: 0,
pageCurrent: 1,
pageSize: 10,
dialogVisible: false,
close: false, // 是否显示关闭按钮
disabled: false,
isDeleteShow: false,
deleteShow: '1',
action: '',
showFileList: false,
hadFile: [],
fileList: []
}
},
computed: {
...mapGetters([
'token',
'sidebar',
'name',
'id' // 人员编号
])
},
created() {
this.getTableData()
},
methods: {
// 查询
getTableData() {
var partNumber_check = this.partNumber ? 1 : 0
this.loading = true
getTableData(partNumber_check, this.partNumber, this.pageSize, this.pageCurrent).then(response => {
this.loading = false
this.tableData = response.data.rows
this.total = response.data.total
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.getTableData()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.getTableData()
},
// 上传
batchImportOfDrawings() {
this.action = `${MESUploadFile}?&num=1&tableName=机加工MES_零件图PDF表&type=1&UploaderName=${this.id}`
},
uploadSuccess(res, file, fileList) {
this.getTableData()
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.str = res[0].result
this.arr = this.str.split('|')
if (this.arr[1] === '无该零件') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}该零件不存在,请检查上传文件名称是否正确!`,
duration: 0
})
}
if (this.arr[1] === '重复') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}请勿重复上传!`,
duration: 0
})
}
if (this.arr[1] === '零件图号不正确') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}和所选图号不符!`,
duration: 0
})
}
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
// this.getTableData()
}
},
uploadFailure(res, file, fileList) {
fileList.map(file => {
this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`)
})
},
// 查看零件图
getNum(row) {
this.num = row.num
this.dialogVisible = true
this.getFileList(row.name)
},
async getFileList(value) {
this.hadFile = []
this.deleteShow === '1' ? this.isDeleteShow = true : this.isDeleteShow = false
if (value) {
await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 机加工MES_零件图PDF表 where 是否启用 = 1 and name = '${value}'`
}
}).then(data => {
this.suffix = data.data
if (data.data.length > 0) {
const server = `${MESDownloadFile}`.split('/')
data.data.map(item => {
this.hadFile.push({
url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
name: `${item.name}.${item.suffix}`,
suffix: item.suffix,
id: item.uid
})
})
}
})
}
},
// 删除零件图
async deleteFileData(id) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '',
method: 'post',
data: {
type: '3',
name: `delete from 机加工MES_零件图PDF表 where uid = N'${id}'`
}
}).then(response => {
this.getTableData()
if (response.data.length === 0) {
this.$message.success('删除成功')
this.dialogVisible = false
this.getFileList(this.num)
} else {
this.$message.error('删除失败')
this.dialogVisible = false
this.getFileList(this.num)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style scoped>
.wrapper{
width: 90%;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
/*float: left;*/
margin: 10px;
}
.content{
position: relative;
padding: 8px 8px 0 8px;
}
.action{
position: absolute;
top: 2px;
right: 8px;
}
.delete{
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover{
background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
color: #fff;
}
a{
text-decoration: none;
}
.icon{
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info{
width: 160px;
height: 50px;
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
</style>

View File

@@ -1,224 +0,0 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -1,522 +0,0 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<!-- <span>名称:</span>-->
<el-input v-model="Name" placeholder="名称" size="small" clearable style="width:200px;margin:0px 10px"/>
<!-- <span>规格:</span>-->
<el-input v-model="spec" placeholder="规格" size="small" clearable style="width:200px;margin:0px 10px"/>
<!-- <span>型号:</span>-->
<el-input v-model="model" placeholder="型号" size="small" clearable style="width:200px;margin:0px 10px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>
</el-row>
<el-row v-show="false">
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
: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>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-row>
</el-card>
<el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()">
<el-tab-pane label="标准件" name="标准件">
<el-table :data="tableData0" size="mini" height="740px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" min-width="200px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent0"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize0"
:total="total0"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
</el-tab-pane>
<el-tab-pane label="外购件" name="外购件">
<el-table :data="tableData1" size="mini" height="740px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<!--<el-table-column align="center" label="机床图号" width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.机床图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="组号" width="80px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.组号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="型号" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格" min-width="200px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供货商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.供货商 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.备注 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供应商" min-width="150px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="合同编号" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购员" width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.姓名 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-tab-pane>
<el-tab-pane label="基本件" name="基本件">
<el-table :data="tableData2" size="mini" height="740px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<!--<el-table-column align="center" label="机床图号" width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.机床图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="名称" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="图号" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.零件图号 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="规格" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.规格 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="材料" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.材料 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="供货商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.供货商 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="备注" min-width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || '—' }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="供应商" min-width="100px" show-overflow-tooltip>-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购合同编号" min-width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column align="center" label="采购员" width="100px">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.姓名 || '—' }}-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { initMachineProject, searchgroup, searchTable1, searchTable2, searchTable1Export, searchTable2Export } from '@/api/PurchasingCenter/PurchaseSituationSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购件采购查询
data() {
return {
Name: '',
spec: '',
model: '',
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
PartType: '标准件',
tableData0: [],
tableData1: [],
tableData2: [],
tableData3: [],
pageCurrent0: 1,
pageSize0: 20,
total0: 0,
pageCurrent1: 1,
pageSize1: 20,
total1: 0,
pageCurrent2: 1,
pageSize2: 20,
total2: 0
}
},
computed: {
...mapGetters([
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
// 导出采购物料执行情况
exportDetail() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 1).then(res1 => { // 标准件
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 2).then(res2 => { // 外购件
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 data1 = res1.data.map(v => filterVal1.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data1.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data2.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data2)
const data3 = res3.data.map(v => filterVal3.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data3.map(v => {
v.push('') // 物料状态
if (v[11] === '—') {
v[14] = '未分配'
} else if (v[7] === '—') {
v[14] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[14] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[14] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '采购物料执行情况',
autoWidth: true,
bookType: 'xlsx'
})
})
})
})
})
},
fetchData() {
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() {
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
}
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable0() { // 查询标准件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent0, this.pageSize0, 1, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
console.log(this.tableData0)
this.tableData0 = response.data.rows
this.total0 = response.data.total
})
},
searchTable1() { // 查询外购件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent1, this.pageSize1, 2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
searchTable2() { // 查询基本件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable2(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent2, this.pageSize2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 0px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>

View File

@@ -1,220 +0,0 @@
/* eslint-disable */
require('script-loader!file-saver');
import XLSX from 'xlsx'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
multiHeader = [],
header,
data,
filename,
merges = [],
autoWidth = true,
bookType= 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
data.unshift(header);
for (let i = multiHeader.length-1; i > -1; i--) {
data.unshift(multiHeader[i])
}
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
if (merges.length > 0) {
if (!ws['!merges']) ws['!merges'] = [];
merges.forEach(item => {
ws['!merges'].push(XLSX.utils.decode_range(item))
})
}
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -1,571 +0,0 @@
<template>
<div class="app-container">
<el-card>
<el-select v-model="machineValue" placeholder="机床图号" style="width: 150px" filterable size="small">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select v-model="groupValue" placeholder="组号" style="width: 150px;margin-top: 10px;margin-bottom: 5px" filterable size="small" clearable="">
<el-option
v-for="item in group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="ModelValue" placeholder="名称规格型号" style="width: 180px" size="small" clearable/>
<el-button icon="el-icon-search" type="primary" plain size="small" @click="pageCurrentWB = 1;pageSizeWB = 1000;pageCurrent = 1;pageSize = 1000;getTableData()">查询</el-button>
<el-tooltip :open-delay="1000" effect="dark" content="导出查询数据" placement="top">
<el-button v-positive="'loading'" type="success" size="small" icon="el-icon-download" plain style="margin-left:10px" @click="exportExcel()">导出</el-button>
</el-tooltip>
</el-card>
<el-card>
<div v-for="(file, key) in hadFile" :key="key">
<div class="wrapper">
<div class="content">
<div class="action"/>
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
<div v-else-if="file.suffix==='docx'|| file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
<div v-else class="icon"><svg-icon icon-class="file" /></div>
<a :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
</div>
</div>
</div>
</el-card>
<el-card>
<div style="font-size: 18px;margin-top: 5px">自制件</div>
<el-table
v-loading="loading"
:data="tableData"
:row-class-name="tableRowClassName1"
highlight-current-row
border
stripe
size="mini"
style="width: 100%;max-height: 520px"
height="460">
<el-table-column
label="序号"
align="center"
fixed="left"
type="index"
width="50"/>
<el-table-column
label="机床图号"
align="center"
prop="机床图号"
fixed="left"
width="130px">
<template slot-scope="scope">{{ scope.row.机床图号 }}</template>
</el-table-column>
<el-table-column
label="组号"
align="center"
prop="组号"
fixed="left"
width="80px">
<template slot-scope="scope">{{ scope.row.组号 }}</template>
</el-table-column>
<el-table-column
label="零件图号"
align="center"
prop="零件图号"
fixed="left"
width="150px">
<template slot-scope="scope">{{ scope.row.零件图号 }}</template>
</el-table-column>
<el-table-column
label="零件名称"
align="center"
prop="零件名称"
min-width="140px"
fixed="left"
show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
</el-table-column>
<el-table-column
label="零件数量"
width="80"
align="center">
<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 label="机床数量" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column
label="材料"
prop="材料"
align="center"
show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.材料 }}</template>
</el-table-column>
<el-table-column
label="规格"
prop="规格"
align="center"
show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.规格 }}</template>
</el-table-column>
<el-table-column
label="备注"
align="center">
<template slot-scope="scope">{{ scope.row.零件备注 }}</template>
</el-table-column>
<el-table-column
label="零件类型"
align="center">
<template slot-scope="scope">{{ scope.row.零件类型名称 }}</template>
</el-table-column>
<el-table-column align="center" label="导入人" width="100">
<template slot-scope="scope">
{{ scope.row.导入人员 }}
</template>
</el-table-column>
<el-table-column align="center" label="导入时间" width="100">
<template slot-scope="scope">
{{ scope.row.操作日期 | formatTime }}
</template>
</el-table-column>
<el-table-column align="center" label="分类码" width="150">
<template slot-scope="scope">
{{ scope.row.分类码 }}
</template>
</el-table-column>
<el-table-column align="center" label="旧零件图号" width="150">
<template slot-scope="scope">
{{ scope.row.前零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="整改类型" width="150">
<template slot-scope="scope">
{{ scope.row.整改类型 }}
</template>
</el-table-column>
<!--<el-table-column label="操作" fixed="right" align="center" width="100">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--:disabled="Number(id)!==0"-->
<!--size="mini"-->
<!--type="text"-->
<!--icon="el-icon-delete"-->
<!--@click="handleDelete(scope.row)"/>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-card>
<el-card>
<div style="font-size: 18px;margin-top: 5px">
外购件
<el-tooltip :open-delay="1000" effect="dark" content="导出查询数据" placement="top">
<el-button v-positive="'loading'" type="success" size="small" icon="el-icon-download" plain style="float: right;margin: 3px 150px 5px 0" @click="exportExcel2()">导出</el-button>
</el-tooltip>
</div>
<el-table v-loading="loadingWB" :data="tableDataWB" style="width: 100%;min-height: 600px;" size="mini" stripe height="500" highlight-current-row border>
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column align="center" prop="物料名称" fixed="left" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" prop="物料规格" fixed="left" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" prop="物料型号" fixed="left" 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 label="部件数量" align="center">
<template slot-scope="scope">
{{ scope.row.部件数量 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column align="center" prop="零件类型" label="零件类型">
<template slot-scope="scope">
{{ scope.row.零件类型 }}
</template>
</el-table-column>
<el-table-column align="center" prop="供货商" label="供货商">
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="100">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column align="center" label="标记" width="100">
<template slot-scope="scope">
{{ scope.row.标记 }}
</template>
</el-table-column>
<el-table-column align="center" label="导入人" width="100">
<template slot-scope="scope">
{{ scope.row.导入人员 }}
</template>
</el-table-column>
<el-table-column align="center" label="导入时间" width="100">
<template slot-scope="scope">
{{ scope.row.操作日期 | formatTime }}
</template>
</el-table-column>
<el-table-column align="center" label="分类码" width="150">
<template slot-scope="scope">
{{ scope.row.分类码 }}
</template>
</el-table-column>
<el-table-column align="center" label="整改类型" width="150">
<template slot-scope="scope">
{{ scope.row.整改类型 }}
</template>
</el-table-column>
<!--<el-table-column label="操作" fixed="right" align="center" width="150">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--:disabled="Number(id)!==0"-->
<!--size="mini"-->
<!--type="text"-->
<!--icon="el-icon-delete"-->
<!--@click="handleDelete(scope.row)">删除</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block" style="margin-top: 10px">
<el-pagination
:current-page="pageCurrentWB"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSizeWB"
:total="totalWB"
layout="total"
@size-change="handleSizeChangeWB"
@current-change="handleCurrentChangeWB"/>
</div>
</el-card>
</div>
</template>
<script>
import { machineSelect, groupSelect, basicPartsData, deleteBasicParts, purchasePartsData, deletePurchaseData, getFileData, searchModel } from '@/api/TechnologyCenter/QueryParts'
import { mapGetters } from 'vuex'
import { ServerIP } from '@/utils/request'
export default {
name: 'Index',
data() {
return {
machineValue: '',
machine: [],
groupValue: '',
group: [],
group1: [],
ModelValue: '', // 规格型号
Model: [], // 规格型号组
loading: false,
loadingWB: false,
dialogFormVisible: false,
total: 0,
tableData: [],
tableDataWB: [],
pageCurrent: 1,
pageSize: 1000,
pageCurrentWB: 1,
pageSizeWB: 1000,
totalWB: 0,
hadFile: []
}
},
computed: {
...mapGetters([
'name',
'id'// 人员编号
]),
groupName() {
for (let i = 0; i < this.group.length; i++) {
if (this.group[i].value === this.groupValue) {
return this.group[i].label
}
}
}
},
watch: {
machineValue(val) {
this.groupValue = ''
this.group = []
if (val) {
this.getGroupSelect(val)
}
},
group(val) {
if (val.length > 0) {
this.groupValue = val[0].value
}
},
groupValue(val) {
if (val) {
this.pageCurrentWB = 1
this.pageSizeWB = 1000
this.pageCurrent = 1
this.pageSize = 1000
this.getTableData()
}
}
},
mounted() {
this.fetchData()
},
methods: {
exportExcel() {
if (this.tableData.length === 0) {
this.$message.warning('请先查询要导出的数据')
} else {
const machine_check = this.machineValue ? 1 : 0
const group_check = this.groupValue ? 1 : 0
const Model_check = this.ModelValue ? 1 : 0
var param = []
param[0] = ['机床流水号_check', machine_check]
param[1] = ['机床流水号', this.machineValue]
param[2] = ['组件流水号_check', group_check]
param[3] = ['组件流水号', this.groupValue]
param[4] = ['规格_check', Model_check]
param[5] = ['规格', this.ModelValue]
var Data = this.CreateData('2001', '报表_PDM_零件明细表_基本件_查询数据_综合gj', param)
this.exportExcel_NPOI(Data)
}
},
exportExcel2() {
if (this.tableDataWB.length === 0) {
this.$message.warning('请先查询要导出的数据')
} else {
const machine_check = this.machineValue ? 1 : 0
const group_check = this.groupValue ? 1 : 0
const Model_check = this.ModelValue ? 1 : 0
var param = []
param[0] = ['机床流水号_check', machine_check]
param[1] = ['机床流水号', this.machineValue]
param[2] = ['组件流水号_check', group_check]
param[3] = ['组件流水号', this.groupValue]
param[4] = ['规格_check', Model_check]
param[5] = ['规格', this.ModelValue]
var Data = this.CreateData('2001', '报表_PDM_零件明细表_标准件和外购件_查询数据', param)
this.exportExcel_NPOI(Data)
}
},
// 在什么情况下需要查询上传的附件调用this.getFileData()即可根据
getFileData(machineValue) {
this.hadFile = []
getFileData(machineValue).then(res => {
if (res.data.length > 0) {
res.data.map(item => {
this.hadFile.push({
url: `${ServerIP}${item.文件标识}.${item.文件后缀}`,
name: `${item.文件名称}.${item.文件后缀}`,
suffix: item.文件后缀,
id: item.文件标识
})
})
}
})
},
fetchData() {
this.getSelect(machineSelect, ['机床图号', '机床流水号'], 'machine')
},
getGroupSelect(val) {
this.getSelect(groupSelect, ['组号', '组件流水号'], 'group', val)
},
getGroupSelect1() {
this.form.组号 = ''
this.getSelect(groupSelect, ['组号', '组件流水号'], 'group1', this.form.机床号)
},
searchModel() {
const machine_check = this.machineValue ? 1 : 0
const group_check = this.groupValue ? 1 : 0
var param = []
param[0] = machine_check
param[1] = this.machineValue
param[2] = group_check
param[3] = this.groupValue
this.getSelect(searchModel, ['规格', '规格'], 'Model', param)
},
getTableData() {
this.getFileData(this.machineValue)
if (this.machineValue) {
const machine_check = this.machineValue ? 1 : 0
const group_check = this.groupValue ? 1 : 0
const Model_check = this.ModelValue ? 1 : 0
this.loading = true
basicPartsData(machine_check, this.machineValue, group_check, this.groupValue, Model_check, this.ModelValue, this.pageSize, this.pageCurrent).then(response => {
this.loading = false
const res = response.data
this.total = res.total
this.tableData = res.rows.map(item => {
if (item.整改类型 === '1') {
item.整改类型 = '新增'
} else if (item.整改类型 === '2') {
item.整改类型 = '替换'
} else if (item.整改类型 === '3') {
item.整改类型 = '补充加工'
}
return item
})
})
} else {
this.$message.warning('请输入查询条件')
}
this.loadingWB = true
const machine_check = this.machineValue ? 1 : 0
const group_check = this.groupValue ? 1 : 0
const Model_check = this.ModelValue ? 1 : 0
purchasePartsData(machine_check, this.machineValue, group_check, this.groupValue, Model_check, this.ModelValue, this.pageSizeWB, this.pageCurrentWB).then(response => {
this.loadingWB = false
const data = response.data
this.totalWB = data.total
this.tableDataWB = data.rows.map(item => {
if (item.整改类型 === '1') {
item.整改类型 = '新增'
} else if (item.整改类型 === '2') {
item.整改类型 = '替换'
} else if (item.整改类型 === '3') {
item.整改类型 = '补充加工'
}
item.零件类型 = item.零件类型 === '2' ? '外购件' : '标准件'
return item
})
})
},
openUrgentItem() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.dialogFormVisible = true
},
tableRowClassName1({ row }) {
if (row.是否加急件 === '1') {
return 'isUrgentItem1'
}
},
handleDelete(row) {
if (row.基本件流水号) {
this.deleteRow(deleteBasicParts, row.基本件流水号, function() {
this.getTableData()
})
} else {
this.deleteRow(deletePurchaseData, row.标准件和外购件流水号, function() {
this.getTableData()
})
}
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.getTableData()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.getTableData()
},
handleSizeChangeWB(val) {
this.pageCurrentWB = 1
this.pageSizeWB = val
this.getTableData()
},
handleCurrentChangeWB(val) {
this.pageCurrentWB = val
this.getTableData()
}
}
}
</script>
<style scoped>
span{
margin: 0px;
}
.wrapper{
width: 225px;
height: 50px;
overflow: hidden;
border: 1px solid #b8c7d9;
float: left;
margin: 0px;
}
.content{
position: relative;
padding: 8px 8px 0 8px;
}
.action{
position: absolute;
top: 4px;
right: 8px;
}
.delete{
padding: 0 5px;
border-radius: 3px;
color: #0f84b0;
font-size: 12px;
}
.delete:hover{
background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
color: #fff;
}
a{
text-decoration: none;
}
.icon{
width: 30px;
height: 30px;
display: inline-block;
margin-right: 7px;
margin-top: 2px;
font-size: 26px;
}
.info{
position: absolute;
left: 44px;
line-height: 30px;
display: inline-block;
color: #999;
}
.el-card {
padding: 0px !important;
margin: 0px !important;
}
</style>
<style>
.el-table .isUrgentItem1{
background: #ff7575
}
</style>