Commit 36ff3e3b by zhuxiaomei

抽样单和历史抽样数据

parent 9c66bda5
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
}, },
"globals": { "globals": {
"BMap": true, "BMap": true,
"AMap": true "AMap": true,
"plus": true
}, },
"rules": {} "rules": {}
}, },
......
...@@ -6,6 +6,8 @@ import http from '../http' ...@@ -6,6 +6,8 @@ import http from '../http'
export default { export default {
page: data => http.post('/drs/v1/sampling_place/page', data).then(res => res), 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), 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' ...@@ -29,3 +29,5 @@ export {default as message} from './message/message'
export {default as samplingPlan} from './drs/sampling-plan' 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 samplingPlanAttachment} from './drs/sampling-plan-attachment'
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
@high-search="_highSearch" @high-search="_highSearch"
@clear-high="_clearHigh"> @clear-high="_clearHigh">
<template #highSearch> <template #highSearch>
<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.planDate"></datetime-field> <datetime-field label="抽样开始日期" v-model="formObj.samplingDateBegin"></datetime-field>
<van-field v-model="formObj.name" label="任务名称" placeholder="请输入任务名称"></van-field> <datetime-field label="抽样结束日期" v-model="formObj.samplingDateEnd"></datetime-field>
<van-field v-model="formObj.name" label="被抽样单位" placeholder="请输入被抽样单位名称"></van-field> <van-field v-model="formObj.taskName" label="任务名称" placeholder="请输入任务名称"></van-field>
<van-field v-model="formObj.testedName" label="被抽样单位" placeholder="请输入被抽样单位名称"></van-field>
</template> </template>
</search-bar> </search-bar>
<div class="layout-cont-sh"> <div class="layout-cont-sh">
...@@ -19,14 +20,14 @@ ...@@ -19,14 +20,14 @@
finished-text="没有更多了" finished-text="没有更多了"
@load="onLoad"> @load="onLoad">
<van-swipe-cell v-for="item in resultList" :key="item.name"> <van-swipe-cell v-for="item in resultList" :key="item.name">
<div class="result-item" @click="_goto(item)"> <div class="result-item" @click="_goto(item)">
<div>抽样单编号:</div> <div>抽样单编号:{{item.samplingNum}}</div>
<div>抽样日期:</div> <div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>任务名称:</div> <div>任务名称:{{item.taskName}}</div>
<div>任务编号:</div> <div>任务编号:{{item.taskNum}}</div>
<div>生产名称:</div> <div>生产者名称:{{item.proName}}</div>
<div>样品名称:</div> <div>样品名称:{{item.sampleName}}</div>
<div>被抽样单位名称:</div> <div>被抽样单位名称:{{item.testedName}}</div>
</div> </div>
</van-swipe-cell> </van-swipe-cell>
</van-list> </van-list>
...@@ -35,43 +36,99 @@ ...@@ -35,43 +36,99 @@
</template> </template>
<script> <script>
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingList", name: "SamplingList",
data() { data() {
return { return {
formObj: { formObj: {
name: '', samplingNum: '',
planDate: '', samplingDateBegin: '',
uname: '', samplingDateEnd: '',
ctime: '' taskName: '',
testedName: '',
isHistory: 1
}, },
resultList: [ key: '',
{name: '计划名称', status: 1}, resultList: [],
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1}, page: 1,
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1}, rows: 10,
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1}, refreshing: false,//刷新中...
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1}, loading: false,//加载中...
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1}, finished: false,//没有更多数据
{name: '计划名称2', status: 2}, {name: '计划名称', status: 1},
{name: '计划名称2', status: 2},
]
} }
}, },
mounted() {
this._getData()
},
methods: { methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) { _search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj) 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() { _highSearch() {
console.log('high-search') this.key = ''
console.log(this.formObj, 'formObj') if (this._valParams()) {
this.$refs.searchBar._hideHighSearch()
this._refresh()
}
}, },
_clearHigh() { _clearHigh() {
this.formObj = this.$resetFields(this.formObj) 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(){ _goto(item) {
this.$router.push('/sampling_list/sampling_list_detail') 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 @@ ...@@ -19,13 +19,13 @@
<!--todo 批量打印、删除--> <!--todo 批量打印、删除-->
</template> </template>
<template #content> <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"> @clear-high="_clearHigh">
<template #highSearch> <template #highSearch>
<van-field v-model="formObj.name" label="抽样单编号" placeholder="请输入抽样单编号"></van-field> <van-field v-model="formObj.name" label="抽样单编号" placeholder="请输入抽样单编号"></van-field>
<!--<datetime-field label="计划日期" v-model="formObj.planDate"></datetime-field>--> <van-field v-model="formObj.placeName" label="地点" placeholder="请输入地点"></van-field>
<!--<van-field v-model="formObj.uname" label="登记人" placeholder="请输入登记人"></van-field>--> <van-field v-model="formObj.shelfName" label="货架" placeholder="请输入货架"></van-field>
<!--<datetime-field label="登记日期" v-model="formObj.ctime"></datetime-field>-->
</template> </template>
</search-bar> </search-bar>
<div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}"> <div class="layout-cont-sh" :class="{'layout-cont-sh-btn':showCheck}">
...@@ -41,19 +41,22 @@ ...@@ -41,19 +41,22 @@
<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> <van-checkbox :name="item.id" shape="square" v-if="showCheck"></van-checkbox>
<div>计划名称:{{item.name}}</div> <div>抽样单编号:{{item.samplingNum}}</div>
<div>抽样进度:已填抽样单/抽样数</div> <div>抽样日期:{{item.samplingDate?$dateformat(item.samplingDate,'yyyy-mm-dd'):''}}</div>
<div>状态:{{item.status}}</div> <div>生产者名称:{{item.proName}}</div>
<div>样品名称:{{item.sampleName}}</div>
<p>附件:</p> <div>被抽样单位名称:{{item.testedName}}</div>
<div>地点:{{item.placeName}}</div>
<div>货架:{{item.shelfName}}</div>
<p @click.stop="_goFile(item.id)" style="margin:20px auto">附件:</p>
</div> </div>
<template #right> <template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn" <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" <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" <van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del"></van-button> @click="_del([item.id])"></van-button>
</template> </template>
</van-swipe-cell> </van-swipe-cell>
</van-checkbox-group> </van-checkbox-group>
...@@ -62,6 +65,7 @@ ...@@ -62,6 +65,7 @@
</div> </div>
<div class="bottom-btn"> <div class="bottom-btn">
<div v-if="showCheck" @click="_checkAll">{{checkAll?'取消全选':'全选'}}</div> <div v-if="showCheck" @click="_checkAll">{{checkAll?'取消全选':'全选'}}</div>
<van-button square type="info" @click="_del(checkListValue)">删除</van-button>
</div> </div>
</template> </template>
<SelectShelves ref="shelvesSelect" @on-select="_shelvesResult"></SelectShelves> <SelectShelves ref="shelvesSelect" @on-select="_shelvesResult"></SelectShelves>
...@@ -69,8 +73,8 @@ ...@@ -69,8 +73,8 @@
</template> </template>
<script> <script>
import {message} from '@/api'
import SelectShelves from './components/SelectShelves' import SelectShelves from './components/SelectShelves'
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingList", name: "SamplingList",
...@@ -80,8 +84,11 @@ ...@@ -80,8 +84,11 @@
data() { data() {
return { return {
formObj: { formObj: {
name: '' name: '',
placeName: '',
shelfName: '',
}, },
key:'',
showPopup: true, showPopup: true,
showCheck: false, showCheck: false,
checkListValue: [], checkListValue: [],
...@@ -91,6 +98,7 @@ ...@@ -91,6 +98,7 @@
refreshing: false,//刷新中... refreshing: false,//刷新中...
loading: false,//加载中... loading: false,//加载中...
finished: false,//没有更多数据 finished: false,//没有更多数据
planId: this.$route.query.planId
} }
}, },
watch: { watch: {
...@@ -108,32 +116,38 @@ ...@@ -108,32 +116,38 @@
} }
}, },
mounted() { mounted() {
this._page() this._getData()
}, },
methods: { methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) { _search(value) {
this.key = value
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this._refresh() this._refresh()
console.log('search', value)
}, },
//高级搜索 清空key 查询
_highSearch() { _highSearch() {
console.log('high-search') this.key = ''
console.log(this.formObj, 'formObj') this.$refs.searchBar._hideHighSearch()
this._refresh()
}, },
_clearHigh() { _clearHigh() {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
console.log(this.formObj, 123)
}, },
_searchParams() { _searchParams() {
let data = { let data = {
page: this.page, page: this.page,
rows: this.rows, rows: this.rows,
planId: this.planId,
...this.formObj//todo 简单查询的关键字 ...this.formObj//todo 简单查询的关键字
}; };
if(this.key){
data.samplingNum = this.key
}
return this.$serializeForm(data) return this.$serializeForm(data)
}, },
_page: async function () { _getData: async function () {
let result = await message.myPage(this._searchParams()) let result = await samplingSummary.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
...@@ -143,27 +157,27 @@ ...@@ -143,27 +157,27 @@
}, },
_refresh() { _refresh() {
this.page = 1; this.page = 1;
this._page() this._getData()
}, },
_load() { _load() {
this.page = this.page + 1; this.page = this.page + 1;
this._page() this._getData()
}, },
_back() { _back() {
this.$router.go(-1) this.$router.go(-1)
}, },
_add() { _add() {
this.$refs.shelvesSelect._open() this.$refs.shelvesSelect._open(this.planId)
}, },
_shelvesResult(res) { _shelvesResult({testedType, shelfId}) {
if (res === '1') { console.log(testedType, 'testedType')
this.$router.push('/sampling_list/sampling_list_add_net') if (testedType === 1) {
this.$router.push({path: '/sampling_list/sampling_list_add_net', query: {testedType, shelfId}})
} else { } else {
this.$router.push('/sampling_list/sampling_list_add') this.$router.push({path: '/sampling_list/sampling_list_add', query: {testedType, shelfId}})
} }
}, },
_longtapHandler() { _longtapHandler() {
console.log(1)
this.showCheck = true this.showCheck = true
}, },
_hideCheck() { _hideCheck() {
...@@ -185,22 +199,40 @@ ...@@ -185,22 +199,40 @@
this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1); this.checkListValue.splice(this.checkListValue.indexOf(item.id), 1);
} }
} else { } else {
if (item.type === 1) { if (item.testedType === 1) {
this.$router.push('/sampling_list/sampling_list_detail_net') this.$router.push({path: '/sampling_list/sampling_list_detail_net', query: {id: item.id}})
} else { } 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() { _print() {
/*todo 蓝牙打印*/ /*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> </script>
......
...@@ -705,6 +705,7 @@ ...@@ -705,6 +705,7 @@
import SamplingListAddTable from './components/SamplingListAddTable' import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow' import TableRow from './components/TableRow'
import TableCol from './components/TableCol' import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingListAdd", name: "SamplingListAdd",
...@@ -797,7 +798,7 @@ ...@@ -797,7 +798,7 @@
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'], thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
storageCondition:'', storageCondition:[],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点” place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '', placeRemark1: '',
placeRemark2: '', placeRemark2: '',
...@@ -818,9 +819,48 @@ ...@@ -818,9 +819,48 @@
{label: '建筑工地食堂', value: '食堂(建筑工地食堂)'}, {label: '建筑工地食堂', value: '食堂(建筑工地食堂)'},
], ],
restLinkList3: ['小吃店', '快餐店', '饮品店集体用餐配送单位', '中央厨房', '其他'], restLinkList3: ['小吃店', '快餐店', '饮品店集体用餐配送单位', '中央厨房', '其他'],
id: '',
testedType: this.$route.query.testedType,
shelfId: this.$route.query.shelfId
} }
}, },
mounted() {
this._open()
},
methods: { 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() { _ok() {
let data = Object.assign({}, this.formObj, {nonNetTested: this.nonNetTested}, {sample: this.sample}) let data = Object.assign({}, this.formObj, {nonNetTested: this.nonNetTested}, {sample: this.sample})
data.sample.storageCondition = this.storageCondition.join(',') data.sample.storageCondition = this.storageCondition.join(',')
...@@ -839,8 +879,29 @@ ...@@ -839,8 +879,29 @@
break 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> </script>
......
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="50%"
label-align="center" label-align="center"
v-model="sample.backupQuanity" v-model="sample.backupQuanity"
label="备样数量" label="备样数量"
></van-field> ></van-field>
</table-col> </table-col>
...@@ -700,6 +700,8 @@ ...@@ -700,6 +700,8 @@
import TableRow from './components/TableRow' import TableRow from './components/TableRow'
import TableCol from './components/TableCol' import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingListAddNet", name: "SamplingListAddNet",
components: { components: {
...@@ -725,7 +727,7 @@ ...@@ -725,7 +727,7 @@
thirdPartyName: '', thirdPartyName: '',
thirdPartyAddress: '', thirdPartyAddress: '',
thirdPartyNature: '', thirdPartyNature: '',
thirdPartyNatureRemark:'', thirdPartyNatureRemark: '',
thirdPartyLicense: '', thirdPartyLicense: '',
thirdPartyTel: '', thirdPartyTel: '',
...@@ -765,18 +767,18 @@ ...@@ -765,18 +767,18 @@
sourceRemark: '', sourceRemark: '',
properties: '', properties: '',
propertiesRemark: '', propertiesRemark: '',
dateType:'', dateType: '',
shelfLife: '', shelfLife: '',
standard: '', standard: '',
qualityGrade: '', qualityGrade: '',
specification: '', specification: '',
quantity:'', quantity: '',
backupQuanity:'', backupQuanity: '',
samplingMethod: '', samplingMethod: '',
qrcode: '', qrcode: '',
price: '', price: '',
inward:'', inward: '',
originPlace:'', originPlace: '',
packClass: '', packClass: '',
storageCondition: '', storageCondition: '',
storageConditionRemark: '', storageConditionRemark: '',
...@@ -792,13 +794,48 @@ ...@@ -792,13 +794,48 @@
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'], storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'], thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
place:'', place: '',
storageCondition:[], storageCondition: [],
id: '',
testedType: this.$route.query.testedType,
shelfId: this.$route.query.shelfId
} }
}, },
methods:{ mounted() {
_open(){ 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() { _ok() {
let data = Object.assign({}, this.formObj, {netTested: this.netTested}, {sample: this.sample}) let data = Object.assign({}, this.formObj, {netTested: this.netTested}, {sample: this.sample})
...@@ -807,8 +844,29 @@ ...@@ -807,8 +844,29 @@
data.netTested.placeLink = this.place.split(',')[0] data.netTested.placeLink = this.place.split(',')[0]
data.netTested.place = this.place.split(',')[1] 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> </script>
......
<template> <template>
<div> <div>
详情 <add-table>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
name="samplingNum"
v-model="formObj.samplingNum"
label="抽样单编号"
:rules="[{ required: true, message: '请填写抽样单编号' }]"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.taskNum"
label="No."
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.source"
label="任务来源"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="任务类别">
<template #input>
<van-radio-group disabled v-model="formObj.taskType" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in taskTypeList">
{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
被抽样单位信息
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="nonNetTested.name"
label="单位名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="nonNetTested.address"
label="单位地址"
placeholder="如证照与许可证不一致,以许可证为准"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="区域类型">
<template #input>
<van-radio-group disabled v-model="nonNetTested.areaType" direction="horizontal">
<van-radio v-for="item in areaTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.areaTypeRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="nonNetTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.permitNum"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.legalPerson"
label="法人代表"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.linkman"
label="联系人"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.license"
label="营业执照号/社会信用代码"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.tel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
抽样地点
</table-col>
<table-col>
<van-radio-group disabled v-model="place" direction="horizontal">
<div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">生产环节:</div>
<van-radio v-for="item in proLinkList" :key="item" :name="1+','+item" shape="square">
{{item}}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="placeRemark1"
></van-field>
</div>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">流通环节:</div>
<van-radio v-for="item in flowLinkList" :key="item" :name="2+','+item" shape="square">
{{item}}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="placeRemark2"
></van-field>
</div>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;">餐饮环节:</div>
<van-radio v-for="item in restLinkList1" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList2" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList3" :key="item.value" :name="3+','+item"
shape="square">{{item}}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="placeRemark3"
></van-field>
</div>
</div>
</div>
</van-radio-group>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
样品信息
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
name="sampleName"
v-model="formObj.sampleName"
label="样品名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.trademark"
label="商标"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qrcode"
label="条形码"
></van-field>
</table-col>
</table-row>
<table-row>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品类型">
<template #input>
<van-radio-group disabled v-model="sample.type" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sampleTypeList">
{{item}}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.typeRemark"
></van-field>
</div>
</van-radio-group>
</template>
</van-field>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品来源">
<template #input>
<van-radio-group disabled v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.sourceRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品属性">
<template #input>
<van-radio-group disabled v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.propertiesRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="sample.dateType" direction="horizontal">
<van-radio v-for="item in dateTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文档"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.batchNo"
label="样品批号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.specification"
label="规格型号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qualityGrade"
label="质量等级"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.shelfLife"
label="保质期"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.price"
label="单价"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.samplingBase"
label="抽样基数"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.quantity"
label="抽样数量"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.backupQuanity"
label="备样数量"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="抽样方式">
<template #input>
<van-radio-group disabled v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="是否进口">
<template #input>
<van-radio-group disabled v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{item.label}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.originPlace"
label="原产地"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="包装分类">
<template #input>
<van-radio-group disabled v-model="sample.packClass" direction="horizontal">
<van-radio v-for="item in packClassList" :name="item" :key="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="储存条件">
<template #input>
<van-checkbox-group disabled v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{item}}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)生产者信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proName"
label="生产者名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proAddress"
label="生产者地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.prolicense"
label="生产许可证号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)第三方企业信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyName"
label="企业名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyAddress"
label="企业地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="企业性质">
<template #input>
<van-radio-group disabled v-model="formObj.thirdPartyNature" direction="horizontal">
<van-radio v-for="item in thirdPartyNatureList" :key="item" :name="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyNatureRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyLicense"
label="企业许可证号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>抽样单位信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testName"
label="单位名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testAddress"
label="地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testLinkman"
label="联系人"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testTel"
label="电话"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testFax"
label="传真"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="100px"
label-align="center"
v-model="formObj.remark"
label="备注"
></van-field>
</table-col>
</table-row>
</add-table>
<div class="bottom-btn">
<van-button block type="info" @click="_goto">返回</van-button>
</div>
</div> </div>
</template> </template>
<script> <script>
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingListDetail" name: "SamplingListAdd",
components: {
"add-table": SamplingListAddTable,
"table-row": TableRow,
"table-col": TableCol
},
data() {
return {
formObj: {
samplingNum: '',
taskNum: '',
sampleName: '',
source: '',
taskType: '',
proName: '',
proAddress: '',
prolicense: '',
proTel: '',
thirdPartyName: '',
thirdPartyAddress: '',
thirdPartyNature: '',
thirdPartyNatureRemark: '',
thirdPartyLicense: '',
thirdPartyTel: '',
testName: '',
testAddress: '',
testLinkman: '',
testTel: '',
testFax: '',
remark: ''
},
nonNetTested: {
name: '',
address: '',
areaType: '',
areaTypeRemark: '',
permitType: '',
permitNum: '',
legalPerson: '',
linkman: '',
license: '',
tel: '',
placeLink: '',//保存时单独赋值 从place字段分离出
place: '', //保存时单独赋值 从place字段分离出
placeRemark: '' //保存时单独赋值 根据环节取对应的placeRemarkN
},
sample: {
trademark: '',
qrcode: '',
type: '',
typeRemark: '',
source: '',
sourceRemark: '',
properties: '',
propertiesRemark: '',
dateType: '',
standard: '',
batchNo: '',
specification: '',
qualityGrade: '',
shelfLife: '',
price: '',
samplingBase: '',
quantity: '',
backupQuanity: '',
samplingMethod: '',
inward: '',
originPlace: '',
packClass: '',
storageCondition: [],
storageConditionRemark: ''
},
taskTypeList: ['监督抽检', '风险监测', '评价性抽检'],
areaTypeList: ['景点', '城市', '乡镇', '学校周边', '其他'],
permitTypeList: ['经营许可证号', '生产许可证号'],
sampleTypeList: ['食用农产品', '工业加工食品', '餐饮加工食品', '食品添加剂', '食品相关产品', '其他',],
sourceList: ['加工/自制', '委托生产', '外购', '其他'],
propertiesList: ['普通食品', '特殊食品', '节令食品', '重大活动保障食品', '其他',],
dateTypeList: ['生产日期', '购进日期', '加工日期', '检疫日期'],
samplingMethodList: ['无菌抽样', '非无菌抽样'],
trueOrFalseList: [{label: '是', value: 1}, {label: '否', value: 0}],
packClassList: ['预包装', '非定量包装', '无包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
storageCondition:[],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '',
placeRemark2: '',
placeRemark3: '',
proLinkList: ['原辅料库', '生产线', '半成品库', '成品库待检区', '成品库已检区', '其他'],
flowLinkList: ['农贸市场', '菜市场', '批发市场', '商场', '超市', '小食杂店', '其他'],
restLinkList1: [
{label: '特大型餐馆', value: '餐馆(特大型餐馆)'},
{label: '大型餐馆', value: '餐馆(大型餐馆)'},
{label: '中型餐馆', value: '餐馆(中型餐馆)'},
{label: '小型餐馆', value: '餐馆(小型餐馆)'},
],
restLinkList2: [
{label: '机关食堂', value: '食堂(机关食堂)'},
{label: '学校/托幼食堂', value: '食堂(学校/托幼食堂)'},
{label: '企事业单位食堂', value: '食堂(企事业单位食堂)'},
{label: '建筑工地食堂', value: '食堂(建筑工地食堂)'},
],
restLinkList3: ['小吃店', '快餐店', '饮品店集体用餐配送单位', '中央厨房', '其他'],
id: '',
}
},
mounted() {
this._open()
},
methods: {
_open() {
this.id = this.$route.query.id
this._getData()
},
_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
}
},
_goto(){
this.$router.go(-1)
}
}
} }
</script> </script>
<style scoped> <style lang="less">
@import "../../styles/sampling-list-add.less";
</style> </style>
<template> <template>
<div> <div>
详情网络 <add-table>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.samplingNum"
label="抽样单编号"
:rules="[{ required: true, message: '请填写抽样单编号' }]"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.taskNum"
label="No."
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.source"
label="任务来源"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="任务类别">
<template #input>
<van-radio-group disabled v-model="formObj.taskType" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in taskTypeList">
{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
网络食品交易第三方平台提供者信息
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.plantformName"
label="平台名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.plantformLicense"
label="营业执照号/社会信用代码"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.plantformSite"
label="平台网址"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.plantformPermit"
label="电信业务经营许可证"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.plantformAddress"
label="平台地址"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.legalPerson"
label="法人代表"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
被抽样单位信息(入网经营者信息)
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="netTested.name"
label="单位名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="netTested.samplingPlace"
label="单位地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="netTested.estore"
label="网店商铺名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="netTested.sampleSite"
label="样品网址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="netTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.permitNum"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.linkman"
label="联系人"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.license"
label="营业执照号/社会信用代码"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="netTested.tel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
抽样地点
</table-col>
<table-col>
<van-radio-group disabled v-model="place" direction="horizontal">
<van-radio :name="1+',网购'" shape="square">流通环节:网购</van-radio>
<van-radio :name="2+',外卖餐饮'" shape="square">餐饮环节:外卖餐饮</van-radio>
</van-radio-group>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
样品信息
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.sampleName"
label="样品名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.trademark"
label="商标"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.num"
label="订单编号"
></van-field>
</table-col>
</table-row>
<table-row>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品类型">
<template #input>
<van-radio-group disabled v-model="sample.type" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sampleTypeList">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.typeRemak"
></van-field>
</div>
</template>
</van-field>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品来源">
<template #input>
<van-radio-group disabled v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.sourceRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品属性">
<template #input>
<van-radio-group disabled v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.propertiesRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="sample.dateType" direction="horizontal">
<van-radio name="生产日期" shape="square">生产日期</van-radio>
<van-radio name="加工日期" shape="square">加工日期</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.shelfLife"
label="保质期"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.dateBatch"
label="生产批号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文件"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qualityGrade"
label="质量等级"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.specification"
label="规格型号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.quantity"
label="抽样数量"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.backupQuanity"
label="备样数量"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="抽样方式">
<template #input>
<van-radio-group disabled v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qrcode"
label="条形码"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.price"
label="单价"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="是否进口">
<template #input>
<van-radio-group disabled v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{item.label}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.originPlace"
label="原产地"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="包装分类">
<template #input>
<van-radio-group disabled v-model="sample.packClass" direction="horizontal">
<van-radio v-for="item in packClassList" :name="item" :key="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="储存条件">
<template #input>
<van-checkbox-group disabled v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{item}}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)生产者信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proName"
label="生产者名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proAddress"
label="生产者地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.prolicense"
label="生产许可证号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)第三方企业信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyName"
label="企业名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyAddress"
label="企业地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="企业性质">
<template #input>
<van-radio-group disabled v-model="formObj.thirdPartyNature" direction="horizontal">
<van-radio v-for="item in thirdPartyNatureList" :key="item" :name="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyNatureRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyLicense"
label="企业许可证号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>抽样单位信息</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testName"
label="单位名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testAddress"
label="地址"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testLinkman"
label="联系人"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testTel"
label="电话"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.testFax"
label="传真"
></van-field>
</table-col>
</table-row>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="100px"
label-align="center"
v-model="formObj.remark"
label="备注"
></van-field>
</table-col>
</table-row>
</add-table>
<div class="bottom-btn">
<van-button block type="info" @click="_goto">返回</van-button>
</div>
</div> </div>
</template> </template>
<script> <script>
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
export default { export default {
name: "SamplingListDetail" name: "SamplingListAddNet",
components: {
"add-table": SamplingListAddTable,
"table-row": TableRow,
"table-col": TableCol
},
data() {
return {
formObj: {
samplingNum: '',
taskNum: '',
source: '',
taskType: '',
sampleName: '',
dateBatch: '',
proName: '',
proAddress: '',
prolicense: '',
proTel: '',
thirdPartyName: '',
thirdPartyAddress: '',
thirdPartyNature: '',
thirdPartyNatureRemark: '',
thirdPartyLicense: '',
thirdPartyTel: '',
testName: '',
testAddress: '',
testLinkman: '',
testTel: '',
testFax: '',
remark: ''
},
netTested: {
plantformName: '',
plantformLicense: '',
plantformSite: '',
plantformPermit: '',
plantformAddress: '',
legalPerson: '',
name: '',
samplingPlace: '',
estore: '',
sampleSite: '',
permitType: '',
permitNum: '',
linkman: '',
license: '',
tel: '',
placeLink: '',//保存时单独赋值 从place字段分离出
place: '', //保存时单独赋值 从place字段分离出
},
sample: {
trademark: '',
num: '',
type: '',
typeRemak: '',
source: '',
sourceRemark: '',
properties: '',
propertiesRemark: '',
dateType: '',
shelfLife: '',
standard: '',
qualityGrade: '',
specification: '',
quantity: '',
backupQuanity: '',
samplingMethod: '',
qrcode: '',
price: '',
inward: '',
originPlace: '',
packClass: '',
storageCondition: '',
storageConditionRemark: '',
},
taskTypeList: ['监督抽检', '风险监测', '评价性抽检'],
permitTypeList: ['经营许可证号', '生产许可证号'],
sampleTypeList: ['食用农产品', '工业加工食品', '餐饮加工食品', '食品添加剂', '食品相关产品', '其他',],
sourceList: ['加工/自制', '委托生产', '外购', '其他'],
propertiesList: ['普通食品', '特殊食品', '节令食品', '重大活动保障食品', '其他',],
samplingMethodList: ['无菌抽样', '非无菌抽样'],
trueOrFalseList: [{label: '是', value: 1}, {label: '否', value: 0}],
packClassList: ['预包装', '非定量包装', '无包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
place: '',
storageCondition: [],
id: '',
}
},
mounted() {
this._open()
},
methods: {
_open() {
this.id = this.$route.query.id
this._getData()
},
_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
}
},
_goto() {
this.$router.go(-1)
},
}
} }
</script> </script>
<style scoped> <style lang="less">
@import "../../styles/sampling-list-add.less";
</style> </style>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
:finished="finished" :finished="finished"
finished-text="没有更多了" finished-text="没有更多了"
@load="_load"> @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.name}}</div>
<div>抽样进度:{{item.completionRatio}}</div> <div>抽样进度:{{item.completionRatio}}</div>
<div>状态:{{item.progress}}</div> <div>状态:{{item.progress}}</div>
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
finished: false,//没有更多数据 finished: false,//没有更多数据
} }
}, },
mounted() {
this._getData()
},
methods: { methods: {
//简单查询 清空高级查询条件 赋值简单查询数据 //简单查询 清空高级查询条件 赋值简单查询数据
_search(value) { _search(value) {
...@@ -125,14 +128,14 @@ ...@@ -125,14 +128,14 @@
}, },
_refresh() { _refresh() {
this.page = 1; this.page = 1;
// this._getData() this._getData()
}, },
_load() { _load() {
this.page = this.page + 1; this.page = this.page + 1;
this._getData() this._getData()
}, },
_goto() { _goto(id) {
this.$router.push('/sampling_list/sampling_list') this.$router.push({path:'/sampling_list/sampling_list',query:{planId:id}})
}, },
} }
} }
......
...@@ -9,34 +9,26 @@ ...@@ -9,34 +9,26 @@
:safe-area-inset-bottom="true" :safe-area-inset-bottom="true"
:close-on-popstate="true" :close-on-popstate="true"
:style="{ height: '70%' }"> :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 class="popup-cont-btn popup-shelves">
<div> <div>
<p>抽样单类型</p> <p>抽样单类型</p>
<van-radio-group v-model="radio" direction="horizontal"> <van-radio-group v-model="radio" direction="horizontal">
<van-radio name="1">网络</van-radio> <van-radio :name="1">网络</van-radio>
<van-radio name="2">非网络</van-radio> <van-radio :name="0">非网络</van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
<div> <div>
<p>所属货架</p> <p>所属货架</p>
<van-tree-select <van-tree-select
height="100%" height="100%"
:items="items" :items="places"
:active-id.sync="activeId" :active-id.sync="activeId"
:main-active-index.sync="activeIndex" :main-active-index.sync="activeIndex"
></van-tree-select> ></van-tree-select>
</div> </div>
</div> </div>
<div class="bottom-btn bottom-btn-two"> <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> <van-button square type="info" @click="_ok">确定</van-button>
</div> </div>
</van-popup> </van-popup>
...@@ -44,15 +36,15 @@ ...@@ -44,15 +36,15 @@
</template> </template>
<script> <script>
import {samplingPlace} from '../../../api'
export default { export default {
name: "SelectShelves", name: "SelectShelves",
data() { data() {
return { return {
showPopup: false, showPopup: false,
// items: [{text: '地点 1'}, {text: '地点 2'}], radio: -1,
shelvesList: [], places: [
radio: 0,
items: [
{ {
text: '地点1', text: '地点1',
children: [ children: [
...@@ -71,44 +63,60 @@ ...@@ -71,44 +63,60 @@
children: [ children: [
{ {
text: '货架2-1', text: '货架2-1',
id: 23, id: 3,
}, },
{ {
text: '货架2-2', text: '货架2-2',
id: 24, id: 4,
},
],
},
{
text: '地点3',
children: [
{
text: '货架3-1',
id: 5,
},
{
text: '货架3-2',
id: 6,
}, },
], ],
}, },
], ],
active: 0, activeId: '',
activeId: 0,
activeIndex: 0, activeIndex: 0,
planId: ''
} }
}, },
methods: { methods: {
_open() { _open(planId) {
this.showPopup = true this.showPopup = true
this.radio = -1
this.activeId = ''
this.planId = planId
this._getShelves()
}, },
_getShelves(item) { _getShelves: async function () {
if (item === 0) { let result = await samplingPlace.listPlaces({planId: this.planId})
this.shelvesList = ['货架1'] if (result) {
this.places = result
} else { } else {
this.shelvesList = ['货架2'] this.places = []
} }
}, },
_selectResult(item) {
console.log(item, 123)
},
_cancel() { _cancel() {
this.showPopup = false this.showPopup = false
}, },
_ok() { _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*/ /*todo 修改toast默认配置 https://youzan.github.io/vant/#/zh-CN/toast#xiu-gai-mo-ren-pei-zhi*/
this.$toast('请选择抽样单类型!'); this.$toast('请选择抽样单类型!');
} else if (this.activeId === '') {
this.$toast('请选择货架!')
} else { } else {
this.$emit('on-select', {testedType: this.radio, shelfId: this.activeId})
this.$emit('on-select', this.radio)
} }
} }
} }
......
<template>
<div>
<div class="layout-cont-btn" style="background: #576b95">
<van-pull-refresh v-model="refreshing" @refresh="_refresh">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="_load">
<van-swipe-cell v-for="item in resultList" :key="item.name">
<div class="result-item" @click="_download(item)">
<div>附件名称:{{item.fileName +'.'+item.type }}</div>
</div>
<template #right>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del(item.id)"></van-button>
</template>
</van-swipe-cell>
</van-list>
</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>
</div>
</div>
</template>
<script>
import {samplingPlanAttachment} from '../../../api'
export default {
data() {
return {
title: '附件',
noDataTitle: '相关附件',
resultList: [],
page: 1,
rows: 20,
contractId: '',
showPrompt: false,
height: '',
imgList: [{
src: '',
}],
preview: false,
fileRename: '',
tempData: {},
loading: false,//加载中...
finished: false,//没有更多数据
refreshing: false,//刷新中...
//文件id
fileId: '',
//上传图片路径:
action: '',
isApp: true
}
},
mounted() {
this.contractId = this.$route.query.contractId;
this.action = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/' + this.contractId;
this._getData();
},
methods: {
_refresh() {
this.page = 1
this._getData()
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
contractId: this.contractId
};
return this.$serializeForm(data)
},
_getData: async function () {
let result = await samplingPlanAttachment.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
}
},
_load() {
this.page = this.page + 1;
this._getData()
},
//关闭图片
_close() {
this.imgList[0].src = '';
},
//路由跳转
_goto(next) {
let data = {contractId: this.contractId};
this.$router.push({path: next, query: data})
},
_resultChange(msg) {
if (this.$store.state.samplingPlanAttachment.success) {
this.$vux.toast.show({
type: 'text',
width: '10em',
text: msg,
});
this._search();
}
},
_del(id) {
let flag = this.$route.query.flag;
let data = {};
if (flag === undefined) {
//只可以删除自己上传的附件
data = {id: id, flag: 1};
} else {
//可以删除全部
data = {id: id};
}
this.$store.dispatch('samplingPlanAttachment/deleteByIds', data).then(() => {
this._resultChange('删除成功');
});
},
_addResult() {
this.showPrompt = true;
},
//下载附件
_download(data) {
this.tempData = data;
if (data.type.toLowerCase() === 'jpg' || data.type.toLowerCase() === 'png') {
//预览图片
this.imgList[0].src = this.$global.baseURL + '/drs/v1/sampling_plan_attachment/down?id=' + data.id + '&objectKey=' + data.objectKey;
this.$refs.previewer.show(0);
} else {
//下载文件
let name = '';
if (data.remark === undefined) {
name = data.fileName;
} else {
name = data.remark;
}
this.$router.push({
path: '/sampling/file_down_load',
query: {fileName: name, id: this.tempData.id, ctime: this.tempData.ctime, remark: data.fileName}
})
}
},
//文件重命名
_reName(data) {
this.fileRename = data.fileName;
this.preview = true;
this.fileId = data.id;
},
_cancel() {
this.preview = false;
},
_ok() {
this.preview = false;
let tempData = {
id: this.fileId,
remark: this.fileRename
};
this.$store.dispatch('samplingPlanAttachment/fileSetName', tempData).then(() => {
this._resultChange('修改成功');
});
},
/****************************************上传图片*************************************************/
_uploadImg() {
this.showPrompt = false;
plus.nativeUI.actionSheet({
title: "选择图片",
cancel: "取消",
buttons: [{title: "拍照"}, {title: "相册"}]
}, (e) => {
let index = e.index;
switch (index) {
case 1:
//拍照上传
this._camera();
break;
case 2:
//从相册选择上传
this._pickPhoto();
break
}
});
},
//拍照上传
_camera() {
plus.camera.getCamera().captureImage((e) => {
plus.io.resolveLocalFileSystemURL(e, (entry) => {
var url = entry.toLocalURL();
var name = url.substr(e.lastIndexOf('/') + 1);
//压缩
plus.zip.compressImage({
src: url,
dst: '_doc/' + name,
overwrite: true,
quality: 30,
}, (zip) => {
let files = [{key: 'imgUpload', path: zip.target}];
this._submitImg(files);
}, (error) => {
console.log('压缩失败', error)
});
}, (e) => {
console.log("读取拍照文件错误:" + e.message);
});
}, (s) => {
console.log("error" + s);
}, {});
},
//从相册选择上传
_pickPhoto() {
//多选
plus.gallery.pick((e) => {
let files = [];
let url = '';
let name = '';
for (let i in e.files) {
url = e.files[i];
name = url.substr(url.lastIndexOf('/') + 1);
//压缩取得缩略图
plus.zip.compressImage({
src: url,
dst: '_doc/' + name,
overwrite: true,
quality: 30,
}, (zip) => {
files = [{key: 'imgUpload' + i, path: zip.target}];
this._submitImg(files);
}, (error) => {
console.log('压缩失败',error)
});
}
}, (e) => {
console.log('打开相册失败', e)
}, {filter: 'image', multiple: true, system: false});
},
//上传
_submitImg(files) {
var task = plus.uploader.createUpload(this.action,
{method: "POST"},
(t, status) => { //上传完成
console.log(t, status)
this._search();
}
);
//单图片上传
let tempData = files[0];
task.addFile(tempData.path, {key: tempData.key});
task.setRequestHeader('accessToken', localStorage.getItem('accessToken'));
task.start();
},
/****************************************上传图片*************************************************/
}
}
</script>
<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 @@ ...@@ -16,9 +16,9 @@
</div> </div>
<template #right> <template #right>
<van-button square type="info" text="打卡" class="swipe-cell-btn" <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" <van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_delLoc(id)"></van-button> @click="_delLoc(item.id)"></van-button>
</template> </template>
</van-swipe-cell> </van-swipe-cell>
</van-list> </van-list>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</template> </template>
<script> <script>
import {samplingPlan, samplingPlace} from '../../../api' import {samplingPlace} from '../../../api'
export default { export default {
name: "SelectLocation", name: "SelectLocation",
...@@ -106,10 +106,9 @@ ...@@ -106,10 +106,9 @@
}, },
_addOk: async function () { _addOk: async function () {
let data = { let data = {
planId: this.planId, ids: this.checkListValue.join(',')
placeIds: this.checkListValue.join(',')
} }
let result = await samplingPlan.savePlace(data) let result = await samplingPlace.addMulti(data)
if (result) { if (result) {
this.$toast('操作成功') this.$toast('操作成功')
this.$emit('refresh') this.$emit('refresh')
......
...@@ -4,6 +4,9 @@ import SamplingListAddNet from '@/page/sampling-list/SamplingListAddNet.vue' ...@@ -4,6 +4,9 @@ import SamplingListAddNet from '@/page/sampling-list/SamplingListAddNet.vue'
import SamplingListAdd from '@/page/sampling-list/SamplingListAdd.vue' import SamplingListAdd from '@/page/sampling-list/SamplingListAdd.vue'
import SamplingListDetail from '@/page/sampling-list/SamplingListDetail.vue' import SamplingListDetail from '@/page/sampling-list/SamplingListDetail.vue'
import SamplingListDetailNet from '@/page/sampling-list/SamplingListDetailNet.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 [ export default [
{path: 'sampling_task', component: SamplingTask, meta: {title: '抽样任务'}}, {path: 'sampling_task', component: SamplingTask, meta: {title: '抽样任务'}},
...@@ -12,4 +15,7 @@ export default [ ...@@ -12,4 +15,7 @@ export default [
{path: 'sampling_list_add_net', component: SamplingListAddNet, meta: {title: '抽样单添加-网络'}}, {path: 'sampling_list_add_net', component: SamplingListAddNet, meta: {title: '抽样单添加-网络'}},
{path: 'sampling_list_detail', component: SamplingListDetail, meta: {title: '抽样单详情-非网络'}}, {path: 'sampling_list_detail', component: SamplingListDetail, meta: {title: '抽样单详情-非网络'}},
{path: 'sampling_list_detail_net', component: SamplingListDetailNet, 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 { ...@@ -193,10 +193,18 @@ html, body, #app, .main-content-con {
height: auto; height: auto;
background: @background-color-white; background: @background-color-white;
margin-top: 10px; margin-top: 10px;
padding: 10px; padding: 10px 0;
border-top: 1px solid @border-color; border-top: 1px solid @border-color;
border-bottom: 1px solid @border-color; border-bottom: 1px solid @border-color;
font-size: 12px; font-size: 12px;
display: flex;
flex-wrap: wrap;
> div {
width: 50%;
padding: 0 10px;
line-height: 24px;
}
} }
.swipe-cell-btn { .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