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.

346 lines
11 KiB

3 years ago
<template>
2 years ago
<div>
6 months ago
<div class="button-wrap">
<Button type="primary" @click="editorChuku('','add','领用')"></Button>
<Button type="primary" @click="editorChuku('','add','处置')"></Button>
6 months ago
<Button type="primary" @click="editorChuku('','add','调令')"></Button>
6 months ago
</div>
3 years ago
<div ref="lxHeader">
6 months ago
<lx-header icon="md-apps" :text="`出库管理`" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
3 years ago
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
6 months ago
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="经办人搜索" />
<Select v-model="select.chukuleixing" style="width: 200px;margin-right: 10px;" placeholder="出库类型" clearable>
<Option v-for="item in chukuTypeList" :key="item.id" :value="item.id">{{ item.value }}</Option>
</Select>
3 years ago
<Button type="primary" @click="getindex"></Button>
3 years ago
</div>
</slot>
</lx-header>
</div>
6 months ago
<xy-table
v-loading="loading"
:list="list"
:total="total"
:table-item="table"
@pageSizeChange="e => select.pageSize = e"
@pageIndexChange="pageChange"
>
3 years ago
<template v-slot:btns>
6 months ago
<el-table-column fixed="right" label="操作" width="300" header-align="center">
2 years ago
<template slot-scope="scope">
2 years ago
<template v-if="isCkName=='仓库管理员'||roleName=='系统管理员'">
6 months ago
<Button v-if="scope.row.zhuangtai===&quot;已办结&quot;" type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'outbounds')"></Button>
2 years ago
</template>
2 years ago
<template v-if="scope.row.jilurenyuan==authName||isCkName=='仓库管理员'||roleName=='系统管理员'">
6 months ago
<Button type="primary" size="small" style="margin-left: 10px;" @click="printChuku(scope.row.id,scope.row.chukuleixing)"></Button>
6 months ago
<!-- <template v-if="scope.row.jilurenyuan==authName||roleName=='系统管理员'"> -->
6 months ago
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'editor',scope.row.chukuleixing)"></Button>
6 months ago
<Button v-if="scope.row.zhuangtai===&quot;待处理&quot;" type="primary" size="small" style="margin-left: 10px;" @click="tofollow(scope.row.id,scope.row)"></Button>
2 years ago
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteChuku(scope.row)">
6 months ago
<Button type="error" style="margin-left: 10px;" size="small" ghost>删除</Button>
2 years ago
</Poptip>
2 years ago
<!-- </template> -->
2 years ago
</template>
3 years ago
</template>
</el-table-column>
</template>
</xy-table>
6 months ago
<addoutbounds ref="addoutbounds" @refresh="getindex" />
<printoutbounds ref="printoutbounds" @refresh="getindex" />
<imports ref="imports" :table-name="customForm.tableName" :form-info="form" @refresh="getindex" />
3 years ago
</div>
</template>
<script>
6 months ago
import {
index,
destroy
} from '@/api/system/baseForm.js'
import {
getInfo
} from '@/api/user.js'
import {
getOutboundsStatus,
getOatoken
} from '@/api/contract.js'
import addoutbounds from './component/addoutbounds.vue'
import printoutbounds from './component/printoutbounds.vue'
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
},
data() {
return {
window: {
width: 0,
height: 0,
top: 0,
left: 0
},
loading: false,
userName: '',
authName: '',
roleName: '',
isCkName: '',
select: {
pageSize: 10,
pageIndex: 1,
keyword: '',
chukuleixing: ''
},
chukuTypeList: [{
id: '领用',
value: '领用出库'
}, {
id: '处置',
value: '处置出库'
}, {
id: '调令',
value: '调令出库'
}],
chukuType: '领用',
customForm: {
customFormId: '',
tableName: ''
},
wuziguanli_oatoken: '',
form: [],
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80
}, {
label: '出库日期',
width: 180,
prop: 'chukushijian',
align: 'center',
fixed: 'left'
},
{
label: '状态',
width: 180,
prop: 'zhuangtai',
align: 'center'
},
{
label: '出库类型',
width: 180,
prop: 'chukuleixing',
align: 'center'
},
6 months ago
{
label: '借用仓库',
width: 180,
prop: 'jieyongcangku',
align: 'center'
3 years ago
},
6 months ago
{
label: '借用部门',
width: 180,
prop: 'jieyongbumen',
align: 'center'
3 years ago
},
6 months ago
{
label: '经办人',
width: 180,
prop: 'jilurenyuan',
align: 'center'
},
6 months 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
}
}
3 years ago
},
6 months ago
{
label: '备注',
prop: 'beizhu',
align: 'left'
}
]
}
},
mounted() {
if (this.$route.path) {
const path = this.$route.path.split('_')[1]
const 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()
this.getindex()
getOatoken().then(res => {
this.wuziguanli_oatoken = res.oatoken
})
},
methods: {
async getUserName() {
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
}
if (k.name == '仓库管理员') {
this.isCkName = '仓库管理员'
}
}
}).catch(error => {})
},
async getindex() {
this.loading = true
const res = await index({
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: 'outbounds',
filter: [{ 'key': 'jilurenyuan', 'op': 'like', 'value': this.select.keyword },
{ 'key': 'chukuleixing', 'op': 'like', 'value': this.select.chukuleixing ? this.select.chukuleixing : '' }]
})
this.list = res.data
this.total = res.total
this.loading = false
},
pageChange(e) {
this.select.pageIndex = e
this.getindex()
3 years ago
},
6 months ago
editorChuku(id, type, leixing) {
if (id) {
this.$refs['addoutbounds'].id = id
}
this.$refs['addoutbounds'].authName = this.authName
this.$refs['addoutbounds'].isShow = true
this.$refs['addoutbounds'].type = type
this.$refs['addoutbounds'].chukuType = leixing
},
// 打印
printChuku(id, leixing) {
this.$refs['printoutbounds'].id = id
this.$refs['printoutbounds'].chukuType = leixing
this.$refs['printoutbounds'].isShow = true
},
async tofollow(id, row) {
console.log(row)
if (row.id_outbounds_items_outbounds_id_relation.length < 1) {
Message({
type: 'warning',
message: '请补充出库物资'
})
6 months ago
return
}
6 months ago
console.log(row)
// return
let wuzimingcheng = ''
let shuliang = ''
let guigexinghao = ''
row.id_outbounds_items_outbounds_id_relation.map(item => {
wuzimingcheng += item.zichanmingcheng + '、'
shuliang += item.jieyongshuliang + '、'
guigexinghao += item.guigexinghao + '、'
2 years ago
})
6 months ago
const default_json = {
// '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,
'wuzimingcheng': wuzimingcheng,
'shuliang': shuliang,
'xinghaoguige': guigexinghao,
'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 = ''
const typeObj = JSON.parse(process.env.VUE_APP_OA_URL_TYPE)
for (var k in typeObj) {
if (k == row.chukuleixing) {
typeid = parseInt(typeObj[k])
}
}
// 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}
const url =
`${process.env.VUE_APP_OA_URL}/admin/flow/create/${typeid}?wuziguanli_oatoken=${this.wuziguanli_oatoken}&username=${this.userName}&default_json=${JSON.stringify(default_json)}`
const seeBuy = window.open(url, 'follow',
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
)
console.log(url)
},
deleteChuku(row) {
// return
destroy({
id: row.id,
table_name: 'outbounds',
destroy_relation: ['id_outbounds_items_outbounds_id_relation']
}).then(res => {
Message({
type: 'success',
message: '删除成功'
})
this.getindex()
})
3 years ago
}
}
6 months ago
}
</script>
6 months ago
<style scoped lang="scss">
.button-wrap{
button{
margin-right:10px;
}
}
3 years ago
</style>