Commit 3fff0d1f by lichengming

修改了委托单登记删除试验项目

parent 25871830
...@@ -108,6 +108,9 @@ ...@@ -108,6 +108,9 @@
@on-result-change="_soilChange" name="sampleDescribe" placeholder="请输入或选择土质描述" @on-result-change="_soilChange" name="sampleDescribe" placeholder="请输入或选择土质描述"
></AutoComplete> ></AutoComplete>
</div> </div>
<div v-else-if="item.key==='experiments'" @click.stop="_handleRow(scope)">
<span @click="_removeItem(scope.row)">{{scope.row[item.key]}}</span>
</div>
<span v-else> {{ scope.row[item.key] }}</span> <span v-else> {{ scope.row[item.key] }}</span>
</template> </template>
</vxe-table-column> </vxe-table-column>
...@@ -120,6 +123,8 @@ ...@@ -120,6 +123,8 @@
<importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal> <importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal>
<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>
<SampleItemEdit ref="sampleItemEdit"></SampleItemEdit>
</div> </div>
</template> </template>
<script> <script>
...@@ -132,12 +137,16 @@ import AutoComplete from '../../../components/base/AutoCompletes' ...@@ -132,12 +137,16 @@ import AutoComplete from '../../../components/base/AutoCompletes'
import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect' import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect'
import assignPerson from '../../../components/user-info-single/assignPerson' import assignPerson from '../../../components/user-info-single/assignPerson'
import Global from '../../../api/config' import Global from '../../../api/config'
import SampleItemRemove from './SampleItemRemove'
import SampleItemEdit from './SampleItemEdit'
export default { export default {
components: { components: {
AutoComplete, AutoComplete,
importModal, importModal,
SampleItemSelect, SampleItemSelect,
assignPerson assignPerson,
SampleItemRemove,
SampleItemEdit
}, },
data() { data() {
const validatefee = (rule, value, callback) => { const validatefee = (rule, value, callback) => {
...@@ -375,6 +384,27 @@ export default { ...@@ -375,6 +384,27 @@ export default {
this.$forceUpdate() this.$forceUpdate()
this.formObj.testType = data this.formObj.testType = data
}, },
_removeItem(itemInfo) {
console.log('试验项目', itemInfo)
this.itemList = itemInfo.experimentList
if (this.edit) {
this.$refs.sampleItemEdit._open(itemInfo.id)
} else {
this.$refs.sampleItemRemove._open(this.itemList)
}
},
_removeItemBack(data) {
if (data) {
this.getPage.records[this.currentIndex].experimentList = data
const itemNames = []
for (let j = 0; j < data.length; j++) {
itemNames.push(data[j].name)
}
this.getPage.records[this.currentIndex].experiments = itemNames.join(
','
)
}
},
_itemImportBack(data) { _itemImportBack(data) {
this.$forceUpdate() this.$forceUpdate()
console.log('传过来的数据', data) console.log('传过来的数据', data)
...@@ -507,39 +537,9 @@ export default { ...@@ -507,39 +537,9 @@ export default {
} }
}, },
_inputBack(data) { _inputBack(data) {
console.log(data)
if (data) { if (data) {
this._getByEntrustId(this.id) this._getByEntrustId(this.id)
} }
// if (undefined !== data) {
// if (this.getPage.records.length > 0) {
// const j = this.getPage.records.length
// for (let i = j; i < data.length + j; i++) {
// console.log(i)
// this.getPage.records.push(data[i - j])
// if (data[i - j].lastTime !== undefined) {
// this.getPage.records[i].lastTime = new Date(data[i - j].lastTime)
// }
// console.log(this.getPage.records)
// // this.getPage.records[i].lastTime = new Date(data[0].lastTime)
// }
// } else {
// for (let i = 0; i < data.length; i++) {
// // if (this.getPage.records[i].lastTime !== undefined) {
// // const t = this.getPage.records[i].lastTime
// // const d = t.valueOf(t)
// // console.log('时间戳', d)
// // this.getPage.records[i].lastTime = d
// // this.getPage.records = []
// // }
// this.getPage.records.push(data[i])
// if (data[i].lastTime !== undefined) {
// this.getPage.records[i].lastTime = new Date(data[i].lastTime)
// }
// console.log(data[i].lastTime)
// }
// }
// }
}, },
_ctimeChange(data) { _ctimeChange(data) {
this.formObj.entrustDate = data this.formObj.entrustDate = data
...@@ -676,9 +676,6 @@ export default { ...@@ -676,9 +676,6 @@ export default {
case 'iconClick': case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex) this._iconClick(data.name, data.rowData, data.rowIndex)
break break
// case 'changeSize':
// this._page()
// break
} }
}, },
allSelect(data) { allSelect(data) {
...@@ -804,15 +801,11 @@ export default { ...@@ -804,15 +801,11 @@ export default {
if (valid) { if (valid) {
const data = this.$serialize('MeterSendTestEdit') const data = this.$serialize('MeterSendTestEdit')
console.log(this.getPage.records) console.log(this.getPage.records)
// Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) { if (this.$string(this.id).isEmpty()) {
// 添加 // 添加
// const saveData = this.formObj
data.sampleList = this.getPage.records data.sampleList = this.getPage.records
console.log(data)
this._save(data) this._save(data)
} else { } else {
// const saveData = this.formObj
data.id = this.id data.id = this.id
data.sampleList = this.getPage.records data.sampleList = this.getPage.records
console.log(data) console.log(data)
...@@ -949,12 +942,13 @@ export default { ...@@ -949,12 +942,13 @@ export default {
} }
}, },
_save: async function(data) { _save: async function(data) {
this._hideLoading()
console.log(data)
const result = await soilEntrust.save(data) const result = await soilEntrust.save(data)
console.log(result)
if (result) { if (result) {
this._resultChange('添加成功!') this._resultChange('添加成功!')
} else {
setTimeout(() => {
this._hideLoading()
}, 500)
} }
}, },
_edit: async function(data) { _edit: async function(data) {
......
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
@on-cancel="_cancel"
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
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilEntrust } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {
catalogueId: '',
name: '',
code: '',
standardCode: '',
standardName: ''
},
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [
{
type: 'md-trash',
id: '',
name: '删除'
}
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '方法', key: 'testMethod', width: 180 }
],
catalogueId: '',
itemList: {
records: []
},
getPage: {},
selectData: [],
originalList: []
}
},
methods: {
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.formObj.sampleId = id
this.$refs.pageTable._hideLoading()
// if (catalogueId) {
this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.pageItem(
this.$serializeForm(this.formObj)
)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteById(data.id)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
_deleteOk: async function(id) {
const result = await soilEntrust.deleteById(id)
if (result) {
this.$Message.success('删除成功')
this._page()
}
},
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
}
},
_ok() {
const data = this.itemList.records
this._saveCatalogueItem(data)
},
_saveCatalogueItem(data) {
this.showModal = false
this.$emit('on-result-change', data)
this._hideLoading()
},
_cancel() {
this.selectData = []
this.showModal = false
},
_visibleChange() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
@on-cancel="_cancel"
title="检测项目管理"
>
<Row>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="itemList" :icon-msg="iconMsg" @on-result-change="_tableResultChange" hide-page="true" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {
catalogueId: '',
name: '',
code: '',
standardCode: '',
standardName: ''
},
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [
{
type: 'md-trash',
id: '',
name: '删除'
}
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '方法', key: 'testMethod', width: 180 }
],
catalogueId: '',
itemList: {
records: []
},
selectData: [],
originalList: []
}
},
methods: {
_open(itemList) {
this.itemList.records = []
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.itemList.records = itemList
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._clearSelection()
// if (catalogueId) {
// this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_formSearch() {
console.log(this.formObj.name)
const searchItem = []
for (let i = 0; i < this.itemList.records.length; i++) {
if (this.itemList.records[i].name === this.formObj.name) {
console.log(this.itemList.records[i])
searchItem.push(this.itemList.records[i])
}
}
this.itemList.records = searchItem
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this.itemList.records.splice(data.index, 1)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
_deleteOk(id) {
// const result = await drugCatalogueItem.deleteById(id)
this.itemList.splice(id, 1)
this.getPage.records = this.itemList
this.$Message.success('已删除')
},
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
},
_ok() {
const data = this.itemList.records
this._saveCatalogueItem(data)
},
_saveCatalogueItem(data) {
this.showModal = false
this.$emit('on-result-change', data)
this._hideLoading()
},
_cancel() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_visibleChange() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
:edit-render="item.editCell?{autofocus: 'input'}:null" sortable> :edit-render="item.editCell?{autofocus: 'input'}:null" sortable>
<template v-slot:edit="scope"> <template v-slot:edit="scope">
<div v-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)"> <div v-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.describeDetail" @blur="_page()" @change="_inputChange(scope.row)"></el-input> <!-- <el-input v-model="scope.row.describeDetail" @change="_inputChange(scope.row)" placeholder="请输入土质描述详情">-->
<!-- </el-input>-->
<Input :value="scope.row.describeDetail" @change.native="_inputChange($event.target.value,scope.row)"></Input>
</div> </div>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -103,6 +105,7 @@ export default { ...@@ -103,6 +105,7 @@ export default {
], ],
itemList: [], itemList: [],
indexList: [], indexList: [],
currentIndex: -1,
footerList: [ footerList: [
{ id: '', name: '取消', type: '' }, { id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' } { id: '', name: '确定', type: 'primary' }
...@@ -157,13 +160,14 @@ export default { ...@@ -157,13 +160,14 @@ export default {
this.$refs.pageTable._showLoading() this.$refs.pageTable._showLoading()
}, },
methods: { methods: {
_inputChange: async function(info) { _inputChange: async function(info, data) {
this.getPage.records[data.index].describeDetail = info
const result = await soilEntrust.sampleEdit({ const result = await soilEntrust.sampleEdit({
id: info.id, id: data.id,
describeDetail: info.describeDetail describeDetail: info
}) })
if (result) { if (result) {
this._resultChange('修改成功') this.$Message.success('修改成功')
} }
}, },
_handleRow(data) { _handleRow(data) {
......
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