Browse Source

盘点需求更新

master
xuhuajiao 4 weeks ago
parent
commit
7fe356342e
  1. 223
      src/views/assetManage/stocktaking/index.vue

223
src/views/assetManage/stocktaking/index.vue

@ -2,26 +2,6 @@
<div class="app-container row-container">
<div class="head-container">
<div v-if="crud.props.searchToggle" class="head-search">
<!-- 搜索 -->
<!-- <el-input
v-model="keyWord"
size="small"
clearable
placeholder="请输入盘点单号搜索"
style="width: 300px;"
class="input-prepend filter-item"
@clear="crud.toQuery"
@keyup.enter.native="crud.toQuery"
>
<el-select slot="prepend" v-model="optionVal" style="width: 92px" @change="searchChange">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-input> -->
<el-input v-model="query.billNo" clearable size="small" placeholder="输入盘点单号搜索" prefix-icon="el-icon-search" style="width: 225px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-select v-model="query.warehouseId" clearable size="small" placeholder="所属仓库" class="filter-item" style="width: 120px" @change="crud.toQuery">
<i slot="prefix" class="iconfont icon-zhuangtai" />
@ -86,7 +66,7 @@
<el-table-column prop="billNo" label="任务编号" min-width="180px" :show-overflow-tooltip="true" />
<!-- <el-table-column prop="stockName" label="任务名称" min-width="150px" />
<el-table-column prop="stockManager" label="负责人" min-width="100px" /> -->
<el-table-column prop="warehouseName" label="所属仓库" min-width="260px" :show-overflow-tooltip="true" />
<el-table-column prop="warehouseName" label="所属仓库" min-width="160px" :show-overflow-tooltip="true" />
<!-- <el-table-column prop="stockExecutor" label="盘点执行人" min-width="120px" /> -->
<el-table-column prop="stockNum" label="总数" min-width="80px" align="right" />
@ -116,7 +96,7 @@
<div>{{ scope.row.takeEnd | parseTime }}</div>
</template>
</el-table-column>
<el-table-column label="操作" min-width="130px">
<el-table-column label="操作" min-width="210px">
<template slot-scope="scope">
<el-button :loading="scope.row.deleteLoading" style="background-color: #F65163; border-color:#F65163; color: #fff;" @click="toDelete(scope.row)">
删除
@ -124,6 +104,9 @@
<el-button :loading="scope.row.settleLoading" style="background-color: #1AAE93; border-color:#1AAE93; color: #fff;" @click="handleSettle(scope.row)">
结算
</el-button>
<el-button :loading="scope.row.exportLoading" @click="handleExport(scope.row)">
导出
</el-button>
</template>
</el-table-column>
</el-table>
@ -259,14 +242,37 @@
</el-table>
<!-- 盘点清单 -->
<div class="inventory-list">
<!-- <div>
<h3>盘点清单</h3>
<h3>盘盈列表</h3>
</div> -->
<ul class="tab-nav">
<li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">盘点清单</li>
<li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">盘盈列表</li>
</ul>
<div style="display: flex; justify-content: space-between; align-items: center;">
<ul class="tab-nav">
<li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">盘点清单</li>
<li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">盘盈列表</li>
</ul>
<div>
<el-select v-if="tabIndex===0" v-model="taskResult" clearable size="small" placeholder="状态" class="filter-item" style="width: 80px" @change="doSearch">
<el-option v-for="item in taskResultOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input
v-model="keyWord"
size="small"
clearable
placeholder="请输入关键字搜索"
style="width: 300px;"
class="input-prepend filter-item"
@keyup.enter.native="doSearch"
@clear="doSearch"
>
<el-select slot="prepend" v-model="optionVal" style="width: 92px">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-input>
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
</div>
<el-table v-loading="inventoryLoading" stripe style="width: 100%;" height="calc(100vh - 460px)" :data="inventoryList">
<el-table-column label="序号" align="center" width="55">
<template slot-scope="scope">
@ -408,7 +414,7 @@ import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
// import { exportFile } from '@/utils/index'
// import qs from 'qs'
import qs from 'qs'
import { mapGetters } from 'vuex'
// user: null, id: null, departmentname: null
@ -452,13 +458,10 @@ export default {
// ]
},
keyWord: '',
optionVal: 'billNo',
optionVal: 'assetMark',
options: [
{ value: 'billNo', label: '盘点单号' },
{ value: 'departmentname', label: '所属部门' }
// { value: 'username', label: '使' },
// { value: 'project', label: '' },
// { value: 'useYear', label: '使' }
{ value: 'assetMark', label: '资产编号' },
{ value: 'assetName', label: '资产名称' }
],
fetchLoading: false,
showFilterList: false,
@ -485,7 +488,15 @@ export default {
warehouseId: '',
status: ''
},
tabIndex: 0
tabIndex: 0,
taskResult: '',
taskResultOptions: [
{ value: 0, label: '未盘' },
{ value: 1, label: '正常' },
{ value: 2, label: '盘亏' }
],
assetMark: '',
assetName: ''
}
},
computed: {
@ -542,6 +553,9 @@ export default {
if (!item.settleLoading) {
this.$set(item, 'settleLoading', false)
}
if (!item.exportLoading) {
this.$set(item, 'exportLoading', false)
}
})
},
//
@ -592,11 +606,6 @@ export default {
searchChange(val) {
if (val) {
this.keyWord = ''
this.options.forEach(option => {
if (option.value !== val) {
this.crud.query[option.value] = null
}
})
}
},
resetQuery() {
@ -604,7 +613,6 @@ export default {
this.query.billNo = ''
this.query.warehouseId = ''
this.query.status = ''
this.crud.toQuery()
},
//
@ -632,6 +640,48 @@ export default {
this.$message({ message: '结算操作失败', type: 'error', offset: 8 })
})
},
handleExport(row) {
row.exportLoading = true
let loadingClosed = false
const params = { id: row.id }
const exportUrl = this.baseApi + '/api/stocktake/exportStockTakeData?' + qs.stringify(params, { indices: false })
const link = document.createElement('a')
link.style.display = 'none'
link.href = exportUrl
document.body.appendChild(link)
link.click()
//
const timer = setTimeout(() => {
if (!loadingClosed) {
loadingClosed = true
row.exportLoading = false
document.body.removeChild(link)
}
}, 1500)
// 3
setTimeout(() => {
if (!loadingClosed) {
clearTimeout(timer)
row.exportLoading = false
}
}, 3000)
},
doSearch() {
if (this.optionVal === 'assetMark') {
this.assetMark = this.keyWord
this.assetName = ''
} else {
this.assetName = this.keyWord
this.assetMark = ''
}
this.inventoryPage = 1
this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
},
toDelete(datas) {
this.$confirm('此操作将删除当前所选盘点任务' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
@ -655,25 +705,6 @@ export default {
}).catch(() => {
})
},
// doExport(data) {
// crud.downloadLoading = true
// this.$confirm('' + '<span></span>', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning',
// dangerouslyUseHTMLString: true
// }).then(() => {
// const ids = []
// data.forEach(val => {
// ids.push(val.fondsId)
// })
// const params = {
// 'fondsIds': ids
// }
// exportFile(this.baseApi + '/api/fonds/download?' + qs.stringify(params, { indices: false }))
// }).catch(() => {
// })
// },
//
// clearCacheDatas(datas) {
// this.$confirm('' + '<span></span>', '', {
@ -694,7 +725,6 @@ export default {
if (isBtn) {
this.fetchLoading = true
}
this.showFilterList = true
const params = {
'departmentname': this.crud.form.departmentname,
@ -711,8 +741,6 @@ export default {
this.$message({ message: '获取数据失败', type: 'error', offset: 8 })
this.fetchLoading = false
})
} else {
return false
}
})
},
@ -728,47 +756,46 @@ export default {
},
//
handleDepartmentChange() {
//
this.currentPage = 1
this.fetchAssetsData()
},
//
handleRowDblClick(row) {
this.tabIndex = 0
this.selectedTask = []
this.selectedTask.push(row)
this.selectedTask = [row]
this.detailDialogVisible = true
this.taskResult = ''
this.assetMark = ''
this.assetName = ''
this.keyWord = ''
this.inventoryPage = 1
this.inventoryPageSize = 10
//
this.fetchInventoryList()
},
changeActiveTab(index) {
this.tabIndex = index
this.inventoryPage = 1 //
this.inventoryPageSize = 10 //
if (this.tabIndex === 1) {
this.getStockTakeSuperfluousByTaskId()
} else {
this.fetchInventoryList()
}
this.inventoryPage = 1
this.taskResult = ''
this.assetMark = ''
this.assetName = ''
this.keyWord = ''
this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
},
//
fetchInventoryList() {
if (!this.selectedTask) return
this.inventoryLoading = true
const params = {
'taskId': this.selectedTask[0].id,
'pageNo': this.inventoryPage,
'pageSize': this.inventoryPageSize
taskId: this.selectedTask[0].id,
pageNo: this.inventoryPage,
pageSize: this.inventoryPageSize,
taskResult: this.taskResult,
assetMark: this.assetMark,
assetName: this.assetName
}
FetchStockTakeDetailsByTaskId(params).then(res => {
console.log('FetchStockTakeDetailsByTaskId', res)
this.inventoryList = res.records
this.inventoryTotal = res.total
this.inventoryLoading = false
}).catch(err => {
console.log(err)
@ -776,19 +803,18 @@ export default {
this.inventoryLoading = false
})
},
//
getStockTakeSuperfluousByTaskId() {
if (!this.selectedTask) return
this.inventoryLoading = true
const params = {
'taskId': this.selectedTask[0].id,
'pageNo': this.inventoryPage,
'pageSize': this.inventoryPageSize
taskId: this.selectedTask[0].id,
pageNo: this.inventoryPage,
pageSize: this.inventoryPageSize,
assetMark: this.assetMark,
assetName: this.assetName
}
FetchStockTakeSuperfluousByTaskId(params).then(res => {
console.log('dd', res.data.records)
this.inventoryList = res.data.records
this.inventoryTotal = res.data.total
this.inventoryLoading = false
@ -802,24 +828,15 @@ export default {
handleInventorySizeChange(size) {
this.inventoryPage = 1
this.inventoryPageSize = size
if (this.tabIndex === 1) {
this.getStockTakeSuperfluousByTaskId()
} else {
this.fetchInventoryList()
}
this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
},
//
handleInventoryCurrentChange(current) {
this.inventoryPage = current
if (this.tabIndex === 1) {
this.getStockTakeSuperfluousByTaskId()
} else {
this.fetchInventoryList()
}
this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
},
//
addStockTakeBill() {
//
this.addLoading = true
add({}).then(res => {
if (res.data === null) {
@ -835,7 +852,6 @@ export default {
this.addLoading = false
})
}
}
}
</script>
@ -939,5 +955,4 @@ export default {
}
}
}
</style>
Loading…
Cancel
Save