市级出入库

master
lion 4 months ago
parent 450b9f1412
commit 2daf9eef83

@ -9,7 +9,7 @@ VUE_APP_OA_URL_TYPE = '{"采购入库":51,"请示入库":54,"调拨入库":55,"
#正式
VUE_APP_BASE_API = http://192.168.60.99:8004/
VUE_APP_BASE_API = http://192.168.60.99:8004
#VUE_APP_UPLOAD_API = http://192.168.60.99:9004/api/admin/upload-file
# 正式oa

@ -0,0 +1,389 @@
<template>
<div>
<xy-dialog
ref="dialog"
:width="80"
:is-show.sync="isShow"
type="form"
:title="titleName"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:rukuriqi>
<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-date-picker
v-model="form.rukuriqi"
style="width: 300px;"
type="date"
placeholder="选择入库日期"
value-format="yyyy-MM-dd"
/>
</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>经办人
</div>
<div class="xy-table-item-content">
<el-input v-model="form.jingbanren" placeholder="请填写经办人" clearable style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:fujian>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />附件
</div>
<div class="xy-table-item-content">
<el-upload
ref="fileUpload"
:action="action"
multiple
class="upload-demo"
:file-list="fileList"
style="width:400px"
:auto-upload="true"
:headers="headers"
:on-success="handleSuccess"
:on-remove="handleRemove"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:beizhu>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />备注
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.beizhu"
type="textarea"
:rows="3"
placeholder="请输入备注"
clearable
style="width: 300px;"
/>
</div>
</div>
</template>
<template v-slot:rukuwuzi>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />入库物资
</div>
<div class="xy-table-item-content" style="width: 100%;">
<div style="margin-bottom: 10px;">
<el-button type="primary" size="small" @click="addMaterial"></el-button>
</div>
<el-table
:data="materialList"
border
style="width: 90%;"
max-height="400"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="cangkumingcheng" label="仓库名称" width="150" align="center" />
<el-table-column prop="xianwuzimingcheng" label="现物资名称" width="150" align="center" />
<el-table-column prop="yuanwuzimingcheng" label="原物资名称" width="150" align="center" />
<el-table-column prop="wuzidaima" label="物资代码" width="120" align="center" />
<el-table-column prop="guigexinghao" label="规格型号" width="120" align="center" />
<el-table-column prop="shuliang" label="数量" width="80" align="center" />
<el-table-column prop="danwei" label="单位" width="80" align="center" />
<el-table-column prop="jiazhiyuan" label="价值(元)" width="100" align="center" />
<el-table-column prop="quyu" label="区域" width="100" align="center" />
<el-table-column fixed="right" label="操作" width="100" align="center">
<template slot-scope="scope">
<el-button
type="danger"
size="mini"
@click="removeMaterial(scope.$index)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</xy-dialog>
<!-- 物资添加组件 -->
<addMater
ref="addMater"
:is-local-mode="true"
@material-added="handleMaterialAdded"
/>
</div>
</template>
<script>
import {
save,
show
} from '@/api/system/baseForm.js'
import {
Message
} from 'element-ui'
import addMater from '@/views/storages/components/addMater.vue'
import { getToken } from '@/utils/auth'
import { index as getCangkuList } from '@/api/system/baseForm.js'
import { getInfo } from '@/api/user.js'
export default {
components: {
addMater
},
data() {
return {
isShow: false,
type: 'add',
id: '',
titleName: '',
tableName: 'flood_entry',
action: `${process.env.VUE_APP_UPLOAD_API}`,
fileList: [],
headers: {
Authorization: `Bearer ${getToken()}`
},
cangkuList: [],
materialList: [], //
form: {
rukuriqi: '',
jingbanren: '',
fujian: [],
beizhu: '',
rukuwuzi: []
},
rules: {
rukuriqi: [{
required: true,
message: '请选择入库日期'
}],
jingbanren: [{
required: true,
message: '请填写经办人'
}]
}
}
},
watch: {
isShow(newVal) {
if (newVal) {
this.titleName = this.type === 'add' ? `新增入库记录` : `编辑入库记录`
if (this.type === 'editor') {
this.getDetail()
} else {
this.resetForm()
//
this.getUserName()
}
} else {
this.id = ''
this.type = ''
this.resetForm()
if (this.$refs['dialog']) {
this.$refs['dialog'].reset()
}
}
}
},
created() {
this.getCangku()
},
methods: {
async getUserName() {
try {
const res = await getInfo()
if (res && res.name) {
this.form.jingbanren = res.name
}
} catch (error) {
console.error('获取用户信息失败', error)
}
},
async getCangku() {
const res = await getCangkuList({
page_size: 999,
page: 1,
table_name: 'materialstorages'
})
this.cangkuList = res.data || []
},
resetForm() {
this.form = {
rukuriqi: '',
jingbanren: '',
fujian: [],
beizhu: '',
rukuwuzi: []
}
this.fileList = []
this.materialList = []
},
handleSuccess(response, file, fileList) {
this.fileList = fileList
const arr = []
for (const item of this.fileList) {
if (item.response && item.response.id) {
arr.push(item.response.id)
} else if (item.id) {
arr.push(item.id)
}
}
this.form.fujian = arr
},
handleRemove(file, fileList) {
this.fileList = fileList
const arr = []
for (const item of this.fileList) {
if (item.response && item.response.id) {
arr.push(item.response.id)
} else if (item.id) {
arr.push(item.id)
}
}
this.form.fujian = arr
},
addMaterial() {
//
this.$refs['addMater'].isShow = true
this.$refs['addMater'].type = 'add'
this.$refs['addMater'].setCkList(this.cangkuList)
},
handleMaterialAdded(materialData) {
// addMater
if (materialData) {
// ID
const newMaterial = {
...materialData,
tempId: Date.now() + Math.random()
}
this.materialList.push(newMaterial)
Message({
type: 'success',
message: '物资添加成功'
})
}
},
removeMaterial(index) {
this.materialList.splice(index, 1)
Message({
type: 'success',
message: '删除成功'
})
},
async getDetail() {
const res = await show({
id: this.id,
table_name: this.tableName
})
this.form = {
rukuriqi: res?.rukuriqi || '',
jingbanren: res?.jingbanren || '',
fujian: res?.fujian ? (Array.isArray(res.fujian) ? res.fujian : JSON.parse(res.fujian)) : [],
beizhu: res?.beizhu || '',
rukuwuzi: res?.rukuwuzi ? (Array.isArray(res.rukuwuzi) ? res.rukuwuzi : JSON.parse(res.rukuwuzi)) : []
}
//
if (this.form.fujian && this.form.fujian.length > 0) {
// 使idfileList
this.fileList = this.form.fujian.map((id, index) => ({
id: id,
name: `附件${index + 1}`,
url: ''
}))
}
//
if (res.rukuwuzi) {
try {
this.materialList = Array.isArray(res.rukuwuzi) ? res.rukuwuzi : JSON.parse(res.rukuwuzi)
} catch (e) {
this.materialList = []
}
} else {
this.materialList = []
}
},
submit() {
//
if (!this.materialList || this.materialList.length === 0) {
Message({
type: 'warning',
message: '请至少添加一条入库物资'
})
return
}
const submitData = {
table_name: this.tableName,
rukuriqi: this.form.rukuriqi,
jingbanren: this.form.jingbanren,
fujian: JSON.stringify(this.form.fujian),
beizhu: this.form.beizhu,
rukuwuzi: JSON.stringify(this.materialList)
}
if (this.type === 'add') {
save(submitData).then(res => {
Message({
type: 'success',
message: '新增成功'
})
this.isShow = false
this.$emit('refresh')
}).catch(err => {
Message({
type: 'error',
message: '新增失败:' + (err.message || '未知错误')
})
})
} else if (this.type === 'editor') {
submitData.id = this.id
save(submitData).then(res => {
Message({
type: 'success',
message: '编辑成功'
})
this.isShow = false
this.$emit('refresh')
}).catch(err => {
Message({
type: 'error',
message: '编辑失败:' + (err.message || '未知错误')
})
})
}
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label {
width: 160px;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
}
::v-deep .xy-table-item-label {
width: 160px !important;
}
::v-deep .beizhu,
::v-deep .rukuwuzi {
flex-basis: 100% !important;
}
</style>

@ -0,0 +1,431 @@
<template>
<div>
<xy-dialog
ref="dialog"
:width="80"
:is-show.sync="isShow"
type="form"
:title="titleName"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:chukuriqi>
<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-date-picker
v-model="form.chukuriqi"
style="width: 300px;"
type="date"
placeholder="选择出库日期"
value-format="yyyy-MM-dd"
/>
</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>经办人
</div>
<div class="xy-table-item-content">
<el-input v-model="form.jingbanren" placeholder="请填写经办人" clearable style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:fujian>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />附件
</div>
<div class="xy-table-item-content">
<el-upload
ref="fileUpload"
:action="action"
multiple
class="upload-demo"
:file-list="fileList"
style="width:400px"
:auto-upload="true"
:headers="headers"
:on-success="handleSuccess"
:on-remove="handleRemove"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:beizhu>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />备注
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.beizhu"
type="textarea"
:rows="3"
placeholder="请输入备注"
clearable
style="width: 300px;"
/>
</div>
</div>
</template>
<template v-slot:chukuwuzi>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;" />出库物资
</div>
<div class="xy-table-item-content" style="width: 100%;">
<div style="margin-bottom: 10px;">
<el-button type="primary" size="small" @click="selectMaterial"></el-button>
</div>
<el-table
:data="materialList"
border
style="width: 90%;"
max-height="400"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="cangkumingcheng" label="仓库名称" width="150" align="center" />
<el-table-column prop="xianwuzimingcheng" label="现物资名称" width="150" align="center" />
<el-table-column prop="yuanwuzimingcheng" label="原物资名称" width="150" align="center" />
<el-table-column prop="wuzidaima" label="物资代码" width="120" align="center" />
<el-table-column prop="guigexinghao" label="规格型号" width="120" align="center" />
<el-table-column prop="kucunshuliang" label="库存数量" width="100" align="center" />
<el-table-column label="出库数量" width="120" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.chukushuliang"
:min="0"
:max="scope.row.kucunshuliang || 999999"
:precision="0"
size="small"
style="width: 100px;"
@change="handleQuantityChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column prop="danwei" label="单位" width="80" align="center" />
<el-table-column prop="jiazhiyuan" label="价值(元)" width="100" align="center" />
<el-table-column prop="quyu" label="区域" width="100" align="center" />
<el-table-column fixed="right" label="操作" width="100" align="center">
<template slot-scope="scope">
<el-button
type="danger"
size="mini"
@click="removeMaterial(scope.$index)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</xy-dialog>
<!-- 选择物资弹窗 -->
<selectMaterial
ref="selectMaterial"
@materials-selected="handleMaterialsSelected"
/>
</div>
</template>
<script>
import {
save,
show
} from '@/api/system/baseForm.js'
import {
Message
} from 'element-ui'
import selectMaterial from './selectMaterial.vue'
import { getToken } from '@/utils/auth'
import { getInfo } from '@/api/user.js'
export default {
components: {
selectMaterial
},
data() {
return {
isShow: false,
type: 'add',
id: '',
titleName: '',
tableName: 'flood_outbound',
action: `${process.env.VUE_APP_UPLOAD_API}`,
fileList: [],
headers: {
Authorization: `Bearer ${getToken()}`
},
materialList: [], //
form: {
chukuriqi: '',
jingbanren: '',
fujian: [],
beizhu: '',
chukuwuzi:[] //
},
rules: {
chukuriqi: [{
required: true,
message: '请选择出库日期'
}],
jingbanren: [{
required: true,
message: '请填写经办人'
}]
}
}
},
watch: {
isShow(newVal) {
if (newVal) {
this.titleName = this.type === 'add' ? `新增出库记录` : `编辑出库记录`
if (this.type === 'editor') {
this.getDetail()
} else {
this.resetForm()
//
this.getUserName()
}
} else {
this.id = ''
this.type = ''
this.resetForm()
if (this.$refs['dialog']) {
this.$refs['dialog'].reset()
}
}
}
},
methods: {
async getUserName() {
try {
const res = await getInfo()
if (res && res.name) {
this.form.jingbanren = res.name
}
} catch (error) {
console.error('获取用户信息失败', error)
}
},
resetForm() {
this.form = {
chukuriqi: '',
jingbanren: '',
fujian: [],
beizhu: '',
chukuwuzi:[]
}
this.fileList = []
this.materialList = []
},
handleSuccess(response, file, fileList) {
this.fileList = fileList
const arr = []
for (const item of this.fileList) {
if (item.response && item.response.id) {
arr.push(item.response.id)
} else if (item.id) {
arr.push(item.id)
}
}
this.form.fujian = arr
},
handleRemove(file, fileList) {
this.fileList = fileList
const arr = []
for (const item of this.fileList) {
if (item.response && item.response.id) {
arr.push(item.response.id)
} else if (item.id) {
arr.push(item.id)
}
}
this.form.fujian = arr
},
selectMaterial() {
//
this.$refs['selectMaterial'].show()
},
handleMaterialsSelected(selectedMaterials) {
//
if (selectedMaterials && selectedMaterials.length > 0) {
selectedMaterials.forEach(material => {
// ID
const exists = this.materialList.find(item => item.id === material.id)
if (!exists) {
// 0
const newMaterial = {
...material,
kucunshuliang: material.shuliang || 0, //
chukushuliang: 0, //
tempId: Date.now() + Math.random() // ID
}
this.materialList.push(newMaterial)
} else {
Message({
type: 'warning',
message: `物资"${material.xianwuzimingcheng}"已存在,请勿重复添加`
})
}
})
Message({
type: 'success',
message: `已添加${selectedMaterials.length}条物资,请填写出库数量`
})
}
},
handleQuantityChange(row) {
//
if (row.chukushuliang > row.kucunshuliang) {
Message({
type: 'warning',
message: '出库数量不能超过库存数量'
})
row.chukushuliang = row.kucunshuliang
}
if (row.chukushuliang < 0) {
row.chukushuliang = 0
}
},
removeMaterial(index) {
this.materialList.splice(index, 1)
Message({
type: 'success',
message: '删除成功'
})
},
async getDetail() {
const res = await show({
id: this.id,
table_name: this.tableName
})
this.form = {
chukuriqi: res?.chukuriqi || '',
jingbanren: res?.jingbanren || '',
fujian: res?.fujian ? (Array.isArray(res.fujian) ? res.fujian : JSON.parse(res.fujian)) : [],
beizhu: res?.beizhu || '',
chukuwuzi: res?.chukuwuzi ? (Array.isArray(res.chukuwuzi) ? res.chukuwuzi : JSON.parse(res.chukuwuzi)) : []
}
//
if (this.form.fujian && this.form.fujian.length > 0) {
this.fileList = this.form.fujian.map((id, index) => ({
id: id,
name: `附件${index + 1}`,
url: ''
}))
}
//
if (res.chukuwuzi) {
try {
this.materialList = Array.isArray(res.chukuwuzi) ? res.chukuwuzi : JSON.parse(res.chukuwuzi)
} catch (e) {
this.materialList = []
}
} else {
this.materialList = []
}
},
submit() {
//
if (!this.materialList || this.materialList.length === 0) {
Message({
type: 'warning',
message: '请至少添加一条出库物资'
})
return
}
//
const invalidMaterials = this.materialList.filter(item => !item.chukushuliang || item.chukushuliang <= 0)
if (invalidMaterials.length > 0) {
Message({
type: 'warning',
message: '请填写所有物资的出库数量'
})
return
}
//
const exceedMaterials = this.materialList.filter(item => item.chukushuliang > item.kucunshuliang)
if (exceedMaterials.length > 0) {
Message({
type: 'warning',
message: '出库数量不能超过库存数量'
})
return
}
const submitData = {
table_name: this.tableName,
chukuriqi: this.form.chukuriqi,
jingbanren: this.form.jingbanren,
fujian: JSON.stringify(this.form.fujian),
beizhu: this.form.beizhu,
chukuwuzi: JSON.stringify(this.materialList)
}
if (this.type === 'add') {
save(submitData).then(res => {
Message({
type: 'success',
message: '新增成功'
})
this.isShow = false
this.$emit('refresh')
}).catch(err => {
Message({
type: 'error',
message: '新增失败:' + (err.message || '未知错误')
})
})
} else if (this.type === 'editor') {
submitData.id = this.id
save(submitData).then(res => {
Message({
type: 'success',
message: '编辑成功'
})
this.isShow = false
this.$emit('refresh')
}).catch(err => {
Message({
type: 'error',
message: '编辑失败:' + (err.message || '未知错误')
})
})
}
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label {
width: 160px;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
}
::v-deep .xy-table-item-label {
width: 160px !important;
}
::v-deep .beizhu,
::v-deep .chukuwuzi {
flex-basis: 100% !important;
}
</style>

@ -0,0 +1,197 @@
<template>
<el-dialog
title="选择物资"
:visible.sync="isShow"
width="80%"
:close-on-click-modal="false"
@close="handleClose"
>
<div>
<!-- 搜索条件 -->
<div style="margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 10px;">
<el-input
v-model="searchForm.keyword"
placeholder="关键词搜索"
style="width: 200px;"
clearable
@keyup.enter.native="handleSearch"
/>
<el-select v-model="searchForm.guanliancangku" placeholder="所在仓库" clearable style="width: 200px;">
<el-option
v-for="item in cangkuList"
:key="item.id"
:label="item.cangkumingcheng"
:value="item.id"
/>
</el-select>
<el-button type="primary" @click="handleSearch"></el-button>
</div>
<!-- 物资列表 -->
<el-table
v-loading="loading"
:data="materialList"
border
style="width: 100%"
max-height="400"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="cangkumingcheng" label="仓库名称" align="center" />
<el-table-column prop="xianwuzimingcheng" label="现物资名称" width="150" align="center" />
<el-table-column prop="yuanwuzimingcheng" label="原物资名称" width="150" align="center" />
<el-table-column prop="wuzidaima" label="物资代码" width="120" align="center" />
<el-table-column prop="guigexinghao" label="规格型号" width="120" align="center" />
<el-table-column prop="shuliang" label="库存数量" width="100" align="center" />
<el-table-column prop="danwei" label="单位" width="80" align="center" />
<el-table-column prop="jiazhiyuan" label="价值(元)" width="100" align="center" />
<el-table-column prop="quyu" label="区域" width="100" align="center" />
</el-table>
<!-- 分页 -->
<div style="margin-top: 15px; text-align: right;">
<el-pagination
:current-page="pagination.page"
:page-sizes="[10, 20, 50, 100]"
:page-size="pagination.pageSize"
:total="pagination.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="isShow = false">取消</el-button>
<el-button type="primary" @click="handleConfirm"></el-button>
</div>
</el-dialog>
</template>
<script>
import { index } from '@/api/system/baseForm.js'
import { index as getCangkuList } from '@/api/system/baseForm.js'
import { Message } from 'element-ui'
export default {
name: 'SelectMaterial',
data() {
return {
isShow: false,
loading: false,
materialList: [],
selectedMaterials: [], //
cangkuList: [],
searchForm: {
keyword: '',
guanliancangku: ''
},
pagination: {
page: 1,
pageSize: 10,
total: 0
}
}
},
created() {
this.getCangku()
},
methods: {
async getCangku() {
const res = await getCangkuList({
page_size: 999,
page: 1,
table_name: 'materialstorages'
})
this.cangkuList = res.data || []
},
show() {
this.isShow = true
this.searchForm = {
keyword: '',
guanliancangku: ''
}
this.selectedMaterials = []
this.getMaterialList()
},
handleClose() {
this.selectedMaterials = []
},
async getMaterialList() {
this.loading = true
const filters = []
if (this.searchForm.keyword) {
filters.push({
'key': 'xianwuzimingcheng',
'op': 'like',
'value': this.searchForm.keyword
})
}
if (this.searchForm.guanliancangku) {
filters.push({
'key': 'guanliancangku',
'op': 'eq',
'value': this.searchForm.guanliancangku
})
}
try {
const res = await index({
page_size: this.pagination.pageSize,
page: this.pagination.page,
table_name: 'flood_materials',
filter: filters
})
this.materialList = res.data || []
this.pagination.total = res.total || 0
} catch (error) {
Message({
type: 'error',
message: '获取物资列表失败'
})
} finally {
this.loading = false
}
},
handleSearch() {
this.pagination.page = 1
this.getMaterialList()
},
handleSelectionChange(selection) {
this.selectedMaterials = selection
},
handleSizeChange(val) {
this.pagination.pageSize = val
this.pagination.page = 1
this.getMaterialList()
},
handleCurrentChange(val) {
this.pagination.page = val
this.getMaterialList()
},
handleConfirm() {
if (this.selectedMaterials.length === 0) {
Message({
type: 'warning',
message: '请至少选择一条物资'
})
return
}
//
this.$emit('materials-selected', this.selectedMaterials)
this.isShow = false
}
}
}
</script>
<style scoped>
.dialog-footer {
text-align: right;
}
</style>

@ -0,0 +1,208 @@
<template>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<Input size="large" v-model="select.keyword" style="width: 200px;margin-right: 10px;height:40px" placeholder="关键词搜索" />
<el-date-picker
v-model="select.rukuriqi"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
style="width: 300px;margin-right: 10px;"
clearable
/>
<Input size="large" v-model="select.jingbanren" style="width: 200px;margin-right: 10px;height:40px" placeholder="经办人" />
<Button type="primary" @click="getindex('page')"></Button>
<Button
type="primary"
style="margin-left: 10px;"
@click="$refs['addEntry'].isShow = true, $refs['addEntry'].type = 'add'"
>添加</Button>
</div>
</slot>
</lx-header>
</div>
<xy-table
v-loading="loading"
:list="list"
:total="total"
:table-item="table"
@pageSizeChange="e => select.pageSize = e"
@pageIndexChange="pageChange"
>
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="180" header-align="center">
<template slot-scope="scope">
<div>
<Button
type="primary"
size="small"
style="margin-left: 10px;"
@click="editorEntry(scope.row.id, 'editor')"
>编辑</Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteEntry(scope.row)">
<Button type="error" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addEntry ref="addEntry" @refresh="getindex" />
</div>
</template>
<script>
import {
index,
destroy
} from '@/api/system/baseForm.js'
import addEntry from './components/addEntry.vue'
import {
Message
} from 'element-ui'
export default {
components: {
addEntry
},
data() {
return {
loading: false,
select: {
pageSize: 10,
pageIndex: 1,
keyword: '',
rukuriqi: [],
jingbanren: ''
},
customForm: {
tableName: 'flood_entry'
},
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80
},
{
label: '入库日期',
width: 120,
prop: 'rukuriqi',
align: 'center'
},
{
label: '经办人',
width: 120,
prop: 'jingbanren',
align: 'center'
},
{
label: '备注',
prop: 'beizhu',
align: 'left'
},
{
label: '创建时间',
width: 180,
prop: 'created_at',
align: 'center'
}
]
}
},
mounted() {
// this.getindex()
},
methods: {
async getindex(page) {
this.loading = true
if (page == 'page') {
this.select.pageIndex = 1
}
const filters = [{
'key': 'jingbanren',
'op': 'like',
'value': this.select.jingbanren ? this.select.jingbanren : ''
}]
//
if (this.select.rukuriqi && this.select.rukuriqi.length === 2) {
filters.push({
'key': 'rukuriqi',
'op': 'gte',
'value': this.select.rukuriqi[0]
})
filters.push({
'key': 'rukuriqi',
'op': 'lte',
'value': this.select.rukuriqi[1]
})
}
//
if (this.select.keyword) {
filters.push({
'key': 'beizhu',
'op': 'like',
'value': this.select.keyword
})
}
const res = await index({
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: this.customForm.tableName,
filter: filters
})
this.list = res.data
this.total = res.total
this.loading = false
},
pageChange(e) {
this.select.pageIndex = e
this.getindex()
},
editorEntry(id, type) {
this.$refs['addEntry'].id = id
this.$refs['addEntry'].type = type
this.$refs['addEntry'].isShow = true
},
deleteEntry(row) {
destroy({
id: row.id,
table_name: this.customForm.tableName
}).then(res => {
Message({
type: 'success',
message: '删除成功'
})
this.getindex()
})
}
}
}
</script>
<style scoped>
/deep/ .draw {
padding-left: 20px;
}
/deep/ .draw>div {
font-size: 20px;
margin: 15px 0
}
/deep/ .el-timeline-item {
list-style: none;
}
</style>

@ -0,0 +1,208 @@
<template>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<Input size="large" v-model="select.keyword" style="width: 200px;margin-right: 10px;height:40px" placeholder="关键词搜索" />
<el-date-picker
v-model="select.chukuriqi"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
style="width: 300px;margin-right: 10px;"
clearable
/>
<Input size="large" v-model="select.jingbanren" style="width: 200px;margin-right: 10px;height:40px" placeholder="经办人" />
<Button type="primary" @click="getindex('page')"></Button>
<Button
type="primary"
style="margin-left: 10px;"
@click="$refs['addOutbound'].isShow = true, $refs['addOutbound'].type = 'add'"
>添加</Button>
</div>
</slot>
</lx-header>
</div>
<xy-table
v-loading="loading"
:list="list"
:total="total"
:table-item="table"
@pageSizeChange="e => select.pageSize = e"
@pageIndexChange="pageChange"
>
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="180" header-align="center">
<template slot-scope="scope">
<div>
<Button
type="primary"
size="small"
style="margin-left: 10px;"
@click="editorOutbound(scope.row.id, 'editor')"
>编辑</Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteOutbound(scope.row)">
<Button type="error" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addOutbound ref="addOutbound" @refresh="getindex" />
</div>
</template>
<script>
import {
index,
destroy
} from '@/api/system/baseForm.js'
import addOutbound from './components/addOutbound.vue'
import {
Message
} from 'element-ui'
export default {
components: {
addOutbound
},
data() {
return {
loading: false,
select: {
pageSize: 10,
pageIndex: 1,
keyword: '',
chukuriqi: [],
jingbanren: ''
},
customForm: {
tableName: 'flood_outbound'
},
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80
},
{
label: '出库日期',
width: 120,
prop: 'chukuriqi',
align: 'center'
},
{
label: '经办人',
width: 120,
prop: 'jingbanren',
align: 'center'
},
{
label: '备注',
prop: 'beizhu',
align: 'left'
},
{
label: '创建时间',
width: 180,
prop: 'created_at',
align: 'center'
}
]
}
},
mounted() {
// this.getindex()
},
methods: {
async getindex(page) {
this.loading = true
if (page == 'page') {
this.select.pageIndex = 1
}
const filters = [{
'key': 'jingbanren',
'op': 'like',
'value': this.select.jingbanren ? this.select.jingbanren : ''
}]
//
if (this.select.chukuriqi && this.select.chukuriqi.length === 2) {
filters.push({
'key': 'chukuriqi',
'op': 'gte',
'value': this.select.chukuriqi[0]
})
filters.push({
'key': 'chukuriqi',
'op': 'lte',
'value': this.select.chukuriqi[1]
})
}
//
if (this.select.keyword) {
filters.push({
'key': 'beizhu',
'op': 'like',
'value': this.select.keyword
})
}
const res = await index({
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: this.customForm.tableName,
filter: filters
})
this.list = res.data
this.total = res.total
this.loading = false
},
pageChange(e) {
this.select.pageIndex = e
this.getindex()
},
editorOutbound(id, type) {
this.$refs['addOutbound'].id = id
this.$refs['addOutbound'].type = type
this.$refs['addOutbound'].isShow = true
},
deleteOutbound(row) {
destroy({
id: row.id,
table_name: this.customForm.tableName
}).then(res => {
Message({
type: 'success',
message: '删除成功'
})
this.getindex()
})
}
}
}
</script>
<style scoped>
/deep/ .draw {
padding-left: 20px;
}
/deep/ .draw>div {
font-size: 20px;
margin: 15px 0
}
/deep/ .el-timeline-item {
list-style: none;
}
</style>

@ -283,7 +283,13 @@ import {
index as getFenleilist
} from '@/api/fenlei.js'
export default {
props: {
//
isLocalMode: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
@ -372,12 +378,11 @@ export default {
},
changeCk(e) {
if (e) {
this.cangkuList.map(item => {
if (e === item.cangkumingcheng) {
this.form.guanliancangku = item.id
this.form.cangkumingcheng = item.cangkumingcheng
}
})
const selectedWarehouse = this.cangkuList.find(item => e === item.id)
if (selectedWarehouse) {
this.form.guanliancangku = selectedWarehouse.id
this.form.cangkumingcheng = selectedWarehouse.cangkumingcheng
}
console.log(this.form.guanliancangku)
}
},
@ -417,7 +422,27 @@ export default {
},
submit() {
console.log('this.form', this.form)
// return
//
if (this.isLocalMode) {
//
if (!this.form.guanliancangku) {
Message({
type: 'warning',
message: '请选择仓库'
})
return
}
//
this.$emit('material-added', { ...this.form })
this.isShow = false
//
this.$refs['dialog'].reset()
return
}
//
if (this.type === 'add') {
save({
table_name: this.tableName,

Loading…
Cancel
Save