You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
485 lines
17 KiB
485 lines
17 KiB
<template>
|
|
<div>
|
|
<!--标题按钮部分开始-->
|
|
<div class="tab-header webtop">
|
|
<!--标题-->
|
|
<div>{{ viewTitle }}</div>
|
|
<!--start 添加修改按钮-->
|
|
<div>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled"
|
|
@click="dialogStatus === 'add' ? saveAdd() : saveEdit()">保存
|
|
</el-button>
|
|
<el-button type="info" size="small" @click="handleReturn()">返回</el-button>
|
|
</div>
|
|
<!--end 添加修改按钮-->
|
|
<!--end 详情按钮-->
|
|
</div>
|
|
<!--标题按钮部分结束-->
|
|
<!--Start 新增修改部分-->
|
|
|
|
<div class="listconadd">
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" label-position="top" label-width="300px" class="formadd">
|
|
<div class="wlInfo"><span>采购订单</span></div>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>订单编号</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="useOrg">
|
|
<el-input v-model="formobj.useOrg" placeholder="" class="addinputw" style="width: 85%" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>订单日期</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseGroup">
|
|
<el-input v-model="formobj.warehouseGroup" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>订单类型</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseCode">
|
|
<el-input v-model="formobj.warehouseCode" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>排产申请编号</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseName">
|
|
<el-input v-model="formobj.warehouseName" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>车型</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseAttribute">
|
|
<el-input v-model="formobj.warehouseAttribute" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label"><span class="icon">*</span>台数</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseContract">
|
|
<el-input v-model="formobj.warehouseContract" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12" class="separate">车型价格信息</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">底盘价格构成</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="useOrg">
|
|
<el-input v-model="formobj.useOrg" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">底盘结算价格</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseGroup">
|
|
<el-input v-model="formobj.warehouseGroup" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">上装价格</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseCode">
|
|
<el-input v-model="formobj.warehouseCode" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">修订差价</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseName">
|
|
<el-input v-model="formobj.warehouseName" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">入库价格</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseAttribute">
|
|
<el-input v-model="formobj.warehouseAttribute" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">运费</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseContract">
|
|
<el-input v-model="formobj.warehouseContract" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12" class="separate">订单进程</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">收到发票日期</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="useOrg">
|
|
<el-input v-model="formobj.useOrg" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">发票金额</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseGroup">
|
|
<el-input v-model="formobj.warehouseGroup" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">预计上线日期</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseCode">
|
|
<el-input v-model="formobj.warehouseCode" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">上线日期</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseName">
|
|
<el-input v-model="formobj.warehouseName" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">下线日期</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseAttribute">
|
|
<el-input v-model="formobj.warehouseAttribute" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="4" class="tleftb">
|
|
<el-form-item><span slot="label">备注</span></el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" class="trightb">
|
|
<el-form-item prop="warehouseContract">
|
|
<el-input v-model="formobj.warehouseContract" placeholder="" class="addinputw" clearable/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</div>
|
|
<!--End 添加修改部分-->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
import req from '@/api/cheliang/basevehiclepurchase'
|
|
|
|
export default {
|
|
name: 'cheliangcaigouAdd',
|
|
data() {
|
|
return {
|
|
viewTitle: '【编辑】采购订单',
|
|
dialogStatus: 'add',
|
|
refreshItem: 0,
|
|
// 级联列表
|
|
useOrg_list: [],
|
|
dataArr: [],
|
|
refreshItem: 0, // 级联列表key值
|
|
options: [], // 级联列表选项
|
|
props: { // props传值
|
|
value: 'sid',
|
|
label: 'name',
|
|
children: 'children',
|
|
multiple: true
|
|
},
|
|
// 组织(单选)
|
|
orgProps: {
|
|
value: 'sid',
|
|
label: 'name',
|
|
children: 'children',
|
|
checkStrictly: true
|
|
},
|
|
orgOptions: [],
|
|
orgArr: [],
|
|
formobj: {
|
|
id: '',
|
|
sid: '',
|
|
useOrg: '', // 使用组织
|
|
useOrgSid: '', // 使用组织sid
|
|
warehouseCode: '', // 编码
|
|
warehouseName: '', // 名称
|
|
warehouseAttribute: '', // 仓库属性
|
|
warehouseContract: '', // 仓库负责人
|
|
warehouseContractSid: '', // 仓库负责人sid
|
|
warehouseGroup: '' // 分组
|
|
},
|
|
rules: {
|
|
// useOrg: [{ required: true, message: '使用组织不能为空', trigger: 'change' }], // 使用组织
|
|
// useOrgSid: [{ required: true, message: '使用组织sid不能为空', trigger: 'blur' }], // 使用组织sid
|
|
// warehouseCode: [{ required: true, message: '编码不能为空', trigger: 'blur' }], // 编码
|
|
// warehouseName: [{ required: true, message: '名称不能为空', trigger: 'blur' }], // 名称
|
|
// warehouseAttribute: [{ required: true, message: '仓库属性不能为空', trigger: 'blur' }], // 仓库属性
|
|
// warehouseContract: [{ required: true, message: '仓库负责人不能为空', trigger: 'blur' }], // 仓库负责人
|
|
// warehouseContractSid: [{ required: true, message: '仓库负责人sid不能为空', trigger: 'blur' }], // 仓库负责人sid
|
|
// warehouseGroup: [{ required: true, message: '分组不能为空', trigger: 'blur' }] // 分组
|
|
},
|
|
submitdisabled: false
|
|
}
|
|
},
|
|
created() {
|
|
this.getBuMen()
|
|
this.getOrg()
|
|
},
|
|
methods: {
|
|
// 组织(单选)
|
|
getOrg() {
|
|
req.getOrg().then((res) => {
|
|
if (res.code === '200') {
|
|
this.useOrg_list = res.data
|
|
// this.org0(this.orgOptions)
|
|
}
|
|
})
|
|
},
|
|
useOrgChange(value) {
|
|
console.log('触发下拉框按钮', value)
|
|
let bb = {}
|
|
this.useOrg_list.forEach((e) => {
|
|
// eslint-disable-next-line eqeqeq
|
|
if (e.name == value) {
|
|
bb = {
|
|
name: e.name,
|
|
key: e.id,
|
|
sid: e.sid
|
|
}
|
|
}
|
|
})
|
|
this.formobj.useOrg = bb.name
|
|
this.formobj.useOrgSid = bb.sid
|
|
console.log('name', this.formobj.useOrg, this.formobj.useOrgSid)
|
|
},
|
|
|
|
//级联列表-组织
|
|
getBuMen() {
|
|
req.salesDepName().then((res) => {
|
|
if (res.code === '200') {
|
|
this.options = res.data
|
|
console.log('请求到的级联列表', this.options)
|
|
this.BuMen0(this.options)
|
|
}
|
|
})
|
|
},
|
|
BuMen0(data) {
|
|
data.forEach((e) => {
|
|
if (e.children.length != 0) {
|
|
this.BuMen0(e.children)
|
|
} else {
|
|
delete e.children
|
|
this.dataArr.push(e)
|
|
return
|
|
}
|
|
})
|
|
},
|
|
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
this.formobj.id = ''
|
|
this.formobj.sid = '' // SID
|
|
this.useOrg = '' // 使用组织
|
|
this.useOrgSid = '' // 使用组织sid
|
|
this.warehouseCode = '' // 编码
|
|
this.warehouseName = '' // 名称
|
|
this.warehouseAttribute = '' // 仓库属性
|
|
this.warehouseContract = '' // 仓库负责人
|
|
this.warehouseContractSid = '' // 仓库负责人sid
|
|
this.warehouseGroup = '' // 分组
|
|
this.useOrg_list = []
|
|
this.$refs['form_obj'].resetFields()
|
|
this.$emit('doback')
|
|
},
|
|
showAdd() {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
this.dialogStatus = 'add'
|
|
// this.viewTitle = '新增仓库'
|
|
},
|
|
showEdit(row) {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
this.dialogStatus = 'edit'
|
|
// this.viewTitle = '修改仓库'
|
|
const _this = this
|
|
req
|
|
.fetchBySid(row.sid)
|
|
.then(resp => {
|
|
const vdata = resp.data
|
|
_this.formobj.id = vdata.id
|
|
_this.formobj.sid = vdata.sid // SID
|
|
_this.formobj.useOrg = vdata.useOrg // 使用组织
|
|
_this.useOrg_list = vdata.useOrgSid // 使用组织sid
|
|
_this.formobj.warehouseCode = vdata.warehouseCode // 编码
|
|
_this.formobj.warehouseName = vdata.warehouseName // 名称
|
|
_this.formobj.warehouseAttribute = vdata.warehouseAttribute // 仓库属性
|
|
_this.formobj.warehouseContract = vdata.warehouseContract // 仓库负责人
|
|
_this.formobj.warehouseContractSid = vdata.warehouseContractSid // 仓库负责人sid
|
|
_this.formobj.warehouseGroup = vdata.warehouseGroup // 分组
|
|
})
|
|
.catch(e => {
|
|
this.formobj = row
|
|
})
|
|
},
|
|
saveAdd() {
|
|
const _this = this
|
|
this.$refs['form_obj'].validate(valid => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req
|
|
.saveAdd(this.formobj)
|
|
.then(resp => {
|
|
this.submitdisabled = false
|
|
_this.$message({ showClose: true, type: 'success', message: resp.msg })
|
|
_this.handleReturn('true')
|
|
})
|
|
.catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
saveEdit() {
|
|
const _this = this
|
|
// Start 使用组织字符串赋值
|
|
var useOrg_Sid = ''
|
|
if (this.useOrg_list.length > 0) {
|
|
this.useOrg_list.forEach((item) => {
|
|
var last_id = item[item.length - 1]
|
|
this.select_temp_Sid = '' //临时遍历,用来保存选中结果(组织Sid)
|
|
this.findOrgId(last_id, this.options)
|
|
useOrg_Sid = useOrg_Sid + this.select_temp_Sid + ','
|
|
})
|
|
}
|
|
if (useOrg_Sid !== '') {
|
|
useOrg_Sid = useOrg_Sid.substring(0, useOrg_Sid.length - 1)
|
|
}
|
|
this.formobj.useOrgSid = useOrg_Sid
|
|
console.log('重新赋值后的组织结构', this.formobj.useOrgSid)
|
|
//End
|
|
this.$refs['form_obj'].validate(valid => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req
|
|
.saveEdit(this.formobj, this.formobj.sid)
|
|
.then(resp => {
|
|
this.submitdisabled = false
|
|
_this.$message({ showClose: true, type: 'success', message: resp.msg })
|
|
_this.handleReturn('true')
|
|
})
|
|
.catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.headInfo {
|
|
margin-left: -14px;
|
|
margin-right: -14px;
|
|
}
|
|
|
|
.wlInfo {
|
|
width: 100%;
|
|
height: 100%;
|
|
padding: 60px 0;
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.formadd {
|
|
padding: 0;
|
|
}
|
|
|
|
.formadd .el-row {
|
|
display: -webkit-box;
|
|
display: -ms-flexbox;
|
|
display: flex;
|
|
-ms-flex-wrap: wrap;
|
|
justify-content: center;
|
|
border-left: 0 !important;
|
|
}
|
|
|
|
.tleftb {
|
|
text-align: right;
|
|
border-left: 1px solid #e0e3eb;
|
|
}
|
|
|
|
.tab-headerg {
|
|
height: 35px;
|
|
background-color: #EDF1F7;
|
|
padding: 20px 20px;
|
|
}
|
|
|
|
.icon {
|
|
color: #e84026;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.separate {
|
|
background-color: #e0e3eb;
|
|
line-height: 2 !important;
|
|
font-size: 18px;
|
|
}
|
|
</style>
|
|
|