Commit 3f2b44f0 by lichengming

修改了送检委托单

parent 605394a9
<template>
<div>
<Modal v-model="showUserGroupModal">
<p slot="header">
{{ modalTitle }}
</p>
<Row>
<!--查询条件-->
<Col span="24">
<Form id="test-item-form" :label-width="90" inline onsubmit="return false">
<label class="label-sign" />
<Form-item :label-width="70" label="授权资质仪器名称" >
<Input
v-model="code"
placeholder="授权资质仪器名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
<Form-item label="检测依据名称">
<Input
v-model="name"
placeholder="请输入检测依据名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
</Form>
</Col>
<Col span="24" style="margin-bottom: 10px">
<el-table
:height="300"
:data="getPage"
border
size="small"
highlight-current-row
style="width: 100%"
@row-click="_rowChange"
@row-dblclick="_dbClick"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:min-width="item.width"
show-overflow-tooltip
>
<template slot-scope="scope">
<span v-if="item.key==='status'">
{{ scope.row[item.key]?scope.row[item.key].display:'' }}
</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</el-table>
</Col>
<Col span="24">
<Page
:total="getPage.total"
:page-size="getPage.size"
placement="top"
show-total
show-elevator
show-sizer
@on-change="_pageChange"
@on-page-size-change="_pageRows"
/>
<div style="clear: both" />
</Col>
</Row>
<div slot="footer" class="btn-width">
<Button style="margin-left: 8px" @click="_cancel">
取消
</Button>
<Button type="primary" @click="_ok">
确定
</Button>
</div>
</Modal>
</div>
</template>
<script>
// import { meterAptitude } from '../../../api'
import { meterManage } from '../../../api'
export default {
name: 'EditModal',
data() {
return {
loading: true,
pageParams: { rows: 20 },
pageColumns: [
{ title: '样品名称', key: 'name' },
{ title: '检定依据', key: 'code' },
{ title: '检定依据名称', key: 'basis' }
],
getPage: [],
showUserGroupModal: false,
modalTitle: '',
currentRowData: {},
name: '',
code: ''
}
},
methods: {
_open() {
this.modalTitle = '选择检测依据'
this.name = ''
this.code = ''
this._judge()
},
_judge() {
this.showUserGroupModal = true
this.currentRowData = {}
this._page()
},
_page: async function() {
const result = await meterManage.page(this._searchParams())
if (result) {
console.log('查询结果')
console.log(result)
this.getPage = result.records
this.loading = false
console.log(this.getPage)
}
},
_pageChange(page) {
this.pageParams.page = page
this._page()
},
_pageRows(rows) {
this.pageParams.rows = rows
this._page()
},
_searchParams() {
const data = this.$serialize('test-item-form')
if (this.name) {
data.name = this.name
}
if (this.code) {
data.code = this.code
}
return this.$extend(data, this.pageParams)
},
_search() {
this._page()
},
_rowChange(data) {
this.currentRowData = data // 选中的行数据;
},
_cancel() {
this.showUserGroupModal = false
},
_ok() {
if (JSON.stringify(this.currentRowData) === '{}') {
switch (this.modalTitle) {
case '选择检测依据':
this.$Message.warning('请选择一条检测依据!')
break
}
} else {
this.$emit('on-result-change', this.currentRowData)
this.showUserGroupModal = false
}
},
// 双击
_dbClick(data, event) {
this.currentRowData = data
// 选中的行数据;
this._ok()
}
}
}
</script>
<style scoped>
</style>
...@@ -6,24 +6,24 @@ ...@@ -6,24 +6,24 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24" style="margin-top: 10px"> <Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false"> <Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:"> <Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/> <Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item> </Form-item>
<Form-item class="search-item" label="资质:"> <Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/> <Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" <btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
@on-result-change="_btnClick"></btn-list> class="contHide"></btn-list>
</Col> </Col>
<!--表格--> <!--表格-->
<Col span="24"> <Col span="24">
...@@ -74,17 +74,17 @@ export default { ...@@ -74,17 +74,17 @@ export default {
], ],
iconMsg: [ iconMsg: [
{ {
type: 'ios-clock', type: 'md-create',
id: '', id: '',
name: '编辑' name: '编辑'
}, },
{ {
type: 'ios-clock', type: 'ios-beaker',
id: '', id: '',
name: '资质项目' name: '资质项目'
}, },
{ type: 'ios-clock', id: '', name: '附件' }, { type: 'md-cloud', id: '', name: '附件' },
{ type: 'ios-clock', id: '', name: '删除' }, { type: 'md-remove-circle', id: '', name: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
...@@ -253,9 +253,9 @@ export default { ...@@ -253,9 +253,9 @@ export default {
this.$refs.refModal._open(id, 'subcontractorId') this.$refs.refModal._open(id, 'subcontractorId')
}, },
_getById: async function(id) { _getById: async function(id) {
const result = await meterSubcontractor.getById(id) const result = await meterEntrust.getVOById(id)
if (result) { if (result) {
this.$refs.editSubcontractorModal._open(result) this.$refs.editSubcontractorModal._openEdit(result)
} }
}, },
_delete: async function(ids) { _delete: async function(ids) {
......
...@@ -72,7 +72,9 @@ ...@@ -72,7 +72,9 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="item.key==='name'" @click.stop="_handleRow(scope)"> <div v-if="item.key==='name'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.name" @click.native="_selectAptitude(scope.$index)" blur placeholder="请输入或选择样品名称" <!-- <el-input v-model="scope.row.name" @click.native="_selectAptitude(scope.$index)" blur placeholder="请输入或选择样品名称"-->
<!-- ></el-input>-->
<el-input v-model="scope.row.name" @on-result-change="_judgeBasisChange" @click.native="_selectjudgeBasis(scope.$rowIndex)" blur placeholder="请输入或选择样品名称"
></el-input> ></el-input>
</div> </div>
<div v-if="item.key==='spec'" @click.stop="_handleRow(scope)"> <div v-if="item.key==='spec'" @click.stop="_handleRow(scope)">
...@@ -111,6 +113,7 @@ ...@@ -111,6 +113,7 @@
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer> <modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div> </div>
</Modal> </Modal>
<EditModal ref="EditModal" @on-result-change="_backData" is-change />
</div> </div>
</template> </template>
<script> <script>
...@@ -119,9 +122,10 @@ ...@@ -119,9 +122,10 @@
*/ */
import { lmsBaseDict, meterEntrust } from '../../../api' import { lmsBaseDict, meterEntrust } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader' import CityNameCascader from '../../../components/base/CityNameCascader'
import EditModal from './EditModal'
export default { export default {
components: { CityNameCascader }, components: { CityNameCascader, EditModal },
data() { data() {
return { return {
formId: 'meterSendTestEditFormId', formId: 'meterSendTestEditFormId',
...@@ -217,6 +221,44 @@ export default { ...@@ -217,6 +221,44 @@ export default {
) )
}, },
methods: { methods: {
_judgeBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.code = data.stdNum
this.formObj.name = data.name
this.$refs.formObj.validateField('code')
break
case 'query':
this.formObj.stdId = ''
this.formObj.code = data.stdNum
this.formObj.name = ''
this._getJudgeBasisList(data.stdNum)
break
case 'focus':
this._getJudgeBasisList()
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.code = ''
this._getJudgeBasisList()
}
this.$refs.formObj.validateField('code')
}
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].name = data.name
this.getPage.records[this.index].aptitudeId = data.id
console.log('返回的数据')
console.log(data)
console.log(this.getPage.records)
},
_add() { _add() {
const data = { const data = {
name: '', name: '',
...@@ -343,13 +385,15 @@ export default { ...@@ -343,13 +385,15 @@ export default {
Object.assign(this.formObj, data) Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) { if (this.$string(this.id).isEmpty()) {
// 添加 // 添加
console.log('data', data) const saveData = this.formObj
console.log('this.formObj', this.formObj) saveData.sampleList = this.getPage.records
console.log(this.getPage.records) this._save(saveData)
this._save(this.formObj)
} else { } else {
// 编辑 // 编辑
this._edit({ id: this.formObj.id, obj: data }) // this._edit({ id: this.formObj.id, obj: data })
const saveData = this.formObj
saveData.sampleList = this.getPage.records
this._edit(saveData)
} }
} else { } else {
this.$Message.error('表单验证失败!') this.$Message.error('表单验证失败!')
...@@ -398,6 +442,30 @@ export default { ...@@ -398,6 +442,30 @@ export default {
this._showTime(formObj) this._showTime(formObj)
} }
}, },
_openEdit(formObj) {
this.getPage.records = []
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.id = ''
this.modalTitle = '送检委托单编辑'
this.id = formObj.id
this.formObj = formObj
this._showAddress(formObj)
this.getPage.records = formObj.sampleList
},
_showAddress(formObj) {
this.testedCityData = []
if (
formObj.province !== undefined &&
formObj.city !== undefined &&
formObj.county !== undefined
) {
this.testedCityData.push(formObj.province)
this.testedCityData.push(formObj.city)
this.testedCityData.push(formObj.county)
}
},
_getAptitudeList: async function() { _getAptitudeList: async function() {
const result = await lmsBaseDict.getItem('subcontractorAptitude') const result = await lmsBaseDict.getItem('subcontractorAptitude')
if (result) { if (result) {
...@@ -406,11 +474,6 @@ export default { ...@@ -406,11 +474,6 @@ export default {
}, },
_showTime(formObj) { _showTime(formObj) {
// 回显资质类型 // 回显资质类型
if (formObj.aptitude !== undefined || '') {
this.formObj.aptitude = formObj.aptitude.split(',')
} else {
this.formObj.aptitude = []
}
}, },
_save: async function(data) { _save: async function(data) {
const result = await meterEntrust.save(data) const result = await meterEntrust.save(data)
...@@ -420,7 +483,9 @@ export default { ...@@ -420,7 +483,9 @@ export default {
} }
}, },
_edit: async function(data) { _edit: async function(data) {
const result = await meterEntrust.edit(data) const result = await meterEntrust.editDTO(data)
console.log('修改后')
console.log(result)
if (result) { if (result) {
this._resultChange('编辑成功!') this._resultChange('编辑成功!')
} }
......
...@@ -10,19 +10,24 @@ ...@@ -10,19 +10,24 @@
<Form id="formId" :label-width="80" inline onsubmit="return false"> <Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item"> <Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/> <Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable/>
</Form-item> </Form-item>
<Form-item label="样品编号:" class="search-item"> <Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入样品编号" clearable @on-enter="_formSearch"/> <Input v-model="formObj.code" @on-enter="_formSearch" placeholder="请输入样品编号" clearable/>
</Form-item> </Form-item>
<Form-item class="search-btn" style="margin-left: -10px"> <Form-item class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Col> </Col>
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage" <PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" select-data @on-result-change="_tableResultChange"> :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -79,6 +84,20 @@ export default { ...@@ -79,6 +84,20 @@ export default {
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' }, { type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' } { type: 'trash-a', id: '', name: '删除' }
], ],
btn: [
{
// meter-review-entrust-pass-btn
type: 'success',
id: '',
name: '分包'
},
// meter-review-entrust-back-btn
{
type: 'success',
id: '',
name: '取消分包'
}
],
options: [ options: [
{ {
name: '检定' name: '检定'
......
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