lion 3 years ago
parent d192e73b23
commit ad5a85c6fd

@ -5,12 +5,13 @@
<lx-header icon="md-apps" text="库存管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px"> <lx-header icon="md-apps" text="库存管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot> <slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;"> <div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<!-- <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" /> <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<Button type="primary" @click="getActivities"></Button> --> <Button type="primary" @click="getindex"></Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;" <!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add'">添加</Button> --> @click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add'">添加</Button> -->
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;" <Button type="primary" style="margin-left: 10px;"
@click="$refs['imports'].show()">导入</Button> --> @click="exportExcel(new Date().getTime().toString())">导出</Button>
</div> </div>
</slot> </slot>
@ -59,7 +60,9 @@
} from 'element-ui' } from 'element-ui'
import imports from "@/views/component/imports.vue" import imports from "@/views/component/imports.vue"
import { index as fieldIndex } from "@/api/system/customFormField"; import { index as fieldIndex } from "@/api/system/customFormField";
import { getparameter } from "@/api/system/dictionary"; import { getparameter } from "@/api/system/dictionary";
import * as XLSX from "xlsx";
import { saveAs } from "file-saver";
export default { export default {
components: { components: {
imports imports
@ -69,7 +72,8 @@
select: { select: {
pageSize: 10, pageSize: 10,
pageIndex: 1, pageIndex: 1,
keyword: "" keyword: "",
is_export:0
}, },
showcode:false, showcode:false,
customForm: { customForm: {
@ -153,6 +157,24 @@
} }
}, },
methods: { methods: {
async exportExcel(sheetName) {
const res = await index(Object.assign(this.select,{ page: 1,page_size: 9999,table_name: 'inventorys'}))
if(res.data){
let headers = this.form.map(i => {
return {
key: i.field,
title: i.name
}
})
const data = res.data.map(row => headers.map(header => row[header.key]));
data.unshift(headers.map(header => header.title));
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, sheetName);
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${sheetName}.xlsx`);
}
},
showCode(e,row){ showCode(e,row){
console.log(e,row) console.log(e,row)
this.showcode = true this.showcode = true
@ -175,10 +197,11 @@
}, },
async getindex() { async getindex() {
const res = await index({ const res = await index({
rows: this.select.pageSize, page_size: this.select.pageSize,
page: this.select.pageIndex, page: this.select.pageIndex,
table_name: 'inventorys', table_name: 'inventorys',
keyword: this.select.keyword // is_export:this.select.is_export,
filter:[{"key":"zichanmingcheng","op":"like","value":this.select.keyword}],
}) })
this.list = res.data this.list = res.data
this.total = res.total this.total = res.total

@ -4,7 +4,7 @@
<template v-slot:chukushijian> <template v-slot:chukushijian>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>出库时间 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>出库时间
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-date-picker <el-date-picker
@ -20,7 +20,7 @@
<template v-slot:chukuleixing> <template v-slot:chukuleixing>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>出库类型 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>出库类型
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-select v-model="form.chukuleixing" style="width: 300px;" placeholder="请选择"> <el-select v-model="form.chukuleixing" style="width: 300px;" placeholder="请选择">
@ -64,7 +64,7 @@
<template v-slot:jieyongren> <template v-slot:jieyongren>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>借用人 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>借用人
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.jieyongren" placeholder="请填写借用人" clearable style="width: 300px;"></el-input> <el-input v-model="form.jieyongren" placeholder="请填写借用人" clearable style="width: 300px;"></el-input>
@ -75,7 +75,7 @@
<template v-slot:jilurenyuan> <template v-slot:jilurenyuan>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>记录人员 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>记录人员
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.jilurenyuan" placeholder="请输入记录人员" clearable style="width: 300px;"></el-input> <el-input v-model="form.jilurenyuan" placeholder="请输入记录人员" clearable style="width: 300px;"></el-input>
@ -121,7 +121,7 @@
</xy-dialog> </xy-dialog>
<!-- 新增明细 --> <!-- 新增明细 -->
<Modal v-model="isShowMingxi" width='650' title="新增明细" @on-cancel='mingxiCancel' @on-ok="mingxiConfirm"> <Modal v-model="isShowMingxi" width='650' title="新增明细" :loading='showLoading' @on-cancel='mingxiCancel' @on-ok="mingxiConfirm">
<div class="mingxiwrap"> <div class="mingxiwrap">
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
@ -152,10 +152,10 @@
</div> </div>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>批次 <span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库批次
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input type="text" v-model="mingxiObj.pici" placeholder="请选择批次" disabled <el-input type="text" v-model="mingxiObj.rukupici" placeholder="请选择入库批次" disabled
style="width: 300px;"></el-input> style="width: 300px;"></el-input>
</div> </div>
</div> </div>
@ -173,7 +173,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>借用/报废数量 <span style="color: red;font-weight: 600;padding-right: 4px;"></span>借用/报废数量
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input type="text" @blur='jieyong' v-model="mingxiObj.jieyongshuliang" placeholder="请选择借用/报废数量" <el-input type="text" @blur='jieyong' v-model="mingxiObj.jieyongshuliang" placeholder="请填写借用/报废数量"
style="width: 300px;"></el-input> style="width: 300px;"></el-input>
</div> </div>
</div> </div>
@ -270,6 +270,22 @@ export default {
chukumingxi:'' chukumingxi:''
}, },
rules:{ rules:{
chukushijian: [{
required: true,
message: '请选择出库时间'
}],
chukuleixing: [{
required: true,
message: '请选择出库类型'
}],
jieyongren: [{
required: true,
message: '请填写借用人'
}],
jilurenyuan: [{
required: true,
message: '请选择记录人员'
}],
}, },
isShowMingxi:false, isShowMingxi:false,
mingxiObj:{ mingxiObj:{
@ -277,6 +293,7 @@ export default {
}, },
mingxiObjBefore:{}, mingxiObjBefore:{},
mingxiList: [], mingxiList: [],
showLoading:true,
mingxiIndex:'', mingxiIndex:'',
mingxiTable: [ mingxiTable: [
{ {
@ -297,8 +314,8 @@ export default {
prop: "jiliangdanwei", prop: "jiliangdanwei",
width: 200 width: 200
},{ },{
label: "批次", label: "入库批次",
prop: "pici", prop: "rukupici",
width: 200 width: 200
},,{ },,{
label: "在库数量", label: "在库数量",
@ -323,6 +340,29 @@ export default {
wuziPageIndex:1, wuziPageIndex:1,
wuziTotal:0, wuziTotal:0,
wuziColumns:[ wuziColumns:[
{
width: 60,
_isChecked: false,
key: "isSelect",
resizable: true,
render: (h, params) => {
return h('div', [
h('Radio', {
props: {
value: params.row.isSelect
},
on: {
'on-change': (e) => {
this.showList.forEach((items) => {
this.$set(items, 'isSelect', false)
});
this.showList[params.index].isSelect = e;
}
}
})
])
}
},
{ {
title:'名称', title:'名称',
key:'names', key:'names',
@ -348,7 +388,6 @@ export default {
} }
}, },
mingxiConfirm(){ mingxiConfirm(){
if(this.mingxiIndex!=''){ if(this.mingxiIndex!=''){
// //
@ -393,15 +432,22 @@ export default {
}) })
for(var m of res.data){ for(var m of res.data){
m.names = m.wuzibianma+"--"+m.zichanmingcheng m.names = m.wuzibianma+"--"+m.zichanmingcheng
m.isSelect = false
} }
this.wuziList = res.data this.wuziList = res.data
this.wuziTotal = res.total this.wuziTotal = res.total
}, },
wuziSelect(e){ wuziSelect(e){
this.wuziList.forEach((items) => {
this.$set(items, 'isSelect', false)
if(items.id==e.id){
this.$set(items, 'isSelect', true)
}
});
this.mingxiObj.wuzibianma = e.wuzibianma this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.pici = e.pici this.mingxiObj.rukupici = e.rukupici
this.mingxiObj.zaikushuliang = e.zaikushuliang this.mingxiObj.zaikushuliang = e.zaikushuliang
this.mingxiObj.jiliangdanwei = e.jiliangdanwei this.mingxiObj.jiliangdanwei = e.jiliangdanwei
this.mingxiObj.inventorys_id = e.id this.mingxiObj.inventorys_id = e.id

@ -5,8 +5,8 @@
<lx-header icon="md-apps" text="出库管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px"> <lx-header icon="md-apps" text="出库管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot> <slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;"> <div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<!-- <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" /> <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="借用人搜索" />
<Button type="primary" @click="getActivities"></Button> --> <Button type="primary" @click="getindex"></Button>
<Button icon="ios-add" type="primary" style="margin-left: 10px;" <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['addoutbounds'].isShow = true,$refs['addoutbounds'].type = 'add'">添加</Button> @click="$refs['addoutbounds'].isShow = true,$refs['addoutbounds'].type = 'add'">添加</Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;" <!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@ -122,10 +122,10 @@
methods: { methods: {
async getindex() { async getindex() {
const res = await index({ const res = await index({
rows: this.select.pageSize, page_size: this.select.pageSize,
page: this.select.pageIndex, page: this.select.pageIndex,
table_name: 'outbounds', table_name: 'outbounds',
keyword: this.select.keyword filter:[{"key":"jieyongren","op":"like","value":this.select.keyword}],
}) })
this.list = res.data this.list = res.data
this.total = res.total this.total = res.total

@ -5,58 +5,47 @@
<template v-slot:rukushijian> <template v-slot:rukushijian>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库时间 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>入库时间
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-date-picker <el-date-picker style="width: 300px;" v-model="form.rukushijian" type="date" placeholder="选择日期"
style="width: 300px;" value-format="yyyy-MM-dd">
v-model="form.rukushijian" </el-date-picker>
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd">
</el-date-picker>
</div> </div>
</div> </div>
</template> </template>
<template v-slot:rukuleixing> <template v-slot:rukuleixing>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库类型 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>入库类型
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-select v-model="form.rukuleixing" style="width: 300px;" placeholder="请选择"> <el-select v-model="form.rukuleixing" style="width: 300px;" placeholder="请选择">
<el-option <el-option v-for="item in lexingoptions" :key="item.value" :label="item.label" :value="item.value">
v-for="item in lexingoptions" </el-option>
:key="item.value" </el-select>
:label="item.label" </div>
:value="item.value"> </div>
</el-option> </template>
</el-select> <template v-slot:rukucangku>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库仓库
</div>
<div class="xy-table-item-content">
<el-select v-model="form.rukucangku" filterable style="width: 300px;" placeholder="请选择入库仓库">
<el-option v-for="item in cangkuList" :key="item.cangkumingcheng" :label="item.cangkumingcheng"
:value="item.cangkumingcheng">
</el-option>
</el-select>
</div> </div>
</div> </div>
</template>
<template v-slot:rukucangku>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库仓库
</div>
<div class="xy-table-item-content">
<el-select v-model="form.rukucangku" filterable style="width: 300px;" placeholder="请选择入库仓库">
<el-option
v-for="item in cangkuList"
:key="item.cangkumingcheng"
:label="item.cangkumingcheng"
:value="item.cangkumingcheng">
</el-option>
</el-select>
</div>
</div>
</template> </template>
<template v-slot:jingbanren> <template v-slot:jingbanren>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>经办人 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>经办人
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.jingbanren" placeholder="请输入经办人" clearable style="width: 300px;"></el-input> <el-input v-model="form.jingbanren" placeholder="请输入经办人" clearable style="width: 300px;"></el-input>
@ -66,7 +55,7 @@
<template v-slot:jilurenyuan> <template v-slot:jilurenyuan>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>记录人员 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>记录人员
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.jilurenyuan" placeholder="请输入记录人员" clearable style="width: 300px;"></el-input> <el-input v-model="form.jilurenyuan" placeholder="请输入记录人员" clearable style="width: 300px;"></el-input>
@ -102,12 +91,12 @@
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<Button v-if="form.rukuleixing!=''" type="primary" icon="md-add" style="margin-bottom: 10px" <Button v-if="form.rukuleixing!=''" type="primary" icon="md-add" style="margin-bottom: 10px"
@click="isShowMingxi=true">新增入库明细</Button> @click="isShowMingxi=true">新增入库明细</Button>
<Button v-if="form.rukuleixing==''" type="primary" icon="md-add" style="margin-bottom: 10px" <Button v-if="form.rukuleixing==''" type="primary" icon="md-add" style="margin-bottom: 10px"
@click="isShowMingxi=true">新增回库明细</Button> @click="isShowMingxi=true">新增回库明细</Button>
<xy-table style="width: 620px" :height="260" :is-page="false" :list="mingxiList" :table-item="mingxiTable"> <xy-table style="width: 620px" :height="260" :is-page="false" :list="mingxiList" :table-item="mingxiTable">
<template v-slot:btns> <template v-slot:btns>
<el-table-column label="操作" width="90" header-align="center" align="center"> <el-table-column label="操作" width="90" header-align="center" align="center">
<template v-slot:default="scope"> <template v-slot:default="scope">
<!-- <Button size="small" type="primary" ghost @click="editMingxi(scope.$index)"></Button> --> <!-- <Button size="small" type="primary" ghost @click="editMingxi(scope.$index)"></Button> -->
<Button size="small" type="primary" ghost @click="mingxiList.splice(scope.$index, 1)">删除</Button> <Button size="small" type="primary" ghost @click="mingxiList.splice(scope.$index, 1)">删除</Button>
</template> </template>
@ -121,93 +110,102 @@
</xy-dialog> </xy-dialog>
<!-- 新增明细 --> <!-- 新增明细 -->
<Modal v-model="isShowMingxi" width='650' title="新增明细" @on-cancel='mingxiCancel' @on-ok="mingxiConfirm"> <Modal v-model="isShowMingxi" width='650' title="新增明细" :loading='showLoading' @on-cancel='mingxiCancel'
<div class="mingxiwrap"> @on-ok="mingxiConfirm">
<div class="xy-table-item"> <div class="mingxiwrap">
<div class="xy-table-item-label"> <div class="xy-table-item">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>物资编码 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>物资编码
<div class="xy-table-item-content" style="display: flex;align-items: center;"> </div>
<el-input v-if="form.rukuleixing!=''" type="text" @focus="showWuzi" v-model="mingxiObj.wuzibianma" placeholder="请选择物资编码" <div class="xy-table-item-content" style="display: flex;align-items: center;">
style="width: 300px;"></el-input> <el-input v-if="form.rukuleixing!=''" type="text" @focus="showWuzi" v-model="mingxiObj.wuzibianma"
<el-input v-if="form.rukuleixing==''" @change='getKucunShow' ref='huikubianma' type="text" v-model="mingxiObj.wuzibianma" placeholder="请扫码获取回库物资编码" placeholder="请选择物资编码" style="width: 300px;"></el-input>
style="width: 300px;"></el-input> <el-input v-if="form.rukuleixing==''" @change='getKucunShow' ref='huikubianma' type="text"
<Button @click='showWuzi("回库")' v-if="form.rukuleixing==''" type="primary" icon="md-add" style="margin-left: 10px" v-model="mingxiObj.wuzibianma" placeholder="请扫码获取回库物资编码" style="width: 300px;"></el-input>
>选择</Button> <Button @click='showWuzi("回库")' v-if="form.rukuleixing==''" type="primary" icon="md-add"
</div> style="margin-left: 10px">选择</Button>
</div> </div>
<div class="xy-table-item"> </div>
<div class="xy-table-item-label"> <div class="xy-table-item">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>资产名称 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>资产名称
<div class="xy-table-item-content"> </div>
<el-input type="text" @focus="showWuzi" v-model="mingxiObj.zichanmingcheng" placeholder="请选择资产名称" disabled <div class="xy-table-item-content">
style="width: 300px;"></el-input> <el-input type="text" @focus="showWuzi" v-model="mingxiObj.zichanmingcheng" placeholder="请选择资产名称" disabled
</div> style="width: 300px;"></el-input>
</div> </div>
<div class="xy-table-item"> </div>
<div class="xy-table-item-label"> <div class="xy-table-item">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>物资类型 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>物资类型
<div class="xy-table-item-content"> </div>
<el-input type="text" v-model="mingxiObj.wuzileixing" placeholder="请选择物资类型" disabled <div class="xy-table-item-content">
style="width: 300px;"></el-input> <el-input type="text" v-model="mingxiObj.wuzileixing" placeholder="请选择物资类型" disabled
</div> style="width: 300px;"></el-input>
</div> </div>
<div class="xy-table-item"> </div>
<div class="xy-table-item-label"> <div class="xy-table-item">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>计量单位 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>计量单位
<div class="xy-table-item-content"> </div>
<el-input type="text" v-model="mingxiObj.jiliangdanwei" placeholder="请选择计量单位" disabled <div class="xy-table-item-content">
style="width: 300px;"></el-input> <el-input type="text" v-model="mingxiObj.jiliangdanwei" placeholder="请选择计量单位" disabled
</div> style="width: 300px;"></el-input>
</div> </div>
<div class="xy-table-item" v-if="mingxiObj.wuzileixing=='一类一码'"> </div>
<div class="xy-table-item-label"> <div class="xy-table-item" v-if="form.rukuleixing=='回库'">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>批次 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>在库数量
<div class="xy-table-item-content"> </div>
<el-input type="text" v-model="mingxiObj.pici" placeholder="请选择或新增批次" <div class="xy-table-item-content">
style="width: 300px;"></el-input> <el-input type="text" v-model="mingxiObj.zaikushuliang" placeholder="请选择计量单位" disabled
</div> style="width: 300px;"></el-input>
</div> </div>
<!-- <div class="xy-table-item" v-if="!mingxiObj.wuzileixing=='一类一码'"> </div>
<div class="xy-table-item-label"> <div class="xy-table-item" v-if="mingxiObj.wuzileixing=='一类一码'">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>批次 <div class="xy-table-item-label">
</div> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库批次
<div class="xy-table-item-content"> </div>
<el-input type="text" v-model="mingxiObj.pici" placeholder="无" disabled <div class="xy-table-item-content">
style="width: 300px;"></el-input> <el-input type="text" v-model="mingxiObj.rukupici" placeholder="请输入入库批次" style="width: 300px;"></el-input>
</div> </div>
</div> --> </div>
<!-- <div class="xy-table-item" v-if="!mingxiObj.wuzileixing=='一类一码'">
<div class="xy-table-item"> <div class="xy-table-item-label">
<div class="xy-table-item-label"> <span style="color: red;font-weight: 600;padding-right: 4px;"></span>批次
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库数量 </div>
</div> <div class="xy-table-item-content">
<div class="xy-table-item-content"> <el-input type="text" v-model="mingxiObj.pici" placeholder="无" disabled
<el-input type="text" v-model="mingxiObj.rukushuliang" placeholder="请填写入库数量" style="width: 300px;"></el-input>
style="width: 300px;"></el-input> </div>
</div> </div> -->
</div>
<div class="xy-table-item">
</div> <div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>入库数量
</div>
<div class="xy-table-item-content">
<el-input type="text" v-model="mingxiObj.rukushuliang" placeholder="请填写入库数量"
style="width: 300px;"></el-input>
</div>
</div>
</div>
</Modal> </Modal>
<!-- 选择物资编号 --> <!-- 选择物资编号 -->
<Modal v-model="isShowWuzi" title="物资选择"> <Modal v-model="isShowWuzi" title="物资选择">
<div class="searchCompanys"> <div class="searchCompanys">
<el-input type="text" @keyup.enter.native="getList" v-model="keyword" placeholder="请输入关键词查找"></el-input> <el-input type="text" @keyup.enter.native="getList" v-model="keyword" placeholder="请输入关键词查找"></el-input>
<el-button type="primary" @click="getList"></el-button> <el-button type="primary" @click="getList"></el-button>
</div> </div>
<Table highlight-row ref="currentRowTable" :columns="wuziColumns" :data="showList" <Table highlight-row ref="currentRowTable" :columns="wuziColumns" :data="showList"
@on-current-change="wuziSelect" /> @on-current-change="wuziSelect" />
<Page :current="wuziPageIndex" :total="showTotal" simple <Page :current="wuziPageIndex" :total="showTotal" simple
style="padding-top: 14px;display: flex;justify-content: center;" @on-change="wuziPageChange" /> style="padding-top: 14px;display: flex;justify-content: center;" @on-change="wuziPageChange" />
</Modal> </Modal>
</div> </div>
@ -221,7 +219,7 @@
} from "@/api/system/baseForm.js" } from "@/api/system/baseForm.js"
import { import {
Message Message
} from 'element-ui' } from 'element-ui'
import isEqual from '@/utils/index.js' import isEqual from '@/utils/index.js'
export default { export default {
@ -230,221 +228,311 @@
isShow: false, isShow: false,
type: 'add', type: 'add',
id: '', id: '',
tableName: 'stocks', tableName: 'stocks',
cangkuList:[], cangkuList: [],
lexingoptions:[{ lexingoptions: [{
label:'盘点', label: '盘点',
value:'盘点' value: '盘点'
},{ }, {
label:'采购', label: '采购',
value:'采购' value: '采购'
},{ }, {
label:'回库', label: '回库',
value:'回库' value: '回库'
}], }],
form: { form: {
rukushijian: '', rukushijian: '',
rukuleixing: '', rukuleixing: '',
rukucangku:'', rukucangku: '',
jingbanren: "", jingbanren: "",
jilurenyuan: '', jilurenyuan: '',
baoguanrenyuan: '', baoguanrenyuan: '',
beizhu: '', beizhu: '',
rukumingxi: '' rukumingxi: ''
}, },
rules: {}, rules: {
isShowMingxi:false, rukushijian: [{
mingxiObj:{ required: true,
message: '请选择入库时间'
}, }],
mingxiObjBefore:{}, rukushijian: [{
mingxiList: [], required: true,
mingxiIndex:'', message: '请选择入库类型'
}],
jingbanren: [{
required: true,
message: '请填写经办人'
}],
jilurenyuan: [{
required: true,
message: '请填写记录人员'
}]
},
isShowMingxi: false,
showLoading: true,
mingxiObj: {
},
mingxiObjBefore: {},
mingxiList: [],
mingxiIndex: '',
mingxiTable: [{ mingxiTable: [{
label: "物资编码", label: "物资编码",
prop: "wuzibianma", prop: "wuzibianma",
width: 200 width: 200
}, },
{ {
label: "资产名称", label: "资产名称",
prop: "zichanmingcheng", prop: "zichanmingcheng",
width: 200, width: 200,
}, },
{ {
label: "物资类型", label: "物资类型",
prop: "wuzileixing", prop: "wuzileixing",
width: 200 width: 200
}, },
{ {
label: "入库数量", label: "入库数量",
prop: "rukushuliang", prop: "rukushuliang",
width: 200 width: 200
}, { }, {
label: "批次", label: "入库批次",
prop: "pici", prop: "rukupici",
width: 200 width: 200
} }, {
label: "在库数量",
prop: "zaikushuliang",
width: 200
},
], ],
// //
isShowWuzi: false, isShowWuzi: false,
wuziList: [], wuziList: [],
kucunList:[], kucunList: [],
showList:[], showList: [],
wuziPageIndex: 1, wuziPageIndex: 1,
keyword:'', keyword: '',
showTotal:0, showTotal: 0,
wuziTotal: 0, wuziTotal: 0,
kucunTotal:0, kucunTotal: 0,
wuziColumns: [{ wuziColumns: [{
width: 60,
_isChecked: false,
key: "isSelect",
resizable: true,
render: (h, params) => {
return h('div', [
h('Radio', {
props: {
value: params.row.isSelect
},
on: {
'on-change': (e) => {
this.showList.forEach((items) => {
this.$set(items, 'isSelect', false)
});
this.showList[params.index].isSelect = e;
}
}
})
])
}
}, {
title: '名称', title: '名称',
key: 'names', key: 'names',
}] }]
} }
}, },
created() { created() {
this.getCangku() this.getCangku()
// this.getWuzi() // this.getWuzi()
// this.getKucun() // this.getKucun()
}, },
methods: { methods: {
mingxiConfirm(){ mingxiConfirm() {
setTimeout(() => {
if(this.mingxiIndex!=''){ this.showLoading = false
this.$nextTick(() => {
// this.showLoading = true
// let isTrue = this.isEqual(this.mingxiObjBefore,this.mingxiObj) })
// if(this.type=='editor'&&!isTrue){ }, 500)
// this.submitMingxi(this.mingxiObj)
// } if (this.mingxiObj.rukushuliang > this.mingxiObj.zaikushuliang) {
this.mingxiList[this.mingxiIndex-1]=this.mingxiObj Message({
}else{ type: 'warning',
this.mingxiList.push(this.mingxiObj) message: '请填写正确的入库数量'
} })
this.mingxiObj = {} this.showLoading = false
this.mingxiObjBefore = {} return
this.mingxiIndex = '' }
this.isShowMingxi = false console.log("123")
this.showList = [] if (this.mingxiIndex != '') {
this.showTotal = 0
this.wuziPageIndex = 1 //
}, // let isTrue = this.isEqual(this.mingxiObjBefore,this.mingxiObj)
mingxiCancel(){ // if(this.type=='editor'&&!isTrue){
this.mingxiObj = {} // this.submitMingxi(this.mingxiObj)
this.mingxiObjBefore = {} // }
this.mingxiIndex = '' this.mingxiList[this.mingxiIndex - 1] = this.mingxiObj
this.isShowMingxi = false } else {
this.showList = [] this.mingxiList.push(this.mingxiObj)
this.showTotal = 0 }
this.wuziPageIndex = 1 this.mingxiObj = {}
}, this.mingxiObjBefore = {}
editMingxi(index){ this.mingxiIndex = ''
const before = this.mingxiList[index] this.isShowMingxi = false
for(var m in this.mingxiList[index]){ this.showLoading = false
this.mingxiObjBefore[m] = this.mingxiList[index][m] this.showList = []
} this.showTotal = 0
this.mingxiObj = this.mingxiList[index] this.wuziPageIndex = 1
this.mingxiIndex = index+1 // 0=false },
this.isShowMingxi = true mingxiCancel() {
this.mingxiObj = {}
this.mingxiObjBefore = {}
this.mingxiIndex = ''
this.isShowMingxi = false
this.showList = []
this.showTotal = 0
this.wuziPageIndex = 1
},
editMingxi(index) {
const before = this.mingxiList[index]
for (var m in this.mingxiList[index]) {
this.mingxiObjBefore[m] = this.mingxiList[index][m]
}
this.mingxiObj = this.mingxiList[index]
this.mingxiIndex = index + 1 // 0=false
this.isShowMingxi = true
}, },
showWuzi(type) { showWuzi(type) {
if(this.form.rukuleixing==''){ if (this.form.rukuleixing == '') {
Message({ Message({
type: 'warning', type: 'warning',
message: '请先选择入库类型' message: '请先选择入库类型'
}) })
return return
} }
this.isShowWuzi = true this.isShowWuzi = true
if(type=='回库'){ if (type == '回库') {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.huikubianma.focus() this.$refs.huikubianma.focus()
}) })
this.getKucun() this.getKucun()
// this.showList = this.kucunList // this.showList = this.kucunList
// this.showTotal = this.kucunTotal // this.showTotal = this.kucunTotal
}else{ } else {
this.getWuzi() this.getWuzi()
// this.showList = this.wuziList // this.showList = this.wuziList
// this.showTotal = this.wuziTotal // this.showTotal = this.wuziTotal
} }
}, },
getList(){ getList() {
if(this.form.rukuleixing=='回库'){ if (this.form.rukuleixing == '回库') {
this.getKucun() this.getKucun()
// this.showList = this.kucunList // this.showList = this.kucunList
// this.showTotal = this.kucunTotal // this.showTotal = this.kucunTotal
}else{ } else {
this.getWuzi() this.getWuzi()
// this.showList = this.wuziList // this.showList = this.wuziList
// this.showTotal = this.wuziTotal // this.showTotal = this.wuziTotal
} }
}, },
async getWuzi() { async getWuzi() {
let res = await index({ let res = await index({
page_size: 10, page_size: 10,
page: this.wuziPageIndex, page: this.wuziPageIndex,
table_name: 'material_infos', table_name: 'material_infos',
filter:[{"key":"zichanmingcheng","op":"like","value":this.keyword}] filter: [{
"key": "zichanmingcheng",
"op": "like",
"value": this.keyword
}]
}) })
for (var m of res.data) { for (var m of res.data) {
m.names = m.wuzibianma + "--" + m.zichanmingcheng m.names = m.wuzibianma + "--" + m.zichanmingcheng
m.isSelect = false
} }
this.showList = res.data this.showList = res.data
this.showTotal = res.total this.showTotal = res.total
}, },
async getKucun() { async getKucun() {
let res = await index({ let res = await index({
page_size: 10, page_size: 10,
page: this.wuziPageIndex, page: this.wuziPageIndex,
table_name: 'inventorys', table_name: 'inventorys',
filter:[{"key":"zichanmingcheng","op":"like","value":this.keyword}] filter: [{
}) "key": "zichanmingcheng",
for (var m of res.data) { "op": "like",
m.names = m.wuzibianma + "--" + m.zichanmingcheng "value": this.keyword
} }]
})
for (var m of res.data) {
m.names = m.wuzibianma + "--" + m.zichanmingcheng
m.isSelect = false
}
this.showList = res.data this.showList = res.data
this.showTotal = res.total this.showTotal = res.total
}, },
async getKucunShow(e){ async getKucunShow(e) {
console.log(e) console.log(e)
let id = '' let id = ''
if(e){ if (e) {
id = e.split('-')[1] id = e.split('-')[1]
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.huikubianma.blur() this.$refs.huikubianma.blur()
}) })
}else{ } else {
return return
} }
const res = await show({ const res = await show({
id: id, id: id,
table_name: "inventorys" table_name: "inventorys"
}) })
this.mingxiObj.wuzibianma = res.wuzibianma this.mingxiObj.wuzibianma = res.wuzibianma
this.mingxiObj.zichanmingcheng = res.zichanmingcheng this.mingxiObj.zichanmingcheng = res.zichanmingcheng
this.mingxiObj.wuzileixing = res.wuzileixing this.mingxiObj.wuzileixing = res.wuzileixing
this.mingxiObj.jiliangdanwei = res.jiliangdanwei this.mingxiObj.jiliangdanwei = res.jiliangdanwei
this.mingxiObj.id = res.id this.mingxiObj.zaikushuliang = res.zaikushuliang
}, this.mingxiObj.rukukupici = res.rukukupici
async getCangku() { this.mingxiObj.id = res.id
let res = await index({
page_size: 999,
page: 1,
table_name: 'materialstorages',
})
this.cangkuList = res.data
}, },
wuziSelect(e) { async getCangku() {
this.mingxiObj.wuzibianma = e.wuzibianma let res = await index({
this.mingxiObj.zichanmingcheng = e.zichanmingcheng page_size: 999,
this.mingxiObj.wuzileixing = e.wuzileixing page: 1,
this.mingxiObj.jiliangdanwei = e.jiliangdanwei table_name: 'materialstorages',
})
this.cangkuList = res.data
},
wuziSelect(e) {
console.log(e)
this.showList.forEach((items) => {
this.$set(items, 'isSelect', false)
if(items.id==e.id){
this.$set(items, 'isSelect', true)
}
});
if (this.form.rukuleixing == '回库') {
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
this.mingxiObj.zaikushuliang = e.zaikushuliang
this.mingxiObj.rukukupici = e.rukukupici
this.mingxiObj.id = e.id
} else {
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
}
}, },
wuziPageChange(e) { wuziPageChange(e) {
console.log("e",e) console.log("e", e)
this.wuziPageIndex = e this.wuziPageIndex = e
this.getList() this.getList()
}, },
@ -476,18 +564,18 @@
}) })
this.list = res.data this.list = res.data
this.total = res.total this.total = res.total
}, },
// //
submitMingxi(params,callback){ submitMingxi(params, callback) {
save({ save({
table_name:'stocks_items', table_name: 'stocks_items',
...params ...params
}).then(res => { }).then(res => {
Message({ Message({
type: 'success', type: 'success',
message: '编辑成功' message: '编辑成功'
}) })
}) })
}, },
submit() { submit() {
this.form.id_stocks_items_stocks_id_relation = this.mingxiList this.form.id_stocks_items_stocks_id_relation = this.mingxiList
@ -520,52 +608,52 @@
this.$emit('refresh') this.$emit('refresh')
}) })
} }
}, },
isEqual(objA,objB){ isEqual(objA, objB) {
// //
if(objA === objB) return objA !== 0 || 1/objA === 1/objB; if (objA === objB) return objA !== 0 || 1 / objA === 1 / objB;
// //
if(objA == null || objB == null) return objA === objB; if (objA == null || objB == null) return objA === objB;
// //
if(Object.prototype.toString.call(objA) !== Object.prototype.toString.call(objB)) return false; if (Object.prototype.toString.call(objA) !== Object.prototype.toString.call(objB)) return false;
switch(Object.prototype.toString.call(objA)){ switch (Object.prototype.toString.call(objA)) {
case '[object RegExp]': case '[object RegExp]':
case '[object String]': case '[object String]':
// //
return '' + objA ==='' + objB; return '' + objA === '' + objB;
case '[object Number]': case '[object Number]':
//,NaN //,NaN
if(+objA !== +objA){ if (+objA !== +objA) {
return +objB !== +objB; return +objB !== +objB;
} }
return +objA === 0?1/ +objA === 1/objB : +objA === +objB; return +objA === 0 ? 1 / +objA === 1 / objB : +objA === +objB;
case '[object Date]': case '[object Date]':
case '[object Boolean]': case '[object Boolean]':
return +objA === +objB; return +objA === +objB;
case '[object Array]': case '[object Array]':
// //
for(let i = 0; i < objA.length; i++){ for (let i = 0; i < objA.length; i++) {
if (!this.isEqual(objA[i],objB[i])) return false; if (!this.isEqual(objA[i], objB[i])) return false;
} }
return true; return true;
case '[object Object]': case '[object Object]':
// //
let keys = Object.keys(objA); let keys = Object.keys(objA);
for(let i = 0; i < keys.length; i++){ for (let i = 0; i < keys.length; i++) {
if (!this.isEqual(objA[keys[i]],objB[keys[i]])) return false; if (!this.isEqual(objA[keys[i]], objB[keys[i]])) return false;
} }
keys = Object.keys(objB); keys = Object.keys(objB);
for(let i = 0; i < keys.length; i++){ for (let i = 0; i < keys.length; i++) {
if (!this.isEqual(objA[keys[i]],objB[keys[i]])) return false; if (!this.isEqual(objA[keys[i]], objB[keys[i]])) return false;
} }
return true; return true;
default : default:
return false; return false;
} }
} }
}, },
watch: { watch: {
@ -586,22 +674,26 @@
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.mingxiwrap{ .mingxiwrap {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.mingxiwrap .xy-table-item{
margin-bottom:10px .mingxiwrap .xy-table-item {
} margin-bottom: 10px
.searchCompanys{ }
display: flex;
justify-content: space-between; .searchCompanys {
margin-bottom:15px; display: flex;
} justify-content: space-between;
::v-deep .searchCompanys .el-input{ margin-bottom: 15px;
width:82% }
::v-deep .searchCompanys .el-input {
width: 82%
} }
.xy-table-item-label { .xy-table-item-label {
width: 160px; width: 160px;
} }

@ -5,8 +5,8 @@
<lx-header icon="md-apps" text="入库管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px"> <lx-header icon="md-apps" text="入库管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot> <slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;"> <div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<!-- <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" /> <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="经办人搜索" />
<Button type="primary" @click="getActivities"></Button> --> <Button type="primary" @click="getindex"></Button>
<Button icon="ios-add" type="primary" style="margin-left: 10px;" <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add'">添加</Button> @click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add'">添加</Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;" <!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@ -97,15 +97,16 @@
}, },
{ {
label: "记录人员", label: "记录人员",
width: 220, width: 120,
prop: 'jilurenyuan', prop: 'jilurenyuan',
align: 'left' align: 'center'
}, },
{ {
label: "保管人员", label: "保管人员",
width: 140, width: 120,
prop: 'baoguanrenyuan' prop: 'baoguanrenyuan',
align: 'center'
}, },
{ {
label: "备注", label: "备注",
@ -119,10 +120,10 @@
methods: { methods: {
async getindex() { async getindex() {
const res = await index({ const res = await index({
rows: this.select.pageSize, page_size: this.select.pageSize,
page: this.select.pageIndex, page: this.select.pageIndex,
table_name: 'stocks', table_name: 'stocks',
keyword: this.select.keyword filter:[{"key":"jingbanren","op":"like","value":this.select.keyword}],
}) })
this.list = res.data this.list = res.data
this.total = res.total this.total = res.total

Loading…
Cancel
Save