You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
11 KiB

3 years ago
<template>
2 years ago
<div>
3 years ago
<div ref="lxHeader">
3 years ago
<lx-header icon="md-apps" :text="`${chukuType}出库管理`" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
3 years ago
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
3 years ago
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="借用人搜索" />
<Button type="primary" @click="getindex"></Button>
3 years ago
<Button icon="ios-add" type="primary" style="margin-left: 10px;"
2 years ago
@click="$refs['addoutbounds'].isShow = true,$refs['addoutbounds'].type = 'add',
$refs['addoutbounds'].chukuType = chukuType,
$refs['addoutbounds'].authName=authName">添加</Button>
3 years ago
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['imports'].show()">导入</Button> -->
</div>
</slot>
</lx-header>
</div>
2 years ago
<xy-table :list="list" v-loading="loading" :total="total" @pageSizeChange="e => select.pageSize = e" @pageIndexChange="pageChange"
3 years ago
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
2 years ago
<template slot-scope="scope">
2 years ago
<template v-if="isCkName=='仓库管理员'||roleName=='系统管理员'">
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'outbounds')"></Button>
</template>
2 years ago
<template v-if="scope.row.jilurenyuan==authName||isCkName=='仓库管理员'||roleName=='系统管理员'">
<Button type="primary" size="small" style="margin-left: 10px;" @click="printChuku(scope.row.id,'print')"></Button>
<!-- <template v-if="scope.row.jilurenyuan==authName||roleName=='系统管理员'"> -->
2 years ago
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'editor')"></Button>
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="tofollow(scope.row.id,scope.row)"></Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteChuku(scope.row)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
2 years ago
<!-- </template> -->
2 years ago
</template>
3 years ago
</template>
</el-table-column>
</template>
</xy-table>
<addoutbounds ref="addoutbounds" @refresh="getindex"></addoutbounds>
<printoutbounds ref="printoutbounds" @refresh="getindex"></printoutbounds>
3 years ago
<imports :table-name="customForm.tableName" :form-info="form" ref="imports" @refresh="getindex"></imports>
</div>
</template>
<script>
import {
index,
destroy
} from "@/api/system/baseForm.js"
import {
2 years ago
getInfo
} from "@/api/user.js"
import {
2 years ago
getOutboundsStatus,
getOatoken
} from "@/api/contract.js"
import addoutbounds from "./component/addoutbounds.vue"
import printoutbounds from "./component/printoutbounds.vue"
3 years ago
import {
Message
} from 'element-ui'
import imports from "@/views/component/imports.vue"
import {
index as fieldIndex
} from "@/api/system/customFormField";
import {
getparameter
} from "@/api/system/dictionary";
export default {
components: {
addoutbounds,
imports,
printoutbounds
3 years ago
},
data() {
2 years ago
return {
window: {
width: 0,
height: 0,
top: 0,
left: 0
},
loading:false,
2 years ago
userName:'',
2 years ago
authName:'',
2 years ago
roleName:'',
isCkName:'',
3 years ago
select: {
pageSize: 10,
pageIndex: 1,
keyword: ""
3 years ago
},
chukuType:'领用',
3 years ago
customForm: {
customFormId: "",
tableName: ""
2 years ago
},
wuziguanli_oatoken:'',
3 years ago
form: [],
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
3 years ago
fixed: 'left',
width:80,
},{
3 years ago
label: "出库时间",
3 years ago
width: 180,
3 years ago
prop: 'chukushijian',
3 years ago
align: 'center',
3 years ago
fixed: 'left',
3 years ago
},
{
label: "状态",
width: 180,
prop: 'zhuangtai',
align: 'center'
},
3 years ago
{
label: "出库类型",
width: 180,
prop: 'chukuleixing',
align: 'center',
3 years ago
},
{
label: "借用仓库",
3 years ago
width: 180,
3 years ago
prop: 'jieyongcangku',
3 years ago
align: 'center',
3 years ago
},
{
label: "借用部门",
3 years ago
width: 180,
3 years ago
prop: 'jieyongbumen',
3 years ago
align: 'center',
3 years ago
},
2 years ago
// {
// label: "借用人",
// width: 180,
// prop: 'jieyongren',
// align: 'center',
// },
3 years ago
{
2 years ago
label: "经办人",
3 years ago
width: 180,
prop: 'jilurenyuan',
align:'center'
2 years ago
},
{
label: "出库详情",
width: 300,
prop: 'id_outbounds_items_outbounds_id_relation',
align:'left',
customFn: (row) => {
if(row.id_outbounds_items_outbounds_id_relation.length>0){
return row.id_outbounds_items_outbounds_id_relation.map(item => {
return ( <p> {item.wuzibianma}-{item.zichanmingcheng}
{item.guigexinghao?'('+item.guigexinghao+')':''}
{item.jieyongshuliang}{item.jiliangdanwei}
</p>)
})
}else{
return
}
}
// formatter(cell, data, value, index){
// console.log("value",value)
// if(value.length>0){
// let html = ''
// for(var item of value){
// html+= `${item.wuzibianma}-${item.zichanmingcheng}${item.guigexinghao?'('+item.guigexinghao+')':''}-${item.jieyongshuliang}${item.jiliangdanwei}`
// }
// return html
// }else{
// return ''
// }
// }
3 years ago
},
{
label: "备注",
prop: 'beizhu',
align: 'left'
}
]
}
},
methods: {
2 years ago
async getUserName(){
2 years ago
getInfo().then(res => {
console.log("res",res)
this.userName = res.username
this.authName = res.name
for(var k of res.role){
if(k.name=='系统管理员'){
this.roleName = k.name
}
2 years ago
if(k.name=='仓库管理员'){
this.isCkName = '仓库管理员'
}
2 years ago
}
}).catch(error => {})
},
2 years ago
async getindex() {
this.loading = true
3 years ago
const res = await index({
3 years ago
page_size: this.select.pageSize,
3 years ago
page: this.select.pageIndex,
table_name: 'outbounds',
3 years ago
filter:[{"key":"jieyongren","op":"like","value":this.select.keyword},
{"key":"chukuleixing","op":"like","value":this.chukuType}],
3 years ago
})
this.list = res.data
2 years ago
this.total = res.total
this.loading = false
3 years ago
},
pageChange(e) {
3 years ago
this.select.pageIndex = e
this.getindex()
3 years ago
},
editorChuku(id, type) {
3 years ago
this.$refs['addoutbounds'].id = id
this.$refs['addoutbounds'].isShow = true
3 years ago
this.$refs['addoutbounds'].type = type
2 years ago
this.$refs['addoutbounds'].chukuType = this.chukuType
},
printChuku(id, type){
this.$refs['printoutbounds'].id = id
this.$refs['printoutbounds'].isShow = true
this.$refs['printoutbounds'].type = type
this.$refs['printoutbounds'].chukuType = this.chukuType
},
2 years ago
async tofollow(id,row){
console.log(row)
if(row.id_outbounds_items_outbounds_id_relation.length<1){
Message({
type: 'warning',
message: '请补充出库物资'
})
return
}
let default_json = {
2 years ago
// 'yewukeshi':row.jieyongbumen,
// 'bianhao':row.chukushijian+'-'+row.id,
// 'wuzimingcheng':row.id_outbounds_items_outbounds_id_relation[0].zichanmingcheng,
// 'lingyongshijian':row.chukushijian,
// 'shuliang':row.id_outbounds_items_outbounds_id_relation[0].jieyongshuliang,
// 'xinghaoguige':row.id_outbounds_items_outbounds_id_relation[0].guigexinghao,
// 'jingbanren':row.jilurenyuan,
// 'beizhu':row.beizhu,
// 'gudingzichanbianhao':row.gudingzichanbianhao,
// 'baofeiyuanyin':row.baofeiyuanyin,
'yewukeshi':row.jieyongbumen,
'bianhao':row.chukushijian+'-'+row.id,
'lingyongshijian':row.chukushijian,
'jingbanren':row.jilurenyuan,
'beizhu':row.beizhu,
'baofeiyuanyin':row.baofeiyuanyin,
'link_id':row.id
}
let typeid = ''
let typeObj = JSON.parse(process.env.VUE_APP_OA_URL_TYPE)
for(var k in typeObj){
if(k==this.chukuType){
typeid = parseInt(typeObj[k])
}
}
2 years ago
// let res = await getOatoken()
// = this.chukuType=='领用'?31:(this.chukuType=='处置'?32:33)
// http://suzhouhedaooa.langye.net/admin/flow/create/31?username=admin&default_json={%22bianhao%22:%22100%22}
let url =
2 years ago
`${process.env.VUE_APP_OA_URL}/admin/flow/create/${typeid}?wuziguanli_oatoken=${this.wuziguanli_oatoken}&username=${this.userName}&default_json=${JSON.stringify(default_json)}`
let seeBuy = window.open(url, 'follow',
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
)
2 years ago
console.log(url)
3 years ago
},
deleteChuku(row) {
3 years ago
// return
destroy({
id: row.id,
2 years ago
table_name: 'outbounds',
destroy_relation:['id_outbounds_items_outbounds_id_relation'],
3 years ago
}).then(res => {
Message({
type: 'success',
message: '删除成功'
})
this.getindex()
})
},
},
3 years ago
mounted() {
if(this.$route.path){
let path = this.$route.path.split("_")[1]
3 years ago
this.chukuType = path=='receive'?'领用':(path=='disposition'?'处置':'应急')
let tableName = path=='receive'?'lingyongchuku':(path=='disposition'?'baofeichuzhi':'yingjichuku')
getOutboundsStatus({
table:tableName
})
}
this.window.width = screen.availWidth * 0.95
this.window.height = screen.availHeight * 0.95
this.window.top = (window.screen.height - 30 - this.window.height) / 2
this.window.left = (window.screen.width - 10 - this.window.width) / 2
this.getUserName()
2 years ago
this.getindex()
getOatoken().then(res=>{
this.wuziguanli_oatoken =res.oatoken
})
3 years ago
}
}
</script>
<style scoped lang="scss">
</style>