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">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<!-- <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<Button type="primary" @click="getActivities"></Button> -->
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<Button type="primary" @click="getindex"></Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['addRuku'].isShow = true,$refs['addRuku'].type = 'add'">添加</Button> -->
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['imports'].show()">导入</Button> -->
<Button type="primary" style="margin-left: 10px;"
@click="exportExcel(new Date().getTime().toString())">导出</Button>
</div>
</slot>
@ -59,7 +60,9 @@
} from 'element-ui'
import imports from "@/views/component/imports.vue"
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 {
components: {
imports
@ -69,7 +72,8 @@
select: {
pageSize: 10,
pageIndex: 1,
keyword: ""
keyword: "",
is_export:0
},
showcode:false,
customForm: {
@ -153,6 +157,24 @@
}
},
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){
console.log(e,row)
this.showcode = true
@ -175,10 +197,11 @@
},
async getindex() {
const res = await index({
rows: this.select.pageSize,
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: 'inventorys',
keyword: this.select.keyword
table_name: 'inventorys',
// is_export:this.select.is_export,
filter:[{"key":"zichanmingcheng","op":"like","value":this.select.keyword}],
})
this.list = res.data
this.total = res.total

@ -4,7 +4,7 @@
<template v-slot:chukushijian>
<div class="xy-table-item">
<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 class="xy-table-item-content">
<el-date-picker
@ -20,7 +20,7 @@
<template v-slot:chukuleixing>
<div class="xy-table-item">
<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 class="xy-table-item-content">
<el-select v-model="form.chukuleixing" style="width: 300px;" placeholder="请选择">
@ -64,7 +64,7 @@
<template v-slot:jieyongren>
<div class="xy-table-item">
<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 class="xy-table-item-content">
<el-input v-model="form.jieyongren" placeholder="请填写借用人" clearable style="width: 300px;"></el-input>
@ -75,7 +75,7 @@
<template v-slot:jilurenyuan>
<div class="xy-table-item">
<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 class="xy-table-item-content">
<el-input v-model="form.jilurenyuan" placeholder="请输入记录人员" clearable style="width: 300px;"></el-input>
@ -121,7 +121,7 @@
</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="xy-table-item">
<div class="xy-table-item-label">
@ -152,10 +152,10 @@
</div>
<div class="xy-table-item">
<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 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>
</div>
</div>
@ -173,7 +173,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>借用/报废数量
</div>
<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>
</div>
</div>
@ -270,6 +270,22 @@ export default {
chukumingxi:''
},
rules:{
chukushijian: [{
required: true,
message: '请选择出库时间'
}],
chukuleixing: [{
required: true,
message: '请选择出库类型'
}],
jieyongren: [{
required: true,
message: '请填写借用人'
}],
jilurenyuan: [{
required: true,
message: '请选择记录人员'
}],
},
isShowMingxi:false,
mingxiObj:{
@ -277,6 +293,7 @@ export default {
},
mingxiObjBefore:{},
mingxiList: [],
showLoading:true,
mingxiIndex:'',
mingxiTable: [
{
@ -297,8 +314,8 @@ export default {
prop: "jiliangdanwei",
width: 200
},{
label: "批次",
prop: "pici",
label: "入库批次",
prop: "rukupici",
width: 200
},,{
label: "在库数量",
@ -323,6 +340,29 @@ export default {
wuziPageIndex:1,
wuziTotal:0,
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:'名称',
key:'names',
@ -348,7 +388,6 @@ export default {
}
},
mingxiConfirm(){
if(this.mingxiIndex!=''){
//
@ -393,15 +432,22 @@ export default {
})
for(var m of res.data){
m.names = m.wuzibianma+"--"+m.zichanmingcheng
m.isSelect = false
}
this.wuziList = res.data
this.wuziTotal = res.total
},
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.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.pici = e.pici
this.mingxiObj.rukupici = e.rukupici
this.mingxiObj.zaikushuliang = e.zaikushuliang
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
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">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<!-- <Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<Button type="primary" @click="getActivities"></Button> -->
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="借用人搜索" />
<Button type="primary" @click="getindex"></Button>
<Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['addoutbounds'].isShow = true,$refs['addoutbounds'].type = 'add'">添加</Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@ -122,10 +122,10 @@
methods: {
async getindex() {
const res = await index({
rows: this.select.pageSize,
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: 'outbounds',
keyword: this.select.keyword
filter:[{"key":"jieyongren","op":"like","value":this.select.keyword}],
})
this.list = res.data
this.total = res.total

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

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

Loading…
Cancel
Save