Commit 8058e30e by wangweidong

整体优化

parent 01accc19
......@@ -18,6 +18,16 @@ export default {
https
.post('meter/v1/item/add_send_entrust', JSON.stringify(data))
.then(res => res),
saveItems: data =>
http
.post(
'meter/v1/item/add_sample_item?sampleIds=' +
data.sampleIds +
'&itemIds=' +
data.itemIds
)
.then(res => res),
testValue: data =>
http
.post(
......
......@@ -34,7 +34,7 @@
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:rows="100" is-task>
:rows="100" is-task :isRadio="true" hide-checkbox>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
......@@ -100,19 +100,6 @@ export default {
}
},
methods: {
_dicSearch() {
this.$store
.dispatch('LmsBaseDict/getItem', '个人任务是否勾选')
.then(() => {
const resultData = this.$store.state.LmsBaseDict.item
if (resultData.length > 0) {
this.personal = resultData[0].name === '是' ? 1 : 0
} else {
this.personal = 1
}
this._page()
})
},
_btnClick() {},
_selInputResult1(msg, data) {
switch (msg) {
......@@ -122,7 +109,6 @@ export default {
}
},
_open() {
// this._dicSearch()
this._page()
},
_searchParams() {
......@@ -135,35 +121,20 @@ export default {
return obj
},
_page: async function() {
console.log(9522123)
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
// Object.assign(this.formObj, this.$refs.pageTable._searchParams())
// console.log('this.formObj', this.formObj)
const result = await meterManage.page(this.formObj)
if (result) {
console.log(55555)
console.log(result)
this.getPage = result
console.log(123456789)
console.log(this.getPage)
this.$refs.pageTable._hideLoading()
}
},
// _page() {
// // this.$refs.pageTable._page(
// // 'data-input-contract-left',
// // 'FoodContract/dataInputContractLeft',
// // this._searchParams()
// // )
// },
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.$emit('on-result-change', data, this.personal)
break
case 'singleSelect':
this.$emit('on-result-change', data.id, this.personal)
break
case 'changeSize':
this._page()
this._clear()
......@@ -182,19 +153,6 @@ export default {
this.$refs.pageTable._pageChange(1)
this._clear()
}
// 委托详情
// _detailModal(data) {
// this.$store.dispatch('FoodContract/getById', data.id).then(() => {
// if (data.type === 1) {
// this.currentComponent = 'FoodContractGovernDetail'
// } else {
// this.currentComponent = 'FoodContractCompanyDetail'
// }
// this.$nextTick(function() {
// this.$refs.refModal._open(this.$store.state.FoodContract.model)
// })
// })
// }
}
}
</script>
......@@ -9,12 +9,17 @@
<ContractRightList ref="rightModal" @on-result-change="_rightResult"></ContractRightList>
</template>
</TwoColumnPage>
<div slot="footer" class="btn-width">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import TwoColumnPage from '../../components/base/TwoColumnPage'
import { meterItem } from '../../api'
import ContractLeftList from './ContractLeftList'
import ContractRightList from './ContractRightList'
......@@ -26,26 +31,62 @@ export default {
},
data() {
return {
showModal: false
showModal: false,
sampleIds: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '添加', type: 'primary' }
],
itemIds: []
}
},
methods: {
_open() {
// this.formObj.entrustId = id
_open(sampleIds) {
this.showModal = true
this.sampleIds = sampleIds
this.$refs.leftModal._open()
// this._page()
},
_leftResult(data, personal) {
this.$refs.rightModal._open(data, personal)
// console.log(data, personal)
},
_rightResult() {
this.$refs.leftModal._page()
_rightResult(data) {
if (undefined !== data) {
this.itemIds = data
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '添加':
this._ok()
break
}
},
_cancel() {
this.showModal = false
},
_ok() {
if (this.itemIds.length === 0) {
this.$Message.warning('请选择要添加的检测项目!')
this.$refs.footerModal._hideLoading()
return false
}
this._saveItemForSample({
sampleIds: this.sampleIds,
itemIds: this.itemIds
})
},
_saveItemForSample: async function(data) {
const result = await meterItem.saveItems(data)
if (result) {
this.$Message.success('添加成功!')
this.$refs.footerModal._hideLoading()
this.$emit('on-result-change')
this._cancel()
}
}
// _open() {
// this.$refs.leftModal._open()
// }
}
}
</script>
......@@ -134,6 +134,7 @@ export default {
{ title: '样品名称', key: 'name', width: 140 },
{ title: '型号规格', key: 'spec', width: 140 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 },
{ title: '所检项目', key: 'itemNames', width: 140 },
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
......
......@@ -130,6 +130,7 @@ export default {
{ title: '样品名称', key: 'name', width: 140 },
{ title: '型号规格', key: 'spec', width: 140 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 },
{ title: '检测项目', key: 'itemNames', width: 140 },
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
......@@ -166,12 +167,6 @@ export default {
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
......@@ -223,7 +218,6 @@ export default {
}
},
_sampleEditModal(data) {
console.log(data)
this.$refs.sampleEditModal._open(data.id)
},
_tableResultChange(msg, data) {
......@@ -404,7 +398,7 @@ export default {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.importModal._open(this.selectIds, this.selectData[0])
this.$refs.importModal._open(this.selectIds)
}
},
_subpackageSample() {
......
......@@ -9,12 +9,17 @@
<ContractRightList ref="rightModal" @on-result-change="_rightResult"></ContractRightList>
</template>
</TwoColumnPage>
<div slot="footer" class="btn-width">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import TwoColumnPage from '../../../components/base/TwoColumnPage'
import { meterItem } from '../../../api'
import ContractLeftList from './ContractLeftList'
import ContractRightList from './ContractRightList'
......@@ -26,26 +31,62 @@ export default {
},
data() {
return {
showModal: false
showModal: false,
sampleIds: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '添加', type: 'primary' }
],
itemIds: []
}
},
methods: {
_open() {
// this.formObj.entrustId = id
_open(sampleIds) {
this.showModal = true
this.sampleIds = sampleIds
this.$refs.leftModal._open()
// this._page()
},
_leftResult(data, personal) {
this.$refs.rightModal._open(data, personal)
// console.log(data, personal)
},
_rightResult() {
this.$refs.leftModal._page()
_rightResult(data) {
if (undefined !== data) {
this.itemIds = data
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '添加':
this._ok()
break
}
},
_cancel() {
this.showModal = false
},
_ok() {
if (this.itemIds.length === 0) {
this.$Message.warning('请选择要添加的检测项目!')
this.$refs.footerModal._hideLoading()
return false
}
this._saveItemForSample({
sampleIds: this.sampleIds,
itemIds: this.itemIds
})
},
_saveItemForSample: async function(data) {
const result = await meterItem.saveItems(data)
if (result) {
this.$Message.success('添加成功!')
this.$refs.footerModal._hideLoading()
this.$emit('on-result-change')
this._cancel()
}
}
// _open() {
// this.$refs.leftModal._open()
// }
}
}
</script>
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