<template>
|
<el-dialog
|
width="75%"
|
title="同步更新工艺配置单订单行待选列表"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-table
|
ref="otherCustomerOrderLineTable"
|
:data="otherCustomerOrderLineList"
|
style="width: 100%"
|
@row-click="rowClick"
|
height="500px"
|
>
|
<el-table-column align="center" width="55">
|
<template slot="header" slot-scope="scope">
|
<el-button type="text" @click="selectAll()">全选</el-button>
|
</template>
|
<template slot-scope="scope">
|
<el-checkbox
|
class="other-customer-table-single-checkbox"
|
v-model="scope.row.commonChecked"
|
disabled
|
></el-checkbox>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="existProcessConfig"
|
align="center"
|
label="是否已有工艺配置单"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<span>{{ scope.row.existProcessConfig ? '已配置' : '未配置' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="otcLineNo"
|
align="center"
|
label="OTC行号"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="customerNo"
|
align="center"
|
label="客户编号"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column prop="customerName" align="center" label="客户名称">
|
</el-table-column>
|
<el-table-column prop="salesPartNo" align="center" label="销售件号">
|
</el-table-column>
|
<el-table-column prop="salesPartName" align="center" label="销售件名称">
|
</el-table-column>
|
<el-table-column prop="productGroup" align="center" label="产品分组">
|
</el-table-column>
|
<el-table-column prop="productType" align="center" label="产品类型">
|
</el-table-column>
|
</el-table>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="updateCurrOrder">只更新当前订单行</el-button>
|
<el-button @click="updateCheckOrder">同步更新勾选订单行</el-button>
|
<el-button @click="innerVisible = false">关 闭</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
<style>
|
/*自定义disabled状态下checkbox的样式*/
|
.other-customer-table-single-checkbox
|
.el-checkbox__input.is-disabled.is-checked
|
.el-checkbox__inner {
|
background-color: #006eff;
|
border-color: #006eff;
|
}
|
.other-customer-table-single-checkbox
|
.el-checkbox__input.is-disabled
|
.el-checkbox__inner {
|
background-color: #ffffff;
|
cursor: pointer;
|
}
|
.other-customer-table-single-checkbox .el-checkbox__inner::after {
|
border: 1px solid #fff !important;
|
border-left: 0 !important;
|
border-top: 0 !important;
|
cursor: pointer !important;
|
}
|
</style>
|
<script>
|
import {
|
getBeSelectedLineNoList,
|
newProcessConfigEditOne,
|
newProcessConfigAddOne,
|
newProcessConfigEdit
|
} from '@/api/plan/customerorder'
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
configContent: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
customerOrderId: {
|
type: String,
|
default: ''
|
},
|
otherCustomerOrderLineList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
}
|
},
|
data() {
|
return {
|
innerVisible: false
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.$nextTick(() => {})
|
}
|
}
|
},
|
methods: {
|
selectAll() {
|
this.otherCustomerOrderLineList.forEach((item) => {
|
item.commonChecked = true
|
})
|
},
|
rowClick(row) {
|
if (row.commonChecked) {
|
row.commonChecked = false
|
} else {
|
row.commonChecked = true
|
}
|
},
|
updateCurrOrder() {
|
const configId = this.configContent.id
|
console.log(this.configContent)
|
for (
|
let i = this.configContent.processConfigDataList.length - 1;
|
i >= 0;
|
i--
|
) {
|
if (
|
!this.configContent.processConfigDataList[i].frequency &&
|
!this.configContent.processConfigDataList[i].deliveryReduce &&
|
!this.configContent.processConfigDataList[i].couplingLoss
|
) {
|
this.configContent.processConfigDataList.splice(i, 1)
|
}
|
}
|
if (configId) {
|
newProcessConfigEditOne(this.configContent).then((res) => {
|
console.log(res)
|
if (res.data.code === 0) {
|
this.innerVisible = false
|
this.$message.success('保存成功')
|
this.$emit('refreshCustomerOrderForm', this.configContent.orderId)
|
} else {
|
this.$message.success('保存失败')
|
}
|
})
|
} else {
|
newProcessConfigAddOne(this.configContent).then((res) => {
|
console.log(res)
|
if (res.data.code === 0) {
|
this.innerVisible = false
|
this.$message.success('保存成功')
|
this.$emit('refreshCustomerOrderForm', this.configContent.orderId)
|
} else {
|
this.$message.success('保存失败')
|
}
|
})
|
}
|
},
|
updateCheckOrder() {
|
// 刷选出选中的otherCustomerOrderLineList行订单
|
const orderIds = []
|
this.otherCustomerOrderLineList.forEach((item) => {
|
if (item.commonChecked) {
|
orderIds.push(item.id)
|
}
|
})
|
if (orderIds.length > 0) {
|
orderIds.push(this.customerOrderId)
|
const configId = this.configContent.id
|
console.log(this.configContent)
|
for (
|
let i = this.configContent.processConfigDataList.length - 1;
|
i >= 0;
|
i--
|
) {
|
if (
|
!this.configContent.processConfigDataList[i].frequency &&
|
!this.configContent.processConfigDataList[i].deliveryReduce &&
|
!this.configContent.processConfigDataList[i].couplingLoss
|
) {
|
this.configContent.processConfigDataList.splice(i, 1)
|
}
|
}
|
this.configContent.orderIdList = orderIds
|
newProcessConfigEdit(this.configContent).then((res) => {
|
console.log(res)
|
if (res.data.code === 0) {
|
this.innerVisible = false
|
this.$message.success('保存成功')
|
this.$emit('refreshCustomerOrderForm', this.configContent.orderId)
|
} else {
|
this.$message.success('保存失败')
|
}
|
})
|
} else {
|
this.$message.error('请选择行订单')
|
}
|
}
|
}
|
}
|
</script>
|