Commit 36ff3e3b by zhuxiaomei

抽样单和历史抽样数据

parent 9c66bda5
......@@ -43,7 +43,8 @@
},
"globals": {
"BMap": true,
"AMap": true
"AMap": true,
"plus": true
},
"rules": {}
},
......
......@@ -6,6 +6,8 @@ import http from '../http'
export default {
page: data => http.post('/drs/v1/sampling_place/page', data).then(res => res),
pageApp: data => http.post('/drs/v1/sampling_place/page_app', data).then(res => res),
edit:data=> http.put('/drs/v1/sampling_place/' + data.id, data.obj).then(res=>res),
edit: data => http.put('/drs/v1/sampling_place/' + data.id, data.obj).then(res => res),
listPlaces: data => http.post('/drs/v1/sampling_place/list_places', data).then(res => res),
addMulti: data => http.put('/drs/v1/sampling_place/upload_multi_selected', data).then(res => res),
}
/**
* 双随机抽样计划附件表相关
*/
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'
import httpJson from '../../api/httpJson'
export default {
page: data => http.post('/drs/v1/sampling_summary/page', data).then(res => res),
add: data => httpJson.post('/drs/v1/sampling_summary/', JSON.stringify(data)).then(res => res),
edit: data => httpJson.post('/drs/v1/sampling_summary/',JSON.stringify(data)).then(res => res),
deleteByIds: ids => http.delete('/drs/v1/sampling_summary/?ids=' + ids).then(res => res),
getById: id => http.get('/drs/v1/sampling_summary/' + id).then(res => res),
}
......@@ -29,3 +29,5 @@ export {default as message} from './message/message'
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'
......@@ -6,10 +6,11 @@
@high-search="_highSearch"
@clear-high="_clearHigh">
<template #highSearch>
<van-field v-model="formObj.name" label="抽样单编号" placeholder="请输入抽样单编号"></van-field>
<datetime-field label="抽样日期" v-model="formObj.planDate"></datetime-field>
<van-field v-model="formObj.name" label="任务名称" placeholder="请输入任务名称"></van-field>
<van-field v-model="formObj.name" label="被抽样单位" placeholder="请输入被抽样单位名称"></van-field>
<van-field v-model="formObj.samplingNum" label="抽样单编号" placeholder="请输入抽样单编号"></van-field>
<datetime-field label="抽样开始日期" v-model="formObj.samplingDateBegin"></datetime-field>
<datetime-field label="抽样结束日期" v-model="formObj.samplingDateEnd"></datetime-field>
<van-field v-model="formObj.taskName" label="任务名称" placeholder="请输入任务名称"></van-field>
<van-field v-model="formObj.testedName" label="被抽样单位" placeholder="请输入被抽样单位名称"></van-field>
</template>
</search-bar>
<div class="layout-cont-sh">
......@@ -19,14 +20,14 @@
finished-text="没有更多了"
@load="onLoad">
<van-swipe-cell v-for="item in resultList" :key="item.name">
<div class="result-item" @click="_goto(item)">
<div>抽样单编号:</div>
<div>抽样日期:</div>
<div>任务名称:</div>
<div>任务编号:</div>
<div>生产名称:</div>
<div>样品名称:</div>
<div>被抽样单位名称:</div>
<div class="result-item" @click="_goto(item)">
<div>抽样单编号:{{item.samplingNum}}</div>
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>任务名称:{{item.taskName}}</div>
<div>任务编号:{{item.taskNum}}</div>
<div>生产者名称:{{item.proName}}</div>
<div>样品名称:{{item.sampleName}}</div>
<div>被抽样单位名称:{{item.testedName}}</div>
</div>
</van-swipe-cell>
</van-list>
......@@ -35,43 +36,99 @@
</template>
<script>
import {samplingSummary} from '../../api'
export default {
name: "SamplingList",
data() {
return {
formObj: {
name: '',
planDate: '',
uname: '',
ctime: ''
samplingNum: '',
samplingDateBegin: '',
samplingDateEnd: '',
taskName: '',
testedName: '',
isHistory: 1
},
resultList: [
{name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2},
]
key: '',
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
}
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj)
console.log('search', value)
this.formObj.isHistory = 1
this._refresh()
},
//高级搜索 清空key 查询
_valParams() {
if (this.formObj.samplingDateBegin === '' && this.formObj.samplingDateEnd !== '') {
this.$toast('请选择抽样开始日期!')
return false
} else if (this.formObj.samplingDateBegin !== '' && this.formObj.samplingDateEnd === '') {
this.$toast('请选择抽样结束日期!')
return false
} else if (this.formObj.samplingDateBegin !== '' && this.formObj.samplingDateEnd !== '' && (new Date(this.formObj.planDateBegin) > new Date(this.formObj.planDateEnd))) {
this.$toast('抽样开始日期不能大于抽样结束日期!')
return false
}
return true
},
_highSearch() {
console.log('high-search')
console.log(this.formObj, 'formObj')
this.key = ''
if (this._valParams()) {
this.$refs.searchBar._hideHighSearch()
this._refresh()
}
},
_clearHigh() {
this.formObj = this.$resetFields(this.formObj)
console.log(this.formObj, 123)
this.formObj.isHistory = 1
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
...this.formObj
};
if (this.key) {
data.samplingNum = this.key
}
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingSummary.page(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
if (this.resultList.length === result.total) {
this.finished = true
}
},
_refresh() {
this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_goto(){
this.$router.push('/sampling_list/sampling_list_detail')
_goto(item) {
if (item.testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_detail_net', query: {id: item.id}})
} else {
this.$router.push({path: '/sampling_list/sampling_list_detail', query: {id: item.id}})
}
}
}
}
......
......@@ -19,13 +19,13 @@
<!--todo 批量打印、删除-->
</template>
<template #content>
<search-bar label="抽样单编号" highSearch @search="_search" @high-search="_highSearch"
<search-bar label="抽样单编号" ref="searchBar"
highSearch @search="_search" @high-search="_highSearch"
@clear-high="_clearHigh">
<template #highSearch>
<van-field v-model="formObj.name" label="抽样单编号" placeholder="请输入抽样单编号"></van-field>
<!--<datetime-field label="计划日期" v-model="formObj.planDate"></datetime-field>-->
<!--<van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人"></van-field>-->
<!--<datetime-field label="登记日期" v-model="formObj.ctime"></datetime-field>-->
<van-field v-model="formObj.placeName" label="地点" placeholder="请输入地点"></van-field>
<van-field v-model="formObj.shelfName" label="货架" placeholder="请输入货架"></van-field>
</template>
</search-bar>
<div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}">
......@@ -41,19 +41,22 @@
<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>计划名称:{{item.name}}</div>
<div>抽样进度:已填抽样单/抽样数</div>
<div>状态:{{item.status}}</div>
<p>附件:</p>
<div>抽样单编号:{{item.samplingNum}}</div>
<div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>生产者名称:{{item.proName}}</div>
<div>样品名称:{{item.sampleName}}</div>
<div>被抽样单位名称:{{item.testedName}}</div>
<div>地点:{{item.placeName}}</div>
<div>货架:{{item.shelfName}}</div>
<p @click.stop="_goFile(item.id)" style="margin:20px auto">附件:</p>
</div>
<template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn"
@click="_edit"></van-button>
@click="_edit(item)"></van-button>
<van-button square type="primary" text="打印" class="swipe-cell-btn"
@click="_print"></van-button>
@click="_print(item)"></van-button>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del"></van-button>
@click="_del([item.id])"></van-button>
</template>
</van-swipe-cell>
</van-checkbox-group>
......@@ -62,6 +65,7 @@
</div>
<div class="bottom-btn">
<div v-if="showCheck" @click="_checkAll">{{checkAll?'取消全选':'全选'}}</div>
<van-button square type="info" @click="_del(checkListValue)">删除</van-button>
</div>
</template>
<SelectShelves ref="shelvesSelect" @on-select="_shelvesResult"></SelectShelves>
......@@ -69,8 +73,8 @@
</template>
<script>
import {message} from '@/api'
import SelectShelves from './components/SelectShelves'
import {samplingSummary} from '../../api'
export default {
name: "SamplingList",
......@@ -80,8 +84,11 @@
data() {
return {
formObj: {
name: ''
name: '',
placeName: '',
shelfName: '',
},
key:'',
showPopup: true,
showCheck: false,
checkListValue: [],
......@@ -91,6 +98,7 @@
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
planId: this.$route.query.planId
}
},
watch: {
......@@ -108,32 +116,38 @@
}
},
mounted() {
this._page()
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj)
this._refresh()
console.log('search', value)
},
//高级搜索 清空key 查询
_highSearch() {
console.log('high-search')
console.log(this.formObj, 'formObj')
this.key = ''
this.$refs.searchBar._hideHighSearch()
this._refresh()
},
_clearHigh() {
this.formObj = this.$resetFields(this.formObj)
console.log(this.formObj, 123)
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
planId: this.planId,
...this.formObj//todo 简单查询的关键字
};
if(this.key){
data.samplingNum = this.key
}
return this.$serializeForm(data)
},
_page: async function () {
let result = await message.myPage(this._searchParams())
_getData: async function () {
let result = await samplingSummary.page(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
......@@ -143,27 +157,27 @@
},
_refresh() {
this.page = 1;
this._page()
this._getData()
},
_load() {
this.page = this.page + 1;
this._page()
this._getData()
},
_back() {
this.$router.go(-1)
},
_add() {
this.$refs.shelvesSelect._open()
this.$refs.shelvesSelect._open(this.planId)
},
_shelvesResult(res) {
if (res === '1') {
this.$router.push('/sampling_list/sampling_list_add_net')
_shelvesResult({testedType, shelfId}) {
console.log(testedType, 'testedType')
if (testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_add_net', query: {testedType, shelfId}})
} else {
this.$router.push('/sampling_list/sampling_list_add')
this.$router.push({path: '/sampling_list/sampling_list_add', query: {testedType, shelfId}})
}
},
_longtapHandler() {
console.log(1)
this.showCheck = true
},
_hideCheck() {
......@@ -185,22 +199,40 @@
this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1);
}
} else {
if (item.type === 1) {
this.$router.push('/sampling_list/sampling_list_detail_net')
if (item.testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_detail_net', query: {id: item.id}})
} else {
this.$router.push('/sampling_list/sampling_list_detail')
this.$router.push({path: '/sampling_list/sampling_list_detail', query: {id: item.id}})
}
}
},
_edit() {
_edit(item) {
if (item.testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_add_net', query: {id: item.id}})
} else {
this.$router.push({path: '/sampling_list/sampling_list_add', query: {id: item.id}})
}
},
_print() {
/*todo 蓝牙打印*/
},
_del() {
_del(ids) {
if (ids.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._delOk()
}
},
_delOk: async function (ids) {
let result = await samplingSummary.deleteByIds(ids)
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
_goFile(id) {
this.$router.push({path: '/sampling_list/file', query: {id: id}})
}
}
}
</script>
......
......@@ -705,6 +705,7 @@
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default {
name: "SamplingListAdd",
......@@ -797,7 +798,7 @@
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
storageCondition:'',
storageCondition:[],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '',
placeRemark2: '',
......@@ -818,9 +819,48 @@
{label: '建筑工地食堂', value: '食堂(建筑工地食堂)'},
],
restLinkList3: ['小吃店', '快餐店', '饮品店集体用餐配送单位', '中央厨房', '其他'],
id: '',
testedType: this.$route.query.testedType,
shelfId: this.$route.query.shelfId
}
},
mounted() {
this._open()
},
methods: {
_open() {
console.log(this.$route.query.id,'this.$route.query.id')
if (this.$route.query.id) {
this.id = this.$route.query.id
this._getData()
} else {
this.id = ''
}
},
_getData: async function () {
let result = await samplingSummary.getById(this.id)
if (result) {
for (let key in this.formObj) {
if (result[key]) {
this.formObj[key] = result[key]
}
}
for(let key in this.netTested){
if(result.netTested[key]){
this.netTested = result.netTested[key]
}
}
for(let key in this.sample){
if(result.sample[key]){
this.sample = result.sample[key]
}
}
this.testedType = result.testedType
this.shelfId = result.shelfId
}
},
_ok() {
let data = Object.assign({}, this.formObj, {nonNetTested: this.nonNetTested}, {sample: this.sample})
data.sample.storageCondition = this.storageCondition.join(',')
......@@ -839,8 +879,29 @@
break
}
}
console.log(data, 'data')
data.shelfId = this.shelfId
data.testedType = this.testedType
console.log(this.testedType,'this.testedType')
if (this.id) {
this._editSave(data)
} else {
this._addSave(data)
}
},
_addSave: async function (data) {
let result = await samplingSummary.add(data)
if (result) {
this.$toast('添加成功!')
this.$router.go(-1)
}
},
_editSave: async function (data) {
let result = await samplingSummary.edit({id: this.id, obj: data})
if (result) {
this.$toast('编辑成功!')
this.$router.go(-1)
}
}
}
}
</script>
......
......@@ -398,7 +398,7 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.backupQuanity"
v-model="sample.backupQuanity"
label="备样数量"
></van-field>
</table-col>
......@@ -700,6 +700,8 @@
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default {
name: "SamplingListAddNet",
components: {
......@@ -725,7 +727,7 @@
thirdPartyName: '',
thirdPartyAddress: '',
thirdPartyNature: '',
thirdPartyNatureRemark:'',
thirdPartyNatureRemark: '',
thirdPartyLicense: '',
thirdPartyTel: '',
......@@ -765,18 +767,18 @@
sourceRemark: '',
properties: '',
propertiesRemark: '',
dateType:'',
dateType: '',
shelfLife: '',
standard: '',
qualityGrade: '',
specification: '',
quantity:'',
backupQuanity:'',
quantity: '',
backupQuanity: '',
samplingMethod: '',
qrcode: '',
price: '',
inward:'',
originPlace:'',
inward: '',
originPlace: '',
packClass: '',
storageCondition: '',
storageConditionRemark: '',
......@@ -792,13 +794,48 @@
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
place:'',
storageCondition:[],
place: '',
storageCondition: [],
id: '',
testedType: this.$route.query.testedType,
shelfId: this.$route.query.shelfId
}
},
methods:{
_open(){
mounted() {
this._open()
},
methods: {
_open() {
if (this.$route.query.id) {
this.id = this.$route.query.id
this._getData()
} else {
this.id = ''
}
},
_getData: async function () {
let result = await samplingSummary.getById(this.id)
if (result) {
for (let key in this.formObj) {
if (result[key]) {
this.formObj[key] = result[key]
}
}
for(let key in this.netTested){
if(result.netTested[key]){
this.netTested = result.netTested[key]
}
}
for(let key in this.sample){
if(result.sample[key]){
this.sample = result.sample[key]
}
}
this.testedType = result.testedType
this.shelfId = result.shelfId
}
},
_ok() {
let data = Object.assign({}, this.formObj, {netTested: this.netTested}, {sample: this.sample})
......@@ -807,8 +844,29 @@
data.netTested.placeLink = this.place.split(',')[0]
data.netTested.place = this.place.split(',')[1]
}
console.log(data, 'data')
data.shelfId = this.shelfId
data.testedType = this.testedType
if (this.id) {
this._editSave(data)
} else {
this._addSave(data)
}
},
_addSave: async function (data) {
let result = await samplingSummary.add(data)
if (result) {
this.$toast('添加成功!')
this.$router.go(-1)
}
},
_editSave: async function (data) {
data.id = this.id
let result = await samplingSummary.edit(data)
if (result) {
this.$toast('编辑成功!')
this.$router.go(-1)
}
}
}
}
</script>
......
......@@ -24,7 +24,7 @@
:finished="finished"
finished-text="没有更多了"
@load="_load">
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item)">
<div class="result-item" v-for="item in resultList" :key="item.name" @click="_goto(item.id)">
<div>计划名称:{{item.name}}</div>
<div>抽样进度:{{item.completionRatio}}</div>
<div>状态:{{item.progress}}</div>
......@@ -60,6 +60,9 @@
finished: false,//没有更多数据
}
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
......@@ -125,14 +128,14 @@
},
_refresh() {
this.page = 1;
// this._getData()
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_goto() {
this.$router.push('/sampling_list/sampling_list')
_goto(id) {
this.$router.push({path:'/sampling_list/sampling_list',query:{planId:id}})
},
}
}
......
......@@ -9,34 +9,26 @@
:safe-area-inset-bottom="true"
:close-on-popstate="true"
:style="{ height: '70%' }">
<!--<van-tree-select height="100%"-->
<!--:items="items"-->
<!--:main-active-index.sync="active"-->
<!--@click-nav="_getShelves">-->
<!--<template #content>-->
<!--<div v-for="item in shelvesList" :key="item" style="height: 40px;background: bisque">{{item}}</div>-->
<!--</template>-->
<!--</van-tree-select>-->
<div class="popup-cont-btn popup-shelves">
<div>
<p>抽样单类型</p>
<van-radio-group v-model="radio" direction="horizontal">
<van-radio name="1">网络</van-radio>
<van-radio name="2">非网络</van-radio>
<van-radio :name="1">网络</van-radio>
<van-radio :name="0">非网络</van-radio>
</van-radio-group>
</div>
<div>
<p>所属货架</p>
<van-tree-select
height="100%"
:items="items"
:items="places"
:active-id.sync="activeId"
:main-active-index.sync="activeIndex"
></van-tree-select>
</div>
</div>
<div class="bottom-btn bottom-btn-two">
<van-button square type="default" color="#f7f8fa" @click="_cancel">取消</van-button>
<van-button square type="default" @click="_cancel">取消</van-button>
<van-button square type="info" @click="_ok">确定</van-button>
</div>
</van-popup>
......@@ -44,15 +36,15 @@
</template>
<script>
import {samplingPlace} from '../../../api'
export default {
name: "SelectShelves",
data() {
return {
showPopup: false,
// items: [{text: '地点 1'}, {text: '地点 2'}],
shelvesList: [],
radio: 0,
items: [
radio: -1,
places: [
{
text: '地点1',
children: [
......@@ -71,44 +63,60 @@
children: [
{
text: '货架2-1',
id: 23,
id: 3,
},
{
text: '货架2-2',
id: 24,
id: 4,
},
],
},
{
text: '地点3',
children: [
{
text: '货架3-1',
id: 5,
},
{
text: '货架3-2',
id: 6,
},
],
},
],
active: 0,
activeId: 0,
activeId: '',
activeIndex: 0,
planId: ''
}
},
methods: {
_open() {
_open(planId) {
this.showPopup = true
this.radio = -1
this.activeId = ''
this.planId = planId
this._getShelves()
},
_getShelves(item) {
if (item === 0) {
this.shelvesList = ['货架1']
_getShelves: async function () {
let result = await samplingPlace.listPlaces({planId: this.planId})
if (result) {
this.places = result
} else {
this.shelvesList = ['货架2']
this.places = []
}
},
_selectResult(item) {
console.log(item, 123)
},
_cancel() {
this.showPopup = false
},
_ok() {
if (this.radio === 0) {
if (this.radio === -1) {
/*todo 修改toast默认配置 https://youzan.github.io/vant/#/zh-CN/toast#xiu-gai-mo-ren-pei-zhi*/
this.$toast('请选择抽样单类型!');
} else if (this.activeId === '') {
this.$toast('请选择货架!')
} else {
this.$emit('on-select', this.radio)
this.$emit('on-select', {testedType: this.radio, shelfId: this.activeId})
}
}
}
......
<template>
<div>
<div style="margin:100px auto 10px auto;text-align: center">
<!--<img src="../../../../static/image/file-down.png" height="100">-->
<p style="margin:10px auto">{{name}}</p>
<p style="color:#aaa;"> {{ctime}}</p>
</div>
<div>
<!--<div class="edit-btn down-btn" @click="_webOk" style="margin-bottom: 15px" v-if="osName === 'web' ">下载</div>-->
<!--<div class="edit-btn down-btn" @click="_ok" style="margin-bottom: 15px">下载</div>-->
<div class="edit-btn down-btn" @click="_view" style="margin-bottom: 15px">预览</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
title: '下载附件',
name: '',
id: '',
ctime: '',
remark: ''
}
},
mounted() {
this._getQuery();
},
methods: {
_getQuery() {
this.name = this.$route.query.fileName;
this.remark = this.$route.query.remark;
this.id = this.$route.query.id;
this.ctime = this.$dateformat(parseInt(this.$route.query.ctime), 'yyyy/mm/dd');
// this.osName = localStorage.getItem('osName');
},
//移动
_ok() {
this.$vux.loading.show({
text: '下载中...',
width: '10em',
show: true
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/env/v1/env_contract_attachment/download/' + this.id,
{}, (d, status) => {
// 下载完成
if (status == 200) {
this.$vux.loading.hide();
this.$vux.toast.show({
type: 'text',
width: '15em',
text: '下载到' + d.filename,
time: 2000
});
this.$router.go(-1);
} else {
this.$vux.loading.hide();
this.$vux.toast.show({
type: 'warn',
width: '10em',
text: '下载失败',
});
}
});
dtask.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
dtask.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
dtask.start();
},
//浏览器
// _webOk() {
// var request = new XMLHttpRequest();
// request.open("GET", this.$global.baseURL + '/env/v1/env_contract_attachment/download/' + this.id);
// request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
// request.setRequestHeader("accessToken", localStorage.getItem('accessToken'));
// request.responseType = 'arraybuffer';
// request.onload = function (e) {
// var a = document.createElement("a");
// document.body.appendChild(a);
// a.style = "display: none";
// var blob = new Blob([this.response], {type: "octet/stream"}),
// url = window.URL.createObjectURL(blob);
// a.href = url;
// a.download = this.remark;
// a.click();
// window.URL.revokeObjectURL(url);
// };
// request.send();
// },
//预览文档
_view() {
// this.$store.dispatch('EnvContractAttachment/preview', this.id).then(() => {
// let result = this.$store.state.EnvContractAttachment.list;
// if (result !== undefined) {
// //使用内置Webview窗口打开URL
// plus.webview.open(this.$global.baseURL + '/print/v1/oos?key=' + result.objectKey, this.id, {
// 'popGesture': 'hide', //侧滑返回
// 'backButtonAutoControl': 'hide', //控制按键返回
// 'additionalHttpHeaders': {accessToken: localStorage.getItem('accessToken')}
// });
// }
// });
//调用第三放程序打开指定文件(必须是本地路径)
this.$vux.loading.show({
text: '加载中...',
width: '10em',
show: true
});
var dtask = plus.downloader.createDownload(
this.$global.baseURL + '/env/v1/env_contract_attachment/download/' + this.id, {}, (d, status) => {
if (status == 200) {
plus.runtime.openFile(d.filename);//cn.wps.moffice_eng-----wps的包名
}
this.$vux.loading.hide();
});
dtask.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
dtask.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
dtask.start();
},
}
}
</script>
<template>
<div>
<div style="margin:100px auto 10px auto;text-align: center">
<div>
<Upload
multiple
:action="action"
:on-success="_handelsuccess"
:before-upload="_beupload"
:data="dataObj"
:headers="headers"
:with-credentials="true"
:show-upload-list="false"
>
<img :src="url" height="100">
</Upload>
</div>
<p style="margin:10px auto">请选择附件上传</p>
</div>
</div>
</template>
<script>
import Global from '../../../api/config'
export default {
data() {
return {
title: '附件',
//合同id
contractId: '',
url: './static/image/file-add.png',
files: [],
action: '',
osName: '',
dataObj: {
file: '',
},
headers: '',
}
},
mounted() {
this._getQuery();
},
methods: {
_getQuery() {
this.contractId = this.$route.query.contractId;
this.action = Global.baseURL + '/env/v1/env_contract_attachment/' + this.contractId;
this.headers = {'accessToken': localStorage.getItem('accessToken')};
},
_resultChange(msg) {
this.$vux.toast.show({
type: 'text',
width: '10em',
text: msg,
});
},
//web
_beupload(file) {
this.dataObj.file = file.name;
this.$vux.loading.show({
text: '上传中...',
width: '10em',
show: true
});
},
_handelsuccess(response) { //上传成功
this.$vux.loading.hide();
if (response.success) {
this._resultChange('上传成功');
this.$router.go(-1);
} else {
this._resultChange('上传失败');
}
},
}
}
</script>
......@@ -16,9 +16,9 @@
</div>
<template #right>
<van-button square type="info" text="打卡" class="swipe-cell-btn"
@click="_getWebLoc"></van-button>
@click="_getWebLoc(item.id)"></van-button>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_delLoc(id)"></van-button>
@click="_delLoc(item.id)"></van-button>
</template>
</van-swipe-cell>
</van-list>
......
......@@ -38,7 +38,7 @@
</template>
<script>
import {samplingPlan, samplingPlace} from '../../../api'
import {samplingPlace} from '../../../api'
export default {
name: "SelectLocation",
......@@ -106,10 +106,9 @@
},
_addOk: async function () {
let data = {
planId: this.planId,
placeIds: this.checkListValue.join(',')
ids: this.checkListValue.join(',')
}
let result = await samplingPlan.savePlace(data)
let result = await samplingPlace.addMulti(data)
if (result) {
this.$toast('操作成功')
this.$emit('refresh')
......
......@@ -4,6 +4,9 @@ import SamplingListAddNet from '@/page/sampling-list/SamplingListAddNet.vue'
import SamplingListAdd from '@/page/sampling-list/SamplingListAdd.vue'
import SamplingListDetail from '@/page/sampling-list/SamplingListDetail.vue'
import SamplingListDetailNet from '@/page/sampling-list/SamplingListDetailNet.vue'
import File from '@/page/sampling-list/file/File.vue'
import FileUpload from '@/page/sampling-list/file/FileUpload.vue'
import FileDownLoad from '@/page/sampling-list/file/FileDownLoad.vue'
export default [
{path: 'sampling_task', component: SamplingTask, meta: {title: '抽样任务'}},
......@@ -12,4 +15,7 @@ export default [
{path: 'sampling_list_add_net', component: SamplingListAddNet, meta: {title: '抽样单添加-网络'}},
{path: 'sampling_list_detail', component: SamplingListDetail, meta: {title: '抽样单详情-非网络'}},
{path: 'sampling_list_detail_net', component: SamplingListDetailNet, meta: {title: '抽样单详情-网络'}},
{path: 'file', component: File, meta: {title: '附件'}},
{path: 'file_upload', component: FileUpload, meta: {title: '添加附件'}},
{path: 'file_download', component: FileDownLoad, meta: {title: '下载附件'}},
]
......@@ -193,10 +193,18 @@ html, body, #app, .main-content-con {
height: auto;
background: @background-color-white;
margin-top: 10px;
padding: 10px;
padding: 10px 0;
border-top: 1px solid @border-color;
border-bottom: 1px solid @border-color;
font-size: 12px;
display: flex;
flex-wrap: wrap;
> div {
width: 50%;
padding: 0 10px;
line-height: 24px;
}
}
.swipe-cell-btn {
......
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