Commit 071e02b8 by lichengming

修改了委托单登记导入试验项目

parent bb378d5b
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change /> <SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change />
<assignPerson ref="userModal" @on-result-change="_userResult"></assignPerson> <assignPerson ref="userModal" @on-result-change="_userResult"></assignPerson>
<SampleItemRemove ref="sampleItemRemove" @on-result-change = '_removeItemBack'></SampleItemRemove> <SampleItemRemove ref="sampleItemRemove" @on-result-change = '_removeItemBack'></SampleItemRemove>
<SampleItemEdit ref="sampleItemEdit"></SampleItemEdit> <SampleItemEdit ref="sampleItemEdit" @on-result-change = '_removeItemBack'></SampleItemEdit>
</div> </div>
</template> </template>
<script> <script>
...@@ -389,12 +389,13 @@ export default { ...@@ -389,12 +389,13 @@ export default {
console.log('试验项目', itemInfo) console.log('试验项目', itemInfo)
this.sampleItemList = itemInfo.experimentList this.sampleItemList = itemInfo.experimentList
if (itemInfo.sampleCode !== '') { if (itemInfo.sampleCode !== '') {
this.$refs.sampleItemEdit._open(itemInfo.id) this.$refs.sampleItemEdit._open(this.sampleItemList)
} else { } else {
this.$refs.sampleItemRemove._open(this.sampleItemList) this.$refs.sampleItemRemove._open(this.sampleItemList)
} }
}, },
_removeItemBack(data) { _removeItemBack(data) {
this.$forceUpdate()
if (data) { if (data) {
this.getPage.records[this.currentIndex].experimentList = data this.getPage.records[this.currentIndex].experimentList = data
const itemNames = [] const itemNames = []
...@@ -405,36 +406,33 @@ export default { ...@@ -405,36 +406,33 @@ export default {
',' ','
) )
} }
this.$set(
this.getPage.records,
this.currentIndex,
this.getPage.records[this.currentIndex]
)
}, },
_itemImportBack(data) { _itemImportBack(data) {
this.$forceUpdate() this.$forceUpdate()
console.log('传过来的数据', data)
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
data[i].id = undefined data[i].id = undefined
} }
const info = data const info = data
console.log('去掉id后的data', info)
for (let i = 0; i < this.indexList.length; i++) { for (let i = 0; i < this.indexList.length; i++) {
const index = this.indexList[i] const index = this.indexList[i]
if (this.getPage.records[index].experiments !== undefined) { if (
this.getPage.records[index].experimentList !== undefined &&
this.getPage.records[index].experimentList !== []
) {
const name = [] const name = []
if (this.getPage.records[index].experimentList) { this.itemList = this.getPage.records[index].experimentList
this.itemList = this.getPage.records[index].experimentList name.push(this.getPage.records[index].experiments)
name.push(this.getPage.records[index].experiments) for (let i = 0; i < info.length; i++) {
for (let i = 0; i < info.length; i++) { this.itemList.push(info[i])
console.log(this.getPage.records[index].experiments[i]) name.push(info[i].name)
this.itemList.push(info[i])
name.push(info[i].name)
}
this.getPage.records[index].experiments = name.join('、')
this.getPage.records[index].experimentList = this.itemList
} else {
name.push(this.getPage.records[index].experiments)
for (let i = 0; i < info.length; i++) {
name.push(info[i].name)
}
this.getPage.records[index].experiments = name.join('、')
} }
this.getPage.records[index].experiments = name.join('、')
this.getPage.records[index].experimentList = this.itemList
this.$set(this.getPage.records, index, this.getPage.records[index]) this.$set(this.getPage.records, index, this.getPage.records[index])
} else { } else {
const name = [] const name = []
...@@ -448,22 +446,13 @@ export default { ...@@ -448,22 +446,13 @@ export default {
this.$set(this.getPage.records, index, this.getPage.records[index]) this.$set(this.getPage.records, index, this.getPage.records[index])
} }
} }
if (this.edit) {
const sampleData = {}
sampleData.id = this.id
sampleData.sampleList = this.getPage.records
this._sampleEdit(sampleData)
}
console.log(this.getPage.records)
}, },
_selectPerson() { _selectPerson() {
this.$refs.userModal._openOrg('选择制表人', 'itemTree') this.$refs.userModal._openOrg('选择制表人', 'itemTree')
}, },
_userResult(data, msg) { _userResult(data, msg) {
this.$forceUpdate() this.$forceUpdate()
console.log(data, msg)
this.formObj.tabulater = data.realname this.formObj.tabulater = data.realname
console.log(this.formObj.tabulater)
}, },
_packChange(msg, data) { _packChange(msg, data) {
switch (msg) { switch (msg) {
...@@ -486,9 +475,6 @@ export default { ...@@ -486,9 +475,6 @@ export default {
} }
}, },
_cusNameChange(msg, data) { _cusNameChange(msg, data) {
console.log(msg, data)
console.log('选择')
// this.financeObj = {} // 清空维护发票信息的数据
if (this.$string(this.id).isEmpty()) { if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位 // 添加的时候选择单位
switch (msg) { switch (msg) {
...@@ -501,9 +487,6 @@ export default { ...@@ -501,9 +487,6 @@ export default {
} }
} else if (this.customerData.indexOf(data) !== -1) { } else if (this.customerData.indexOf(data) !== -1) {
this._getQueryList(data) this._getQueryList(data)
// 编辑的时候选择单位(互不影响)
// this.cusName = data
// this.formObj.customer.cname = data
} else { } else {
} }
}, },
...@@ -591,12 +574,10 @@ export default { ...@@ -591,12 +574,10 @@ export default {
} }
}, },
_selectjudgeBasis(index) { _selectjudgeBasis(index) {
console.log(index)
this.index = index this.index = index
this.$refs.EditModal._open() this.$refs.EditModal._open()
}, },
_selectverification(index) { _selectverification(index) {
console.log(index)
this.index = index this.index = index
this.$refs.VerificationModal._open() this.$refs.VerificationModal._open()
}, },
...@@ -612,8 +593,6 @@ export default { ...@@ -612,8 +593,6 @@ export default {
this.getPage.records[this.index].price = data.price this.getPage.records[this.index].price = data.price
this.getPage.records[this.index].totalPrice = this.getPage.records[this.index].totalPrice =
data.price * this.getPage.records[this.index].quantity data.price * this.getPage.records[this.index].quantity
console.log('返回的数据', data)
console.log(this.getPage.records)
}, },
_backContract(data) { _backContract(data) {
this.formObj.client = data.client this.formObj.client = data.client
...@@ -648,8 +627,7 @@ export default { ...@@ -648,8 +627,7 @@ export default {
samplePack: '', samplePack: '',
sampleDescribe: '', sampleDescribe: '',
siteNo: '', siteNo: '',
experiments: '', experiments: ''
experimentList: []
} }
this.getPage.records.unshift(data) this.getPage.records.unshift(data)
}, },
......
...@@ -9,23 +9,8 @@ ...@@ -9,23 +9,8 @@
title="检测项目管理" title="检测项目管理"
> >
<Row> <Row>
<Col span="24">
<Form v-model="formObj" :label-width="90" inline onsubmit="return false">
<Form-item class="search-item" label="试验名称:" style="margin-left: -25px">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入试验名称" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--正常界面--> <!--正常界面-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" />
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :loading="true" <PTVXETable ref="pageTable" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data> :get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column <vxe-table-column
...@@ -119,19 +104,25 @@ export default { ...@@ -119,19 +104,25 @@ export default {
itemList: { itemList: {
records: [] records: []
}, },
getPage: {}, getPage: {
records: []
},
selectData: [], selectData: [],
originalList: [] originalList: []
} }
}, },
methods: { methods: {
_open(id) { _open(expList) {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.showModal = true this.showModal = true
this.formObj.sampleId = id this.getPage.records = expList
this.$refs.pageTable._hideLoading() this.selectData = []
console.log(expList)
this.$refs.pageTable._clearSelection()
// this.formObj.sampleId = id
// this.$refs.pageTable._hideLoading()
// if (catalogueId) { // if (catalogueId) {
this._page() // this._page()
// } // }
}, },
_handleRow(scope) { _handleRow(scope) {
...@@ -151,7 +142,7 @@ export default { ...@@ -151,7 +142,7 @@ export default {
this._cancel() this._cancel()
break break
case '保存': case '保存':
this._ok() this._saveCatalogueItem()
break break
} }
}, },
...@@ -178,25 +169,30 @@ export default { ...@@ -178,25 +169,30 @@ export default {
_iconClick(res, data) { _iconClick(res, data) {
switch (res) { switch (res) {
case '删除': case '删除':
this._deleteById(data.id) this._deleteById(data.id, data.index)
break break
} }
}, },
// 删除 // 删除
_deleteById(id) { _deleteById(id, index) {
this.$Modal.confirm({ this.$Modal.confirm({
title: '提示', title: '提示',
content: '确定删除该数据?', content: '确定删除该数据?',
onOk: () => { onOk: () => {
this._deleteOk(id) this._deleteOk(id, index)
} }
}) })
}, },
_deleteOk: async function(id) { _deleteOk: async function(id, index) {
const result = await soilEntrust.experimentDeleteById(id) if (id) {
if (result) { const result = await soilEntrust.experimentDeleteById(id)
this.$Message.success('删除成功') if (result) {
this._page() this.$Message.success('删除成功')
this.getPage.records.splice(index, 1)
}
} else {
this.$Message.success('成功删除')
this.getPage.records.splice(index, 1)
} }
}, },
// table结果 返回整行 // table结果 返回整行
...@@ -222,12 +218,14 @@ export default { ...@@ -222,12 +218,14 @@ export default {
}, },
_saveCatalogueItem(data) { _saveCatalogueItem(data) {
this.showModal = false this.showModal = false
this.$emit('on-result-change', data) this.$emit('on-result-change', this.getPage.records)
this._hideLoading() this._hideLoading()
console.log(this.getPage.records)
}, },
_cancel() { _cancel() {
this.selectData = [] this.selectData = []
this.showModal = false this.showModal = false
this.$emit('on-result-change', this.getPage.records)
}, },
_visibleChange() { _visibleChange() {
const data = this.itemList.records const data = this.itemList.records
......
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