|
|
@@ -33,7 +33,7 @@
|
|
|
<!-- 表格 -->
|
|
|
<div class="table">
|
|
|
<div class="title">
|
|
|
- <h3>藏品信息<el-button >归 还</el-button></h3>
|
|
|
+ <h3>藏品信息<el-button @click="goodsReturn">归 还</el-button></h3>
|
|
|
</div>
|
|
|
<el-table
|
|
|
@selection-change="handleSelectionChange"
|
|
|
@@ -63,7 +63,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="status" label="状态" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="出库位置" width="300">
|
|
|
+ <el-table-column prop="outPath" label="出库位置" width="300">
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
@@ -77,11 +77,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getDetailById } from '@/apis/holding2'
|
|
|
+import { getDetailById, goodsReturn } from '@/apis/holding2'
|
|
|
import axios from '@/utils/request'
|
|
|
import TabList from '@/components/tabLeft.vue'
|
|
|
export default {
|
|
|
- name: 'holding2_result',
|
|
|
+ name: 'holding2_look',
|
|
|
components: { TabList },
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
@@ -89,6 +89,8 @@ export default {
|
|
|
myData: {},
|
|
|
// 服务器初始地址前缀
|
|
|
baseURL: '',
|
|
|
+ // 小商品id集合数组
|
|
|
+ goodsIds: [],
|
|
|
// 点击查看显示弹窗
|
|
|
isShow: false,
|
|
|
fromData: {
|
|
|
@@ -116,31 +118,63 @@ export default {
|
|
|
]
|
|
|
return list.filter(v => id === v.id)[0].name
|
|
|
},
|
|
|
+ // 点击归还
|
|
|
+ goodsReturn () {
|
|
|
+ if (this.goodsIds.length === 0) return this.$message.warning('至少选中一个!')
|
|
|
+ this.$confirm('确定归还吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ const obj = { id: Number(this.myData.id), goodsIds: this.goodsIds.join(',') }
|
|
|
+ const res = await goodsReturn(obj)
|
|
|
+ // console.log(99999, res)
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ this.getDetailById()
|
|
|
+ } else this.$message.error('错误')
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
// 表格的多选
|
|
|
handleSelectionChange (rows) {
|
|
|
- console.log(333, rows)
|
|
|
+ // console.log(333, rows)
|
|
|
+ const temp = []
|
|
|
+ rows.forEach(v => {
|
|
|
+ temp.push(v.id)
|
|
|
+ })
|
|
|
+ const temp2 = new Set(temp)
|
|
|
+ this.goodsIds = [...temp2]
|
|
|
},
|
|
|
selectable (row, index) {
|
|
|
- console.log(row.status)
|
|
|
+ // console.log(row.status)
|
|
|
if (row.status === '已归还') return false
|
|
|
else return true
|
|
|
+ },
|
|
|
+ // 封装通过ID获取详情方法
|
|
|
+ async getDetailById () {
|
|
|
+ const res = await getDetailById(this.myData.id)
|
|
|
+ this.tableData = res.data.goods
|
|
|
+ this.tableData.forEach(v => {
|
|
|
+ v.integrity = this.spoil(v.integrity)
|
|
|
+ v.goodsTypeId = this.category(v.goodsTypeId)
|
|
|
+ v.status = this.myStatus(v.status)
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created () {},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- async mounted () {
|
|
|
+ mounted () {
|
|
|
// 获取服务器前缀地址
|
|
|
this.baseURL = axios.defaults.baseURL
|
|
|
// 从第一层拿到传过来的数据
|
|
|
this.myData = this.$route.query
|
|
|
- const res = await getDetailById(this.myData.id)
|
|
|
- this.tableData = res.data.goods
|
|
|
- this.tableData.forEach(v => {
|
|
|
- v.integrity = this.spoil(v.integrity)
|
|
|
- v.goodsTypeId = this.category(v.goodsTypeId)
|
|
|
- v.status = this.myStatus(v.status)
|
|
|
- })
|
|
|
+ this.getDetailById()
|
|
|
},
|
|
|
beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
beforeMount () {}, // 生命周期 - 挂载之前
|