Commit 5480e029 by zhangmengqi

Merge branch 'dev'

parents 757811c5 1a81fe50
......@@ -27,7 +27,7 @@
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
<PTVXETable ref="pageTable" :table-height="tableHeight" :icon-msg="iconMsg" :form-id="formId" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
......@@ -105,13 +105,15 @@
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
</div>
</template>
<script>
import http from '../../../api/http'
import { soilEntrust } from '../../../api'
import IndexManage from './IndexManage'
export default {
components: {},
components: { IndexManage },
data() {
return {
formId: 'SoilSampleItemManage',
......@@ -120,7 +122,7 @@ export default {
// { type: 'success', id: '', name: '提交分包' },
{ type: 'success', id: 'ZBC', name: '取消分包' }
],
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }],
iconMsg: [{ type: 'md-apps', id: '', name: '查看指标' }],
sampleId: '', // 样品id
showModal: false,
modalTitle: '管理检测项目',
......@@ -377,25 +379,15 @@ export default {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '导出样品委托协议':
this._exportAgreement(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
case '查看指标':
this._indexManage(data)
break
}
})
},
_indexManage(data) {
this.$refs.indexModal._open(data)
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
......@@ -406,9 +398,9 @@ export default {
this.selectIds = selectIds
this.selectData = data
break
// case 'iconClick':
// this._iconClick(data.name, data.rowData, data.componentName)
// break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'page':
this._page()
break
......
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false" width="600">
<p slot="header">{{modalTitle}}</p>
<div>
<Upload
:action="action"
:show-upload-list="false"
:before-upload="_beupload"
multiple
>
<Button type="dashed" icon="ios-cloud-upload-outline">上传文件(小于50MB)</Button>
</Upload>
<div>
<Card :dis-hover="true" style="width: 100%;height: 400px;overflow: auto;">
<p slot="title">已上传文件列表</p>
<div v-for="(item,index) in fileList" :key="index" class="file-upload-list">
<div>
<div class="file-upload-list-cover">
<Icon @click.native.stop="_handleRemove(item)" type="md-trash" style="color: white;font-size: 20px;"></Icon>
</div>
</div>
{{item.fileName }}
</div>
</Card>
</div>
</div>
<div slot="footer" class="btn-width">
<Button @click="showEditModal = false">取消</Button>
<Button @click="_mutipleUpload" :loading="isLoading" type="primary">{{btnName}}</Button>
</div>
</Modal>
</div>
</template>
<script>
/**
* 上传文件,在文件夹下
*/
import axios from 'axios'
import global from '../../../../api/config'
import loading from '../../../../api/loading'
export default {
data() {
return {
id: '',
ID: '',
action: '',
modalTitle: '',
showEditModal: false,
name: '',
isLoading: false,
btnName: '上传',
fileList: []
}
},
methods: {
_open(obj) {
this.fileList = []
this.showEditModal = true
this.ID = obj
this.modalTitle = '上传文件'
},
_beupload(file) {
// 单个文件上传超过50M时,取消上传
const isLt50M = file.size / 1024 / 1024 < 50
const fileName = file.name.split('.')[0]
if (!isLt50M) {
this.$Message.warning({
content: '文件 ' + fileName + ' 大小超多50M,请重新上传!',
duration: 3
})
this.isLoading = false
} else {
// 动态循环给文件命名
const temObj = {
file: file,
fileName: fileName
}
this.fileList.push(temObj)
}
return false
},
_mutipleUpload() {
if (this.fileList.length > 0 && this.btnName === '上传') {
this.isLoading = true
this.btnName = '上传中...'
// 创建formula对象
const formData = new FormData()
formData.append('entrustId', this.ID)
// 多个文件
for (let i = 0; i < this.fileList.length; i++) {
formData.append('file' + i, this.fileList[i].file)
}
const config = {
headers: {
'Content-Type': 'multipart/form-data'
}
}
const instanceFile = axios.create()
instanceFile.defaults.withCredentials = true
// 发起请求
instanceFile
.post(
global.baseURL +
'/soil/v1/experiment/upload_dynamics_collect/' +
this.ID,
formData,
{
headers: config
}
)
.then(res => {
if (res.data.code === '1') {
this.$Message.success('上传成功!')
this.showEditModal = false
this.$emit('on-result-change')
} else if (res.data.code === '0') {
loading.toast.show(res.data.code, res.data.msg)
this.$Message.error('操作失败')
}
this._resetLoading()
})
.catch(err => {
console.log(err)
this._resetLoading()
})
} else {
this.$Message.warning('请至少上传一个文件')
this._resetLoading()
}
},
_resetLoading() {
this.isLoading = false
this.btnName = '上传'
},
// 删除对应的上传的文件
_handleRemove(data) {
const index = this.fileList.findIndex(item => item === data)
this.fileList.splice(index, 1)
}
}
}
</script>
<style>
.file-upload-list {
display: inline-block;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin-right: 4px;
}
.file-upload-list:hover .file-upload-list-cover {
display: block;
}
.file-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
}
</style>
......@@ -59,6 +59,7 @@
<Reason ref="reasonModal" @on-result-change="_reasonResult" />
<Operation ref="Operation"></Operation>
<importModal ref="importModal"></importModal>
<ItemBatchUpload ref="batchUpload"></ItemBatchUpload>
</div>
</template>
<script>
......@@ -76,6 +77,7 @@ import Reason from '../../../../components/base/Reason'
import Operation from '../../../../components/operation/ItemOperation'
import importModal from '../../../../components/import/GDSImport'
import CreateReport from './CreateReport'
import ItemBatchUpload from './ItemBatchUpload'
export default {
components: {
AssignPerson,
......@@ -89,7 +91,8 @@ export default {
Reason,
CreateReport,
Operation,
importModal
importModal,
ItemBatchUpload
},
data() {
return {
......@@ -141,7 +144,8 @@ export default {
{ type: 'success', id: '', name: '完成提交' },
{ type: 'success', id: '', name: '设备' },
{ type: 'success', id: '', name: '退回' },
{ type: 'success', id: '', name: '导入GDS数据' }
{ type: 'success', id: '', name: '导入GDS数据' },
{ type: 'success', id: '', name: '力学文件上传采集' }
],
iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
......@@ -432,8 +436,17 @@ export default {
case '导入GDS数据':
this._import()
break
case '力学文件上传采集':
this._batchUpload()
break
}
},
_batchUpload() {
this.$refs.batchUpload._open(this.entrustId)
},
_getEntrustId(id) {
this.entrustId = id
},
_import() {
const data = {
importUrl: '/soil/v1/experiment/upload_gds_file/',
......
......@@ -5,7 +5,7 @@
<ItemLeftList ref="leftModal" :rightSelectData =rightSelectData @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="rightModal" @child-data="_rightSelectData" @on-result-change="_rightResult"></ItemRightList>
<ItemRightList ref="rightModal" :entrustIds = id @child-data="_rightSelectData" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
......@@ -49,6 +49,7 @@ export default {
_open(id) {
this.id = id
this.$refs.leftModal._open(this.id)
this.$refs.rightModal._getEntrustId(this.id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment