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.

392 lines
12 KiB

<template>
<div>
<div class="button-wrap" v-if="roleName=='系统管理员'||isCkName=='仓库管理员'">
<Button type="primary" @click="editorRuku('','add','采购入库')"></Button>
<Button type="primary" @click="editorRuku('','add','请示入库')"></Button>
<Button type="primary" @click="editorRuku('','add','调拨入库')"></Button>
<Button type="primary" @click="editorRuku('','add','盘点入库')"></Button>
<Button type="primary" @click="editorRuku('','add','归还入库')"></Button>
</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 v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="经办人搜索" />
<Select v-model="select.rukuleixing" style="width: 200px;margin-right: 10px;" placeholder="入库类型" clearable>
<Option v-for="item in rukuTypeList" :key="item.id" :value="item.id">{{ item.value }}</Option>
</Select>
<Select v-model="select.zhuangtai" style="width: 200px;margin-right: 10px;" placeholder="状态" clearable>
<Option v-for="item in statusList" :key="item.id" :value="item.id">{{ item.value }}</Option>
</Select>
<Button type="primary" @click="getindex">查询</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:guanlianjilu>
<el-table-column label="关联记录" width="260" header-align="left">
<template slot-scope="scope">
<div v-for="item in rukuTypeList">
<div v-if="scope.row.rukuleixing===item.id">
{{ item.prop?scope.row[item.prop]:'' }}
</div>
</div>
</template>
</el-table-column>
</template> -->
<template v-slot:zhuangtai>
<el-table-column label="状态" width="120" align="center" header-align="center">
<template slot-scope="scope">
<div v-for="item in statusList">
<el-tag :type="item.type" v-if="scope.row.zhuangtai==item.id">
{{ item.value }}
</el-tag>
</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column label="操作" width="240" header-align="center">
<!-- 1 盘点 和 归还不用发起流程 不用确认入库 -->
<!-- 2 待处理 或 退回 可编辑 -->
<!-- 3 待处理 可删除 -->
<!-- 4 退回 或 待处理 可发起流程 -->
<!-- 5 待入库 可确认入库 -->
<!-- 6 已入库 只有查看 -->
<template slot-scope="scope">
<div v-if="roleName=='系统管理员'||isCkName=='仓库管理员'">
<template v-if="scope.row.zhuangtai===3 || scope.row.zhuangtai===1">
<Button style="margin-right: 10px;" type="primary" size="small"
@click="showRukuDetail(scope.row.id)">查看</Button>
</template>
<template v-else>
<Button v-if="scope.row.zhuangtai===0 || scope.row.zhuangtai===4" style="margin-right: 10px;"
type="primary" size="small"
@click="editorRuku(scope.row.id,'editor',scope.row.rukuleixing)">编辑</Button>
<Button v-if="scope.row.zhuangtai===0 || scope.row.zhuangtai===4" style="margin-right: 10px;"
type="primary" size="small" @click="toOaFollow(scope.row,scope.row.rukuleixing)">发起流程</Button>
<Button v-if="scope.row.zhuangtai===2" style="margin-right: 10px;" type="primary" size="small"
@click="showRukuDetail(scope.row.id)">确认入库</Button>
<Poptip v-if="scope.row.zhuangtai===0" transfer confirm title="确认要删除该入库记录?入库明细将一同删除。"
@on-ok="deleteRuku(scope.row)">
<Button type="error" size="small" ghost>删除</Button>
</Poptip>
</template>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addRuku ref="addRuku" @refresh="getindex" />
<showRuku ref="showRuku" @refresh="getindex"></showRuku>
<imports ref="imports" :table-name="customForm.tableName" :form-info="form" @refresh="getindex" />
</div>
</template>
<script>
import {
index,
destroy
} from '@/api/system/baseForm.js'
import addRuku from './component/addRuku.vue'
import showRuku from './component/showRuku.vue'
import {
delStock
} from '@/api/stocks.js'
import {
getOatoken
} from '@/api/contract.js'
import {
Message
} from 'element-ui'
import {
getInfo
} from '@/api/user.js'
import imports from '@/views/component/imports.vue'
import {
index as fieldIndex
} from '@/api/system/customFormField'
import {
getparameter
} from '@/api/system/dictionary'
export default {
components: {
addRuku,
imports,
showRuku
},
data() {
return {
authName: '',
roleName: '',
isCkName: '',
wuziguanli_oatoken: '',
loading: false,
select: {
pageSize: 10,
pageIndex: 1,
keyword: '',
rukuleixing: '',
zhuangtai: ''
},
rukuTypeList: [{
id: '采购入库',
value: '采购入库',
prop: 'caigouhetong'
}, {
id: '请示入库',
value: '请示入库',
prop: 'qingshiliucheng'
}, {
id: '调拨入库',
value: '调拨入库',
}, {
id: '盘点',
value: '盘点入库'
}, {
id: '回库',
value: '归还入库'
}],
statusList: [{
id: 0,
value: '待处理',
type: 'info'
}, {
id: 1,
value: '待办结',
type: 'warning'
}, {
id: 2,
value: '待入库',
type: ''
}, {
id: 3,
value: '已入库',
type: 'success'
}, {
id: 4,
value: '退回',
type: 'danger'
}],
// rukuTypeList:{
// purchase:'采购',
// return:'回库',
// check:'盘点',
// data:"数据校对",
// mock:'模拟盘点',
// ask:'请示',
// yingji:'应急采购'
// },
customForm: {
customFormId: '',
tableName: 'stocks'
},
form: [],
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80
},
{
label: '入库日期',
width: 120,
prop: 'rukushijian',
align: 'center',
formatter: (cell, data, value) => {
return value ? value.substring(0, 10) : ''
}
},
{
label: '入库类型',
width: 120,
prop: 'rukuleixing',
align: 'center'
},
{
label: '状态',
width: 120,
prop: 'zhuangtai',
align: 'center'
},
// {
// label: '关联记录',
// width: 240,
// prop: 'guanlianjilu',
// align: 'left'
// },
{
label: '经办人',
width: 120,
prop: 'jingbanren',
align: 'center'
},
// {
// label: '记录人',
// width: 120,
// prop: 'jilurenyuan',
// align: 'center'
// },
// {
// label: '保管人',
// width: 120,
// prop: 'baoguanrenyuan',
// align: 'center'
// },
// {
// label: "固定资产编号",
// width: 180,
// prop: 'gudingzichanbianhao',
// align: 'center'
// },
{
label: '备注',
// width: 240,
prop: 'beizhu',
align: 'left'
}
]
}
},
mounted() {
if(this.$route.query.oaType==='wuzi'){
this.editorRuku('','add',this.$route.query.rukuType)
}
this.getUserName()
this.getindex()
getOatoken().then(res => {
this.wuziguanli_oatoken = res.oatoken
})
},
methods: {
async getUserName() {
getInfo().then(res => {
for (var k of res.role) {
if (k.name == '系统管理员') {
this.roleName = k.name
}
if (k.name == '仓库管理员') {
this.isCkName = '仓库管理员'
}
}
this.authName = res.name
}).catch(error => {})
},
async getindex() {
this.loading = true
const res = await index({
page_size: this.select.pageSize,
page: this.select.pageIndex,
table_name: 'stocks',
filter: [{
'key': 'jingbanren',
'op': 'like',
'value': this.select.keyword
},
{
'key': 'rukuleixing',
'op': 'eq',
'value': this.select.rukuleixing ? this.select.rukuleixing : ''
},
{
'key': 'zhuangtai',
'op': 'like',
'value': this.select.zhuangtai ? this.select.zhuangtai : (this.select.zhuangtai === 0 ? 0 : '')
}
]
})
this.list = res.data
this.total = res.total
this.loading = false
},
pageChange(e) {
this.select.pageIndex = e
this.getindex()
},
editorRuku(id, type, rukuleixing) {
if (id) {
this.$refs['addRuku'].id = id
}
this.$refs['addRuku'].type = type
this.$refs['addRuku'].authName = this.authName
this.$refs['addRuku'].rukuType = rukuleixing
this.$refs['addRuku'].isShow = true
},
// 查看 或者确认入库
showRukuDetail(id) {
this.$refs['showRuku'].id = id
this.$refs['showRuku'].isShow = true
},
// 发起流程
toOaFollow(res, type) {
let typeid = ''
const typeObj = JSON.parse(process.env.VUE_APP_OA_URL_TYPE)
console.log("typeObj", typeObj, type)
for (var k in typeObj) {
if (k == type) {
typeid = parseInt(typeObj[k])
}
}
let default_json = {
stocks_id:res.id,
xiangguanliucheng:res.xiangguanliucheng,
// xiangguanliucheng:res.link_id,
rukuriqi:res.rukushijian,
jingbanren:res.jingbanren,
jiluren:res.jilurenyuan,
baoguanren:res.baoguanrenyuan,
remark:res.beizhu,
huowudan:res.zuozhengwenjian.join(",")
}
const url =
`${process.env.VUE_APP_OA_URL}/admin/flow/create/${typeid}?wuziguanli_oatoken=${this.wuziguanli_oatoken}&stocks_id=${res.id}&default_json=${JSON.stringify(default_json)}`
const seeBuy = window.open(url, '_blank')
if(this.$route.query.oaType==='wuzi'){
window.history.back()
}
},
deleteRuku(row) {
console.log(row.id)
// return
delStock({
id: row.id,
// table_name: this.customForm.tableName,
// destroy_relation: ['id_stocks_item_links_stocks_id_relation', 'id_stocks_items_stocks_id_relation']
}).then(res => {
Message({
type: 'success',
message: '删除成功'
})
this.getindex()
})
}
}
}
</script>
<style scoped lang="scss">
.button-wrap {
button {
margin-right: 10px;
}
}
</style>