Commit cfbf2c59 by zhangmengqi

Merge branch 'dev'

parents 615cdd63 c110dddc
...@@ -13,10 +13,18 @@ export default { ...@@ -13,10 +13,18 @@ export default {
pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res), pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res),
pageItemByEntrustId: data => pageItemByEntrustId: data =>
http.post('soil/v1/experiment/page_by_entrust', data).then(res => res), http.post('soil/v1/experiment/page_by_entrust', data).then(res => res),
listEntrustItemNum: data =>
http
.post('soil/v1/statistics/list_entrust_item_num', data)
.then(res => res),
pageReview: data => pageReview: data =>
http.post('soil/v1/entrust/page_review', data).then(res => res), http.post('soil/v1/entrust/page_review', data).then(res => res),
pageSampleReceive: data => pageSampleReceive: data =>
http.post('soil/v1/entrust/page_sample_receive', data).then(res => res), http.post('soil/v1/entrust/page_sample_receive', data).then(res => res),
pageLocationEntrust: data =>
http
.post('soil/v1/entrust/page_receive_location_entrust', data)
.then(res => res),
pageSampleTake: data => pageSampleTake: data =>
http.post('soil/v1/entrust/page_sample_take', data).then(res => res), http.post('soil/v1/entrust/page_sample_take', data).then(res => res),
pageSampleReceiveHis: data => pageSampleReceiveHis: data =>
...@@ -76,11 +84,13 @@ export default { ...@@ -76,11 +84,13 @@ export default {
pagePrepareHis: data => pagePrepareHis: data =>
http.post('soil/v1/sample/page_prepare_his', data).then(res => res), http.post('soil/v1/sample/page_prepare_his', data).then(res => res),
pagePrepareDetailHis: data => pagePrepareDetailHis: data =>
http.post('soil/v1/prepare/page_prepare_his', data).then(res => res), http.post('soil/v1/prepare/page_prepare_detail', data).then(res => res),
sampleEdit: data => sampleEdit: data =>
http.put( http.put(
'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail 'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail
), ),
sampleRemarkEdit: data =>
http.put('soil/v1/sample/' + data.id + '?remark=' + data.remark),
weiteSoilDetail: data => weiteSoilDetail: data =>
http.post('soil/v1/sample/write_soil_detail', data).then(res => res), http.post('soil/v1/sample/write_soil_detail', data).then(res => res),
pageBackup: data => pageBackup: data =>
......
...@@ -19,6 +19,10 @@ export default { ...@@ -19,6 +19,10 @@ export default {
http.post('soil/v1/receive_location/', data).then(res => res), http.post('soil/v1/receive_location/', data).then(res => res),
locationDeleteById: data => locationDeleteById: data =>
http.delete('soil/v1/receive_location/?ids=' + data).then(res => res), http.delete('soil/v1/receive_location/?ids=' + data).then(res => res),
removeSampleFromLocation: data =>
http
.post('soil/v1/sample/remove_sample_from_location/?ids=' + data)
.then(res => res),
locationEdit: data => locationEdit: data =>
http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res), http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res),
// 试验室领样操作 // 试验室领样操作
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<Button>上传</Button> <Button>上传</Button>
</Upload> </Upload>
</label> </label>
<Button @click="batchUpload">批量上传</Button>
<!--一系列操作--> <!--一系列操作-->
<!--非表格--> <!--非表格-->
<!-- <Button v-if="viewStyle === 2 || viewStyle === 3" v-for="item in menusListA" :key="item.name" @click="_radioChange(item.value)"--> <!-- <Button v-if="viewStyle === 2 || viewStyle === 3" v-for="item in menusListA" :key="item.name" @click="_radioChange(item.value)"-->
...@@ -115,6 +116,7 @@ ...@@ -115,6 +116,7 @@
<!--/--> <!--/-->
</Col> </Col>
</Row> </Row>
<BatchPhotoManage ref="batchUpload" @on-result-change="_page"></BatchPhotoManage>
<!--上传loading--> <!--上传loading-->
<div v-show="isLoad"> <div v-show="isLoad">
<Spin fix> <Spin fix>
...@@ -202,11 +204,15 @@ export default { ...@@ -202,11 +204,15 @@ export default {
} }
}, },
methods: { methods: {
batchUpload() {
this.$refs.batchUpload._open(this.id)
},
_setUploadData(data, idsObj, idKey) { _setUploadData(data, idsObj, idKey) {
this.selectIds = [] this.selectIds = []
this.imgViewIndex = null this.imgViewIndex = null
this.isLoad = false this.isLoad = false
this.id = data.id this.id = data.id
console.log('委托id', this.id)
const pageKey = idKey const pageKey = idKey
console.log(pageKey) console.log(pageKey)
this.$set(this.formObj, pageKey, data.id) this.$set(this.formObj, pageKey, data.id)
......
<template>
<div @click="_closeMenu">
<!--内容-->
<div class="layout-content-padding marginLeft-10">
<div class="layout-content-main tree-position">
<div :style="treeStyleObj" v-show="isTree" class="position-left">
<Card dis-hover class="card_tree">
<p slot="title" style="width: 60%">文档管理列表</p>
<p slot="title" style="width: 40%;text-align: right">
<a @click="_refreshFloder">
<Icon type="refresh" size="20"></Icon>
</a>
</p>
<div>
<FileTree ref="filetree" @on-result-change="_fileData" :keyword="keyword"></FileTree>
</div>
</Card>
</div>
<div @click="_treeHide" v-if="isTree" style="position: absolute;left: 196px;top: 50%;cursor:pointer">
<div class="navbarImgShow"></div>
</div>
<div @click="_treeShow" v-else="isTree" style="position: absolute;left:0;top: 50%;cursor:pointer">
<div class="navbarImgHide"></div>
</div>
<div :style="tableStyleObj" class="position-right">
<!--菜单操作-->
<Row>
<Col span="24">
<div class="btns-menu">
<!--查看方式-->
<Select @on-change="_view" v-model="selectValue" style="width:150px" placeholder="请选择查看方式">
<Option v-for="(item,index) in checkList" :key="index" :value="item.value">{{ item.name }}</Option>
</Select>
<!--一系列操作-->
<label v-show="viewStyle == '2' || viewStyle == '3' ">
<Button v-for="item in menusList" :key="item.name" @click="_tableChange(item.value)"
type="ghost" style="margin-right: 5px">
<Icon :type="item.type"></Icon>&nbsp;{{item.name}}
</Button>
</label>
<!--查询条件-->
<Input v-model="keyword" @on-enter="_searchFile" style="width:200px" placeholder="请输入文件名称"
clearable></Input>
<Button @click="_searchFile" type="primary">搜索</Button>
</div>
</Col>
<!-- 表格 -->
<Col span="24" style="margin-bottom: 10px">
<!--上级文件操作-->
<div style="margin: 10px 0;width: 100px;">
<a v-show="isUpLEevel" @click="_upLevel" style="font-size: 14px">
<Icon type="chevron-left"></Icon>&nbsp;返回
</a>
<p v-show="!isUpLEevel" style="font-size: 14px;height:20px">
<Icon type="ios-folder" color="#f5a623"></Icon>&nbsp;全部文件
</p>
</div>
<!--默认是详细模式-->
<div v-if="viewStyle == 1">
<ElementTable ref="pageTable"
:tableHeight="tableHeight" :getPage="List" hide-page hide-checkbox>
<el-table-column
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key"
show-overflow-tooltip sortable>
<template slot-scope="scope">
<div v-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}
</div>
<div v-else-if="item.name">
<div v-if="scope.row.type===undefined">
<span
:style="`background:url(${smallUrl}folder.png)no-repeat;`"
class="span_height">
<a @click="_nextLevel(scope.row.id,scope.row.pid)"
style="display: inline-block;margin-left: 18px">{{scope.row.name}}</a>
</span>
</div>
<div v-else>
<span
:style="`background:url(${smallUrl}${$fileFormat(scope.row.type)}.png)no-repeat;`"
class="span_height">
<span style="display: inline-block;margin-left: 18px">{{scope.row[item.key]}}</span>
</span>
</div>
</div>
<div v-else-if="item.type">
{{scope.row.type===undefined?'文件夹':scope.row.type}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</el-table-column>
<el-table-column
:width="80"
label="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<Poptip placement="left-start" width="150" transfer popper-class="poptip-body_0">
<Icon v-if="scope.row.type" @click="_getFilePre(scope.row)" type="navicon-round" class="icons"
size=20></Icon>
<div slot="content">
<ul class="file_menu_list">
<li v-for="item in menuList" :key="item.name" @click="_iconClick(item.name,scope.row)">
{{item.name}}
</li>
</ul>
</div>
</Poptip>
</template>
</el-table-column>
</ElementTable>
<Page :total="List.total"
:current="List.current"
:page-size="rows"
@on-change="_pageChange"
placement="top"
show-total
style="margin-top: 10px;"></Page>
</div>
<!--缩略图 模式-->
<div v-else-if="viewStyle == 2">
<ul :style="{ 'height': tableHeight }" class="thumbnailStyle">
<CheckboxGroup @on-change="_chkThumbnailVal" v-model="thumbnailValue">
<li v-for="(item,index) in List.records" :key="index">
<div class="thumbnailStyleImg">
<Tooltip placement="top">
<img v-if="item.type == undefined" :src="folderUrl"/>
<img v-else :src="bigUrl+$fileFormat(item.type)+'.png' "/>
<div slot="content" style="white-space: normal">
<p>名称:{{item.name}}</p>
<p v-if="item.type == undefined ">类型:文件夹</p>
<p v-else>类型:{{item.type}}</p>
</div>
</Tooltip>
</div>
<div class="thumbnailStyleCheck">
<div v-if="item.type == undefined" class="file-undefined">
<span style="font-size: 12px">
<a @click="_nextLevel(item.id,item.pid)">{{item.name}}</a>
</span>
</div>
<div v-else>
<Checkbox :label="item.id"><span class="inline-span">{{item.name}}</span></Checkbox>
</div>
</div>
</li>
</CheckboxGroup>
</ul>
</div>
<!--列表 模式-->
<div v-else="viewStyle == 3">
<ul :style="{ 'height': tableHeight }" class="listStyle">
<CheckboxGroup @on-change="_chkThumbnailVal" v-model="listValue">
<li v-for="(item,index) in List.records" :key="index">
<div class="listStyleCheck">
<Tooltip placement="top">
<span class="spanImg">
<img v-if="item.type == undefined" :src=" smallUrl+'folder.png' "/>
<img v-else :src="smallUrl+$fileFormat(item.type)+'.png' "/>
</span>
<span v-if="item.type == undefined" style="font-size: 12px">
<a @click="_nextLevel(item.id,item.pid)"> {{item.name}}</a>
</span>
<span v-else>
<Checkbox :label="item.id"><span> {{item.name}}</span></Checkbox>
</span>
<div slot="content" style="white-space: normal">
<p v-if="item.type == undefined ">类型:文件夹</p>
<p v-else>类型:{{item.type}}</p>
</div>
</Tooltip>
</div>
</li>
</CheckboxGroup>
</ul>
</div>
</Col>
</Row>
</div>
</div>
</div>
<!--图片预览-->
<Modal :title="imgName" v-model="visible">
<img :src="imgUrl" v-if="visible" style="width:100%">
</Modal>
<!--历史版本-->
<VersionFile ref="versionFile" @on-result-change="_versonData"></VersionFile>
<!--更新文件-->
<UploadFileUpdate ref="fileUpdateModal" @on-result-change="_refresh"/>
<!--预览txt文件-->
<TxtReadOnly ref="txtModal"/>
<!--变更文件-->
<UploadChangeFile ref="uploadChangeFile" @on-result-change="_refresh"></UploadChangeFile>
<!--变更原因-->
<Reason ref="reasonModal" @on-result-change="_reasonResult"></Reason>
</div>
</template>
<script>
import global from '../../../api/config'
import FileTree from './FileTree.vue'
import VersionFile from './Version.vue'
import UploadFileUpdate from './UploadFileUpdate.vue'
import TxtReadOnly from './TxtReadOnly'
import UploadChangeFile from './UploadChangeFile.vue'
import Reason from './Reason'
export default {
components: {
Reason,
FileTree,
VersionFile,
UploadFileUpdate,
TxtReadOnly,
UploadChangeFile
},
data() {
return {
viewModal: '',
loading: true,
imgName: '',
imgUrl: '',
visible: false,
selectIds: [],
smallUrl: global.staticURL + '/img/smallfile/',
bigUrl: global.staticURL + '/img/bigfile/',
folderUrl: global.staticURL + '/img/bigfile/folder.png',
pageColumns: [
{ title: '文件名', key: 'name', name: true },
{ title: '类型', key: 'type', width: 100, type: true },
{ title: '创建人', key: 'realname', width: 100 },
{ title: '创建日期', key: 'ctime', width: 140, date: true },
{ title: '文件编号', key: 'code', width: 100, align: 'center' },
{ title: '版本', key: 'version', width: 100, align: 'center' },
{ title: '分发份数', key: 'copies', width: 100, align: 'center' },
{ title: '存档份数', key: 'save', width: 100, align: 'center' },
{ title: '备注', key: 'remark', width: 100, align: 'center' }
],
// 文件权限
version: { name: '版本' },
upload: { name: '签入' },
del: { name: '删除' },
down: { name: '下载' },
view: { name: '预览' },
edit: { name: '编辑' },
change: { name: '变更' },
destruction: { name: '销毁' },
// 文件权限
menuList: [],
selMenus: '',
menusList: [
{ name: '全选', value: 'checkAll', type: 'checkmark-circled' },
{ name: '反选', value: 'unCheckAll', type: 'minus-circled' },
{ name: '批量删除', value: 'delete', type: 'trash-a' }
],
checkList: [
{ name: '详细模式', value: '1' },
{ name: '缩略图模式', value: '2' },
{ name: '列表模式', value: '3' }
],
viewStyle: '1',
thumbnailValue: [],
listValue: [],
folderId: '', // 文件夹id
allList: [], // 文件和文件夹总数据
fileList: [],
pageList: {},
upLevelPid: '',
isUpLEevel: false,
treeStyleObj: {
width: '210px',
height: ''
},
tableStyleObj: {
'margin-left': '215px'
},
isTree: true,
getPage: {},
// 查询条件
keyword: '',
selectValue: '1',
// 每页的条数
rows: 20,
changeData: {},
destructionId: ''
}
},
computed: {
List() {
return {
records: this.allList,
total: this.getPage.total,
current: this.getPage.current
}
},
tableHeight: function() {
return this.$newTableHeight('', 250)
}
},
mounted() {
this.selectValue = '1'
this.keyword = ''
// 获取文件夹
this.$refs.filetree._Ztree()
// 获取文件
this._filetree()
this._tableHeight(255)
},
methods: {
// 重置所有数据(查所有的数据)
_refreshFloder() {
this.pageList.page = 1
this.isUpLEevel = false
this.$refs.filetree._getFolderList('', 1)
},
_iconClick(res, data) {
switch (res) {
case '版本':
this._version(data)
break
case '签入':
this._checkIn(data)
break
case '删除':
this._deleteById(data.id, data.type)
break
case '下载':
this._download(data.id)
break
case '预览':
this._viewFile(data)
break
case '编辑':
this._editFile(data)
break
case '变更':
this._changeFile(data)
break
case '销毁':
this._destructionFile(data.id)
break
}
},
_reasonResult(remark, title) {
switch (title) {
case '变更原因':
this.changeData.remark = remark
this.$refs.uploadChangeFile._open(this.changeData)
break
case '销毁原因':
this.$store
.dispatch('SysFileStatistics/destroyFile', {
id: this.destructionId,
remark: remark
})
.then(() => {
// 销毁文件
if (this.$store.state.SysFileStatistics.success) {
this.$Message.success('提交成功!')
this._refresh()
}
})
break
}
},
_changeFile(data) {
this.changeData = data
this.$Modal.confirm({
title: '提示',
content: '确定要变更文件?',
onOk: () => {
this.$refs.reasonModal._open('变更原因')
}
})
},
_destructionFile(id) {
this.destructionId = id
this.$Modal.confirm({
title: '提示',
content: '确定要销毁这个文件?',
onOk: () => {
this.$refs.reasonModal._open('销毁原因')
}
})
},
_tableHeight(val) {
this.treeStyleObj.height =
document.documentElement.clientHeight - 110 + 'px'
},
_pageChange(page) {
this.pageList.page = page
this._filetree()
},
// 搜索文件
_searchFile() {
if (this.keyword) {
this.pageList.name = this.keyword
} else {
this.pageList.name = ''
}
this._filetree()
},
_searchParams() {
const data = {}
if (this.folderId) {
data.folderId = this.folderId
}
if (this.keyword) {
data.name = this.keyword
}
return this.$extend(data, this.pageList)
},
_selectRowChange(data) {
const idList = []
for (let i = 0; i < data.length; i++) {
idList.push(data[i].id)
}
this.selectIds = idList
},
_selectAll: function(data) {
this._selectRowChange(data)
},
_fileData(rel, ID, PID, fileList, current) {
// ztree返回的数据
const currentPage = current.currentPage
if (currentPage) {
// 重新发起一次请求,请求上一页的数据
this.pageList.page = currentPage
this._filetree()
}
// page 参数
this.getPage = current.getPage
this.pageList.page = this.getPage.page
this.folderId = ID
this.upLevelPid = PID
this.allList = rel
this.fileList = fileList // 文件夹数据
this.thumbnailValue = []
this.listValue = []
this.selectIds = []
// 【返回】键是否显示
if (this.folderId) {
this.isUpLEevel = true
} else {
this.isUpLEevel = false
}
},
_closeMenu() {
this.$refs.filetree._close()
},
_filetree() {
this.$refs.filetree._getFolderList(
this.folderId,
this.pageList.page,
this.upLevelPid
)
},
_view(rel) {
// 查看方式改变
this.viewStyle = rel
this._tableHeight(255)
this.selectIds = []
this.thumbnailValue = []
this.listValue = []
},
_tableChange(rel) {
// 一系列操作返回的值
if (rel == 'checkAll') {
// 全选
if (this.viewStyle == '1') {
this.$refs.selection.selectAll(true)
} else if (this.viewStyle == '2') {
this._thumbnailChkAll()
} else if (this.viewStyle == '3') {
this._listChkAll()
}
} else if (rel == 'unCheckAll') {
// 反选
this._unCheckAll()
} else if (rel == 'delete') {
// 删除
this._deleteSelected()
} else {
}
},
_chkThumbnailVal(rel) {
// 缩略图模式/列表模式选择其中一个
this.selectIds = rel
},
_thumbnailChkAll() {
// 缩略图模式全选
const idList = []
const rel = this.fileList
for (let i = 0; i < rel.length; i++) {
idList.push(rel[i].id)
}
this.selectIds = idList
this.thumbnailValue = idList
},
_listChkAll() {
// 列表模式全选
const idList = []
const rel = this.fileList
for (let i = 0; i < rel.length; i++) {
idList.push(rel[i].id)
}
this.selectIds = idList
this.listValue = idList
},
_unCheckAll() {
if (this.viewStyle == '1') {
this.$refs.selection.selectAll(false)
} else if (this.viewStyle == '2' || this.viewStyle == '3') {
this.selectIds = []
this.thumbnailValue = []
this.listValue = []
}
},
_deleteByIds(ids, type) {
this.$Modal.confirm({
title: '提示',
content: '确定要删除这 ' + ids.length + ' 个文件?',
onOk: () => {
if (type !== undefined) {
this.$store
.dispatch('SysFileStatistics/deleteByIds', ids)
.then(() => {
// 删除文件
if (this.$store.state.SysFileStatistics.success) {
this.$Message.success('删除成功!')
this._refresh()
}
})
}
}
})
},
_deleteById(id, type) {
// 删除一条记录
this._deleteByIds([id], type)
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '', '')
}
},
_refresh() {
// 根据分页及floderId,查询条件刷新
this._filetree()
this.thumbnailValue = []
this.listValue = []
},
_download(id) {
// 下载
this.$Modal.confirm({
title: '提示',
content: '确定要下载?',
onOk: () => {
window.open(
global.baseURL + '/statistics/v1/file/download/' + id,
'_blank'
)
}
})
},
_versonData() {
this._filetree()
},
_version(rel) {
// 历史版本
this.$refs.versionFile._open(rel)
},
_checkIn(data) {
// 签入
this.$refs.fileUpdateModal._open(data)
},
_treeHide() {
// 左侧树隐藏
this.isTree = false
this.tableStyleObj.marginLeft = '15px'
},
_treeShow() {
this.isTree = true
this.tableStyleObj.marginLeft = '215px'
},
/** ********************获取文件权限********************************/
// 权限从小到大依次是 0,3,1,2
_getMaxPre(result) {
const list = result
const index = list.findIndex(item => item === 3)
if (index !== -1) {
list.splice(index, 1)
if (Math.max.apply(null, list) === 0) {
return 3
} else {
return Math.max.apply(null, list)
}
} else {
return Math.max.apply(null, list)
}
},
_getFilePre(data) {
this.menuList = []
this.$store.dispatch('SysFileStatistics/authorize', data.id).then(() => {
const result = this.$store.state.SysFileStatistics.model
// 获取最大权限
const max = this._getMaxPre(result)
console.log(max, 'max')
if (max === 0) {
// 查看
if (this.$fileFormat(data.type) === 'other') {
// 其他格式
this._noFileTip()
} else {
this.menuList = [this.view]
}
} else if (max === 1) {
// 上传
// txt格式不支持编辑,则按钮自动变为预览
// 图片格式也自动变为预览
if (this.$fileFormat(data.type) === 'other') {
// 其他格式
this.menuList = [this.down, this.version, this.upload]
} else {
let fileType = ''
if (
data.type.toLowerCase() === 'txt' ||
this.$fileFormat(data.type, 'img')
) {
fileType = this.view
} else {
fileType = this.edit
}
this.menuList = [
fileType,
this.down,
this.version,
this.upload,
this.change
]
}
} else if (max === 2) {
// 删除
// txt格式不支持编辑,则按钮自动变为预览
// 图片格式也自动变为预览
if (this.$fileFormat(data.type) === 'other') {
// 其他格式
this.menuList = [this.down, this.version, this.upload, this.del]
} else {
let fileType = ''
if (
data.type.toLowerCase() === 'txt' ||
this.$fileFormat(data.type, 'img')
) {
fileType = this.view
} else {
fileType = this.edit
}
this.menuList = [
fileType,
this.down,
this.version,
this.upload,
this.del,
this.change,
this.destruction
]
}
} else if (max === 3) {
// 查看
if (this.$fileFormat(data.type) === 'other') {
// 其他格式
this.menuList = [this.down]
} else {
this.menuList = [this.view, this.down]
}
} else {
// 无任何权限
this._noFileTip()
}
})
},
_noFileTip() {
this.menuList = []
this.$Notice.error({
top: 50,
duration: 10,
title: '该文件暂无任何权限,请联系管理员!'
})
},
/** ********************获取文件权限********************************/
/** ********************查看上下级文件********************************/
// 进入下级,查看下级文件
_nextLevel(id, pid) {
this.upLevelPid = pid
this.folderId = id
this._getPidList()
},
// 上一级文件
_upLevel() {
this.$store
.dispatch('SysFolderStatistics/getById', this.upLevelPid)
.then(() => {
// 上级文件夹
const list1 = this.$store.state.SysFolderStatistics.model
if (list1 === undefined) {
// 重置所有数据
this._refreshFloder()
} else {
this.isUpLEevel = true
this.upLevelPid = list1.pid // 存储pid到div中
this.folderId = list1.id // 查List列表
this._getPidList()
}
})
},
// 获取文件及文件夹(根据文件夹id)
_getPidList() {
// 进入文件夹中每次page都为1
this.isUpLEevel = true
this.pageList.page = 1
this.pageList.rows = 20
this._filetree()
},
/** ********************查看上下级文件********************************/
/** *******************************文件的处理**********************************/
_viewFile(rel) {
// 预览文件
const random = '?' + +'?' + Math.random()
if (this.$fileFormat(rel.type, 'img')) {
this.imgName = '预览---' + rel.name
this.visible = true
this.imgUrl =
global.baseURL + '/statistics/v1/file/download/' + rel.id + random
} else {
this._optFile(rel, 5, false)
}
},
_optFile(rel, isReport, isEdit) {
if (rel.type.toLowerCase() === 'pdf') {
// pdf 单独预览
this.$pdfView(rel.objectKey)
} else if (rel.type.toLowerCase() === 'txt') {
// txt 单独预览
this.$refs.txtModal._open(rel)
} else {
// pageoffice或officeOnline打开
this.$openWindowModeless({
objectKey: rel.objectKey,
id: rel.id,
isReport: isReport,
noMark: true,
isEdit: isEdit
})
}
},
_editFile(rel) {
// 编辑文件
this._optFile(rel, 4, true)
}
/** *******************************文件的处理**********************************/
}
}
</script>
<style scoped>
.file_menu_list {
overflow: hidden;
margin-bottom: 0;
}
.file_menu_list li {
float: left;
padding: 10px 10px 10px 20px;
width: 100%;
text-align: left;
border-bottom: 1px solid #eee;
}
.file_menu_list li:hover {
background: #eee;
cursor: pointer;
}
.span_height {
width: 16px;
height: 16px;
display: inline-block;
line-height: 16px;
}
</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/sample_photo/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>
...@@ -108,6 +108,9 @@ ...@@ -108,6 +108,9 @@
@on-result-change="_soilChange" name="sampleDescribe" placeholder="请输入或选择土质描述" @on-result-change="_soilChange" name="sampleDescribe" placeholder="请输入或选择土质描述"
></AutoComplete> ></AutoComplete>
</div> </div>
<div v-else-if="item.key==='experiments'" @click.stop="_handleRow(scope)">
<span @click="_removeItem(scope.row)">{{scope.row[item.key]}}</span>
</div>
<span v-else> {{ scope.row[item.key] }}</span> <span v-else> {{ scope.row[item.key] }}</span>
</template> </template>
</vxe-table-column> </vxe-table-column>
...@@ -120,6 +123,8 @@ ...@@ -120,6 +123,8 @@
<importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal> <importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal>
<SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change /> <SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change />
<assignPerson ref="userModal" @on-result-change="_userResult"></assignPerson> <assignPerson ref="userModal" @on-result-change="_userResult"></assignPerson>
<SampleItemRemove ref="sampleItemRemove" @on-result-change = '_removeItemBack'></SampleItemRemove>
<SampleItemEdit ref="sampleItemEdit"></SampleItemEdit>
</div> </div>
</template> </template>
<script> <script>
...@@ -132,12 +137,16 @@ import AutoComplete from '../../../components/base/AutoCompletes' ...@@ -132,12 +137,16 @@ import AutoComplete from '../../../components/base/AutoCompletes'
import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect' import SampleItemSelect from '../../meter-aptitude/standard-manage/SampleItemSelect'
import assignPerson from '../../../components/user-info-single/assignPerson' import assignPerson from '../../../components/user-info-single/assignPerson'
import Global from '../../../api/config' import Global from '../../../api/config'
import SampleItemRemove from './SampleItemRemove'
import SampleItemEdit from './SampleItemEdit'
export default { export default {
components: { components: {
AutoComplete, AutoComplete,
importModal, importModal,
SampleItemSelect, SampleItemSelect,
assignPerson assignPerson,
SampleItemRemove,
SampleItemEdit
}, },
data() { data() {
const validatefee = (rule, value, callback) => { const validatefee = (rule, value, callback) => {
...@@ -206,6 +215,7 @@ export default { ...@@ -206,6 +215,7 @@ export default {
edit: false, edit: false,
cityData: [], cityData: [],
selectData: [], selectData: [],
sampleItemList: [],
searchOpen: true, searchOpen: true,
testedCityData: [], testedCityData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }], judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
...@@ -375,6 +385,27 @@ export default { ...@@ -375,6 +385,27 @@ export default {
this.$forceUpdate() this.$forceUpdate()
this.formObj.testType = data this.formObj.testType = data
}, },
_removeItem(itemInfo) {
console.log('试验项目', itemInfo)
this.sampleItemList = itemInfo.experimentList
if (itemInfo.sampleCode !== '') {
this.$refs.sampleItemEdit._open(itemInfo.id)
} else {
this.$refs.sampleItemRemove._open(this.sampleItemList)
}
},
_removeItemBack(data) {
if (data) {
this.getPage.records[this.currentIndex].experimentList = data
const itemNames = []
for (let j = 0; j < data.length; j++) {
itemNames.push(data[j].name)
}
this.getPage.records[this.currentIndex].experiments = itemNames.join(
','
)
}
},
_itemImportBack(data) { _itemImportBack(data) {
this.$forceUpdate() this.$forceUpdate()
console.log('传过来的数据', data) console.log('传过来的数据', data)
...@@ -385,17 +416,25 @@ export default { ...@@ -385,17 +416,25 @@ export default {
console.log('去掉id后的data', info) console.log('去掉id后的data', info)
for (let i = 0; i < this.indexList.length; i++) { for (let i = 0; i < this.indexList.length; i++) {
const index = this.indexList[i] const index = this.indexList[i]
if (this.getPage.records[index].experimentList !== undefined) { if (this.getPage.records[index].experiments !== undefined) {
const name = [] const name = []
this.itemList = this.getPage.records[index].experimentList if (this.getPage.records[index].experimentList) {
name.push(this.getPage.records[index].experiments) this.itemList = this.getPage.records[index].experimentList
for (let i = 0; i < info.length; i++) { name.push(this.getPage.records[index].experiments)
console.log(this.getPage.records[index].experiments[i]) for (let i = 0; i < info.length; i++) {
this.itemList.push(info[i]) console.log(this.getPage.records[index].experiments[i])
name.push(info[i].name) this.itemList.push(info[i])
name.push(info[i].name)
}
this.getPage.records[index].experiments = name.join('、')
this.getPage.records[index].experimentList = this.itemList
} else {
name.push(this.getPage.records[index].experiments)
for (let i = 0; i < info.length; i++) {
name.push(info[i].name)
}
this.getPage.records[index].experiments = name.join('、')
} }
this.getPage.records[index].experiments = name.join('、')
this.getPage.records[index].experimentList = this.itemList
this.$set(this.getPage.records, index, this.getPage.records[index]) this.$set(this.getPage.records, index, this.getPage.records[index])
} else { } else {
const name = [] const name = []
...@@ -409,6 +448,12 @@ export default { ...@@ -409,6 +448,12 @@ export default {
this.$set(this.getPage.records, index, this.getPage.records[index]) this.$set(this.getPage.records, index, this.getPage.records[index])
} }
} }
if (this.edit) {
const sampleData = {}
sampleData.id = this.id
sampleData.sampleList = this.getPage.records
this._sampleEdit(sampleData)
}
console.log(this.getPage.records) console.log(this.getPage.records)
}, },
_selectPerson() { _selectPerson() {
...@@ -507,39 +552,9 @@ export default { ...@@ -507,39 +552,9 @@ export default {
} }
}, },
_inputBack(data) { _inputBack(data) {
console.log(data)
if (data) { if (data) {
this._getByEntrustId(this.id) this._getByEntrustId(this.id)
} }
// if (undefined !== data) {
// if (this.getPage.records.length > 0) {
// const j = this.getPage.records.length
// for (let i = j; i < data.length + j; i++) {
// console.log(i)
// this.getPage.records.push(data[i - j])
// if (data[i - j].lastTime !== undefined) {
// this.getPage.records[i].lastTime = new Date(data[i - j].lastTime)
// }
// console.log(this.getPage.records)
// // this.getPage.records[i].lastTime = new Date(data[0].lastTime)
// }
// } else {
// for (let i = 0; i < data.length; i++) {
// // if (this.getPage.records[i].lastTime !== undefined) {
// // const t = this.getPage.records[i].lastTime
// // const d = t.valueOf(t)
// // console.log('时间戳', d)
// // this.getPage.records[i].lastTime = d
// // this.getPage.records = []
// // }
// this.getPage.records.push(data[i])
// if (data[i].lastTime !== undefined) {
// this.getPage.records[i].lastTime = new Date(data[i].lastTime)
// }
// console.log(data[i].lastTime)
// }
// }
// }
}, },
_ctimeChange(data) { _ctimeChange(data) {
this.formObj.entrustDate = data this.formObj.entrustDate = data
...@@ -633,7 +648,8 @@ export default { ...@@ -633,7 +648,8 @@ export default {
samplePack: '', samplePack: '',
sampleDescribe: '', sampleDescribe: '',
siteNo: '', siteNo: '',
experiments: '' experiments: '',
experimentList: []
} }
this.getPage.records.unshift(data) this.getPage.records.unshift(data)
}, },
...@@ -676,9 +692,6 @@ export default { ...@@ -676,9 +692,6 @@ export default {
case 'iconClick': case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex) this._iconClick(data.name, data.rowData, data.rowIndex)
break break
// case 'changeSize':
// this._page()
// break
} }
}, },
allSelect(data) { allSelect(data) {
...@@ -804,15 +817,11 @@ export default { ...@@ -804,15 +817,11 @@ export default {
if (valid) { if (valid) {
const data = this.$serialize('MeterSendTestEdit') const data = this.$serialize('MeterSendTestEdit')
console.log(this.getPage.records) console.log(this.getPage.records)
// Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) { if (this.$string(this.id).isEmpty()) {
// 添加 // 添加
// const saveData = this.formObj
data.sampleList = this.getPage.records data.sampleList = this.getPage.records
console.log(data)
this._save(data) this._save(data)
} else { } else {
// const saveData = this.formObj
data.id = this.id data.id = this.id
data.sampleList = this.getPage.records data.sampleList = this.getPage.records
console.log(data) console.log(data)
...@@ -949,12 +958,13 @@ export default { ...@@ -949,12 +958,13 @@ export default {
} }
}, },
_save: async function(data) { _save: async function(data) {
this._hideLoading()
console.log(data)
const result = await soilEntrust.save(data) const result = await soilEntrust.save(data)
console.log(result)
if (result) { if (result) {
this._resultChange('添加成功!') this._resultChange('添加成功!')
} else {
setTimeout(() => {
this._hideLoading()
}, 500)
} }
}, },
_edit: async function(data) { _edit: async function(data) {
...@@ -964,6 +974,13 @@ export default { ...@@ -964,6 +974,13 @@ export default {
this._resultChange('编辑成功!') this._resultChange('编辑成功!')
} }
}, },
_sampleEdit: async function(data) {
this._hideLoading()
const result = await soilEntrust.editDTO(data)
if (result) {
this.$Message.success('编辑成功')
}
},
_visibleChange(data) { _visibleChange(data) {
this.$forceUpdate() this.$forceUpdate()
console.log('清空') console.log('清空')
......
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
@on-cancel="_cancel"
title="检测项目管理"
>
<Row>
<Col span="24">
<Form v-model="formObj" :label-width="90" inline onsubmit="return false">
<Form-item class="search-item" label="试验名称:" style="margin-left: -25px">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入试验名称" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--正常界面-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" />
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilEntrust } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {
catalogueId: '',
name: '',
code: '',
standardCode: '',
standardName: ''
},
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [
{
type: 'md-trash',
id: '',
name: '删除'
}
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '方法', key: 'testMethod', width: 180 }
],
catalogueId: '',
itemList: {
records: []
},
getPage: {},
selectData: [],
originalList: []
}
},
methods: {
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.formObj.sampleId = id
this.$refs.pageTable._hideLoading()
// if (catalogueId) {
this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.pageItem(
this.$serializeForm(this.formObj)
)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteById(data.id)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
_deleteOk: async function(id) {
const result = await soilEntrust.experimentDeleteById(id)
if (result) {
this.$Message.success('删除成功')
this._page()
}
},
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
}
},
_ok() {
const expNames = []
for (let i = 0; i < this.getPage.records.length; i++) {
expNames.push(this.getPage.records[i].name)
}
const data = expNames
this._saveCatalogueItem(data)
},
_saveCatalogueItem(data) {
this.showModal = false
this.$emit('on-result-change', data)
this._hideLoading()
},
_cancel() {
this.selectData = []
this.showModal = false
},
_visibleChange() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
@on-cancel="_cancel"
title="检测项目管理"
>
<Row>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="itemList" :icon-msg="iconMsg" @on-result-change="_tableResultChange" hide-page="true" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {
catalogueId: '',
name: '',
code: '',
standardCode: '',
standardName: ''
},
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [
{
type: 'md-trash',
id: '',
name: '删除'
}
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '方法', key: 'testMethod', width: 180 }
],
catalogueId: '',
itemList: {
records: []
},
selectData: [],
originalList: []
}
},
methods: {
_open(itemList) {
this.itemList.records = []
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.itemList.records = itemList
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._clearSelection()
// if (catalogueId) {
// this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_formSearch() {
console.log(this.formObj.name)
const searchItem = []
for (let i = 0; i < this.itemList.records.length; i++) {
if (this.itemList.records[i].name === this.formObj.name) {
console.log(this.itemList.records[i])
searchItem.push(this.itemList.records[i])
}
}
this.itemList.records = searchItem
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this.itemList.records.splice(data.index, 1)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
_deleteOk(id) {
// const result = await drugCatalogueItem.deleteById(id)
this.itemList.splice(id, 1)
this.getPage.records = this.itemList
this.$Message.success('已删除')
},
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
},
_ok() {
const data = this.itemList.records
this._saveCatalogueItem(data)
},
_saveCatalogueItem(data) {
this.showModal = false
this.$emit('on-result-change', data)
this._hideLoading()
},
_cancel() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_visibleChange() {
const data = this.itemList.records
this._saveCatalogueItem(data)
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<template> <template>
<div> <div>
<Modal v-model="showModal" @on-visible-change="_visibleChange" width="970" class="modal-footer-none"> <Modal v-model="showModal" width="1200" class="modal-footer-none" @on-visible-change="_visibleChange">
<p slot="header"> <p slot="header">
{{ modalTitle }} {{ modalTitle }}
</p> </p>
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false"> <Form v-show="searchOpen" id="search-sample-company" :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.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable /> <Input v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" />
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_page" type="primary"> <Button type="primary" @click="_page">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list> <btn-list :msg="btn" :open="searchOpen" class="contHide" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" is-edit select-data> :get-page="getPage" :icon-msg="iconMsg" is-edit select-data @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -39,7 +39,12 @@ ...@@ -39,7 +39,12 @@
:edit-render="item.editCell?{autofocus: 'input'}:null" sortable> :edit-render="item.editCell?{autofocus: 'input'}:null" sortable>
<template v-slot:edit="scope"> <template v-slot:edit="scope">
<div v-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)"> <div v-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.describeDetail" @blur="_page()" @change="_inputChange(scope.row)"></el-input> <!-- <el-input v-model="scope.row.describeDetail" @change="_inputChange(scope.row)" placeholder="请输入土质描述详情">-->
<!-- </el-input>-->
<Input :value="scope.row.describeDetail" @change.native="_inputChange($event.target.value,scope.row)"></Input>
</div>
<div v-else-if="item.key==='remark'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.remark" @change="_remarkChange(scope.row)"></el-input>
</div> </div>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -103,6 +108,7 @@ export default { ...@@ -103,6 +108,7 @@ export default {
], ],
itemList: [], itemList: [],
indexList: [], indexList: [],
currentIndex: -1,
footerList: [ footerList: [
{ id: '', name: '取消', type: '' }, { id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' } { id: '', name: '确定', type: 'primary' }
...@@ -126,7 +132,8 @@ export default { ...@@ -126,7 +132,8 @@ export default {
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' }, { title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 100 }, { title: '试样深度', key: 'sampleDepth', width: 100 },
{ title: '现场编号', key: 'siteNo', width: 100 }, { title: '现场编号', key: 'siteNo', width: 100 },
{ title: '试验项目', key: 'experimentNames', width: 100 }, { title: '试验项目', key: 'experimentNames', width: 110 },
{ title: '试验项目简写', key: 'experimentShortNames', width: 120 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 }, { title: '土质描述', key: 'sampleDescribe', width: 160 },
{ {
title: '土质描述详情', title: '土质描述详情',
...@@ -134,6 +141,12 @@ export default { ...@@ -134,6 +141,12 @@ export default {
width: 200, width: 200,
editCell: true editCell: true
}, },
{
title: '备注',
key: 'remark',
width: 200,
editCell: true
},
{ title: '样品包装类型', key: 'samplePack', width: 120 } { title: '样品包装类型', key: 'samplePack', width: 120 }
], ],
sampleId: '', sampleId: '',
...@@ -157,15 +170,27 @@ export default { ...@@ -157,15 +170,27 @@ export default {
this.$refs.pageTable._showLoading() this.$refs.pageTable._showLoading()
}, },
methods: { methods: {
_inputChange: async function(info) { _inputChange: async function(info, data) {
this.getPage.records[data.index].describeDetail = info
const result = await soilEntrust.sampleEdit({ const result = await soilEntrust.sampleEdit({
id: data.id,
describeDetail: info
})
if (result) {
this.$Message.success('修改成功')
}
},
_remarkChange: async function(info) {
const result = await soilEntrust.sampleRemarkEdit({
id: info.id, id: info.id,
describeDetail: info.describeDetail remark: info.remark
}) })
if (result) { if (result) {
this._resultChange('修改成功') // this._resultChange('修改成功')
} }
}, },
_handleRow(data) { _handleRow(data) {
this.currentRow = data.row this.currentRow = data.row
this.currentIndex = data.rowIndex this.currentIndex = data.rowIndex
......
<template> <template>
<div> <div>
<Modal v-model="showModal" width="980" class="modal-footer-none"> <Modal v-model="showModal" width="1180" class="modal-footer-none">
<p slot="header"> <p slot="header">
{{ modalTitle }} {{ modalTitle }}
</p> </p>
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false"> <Form v-show="searchOpen" id="search-sample-company" :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.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable /> <Input v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" />
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_page" type="primary"> <Button type="primary" @click="_page">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -23,33 +23,31 @@ ...@@ -23,33 +23,31 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list> <btn-list :msg="btn" :open="searchOpen" class="contHide" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data> :get-page="getPage" :icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
:field="item.key" :field="item.key"
:title="item.title" :title="item.title"
:width="item.width?item.width:200" :width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable> :fixed="item.fixed?item.fixed:undefined"
<template slot-scope="scope"> :edit-render="item.editCell?{autofocus: 'input'}:null" sortable>
<div v-if="item.detail"> <template slot-scope="scope">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a> <div v-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)">
</div> <Input :value="scope.row.describeDetail" @change.native="_inputChange($event.target.value,scope.row)"></Input>
<div v-else-if="item.status"> </div>
{{ scope.row[item.key].display }} <div v-else-if="item.key==='remark'" @click.stop="_handleRow(scope)">
</div> <el-input v-model="scope.row.remark" @change="_remarkChange(scope.row)"></el-input>
<div v-else-if="item.date"> </div>
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }} <div v-else>
</div> {{ scope.row[item.key] }}
<div v-else> </div>
{{ scope.row[item.key] }} </template>
</div>
</template>
</vxe-table-column> </vxe-table-column>
</PTVXETableHeight> </PTVXETableHeight>
</Col> </Col>
...@@ -87,6 +85,11 @@ export default { ...@@ -87,6 +85,11 @@ export default {
type: 'success', type: 'success',
id: 'ZBC', id: 'ZBC',
name: '打印标签' name: '打印标签'
},
{
type: 'success',
id: '',
name: '批量填写土质描述详情'
} }
], ],
itemList: [], itemList: [],
...@@ -117,11 +120,29 @@ export default { ...@@ -117,11 +120,29 @@ export default {
selectData: {}, selectData: {},
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' }, {
title: '试样编号',
key: 'sampleCode',
width: 120,
fixed: 'left'
},
{ title: '试样深度', key: 'sampleDepth', width: 100 }, { title: '试样深度', key: 'sampleDepth', width: 100 },
{ title: '现场编号', key: 'siteNo', width: 100 }, { title: '现场编号', key: 'siteNo', width: 100 },
{ title: '试验项目', key: 'experimentNames', width: 110 },
{ title: '试验项目简写', key: 'experimentShortNames', width: 120 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 }, { title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '土质描述详情', key: 'describeDetail', width: 160 }, {
title: '土质描述详情',
key: 'describeDetail',
width: 200,
editCell: true
},
{
title: '备注',
key: 'remark',
width: 200,
editCell: true
},
{ title: '样品包装类型', key: 'samplePack', width: 120 } { title: '样品包装类型', key: 'samplePack', width: 120 }
], ],
sampleId: '', sampleId: '',
...@@ -142,15 +163,27 @@ export default { ...@@ -142,15 +163,27 @@ export default {
} }
}, },
methods: { methods: {
_inputChange: async function(info) { _inputChange: async function(info, data) {
this.getPage.records[data.index].describeDetail = info
const result = await soilEntrust.sampleEdit({ const result = await soilEntrust.sampleEdit({
id: data.id,
describeDetail: info
})
if (result) {
this.$Message.success('修改成功')
}
},
_remarkChange: async function(info) {
const result = await soilEntrust.sampleRemarkEdit({
id: info.id, id: info.id,
describeDetail: info.describeDetail remark: info.remark
}) })
if (result) { if (result) {
this._resultChange('修改成功') // this._resultChange('修改成功')
} }
}, },
_handleRow(data) { _handleRow(data) {
this.currentRow = data.row this.currentRow = data.row
this.currentIndex = data.rowIndex this.currentIndex = data.rowIndex
...@@ -212,42 +245,12 @@ export default { ...@@ -212,42 +245,12 @@ export default {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
switch (msg) { switch (msg) {
case '添加':
this._editModal(false)
break
case '复制历史样品':
this._copyHisSample()
break
case '导入样品':
this._importSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '打印标签': case '打印标签':
this._printLabel() this._printLabel()
break break
case '试样制备':
this._samplePre()
break
case '批量填写土质描述详情': case '批量填写土质描述详情':
this._writeDetail(this.selectIds) this._writeDetail(this.selectIds)
break break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search': case 'search':
this.searchOpen = !this.searchOpen this.searchOpen = !this.searchOpen
break break
......
...@@ -62,22 +62,16 @@ ...@@ -62,22 +62,16 @@
<!--组件加载--> <!--组件加载-->
<ViewSample ref="viewSample"></ViewSample> <ViewSample ref="viewSample"></ViewSample>
<StandardsManageEdit ref="editModal" @on-result-change="_page"></StandardsManageEdit> <StandardsManageEdit ref="editModal" @on-result-change="_page"></StandardsManageEdit>
<DownloadTemplateImport ref="importModal" @on-result-change="_page"></DownloadTemplateImport>
<!-- <component ref="refModal" :is="currentComponent" @on-result-change="_page"></component>-->
</div> </div>
</template> </template>
<script> <script>
import http from '../../../api/http'
import { soilSample } from '../../../api' import { soilSample } from '../../../api'
import global from '../../../api/config'
import DownloadTemplateImport from '../../../components/import/DownloadTemplateImport' // 导入
import StandardsManageEdit from './AddressManageEdit' // 添加、编辑 import StandardsManageEdit from './AddressManageEdit' // 添加、编辑
import ViewSample from './ViewSample' import ViewSample from './ViewLocationEntrust'
export default { export default {
components: { components: {
StandardsManageEdit, StandardsManageEdit,
DownloadTemplateImport,
ViewSample ViewSample
}, },
data() { data() {
...@@ -95,8 +89,6 @@ export default { ...@@ -95,8 +89,6 @@ export default {
componentName: 'StandardsManageEdit' componentName: 'StandardsManageEdit'
}, },
{ type: 'error', id: '', name: '删除' } { type: 'error', id: '', name: '删除' }
// { id: '', name: '导入', componentName: 'DownloadTemplateImport' },
// { id: '', name: '导出' }
], ],
// 表格 // 表格
pageColumns: [ pageColumns: [
...@@ -104,12 +96,6 @@ export default { ...@@ -104,12 +96,6 @@ export default {
{ title: '位置管理人', key: 'manager' }, { title: '位置管理人', key: 'manager' },
{ title: '收样存储位置', key: 'name' }, { title: '收样存储位置', key: 'name' },
{ title: '备注说明', key: 'remark' } { title: '备注说明', key: 'remark' }
// { title: '标准状态', key: 'status', width: 120 },
// { title: '标准分类', key: 'classify' },
// { title: '标准类型', key: 'type' },
// { title: '发布单位', key: 'publishUnit' },
// { title: '发布日期', key: 'publishDate', date: true, width: 140 },
// { title: '文件是否上传', key: 'fileUrl', width: 120 }
], ],
// 操作 // 操作
iconMsg: [ iconMsg: [
...@@ -129,25 +115,7 @@ export default { ...@@ -129,25 +115,7 @@ export default {
searchOpen: false, searchOpen: false,
getPage: {}, getPage: {},
// 选中的内容 // 选中的内容
selectIds: [], selectIds: []
statusList: [
{ value: 0, name: '现行' },
{ value: 1, name: '即将实施' },
{ value: 2, name: '部分被代替' },
{ value: 3, name: '被代替' },
{ value: 4, name: '作废' }
],
classifyList: [
{ value: 0, name: '判定标准' },
{ value: 1, name: '检测依据' },
{ value: 2, name: '其他' }
],
typeList: [
{ value: 0, name: '国家标准' },
{ value: 1, name: '地方标准' },
{ value: 2, name: '行业标准' },
{ value: 3, name: '企业标准' }
]
} }
}, },
computed: { computed: {
...@@ -201,40 +169,17 @@ export default { ...@@ -201,40 +169,17 @@ export default {
case '查看试样': case '查看试样':
this._viewSample(data.name) this._viewSample(data.name)
break break
case '上传':
this._upload(data.id)
break
case '下载':
this._download(data)
break
case '预览':
this._viewReport(data)
break
case '查看替代关系':
this.$refs.relationModal._open(data.id)
break
case '删除': case '删除':
this._deleteById(data.id) this._deleteById(data.id)
break break
} }
}) })
}, },
_upload(id) {
const obj = {
importUrl: '/soil/v1/standard_annex/upload/' + id
}
this.$refs.uploadModal._open(obj)
},
_viewSample(data) { _viewSample(data) {
console.log(data) this.$refs.viewSample._open(data)
this.$refs.viewSample._openHis(data)
}, },
_editModal: async function(edit, id) { _editModal: async function(edit, id) {
if (edit) { if (edit) {
// 编辑
// this.$store.dispatch('StandardInfo/getById', id).then(() => {
// this.$refs.refModal._open(this.$store.state.StandardInfo.model)
// })
const result = await soilSample.locationGetById(id) const result = await soilSample.locationGetById(id)
if (result) { if (result) {
this.$refs.editModal._open(result) this.$refs.editModal._open(result)
...@@ -246,13 +191,11 @@ export default { ...@@ -246,13 +191,11 @@ export default {
}, },
// 获取数据 // 获取数据
_page: async function() { _page: async function() {
// this.$refs.pageTable._page('search-form', 'StandardInfo/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.locationPage( const result = await soilSample.locationPage(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
console.log(result)
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
} }
...@@ -299,7 +242,6 @@ export default { ...@@ -299,7 +242,6 @@ export default {
switch (msg) { switch (msg) {
case 'page': case 'page':
this._page() this._page()
// this.getPage = this.$store.state.StandardInfo.page
break break
case 'selectIds': case 'selectIds':
this.selectIds = data this.selectIds = data
...@@ -311,66 +253,6 @@ export default { ...@@ -311,66 +253,6 @@ export default {
this._page() this._page()
break break
} }
},
// 导入
_import() {
const data = {
importUrl: '/food/v1/food_standard_info/import_standard',
downloadUrl: '/food/v1/excel/template/FoodStandardInfo',
title: '导入食品标准管理'
}
this.$refs.importModal._open(data)
},
// 导出
_export() {
const ids = this.selectIds
this._exportByIds(
ids,
ids.length === 0
? '确定导出全部记录?'
: '确定导出 ' + ids.length + ' 条记录?'
)
},
_exportByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
if (ids.length === 0) {
http.open('/food/v1/food_standard_info/export_standard')
} else {
http.open('/food/v1/food_standard_info/export_standard?ids=' + ids)
}
}
})
},
// 预览
_viewReport(data) {
const fileUrl = encodeURIComponent(
global.baseURL + '/soil/v1/standard_annex/preview/' + data.id
)
console.log(fileUrl)
window.open(
global.staticURL + '/pdf/PDFJS/pdfjs/web/viewer.html?file=' + fileUrl
)
},
// 下载
_download(data) {
console.log(data)
this.$Modal.confirm({
title: '提示',
content: '确定要下载文件?',
onOk: () => {
if (!data.fileUrl) {
this.$Message.error('附件未上传,请上传附件!')
return
}
window.open(
global.baseURL + '/soil/v1/standard_annex/download/' + data.id,
'_blank'
)
}
})
} }
} }
} }
......
<template>
<div>
<Modal v-model="showModal" width="1030" class="modal-footer-none">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form v-show="searchOpen" id="search-sample-company" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input v-model="formObj.sampleCode" placeholder="请输入试样编号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item label="现场编号:" class="search-item">
<Input v-model="formObj.siteNo" placeholder="请输入现场编号" clearable @on-enter="_formSearch" />
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_page">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" class="contHide" 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" select-data @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-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>
<span v-else>
{{ scope.row[item.key] }}
</span>
</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 { soilEntrust } from '../../../api'
import SoilSampleItemManage from './ViewSample'
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: '查看试样'
}
],
contractId: '', // 委托id
showModal: false,
searchOpen: true,
modalTitle: '管理样品',
selectIds: [],
selectData: {},
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 230 },
{ 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: 'testType', width: 120 }
],
formObj: {
receiveLocation: undefined,
entrustCode: undefined,
client: undefined
},
receiveLocation: ''
}
},
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)
},
_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._deleteSelected()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_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
}
})
},
_itemManage(data) {
this.$refs.sampleItemManage._open(data, this.receiveLocation)
},
_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':
this.allSelect(data)
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_open(name) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.receiveLocation = name
this.receiveLocation = name
this.showModal = true
this.$refs.pageTable._hideLoading()
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.pageLocationEntrust(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
} else {
// 添加
this.$refs.refModal._open('', this.contractId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETableHeight ref="pageTable" :rows="500" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange" select-data> :get-page="getPage" :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"
...@@ -37,10 +37,7 @@ ...@@ -37,10 +37,7 @@
:width="item.width?item.width:200" :width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable> :fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="item.detail"> <div v-if="item.status">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<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">
...@@ -62,10 +59,7 @@ ...@@ -62,10 +59,7 @@
</div> </div>
</template> </template>
<script> <script>
import http from '../../../api/http' import { soilSample } from '../../../api'
import { soilEntrust, soilSample } from '../../../api'
import { getLodop } from '../../../plugins/clodop/LodopFuncs'
let LODOP
export default { export default {
components: {}, components: {},
data() { data() {
...@@ -77,8 +71,14 @@ export default { ...@@ -77,8 +71,14 @@ export default {
type: 'success', type: 'success',
id: 'ZBC', id: 'ZBC',
name: '打印标签' name: '打印标签'
},
{
type: 'error',
id: '',
name: '批量删除'
} }
], ],
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
itemList: [], itemList: [],
indexList: [], indexList: [],
footerList: [ footerList: [
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
dateList: [], dateList: [],
formObj: { formObj: {
receiveLocation: undefined, receiveLocation: undefined,
sampleCode: undefined entrustId: undefined
} }
} }
}, },
...@@ -121,15 +121,6 @@ export default { ...@@ -121,15 +121,6 @@ export default {
} }
}, },
methods: { methods: {
_inputChange: async function(info) {
const result = await soilEntrust.sampleEdit({
id: info.id,
describeDetail: info.describeDetail
})
if (result) {
this._resultChange('修改成功')
}
},
_handleRow(data) { _handleRow(data) {
this.currentRow = data.row this.currentRow = data.row
this.currentIndex = data.rowIndex this.currentIndex = data.rowIndex
...@@ -152,160 +143,29 @@ export default { ...@@ -152,160 +143,29 @@ export default {
this.$refs.footerModal._hideLoading() this.$refs.footerModal._hideLoading()
console.log(this.getPage) 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) { _btnClick(msg, componentName) {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
switch (msg) { switch (msg) {
case '添加': 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._samplePre()
break
case '批量填写土质描述详情':
this._writeDetail(this.selectIds)
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected() this._deleteSelected()
break break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search': case 'search':
this.searchOpen = !this.searchOpen this.searchOpen = !this.searchOpen
break break
} }
}) })
}, },
_samplePre() {
if (this.selectIds.length === 0) {
this.$message.warning('至少选择一条数据')
} else {
this.$refs.preModal._open(this.selectIds.join(','))
}
},
_writeDetail(id) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const ids = id.join(',')
this.$refs.writeDetailModal._open(ids)
}
},
_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.entrustId)
},
_iconClick(res, data, componentName, index) { _iconClick(res, data, componentName, index) {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
switch (res) { switch (res) {
case '管理检测项目':
this._itemManage(data.id)
break
case '制备详情':
this._preEdit(data.id)
break
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除': case '删除':
console.log(index)
this._deleteById(data.id) this._deleteById(data.id)
break break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
} }
}) })
}, },
_preEdit(id) {
this.$refs.preHisModal._open(id)
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_tableResultChange(msg, data) { _tableResultChange(msg, data) {
const selectIds = [] const selectIds = []
switch (msg) { switch (msg) {
...@@ -317,7 +177,6 @@ export default { ...@@ -317,7 +177,6 @@ export default {
this.selectData = data this.selectData = data
break break
case 'allSelect': case 'allSelect':
console.log('123465798', data)
this.allSelect(data) this.allSelect(data)
break break
case 'iconClick': case 'iconClick':
...@@ -335,28 +194,20 @@ export default { ...@@ -335,28 +194,20 @@ export default {
} }
console.log('索引', this.indexList) console.log('索引', this.indexList)
}, },
_open(id) { _open(id, name) {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.dateList = [] this.dateList = []
this.showModal = true this.showModal = true
this.formObj.entrustId = id // 委托id this.formObj.entrustId = id // 委托id
console.log(this.entrustId) this.formObj.receiveLocation = name // 委托id
this.$refs.pageTable._hideLoading()
this._page()
},
_openHis(adress) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.formObj.receiveLocation = adress // 委托id
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.recordHis = true
this._page() this._page()
}, },
_formSearch() { _formSearch() {
this.$refs.pageTable._pageChange(1) this.$refs.pageTable._pageChange(1)
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.pageLocationSample(this.formObj) const result = await soilSample.pageLocationSample(this.formObj)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
...@@ -368,21 +219,10 @@ export default { ...@@ -368,21 +219,10 @@ export default {
title: '提示', title: '提示',
content: content || '确定删除该记录?', content: content || '确定删除该记录?',
onOk: () => { onOk: () => {
// this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
// this._resultChange('删除成功!')
// })
this._deleteOk(ids) this._deleteOk(ids)
} }
}) })
}, },
// _deleteOk: async function(ids) {
// const result = await drugSample.deleteById(ids)
// if (result) {
// this._resultChange('删除成功')
// }
// },
_deleteById(id) { _deleteById(id) {
// 删除一条记录 // 删除一条记录
this._deleteByIds([id]) this._deleteByIds([id])
...@@ -396,155 +236,21 @@ export default { ...@@ -396,155 +236,21 @@ export default {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?') this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
} }
}, },
_detailModal(data) {}, _deleteOk: async function(ids) {
_editModal(edit, data) { const result = await soilSample.removeSampleFromLocation(ids.join(','))
if (edit) { if (result) {
console.log(data) this.$Message.success('成功移除')
this.$refs.sampleManageEdit._open(data) this._page()
} else {
// 添加
this.$refs.refModal._open('', this.entrustId)
} }
// const result = await drugCatalogueItem.deleteById(id)
}, },
// 添加编辑模拟样品 // 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.entrustId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.entrustId)
}
},
_search() { _search() {
this._page() this._page()
}, },
_resultChange(msg) { _resultChange(msg) {
this.$Message.success(msg) this.$Message.success(msg)
this._page() this._page()
},
_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)
}
})
},
// 导入检测项目
_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)
} }
} }
} }
......
...@@ -29,13 +29,7 @@ export default { ...@@ -29,13 +29,7 @@ export default {
data() { data() {
return { return {
formId: '', formId: '',
lengthLimitList: [ modalTitle: '土质描述详情填写',
{ key: 'stdNum', title: '标准号' },
{ key: 'enName', title: '英文名称' },
{ key: 'belongUnit', title: '归口单位' },
{ key: 'publishUnit', title: '发布单位' }
],
modalTitle: '收样位置选择',
formObj: { formObj: {
detail: '' detail: ''
}, },
...@@ -43,24 +37,6 @@ export default { ...@@ -43,24 +37,6 @@ export default {
showEditModal: false, showEditModal: false,
ids: '', ids: '',
options: [], options: [],
classifyList: [
{ value: 0, name: '判定依据' },
{ value: 1, name: '检测依据' },
{ value: 2, name: '其他' }
],
typeList: [
{ value: 0, name: '国家标准' },
{ value: 1, name: '地方标准' },
{ value: 2, name: '行业标准' },
{ value: 3, name: '企业标准' }
],
statusList: [
{ value: 0, name: '现行' },
{ value: 1, name: '即将实施' },
{ value: 2, name: '部分被代替' },
{ value: 3, name: '被代替' },
{ value: 4, name: '作废' }
],
footerList: [ footerList: [
{ id: '', name: '取消', type: '' }, { id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' } { id: '', name: '保存', type: 'primary' }
......
...@@ -61,6 +61,7 @@ import SoilSampleManage from '../SoilSampleManage' ...@@ -61,6 +61,7 @@ import SoilSampleManage from '../SoilSampleManage'
import global from '../../../api/config' import global from '../../../api/config'
import SamplePreparationEdit from './SamplePreparationEdit' import SamplePreparationEdit from './SamplePreparationEdit'
import SoilSampleItemManageEdit from './SoilSampleItemManageEdit' import SoilSampleItemManageEdit from './SoilSampleItemManageEdit'
import SoilEntrustItemNum from './SoilItemNum'
export default { export default {
components: { components: {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
...@@ -70,7 +71,9 @@ export default { ...@@ -70,7 +71,9 @@ export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
SoilSampleManage, SoilSampleManage,
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
SoilSampleItemManageEdit SoilSampleItemManageEdit,
// eslint-disable-next-line vue/no-unused-components
SoilEntrustItemNum
}, },
data() { data() {
return { return {
...@@ -111,6 +114,11 @@ export default { ...@@ -111,6 +114,11 @@ export default {
name: '试验项目列表' name: '试验项目列表'
}, },
{ {
type: 'ios-calculator-outline',
id: '',
name: '项目量统计'
},
{
type: 'ios-download', type: 'ios-download',
id: '', id: '',
name: '导出开土制备记录' name: '导出开土制备记录'
...@@ -203,6 +211,9 @@ export default { ...@@ -203,6 +211,9 @@ export default {
case '试验项目列表': case '试验项目列表':
this._itemManage(data.id) this._itemManage(data.id)
break break
case '项目量统计':
this._itemNumManage(data.id)
break
case '导出开土制备记录': case '导出开土制备记录':
this._exportPrepare(data.id) this._exportPrepare(data.id)
break break
...@@ -210,7 +221,7 @@ export default { ...@@ -210,7 +221,7 @@ export default {
this._sampleManage(data.id) this._sampleManage(data.id)
break break
case '试样照片': case '试样照片':
this._uploadPhoto(data.id) this._uploadPhoto(data)
break break
case '附件': case '附件':
this._upload(data.id) this._upload(data.id)
...@@ -369,12 +380,17 @@ export default { ...@@ -369,12 +380,17 @@ export default {
}) })
// this.$refs.itemManageModal._openByEntrustId(data) // this.$refs.itemManageModal._openByEntrustId(data)
}, },
_itemNumManage(data) {
_uploadPhoto(id) { this.currentComponent = 'SoilEntrustItemNum'
this.$nextTick(() => {
this.$refs.refModal._open(data)
})
},
_uploadPhoto(data) {
// 上传照片文件 // 上传照片文件
this.currentComponent = 'PhotoManage' this.currentComponent = 'PhotoManage'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId') this.$refs.refModal._open(data.id, 'entrustId')
}) })
// this.$refs.PhotoManage._open(id, 'entrustId') // this.$refs.PhotoManage._open(id, 'entrustId')
}, },
......
...@@ -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 id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false"> <Form v-show="searchOpen" id="formId" :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.client" @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/> <Input v-model="formObj.client" name="client" placeholder="请输入委托单位" clearable @on-enter="_formSearch"/>
</Form-item> </Form-item>
<Form-item class="search-item" label="委托编号:"> <Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" placeholder="请输入委托单号" clearable/> <Input v-model="formObj.entrustCode" name="entrustCode" placeholder="请输入委托单号" clearable @on-enter="_formSearch"/>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button type="primary" @click="_formSearch">搜索</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" <btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
class="contHide"></btn-list> @on-result-change="_btnClick"></btn-list>
</Col> </Col>
<!--表格--> <!--表格-->
<Col span="24"> <Col span="24">
...@@ -49,13 +49,9 @@ ...@@ -49,13 +49,9 @@
</Row> </Row>
</div> </div>
</div> </div>
<!-- <MeterEntrustRecord ref="entrustRecordModal" @on-result-change="_page"></MeterEntrustRecord>-->
<!-- <SoilSampleManageHis ref="sampleManageModal" @on-result-change="_page"></SoilSampleManageHis>-->
<!-- <PhotoManage ref="photoManage"></PhotoManage>-->
<!-- <FileManage ref="fileManage"></FileManage>-->
<keep-alive> <keep-alive>
<!-- eslint-disable-next-line vue/require-component-is --> <!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_componentResult"></component> <component :is="currentComponent" ref="refModal" @on-result-change="_componentResult"></component>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
...@@ -64,9 +60,10 @@ import { soilAptitude, soilEntrust } from '../../../api' ...@@ -64,9 +60,10 @@ import { soilAptitude, soilEntrust } from '../../../api'
import MeterEntrustRecord from '../../../components/operation/Operation' import MeterEntrustRecord from '../../../components/operation/Operation'
import SoilSampleManageHis from '../SoilSampleManageHis' import SoilSampleManageHis from '../SoilSampleManageHis'
import global from '../../../api/config' import global from '../../../api/config'
import SoilEntrustItemNum from './SoilItemNum'
export default { export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
components: { SoilSampleManageHis, MeterEntrustRecord }, components: { SoilSampleManageHis, MeterEntrustRecord, SoilEntrustItemNum },
data() { data() {
return { return {
currentComponent: '', currentComponent: '',
...@@ -85,6 +82,7 @@ export default { ...@@ -85,6 +82,7 @@ export default {
id: '', id: '',
name: '试样列表' name: '试样列表'
}, },
{ {
type: 'ios-camera-outline', type: 'ios-camera-outline',
id: '', id: '',
...@@ -96,6 +94,11 @@ export default { ...@@ -96,6 +94,11 @@ export default {
name: '导出开土制备记录' name: '导出开土制备记录'
}, },
{ {
type: 'ios-calculator-outline',
id: '',
name: '项目量统计'
},
{
type: 'md-cloud', type: 'md-cloud',
id: '', id: '',
name: '附件' name: '附件'
...@@ -172,6 +175,9 @@ export default { ...@@ -172,6 +175,9 @@ export default {
case '附件': case '附件':
this._upload(data.id) this._upload(data.id)
break break
case '项目量统计':
this._itemNumManage(data.id)
break
case '试样照片': case '试样照片':
this._upLoadPhoto(data.id) this._upLoadPhoto(data.id)
break break
...@@ -190,6 +196,12 @@ export default { ...@@ -190,6 +196,12 @@ export default {
} }
}) })
}, },
_itemNumManage(data) {
this.currentComponent = 'SoilEntrustItemNum'
this.$nextTick(() => {
this.$refs.refModal._open(data)
})
},
_exportPrepare(id) { _exportPrepare(id) {
this.$Modal.confirm({ this.$Modal.confirm({
title: '提示', title: '提示',
......
...@@ -47,7 +47,6 @@ export default { ...@@ -47,7 +47,6 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.refModal._page() this.$refs.refModal._page()
}) })
// this.$refs.waitTabs._page()
} }
} }
} }
......
<template>
<div>
<Modal v-model="showModal" width="800">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" class="contHide" 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" hide-page="true" is-edit select-data @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"
:edit-render="item.editCell?{autofocus: 'input'}:null"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
{{ scope.row[item.key] }}
</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 { soilEntrust } from '../../../api'
export default {
components: {},
data() {
return {
formId: 'SampleItemManage',
currentComponent: '',
btn: [],
entrustId: '',
showModal: false,
modalTitle: '试验项目统计量',
selectIds: [],
itemId: '',
showOption: true,
searchOpen: true,
selectData: {},
getPage: { records: [] },
currentRow: '',
currentIndex: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '关闭', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name' },
{ title: '试验总数', key: 'num' }
],
formObj: {
entrustId: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_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
},
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
methodChange(data) {
const editData = {}
editData.testMethod = data.testMethod
this._editItem(data.id, editData)
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '批量填写试验项目信息':
this._writeInfo()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_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 'page':
this._pageByEntrustId()
break
case 'changeSize':
this._pageByEntrustId()
break
}
},
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.entrustId = id
this.showModal = true
this.$refs.pageTable._hideLoading()
this._pageByEntrustId()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_pageByEntrustId: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.listEntrustItemNum(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage.records = result
}
},
_detailModal(data) {},
_search() {
this._pageByEntrustId()
},
_resultChange(msg) {
this._pageByEntrustId()
this.$Message.success(msg)
this.$emit('on-result-change')
}
}
}
</script>
...@@ -18,6 +18,7 @@ import VXESettingCol from '../components/base/VXESettingCol' ...@@ -18,6 +18,7 @@ import VXESettingCol from '../components/base/VXESettingCol'
import ElTableNoPage from '../components/table/ElTableNoPage' import ElTableNoPage from '../components/table/ElTableNoPage'
import PhotoManage from '../components/file/photo-manage/PhotoManage' import PhotoManage from '../components/file/photo-manage/PhotoManage'
import elementTableHeight from '../components/table/elementTableHeight' import elementTableHeight from '../components/table/elementTableHeight'
import BatchPhotoManage from '../components/import/BatchUploadFile'
Vue.use(VXETable) Vue.use(VXETable)
Vue.component('btn-list', btnList) Vue.component('btn-list', btnList)
...@@ -33,4 +34,5 @@ Vue.component('VXEIconList', VXEIconList) ...@@ -33,4 +34,5 @@ Vue.component('VXEIconList', VXEIconList)
Vue.component('VXESettingCol', VXESettingCol) Vue.component('VXESettingCol', VXESettingCol)
Vue.component('FileManage', FileManage) Vue.component('FileManage', FileManage)
Vue.component('PhotoManage', PhotoManage) Vue.component('PhotoManage', PhotoManage)
Vue.component('BatchPhotoManage', BatchPhotoManage)
Vue.component('ElTableNoPage', ElTableNoPage) Vue.component('ElTableNoPage', ElTableNoPage)
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