|
|
@@ -1,52 +1,29 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-tabs tabPosition="left" v-model="activeName">
|
|
|
+ <el-tabs tabPosition="left" v-model="activeName">
|
|
|
|
|
|
<el-tab-pane label="上传附件" name="first">
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- stripe
|
|
|
- style="width: 100%">
|
|
|
- <el-table-column
|
|
|
- prop="date"
|
|
|
- label="上传日期"
|
|
|
- width="180">
|
|
|
+ <el-table :data="FiletableData" stripe style="width: 100%">
|
|
|
+ <el-table-column prop="date" label="上传日期" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="name"
|
|
|
- label="预览"
|
|
|
- width="180">
|
|
|
+ <el-table-column prop="name" label="预览" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="address"
|
|
|
- label="文件地址">
|
|
|
+ <el-table-column prop="address" label="文件地址">
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
- <el-button size="mini" type="primary">上传附件</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="openfiledialog('1')">上传附件</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="问题附件" name="second">
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- stripe
|
|
|
- style="width: 100%">
|
|
|
- <el-table-column
|
|
|
- prop="date"
|
|
|
- label="上传日期"
|
|
|
- width="180">
|
|
|
+ <el-table :data="QuesFiletableData" stripe style="width: 100%">
|
|
|
+ <el-table-column prop="date" label="上传日期" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="name"
|
|
|
- label="预览"
|
|
|
- width="180">
|
|
|
+ <el-table-column prop="name" label="预览" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="address"
|
|
|
- label="文件地址">
|
|
|
+ <el-table-column prop="address" label="文件地址">
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
- <!--<el-button size="mini" type="primary">点击上传</el-button>-->
|
|
|
- <el-button size="mini" type="primary" @click="datadialogVisible=true">上传问题附件</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="openfiledialog('2')">上传问题附件</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -54,7 +31,7 @@
|
|
|
</el-tabs>
|
|
|
|
|
|
<!--新增、编辑附件信息-->
|
|
|
- <el-dialog title="附件信息" :visible.sync="datadialogVisible" top="5vh">
|
|
|
+ <el-dialog :title="dialogtiltle" :visible.sync="datadialogVisible" top="5vh">
|
|
|
<el-form :model="attachForm" ref="templateform">
|
|
|
<el-form-item label="模板类型" label-width="120px">
|
|
|
<el-select v-model="attachForm.Type" style="width:100%" disabled>
|
|
|
@@ -70,13 +47,9 @@
|
|
|
<el-input type="textarea" v-model="attachForm.Remark" placeholder="请输入附件说明"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="附件地址" prop="FileURL" label-width="120px">
|
|
|
- <el-input v-model="attachForm.FileURL" placeholder="请输入附件地址"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
<el-form-item label="附件上传" prop="TemplateInfo" label-width="120px">
|
|
|
- <el-upload :multiple = "false" action="" :limit="1" ref="refuploadattach"
|
|
|
- :http-request="uploadrequest" class="attach-uploader" :show-file-list="true" :before-upload="beforeAvatarUpload">
|
|
|
+ <el-upload multiple style="margin-top: 10px;" action="" ref="refuploadattach" :http-request="uploadrequest"
|
|
|
+ class="attach-uploader" :before-upload="beforeAvatarUpload">
|
|
|
<i class="el-icon-upload attach-uploader-icon"></i>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
@@ -92,41 +65,127 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ import axios from 'axios'
|
|
|
+ import uploadajax from '@/assets/js/uploadajax.js'
|
|
|
export default {
|
|
|
- data () {
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ authUser: 'authUser'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ name: 'attchlist',
|
|
|
+ props: {
|
|
|
+ DataEntryId: {
|
|
|
+ type: String,
|
|
|
+ default: '0'
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
return {
|
|
|
+ dialogtiltle: "",
|
|
|
service_flag: 'add',
|
|
|
datadialogVisible: false,
|
|
|
activeName: 'first',
|
|
|
attachForm: {
|
|
|
+ DataEntryId: '',
|
|
|
Id: 0,
|
|
|
Name: '',
|
|
|
Remark: '',
|
|
|
FileURL: '',
|
|
|
Type: '1',
|
|
|
-
|
|
|
+ CreatOn: '',
|
|
|
+ },
|
|
|
+ //分页参数
|
|
|
+ size: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ currentItemCount: 0,
|
|
|
+ //列表排序
|
|
|
+ Column: {
|
|
|
+ Order: '',
|
|
|
+ Prop: ''
|
|
|
},
|
|
|
- tableData: [{
|
|
|
- date: '2016-05-02',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1518 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-04',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1517 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-01',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1519 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-03',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1516 弄'
|
|
|
- }]
|
|
|
+ // 查询时间
|
|
|
+ CreateOn: [new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()],
|
|
|
+ searchform: {
|
|
|
+ DataEntryId: '',
|
|
|
+ Id: 0,
|
|
|
+ Name: '',
|
|
|
+ Remark: '',
|
|
|
+ FileURL: '',
|
|
|
+ Type: '1',
|
|
|
+ CreatOn: '',
|
|
|
+ },
|
|
|
+ QuesFiletableData: [],
|
|
|
+ FiletableData: [],
|
|
|
+ waituploads: [] // 等待上传的附件列表
|
|
|
}
|
|
|
},
|
|
|
- method: {
|
|
|
- uploadrequest (option) {
|
|
|
+ created() {
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ initDatas() {
|
|
|
+ let _this = this;
|
|
|
+ let MyCreateOn = []
|
|
|
+ if (!_this.CreateOn) {
|
|
|
+ _this.CreateOn = []
|
|
|
+ }
|
|
|
+ // 解析时间
|
|
|
+ if (_this.CreateOn.length == 2) {
|
|
|
+ _this.CreateOn[1].setHours(23)
|
|
|
+ _this.CreateOn[1].setMinutes(59)
|
|
|
+ _this.CreateOn[1].setSeconds(59)
|
|
|
+ MyCreateOn.push(_this.formatDateTime(_this.CreateOn[0]))
|
|
|
+ MyCreateOn.push(_this.formatDateTime(_this.CreateOn[1]))
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ Order: this.Column.Order,
|
|
|
+ Prop: this.Column.Prop
|
|
|
+ }
|
|
|
+ this.searchform.DataEntryId = this.DataEntryId
|
|
|
+ Object.assign(params, this.searchform)
|
|
|
+ this.$axios.get('/limsdataentry/myfilelist?CreateOn=' + MyCreateOn.join(','), {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(function (response) {
|
|
|
+ _this.FiletableData = response.data.items
|
|
|
+ _this.currentItemCount = response.data.currentItemCount
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ makesure() {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ // 上传附件是否完成判断
|
|
|
+ if (!this.attachissuccess()) {
|
|
|
+ this.$message.error('有附件未成功上传!不能保存数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.getattachissuccess()
|
|
|
+ this.editSubfile()
|
|
|
+ } else {
|
|
|
+ this.editSubfile()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //打开附件上传弹窗
|
|
|
+ openfiledialog(val) {
|
|
|
+ if (val === '1') {
|
|
|
+ this.dialogtiltle = "附件上传"
|
|
|
+ this.datadialogVisible = true
|
|
|
+ } else if (val === '2') {
|
|
|
+ this.dialogtiltle = "问题附件上传"
|
|
|
+ this.datadialogVisible = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadrequest(option) {
|
|
|
let _this = this
|
|
|
this.$axios.post(process.env.upfilehost, {})
|
|
|
.then(function (res) {
|
|
|
@@ -163,17 +222,79 @@
|
|
|
}
|
|
|
return true
|
|
|
},
|
|
|
+ // 判断附件是否上传成功
|
|
|
+ attachissuccess() {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles[i].status !== 'success') {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ getattachissuccess() {
|
|
|
+ this.SubfileForm.FileUrl = ''
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles[i].status === 'success') {
|
|
|
+ for (let j = 0; j < this.waituploads.length; j++) {
|
|
|
+ if (this.waituploads[j].uid === this.$refs.refuploadattach.uploadFiles[i].uid) {
|
|
|
+ this.SubfileForm.FileUrl +=
|
|
|
+ `${this.waituploads[j].url}/${this.waituploads[j].fid}|${this.$refs.refuploadattach.uploadFiles[i].name}$`
|
|
|
+ this.SubfileForm.FileName += `${this.$refs.refuploadattach.uploadFiles[i].name}$`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clickachment(url, uid) {
|
|
|
+ window.open(`http://${url}`)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ formatDateTime(date) {
|
|
|
+ var y = date.getFullYear()
|
|
|
+ var m = date.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ var d = date.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ var h = date.getHours()
|
|
|
+ var minute = date.getMinutes()
|
|
|
+ minute = minute < 10 ? ('0' + minute) : minute
|
|
|
+ return y + '-' + m + '-' + d + ' ' + h + ':' + minute
|
|
|
+ },
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
- .attach-uploader .el-upload {
|
|
|
+ .attach-uploader .el-upload {
|
|
|
border: 1px dashed #63B8FF;
|
|
|
cursor: pointer;
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
- margin-bottom: -20px;
|
|
|
+ margin-left: 20px
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader .el-upload:hover {
|
|
|
+ border-color: #228B22;
|
|
|
}
|
|
|
+
|
|
|
+ .attach-uploader-icon {
|
|
|
+ font-size: 25px;
|
|
|
+ color: #63B8FF;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon:hover {
|
|
|
+ color: #228B22;
|
|
|
+ }
|
|
|
+
|
|
|
</style>
|