Commit 071e02b8 by lichengming

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

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