Commit 8facabfc by lichengming

修改了委托单登记

parent 9fc27800
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false" width="600">
<p slot="header">{{modalTitle}}</p>
<div>
<Upload
:action="action"
:show-upload-list="false"
:before-upload="_beupload"
multiple
>
<Button type="dashed" icon="ios-cloud-upload-outline">上传文件(小于50MB)</Button>
</Upload>
<div>
<Card :dis-hover="true" style="width: 100%;height: 400px;overflow: auto;">
<p slot="title">已上传文件列表</p>
<div v-for="(item,index) in fileList" :key="index" class="file-upload-list">
<div>
<div class="file-upload-list-cover">
<Icon @click.native.stop="_handleRemove(item)" type="md-trash" style="color: white;font-size: 20px;"></Icon>
</div>
</div>
{{item.fileName }}
</div>
</Card>
</div>
</div>
<div slot="footer" class="btn-width">
<Button @click="showEditModal = false">取消</Button>
<Button @click="_mutipleUpload" :loading="isLoading" type="primary">{{btnName}}</Button>
</div>
</Modal>
</div>
</template>
<script>
/**
* 上传文件,在文件夹下
*/
import axios from 'axios'
import global from '../../../api/config'
import loading from '../../../api/loading'
export default {
data() {
return {
id: '',
ID: '',
action: '',
modalTitle: '',
showEditModal: false,
name: '',
isLoading: false,
btnName: '上传',
fileList: []
}
},
methods: {
_open(obj) {
this.fileList = []
this.showEditModal = true
this.ID = obj
this.modalTitle = '上传文件'
},
_beupload(file) {
// 单个文件上传超过50M时,取消上传
const isLt50M = file.size / 1024 / 1024 < 50
const fileName = file.name.split('.')[0]
if (!isLt50M) {
this.$Message.warning({
content: '文件 ' + fileName + ' 大小超多50M,请重新上传!',
duration: 3
})
this.isLoading = false
} else {
// 动态循环给文件命名
const temObj = {
file: file,
fileName: fileName
}
this.fileList.push(temObj)
}
return false
},
_mutipleUpload() {
if (this.fileList.length > 0 && this.btnName === '上传') {
this.isLoading = true
this.btnName = '上传中...'
// 创建formula对象
const formData = new FormData()
formData.append('entrustId', this.ID)
// 多个文件
for (let i = 0; i < this.fileList.length; i++) {
formData.append('file' + i, this.fileList[i].file)
}
const config = {
headers: {
'Content-Type': 'multipart/form-data'
}
}
const instanceFile = axios.create()
instanceFile.defaults.withCredentials = true
// 发起请求
instanceFile
.post(
global.baseURL + '/soil/v1/entrust_annex/upload_bath/' + this.ID,
formData,
{
headers: config
}
)
.then(res => {
if (res.data.code === '1') {
this.$Message.success('上传成功!')
this.showEditModal = false
this.$emit('on-result-change')
} else if (res.data.code === '0') {
loading.toast.show(res.data.code, res.data.msg)
this.$Message.error('操作失败')
}
this._resetLoading()
})
.catch(err => {
console.log(err)
this._resetLoading()
})
} else {
this.$Message.warning('请至少上传一个文件')
this._resetLoading()
}
},
_resetLoading() {
this.isLoading = false
this.btnName = '上传'
},
// 删除对应的上传的文件
_handleRemove(data) {
const index = this.fileList.findIndex(item => item === data)
this.fileList.splice(index, 1)
}
}
}
</script>
<style>
.file-upload-list {
display: inline-block;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin-right: 4px;
}
.file-upload-list:hover .file-upload-list-cover {
display: block;
}
.file-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
}
</style>
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false" width="600">
<p slot="header">{{modalTitle}}</p>
<div>
<Upload
:action="action"
:show-upload-list="false"
:before-upload="_beupload"
multiple
>
<Button type="dashed" icon="ios-cloud-upload-outline">上传文件(小于50MB)</Button>
</Upload>
<div>
<Card :dis-hover="true" style="width: 100%;height: 400px;overflow: auto;">
<p slot="title">已上传文件列表</p>
<div v-for="(item,index) in fileList" :key="index" class="file-upload-list">
<div>
<div class="file-upload-list-cover">
<Icon @click.native.stop="_handleRemove(item)" type="md-trash" style="color: white;font-size: 20px;"></Icon>
</div>
</div>
{{item.fileName }}
</div>
</Card>
</div>
</div>
<div slot="footer" class="btn-width">
<Button @click="showEditModal = false">取消</Button>
<Button @click="_mutipleUpload" :loading="isLoading" type="primary">{{btnName}}</Button>
</div>
</Modal>
</div>
</template>
<script>
/**
* 上传文件,在文件夹下
*/
import axios from 'axios'
import global from '../../../api/config'
import loading from '../../../api/loading'
export default {
data() {
return {
id: '',
ID: '',
action: '',
modalTitle: '',
showEditModal: false,
name: '',
isLoading: false,
btnName: '上传',
fileList: []
}
},
methods: {
_open(obj) {
this.fileList = []
this.showEditModal = true
this.ID = obj
this.modalTitle = '文件上传'
},
_beupload(file) {
// 单个文件上传超过50M时,取消上传
const isLt50M = file.size / 1024 / 1024 < 50
const fileName = file.name.split('.')[0]
if (!isLt50M) {
this.$Message.warning({
content: '文件 ' + fileName + ' 大小超多50M,请重新上传!',
duration: 3
})
this.isLoading = false
} else {
// 动态循环给文件命名
const temObj = {
file: file,
fileName: fileName
}
this.fileList.push(temObj)
}
return false
},
_mutipleUpload() {
if (this.fileList.length > 0 && this.btnName === '上传') {
this.isLoading = true
this.btnName = '上传中...'
// 创建formula对象
const formData = new FormData()
formData.append('entrustId', this.ID)
// 多个文件
for (let i = 0; i < this.fileList.length; i++) {
formData.append('file' + i, this.fileList[i].file)
}
const config = {
headers: {
'Content-Type': 'multipart/form-data'
}
}
const instanceFile = axios.create()
instanceFile.defaults.withCredentials = true
// 发起请求
instanceFile
.post(
global.baseURL +
'/soil/v1/alone_sample_annex/upload_bath/' +
this.ID,
formData,
{
headers: config
}
)
.then(res => {
if (res.data.code === '1') {
this.$Message.success('上传成功!')
this.showEditModal = false
this.$emit('on-result-change')
} else if (res.data.code === '0') {
loading.toast.show(res.data.code, res.data.msg)
this.$Message.error('操作失败')
}
this._resetLoading()
})
.catch(err => {
console.log(err)
this._resetLoading()
})
} else {
this.$Message.warning('请至少上传一个文件')
this._resetLoading()
}
},
_resetLoading() {
this.isLoading = false
this.btnName = '上传'
},
// 删除对应的上传的文件
_handleRemove(data) {
const index = this.fileList.findIndex(item => item === data)
this.fileList.splice(index, 1)
}
}
}
</script>
<style>
.file-upload-list {
display: inline-block;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin-right: 4px;
}
.file-upload-list:hover .file-upload-list-cover {
display: block;
}
.file-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
}
</style>
<template>
<div>
<Modal v-model="showModal" :width="900" v-drag class="modal-footer-none zIndex-1100">
<p slot="header">{{modalTitle}}</p>
<div>
<FileManageCont ref="fileCont" :flag="flag"></FileManageCont>
</div>
</Modal>
</div>
</template>
<script>
import FileManageCont from './FileManageCont'
export default {
components: {
FileManageCont
},
props: {
// 只能删除自己的标识
flag: null
},
data() {
return {
showModal: false,
modalTitle: '附件管理'
}
},
methods: {
_open(id, key) {
this.showModal = true
this.$refs.fileCont._open(id, key)
}
}
}
</script>
<template>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="margin-bottom: -10px">
<Form :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="文件名称:">
<Input v-model="fileName" @on-enter="_search" placeholder="请输入文件名称"
style="width:200px" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--列表-->
<Col span="24">
<FilesList ref="fileModal" :fileName="fileName" @on-result-change="_fileData"></FilesList>
</Col>
</Row>
<!--删除提示框-->
<ModalConfirm ref="confirmModal" :content="modalContent" :btnModalList="btnModalList"
@on-result-change="_modalResult"></ModalConfirm>
</div>
</template>
<script>
import ModalConfirm from '../../base/ModalConfirm'
import { meterEntrust } from '../../../api'
import FilesList from './FilesList'
export default {
components: {
FilesList,
ModalConfirm
},
props: {
// 只能删除自己的标识
flag: null
},
data() {
return {
fileName: '',
selectIds: [],
getPage: {},
// ids
contractId: '',
sampleId: '',
subcontractorId: '',
originalRecordId: '',
curveId: '',
// 用于区分是哪种附件(合同、委托、样品)
idKey: '',
// 弹框的内容
modalContent: '',
btnModalList: [
{ type: '', name: '取消' },
{ type: 'primary', name: '确定' }
],
//
deleteId: [],
urlData: {}
}
},
methods: {
/**
* msg:表示是哪种附件(委托,样品,分包商)
* pageUrl:page 请求地址
* deleteUrl:删除请求地址
* uploadFileUrl:上传地址
* downloadFileUrl:下载地址
* uri:预览请求地址
* viewUri:预览图片地址
* downloadBatch:批量打包下载
*/
_open(id, key) {
this.fileName = ''
this.showModal = true
this.contractId = ''
this.sampleId = ''
this.subcontractorId = ''
this.originalRecordId = ''
this.curveId = ''
this.entrustId = ''
this.idKey = key
switch (key) {
// 委托
case 'contractId':
this.contractId = id
this.urlData = {
msg: 'FoodContractAttachment',
pageUrl: '/meter/v1/entrust_attachment/page',
deleteUrl: '/meter/v1/entrust_attachment/?ids=',
uploadFileUrl: '/meter/v1/entrust_attachment/upload/',
downloadFileUrl: '/meter/v1/entrust_attachment/download/',
downloadBatch: '/food/v1/contract_attachment/download_batch',
uri: 'FoodContractAttachment/getByContractId',
viewUri: '/meter/v1/entrust_attachment/preview/'
}
break
case 'entrustId':
this.entrustId = id
this.urlData = {
msg: 'FoodContractAttachment',
pageUrl: 'soil/v1/entrust_annex/page',
deleteUrl: '/soil/v1/entrust_annex/?ids=',
uploadFileUrl: '/soil/v1/entrust_annex/upload/',
downloadFileUrl: '/soil/v1/entrust_annex/download/',
downloadBatch: '/food/v1/contract_attachment/download_batch',
uri: 'FoodContractAttachment/getByContractId',
viewUri: '/soil/v1/standard_annex/preview/'
}
break
case 'aloneSampleId':
// 样品
this.entrustId = id
this.urlData = {
msg: 'FoodSampleAttachment',
pageUrl: 'soil/v1/alone_sample_annex/page',
deleteUrl: '/soil/v1/alone_sample_annex/?ids=',
uploadFileUrl: '/soil/v1/alone_sample_annex/upload/',
downloadFileUrl: '/soil/v1/alone_sample_annex/download/',
downloadBatch: '/food/v1/sample_attachment/download_batch',
uri: 'FoodSampleAttachment/getBySampleId',
viewUri: '/food/v1/sample_attachment/view'
}
break
case 'subcontractorId':
// 分包商
this.subcontractorId = id
this.urlData = {
msg: 'FoodSubContractAttachment',
pageUrl: '/meter/v1/contract_attachment/page',
deleteUrl: '/meter/v1/contract_attachment/?ids=',
uploadFileUrl: '/meter/v1/contract_attachment/upload/',
downloadFileUrl: '/meter/v1/contract_attachment/download/',
downloadBatch: '/food/v1/subcontractor_attachment/download_batch',
uri: 'FoodSubContractAttachment/getBySubcontractorId',
viewUri: '/food/v1/subcontractor_attachment/view'
}
break
case 'originalRecordId':
// 原始记录
this.originalRecordId = id
this.urlData = {
msg: 'FoodOriginalRecordAttachment',
pageUrl: 'FoodOriginalRecordAttachment/page',
deleteUrl: 'FoodOriginalRecordAttachment/deleteByIds',
uploadFileUrl: '/food/v1/original_attachment/',
downloadFileUrl: '/food/v1/original_attachment/download/',
downloadBatch: '/food/v1/original_attachment/download_batch',
uri: 'FoodOriginalRecordAttachment/getByOriginalRecordId',
viewUri: '/food/v1/original_attachment/preview'
}
break
case 'curveId':
// 采样记录
this.curveId = id
this.urlData = {
msg: 'ElnCurveAttachment',
pageUrl: 'ElnCurveAttachment/page',
deleteUrl: 'ElnCurveAttachment/deleteByIds',
uploadFileUrl: '/print/v1/curve_attachment/',
downloadFileUrl: '/print/v1/curve_attachment/download/',
downloadBatch: '/print/v1/curve_attachment/download_batch',
uri: 'ElnCurveAttachment/getById',
viewUri: '/print/v1/curve_attachment/view'
}
break
}
const idsObj = {
contractId: this.contractId,
sampleId: this.sampleId,
subcontractorId: this.subcontractorId,
originalRecordId: this.originalRecordId,
curveId: this.curveId,
entrustId: this.entrustId
}
this.$refs.fileModal._setUploadData(
Object.assign({ id: id }, this.urlData),
idsObj,
this.idKey
)
},
_deleteById(ids) {
this.deleteId = ids
this.modalContent = '确定要删除这 ' + ids.length + ' 个附件?'
this.$refs.confirmModal._openModal()
},
_delPage: async function(data) {
console.log(data)
const result = await meterEntrust.attachmentDelete(
this.urlData.deleteUrl,
data.id
)
if (result) {
this.$Message.success('删除成功!')
this.$refs.fileModal._page()
}
this.$refs.confirmModal._closeModal()
this.deleteId = []
},
// 删除提示框返回
_modalResult(msg) {
if (msg === '确定') {
// 删除一条记录
if (this.flag === undefined) {
// 只能删除自己上传的
this._delPage({ id: this.deleteId, flag: 1 })
} else {
// 可以删除全部
this._delPage({ id: this.deleteId })
}
}
},
_fileData(msg, data) {
switch (msg) {
case 'delete':
this._deleteById(data)
break
}
},
// 搜索
_search() {
this.$refs.fileModal._page(this.fileName)
}
}
}
</script>
......@@ -120,13 +120,11 @@
</template>
<script>
import VueGallerySlideshow from 'vue-gallery-slideshow'
import ElementTable from '../../table/ElementTable'
import IconList from '../../base/IconList'
import global from '../../../api/config'
import { http } from '../../../api/http'
/* 样品附件--只读-附属 */
export default {
components: { ElementTable, IconList, VueGallerySlideshow },
components: { IconList, VueGallerySlideshow },
data() {
return {
loading: false,
......@@ -271,7 +269,7 @@ export default {
},
// 一系列操作返回的值
_tableChange(val) {
if (val == 'down') {
if (val === 'down') {
if (this.objectKey.length === 0) {
this.$Message.warning('请选择一条数据!')
} else {
......
......@@ -6,24 +6,24 @@
<Row>
<!--查询-->
<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>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" name="client" placeholder="请输入委托单位" clearable @on-enter="_formSearch"/>
<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" name="entrustCode" placeholder="请输入委托编号" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
......@@ -49,7 +49,7 @@
</div>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component :is="currentComponent" ref="refModal" @on-result-change="_componentResult"></component>
<component ref="refModal" :is="currentComponent" @on-result-change="_componentResult"></component>
</keep-alive>
</div>
</template>
......@@ -59,6 +59,7 @@ import Operation from '../../../components/operation/Operation'
import SoilSampleManage from '../SoilSampleManage'
import importModal from '../../../components/import/DownloadTemplateImport'
import SoilSampleItemManage from '../SoilSampleItemManageEdit'
import EntrustFileManage from '../../../components/file/entrust-file-manage/FileManage'
import EntrustRegisterEdit from './EntrustRegisterEdit'
export default {
components: {
......@@ -71,7 +72,9 @@ export default {
// eslint-disable-next-line vue/no-unused-components
importModal,
// eslint-disable-next-line vue/no-unused-components
SoilSampleItemManage
SoilSampleItemManage,
// eslint-disable-next-line vue/no-unused-components
EntrustFileManage
},
data() {
return {
......@@ -142,15 +145,17 @@ export default {
pageColumns: [
{ title: '委托商', key: 'client', width: 230 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '平均容重', key: 'projectNo', width: 120 },
{ title: '项目负责人', key: 'projectLeader', width: 120 },
{ title: '驳回原因', key: 'backReasons', width: 120 },
{ title: '进度', key: 'progress', width: 95, status: true },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '项目名称', key: 'projectName', width: 120 },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '平均容重', key: 'projectNo', width: 120 },
{ title: '指标人', key: 'tabulater', 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 }
......@@ -293,6 +298,8 @@ export default {
const result = await soilEntrust.submit(ids)
if (result) {
this._resultChange('提交成功')
} else {
this.$refs.pageTable._hideLoading()
}
},
_subToSkipRe: async function(ids) {
......@@ -365,7 +372,7 @@ export default {
},
_upload(id) {
// 上传文件
this.currentComponent = 'FileManage'
this.currentComponent = 'EntrustFileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId')
})
......
......@@ -18,31 +18,37 @@
@on-result-change="_projectChange" name="projectName" placeholder="请输入或选择项目名称"
></AutoComplete>
</Form-item>
<Form-item label="钻孔名称" prop="boreholeName" class="width-48">
<Input v-model="formObj.boreholeName" name="boreholeName" placeholder="请输入名称"/>
<Form-item label="项目负责人" prop="projectLeader" class="width-48">
<AutoComplete ref="autoInput" v-model="formObj.projectLeader" :down-data="projectLeaderData"
@on-result-change="_projectLeaderChange" show-key="realname" name="projectLeader" placeholder="请输入或选择项目负责人"
></AutoComplete>
<!-- <Input v-model="formObj.projectLeader" name="projectLeader" 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="latitude" class="width-48">
<Input v-model="formObj.latitude" name="latitude" placeholder="请输入纬度"/>
<Form-item label="钻孔名称" prop="boreholeName" class="width-48">
<Input v-model="formObj.boreholeName" name="boreholeName" placeholder="请输入名称"/>
</Form-item>
<Form-item label="经度" prop="longitude" class="width-48">
<Input v-model="formObj.longitude" name="longitude" placeholder="请输入经度"/>
</Form-item>
<Form-item label="纬度" prop="latitude" class="width-48">
<Input v-model="formObj.latitude" name="latitude" placeholder="请输入纬度"/>
</Form-item>
<Form-item label="水深(米)" prop="waterDepth" class="width-48">
<Input v-model="formObj.waterDepth" @keydown.native="channelInputLimit" type="number" name="waterDepth" placeholder="请输入深度"/>
</Form-item>
<Form-item label="平均容重" prop="projectNo" class="width-48">
<Input v-model="formObj.projectNo" name="projectNo" placeholder="请输入平均容重"/>
</Form-item>
<Form-item @click.native="_selectPerson" label="制表人" prop="tabulater" class="width-48">
<Input v-model="formObj.tabulater" name="tabulater" 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 @click.native="_selectPerson" label="制表人" prop="tabulater" class="width-48">
<Input v-model="formObj.tabulater" name="tabulater" placeholder="请输入名称"/>
</Form-item>
<Form-item label="检验类别:" prop="testType" class="width-48">
<el-select @change="typeChange" v-model="formObj.testType" name="testType" placeholder="请选择"
size="small"
......@@ -123,7 +129,12 @@
/**
* 添加编辑分包商
*/
import { meterEntrust, meterSample, soilEntrust } from '../../../api'
import {
meterEntrust,
meterSample,
soilEntrust,
soilSample
} from '../../../api'
import importModal from '../../../components/import/DownloadTemplateImport'
import AutoComplete from '../../../components/base/AutoCompletes'
import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect'
......@@ -149,6 +160,8 @@ export default {
showBtn: true,
customerData: [],
projectData: [],
projectLeaderData: [],
projectLeaderName: [],
edit: false,
cityData: [],
selectData: [],
......@@ -299,6 +312,48 @@ export default {
}
}
},
_getLeaderList: async function() {
const result = await soilSample.getUserList()
if (result) {
this.projectLeaderData = result.records
for (let i = 0; i < result.records.length; i++) {
this.projectLeaderName.push(result.records[i].realname)
}
}
},
_projectLeaderChange(msg, data) {
// 添加的时候选择单位
console.log(msg, data)
switch (msg) {
case 'select':
this._leaderMatch(data)
break
case 'query':
this._leaderQuery(data)
break
}
},
_leaderMatch(data) {
console.log('选中', data)
this.formObj.projectLeader = data.realname
if (data.id) {
this.formObj.projectLeaderId = data.id
}
},
_leaderQuery(query) {
this.formObj.projectLeader = query.realname
this._queryUserList(query)
},
_queryUserList: async function(query) {
if (query.realname === '') {
this.$forceUpdate()
this.formObj.projectLeader = ''
}
const result = await soilSample.queryUserList(query)
if (result) {
this.projectLeaderData = result.records
}
},
_selectPerson() {
this.$refs.userModal._openOrg('选择制表人', 'itemTree')
},
......@@ -675,11 +730,25 @@ export default {
if (this.$string(this.id).isEmpty()) {
// 添加
data.sampleList = this.getPage.records
if (this.formObj.projectLeaderId) {
data.projectLeaderId = this.formObj.projectLeaderId
}
if (this.projectLeaderName.indexOf(data.projectLeader) === -1) {
data.projectLeader = undefined
data.projectLeaderId = undefined
}
this._save(data)
} else {
data.id = this.id
data.sampleList = this.getPage.records
console.log(data)
if (this.formObj.projectLeaderId) {
data.projectLeaderId = this.formObj.projectLeaderId
}
if (this.projectLeaderName.indexOf(data.projectLeader) === -1) {
data.projectLeader = undefined
data.projectLeaderId = undefined
}
this._edit(data)
}
} else {
......@@ -718,6 +787,7 @@ export default {
this._getPackList()
this._getProjectList()
this._getSoil()
this._getLeaderList()
this.showBtn = true
this.showModal = true
this._hideLoading()
......@@ -739,6 +809,7 @@ export default {
this._getPackList()
this._getSoil()
this._getProjectList()
this._getLeaderList()
this.showBtn = false
this.showModal = true
this.$refs.formObj.resetFields()
......
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