Commit f6aca89b by zhuxiaomei

附件

parent 81cd7761
/**
* 双随机抽样计划附件表相关
*/
import http from '../../api/http'
export default {
page: data => http.post('/drs/v1/sampling_plan_attachment/page', data).then(res => res),
list: data => http.post('/drs/v1/sampling_plan_attachment/list', data).then(res => res),
add: data => http.post('/drs/v1/sampling_plan_attachment/', data).then(res => res),
edit: data => http.put('/drs/v1/sampling_plan_attachment/' + data.id, data.obj).then(res => res),
deleteByIds: data => http.delete('/drs/v1/sampling_plan_attachment/?ids=' + data.id).then(res => res),
getById: id => http.get('/drs/v1/sampling_plan_attachment/' + id).then(res => res),
//计划下的附件是图片的附件id集合
getImgById: id => http.post('/drs/v1/sampling_plan_attachment/list_picture_by_plan_id?planId=' + id).then(res => res),
}
/**
* 双随机抽样计划附件表相关
*/
import http from '../../api/http'
export default {
page: data => http.post('/drs/v1/sampling_summary_attachment/page', data).then(res => res),
list: data => http.post('/drs/v1/sampling_summary_attachment/list', data).then(res => res),
add: data => http.post('/drs/v1/sampling_summary_attachment/', data).then(res => res),
edit: data => http.put('/drs/v1/sampling_summary_attachment/' + data.id, data.obj).then(res => res),
deleteByIds: data => http.delete('/drs/v1/sampling_summary_attachment/?ids=' + data.id).then(res => res),
getById: id => http.get('/drs/v1/sampling_summary_attachment/' + id).then(res => res),
//计划下的附件是图片的附件id集合
getImgById: id => http.post('/drs/v1/sampling_summary_attachment/list_picture_by_plan_id?planId=' + id).then(res => res),
}
......@@ -30,5 +30,5 @@ export {default as samplingPlan} from './drs/sampling-plan'
export {default as samplingPlace} from './drs/sampling-place'
export {default as samplingShelf} from './drs/sampling-shelf'
export {default as samplingSummary} from './drs/sampling-summary'
export {default as samplingPlanAttachment} from './drs/sampling-plan-attachment'
export {default as samplingSummaryAttachment} from './drs/sampling-summary-attachment'
export {default as attendanceRecord} from './drs/attendance_record'
......@@ -18,7 +18,9 @@
components: {},
methods: {
_back() {
this.$router.go(-1)
if (this.$route.meta.leftArrow !== false) {
this.$router.go(-1)
}
}
}
}
......
......@@ -48,7 +48,8 @@
samplingDateEnd: '',
taskName: '',
testedName: '',
isHistory: 1
isHistory: 1,
isSelf:1
},
key: '',
resultList: [],
......@@ -68,6 +69,7 @@
this.key = value
this.formObj = this.$resetFields(this.formObj)
this.formObj.isHistory = 1
this.formObj.isSelf = 1
this._refresh()
},
//高级搜索 清空key 查询
......@@ -94,6 +96,7 @@
_clearHigh() {
this.formObj = this.$resetFields(this.formObj)
this.formObj.isHistory = 1
this.formObj.isSelf = 1
},
_searchParams() {
let data = {
......
......@@ -40,11 +40,17 @@
<van-checkbox-group v-model="checkListValue" ref="checkboxGroup">
<van-swipe-cell v-for="item in resultList" :key="item.id">
<div class="result-item" @click="_tapItem(item)" v-touch:longtap="_longtapHandler">
<van-checkbox :name="item.id" shape="square" v-if="showCheck"></van-checkbox>
<div @click.stop="_goFile(item.id)" style="margin:20px auto;color:#00a0e9">
查看附件
<div style="width: 100%;display: flex;justify-content: space-between;border-bottom: 1px solid #eeeeee">
<div style="display: flex">
<div style="margin-right: 20px" v-if="showCheck">
<van-checkbox :name="item.id" shape="square"></van-checkbox>
</div>
<div>抽样单编号:{{item.samplingNum}}</div>
</div>
<div @click.stop="_goFile(item.id)">
<img src="../../assets/file-nav.png" style="width: 20px">
</div>
</div>
<div>抽样单编号:{{item.samplingNum}}</div>
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>生产者名称:{{item.proName}}</div>
<div>样品名称:{{item.sampleName}}</div>
......@@ -65,7 +71,7 @@
</van-list>
</van-pull-refresh>
</div>
<div class="bottom-btn bottom-btn-two" v-if="showCheck">
<div class="bottom-btn bottom-btn-two" v-if="showCheck">
<van-button square @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button>
<van-button square type="danger" @click="_del(checkListValue)">删除</van-button>
</div>
......@@ -233,7 +239,7 @@
}
},
_goFile(id) {
this.$router.push({path: '/sampling_list/file', query: {id: id}})
this.$router.push({path: '/sampling_list/file', query: {summaryId: id}})
}
}
}
......
<template>
<div>
<div class="layout-cont-btn" style="background: #576b95">
<div class="layout-cont-btn" >
<van-pull-refresh v-model="refreshing" @refresh="_refresh">
<van-list
v-model="loading"
......@@ -20,8 +20,8 @@
</van-pull-refresh>
</div>
<div class="bottom-btn bottom-btn-two">
<van-button type="info" block @click="_goto('/sampling/file_upload')">添加附件</van-button>
<van-button type="info" block @click="_uploadImg">添加图片</van-button>
<van-button type="info" square @click="_goto('/sampling_list/file_upload')">添加附件</van-button>
<van-button type="primary" square @click="_uploadImg">添加图片</van-button>
</div>
<van-image-preview v-model="showImg" :images="imgList">
<!--<template #:index>第{{ index }}页</template>-->
......@@ -30,7 +30,7 @@
</template>
<script>
import {samplingPlanAttachment} from '../../../api'
import {samplingSummaryAttachment} from '../../../api'
export default {
data() {
......@@ -38,7 +38,7 @@
resultList: [],
page: 1,
rows: 20,
planId: '',
summaryId: '',
imgList: [''],
loading: false,//加载中...
finished: false,//没有更多数据
......@@ -51,8 +51,8 @@
}
},
mounted() {
this.planId = this.$route.query.planId;
this.action = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/upload?planId=' + this.planId;
this.summaryId = this.$route.query.summaryId;
this.action = this.$global.baseURL + '/drs/v1/sampling_summary_attachment/' + this.summaryId;
this._getData();
},
methods: {
......@@ -64,12 +64,12 @@
let data = {
page: this.page,
rows: this.rows,
planId: this.planId
summaryId: this.summaryId
};
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingPlanAttachment.page(this._searchParams())
let result = await samplingSummaryAttachment.page(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
......@@ -83,11 +83,11 @@
},
//路由跳转
_goto(next) {
let data = {planId: this.planId};
let data = {summaryId: this.summaryId};
this.$router.push({path: next, query: data})
},
_del: async function (id) {
let result = await samplingPlanAttachment.deleteByIds({id: id})
let result = await samplingSummaryAttachment.deleteByIds({id: id})
if (result) {
this.$toast('删除成功!')
this._refresh()
......@@ -98,7 +98,7 @@
if (data.type.toLowerCase() === 'jpg' || data.type.toLowerCase() === 'png') {
this.showImg = true
//预览图片
this.imgList[0] = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + data.id;
this.imgList[0] = this.$global.baseURL + '/drs/v1/sampling_summary_attachment/down?id=' + data.id;
} else {
//下载文件
let name = '';
......
......@@ -40,7 +40,7 @@
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + this.id,
this.$global.baseURL + '/drs/v1/sampling_summary_attachment/down?id=' + this.id,
{}, (d, status) => {
// 下载完成
if (status == 200) {
......@@ -64,7 +64,7 @@
forbidClick: true,
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + this.id, {}, (d, status) => {
this.$global.baseURL + '/drs/v1/sampling_summary_attachment/down?id=' + this.id, {}, (d, status) => {
if (status == 200) {
plus.runtime.openFile(d.filename);//cn.wps.moffice_eng-----wps的包名
}
......
......@@ -24,7 +24,7 @@
export default {
data() {
return {
planId: '',
summaryId: '',
action: '',
dataObj: {
file: '',
......@@ -37,8 +37,8 @@
},
methods: {
_getQuery() {
this.planId = this.$route.query.planId;
this.action = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/upload?planId=' + this.planId;
this.summaryId = this.$route.query.summaryId;
this.action = this.$global.baseURL + '/drs/v1/sampling_summary_attachment/' + this.summaryId;
this.headers = {'accessToken': localStorage.getItem('accessToken')};
},
//web
......
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