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