Commit a3fe7a0d by lichengming

修改了开土制备页面

parent 5e5c1594
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form v-show="searchOpen" id="search-sample-company" inline onsubmit="return false" :label-width="80"> <Form id="search-sample-company" v-show="searchOpen" :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.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" /> <Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
</Form-item> </Form-item>
<!-- <Form-item label="制单日期:" style="width: 25%">--> <!-- <Form-item label="制单日期:" style="width: 25%">-->
<!-- <Date-picker--> <!-- <Date-picker-->
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<!-- ></Date-picker>--> <!-- ></Date-picker>-->
<!-- </Form-item>--> <!-- </Form-item>-->
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_page"> <Button @click="_page" type="primary">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" class="contHide" :open="searchOpen" show-search-btn="true" @on-result-change="_btnClick"></btn-list> <btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<div v-if="item.detail"> <div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a> <a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div> </div>
<div v-else-if="item.key==='progress'"> <div v-else-if="item.status">
{{ scope.row[item.key].display }} {{ scope.row[item.key].display }}
</div> </div>
<div v-else-if="item.date"> <div v-else-if="item.date">
...@@ -129,16 +129,18 @@ export default { ...@@ -129,16 +129,18 @@ export default {
selectData: {}, selectData: {},
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '样品编号', key: 'sampleCode', width: 150 }, {
{ title: '样品名称', key: 'name', width: 140 }, title: '样品编号',
{ title: '检测项目', key: 'itemNames', width: 140 }, key: 'num',
{ title: '样品批号', key: 'lotNum', width: 130 }, width: 180,
{ title: '样品数量', key: 'quantity', width: 120 }, detail: true,
{ title: '单位', key: 'unit', width: 120 }, fixed: 'left'
{ title: '样品形态', key: 'shape', width: 120 }, },
{ title: '状态', key: 'progress', width: 110 }, { title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '制单日期', key: 'ctime', width: 120, date: true }, { title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '备注', key: 'remark' } { title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
], ],
sampleId: '', sampleId: '',
dateList: [], dateList: [],
...@@ -353,7 +355,9 @@ export default { ...@@ -353,7 +355,9 @@ export default {
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.contractId this.formObj.entrustId = this.contractId
const result = await soilEntrust.page(this.$serializeForm(this.formObj)) const result = await soilEntrust.samplePage(
this.$serializeForm(this.formObj)
)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
......
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
{ {
type: 'ios-list', type: 'ios-list',
id: '', id: '',
name: '试列表' name: '试列表'
}, },
// { // {
// type: 'ios-beaker', // type: 'ios-beaker',
...@@ -184,7 +184,7 @@ export default { ...@@ -184,7 +184,7 @@ export default {
case '编辑': case '编辑':
this._editModal(true, data.id) this._editModal(true, data.id)
break break
case '试列表': case '试列表':
this._sampleManage(data.id) this._sampleManage(data.id)
break break
case '附件': case '附件':
......
<template>
<div>
<Modal v-model="showModal" width="1200">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form v-show="searchOpen" id="search-sample-company" inline onsubmit="return false" :label-width="90">
<label class="label-sign"></label>
<Form-item label="检测项目:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入检测项目" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item label="检测依据:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入检测依据" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" class="contHide" :open="searchOpen" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<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">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.key==='epibolyItem'" @click.stop="_handleRow(scope)">
<el-select v-if="showOption" v-model="scope.row.epibolyItem" placeholder="请选择" @change="_optionChange(scope.row)">
<el-option
v-for="(item,index) in subOptions"
:key="index"
:label="item.label"
:value="index"
/>
</el-select>
<span v-if="!showOption">{{ scope.row[item.key]===0? '否':'是' }}</span>
</div>
<div v-else-if="item.key==='progress'">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.judged">
{{ scope.row[item.key]===0? '否':'是' }}
</div>
<div v-else-if="item.date">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
@blur="_codeEdit({id:scope.row.id, obj :{code:scope.row.code}})"
/>
<i style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search" @click.stop="_selectjudgeBasis(scope.row.id,scope.$index)"></i>
</div>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
blur
placeholder="请输入比较符"
@blur="_compareSymbolEdit({id:scope.row.id, obj :{compareSymbol:scope.row.compareSymbol}})"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
blur
placeholder="请输入限值"
@blur="_limitValueEdit({id:scope.row.id, obj :{limitValue:scope.row.limitValue}})"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
blur
placeholder="请输入单位"
@blur="_unitEdit({id:scope.row.id, obj :{unit:scope.row.unit}})"
/>
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import http from '../../api/http'
import { soilEntrust } from '../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
btn: [
{ type: 'success', id: '', name: '提交分包' },
{ type: 'success', id: '', name: '取消分包' }
],
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }],
sampleId: '', // 样品id
showModal: false,
modalTitle: '管理检测项目',
selectIds: [],
itemId: '',
index: '',
showOption: true,
searchOpen: true,
selectData: {},
getPage: {},
currentRow: '',
currentIndex: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '关闭', type: 'primary' }
],
pageColumns: [
{ title: '项目类别', key: 'type', width: 160 },
{ title: '检测项目', key: 'name', width: 140 },
{ title: '子项目', key: 'sonItem', width: 140 },
{ title: '是否分包', key: 'epibolyItem' },
{ title: '方法', key: 'method', width: 180 },
{ title: '设备', key: 'device', width: 180 },
{ title: '检测依据', key: 'code', width: 180 },
{ title: '检测科室', key: 'groupName', width: 110 },
{ title: '比较符', key: 'compareSymbol', width: 100 },
{ title: '限值', key: 'limitValue' },
{ title: '单位', key: 'unit' },
{ title: '是否系统判定', key: 'judged', width: 120, judged: true },
{ title: '备注', key: 'remark' }
],
subOptions: [
{
value: '0',
label: '否'
},
{
value: '1',
label: '是'
}
],
dateList: [],
formObj: {
name: undefined,
sampleId: undefined,
code: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_selectjudgeBasis(id, index) {
console.log(id)
this.itemId = id
this.index = index
this.$refs.EditModal._open()
},
_optionChange(data) {
console.log(data)
if (data.epibolyItem === 1) {
this._submit(data.id)
} else {
this._cancelSub(data.id)
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '关闭':
this._cancel()
break
}
},
_cancel() {
this.$emit('on-result-change')
this.$refs.pageTable._hideLoading()
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_ok() {
console.log(this.getPage.records)
},
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '提交分包':
this._submitOutPack()
break
case '取消分包':
this._cancelOutPack()
break
case '添加':
this._editModal(false)
break
case '复制历史样品':
this._copyHisSample()
break
case '导入样品':
this._importSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_backData(data) {
this.getPage.records[this.index].code = data.code
this._codeEdit({ id: this.itemId, obj: { code: data.code } })
},
_codeEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_compareSymbolEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_limitValueEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_unitEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_submitOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定分包这' + this.selectIds.length + '条',
onOk: () => {
this._submit()
}
})
}
},
_cancelOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定取消这' + this.selectIds.length + '条分包',
onOk: () => {
this._cancelSub()
}
})
}
},
_submit: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.submitOutPack(this.selectIds)
if (result) {
this._resultChange('分包成功')
}
},
_cancelSub: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.cancelOutPack(this.selectIds)
if (result) {
this._resultChange('取消分包成功')
}
},
_exportSample() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条样品')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出这' + this.selectIds.length + '条样品',
onOk: () => {
http.open(
'/food/v1/sample/company/export',
{ ids: this.selectIds.join(',') },
'_blank'
)
}
})
}
},
_copyHisSample() {
this.$refs.refModal._open(this.sampleId)
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '导出样品委托协议':
this._exportAgreement(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_exportAgreement(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-contract-company-export-sample-agreement'
)
.then(() => {
if (this.$store.state.ReportExport.model) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) {
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
}
})
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
// case 'iconClick':
// this._iconClick(data.name, data.rowData, data.componentName)
// break
case 'page':
this._page()
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.$refs.pageTable._hideLoading()
this._page()
},
_openRecord(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.$refs.pageTable._hideLoading()
this.showOption = false
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj = this.$serializeForm(this.formObj)
this.formObj.sampleId = this.sampleId
const result = await soilEntrust.page(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
console.log(result)
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteOk: async function(ids) {
const result = await soilEntrust.deleteById(ids)
if (result) {
this._resultChange('删除成功! ')
}
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(data) {},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
// localStorage.setItem('type', data.type)
// // 编辑
// this.$store.dispatch('FoodSample/getByCompanyId', data.id).then(() => {
// const result = this.$store.state.FoodSample.companyModel
// if (data.type === 0) {
// // 普通企业样品
// this.$refs.refModal._open(result, this.sampleId)
// } else if (data.type === 3) {
// // 模拟样品
// this._editImitateModal(true, result)
// }
// })
} else {
// 添加
this.$refs.refModal._open('', this.sampleId)
}
},
// 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.sampleId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.sampleId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.$emit('on-result-change')
},
_copy(data) {
this.$refs.copyModal._open(data.id, data.type)
},
// 复制样品
_copySample(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopySample(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopySample(result)
}
})
},
_copyAll(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopyAll(result)
}
})
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.sampleId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(
this.selectIds,
this.selectData[0],
this.selectData
)
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, 'sample-rel-package-item')
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1200" class="modal-footer-none">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable />
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
</Form-item>
<!-- <Form-item label="制单日期:" style="width: 25%">-->
<!-- <Date-picker-->
<!-- v-model="dateList"-->
<!-- type="daterange"-->
<!-- placeholder="制单日期"-->
<!-- format="yyyy-MM-dd"-->
<!-- :editable="false"-->
<!-- style="width:100%"-->
<!-- placement="bottom-end"-->
<!-- @on-change="_dateChange"-->
<!-- ></Date-picker>-->
<!-- </Form-item>-->
<Form-item class="search-btn">
<Button @click="_page" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<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">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.status">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.date">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
</div>
</template>
<script>
import http from '../../api/http'
import { soilEntrust } from '../../api'
import { getLodop } from '../../plugins/clodop/LodopFuncs'
import SoilSampleItemManage from './SoilSampleItemManage'
let LODOP
export default {
components: { SoilSampleItemManage },
data() {
return {
formId: 'soilSampleManage',
currentComponent: '',
btn: [
{
type: 'success',
id: '',
name: '导入检测项目'
},
{
type: 'success',
id: '',
name: '导入检测项目包'
},
{
type: 'success',
id: '',
name: '打印标签'
}
],
itemList: [],
indexList: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理检测项目'
},
{ type: 'md-trash', id: '', name: '删除' }
],
contractId: '', // 委托id
showModal: false,
recordHis: false,
searchOpen: true,
modalTitle: '管理样品',
selectIds: [],
selectData: {},
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
sampleId: '',
dateList: [],
formObj: {
name: undefined,
sampleCode: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_cancel() {
this.showModal = false
},
_ok() {
this.showModal = false
this.$refs.footerModal._hideLoading()
console.log(this.getPage)
},
_itemImportBack(data) {
if (this.selectIds === undefined || this.selectIds.length === 0) {
return false
}
if (data === undefined || data.length === 0) {
return false
}
this._importItemOk({ sampleIds: this.selectIds, drugItemList: data })
},
// _importItemOk: async function(data) {
// const result = await drugSample.importSampleItemDTO(data)
// if (result) {
// this.$Message.success('导入成功!')
// await this._page()
// }
// },
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '复制历史样品':
this._copyHisSample()
break
case '导入样品':
this._importSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '打印标签':
this._printLabel()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_exportSample() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条样品')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出这' + this.selectIds.length + '条样品',
onOk: () => {
http.open(
'/food/v1/sample/company/export',
{ ids: this.selectIds.join(',') },
'_blank'
)
}
})
}
},
_copyHisSample() {
this.$refs.refModal._open(this.contractId)
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理检测项目':
this._itemManage(data.id)
break
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'allSelect':
console.log('123465798', data)
this.allSelect(data)
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
allSelect(data) {
this.indexList = []
for (let i = 0; i < data.length; i++) {
this.indexList.push(data[i].index)
}
console.log('索引', this.indexList)
},
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.contractId = id // 委托id
console.log(this.contractId)
this.$refs.pageTable._hideLoading()
this._page()
},
_openHis(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.contractId = id // 委托id
console.log(this.contractId)
this.$refs.pageTable._hideLoading()
this.recordHis = true
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.contractId
const result = await soilEntrust.samplePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
// this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
// this._resultChange('删除成功!')
// })
this._deleteOk(ids)
}
})
},
// _deleteOk: async function(ids) {
// const result = await drugSample.deleteById(ids)
// if (result) {
// this._resultChange('删除成功')
// }
// },
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(data) {},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
} else {
// 添加
this.$refs.refModal._open('', this.contractId)
}
},
// 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.contractId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.contractId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
},
_copy(data) {
this.$refs.copyModal._open(data.id, data.type)
},
// 复制样品
_copySample(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopySample(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopySample(result)
}
})
},
_copyAll(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopyAll(result)
}
})
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.contractId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.sampleItemModal._open()
this.$refs.pageTable.checkedData()
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
// this.$refs.refModal._open(this.selectIds, 'sample-rel-package-item')
this.$refs.itemPackageModal._open(
this.selectIds,
'sample-rel-package-item'
)
}
},
_printLabel() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
for (let m = 0; m < this.selectData.length; m++) {
const row = this.selectData[m]
this._printLabelOk(row)
}
}
},
_printLabelOk(row) {
LODOP = getLodop()
if (LODOP === 'undefined' || LODOP === undefined) {
this._pluginDownload()
return false
}
if (LODOP.GET_PRINTER_COUNT() === 0) {
this.$Messager.warning('系统未关联打印机,请确认....')
return false
}
LODOP.PRINT_INITA('0mm', '0mm', '70.01mm', '50.01mm', '样品标签打印')
LODOP.ADD_PRINT_LINE(36, 15, 35, 251, 0, 1)
LODOP.ADD_PRINT_LINE(74, 15, 73, 251, 0, 1)
LODOP.ADD_PRINT_LINE(107, 15, 106, 251, 0, 1)
LODOP.ADD_PRINT_LINE(140, 15, 139, 251, 0, 1)
LODOP.ADD_PRINT_LINE(175, 15, 174, 251, 0, 1)
LODOP.ADD_PRINT_LINE(35, 15, 174, 16, 0, 1)
LODOP.ADD_PRINT_LINE(35, 74, 174, 75, 0, 1)
LODOP.ADD_PRINT_LINE(35, 251, 174, 252, 0, 1)
LODOP.ADD_PRINT_TEXT(49, 17, 59, 20, '样品名称')
LODOP.ADD_PRINT_TEXT(82, 18, 59, 20, '样品编号')
LODOP.ADD_PRINT_TEXT(116, 17, 59, 20, '样品状态')
LODOP.ADD_PRINT_TEXT(151, 27, 39, 20, '备注')
LODOP.ADD_PRINT_TEXT(16, 95, 100, 20, '检测样品标签')
LODOP.SET_PRINT_STYLEA(0, 'Bold', 1)
LODOP.ADD_PRINT_TEXT(49, 78, 135, 20, row.name)
LODOP.ADD_PRINT_TEXT(82, 77, 136, 20, row.sampleCode)
LODOP.ADD_PRINT_TEXT(117, 76, 176, 20, '□未检 □在检 □已检 □留样')
if (row.surplus === '取回') {
LODOP.ADD_PRINT_TEXT(152, 77, 138, 20, '☑"取回 □服务方处理')
} else if (row.surplus === '服务方处理') {
LODOP.ADD_PRINT_TEXT(152, 77, 138, 20, '□取回 ☑服务方处理')
} else {
LODOP.ADD_PRINT_TEXT(152, 77, 138, 20, '□取回 □服务方处理')
}
LODOP.PRINT_DESIGN()
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" 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" :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" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<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.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<Operation ref="operationModal"></Operation>
<SamplePreparationEdit ref="editModal" @on-result-change="_formSearch"></SamplePreparationEdit>
<SoilSampleManage ref="sampleManageModal" @on-result-change="_page"></SoilSampleManage>
</div>
</template>
<script>
import { soilEntrust } from '../../../api'
import http from '../../../api/http'
import Operation from '../../../components/operation/Operation'
import SoilSampleManage from '../SoilSampleManage'
import SamplePreparationEdit from './SamplePreparationEdit'
export default {
components: { Operation, SamplePreparationEdit, SoilSampleManage },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
// {
// type: 'success',
// id: '',
// name: '添加'
// },
// {
// type: 'success',
// id: '',
// name: '提交至评审'
// },
// {
// type: 'success',
// id: '',
// name: '提交'
// }
],
iconMsg: [
// {
// type: 'md-create',
// id: '',
// name: '编辑'
// },
{
type: 'ios-list',
id: '',
name: '试样列表'
},
// {
// type: 'ios-beaker',
// id: '',
// name: '管理样品'
// },
{
type: 'md-cloud',
id: '',
name: '附件'
},
// {
// type: 'md-document',
// id: '',
// name: '导出委托单'
// },
{
type: 'md-remove-circle',
id: '',
name: '删除'
},
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
client: undefined,
contractCode: undefined,
entrustCode: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交至评审':
this._submitToReview()
break
case '提交':
this._submitToSkipReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '试样列表':
this._sampleManage(data.id)
break
case '附件':
this._upload(data.id)
break
case '导出委托单':
this._exportEntrust(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_sampleManage(data) {
// 管理样品
this.$refs.sampleManageModal._open(data)
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitToSkipReview() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要提交 ' + ids.length + ' 条记录?',
onOk: () => {
this._subToSkipRe(ids)
}
})
}
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
this._subToRe(ids)
}
})
}
},
_subToRe: async function(ids) {
const result = await soilEntrust.submit(ids)
if (result) {
this._resultChange('提交成功')
}
},
_subToSkipRe: async function(ids) {
const result = await soilEntrust.submitSkipReview(ids)
if (result) {
this._resultChange('提交成功')
}
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
},
_record(id) {
this.$refs.operationModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'page':
this._page()
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'contractId')
},
_exportEntrust(id) {
this.$Modal.confirm({
title: '提示',
content: '确定导出委托单?',
onOk: () => {
http.open('/meter/v1/entrust/export_send_entrust/?id=' + id)
}
})
},
_getById: async function(id) {
const result = await soilEntrust.getVOById(id)
if (result) {
this.$refs.editModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await soilEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="900">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="MeterSendTestEdit" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form-item label="委托商" prop="client" class="width-48">
<AutoComplete :value="formObj.client" :down-data="customerData" @on-result-change="_cusNameChange"
name="client" placeholder="请输入或选择委托单位"
></AutoComplete>
</Form-item>
<Form-item label="委托日期:" prop="entrustDate" class="width-48">
<Date-picker v-model="formObj.entrustDate" @on-change="_ctimeChange" type="date" split-panels style="width:100%;"
placeholder="请选择委托日期" name="entrustDate"></Date-picker>
</Form-item>
<Form-item label="钻孔名称" prop="boreholeName" class="width-48">
<Input v-model="formObj.boreholeName" name="boreholeName" placeholder="请输入名称"/>
</Form-item>
<Form-item label="钻孔位置" prop="boreholeLocation" class="width-48">
<Input v-model="formObj.boreholeLocation" name="boreholeLocation" placeholder="请输入名称"/>
</Form-item>
<Form-item label="水深(米)" prop="waterDepth" class="width-48">
<Input v-model="formObj.waterDepth" name="waterDepth" placeholder="请输入名称"/>
</Form-item>
<Form-item label="制单日期:" prop="tabulateDate" class="width-48">
<Date-picker v-model="formObj.tabulateDate" @on-change="_tabulateChange" name="tabulateDate" type="date" split-panels style="width:100%;"
placeholder="请选择委托日期"></Date-picker>
</Form-item>
<Form-item label="制表人" prop="tabulater" class="width-48">
<Input v-model="formObj.tabulater" name="tabulater" placeholder="请输入名称"/>
</Form-item>
<Form-item label="检验类别" prop="testType" class="width-48">
<Input v-model="formObj.testType" name="testType" placeholder="请输入名称"/>
</Form-item>
</Form>
</div>
<div style="margin-bottom: 10px;">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick"
class="contHide"></btn-list>
</div>
<div>
<PTVXETable
ref="pageTable"
:form-id="formId"
:table-height="500"
:get-page="getPage"
:icon-msg="iconMsg"
:hidePage = true
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<!-- <div v-if="item.key==='sampleCode'" @click.stop="_handleRow(scope)">-->
<!-- <el-input v-model="scope.row.name" blur placeholder="请输入或选择样品名称" style="width: 150px;"-->
<!-- ></el-input>-->
<!-- <a @on-result-change="_judgeBasisChange" @click="_selectjudgeBasis(scope.$rowIndex)" style="font-size: 18px;" class="">+</a>-->
<!-- </div>-->
<div v-if="item.key==='siteNo'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.siteNo" blur placeholder="请输入现场编号"
></el-input>
</div>
<div v-if="item.key==='sampleDepth'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.sampleDepth" blur placeholder="请输入试样深度"
></el-input>
</div>
<div v-if="item.key==='samplePack'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.samplePack" blur placeholder="请输入试样包装类型"
></el-input>
</div>
<div v-if="item.key==='sampleDescribe'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.sampleDescribe" blur placeholder="请输入土质描述"
></el-input>
</div>
<div v-else-if="item.key==='itemNames'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.itemNames"
blur
placeholder="试验项目"
readonly
/>
</div>
<div v-else @click.stop="_handleRow(scope)">
<span> {{ scope.row[item.key] }}</span>
</div>
</template>
</vxe-table-column>
</PTVXETable>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal>
<SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change />
</div>
</template>
<script>
/**
* 添加编辑分包商
*/
import { meterEntrust, meterSample, soilEntrust } from '../../../api'
import importModal from '../../../components/import/DownloadTemplateImport'
import AutoComplete from '../../../components/base/AutoCompletes'
import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect'
export default {
components: {
AutoComplete,
importModal,
SampleItemSelect
},
data() {
const validatefee = (rule, value, callback) => {
if (this.formObj.operation.fee === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateRemark = (rule, value, callback) => {
if (this.testedCityData.length === 0) {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateClient = (rule, value, callback) => {
if (this.formObj.client === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateEdate = (rule, value, callback) => {
if (this.formObj.entrustDate === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateOdate = (rule, value, callback) => {
if (this.formObj.odate === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
return {
formId: 'meterSendTestEditFormId',
getPage: {
records: []
},
showBtn: true,
customerData: [],
cityData: [],
selectData: [],
searchOpen: true,
testedCityData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [
{
type: 'md-trash',
id: '',
name: '删除'
}
],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 140 },
{ title: '现场编号', key: 'siteNo', width: 140 },
{ title: '试验项目', key: 'itemNames', width: 140 },
{ title: '试样深度', key: 'sampleDepth', width: 140 },
{ title: '样品包装类型', key: 'samplePack', width: 150 },
{ title: '土质描述', key: 'sampleDescribe' }
],
btn: [
{
type: 'success',
id: '',
name: '添加'
},
{
type: 'success',
id: '',
name: '导入试验项目'
}
// ,
// {
// type: 'success',
// id: '',
// name: '导入'
// }
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
id: '',
modalTitle: '',
subcontractorId: '',
formObj: {},
selectIds: [],
indexList: [],
itemList: [],
ruleValidate: {
client: [
{
required: true,
message: '委托单位不能为空',
validator: validateClient,
trigger: ['blur', 'change']
}
],
entrustDate: [
{
required: true,
validator: validateEdate,
message: '委托日期不能为空',
trigger: 'blur'
}
],
odate: [
{
required: true,
validator: validateOdate,
message: '要求完成时间不能为空',
trigger: 'blur'
}
],
'operation.person': [
{ required: true, message: '联系人不能为空', trigger: 'blur' }
],
'operation.fee': [
{
required: true,
validator: validatefee,
message: '委托费用不能为空',
trigger: 'blur'
}
],
'operation.tel': [
{ required: true, message: '联系电话不能为空', trigger: 'blur' }
],
testedCityData: [
{
required: true,
message: '省市区不能为空',
validator: validateRemark,
trigger: 'blur'
}
]
},
clearingWayList: ['款到后测试', '先测试后付款', '其他情况()'],
clearingWayListTemp: ['款到后测试', '先测试后付款', '其他情况()'],
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
aptitudeData: []
}
},
methods: {
_itemImportBack(data) {
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].experimentList !== undefined) {
const name = []
this.itemList = this.getPage.records[index].experimentList
name.push(this.getPage.records[index].itemNames)
for (let i = 0; i < info.length; i++) {
console.log(this.getPage.records[index].itemNames[i])
this.itemList.push(info[i])
name.push(info[i].name)
}
this.getPage.records[index].itemNames = name.join('、')
this.getPage.records[index].experimentList = this.itemList
this.$set(this.getPage.records, index, this.getPage.records[index])
} else {
const name = []
this.itemList = []
for (let i = 0; i < info.length; i++) {
this.itemList.push(info[i])
name.push(info[i].name)
}
this.getPage.records[index].itemNames = name.join('、')
this.getPage.records[index].experimentList = this.itemList
this.$set(this.getPage.records, index, this.getPage.records[index])
}
}
console.log(this.getPage.records)
},
_cusNameChange(msg, data) {
// this.financeObj = {} // 清空维护发票信息的数据
if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位
switch (msg) {
case 'select':
this._customerMatch(data)
break
case 'query':
this._cusNameQuery(data)
break
}
} else if (this.customerData.indexOf(data) !== -1) {
this._getQueryList(data)
// 编辑的时候选择单位(互不影响)
// this.cusName = data
// this.formObj.customer.cname = data
} else {
}
},
_customerMatch(data) {
this._getQueryList(data)
},
_cusNameQuery(query) {
this.formObj.client = query
},
_btnClick(msg) {
this.$nextTick(function() {
switch (msg) {
case '添加':
this._add()
break
case '导入试验项目':
this._importItem()
break
case '导入':
this._importSample()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择至少一条数据!')
} else {
console.log('导入检测项目')
this.$refs.sampleItemSelectModal._open()
this.allSelect(this.selectData)
}
},
_inputBack(data) {
console.log(data)
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) {
this.formObj.entrustDate = data
},
_tabulateChange(data) {
this.formObj.tabulateDate = data
},
_odateChange(data) {
this.formObj.odate = data
},
_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()
},
_selectverification(index) {
console.log(index)
this.index = index
this.$refs.VerificationModal._open()
},
_selectcontractCode() {
this.$refs.ContractModal._open()
},
_backData(data) {
this.$forceUpdate()
console.log(typeof this.index)
this.getPage.records[this.index].name = data.name
this.getPage.records[this.index].aptitudeId = data.id
this.getPage.records[this.index].verification = data.code + data.basis
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
this.formObj.operation.person = data.person
this.formObj.operation.tel = data.tel
this.formObj.operation.fax = data.fax
if (data.province) {
this.testedCityData = [data.province, data.city, data.county]
this.formObj.province = data.province
this.formObj.city = data.city
this.formObj.county = data.county
}
this.formObj.street = data.street
this.formObj.entrustDate = new Date(data.entrustDate)
this.formObj.odate = new Date(data.odate)
this.formObj.contractCode = data.salesCode
this.formObj.operation.fee = data.discountPrice
if (data.sampleQuoteList) {
this.getPage.records = data.sampleQuoteList
} else {
this.getPage.records = []
}
},
_backVerification(data) {
this.$forceUpdate()
this.getPage.records[this.index].verification = data.verification
},
_add() {
const data = {
sampleCode: '',
sampleDepth: '',
samplePack: '',
sampleDescribe: '',
siteNo: '',
itemNames: ''
}
this.getPage.records.unshift(data)
},
_importSample() {
const data = {
importUrl: '/meter/v1/sample/import_sample_pre',
downloadUrl: '/meter/v1/excel/template/MeterSampleImport',
title: '导入'
}
this.$refs.importModal._open(data, '样品导入')
},
_tableResultChange(msg, data, selData) {
switch (msg) {
case 'selectIds':
this.selectIds = data
this.selectData = selData
console.log(this.selectIds)
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex)
break
// case 'changeSize':
// this._page()
// break
}
},
allSelect(data) {
console.log(data)
this.indexList = []
for (let i = 0; i < data.length; i++) {
this.indexList.push(data[i].index)
}
console.log('索引', this.indexList)
},
// 省 市 区
_cascaderResult(name, data, msg) {
switch (name) {
case 'cus':
this._casChange(data, msg)
break
case 'tested':
this._testedChange(data, msg)
break
}
},
_emptyProvince() {
this.cityData = []
this.testedCityData = []
// this.formObj.tested.testedProvince = ''
// this.formObj.tested.testedCity = ''
// this.formObj.tested.testedCounty = ''
// this.formObj.testedTemp.testedProvince = ''
// this.formObj.testedTemp.testedCity = ''
// this.formObj.testedTemp.testedCounty = ''
},
_testedChange(data, msg) {
// 省、市、区
if (msg === 'clear') {
// this.formObj.tested.testedProvince = ''
// this.formObj.tested.testedCity = ''
// this.formObj.tested.testedCounty = ''
this.formObj.testedTemp.testedProvince = ''
this.formObj.testedTemp.testedCity = ''
this.formObj.testedTemp.testedCounty = ''
this.formObj.province = ''
this.formObj.city = ''
this.formObj.county = ''
this.testedCityData = []
} else {
// this.formObj.tested.testedProvince = data.value[0]
// this.formObj.tested.testedCity = data.value[1]
// this.formObj.tested.testedCounty = data.value[2]
this.formObj.province = data.value[0]
this.formObj.city = data.value[1]
this.formObj.county = data.value[2]
this.testedCityData = [data.value[0], data.value[1], data.value[2]]
}
},
_iconClick(res, data, index) {
switch (res) {
case '编辑':
// this._editModal(true, data.id)
break
case '删除':
this.getPage.records.splice(index, 1)
this._deleteSample(data)
break
case '操作日志':
// this._record(data.id)
break
}
},
_deleteSample(data) {
if (data.id === undefined) {
return false
} else {
this._delete(data.id)
}
},
_delete: async function(id) {
const result = await meterSample.deleteById(id)
if (result) {
console.log(result)
}
},
_selectAptitude(data) {
console.log(data)
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
channelInputLimit(e) {
const key = e.key
// 不允许输入'e'和'.'
if (key === 'e' || key === '.') {
e.returnValue = false
return false
}
return true
},
/** *modal-footer */
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('MeterSendTestEdit')
console.log(this.getPage.records)
// Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) {
// 添加
// const saveData = this.formObj
data.sampleList = this.getPage.records
console.log(data)
this._save(data)
} else {
// const saveData = this.formObj
console.log(data)
data.id = this.id
data.sampleList = this.getPage.records
this._edit(data)
}
} else {
this.$Message.error('表单验证失败!')
this._hideLoading()
}
})
},
_wayResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.clearingWay = data
break
case 'query':
this.formObj.clearingWay = data
this._wayQuery(data)
break
}
},
_wayQuery(query) {
if (query === '') {
this.clearingWayList = this.clearingWayListTemp
} else {
this.clearingWayList = this.clearingWayListTemp.filter(
item => item.indexOf(query) > -1
)
}
},
_cancel() {
this.showModal = false
},
_open(formObj) {
this.showBtn = true
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
if (this.$string(formObj).isEmpty()) {
this.getPage.records = []
this.id = ''
this.formObj.entrustDate = new Date()
this.modalTitle = '委托单新增'
} else {
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '委托单编辑'
this._showTime(formObj)
}
},
_openEdit(formObj) {
this.showBtn = false
this.showModal = true
this.$refs.formObj.resetFields()
this.getPage.records = []
this._hideLoading()
this.id = ''
this.modalTitle = '委托单编辑'
this.id = formObj.id
this.formObj = formObj
this._showTime(formObj)
if (formObj.sampleList) {
this.getPage.records = formObj.sampleList
}
// for (let i = 0; i < formObj.sampleList.length; i++) {
// if (formObj.sampleList[i].lastTime !== undefined) {
// this.getPage.records[i].lastTime = new Date(
// formObj.sampleList[i].lastTime
// )
// }
// }
},
_showTime(formObj) {
if (this.formObj.entrustDate === undefined) {
this.formObj.entrustDate = ''
} else {
this.formObj.entrustDate = new Date(formObj.entrustDate)
}
if (this.formObj.tabulateDate === undefined) {
this.formObj.tabulateDate = ''
} else {
this.formObj.tabulateDate = new Date(formObj.tabulateDate)
}
},
_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)
}
},
_getList: async function() {
const result = await meterEntrust.pageList()
const list = []
console.log('result', result)
if (result) {
for (let i = 0; i < result.length; i++) {
console.log(result[i].cname)
list.push(result[i].cname)
}
console.log('委托单位名单', list)
this.customerData = list
}
},
_getQueryList: async function(data) {
const result = await meterEntrust.pageQueryList(data)
if (result) {
console.log(result)
}
},
_save: async function(data) {
console.log(data)
const result = await soilEntrust.save(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilEntrust.editDTO(data)
if (result) {
this._resultChange('编辑成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" 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" :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" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<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.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterEntrustRecord ref="entrustRecordModal" @on-result-change="_page"></MeterEntrustRecord>
</div>
</template>
<script>
import { soilAptitude, soilEntrust } from '../../../api'
import MeterEntrustRecord from '../../../components/operation/Operation'
export default {
components: { MeterEntrustRecord },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: true,
btn: [
// {
// type: 'success',
// id: '',
// name: '添加'
// }
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
client: undefined,
entrustCode: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
case '查看样品':
this._sampleManage(data.id)
break
}
})
},
_sampleManage(data) {
// 管理样品
this.$refs.meterSampleManageModal._open(data)
},
_record(id) {
this.$refs.entrustRecordModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await soilAptitude.getById(id)
if (result) {
this.$refs.editSubcontractorModal._open(result)
}
},
_delete: async function(ids) {
const result = await soilAptitude.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="待完成" name="wait">
<MeterSendEntrust ref="waitTabs"></MeterSendEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterSendEntrustHis ref="hisTabs"></MeterSendEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterSendEntrust from './SamplePreparation'
import MeterSendEntrustHis from './SamplePreparationHis'
export default {
name: 'MeterSendEntrustIndex',
components: {
MeterSendEntrust,
MeterSendEntrustHis
},
data() {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this._page()
} else {
this.$refs.hisTabs._page()
}
},
_page() {
this.$refs.waitTabs._page()
}
}
}
</script>
<style scoped>
</style>
...@@ -8,6 +8,7 @@ import ExperimentItemManage from '../pages/meter-aptitude/item-manage/Experiment ...@@ -8,6 +8,7 @@ import ExperimentItemManage from '../pages/meter-aptitude/item-manage/Experiment
import EntrustIndex from '../pages/meter-entrust/entrust-register/EntrustIndex' import EntrustIndex from '../pages/meter-entrust/entrust-register/EntrustIndex'
import ReviewEntrust from '../pages/meter-entrust/entrust-review/ReviewEntrust' import ReviewEntrust from '../pages/meter-entrust/entrust-review/ReviewEntrust'
import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/SampleReceiveIndex' import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/SampleReceiveIndex'
import SamplePreparationIndex from '../pages/soil-sample-manage/sample-preparation/SamplePreparationIndex'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -42,7 +43,7 @@ export default [ ...@@ -42,7 +43,7 @@ export default [
}, },
{ {
path: 'prepare', path: 'prepare',
component: workbench, component: SamplePreparationIndex,
meta: { title: '开土制备' } meta: { title: '开土制备' }
}, },
{ {
......
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