Files
JY1.0/src/views/SalesManagement/OrderManagement/index.vue

1220 lines
47 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card style="height: 850px">
<el-row>
<el-select
v-model="customerNameValue"
:remote-method="getCustomer"
style="width:200px"
placeholder="买方名称"
size="small"
filterable
clearable
remote
@change="searchTable()">
<el-option
v-for="item in customerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="font-size: 13px;color: black">签订日期</span>
<el-date-picker
v-model="dateRange"
size="small"
type="daterange"
align="center"
style="width: 240px;margin-right: 330px"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="searchTable()"/>
<el-tooltip :open-delay="700" effect="dark" content="查看库存信息" placement="top">
<el-button type="text" size="mini" @click="handleStock">
<svg-icon icon-class="库存查询" style="width: 20px;height: 20px"/>
</el-button>
</el-tooltip>
</el-row>
<div style="float: left">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
stripe
size="mini"
style="width: 861px;"
height="222"
@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 label="客户名称" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.客户名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="合同交货期限" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.交货期限 }}
</template>
</el-table-column>
<el-table-column width="155px" label="操作" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<el-button type="text" icon="el-icon-check" size="mini" @click.native.stop="ReleaseOrder(scope.row)">
提交订单
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="margin-top: 10px" @mouseover="show=true" @mouseleave="show=false">
<el-table
v-loading="loading1"
:data="tableData1"
:header-cell-style="changeStyle"
highlight-current-row
border
size="mini"
style="width: 1821px;margin-top: 10px"
height="430px"
@row-dblclick="changeState">
<el-table-column width="50px" label="序号" fixed type="index" align="center"/>
<el-table-column width="120px" fixed label="部件名称" align="center">
<template slot-scope="scope">
<template v-if="parseInt(scope.row.是否合同创建)===0&&scope.row.edit ===true">
<el-input v-model="scope.row.产品名称" size="mini" style="width: 100%" @dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.产品名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="70px" label="单位" fixed align="center">
<template slot-scope="scope">
<template v-if="parseInt(scope.row.是否合同创建)===0&&scope.row.edit ===true">
<el-input v-model="scope.row.单位" size="mini" style="width: 100%" @dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.单位 }}
</template>
</template>
</el-table-column>
<el-table-column width="80px" label="数量" fixed align="center">
<template slot-scope="scope">
<template v-if="parseInt(scope.row.是否合同创建)===0&&scope.row.edit ===true">
<el-input v-model="scope.row.数量" size="mini" type="number" style="width: 100%" @dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.数量 }}
</template>
</template>
</el-table-column>
<el-table-column width="200px" label="产品详情" fixed align="center">
<template slot-scope="scope">
<template v-if="parseInt(scope.row.是否合同创建)===0&&scope.row.edit ===true">
<el-input
v-model="scope.row.产品详情"
size="mini"
type="textarea"
style="width: 100%"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.产品详情 }}
</template>
</template>
</el-table-column>
<el-table-column width="230px" label="轴承型号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.轴承位置"
:options="bearing"
style="width: 100%"
size="small"
@change="getData3(scope.row)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.轴承位置文本 }}
</template>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('安装方向')" label="安装方向" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.安装方向"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in installationDirection"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.安装方向名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="300px" label="电机型号/电机联接板" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.电机位置"
:options="motorModel"
style="width: 100%"
size="small"
clearable
@change="getData1(scope.row)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.电机位置文本 }}
</template>
</template>
</el-table-column>
<el-table-column width="150px" label="传动方式" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===2)"
:show-all-levels="false"
v-model="scope.row.传动方式位置"
:options="transmissionMode"
style="width: 100%"
size="small"
clearable
@change="getData2(scope.row, scope.$index)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.传动方式位置文本 }}
</template>
</template>
</el-table-column>
<el-table-column width="190px" label="主轴轮" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.主轴轮"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in spindleWheel"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.主轴轮名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="190px" label="电机轮" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.电机轮"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in motorWheel"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.电机轮名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="180px" label="传动带" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.皮带轮"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in pulley"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.皮带轮名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="180px" label="拉杆" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.拉杆"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in pullRod"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.拉杆名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="140px" label="其它" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-input v-model="scope.row.其它" size="mini" style="width: 100%" @dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.其它 }}
</template>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('输出转速')" label="输出转速" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-input
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.输出转速"
size="mini"
style="width: 100%"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.输出转速 }}
</template>
</template>
</el-table-column>
<el-table-column width="160px" label="中心内冷" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===2)"
v-model="scope.row.中心内冷"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in CentralInternalCooling"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.中心内冷名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="160px" label="防护类型" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-select
:disabled="!(scope.row.是否滑台===1)"
v-model="scope.row.防护类型"
filterable
clearable
size="small"
style="width: 100%"
@dblclick.native.stop>
<el-option
v-for="item in TypeOfProtection"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.防护类型名称 }}
</template>
</template>
</el-table-column>
<el-table-column width="120px" label="电机型号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===1)"
:show-all-levels="false"
v-model="scope.row.滑台电机位置"
:options="motorModel1"
style="width: 100%"
size="small"
clearable
@change="getData4(scope.row, scope.$index)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.滑台电机文本 }}
</template>
</template>
</el-table-column>
<el-table-column width="120px" label="电机联接板" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===1)"
:show-all-levels="false"
v-model="scope.row.电机联接板"
:options="ConnectingPlate"
style="width: 100%"
size="small"
clearable
@change="getData5(scope.row, scope.$index)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.电机联接板文本 }}
</template>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('联轴器')" label="联轴器" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit ===true">
<el-cascader
ref="cascader"
:disabled="!(scope.row.是否滑台===1)"
:show-all-levels="false"
v-model="scope.row.联轴器"
:options="coupling"
style="width: 100%"
size="small"
clearable
@change="getData6(scope.row, scope.$index)"
@dblclick.native.stop/>
</template>
<template v-else>
{{ scope.row.联轴器文本 }}
</template>
</template>
</el-table-column>
<el-table-column width="140px" label="操作" fixed="right" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="text" size="mini" @click="editProduct(scope.row)">确认</el-button>
<el-button v-if="scope.row.edit" type="text" size="mini" @click="cancel(scope.row)">取消</el-button>
<el-tooltip :open-delay="700" effect="dark" content="删除" placement="top">
<el-button
:disabled="parseInt(scope.row.是否合同创建)===1"
type="text"
icon="el-icon-minus"
size="mini"
@click="deleteProduct(scope.row)"/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-button v-show="show" icon="el-icon-circle-plus-outline" size="mini" @click="createProduct"/>
</div>
<span>订单备注</span>
<el-input v-model="remarks" type="textarea" style="width:600px"/>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" center width="770px">
<div style="width: 100%;overflow: hidden">
<el-input
v-model="materialNameTypeValue"
style="width:200px"
placeholder="物料名称规格型号"
size="small"
clearable
@keyup.enter.native="pageCurrent=1;searchTable10()"/>
<el-table
ref="table"
:data="tableData10"
:header-cell-style="{background: '#383E4B',color: 'white'}"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 721px"
height="440px"
@sort-change="sortChange">
<el-table-column
width="140px"
label="物料编号"
align="center"
show-overflow-tooltip
sortable="物料编码"
prop="物料编码">
<template slot-scope="scope">
{{ scope.row.物料编码 }}
</template>
</el-table-column>
<el-table-column
width="170px"
label="物料名称"
align="center"
show-overflow-tooltip
sortable="物料名称"
prop="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column width="150px" label="图号型号" align="center">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="外库存" prop="预库存" align="center">
<template slot-scope="scope">
{{ scope.row.预库存 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="库存" prop="库存" 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"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
dialogFormVisible: false,
materialNameTypeValue: '',
spindleWheel: [], // 主轴轮数组
motorWheel: [], // 电机轮数组
pulley: [], // 皮带轮数组
pullRod: [], // 皮带轮数组
bearing: [], // 轴承型号数组
motorPower: [], // 电机功率数组
motorSpeed: [], // 电机转速数组
transmissionMode: [], // 传动方式数组
ConnectingPlate: [], // 联接板数组
slideType: [], // 滑台类型数组
motorConnectingPlate: [], // 电机联接板数组
CentralInternalCooling: [], // 中心内冷数组
TypeOfProtection: [], // 防护类型数组
motorModel: [], // 电机型号数组
motorModel1: [], // 滑台电机型号数组
coupling: [], // 联轴器数组
installationDirection: [], // 安装方向数组
level: [], // 级别数组
remarks: '',
orderValue: '',
product: [],
typeValue: '',
productValue: '', // 产品数值
motorModelLabel: '',
motorModelName: '',
motorModelId: '',
bearingLabel: '',
bearingName: '',
bearingId: '',
transmissionModeLabel: '',
transmissionModeName: '',
transmissionModeId: '',
ConnectingPlateLabel: '',
ConnectingPlateName: '',
ConnectingPlateId: '',
couplingLabel: '',
couplingName: '',
couplingId: '',
motorModelLabel1: '',
motorModelName1: '',
motorModelId1: '',
customerName: [],
customerNameValue: '',
dateRange: '',
PowerHead: [],
PowerHeadName: '',
show: false,
show1: false,
loading: false, // 数据加载
loading1: false, // 数据加载
total: 0, // 分页总数
tableData: [], // 订单信息表
tableData1: [], // 产品信息表
tableData10: [], // 产品信息表
tableData100: [], // 产品信息表
pageCurrent: 1, // 分页当前页
pageSize: 20, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
this.searchTable()
this.getMotorWheel()
},
methods: {
fetchData() {
this.getBasicData()
this.productList()
this.getTreeData1()
this.getTreeData2()
this.getTreeData3()
this.getTreeData4()
this.getTreeData5()
this.getTreeData6()
this.getCustomer('')
},
getMotorWheel() {
var param = []
var Data = this.CreateData('11', '传动方式_获取电机轮新', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.motorWheel.push({
label: response.data[i].传动方式,
value: response.data[i].传动方式流水号
})
}
})
},
getCustomer(query) {
this.customerName = []
var param = []
param[0] = ['客户名称', query]
var Data = this.CreateData('11', '合同管理_客户信息_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.customerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
changeStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 19 || columnIndex === 16 || columnIndex === 17 || columnIndex === 18) {
return 'background:#31384B;color:white'
} else {
return 'background:#2283D4;color:white'
}
},
exportTable() {
},
handleStock() {
this.dialogFormVisible = true
},
searchTable10() {
let materialNameTypeValue_check
this.materialNameTypeValue ? materialNameTypeValue_check = 1 : materialNameTypeValue_check = 0
var param = []
param[0] = ['物料名称_check', materialNameTypeValue_check]
param[1] = ['物料名称', this.materialNameTypeValue]
param[2] = ['排序名称', this.orderName]
param[3] = ['排序方式', this.order]
var Data = this.CreateData('11', '仓储管理_通用库存_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData10 = response.data.rows
this.total = response.data.total
})
},
sortChange(column) {
if (column.prop === '状态') {
this.orderName = 1
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') {
this.order = 2
} else {
this.order = ''
}
this.searchTable10()
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable10()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable10()
},
getData1(row) {
this.motorModelLabel = this.treeToLabel(this.motorModel, row.电机位置)
this.motorModelId = parseInt(row.电机位置.split(',')[row.电机位置.split(',').length - 1])
const index = this.motorModelLabel.indexOf('/')
this.motorModelLabel = this.motorModelLabel.substring(index + 1, this.motorModelLabel.length)
},
getData3(row) {
this.bearingLabel = this.treeToLabel(this.bearing, row.轴承位置)
this.bearingId = parseInt(row.轴承位置.split(',')[row.轴承位置.split(',').length - 1])
const index = this.bearingLabel.indexOf('/')
this.bearingLabel = this.bearingLabel.substring(index + 1, this.bearingLabel.length)
},
getData4(row) {
this.motorModelLabel1 = this.treeToLabel(this.motorModel1, row.滑台电机位置)
this.motorModelId1 = parseInt(row.滑台电机位置.split(',')[row.滑台电机位置.split(',').length - 1])
const index = this.motorModelLabel1.indexOf('/')
this.motorModelLabel1 = this.motorModelLabel1.substring(index + 1, this.motorModelLabel1.length)
},
getData5(row) {
this.ConnectingPlateLabel = this.treeToLabel(this.ConnectingPlate, row.电机联接板)
this.ConnectingPlateId = parseInt(row.电机联接板.split(',')[row.电机联接板.split(',').length - 1])
const index = this.ConnectingPlateLabel.indexOf('/')
this.ConnectingPlateLabel = this.ConnectingPlateLabel.substring(index + 1, this.ConnectingPlateLabel.length)
},
getData6(row) {
this.couplingLabel = this.treeToLabel(this.coupling, row.联轴器)
this.couplingId = parseInt(row.联轴器.split(',')[row.联轴器.split(',').length - 1])
const index = this.couplingLabel.indexOf('/')
this.couplingLabel = this.couplingLabel.substring(index + 1, this.couplingLabel.length)
},
getData2(row, index) {
this.transmissionModeId = parseInt(row.传动方式位置.split(',')[row.传动方式位置.split(',').length - 1])
this.spindleWheel = []
this.pulley = []
this.tableData1[index].主轴轮 = ''
this.tableData1[index].电机轮 = ''
this.tableData1[index].皮带轮 = ''
var param4 = []
param4[0] = ['传动方式流水号', this.transmissionModeId]
var Data4 = this.CreateData('11', '传动方式_获取名称', param4)
this.ExecDatabase(Data4).then(response => {
this.transmissionModeLabel = response.data[0].传动方式
})
var param = []
param[0] = ['传动方式流水号', this.transmissionModeId]
var Data = this.CreateData('11', '传动方式_获取主轴轮', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.spindleWheel.push({
label: response.data[i].传动方式,
value: response.data[i].传动方式流水号
})
}
})
var Data2 = this.CreateData('11', '传动方式_获取皮带', param)
this.ExecDatabase(Data2).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.pulley.push({
label: response.data[i].传动方式,
value: response.data[i].传动方式流水号
})
}
})
},
changeState(row) {
this.motorModelLabel = row.电机位置文本
this.motorModelId = row.电机位置[row.电机位置.length - 1]
this.bearingLabel = row.轴承位置文本
this.bearingId = row.轴承位置[row.轴承位置.length - 1]
this.transmissionModeLabel = row.传动方式位置文本
this.transmissionModeId = row.传动方式位置[row.传动方式位置.length - 1]
this.motorModelLabel1 = row.滑台电机文本
this.ConnectingPlateLabel = row.电机联接板文本
this.couplingLabel = row.联轴器文本
this.spindleWheel = []
this.pulley = []
var param = []
param[0] = ['传动方式流水号', this.transmissionModeId]
var Data = this.CreateData('11', '传动方式_获取主轴轮', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.spindleWheel.push({
label: response.data[i].传动方式,
value: response.data[i].传动方式流水号
})
}
})
var Data2 = this.CreateData('11', '传动方式_获取皮带', param)
this.ExecDatabase(Data2).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.pulley.push({
label: response.data[i].传动方式,
value: response.data[i].传动方式流水号
})
}
})
for (let i = 0; i < this.tableData1.length; i++) {
if (row.组件流水号 === this.tableData1[i].组件流水号) {
row.edit = !row.edit
} else {
this.tableData1[i].edit = false
}
}
},
getTreeData1() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '电机型号_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.motorModel = this.tree(data, 0)
})
},
getTreeData2() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '轴承型号_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.bearing = this.tree(data, 0)
})
},
getTreeData3() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '传动方式_查询节点_订单', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.transmissionMode = this.tree(data, 0)
})
},
getTreeData4() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '联接板_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.ConnectingPlate = this.tree(data, 0)
})
},
getTreeData5() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '联轴器_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.coupling = this.tree(data, 0)
})
},
getTreeData6() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '滑台电机_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.motorModel1 = 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
},
treeToLabel(data, arr) {
const result = []
const childrenTreeToLabel = (data, arr, result) => {
console.log(data, arr, 333333)
for (let i = 0; i < data.length; i++) {
if (arr[0] === data[i].value) {
result.push(data[i].label)
if (data[i].children && arr.length > 1) {
childrenTreeToLabel(data[i].children, arr.slice(1), result)
}
break
}
}
}
childrenTreeToLabel(data, arr, result)
return result.join('/')
},
getBasicData() {
var param = []
var Data = this.CreateData('11', '轴承型号_基础表_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.bearing.push({
label: response.data[i].轴承型号,
value: response.data[i].轴承型号流水号
})
}
})
var param1 = []
var Data1 = this.CreateData('11', '中心内冷_基础表_查询数据', param1)
this.ExecDatabase(Data1).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.CentralInternalCooling.push({
label: response.data[i].中心内冷,
value: response.data[i].中心内冷流水号
})
}
})
var param2 = []
var Data2 = this.CreateData('11', '电机转速_基础表_查询数据', param2)
this.ExecDatabase(Data2).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.motorSpeed.push({
label: response.data[i].电机转速,
value: response.data[i].电机转速流水号
})
}
})
var param4 = []
var Data4 = this.CreateData('11', '防护类型_基础表_查询数据', param4)
this.ExecDatabase(Data4).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.TypeOfProtection.push({
label: response.data[i].防护类型,
value: response.data[i].防护类型流水号
})
}
})
var param5 = []
var Data5 = this.CreateData('11', '电机联接板_基础表_查询数据', param5)
this.ExecDatabase(Data5).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.motorConnectingPlate.push({
label: response.data[i].电机联接板,
value: response.data[i].电机联接板流水号
})
}
})
var param7 = []
var Data7 = this.CreateData('11', '拉杆_基础表_查询数据', param7)
this.ExecDatabase(Data7).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.pullRod.push({
label: response.data[i].拉杆,
value: response.data[i].拉杆流水号
})
}
})
var param8 = []
var Data8 = this.CreateData('11', '安装方向_基础表_查询数据', param8)
this.ExecDatabase(Data8).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.installationDirection.push({
label: response.data[i].安装方向,
value: response.data[i].安装方向流水号
})
}
})
var param9 = []
var Data9 = this.CreateData('11', '级别_基础表_查询数据', param9)
this.ExecDatabase(Data9).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.level.push({
label: response.data[i].级别,
value: response.data[i].级别流水号
})
}
})
},
productList() {
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].产品名称,
name: response.data[i].产品流水号
})
}
})
},
searchTable() {
let check, check1
this.customerNameValue ? check = 1 : check = 0
this.dateRange ? check1 = 1 : (check1 = 0, this.dateRange = '')
var param = []
param[0] = ['客户_check', check]
param[1] = ['客户流水号', this.customerNameValue]
param[2] = ['时间_check', check1]
param[3] = ['开始时间', this.dateRange[0]]
param[4] = ['结束时间', this.dateRange[1]]
var Data = this.CreateData('11', '合同信息_未提交订单_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data
})
},
searchTable1(row) {
this.tableData100 = []
if (Number(row.合同类型) === 5) {
this.remarks = row.合同备注
} else {
this.remarks = ''
}
this.orderValue = row.项目流水号
this.searchTable2()
},
searchTable2() {
this.loading1 = true
this.tableData100 = []
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.tableData100.push({
组件流水号: response.data[i].组件流水号,
产品流水号: response.data[i].产品流水号,
是否滑台: response.data[i].是否滑台,
产品名称: response.data[i].产品名称,
产品详情: response.data[i].产品详情,
单位: response.data[i].单位,
数量: response.data[i].数量,
主轴轮: parseInt(response.data[i].主轴轮) ? parseInt(response.data[i].主轴轮) : '',
主轴轮名称: response.data[i].主轴轮名称,
电机轮: parseInt(response.data[i].电机轮) ? parseInt(response.data[i].电机轮) : '',
电机轮名称: response.data[i].电机轮名称,
皮带轮: parseInt(response.data[i].皮带轮) ? parseInt(response.data[i].皮带轮) : '',
皮带轮名称: response.data[i].皮带轮名称,
防护类型: parseInt(response.data[i].防护类型) ? parseInt(response.data[i].防护类型) : '',
防护类型名称: response.data[i].防护类型名称,
电机联接板: response.data[i].电机联接板 ? response.data[i].电机联接板.split(',').map(Number) : [],
电机联接板文本: response.data[i].电机联接板文本,
电机位置: response.data[i].电机位置 ? response.data[i].电机位置.split(',').map(Number) : [],
电机位置文本: response.data[i].电机位置文本,
轴承位置: response.data[i].轴承位置 ? response.data[i].轴承位置.split(',').map(Number) : [],
轴承位置文本: response.data[i].轴承位置文本,
传动方式位置: response.data[i].传动方式位置 ? response.data[i].传动方式位置.split(',').map(Number) : [],
传动方式位置文本: response.data[i].传动方式位置文本,
联轴器: response.data[i].联轴器 ? response.data[i].联轴器.split(',').map(Number) : [],
联轴器文本: response.data[i].联轴器文本,
滑台电机位置: response.data[i].滑台电机位置 ? response.data[i].滑台电机位置.split(',').map(Number) : [],
滑台电机文本: response.data[i].滑台电机文本,
安装方向: parseInt(response.data[i].安装方向) ? parseInt(response.data[i].安装方向) : '',
安装方向名称: response.data[i].安装方向名称,
中心内冷: parseInt(response.data[i].中心内冷) ? parseInt(response.data[i].中心内冷) : '',
中心内冷名称: response.data[i].中心内冷名称,
拉杆: parseInt(response.data[i].拉杆) ? parseInt(response.data[i].拉杆) : '',
拉杆名称: response.data[i].拉杆名称,
其它: response.data[i].其它,
原其它: response.data[i].其它,
输出转速: response.data[i].输出转速,
原输出转速: response.data[i].输出转速,
是否合同创建: response.data[i].是否合同创建,
原产品名称: response.data[i].产品名称,
原产品详情: response.data[i].产品详情,
原数量: response.data[i].数量,
原单位: response.data[i].单位,
edit: false
})
}
}).then(() => {
this.tableData1 = this.tableData100
this.loading1 = false
})
},
groupChange(row) {
var param = []
param[0] = ['组件流水号', row.组件流水号]
param[1] = ['轴承型号', row.轴承型号]
param[2] = ['主轴轮', row.主轴轮]
param[3] = ['电机轮', row.电机轮]
param[4] = ['皮带轮', row.皮带轮]
param[5] = ['防护类型', row.防护类型]
param[6] = ['电机联接板', row.电机联接板]
param[7] = ['电机位置', row.电机位置.join(',')]
param[8] = ['联轴器', row.联轴器]
param[9] = ['中心内冷', row.中心内冷]
param[10] = ['安装方向', row.安装方向]
param[11] = ['其它', row.其它]
param[12] = ['输出转速', row.输出转速]
param[13] = ['拉杆', row.拉杆]
var Data = this.CreateData('12', '订单信息_产品详细参数_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '0') {
this.$message.error('编辑失败')
}
})
},
// updateRemarks() {
// var param = []
// param[0] = ['订单流水号', this.orderValue]
// param[1] = ['订单备注', this.remarks]
// var Data = this.CreateData('12', '订单信息_编辑数据', param)
// this.ExecDatabase(Data).then(response => {
// if (response.data[0].result === '0') {
// this.$message.error('编辑失败')
// }
// })
// },
ReleaseOrder(row) {
if (this.orderValue !== row.项目流水号) {
this.$message.warning('请查看部件内容是否与该合同一致!')
} else {
this.orderValue = row.项目流水号
var param = []
param[0] = ['项目流水号', this.orderValue]
param[1] = ['订单备注', this.remarks]
param[2] = ['下单人', this.id]
var Data = this.CreateData('12', '合同信息_提交订单', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('提交成功')
this.searchTable()
this.tableData1 = []
this.tableData100 = []
this.remarks = ''
} else {
this.$message.error('提交失败')
}
})
}
},
createProduct() {
var param = []
param[0] = ['项目流水号', this.orderValue]
var Data = this.CreateData('12', '订单信息_产品信息_增加数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.searchTable2()
} else {
this.$message.error('添加失败')
}
})
},
editProduct(row) {
var param = []
param[0] = ['组件流水号', row.组件流水号]
param[1] = ['产品名称', row.产品名称]
param[2] = ['产品详情', row.产品详情]
param[3] = ['单位', row.单位]
param[4] = ['数量', row.数量]
if (Number(row.是否合同创建) === 0) {
param[5] = ['产品流水号', 0]
} else {
param[5] = ['产品流水号', row.产品流水号]
}
param[6] = ['轴承位置', row.轴承位置.join(',')]
param[7] = ['主轴轮', row.主轴轮]
param[8] = ['电机轮', row.电机轮]
param[9] = ['皮带轮', row.皮带轮]
param[10] = ['防护类型', row.防护类型]
param[11] = ['电机联接板', row.电机联接板.join(',')]
param[12] = ['电机位置', row.电机位置.join(',')]
param[13] = ['联轴器', row.联轴器.join(',')]
param[14] = ['中心内冷', row.中心内冷]
param[15] = ['安装方向', row.安装方向]
param[16] = ['其它', row.其它]
param[17] = ['输出转速', row.输出转速]
param[18] = ['电机位置文本', this.motorModelLabel]
param[19] = ['传动方式位置', row.传动方式位置.join(',')]
param[20] = ['传动方式位置文本', this.transmissionModeLabel]
param[21] = ['轴承位置文本', this.bearingLabel]
param[22] = ['滑台电机文本', this.motorModelLabel1]
param[23] = ['滑台电机位置', row.滑台电机位置.join(',')]
param[24] = ['电机联接板文本', this.ConnectingPlateLabel]
param[25] = ['联轴器文本', this.couplingLabel]
param[26] = ['拉杆', row.拉杆]
var Data = this.CreateData('12', '订单信息_产品详细参数_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable2()
} else {
this.$message.error('编辑失败')
}
})
row.edit = !row.edit
},
deleteProduct(row) {
var param = []
param[0] = ['组件流水号', row.组件流水号]
var Data = this.CreateData('12', 'PDM_组件名称_删除数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable2()
} else {
this.$message.error('删除失败')
}
})
},
cancel(row) {
row.产品名称 = row.原产品名称
row.产品详情 = row.原产品详情
row.单位 = row.原单位
row.数量 = row.原数量
row.其它 = row.原其它
row.输出转速 = row.原输出转速
row.edit = false
}
}
}
</script>