|
|
@@ -56,19 +56,19 @@
|
|
|
>
|
|
|
<el-table-column type="selection" width="40"> </el-table-column>
|
|
|
<el-table-column label="缩略图" width="146">
|
|
|
- <template #default>
|
|
|
+ <template #default='{row}'>
|
|
|
<div class="smimg">
|
|
|
- <img src="../../assets/img/user.png" alt="" />
|
|
|
+ <img :src="baseURL+row.thumb" alt="" />
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="总登记号" width="235">
|
|
|
+ <el-table-column prop="registerNum" label="总登记号" width="235">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="address" label="藏品名称">
|
|
|
+ <el-table-column prop="name" label="藏品名称">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="类别" width="130">
|
|
|
+ <el-table-column prop="goodsTypeName" label="类别" width="130">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="完残程度" width="220">
|
|
|
+ <el-table-column prop="integrity" label="完残程度" width="220">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="藏品位置" width="230">
|
|
|
<template #default>
|
|
|
@@ -84,17 +84,19 @@
|
|
|
</div>
|
|
|
<!-- 最下面的2个按钮 -->
|
|
|
<div class="bot_btn">
|
|
|
- <el-button type="primary">提 交</el-button>
|
|
|
- <el-button @click="$router.go(-1)">返 回</el-button>
|
|
|
+ <el-button type="primary" @click="submit">提 交</el-button>
|
|
|
+ <el-button @click="goBack">返 回</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 点击添加出现弹窗 -->
|
|
|
- <Holding1Dialog :dialogFormVisible.sync="isShow" ref="myDialog" :bigId='mydata.id'/>
|
|
|
+ <Holding1Dialog :dialogFormVisible.sync="isShow" ref="myDialog" @getSonList='getSonList'/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { holding1submit } from '@/apis/holding1'
|
|
|
+import axios from '@/utils/request'
|
|
|
import TabList from '@/components/tabLeft.vue'
|
|
|
import Holding1Dialog from './holding1_Dialog.vue'
|
|
|
export default {
|
|
|
@@ -105,6 +107,10 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ // 处理从子组件拿到的数据的id集合数组
|
|
|
+ goodsIds: [],
|
|
|
+ // 服务器前缀地址
|
|
|
+ baseURL: '',
|
|
|
mydata: {},
|
|
|
value: [],
|
|
|
options: [{
|
|
|
@@ -314,7 +320,7 @@ export default {
|
|
|
rules: {
|
|
|
number: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
people: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
- textarea: [{ max: 255, message: '不能超过255个字符', trigger: 'blur' }]
|
|
|
+ textarea: [{ required: true, message: '不能为空', trigger: 'blur' }, { max: 255, message: '不能超过255个字符', trigger: 'blur' }]
|
|
|
},
|
|
|
// 表格数据
|
|
|
tableData: []
|
|
|
@@ -323,9 +329,31 @@ export default {
|
|
|
// 监听属性 类似于data概念
|
|
|
computed: {},
|
|
|
// 监控data中的数据变化
|
|
|
- watch: {},
|
|
|
+ watch: {
|
|
|
+ isShow (val) {
|
|
|
+ // if (!val) {
|
|
|
+ // console.log(77777)
|
|
|
+ // this.getSonList()
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ },
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ // 从子组件哪里拿到选中的数据
|
|
|
+ getSonList (data) {
|
|
|
+ // console.log(666, data)
|
|
|
+ this.tableData = data
|
|
|
+ this.tableData.forEach(v => {
|
|
|
+ v.integrity = this.spoil(v.integrity)
|
|
|
+ })
|
|
|
+ const temp = []
|
|
|
+ data.forEach(v => {
|
|
|
+ temp.push(v.id)
|
|
|
+ })
|
|
|
+ const temp2 = new Set(temp)
|
|
|
+ this.goodsIds = [...temp2]
|
|
|
+ // console.log(999, this.goodsIds)
|
|
|
+ },
|
|
|
// 多层选择器的事件
|
|
|
handleChange (value) {
|
|
|
console.log(value)
|
|
|
@@ -335,11 +363,44 @@ export default {
|
|
|
// 调用子组件方法
|
|
|
this.$refs.myDialog.getListTow({ pageNum: 1, pageSize: 10 })
|
|
|
this.isShow = true
|
|
|
+ },
|
|
|
+ // 点击返回
|
|
|
+ goBack () {
|
|
|
+ const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: null }
|
|
|
+ // console.log(666, obj)
|
|
|
+ this.$confirm('您需要保存这条数据吗?', '提示', {
|
|
|
+ confirmButtonText: '保存',
|
|
|
+ cancelButtonText: '放弃',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ // 发请求
|
|
|
+ this.fromData.status = null
|
|
|
+ await holding1submit(obj)
|
|
|
+ this.$router.push('/layout/holding1')
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '保存成功!'
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$router.push('/layout/holding1')
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '放弃保存.'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击提交
|
|
|
+ async submit () {
|
|
|
+ const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: 1 }
|
|
|
+ await holding1submit(obj)
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.$router.push('/layout/holding1')
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created () {
|
|
|
+ // 获取服务器前缀地址
|
|
|
+ this.baseURL = axios.defaults.baseURL
|
|
|
// 从第一层拿到传过来的数据
|
|
|
this.mydata = this.$route.query
|
|
|
this.mydata.id = Number(this.mydata.id)
|