Browse Source

修复测试文档中供应链管理--即时库存表的问题

master
yunuo970428 3 years ago
parent
commit
8a4da19efb
  1. 762
      anrui-scm/anrui-scm-ui/src/views/anruiscm/scmrealtimeinventory/scmrealtimeinventory.vue
  2. 848
      anrui-scm/anrui-scm-ui/src/views/anruiscm/scmrealtimeinventory/scmrealtimeinventoryAdd.vue

762
anrui-scm/anrui-scm-ui/src/views/anruiscm/scmrealtimeinventory/scmrealtimeinventory.vue

@ -3,44 +3,40 @@
<div v-show="viewState == 1"> <div v-show="viewState == 1">
<button-bar view-title="即时库存表" :btndisabled="btndisabled" @btnhandle="btnHandle"/> <button-bar view-title="即时库存表" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
<div class="searchcon"> <div class="searchcon">
<el-button size="small" class="searchbtn" @click="isSearchShow = !isSearchShow">{{ isSearchShow ? '隐藏查询条件' : <el-button size="small" class="searchbtn" @click="isSearchShow = !isSearchShow">{{isSearchShow ? '隐藏查询条件' : '显示查询条件' }}</el-button>
'显示查询条件' }}
</el-button>
<div v-show="isSearchShow" class="search"> <div v-show="isSearchShow" class="search">
<el-form :inline="true" class="tab-header"> <el-form :inline="true" class="tab-header" label-width="100px">
<el-form-item label="物料编码"> <el-row>
<el-input v-model="queryParams.params.mNum" placeholder="请输入物料编码" clearable/> <el-form-item label="物料编码">
</el-form-item> <el-input v-model="queryParams.params.mNum" placeholder="请输入物料编码" clearable/>
<el-form-item label="物料名称"> </el-form-item>
<el-input v-model="queryParams.params.mName" placeholder="请输入物料名称" clearable/> <el-form-item label="物料名称">
</el-form-item> <el-input v-model="queryParams.params.mName" placeholder="请输入物料名称" clearable/>
<el-form-item label="库存主单位"> </el-form-item>
<el-select v-model="queryParams.params.inventoryPrimaryUnit" @change="changeInventoryPrimary" <el-form-item label="库存主单位">
placeholder="请选择" class="addinputw" clearable> <el-select v-model="queryParams.params.inventoryPrimaryUnit" @change="changeInventoryPrimary" placeholder="请选择" clearable>
<el-option v-for="item in inventoryPrimary_list" :key="item.dictKey" :label="item.dictValue" <el-option v-for="item in inventoryPrimary_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" clearable></el-option>
:value="item.dictKey" clearable></el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> <el-form-item label="库存状态">
<el-form-item label="库存状态"> <el-select v-model="queryParams.params.invenState" @change="changeInvenState" placeholder="请选择" clearable>
<el-select v-model="queryParams.params.invenState" @change="changeInvenState" <el-option v-for="item in invenState_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
placeholder="请选择" clearable> </el-select>
<el-option v-for="item in invenState_list" :key="item.dictKey" :label="item.dictValue" </el-form-item>
:value="item.dictKey"></el-option> <el-form-item label="仓库">
</el-select> <el-select v-model="queryParams.params.warehouse" @change="changeWarehouse" placeholder="请选择" clearable>
</el-form-item> <el-option v-for="item in warehouse_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
<el-form-item label="仓库"> </el-select>
<el-select v-model="queryParams.params.warehouse" @change="changeWarehouse" </el-form-item>
placeholder="请选择" class="addinputw" clearable> </el-row>
<el-option v-for="item in warehouse_list" :key="item.dictKey" :label="item.dictValue" <el-row>
:value="item.dictKey"></el-option> <el-form-item label="货主">
</el-select> <el-input v-model="queryParams.params.cargoOwner" placeholder="请输入货主" clearable/>
</el-form-item> </el-form-item>
<el-form-item label="货主"> <el-form-item label="保管者名称">
<el-input v-model="queryParams.params.cargoOwner" placeholder="请输入货主" clearable/> <el-input v-model="queryParams.params.custodian" placeholder="请输入保管者名称" clearable/>
</el-form-item> </el-form-item>
<el-form-item label="保管者名称"> </el-row>
<el-input v-model="queryParams.params.custodian" placeholder="请输入保管者名称" clearable/>
</el-form-item>
<el-divider/> <el-divider/>
<div class="btn" style="text-align: center;"> <div class="btn" style="text-align: center;">
<el-button type="primary" @click="dosearch">查询</el-button> <el-button type="primary" @click="dosearch">查询</el-button>
@ -52,15 +48,12 @@
<!--Start 项目列表头部--> <!--Start 项目列表头部-->
<div class="listtop"> <div class="listtop">
<div class="tit">即时库存表列表</div> <div class="tit">即时库存表列表</div>
<pageye v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" <pageye v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
:limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
</div> </div>
<!--End 项目列表头部--> <!--End 项目列表头部-->
<!--Start 项目列表--> <!--Start 项目列表-->
<div class="listcon"> <div class="listcon">
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%" <el-table v-loading="tableLoading" :data="dataList" border style="width: 100%" @selection-change="handleSelectionChange">
@selection-change="handleSelectionChange">
<el-table-column width="50px" type="selection" align="center"/> <el-table-column width="50px" type="selection" align="center"/>
<el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/> <el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column prop="mNum" label="物料编码" align="center"> <el-table-column prop="mNum" label="物料编码" align="center">
@ -88,14 +81,7 @@
<div class="pages"> <div class="pages">
<div class="tit"/> <div class="tit"/>
<!-- 翻页 --> <!-- 翻页 -->
<pagination <pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
v-show="dataList.length > 0"
:total="queryParams.total"
:page.sync="queryParams.current"
:limit.sync="queryParams.size"
class="pagination"
@pagination="loadList"
/>
</div> </div>
</div> </div>
<!--End 查询和其列表部分--> <!--End 查询和其列表部分-->
@ -109,368 +95,366 @@
</template> </template>
<script> <script>
import req from '@/api/anruiscm/scmrealtimeinventory' import req from '@/api/anruiscm/scmrealtimeinventory'
import ButtonBar from '@/components/ButtonBar' import ButtonBar from '@/components/ButtonBar'
import Pagination from '@/components/pagination' import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye' import pageye from '@/components/pagination/pageye'
import divAdd from './scmrealtimeinventoryAdd' import divAdd from './scmrealtimeinventoryAdd'
import divInfo from './scmrealtimeinventoryInfo' import divInfo from './scmrealtimeinventoryInfo'
import { setuser, getuser } from '@/utils/baocun'
export default { export default {
name: 'ScmRealTimeInventoryIndex', name: 'ScmRealTimeInventoryIndex',
components: { components: {
ButtonBar, ButtonBar,
Pagination, Pagination,
pageye, pageye,
divAdd, divAdd,
divInfo divInfo
},
data() {
return {
btndisabled: false,
viewState: 1, // 1 2 3 4
isSearchShow: false,
tableLoading: false,
//
invenState_list: [], //
warehouse_list: [], //
//
inventoryPrimary_list: [], //
dataArr: [],
refreshItem: 0, // key
options: [], //
props: { // props
value: 'sid',
label: 'name',
children: 'children',
multiple: true
},
dataList: [],
sids: [],
sides: '',
queryParams: {
current: 1,
size: 10,
total: 0,
params: {
sids: [], // SID
mNum: '', //
mName: '', //
warehouse: '', //
inventoryPrimaryUnit: '', //
inventory: '', //
availableQuantity: '', //
stockOrgName: '', //
cargoOwnerType: '', //
cargoOwnerNo: '', //
cargoOwner: '', //
invenState: '', //
warehouseNo: '', //
custodianType: '', //
custodianNo: '', //
custodian: '' //
}
},
multipleSelection: []
}
},
created() {
this.loadList()
this.getInvenState() //
this.getWarehouse() //
this.getInventoryPrimary() //
},
methods: {
resetState() {
this.viewState = 1
}, },
data() { btnHandle(btnKey) {
return { console.log('XXXXXXXXXXXXXXX ' + btnKey)
btndisabled: false, switch (btnKey) {
viewState: 1, // 1 2 3 4 case 'toAdd':
isSearchShow: false, this.toAdd()
tableLoading: false, break
// case 'toEdit':
invenState_list: [],// this.toEdit()
warehouse_list: [],// break
// case 'doSubmit':
inventoryPrimary_list: [],// this.doSubmit()
dataArr: [], break
refreshItem: 0, // key case 'doDel':
options: [], // this.doDel()
props: { // props break
value: 'sid', case 'doImport':
label: 'name', this.doImport()
children: 'children', break
multiple: true case 'doExport':
}, this.doExport()
dataList: [], break
sids: [], default:
sides: '', break
queryParams: {
current: 1,
size: 10,
total: 0,
params: {
sids: [], // SID
mNum: '', //
mName: '', //
warehouse: '', //
inventoryPrimaryUnit: '', //
inventory: '', //
availableQuantity: '', //
stockOrgName: '', //
cargoOwnerType: '', //
cargoOwnerNo: '', //
cargoOwner: '', //
invenState: '', //
warehouseNo: '', //
custodianType: '', //
custodianNo: '', //
custodian: '' //
}
},
multipleSelection: []
} }
}, },
created() { // sid
this.loadList() handleSelectionChange(row) {
this.getInvenState() // console.log('aaa', row)
this.getWarehouse() // const aa = []
this.getInventoryPrimary() // row.forEach(element => {
aa.push(element.sid)
})
this.sids = aa
this.sides = this.sids.join() // sid
console.log('获取sids数组', this.sids)
}, },
methods: { // - changeInvenState
resetState() { getInvenState() {
this.viewState = 1 req.pullDown({
}, type: 'invenState'
btnHandle(btnKey) { }).then((res) => {
console.log('XXXXXXXXXXXXXXX ' + btnKey) if (res.code === '200') {
switch (btnKey) { this.invenState_list = res.data
case 'toAdd': console.log('下拉框请求111', res.data)
this.toAdd()
break
case 'toEdit':
this.toEdit()
break
case 'doSubmit':
this.doSubmit()
break
case 'doDel':
this.doDel()
break
case 'doImport':
this.doImport()
break
case 'doExport':
this.doExport()
break
default:
break
} }
}, })
// sid },
handleSelectionChange(row) { changeInvenState(value) {
console.log('aaa', row) console.log('触发下拉框按钮')
const aa = [] let bb = {}
row.forEach(element => { this.invenState_list.forEach((e) => {
aa.push(element.sid) if (e.dictKey === value) {
setuser(this.sids) bb = {
}) type: e.dictType,
this.sids = aa name: e.dictValue,
this.sides = this.sids.join() //sid key: e.dictKey,
console.log('获取sids数组', this.sids) sid: e.sid
},
//- changeInvenState
getInvenState() {
req.pullDown({
type: 'invenState'
}).then((res) => {
if (res.code === '200') {
this.invenState_list = res.data
console.log('下拉框请求111', res.data)
}
})
},
changeInvenState(value) {
console.log('触发下拉框按钮')
let bb = {}
this.invenState_list.forEach((e) => {
// eslint-disable-next-line eqeqeq
if (e.dictKey == value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
}
})
this.queryParams.params.invenState = bb.name
this.queryParams.params.invenStateSid = bb.sid
console.log('name', this.invenState, this.invenStateSid)
},
//- warehouse
getWarehouse() {
req.pullDown({
type: 'warehouse'
}).then((res) => {
if (res.code === '200') {
this.warehouse_list = res.data
console.log('下拉框请求111', res.data)
} }
}) }
}, })
changeWarehouse(value) { this.queryParams.params.invenState = bb.name
console.log('触发下拉框按钮') this.queryParams.params.invenStateSid = bb.sid
let bb = {} console.log('name', this.invenState, this.invenStateSid)
this.warehouse_list.forEach((e) => { },
// eslint-disable-next-line eqeqeq // - warehouse
if (e.dictKey == value) { getWarehouse() {
bb = { req.pullDown({
type: e.dictType, type: 'warehouse'
name: e.dictValue, }).then((res) => {
key: e.dictKey, if (res.code === '200') {
sid: e.sid this.warehouse_list = res.data
} console.log('下拉框请求111', res.data)
}
})
},
changeWarehouse(value) {
console.log('触发下拉框按钮')
let bb = {}
this.warehouse_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
} }
}) }
this.queryParams.params.warehouse = bb.name })
this.queryParams.params.warehouseSid = bb.sid this.queryParams.params.warehouse = bb.name
console.log('name', this.queryParams.params.warehouse, this.queryParams.params.warehouseSid) this.queryParams.params.warehouseSid = bb.sid
}, console.log('name', this.queryParams.params.warehouse, this.queryParams.params.warehouseSid)
},
//- // -
getInventoryPrimary() { getInventoryPrimary() {
req.pullDown({ req.pullDown({
type: 'basicUnit' type: 'basicUnit'
}).then((res) => { }).then((res) => {
if (res.code === '200') { if (res.code === '200') {
this.inventoryPrimary_list = res.data this.inventoryPrimary_list = res.data
console.log('下拉框请求111', res.data) console.log('下拉框请求111', res.data)
}
})
},
changeInventoryPrimary(value) {
console.log('触发下拉框按钮')
let bb = {}
this.inventoryPrimary_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
} }
}
})
this.queryParams.params.inventoryPrimaryUnit = bb.name
console.log('name', this.queryParams.params.inventoryPrimaryUnit)
},
toAdd() {
this.viewState = 2
this.$refs['divadd'].showAdd()
},
toEdit() {
if (this.sids.length === 0) {
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行编辑' })
return
}
if (this.sids.length > 1) {
this.$message({ showClose: true, type: 'error', message: '只能选择一条记录进行编辑' })
return
}
const sid = this.sids[0]
this.$refs['divadd'].showEdit(sid)
this.viewState = 3
},
doSubmit(row) {
//
this.btndisabled = true
req
.doSubmit(this.queryParams.params)
.then(resp => {
console.log(resp)
this.btndisabled = false
}) })
}, .catch(() => {
changeInventoryPrimary(value) { this.btndisabled = false
console.log('触发下拉框按钮')
let bb = {}
this.inventoryPrimary_list.forEach((e) => {
// eslint-disable-next-line eqeqeq
if (e.dictKey == value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
}
}) })
this.queryParams.params.inventoryPrimaryUnit = bb.name },
console.log('name', this.queryParams.params.inventoryPrimaryUnit)
},
toAdd() { doDel() {
this.viewState = 2 if (this.sids.length === 0) {
this.$refs['divadd'].showAdd() this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' })
}, return
toEdit() { }
if (this.sids.length === 0) { const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?'
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行编辑' }) this.$confirm(tip, '提示', {
return confirmButtonText: '确定',
} cancelButtonText: '取消',
if (this.sids.length > 1) { type: 'warning'
this.$message({ showClose: true, type: 'error', message: '只能选择一条记录进行编辑' }) }).then(() => {
return const loading = this.$loading({
} lock: true,
const sid = this.sids[0] text: 'Loading',
this.$refs['divadd'].showEdit(sid) spinner: 'el-icon-loading',
this.viewState = 3 background: 'rgba(0, 0, 0, 0.7)'
},
doSubmit(row) {
//
this.btndisabled = true
req
.doSubmit(this.queryParams.params)
.then(resp => {
console.log(resp)
this.btndisabled = false
})
.catch(() => {
this.btndisabled = false
}) })
}, const _this = this
req.delBySids(this.sids).then(resp => {
doDel() { loading.close()
if (this.sids.length === 0) { _this.$message({ type: 'success', message: resp.msg, showClose: true })
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) _this.loadList()
return }).catch(e => {
}
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const _this = this
req.delBySids(this.sids).then(resp => {
loading.close() loading.close()
_this.$message({ type: 'success', message: resp.msg, showClose: true })
_this.loadList()
}) })
.catch(e => {
loading.close()
})
})
.catch(() => {
})
},
doImport() {
//
req
.importExcel(this.queryParams.params)
.then(resp => {
console.log(resp)
})
.catch(() => {
})
},
doExport(row) {
//
const sids = []
this.multipleSelection.forEach(row => {
sids.push(row.sid)
}) })
this.queryParams.params.sids = sids .catch(() => {
req })
.exportExcel(this.queryParams.params) },
.then(resp => {
var map = resp.data doImport() {
const fileName = map.filename // //
// // <a> Firefox Chrome download req.importExcel(this.queryParams.params).then(resp => {
// // IE10blobdownload console.log(resp)
const link = document.createElement('a') // a }).catch(() => {
link.download = fileName // a })
link.style.display = 'none' },
link.href = map.downurl doExport(row) {
document.body.appendChild(link) //
link.click() // const sids = []
URL.revokeObjectURL(link.href) // url this.multipleSelection.forEach(row => {
document.body.removeChild(link) // sids.push(row.sid)
}) })
.catch(() => { this.queryParams.params.sids = sids
}) req.exportExcel(this.queryParams.params).then(resp => {
}, var map = resp.data
dosearch() { const fileName = map.filename //
this.queryParams.current = 1 // // <a> Firefox Chrome download
this.loadList() // // IE10blobdownload
}, const link = document.createElement('a') // a
resetQuery() { link.download = fileName // a
this.queryParams.params = {} link.style.display = 'none'
this.queryParams.params.sid = '' // sid link.href = map.downurl
this.queryParams.params.name = '' // document.body.appendChild(link)
this.dosearch() link.click() //
}, URL.revokeObjectURL(link.href) // url
loadList() { document.body.removeChild(link) //
const _this = this }).catch(() => {
this.tableLoading = true })
req },
.listPage(this.queryParams) dosearch() {
.then(resp => { this.queryParams.current = 1
console.log('查询列表', resp) this.loadList()
_this.tableLoading = false },
const data = resp.data resetQuery() {
_this.queryParams.total = data.total this.queryParams.params = {}
_this.dataList = data.records this.queryParams.params.sid = '' // sid
}) this.queryParams.params.name = '' //
.catch(() => { this.dosearch()
_this.tableLoading = false },
}) loadList() {
}, const _this = this
// this.tableLoading = true
indexMethod(index) { req.listPage(this.queryParams).then(resp => {
var pagestart = (this.queryParams.current - 1) * this.queryParams.size console.log('查询列表', resp)
var pageindex = index + 1 + pagestart _this.tableLoading = false
return pageindex const data = resp.data
}, _this.queryParams.total = data.total
toInfo(row) { _this.dataList = data.records
const sid = row.sid }).catch(() => {
console.log('打开详情', sid) _this.tableLoading = false
this.$refs['divinfo'].showInfo(sid,row) })
this.viewState = 4 },
} //
indexMethod(index) {
var pagestart = (this.queryParams.current - 1) * this.queryParams.size
var pageindex = index + 1 + pagestart
return pageindex
},
toInfo(row) {
const sid = row.sid
console.log('打开详情', sid)
this.$refs['divinfo'].showInfo(sid, row)
this.viewState = 4
} }
} }
}
</script> </script>
<style scoped> <style scoped>
/deep/ .el-collapse { /deep/ .el-collapse {
border-top: 0px solid #e6ebf5; border-top: 0px solid #e6ebf5;
border-bottom: 0px solid #e6ebf5; border-bottom: 0px solid #e6ebf5;
} }
/deep/ .el-collapse-item__content { /deep/ .el-collapse-item__content {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
/deep/ .el-collapse-item__wrap { /deep/ .el-collapse-item__wrap {
border-bottom: 0px solid #ebeef5; border-bottom: 0px solid #ebeef5;
} }
/deep/ .el-collapse-item__header { /deep/ .el-collapse-item__header {
border-bottom: 0px solid #e6ebf5; border-bottom: 0px solid #e6ebf5;
} }
.searchbtn { .searchbtn {
border: #2cab69 1px solid; border: #2cab69 1px solid;
color: #2cab69; color: #2cab69;
} }
.listtop {
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid #dfe4ed;
height: 40px;
}
.tit {
margin-bottom: -10px;
}
.pagination {
margin-bottom: -10px;
}
</style> </style>

848
anrui-scm/anrui-scm-ui/src/views/anruiscm/scmrealtimeinventory/scmrealtimeinventoryAdd.vue

@ -1,20 +1,14 @@
<template> <template>
<div> <div>
<!--标题按钮部分开始-->
<div class="tab-header webtop"> <div class="tab-header webtop">
<!--标题--> <!--标题-->
<div>{{ viewTitle }}</div> <div>{{ viewTitle }}</div>
<!--start 添加修改按钮-->
<div> <div>
<el-button type="primary" size="small" :disabled="submitdisabled" <el-button type="primary" size="small" :disabled="submitdisabled" @click="dialogStatus === 'add' ? saveAdd() : saveEdit()">保存
@click="dialogStatus === 'add' ? saveAdd() : saveEdit()">保存
</el-button> </el-button>
<el-button type="info" size="small" @click="handleReturn()">返回</el-button> <el-button type="info" size="small" @click="handleReturn()">返回</el-button>
</div> </div>
<!--end 添加修改按钮-->
</div> </div>
<!--标题按钮部分结束-->
<!--Start 新增修改部分-->
<div class="listconadd"> <div class="listconadd">
<el-form ref="form_obj" :model="formobj" :rules="rules" label-position="top" label-width="300px" class="formadd"> <el-form ref="form_obj" :model="formobj" :rules="rules" label-position="top" label-width="300px" class="formadd">
<div class="wlInfo"><span>即时库存表</span></div> <div class="wlInfo"><span>即时库存表</span></div>
@ -24,20 +18,16 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="mNum"> <el-form-item prop="mNum">
<el-select v-model="formobj.mNum" @change="changeMnum" placeholder="请选择" class="addinputw" clearable>
<el-select v-model="formobj.mNum" @change="changeMnum" <el-option v-for="item in mnum_list" :key="item.sid" :label="item.mNum" :value="item.mNum"></el-option>
placeholder="请选择" class="addinputw" clearable>
<el-option v-for="item in mnum_list" :key="item.sid" :label="item.mNum"
:value="item.mNum"></el-option>
</el-select> </el-select>
<!-- <el-input v-model="formobj.mNum" placeholder="请输入物料编码" class="addinputw" clearable/>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4" class="tleftb"> <el-col :span="4" class="tleftb">
<el-form-item><span slot="label"><span class="icon">*</span>物料名称</span></el-form-item> <el-form-item><span slot="label"><span class="icon">*</span>物料名称</span></el-form-item>
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item> <!-- prop="mName"--> <el-form-item>
<el-input v-model="formobj.mName" placeholder="请输入物料名称" class="addinputw" readonly/> <el-input v-model="formobj.mName" placeholder="请输入物料名称" class="addinputw" readonly/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -48,10 +38,8 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="warehouse"> <el-form-item prop="warehouse">
<el-select v-model="formobj.warehouse" @change="changeWarehouse" <el-select v-model="formobj.warehouse" @change="changeWarehouse" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in warehouse_list" :key="item.sid" :label="item.warehouseName" :value="item.warehouseName" clearable></el-option>
<el-option v-for="item in warehouse_list" :key="item.sid" :label="item.warehouseName"
:value="item.warehouseName" clearable></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -59,7 +47,7 @@
<el-form-item><span slot="label"><span class="icon">*</span>仓库编码</span></el-form-item> <el-form-item><span slot="label"><span class="icon">*</span>仓库编码</span></el-form-item>
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item> <!--prop="warehouseNo"--> <el-form-item>
<el-input v-model="formobj.warehouseNo" placeholder="请输入仓库编码" class="addinputw" readonly/> <el-input v-model="formobj.warehouseNo" placeholder="请输入仓库编码" class="addinputw" readonly/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -78,12 +66,6 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="availableQuantity"> <el-form-item prop="availableQuantity">
<!-- <el-select v-model="formobj.availableQuantity" @change='changAvailable' class="addinputw" filterable-->
<!-- placeholder="请选择">-->
<!-- <el-option v-for="item in available_list" :key="item.dictKey" :label="item.dictValue"-->
<!-- :value="item.dictKey">-->
<!-- </el-option>-->
<!-- </el-select>-->
<el-input v-model="formobj.availableQuantity" placeholder="请输入可用量" class="addinputw" clearable/> <el-input v-model="formobj.availableQuantity" placeholder="请输入可用量" class="addinputw" clearable/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -93,14 +75,10 @@
<el-form-item><span slot="label"><span class="icon">*</span>库存组织</span></el-form-item> <el-form-item><span slot="label"><span class="icon">*</span>库存组织</span></el-form-item>
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="stockOrgName"> <!----> <el-form-item prop="stockOrgName">
<el-select v-model="formobj.stockOrgName" @change="stockOrgNameChange" <el-select v-model="formobj.stockOrgName" @change="stockOrgNameChange" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in stockOrgName_list" :key="item.sid" :label="item.name" :value="item.name" clearable></el-option>
<el-option v-for="item in stockOrgName_list" :key="item.sid" :label="item.name"
:value="item.name" clearable></el-option>
</el-select> </el-select>
<!-- <el-cascader :key="refreshItem" v-model="stockOrgName_list" @change="stockOrgNameChange"-->
<!-- :options="orgOptions" :props="orgProps" class="addinputw" clearable/>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4" class="tleftb"> <el-col :span="4" class="tleftb">
@ -108,10 +86,8 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="cargoOwnerType"> <el-form-item prop="cargoOwnerType">
<el-select v-model="formobj.cargoOwnerType" @change="changeCargoType" <el-select v-model="formobj.cargoOwnerType" @change="changeCargoType" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in cargoType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
<el-option v-for="item in cargoType_list" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -140,10 +116,8 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="invenState"> <el-form-item prop="invenState">
<el-select v-model="formobj.invenState" @change="changeInvenState" <el-select v-model="formobj.invenState" @change="changeInvenState" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in invenState_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
<el-option v-for="item in invenState_list" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -152,10 +126,8 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <!--basicUnit--> <el-col :span="8" class="trightb"> <!--basicUnit-->
<el-form-item prop="inventoryPrimaryUnit"> <el-form-item prop="inventoryPrimaryUnit">
<el-select v-model="formobj.inventoryPrimaryUnit" @change="changeInventoryPrimary" <el-select v-model="formobj.inventoryPrimaryUnit" @change="changeInventoryPrimary" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in inventoryPrimary_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" clearable></el-option>
<el-option v-for="item in inventoryPrimary_list" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey" clearable></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -166,10 +138,8 @@
</el-col> </el-col>
<el-col :span="8" class="trightb"> <el-col :span="8" class="trightb">
<el-form-item prop="custodianType"> <el-form-item prop="custodianType">
<el-select v-model="formobj.custodianType" @change="changeCustodianType" <el-select v-model="formobj.custodianType" @change="changeCustodianType" placeholder="请选择" class="addinputw" clearable>
placeholder="请选择" class="addinputw" clearable> <el-option v-for="item in custodianType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"></el-option>
<el-option v-for="item in custodianType_list" :key="item.dictKey" :label="item.dictValue"
:value="item.dictKey"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -194,484 +164,378 @@
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<!--End 添加修改部分-->
</div> </div>
</template> </template>
<script> <script>
import req from '@/api/anruiscm/scmrealtimeinventory' import req from '@/api/anruiscm/scmrealtimeinventory'
export default { export default {
name: 'ScmRealTimeInventoryAdd', name: 'ScmRealTimeInventoryAdd',
data() { data() {
return { return {
viewTitle: '', viewTitle: '',
dialogStatus: 'add', dialogStatus: 'add',
//
mnum_list: [], //
cargoType_list: [], //
invenState_list: [],//
custodianType_list: [],//
warehouse_list: [],//
inventoryPrimary_list: [], //
//
stockOrgName_list: [],//
orgArr: [],
refreshItem: 0, // key
orgOptions: [], //
orgProps: { // props
value: 'sid',
label: 'name',
children: 'children',
multiple: true
},
formobj: {
sid: '', //sid
mNum: '', //
mName: '', //
warehouse: '', //
inventoryPrimaryUnit: '', //
inventory: '', //
availableQuantity: '', //
stockOrgName: '', //
stockOrgNameSid: '', //sid
cargoOwnerType: '', //
cargoOwnerNo: '', //
cargoOwner: '', //
invenState: '', //
warehouseNo: '', //
custodianType: '', //
custodianNo: '', //
custodian: '' //
},
rules: {
mNum: [{ required: true, message: '物料编码不能为空', trigger: 'change' }], //
mName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }], //
warehouse: [{ required: true, message: '仓库不能为空', trigger: 'change' }], //
inventoryPrimaryUnit: [{ required: true, message: '库存主单位不能为空', trigger: 'change' }], //
inventory: [{ required: true, message: '库存量(主单位)不能为空', trigger: 'blur' }], //
availableQuantity: [{ required: true, message: '可用量(主单位)不能为空', trigger: 'blur' }], //
stockOrgName: [{ required: true, message: '库存组织不能为空', trigger: 'change' }], //
cargoOwnerType: [{ required: true, message: '货主类型不能为空', trigger: 'change' }], //
cargoOwnerNo: [{ required: true, message: '货主编码不能为空', trigger: 'blur' }], //
cargoOwner: [{ required: true, message: '货主不能为空', trigger: 'blur' }], //
invenState: [{ required: true, message: '库存状态不能为空', trigger: 'change' }], //
warehouseNo: [{ required: true, message: '仓库编码不能为空', trigger: 'blur' }], //
custodianType: [{ required: true, message: '保管者类型不能为空', trigger: 'change' }], //
custodianNo: [{ required: true, message: '保管者编码不能为空', trigger: 'blur' }], //
custodian: [{ required: true, message: '保管者名称不能为空', trigger: 'blur' }] //
},
submitdisabled: false
}
},
created() {
// //
this.getCargoType() // mnum_list: [], //
this.getWarehouse() // cargoType_list: [], //
this.getCustodianType() // invenState_list: [], //
this.getInvenState() // custodianType_list: [], //
this.getInventoryPrimary() // warehouse_list: [], //
this.getWlxx() // inventoryPrimary_list: [], //
// //
// this.getBuMen() stockOrgName_list: [], //
// () orgArr: [],
this.getOrg() refreshItem: 0, // key
}, orgOptions: [], //
methods: { orgProps: { // props
//- value: 'sid',
getWlxx() { label: 'name',
req.getWlxx({}).then(res => { children: 'children',
this.mnum_list = res.data multiple: true
})
},
changeMnum() {
req.getWlxxInfo().then(res => {
var data = res.data
console.log('物料编码详情', data)
for (var i = 0; i < data.length; i++) {
if (data[i].mNum === this.formobj.mNum) {
this.formobj.mName = data[i].mName
}
}
})
},
//- warehouse basicUnit
getWarehouse() {
req.getWarehouse().then((res) => {
if (res.code === '200') {
this.warehouse_list = res.data
}
})
}, },
changeWarehouse(value) { formobj: {
console.log('触发下拉框按钮') sid: '', // sid
let bb = {} mNum: '', //
this.warehouse_list.forEach((e) => { mName: '', //
// eslint-disable-next-line eqeqeq warehouse: '', //
if (e.warehouseName == value) { inventoryPrimaryUnit: '', //
bb = { inventory: '', //
name: e.warehouseName, availableQuantity: '', //
warehouseNo: e.warehouseCode, stockOrgName: '', //
key: e.dictKey, stockOrgNameSid: '', // sid
sid: e.sid cargoOwnerType: '', //
} cargoOwnerNo: '', //
} cargoOwner: '', //
}) invenState: '', //
this.formobj.warehouse = bb.name warehouseNo: '', //
this.formobj.warehouseNo = bb.warehouseNo custodianType: '', //
console.log('name', this.formobj.warehouse, this.formobj.warehouseNo) custodianNo: '', //
custodian: '' //
}, },
rules: {
//- mNum: [{ required: true, message: '物料编码不能为空', trigger: 'change' }], //
getCargoType() { mName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }], //
req.pullDown({ warehouse: [{ required: true, message: '仓库不能为空', trigger: 'change' }], //
type: 'cargoOwnerType' inventoryPrimaryUnit: [{ required: true, message: '库存主单位不能为空', trigger: 'change' }], //
}).then((res) => { inventory: [{ required: true, message: '库存量(主单位)不能为空', trigger: 'blur' }], //
if (res.code === '200') { availableQuantity: [{ required: true, message: '可用量(主单位)不能为空', trigger: 'blur' }], //
this.cargoType_list = res.data stockOrgName: [{ required: true, message: '库存组织不能为空', trigger: 'change' }], //
console.log('下拉框请求111', res.data) cargoOwnerType: [{ required: true, message: '货主类型不能为空', trigger: 'change' }], //
} cargoOwnerNo: [{ required: true, message: '货主编码不能为空', trigger: 'blur' }], //
}) cargoOwner: [{ required: true, message: '货主不能为空', trigger: 'blur' }], //
invenState: [{ required: true, message: '库存状态不能为空', trigger: 'change' }], //
warehouseNo: [{ required: true, message: '仓库编码不能为空', trigger: 'blur' }], //
custodianType: [{ required: true, message: '保管者类型不能为空', trigger: 'change' }], //
custodianNo: [{ required: true, message: '保管者编码不能为空', trigger: 'blur' }], //
custodian: [{ required: true, message: '保管者名称不能为空', trigger: 'blur' }] //
}, },
changeCargoType(value) { submitdisabled: false
console.log('触发下拉框按钮') }
let bb = {} },
this.cargoType_list.forEach((e) => { created() {
// eslint-disable-next-line eqeqeq //
if (e.dictKey == value) { this.getCargoType() //
bb = { this.getWarehouse() //
type: e.dictType, this.getCustodianType() //
name: e.dictValue, this.getInvenState() //
key: e.dictKey, this.getInventoryPrimary() //
sid: e.sid this.getWlxx() //
} // ()
this.getOrg()
},
methods: {
// -
getWlxx() {
req.getWlxx({}).then(res => {
this.mnum_list = res.data
})
},
changeMnum() {
req.getWlxxInfo().then(res => {
var data = res.data
console.log('物料编码详情', data)
for (var i = 0; i < data.length; i++) {
if (data[i].mNum === this.formobj.mNum) {
this.formobj.mName = data[i].mName
} }
}) }
this.formobj.cargoOwnerType = bb.name })
this.formobj.cargoOwnerSid = bb.sid },
console.log('name', this.formobj.cargoOwnerType, this.formobj.cargoOwnerSid)
},
//- // - warehouse basicUnit
getInventoryPrimary() { getWarehouse() {
req.pullDown({ req.getWarehouse().then((res) => {
type: 'basicUnit' if (res.code === '200') {
}).then((res) => { this.warehouse_list = res.data
if (res.code === '200') { }
this.inventoryPrimary_list = res.data })
console.log('下拉框请求111', res.data) },
} changeWarehouse(value) {
}) console.log('触发下拉框按钮')
}, let bb = {}
changeInventoryPrimary(value) { this.warehouse_list.forEach((e) => {
console.log('触发下拉框按钮') if (e.warehouseName === value) {
let bb = {} bb = {
this.inventoryPrimary_list.forEach((e) => { name: e.warehouseName,
// eslint-disable-next-line eqeqeq warehouseNo: e.warehouseCode,
if (e.dictKey == value) { key: e.dictKey,
bb = { sid: e.sid
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
}
})
this.formobj.inventoryPrimaryUnit = bb.name
console.log('name', this.formobj.inventoryPrimaryUnit)
},
//-
getCustodianType() {
req.pullDown({
type: 'custodianType'
}).then((res) => {
if (res.code === '200') {
this.custodianType_list = res.data
console.log('下拉框请求111', res.data)
}
})
},
changeCustodianType(value) {
console.log('触发下拉框按钮')
let bb = {}
this.custodianType_list.forEach((e) => {
// eslint-disable-next-line eqeqeq
if (e.dictKey == value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
}
} }
}) }
this.formobj.custodianType = bb.name })
this.formobj.custodianSid = bb.sid this.formobj.warehouse = bb.name
console.log('name', this.formobj.custodianType, this.formobj.custodianSid) this.formobj.warehouseNo = bb.warehouseNo
}, console.log('name', this.formobj.warehouse, this.formobj.warehouseNo)
},
//- changeInvenState // -
getInvenState() { getCargoType() {
req.pullDown({ req.pullDown({
type: 'invenState' type: 'cargoOwnerType'
}).then((res) => { }).then((res) => {
if (res.code === '200') { if (res.code === '200') {
this.invenState_list = res.data this.cargoType_list = res.data
console.log('下拉框请求111', res.data) console.log('下拉框请求111', res.data)
} }
}) })
}, },
changeInvenState(value) { changeCargoType(value) {
console.log('触发下拉框按钮') console.log('触发下拉框按钮')
let bb = {} let bb = {}
this.invenState_list.forEach((e) => { this.cargoType_list.forEach((e) => {
// eslint-disable-next-line eqeqeq if (e.dictKey === value) {
if (e.dictKey == value) { bb = {
bb = { type: e.dictType,
type: e.dictType, name: e.dictValue,
name: e.dictValue, key: e.dictKey,
key: e.dictKey, sid: e.sid
sid: e.sid
}
} }
}) }
this.formobj.invenState = bb.name })
this.formobj.invenStateSid = bb.sid this.formobj.cargoOwnerType = bb.name
console.log('name', this.formobj.invenState, this.formobj.invenStateSid) this.formobj.cargoOwnerSid = bb.sid
}, console.log('name', this.formobj.cargoOwnerType, this.formobj.cargoOwnerSid)
},
//-
// 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
// }
// })
// },
// ()
getOrg() {
req.getOrg().then((res) => {
if (res.code === '200') {
this.stockOrgName_list = res.data
// -
getInventoryPrimary() {
req.pullDown({
type: 'basicUnit'
}).then((res) => {
if (res.code === '200') {
this.inventoryPrimary_list = res.data
console.log('下拉框请求111', res.data)
}
})
},
changeInventoryPrimary(value) {
console.log('触发下拉框按钮')
let bb = {}
this.inventoryPrimary_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
} }
}) }
}, })
stockOrgNameChange(value) { this.formobj.inventoryPrimaryUnit = bb.name
console.log('触发下拉框按钮',value) console.log('name', this.formobj.inventoryPrimaryUnit)
let bb = {} },
this.stockOrgName_list.forEach((e) => { // -
// eslint-disable-next-line eqeqeq getCustodianType() {
if (e.name == value) { req.pullDown({
bb = { type: 'custodianType'
name: e.name, }).then((res) => {
key: e.id, if (res.code === '200') {
sid: e.sid this.custodianType_list = res.data
} console.log('下拉框请求111', res.data)
}
})
},
changeCustodianType(value) {
console.log('触发下拉框按钮')
let bb = {}
this.custodianType_list.forEach((e) => {
if (e.dictKey === value) {
bb = {
type: e.dictType,
name: e.dictValue,
key: e.dictKey,
sid: e.sid
} }
}) }
this.formobj.stockOrgName = bb.name })
this.formobj.stockOrgNameSid = bb.sid this.formobj.custodianType = bb.name
console.log('name', this.formobj.stockOrgName, this.formobj.stockOrgNameSid) this.formobj.custodianSid = bb.sid
}, console.log('name', this.formobj.custodianType, this.formobj.custodianSid)
},
// org0(data) { // - changeInvenState
// data.forEach((e) => { getInvenState() {
// if (e.children.length != 0) { req.pullDown({
// this.org0(e.children) type: 'invenState'
// } else { }).then((res) => {
// delete e.children if (res.code === '200') {
// this.orgArr.push(e) this.invenState_list = res.data
// return console.log('下拉框请求111', res.data)
// } }
// }) })
// }, },
// // changeInvenState(value) {
// stockOrgNameChange(e) { console.log('触发下拉框按钮')
// console.log('' + JSON.stringify(e)) let bb = {}
// var result = '' this.invenState_list.forEach((e) => {
// var result_Sid = '' if (e.dictKey === value) {
// if (e.length > 0) { bb = {
// // type: e.dictType,
// e.forEach((item) => { name: e.dictValue,
// var last_id = item[item.length - 1] key: e.dictKey,
// // sid: e.sid
// this.select_temp_Name = '' // ()
// this.select_temp_Sid = '' //(Sid)
// this.gainOrgId(last_id, this.options)
// result = result + this.select_temp_Name + ','
// result_Sid = result_Sid + this.select_temp_Sid + ','
// })
// }
// if (result !== '') {
// result = result.substring(0, result.length - 1)
// }
// if (result_Sid !== '') {
// result_Sid = result_Sid.substring(0, result_Sid.length - 1)
// }
// this.formobj.stockOrgName = result
// this.formobj.stockOrgNameSid = result_Sid
// console.log('' + this.formobj.stockOrgName, this.formobj.stockOrgNameSid)
// },
// // ---
// gainOrgId(id, orgOptions) {
// for (var i = 0; i < orgOptions.length; i++) {
// if (orgOptions[i].sid) {
// this.select_temp_Name = orgOptions[i].name //
// this.select_temp_Sid = orgOptions[i].sid
// return true
// } else {
// //
// if (orgOptions[i].children !== undefined) {
// //
// if (this.gainOrgId(id, orgOptions[i].children)) {
// return true
// }
// }
// }
// }
// },
//
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.formobj = {}
this.stockOrgName_list = []
this.$refs['form_obj'].resetFields()
this.$emit('doback')
},
showAdd() {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.dialogStatus = 'add'
this.viewTitle = '【新增】即时库存表'
},
showEdit(sid) {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.dialogStatus = 'edit'
this.viewTitle = '【编辑】即时库存表'
const _this = this
req.fetchBySid(sid).then(resp => {
console.log('编辑回显', resp)
const data = resp.data
this.formobj.sid = sid
this.formobj = data
this.stockOrgName_list = data.stockOrgNameSid //
console.log('======+++======', this.stockOrgName_list)
})
.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 result_Sid = ''
if (this.stockOrgName_list.length > 0) {
this.stockOrgName_list.forEach((item) => {
var last_id = item[item.length - 1]
this.select_temp_Sid = '' //(Sid)
this.findOrgId(last_id, this.options)
result_Sid = result_Sid + this.select_temp_Sid + ','
})
} }
if (result_Sid !== '') { })
result_Sid = result_Sid.substring(0, result_Sid.length - 1) this.formobj.invenState = bb.name
this.formobj.invenStateSid = bb.sid
console.log('name', this.formobj.invenState, this.formobj.invenStateSid)
},
// ()
getOrg() {
req.getOrg().then((res) => {
if (res.code === '200') {
this.stockOrgName_list = res.data
}
})
},
stockOrgNameChange(value) {
console.log('触发下拉框按钮', value)
let bb = {}
this.stockOrgName_list.forEach((e) => {
if (e.name === value) {
bb = {
name: e.name,
key: e.id,
sid: e.sid
}
} }
this.formobj.stockOrgNameSid = result_Sid })
console.log('重新赋值后的组织结构', this.formobj.stockOrgNameSid) this.formobj.stockOrgName = bb.name
//End this.formobj.stockOrgNameSid = bb.sid
this.$refs['form_obj'].validate(valid => { console.log('name', this.formobj.stockOrgName, this.formobj.stockOrgNameSid)
if (valid) { },
this.submitdisabled = true //
req.saveEdit(this.formobj, this.formobj.sid).then(resp => { handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.formobj = {}
this.stockOrgName_list = []
this.$refs['form_obj'].resetFields()
this.$emit('doback')
},
showAdd() {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.dialogStatus = 'add'
this.viewTitle = '【新增】即时库存表'
},
showEdit(sid) {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.dialogStatus = 'edit'
this.viewTitle = '【编辑】即时库存表'
req.fetchBySid(sid).then(resp => {
console.log('编辑回显', resp)
const data = resp.data
this.formobj.sid = sid
this.formobj = data
console.log('======+++======', this.stockOrgName_list)
})
.catch(e => {
this.formobj = {}
})
},
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.submitdisabled = false
_this.$message({ showClose: true, type: 'success', message: resp.msg }) _this.$message({ showClose: true, type: 'success', message: resp.msg })
_this.handleReturn('true') _this.handleReturn('true')
}).catch(() => { })
.catch(() => {
this.submitdisabled = false this.submitdisabled = false
}) })
} else { } else {
return false return false
} }
}) })
} },
saveEdit() {
const _this = this
console.log('重新赋值后的组织结构', this.formobj.stockOrgNameSid)
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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.headInfo { .headInfo {
margin-left: -14px; margin-left: -14px;
margin-right: -14px; margin-right: -14px;
} }
.wlInfo { .wlInfo {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 60px 0; padding: 60px 0;
font-size: 24px; font-size: 24px;
border-width: 0 0 1px 0; border-width: 0 0 1px 0;
border-style: solid; border-style: solid;
border-color: #EDF1F7; border-color: #EDF1F7;
font-weight: bold; font-weight: bold;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.formadd { .formadd {
padding: 0px; padding: 0px;
} }
.tleftb { .tleftb {
text-align: right; text-align: right;
} }
.tab-headerg { .tab-headerg {
height: 35px; height: 35px;
background-color: #EDF1F7; background-color: #EDF1F7;
padding: 20px 20px; padding: 20px 20px;
} }
.icon { .icon {
color: #e84026; color: #e84026;
margin-right: 4px; margin-right: 4px;
} }
</style> </style>

Loading…
Cancel
Save