|
|
@@ -0,0 +1,371 @@
|
|
|
+<!-- -->
|
|
|
+<template>
|
|
|
+ <div class="holdingAdd">
|
|
|
+ <TabList :ind='2'/>
|
|
|
+ <div class="right">
|
|
|
+ <div class="top">
|
|
|
+ <el-breadcrumb separator="/">
|
|
|
+ <!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> -->
|
|
|
+ <el-breadcrumb-item to="">首页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item to="">征集品管理</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>征集品注销</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item id="mytitle">{{mydata.description?'编辑':'新增'}}</el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ </div>
|
|
|
+ <div class="conten">
|
|
|
+ <el-form
|
|
|
+ :model="fromData"
|
|
|
+ :rules="rules"
|
|
|
+ ref="fromData"
|
|
|
+ label-width="140px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <div class="one_row">
|
|
|
+ <el-form-item label="注销编号:" prop="number" style="width: 45%">
|
|
|
+ <el-input v-model="fromData.number" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登记人员:" prop="people" style="width: 45%">
|
|
|
+ <el-input v-model="fromData.people" disabled></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="one_row">
|
|
|
+ <el-form-item label="注销说明:" prop='textarea' style="width: 90%">
|
|
|
+ <el-input type="textarea" :rows="3" v-model="fromData.textarea"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <!-- 藏品信息 -->
|
|
|
+ <div class="info">
|
|
|
+ <div class="title">
|
|
|
+ <h3>藏品信息</h3>
|
|
|
+ <div class="btn">
|
|
|
+ <el-button size="small" @click="addObject">添 加</el-button>
|
|
|
+ <el-button size="small" @click="deleteS">删 除</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--表格 -->
|
|
|
+ <div class="table">
|
|
|
+ <el-table
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
|
|
|
+ :data="tableData"
|
|
|
+ border
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="40"> </el-table-column>
|
|
|
+ <el-table-column label="缩略图" width="146">
|
|
|
+ <template #default='{row}'>
|
|
|
+ <div class="smimg">
|
|
|
+ <img :src="baseURL+row.thumb" alt="" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="registerNum" label="总登记号" width="235">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="藏品名称">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="goodsTypeId" label="类别" width="180">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="integrity" label="完残程度" width="130">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="age" label="藏品年代" width="180">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="120">
|
|
|
+ <template #default='{row}'>
|
|
|
+ <el-button type="text" @click="myLook(row)">查 看</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 最下面的2个按钮 -->
|
|
|
+ <div class="bot_btn">
|
|
|
+ <el-button type="primary" @click="submit">提 交</el-button>
|
|
|
+ <el-button @click="goBack">返 回</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 点击添加出现弹窗 -->
|
|
|
+ <Collect2Dialog :dialogFormVisible.sync="isShow5" ref="myDialog" @getSonList='getSonList' :myTemp='myTemp'/>
|
|
|
+ <!-- 点击查看显示弹窗 -->
|
|
|
+ <Holding0AuditDia :dialogFormVisible.sync='isShow' :myObj='myObj' ref="mylook"/>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Holding0AuditDia from '../holding/holding0_audit_Dia.vue'
|
|
|
+import { holding1submit, getDetailById } from '@/apis/collect2'
|
|
|
+import axios from '@/utils/request'
|
|
|
+import TabList from '@/components/tabLeft2.vue'
|
|
|
+import Collect2Dialog from './collect2_Dialog.vue'
|
|
|
+export default {
|
|
|
+ name: 'collect2Add',
|
|
|
+ components: {
|
|
|
+ Collect2Dialog,
|
|
|
+ TabList,
|
|
|
+ Holding0AuditDia
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ // 传给查看弹窗的数据
|
|
|
+ myObj: {},
|
|
|
+ // 手动输入的每个藏品位置
|
|
|
+ // location: [],
|
|
|
+ locations: {},
|
|
|
+ // 传递给弹窗的表格数据,用来筛选
|
|
|
+ myTemp: [],
|
|
|
+ // 处理从子组件拿到的数据的id集合数组
|
|
|
+ goodsIds: [],
|
|
|
+ // 服务器前缀地址
|
|
|
+ baseURL: '',
|
|
|
+ mydata: {},
|
|
|
+ // 控制弹出层显示隐藏
|
|
|
+ isShow5: false,
|
|
|
+ isShow: false,
|
|
|
+ // 表单数据
|
|
|
+ fromData: {
|
|
|
+ number: '',
|
|
|
+ people: '',
|
|
|
+ textarea: ''
|
|
|
+ },
|
|
|
+ // 表单验证
|
|
|
+ rules: {
|
|
|
+ number: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
+ people: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
|
|
+ textarea: [{ required: true, message: '不能为空', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ // 表格数据
|
|
|
+ tableData: [],
|
|
|
+ // 表格选中后的暂存数据
|
|
|
+ delArr: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听属性 类似于data概念
|
|
|
+ computed: {},
|
|
|
+ // 监控data中的数据变化
|
|
|
+ watch: {
|
|
|
+ },
|
|
|
+ // 方法集合
|
|
|
+ methods: {
|
|
|
+ // 点击查看
|
|
|
+ myLook (val) {
|
|
|
+ this.myObj = val
|
|
|
+ // 调用子组件的方法,获取附件信息
|
|
|
+ this.$refs.mylook.getFileList(val.id, 'video')
|
|
|
+ this.isShow = true
|
|
|
+ },
|
|
|
+ // 从子组件哪里拿到选中的数据
|
|
|
+ getSonList (data) {
|
|
|
+ const temp = []
|
|
|
+ data.forEach(v => {
|
|
|
+ temp.push(v.id)
|
|
|
+ })
|
|
|
+ const temp2 = new Set(temp)
|
|
|
+ this.goodsIds = [...temp2]
|
|
|
+ // console.log(999, this.goodsIds)
|
|
|
+ this.tableData = data
|
|
|
+ this.tableData.forEach(v => {
|
|
|
+ v.integrity = this.spoil(v.integrity)
|
|
|
+ v.goodsTypeId = this.category(v.goodsTypeId)
|
|
|
+ v.numTypeId = this.mycategory(v.numTypeId)
|
|
|
+ v.repair = this.mySave(v.repair)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 多层选择器的事件
|
|
|
+ handleChange (value) {
|
|
|
+ console.log(value)
|
|
|
+ },
|
|
|
+ // 表格的多选
|
|
|
+ handleSelectionChange (val) {
|
|
|
+ this.delArr = val
|
|
|
+ },
|
|
|
+ // 点击删除
|
|
|
+ deleteS () {
|
|
|
+ if (this.delArr.length === 0) return this.$message.warning('至少选中一条!')
|
|
|
+ this.$confirm('确定删除吗?', '提示', {
|
|
|
+ confirmButtonText: '删除',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ const temp = this.goodsIds
|
|
|
+ this.delArr.forEach((v) => {
|
|
|
+ // 删除数据,刷新页面
|
|
|
+ this.tableData.forEach((item, index) => {
|
|
|
+ // eslint-disable-next-line
|
|
|
+ if (v.id == item.id) this.tableData.splice(index, 1)
|
|
|
+ })
|
|
|
+ // 改变发请求id
|
|
|
+ temp.forEach((item, index) => {
|
|
|
+ // eslint-disable-next-line
|
|
|
+ if (v.id == item) temp.splice(index, 1)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.goodsIds = temp
|
|
|
+ // console.log(99999, this.goodsIds)
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消.'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击添加
|
|
|
+ addObject () {
|
|
|
+ // 把当前表格的数据传递过去,防止重复选择
|
|
|
+ this.myTemp = this.tableData
|
|
|
+ // 调用子组件方法
|
|
|
+ this.$refs.myDialog.getListTow({ pageNum: 1, pageSize: 99999 })
|
|
|
+ this.isShow5 = true
|
|
|
+ },
|
|
|
+ // 点击返回
|
|
|
+ goBack () {
|
|
|
+ const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: null }
|
|
|
+ this.$confirm('您需要保存这条数据吗?', '提示', {
|
|
|
+ confirmButtonText: '保存',
|
|
|
+ cancelButtonText: '放弃',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ if (this.fromData.textarea.trim() === '') return this.$message.warning('注销说明不能为空')
|
|
|
+ // 发请求
|
|
|
+ await holding1submit(obj)
|
|
|
+ this.$router.push('/layout/collect2')
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '保存成功!'
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$router.push('/layout/collect2')
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '放弃保存.'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击提交
|
|
|
+ async submit () {
|
|
|
+ if (this.fromData.textarea.trim() === '') return this.$message.warning('注销说明不能为空')
|
|
|
+
|
|
|
+ const obj = { description: this.fromData.textarea, goodsIds: this.goodsIds.join(','), id: this.mydata.id, status: 1 }
|
|
|
+ // console.log(999, obj)
|
|
|
+ await holding1submit(obj)
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.$router.push('/layout/collect2')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created () {
|
|
|
+ // 获取服务器前缀地址
|
|
|
+ this.baseURL = axios.defaults.baseURL
|
|
|
+ // 从第一层拿到传过来的数据
|
|
|
+ this.mydata = this.$route.query
|
|
|
+ this.mydata.id = Number(this.mydata.id)
|
|
|
+ this.fromData.people = this.mydata.realName
|
|
|
+ this.fromData.number = this.mydata.num
|
|
|
+ this.fromData.textarea = this.mydata.description
|
|
|
+ },
|
|
|
+ // 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ async mounted () {
|
|
|
+ // 如果是编辑
|
|
|
+ if (this.mydata.goodsIds) {
|
|
|
+ // 通过id获取列表详情
|
|
|
+ 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.numTypeId = this.mycategory(v.numTypeId)
|
|
|
+ v.repair = this.mySave(v.repair)
|
|
|
+ })
|
|
|
+
|
|
|
+ this.goodsIds = this.mydata.goodsIds.split(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
+ beforeMount () {}, // 生命周期 - 挂载之前
|
|
|
+ beforeUpdate () {}, // 生命周期 - 更新之前
|
|
|
+ updated () {}, // 生命周期 - 更新之后
|
|
|
+ beforeDestroy () {}, // 生命周期 - 销毁之前
|
|
|
+ destroyed () {}, // 生命周期 - 销毁完成
|
|
|
+ activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang='less' scoped>
|
|
|
+//@import url(); 引入公共css类
|
|
|
+.holdingAdd {
|
|
|
+ /deep/#mytitle > span {
|
|
|
+ font-weight: 800;
|
|
|
+ }
|
|
|
+ display: flex;
|
|
|
+ .right {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .top {
|
|
|
+ padding-left: 35px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ box-shadow: 1px 1px 10px 1px;
|
|
|
+ margin-left: 2px;
|
|
|
+ height: 40px;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .conten {
|
|
|
+ position: relative;
|
|
|
+ padding: 40px 0 0 20px;
|
|
|
+ flex: 1;
|
|
|
+ background-color: #fff;
|
|
|
+ margin: 20px 20px 40px;
|
|
|
+ .one_row {
|
|
|
+ display: flex;
|
|
|
+ justify-content: start;
|
|
|
+ }
|
|
|
+ .tow_row {
|
|
|
+ display: flex;
|
|
|
+ justify-content: start;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ // max-height: 390px;
|
|
|
+ // overflow: auto;
|
|
|
+ width: 86%;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ margin-left: 70px;
|
|
|
+ .title {
|
|
|
+ color: black;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 52px;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 30px;
|
|
|
+ }
|
|
|
+ .table {
|
|
|
+ /deep/.el-table__body-wrapper{
|
|
|
+ max-height: 360px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .smimg {
|
|
|
+ border: 3px solid #ccc;
|
|
|
+ height: 78px;
|
|
|
+ img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .bot_btn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 20px;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 230px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|