Commit f492fbe5 by lichengming

修改了试验项目

parent 1a1b613a
......@@ -3,7 +3,7 @@
*/
import http from '../http'
import { https } from '../https'
// import { https } from '../https'
export default {
// page
......@@ -17,8 +17,6 @@ export default {
http.delete('meter/v1/sample/?ids=' + data).then(res => res),
// 保存
save: data =>
https
.post('meter/v1/sample/add_send_entrust', JSON.stringify(data))
.then(res => res),
http.post('meter/v1/sample/add_send_entrust', data).then(res => res),
addSample: data => http.post('meter/v1/sample/', data).then(res => res)
}
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top:10px">
<Form v-show="searchOpen" :d="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="试验名称:" style="margin-left: 1px">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入试验名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:form-id="formId"
:table-height="tableHeight"
:get-page="getPage"
:icon-msg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<span v-if="item.dateTime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</span>
<span v-else-if="item.image">
{{scope.row.picUri!==undefined?'是':'否'}}
</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!-- 导入-->
<!-- 添加、编辑 -->
<importModal ref="importModal" @on-result-change="_page"></importModal>
<imageTemplateImport ref="imageTemplateImport" @on-result-change="_page"></imageTemplateImport>
<ItemManageEdit ref="editModal" @on-result-change="_page"></ItemManageEdit>
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
// eslint-disable-next-line no-unused-vars
import { soilAptitude } from '../../../api'
import importModal from '../../../components/import/DownloadTemplateImport'
import imageTemplateImport from '../../../components/import/ImageTemplateImport'
import ItemManageEdit from './ItemManageEdit'
import IndexManage from './IndexManage'
export default {
name: 'MeterAptitudeManage',
components: {
imageTemplateImport,
importModal,
ItemManageEdit,
IndexManage
},
data() {
return {
formId: 'meterAptitudeManageFormId',
pageColumns: [
{ title: '试验名称', key: 'name' },
{ title: '英文名称', key: 'elName', width: 160 },
{ title: '试验项目英文简写', key: 'shortName' },
{ title: '大类', key: 'mainType' },
// {title: '限制范围或说明', key: 'limitDescription'},
{ title: '小类', key: 'smallType' },
{ title: '试验方法', key: 'testMethod' }
],
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' },
{ type: '', id: '', name: '导入' }
],
iconMsg: [
{ type: 'md-apps', id: '', name: '指标管理' },
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'md-add', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' }
// { type: 'md-add', id: '', name: '操作日志' }
],
formObj: {
basis: undefined,
name: undefined,
code: undefined
},
searchOpen: true,
selectIds: [],
getPage: {},
typeData: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg) {
switch (msg) {
case '添加':
this._editModal(false)
break
case '删除':
this._deleteSelected()
break
case '导入':
this._import()
break
case '导出':
this._export()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '删除':
this._deleteById(data.id)
break
case '指标管理':
this.$refs.indexModal._open(data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._record(data.id)
break
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'subcontractorId')
},
_lookPic(data) {
if (data.picUri) {
window.open(data.picUri)
} else {
this.$Message.warning('暂无图片!')
}
},
_uploadPic(id) {
const action = '/meter/v1/aptitude/upload_?aptitudeId=' + id
const data = {
importUrl: action,
downloadUrl: '',
title: '上传'
}
this.$refs.imageTemplateImport._open(data, '上传图片')
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilAptitude.page(this.formObj)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
_delete: async function(ids) {
const result = await soilAptitude.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
},
_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, id) {
if (edit) {
this._getById(id)
// 编辑
// this.$store.dispatch('FoodJudgeBasis/getById', id).then(() => {
// this.$refs.editModal._open(this.$store.state.FoodJudgeBasis.model)
// })
} else {
// 添加
this.$refs.editModal._open()
}
},
_getById: async function(id) {
const result = await soilAptitude.getById(id)
console.log('编辑结果')
console.log(result)
if (result) {
this.$refs.editModal._open(result)
}
},
// 导入
_import() {
const data = {
importUrl: '/meter/v1/aptitude/import_aptitude',
downloadUrl: '/meter/v1/excel/template/MeterAptitudeImport',
title: '授权资质导入'
}
this.$refs.importModal._open(data, '授权资质导入')
},
// 导出
_export() {
console.log('.this.selectIds', this.selectIds)
if (this.selectIds.length === 0) {
this.$Message.warning('请选择需要导出的数据')
} else {
const content = '确定导出 ' + this.selectIds.length + ' 条记录?'
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
// eslint-disable-next-line no-undef
http.open(
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_export?ids=' +
this.selectIds
)
}
})
}
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<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>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns" :key="item.key">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
aptitudeItemId: '',
typeName: '',
testParameter: '',
judgeBasis: '',
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.formObj.aptitudeItemId = data.id
this.modalTitle = data.testBasis + ' ' + data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.formObj)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
console.log('编辑')
} else {
this.$refs.indexEdit._open()
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
this.$msgTip('warning')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this.$store
.dispatch('FoodAptitudeLimit/deleteByIds', this.selectIds)
.then(() => {
if (this.$store.state.FoodAptitudeLimit.success) {
this.$Message.success('删除成功!')
this._page()
}
})
}
})
}
}
}
}
</script>
......@@ -4,6 +4,7 @@
// 工作台
import workbench from '../pages/workbench/workbench'
import StandardManage from '../pages/meter-aptitude/standard-manage/StandardManage'
import ExperimentItemManage from '../pages/meter-aptitude/item-manage/ExperimentItemManage'
import Blank from '~/pages/blank'
export default [
{
......@@ -64,7 +65,7 @@ export default [
},
{
path: 'experiment',
component: workbench,
component: ExperimentItemManage,
meta: { title: '试验项目' }
}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment