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">
...@@ -20,13 +21,13 @@ ...@@ -20,13 +21,13 @@
@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
}
}, },
_goto(){ _refresh() {
this.$router.push('/sampling_list/sampling_list_detail') this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_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 @@ ...@@ -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>
......
...@@ -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>
......
...@@ -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 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