|
@@ -3,28 +3,24 @@
|
|
|
<el-page-header @back="handleBack" :content="detailsId?'编辑':'新增'" style=" padding: 20px 20px 0 20px;"
|
|
|
></el-page-header>
|
|
|
<sales-header ref="header" />
|
|
|
- <sales-table :dataList="dataList" :column="column" :isOperation="detailsId ?false:true" isSelection
|
|
|
- @handleSelection="handleSelection"
|
|
|
+ <sales-table
|
|
|
+ :dataList="dataList"
|
|
|
+ :column="column"
|
|
|
+ :isOperation="detailsId ? false : true"
|
|
|
+ isSelection
|
|
|
+ @handleSelection="handleSelection"
|
|
|
>
|
|
|
<template #bts>
|
|
|
- <div v-if="!detailsId ">
|
|
|
- <el-button type="primary" v-if="dis"
|
|
|
- size="mini" @click="dialogVisible=true"
|
|
|
- >添加
|
|
|
- </el-button>
|
|
|
- <el-button type="danger" v-if="dis"
|
|
|
- size="mini" @click="delChange"
|
|
|
- >删除
|
|
|
- </el-button>
|
|
|
+ <div v-if="!detailsId">
|
|
|
+ <el-button type="primary" v-if="dis" size="mini" @click="dialogVisible = true">添加 </el-button>
|
|
|
+ <el-button type="danger" v-if="dis" size="mini" @click="delChange">删除 </el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #events>
|
|
|
<div v-if="!detailsId">
|
|
|
<el-button type="primary" :disabled="!dis" size="mini" @click="handelSubmit(1)">提交</el-button>
|
|
|
- <el-button size="mini" @click="onReset" v-if="dis"
|
|
|
- >重置
|
|
|
- </el-button>
|
|
|
- <el-button size="mini" v-if="isFront!==false" :disabled="dis" @click="handleInform(2)">通知发货</el-button>
|
|
|
+ <el-button size="mini" @click="onReset" v-if="dis">重置 </el-button>
|
|
|
+ <el-button size="mini" v-if="isFront !== false" :disabled="dis" @click="handleInform(2)">通知发货</el-button>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<el-button type="primary" size="mini" @click="handelSubmit(2)">保存</el-button>
|
|
@@ -32,19 +28,18 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <template v-slot:operation="{item:{row,$index}}">
|
|
|
- <el-popconfirm
|
|
|
- v-if="dis"
|
|
|
- style="margin-left: 10px"
|
|
|
- title="删除?"
|
|
|
- @onConfirm="handleDel(row,$index)"
|
|
|
- >
|
|
|
+ <template v-slot:operation="{ item: { row, $index } }">
|
|
|
+ <el-popconfirm v-if="dis" style="margin-left: 10px" title="删除?" @onConfirm="handleDel(row, $index)">
|
|
|
<el-button slot="reference" type="text" size="mini">删除</el-button>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
|
</sales-table>
|
|
|
- <sales-dialog ref="dia" :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
|
|
|
- @confirm="confirm"
|
|
|
+ <sales-dialog
|
|
|
+ ref="dia"
|
|
|
+ :dialogVisible="dialogVisible"
|
|
|
+ :customerNumber="customerNumber"
|
|
|
+ :func="getDialogList"
|
|
|
+ @confirm="confirm"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -63,7 +58,7 @@ export default {
|
|
|
SalesTable,
|
|
|
SalesDialog
|
|
|
},
|
|
|
- props: ['detailsId','pageType'],
|
|
|
+ props: ['detailsId', 'pageType'],
|
|
|
data() {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
@@ -73,7 +68,7 @@ export default {
|
|
|
disabled: false,
|
|
|
flag: 1,
|
|
|
dis: true,
|
|
|
- column: [
|
|
|
+ column: [
|
|
|
{
|
|
|
prop: 'materialName',
|
|
|
label: '产品名称',
|
|
@@ -106,7 +101,6 @@ export default {
|
|
|
width: '180',
|
|
|
isInput: true,
|
|
|
type: 'text'
|
|
|
-
|
|
|
}
|
|
|
],
|
|
|
isFront: JSON.parse(localStorage.getItem('supply_user')).isFront,
|
|
@@ -115,7 +109,6 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
if (this.detailsId) {
|
|
|
-
|
|
|
getFrontOrderDetail({ id: this.detailsId }).then(res => {
|
|
|
this.dataList = res.data.orders
|
|
|
this.customerNumber = res.data.customerNumber
|
|
@@ -129,46 +122,44 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
Object.assign(this.$data, this.$options.data())
|
|
|
- this.column = [
|
|
|
- {
|
|
|
- prop: 'materialName',
|
|
|
- label: '产品名称',
|
|
|
- width: '180'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'materialCode',
|
|
|
- label: '物料编码',
|
|
|
- width: '180'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'specification',
|
|
|
- label: '规格型号',
|
|
|
- width: '300'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'stockQty',
|
|
|
- label: '库存数量',
|
|
|
- width: '180'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'qty',
|
|
|
- label: '数量',
|
|
|
- width: '180',
|
|
|
- isInput: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'notes',
|
|
|
- label: '备注',
|
|
|
- width: '180',
|
|
|
- isInput: true,
|
|
|
- type: 'text'
|
|
|
-
|
|
|
- }
|
|
|
- ]
|
|
|
+ this.column = [
|
|
|
+ {
|
|
|
+ prop: 'materialName',
|
|
|
+ label: '产品名称',
|
|
|
+ width: '180'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'materialCode',
|
|
|
+ label: '物料编码',
|
|
|
+ width: '180'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格型号',
|
|
|
+ width: '300'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'stockQty',
|
|
|
+ label: '库存数量',
|
|
|
+ width: '180'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'qty',
|
|
|
+ label: '数量',
|
|
|
+ width: '180',
|
|
|
+ isInput: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'notes',
|
|
|
+ label: '备注',
|
|
|
+ width: '180',
|
|
|
+ isInput: true,
|
|
|
+ type: 'text'
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
getDialogList(p) {
|
|
|
let func = getcustomerFrontList
|
|
|
if (this.isFront === true) {
|
|
@@ -181,12 +172,15 @@ export default {
|
|
|
},
|
|
|
confirm(selected) {
|
|
|
this.dataList = [...this.dataList, ...selected]
|
|
|
- for (let i = 0; i <this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData.length ; i++) {
|
|
|
+ for (let i = 0; i < this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData.length; i++) {
|
|
|
for (let j = 0; j < this.dataList.length; j++) {
|
|
|
- if ( this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].id == this.dataList[j].id || this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].disabled ===false){
|
|
|
- this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i],'disabled',false)
|
|
|
- }else{
|
|
|
- this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i],'disabled',true)
|
|
|
+ if (
|
|
|
+ this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].id == this.dataList[j].id ||
|
|
|
+ this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].disabled === false
|
|
|
+ ) {
|
|
|
+ this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i], 'disabled', false)
|
|
|
+ } else {
|
|
|
+ this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i], 'disabled', true)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -225,13 +219,15 @@ export default {
|
|
|
},
|
|
|
delChange() {
|
|
|
if (this.dataList.length) {
|
|
|
- for (let i = 0; i <this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData.length ; i++) {
|
|
|
+ for (let i = 0; i < this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData.length; i++) {
|
|
|
for (let j = 0; j < this.selection.length; j++) {
|
|
|
- if ( this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].id == this.selection[j].id|| this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].disabled ===true){
|
|
|
+ if (
|
|
|
+ this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].id == this.selection[j].id ||
|
|
|
+ this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i].disabled === true
|
|
|
+ ) {
|
|
|
// k.disabled = true
|
|
|
- this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i],'disabled',true)
|
|
|
+ this.$set(this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.tableData[i], 'disabled', true)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
this.dataList = this.resArr(this.dataList, this.selection)
|
|
@@ -240,7 +236,6 @@ export default {
|
|
|
this.customerNumber = ''
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
handleSelection(data) {
|
|
|
this.selection = data
|
|
@@ -253,7 +248,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handelSubmit(type, status = 1) {
|
|
|
-
|
|
|
if (!this.dataList.length) {
|
|
|
this.$errorMsg('请添加产品')
|
|
|
return
|
|
@@ -261,8 +255,6 @@ export default {
|
|
|
for (let i = 0; i < this.dataList.length; i++) {
|
|
|
this.dataList[i].id = ''
|
|
|
this.dataList[i].directFlag = this.dataList[i].flag
|
|
|
- console.log(Number(this.dataList[i].qty))
|
|
|
-
|
|
|
if (Number(this.dataList[i].qty) < 0 || !this.dataList[i].qty) {
|
|
|
this.$errorMsg(`第${i + 1}产品数量有误`)
|
|
|
return
|
|
@@ -274,7 +266,7 @@ export default {
|
|
|
orders: this.dataList,
|
|
|
status: status
|
|
|
}
|
|
|
- this.$refs.header.$refs.form.validate((valid) => {
|
|
|
+ this.$refs.header.$refs.form.validate(valid => {
|
|
|
if (valid) {
|
|
|
if (type == 1) {
|
|
|
params.id = ''
|
|
@@ -282,7 +274,7 @@ export default {
|
|
|
this.$successMsg('新增成功')
|
|
|
this.dis = false
|
|
|
this.disabled = true
|
|
|
- this.$set(this.$refs.header.screenForm,'disabled',true)
|
|
|
+ this.$set(this.$refs.header.screenForm, 'disabled', true)
|
|
|
this.column = [
|
|
|
{
|
|
|
prop: 'materialName',
|
|
@@ -307,8 +299,7 @@ export default {
|
|
|
{
|
|
|
prop: 'qty',
|
|
|
label: '数量',
|
|
|
- width: '180',
|
|
|
-
|
|
|
+ width: '180'
|
|
|
},
|
|
|
{
|
|
|
prop: 'notes',
|
|
@@ -316,7 +307,6 @@ export default {
|
|
|
width: '180',
|
|
|
|
|
|
type: 'text'
|
|
|
-
|
|
|
}
|
|
|
]
|
|
|
if (this.isFront ===false){
|
|
@@ -325,14 +315,12 @@ export default {
|
|
|
this.$set(this.$refs.header.screenForm,'id',res.data)
|
|
|
this.$forceUpdate()
|
|
|
})
|
|
|
-
|
|
|
} else {
|
|
|
updateFrontOrder(params).then(res => {
|
|
|
this.$successMsg('编辑成功')
|
|
|
this.handleBack()
|
|
|
this.$forceUpdate()
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
@@ -353,6 +341,4 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped></style>
|