Commit 24e1f700 by lichengming

修改了检测依据管理页面

parent c22b6040
......@@ -6,6 +6,17 @@ import http from '../http'
// import { https } from '../https'
export default {
// 检测依据管理
standardPage: data =>
http.post('soil/v1/standard/page', data).then(res => res),
standardGetById: data =>
http.get('soil/v1/standard/' + data).then(res => res),
standardSave: data => http.post('soil/v1/standard/', data).then(res => res),
standardEdit: data =>
http.put('soil/v1/standard/' + data.id, data.obj).then(res => res),
standardDeleteById: data =>
http.delete('soil/v1/standard/?ids=' + data).then(res => res),
// 试验项目
// page
page: data => http.post('soil/v1/aptitude_exp/page', data).then(res => res),
getById: data => http.get('soil/v1/aptitude_exp/' + data).then(res => res),
......
......@@ -188,7 +188,6 @@ export default {
_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)
......
......@@ -6,13 +6,13 @@
<Row>
<Col span="24" class="margin-top-10">
<!--搜索表单-->
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<Form id="search-form" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="依据编号:">
<Input @on-enter="_formSearch" name="stdNum" placeholder="请输入标准号" clearable/>
<Form-item class="search-item" label="检测依据:">
<Input @on-enter="_formSearch" v-model="formObj.code" name="code" placeholder="请输入检测依据" clearable/>
</Form-item>
<Form-item class="search-item" label="依据名称:">
<Input @on-enter="_formSearch" name="name" placeholder="请输入标准名称" clearable/>
<Form-item class="search-item" label="检测依据名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入检测依据名称" clearable/>
</Form-item>
<!-- <Form-item class="search-item" label="标准状态:">-->
<!-- <Select name="status" placeholder="请选择标准状态" clearable>-->
......@@ -68,7 +68,6 @@
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='fileUrl'">
<span v-if="scope.row['fileUrl']" class="green-color"></span>
<span v-else class="red-color"></span>
......@@ -109,7 +108,10 @@ export default {
data() {
return {
currentComponent: '',
formObj: {},
formObj: {
code: undefined,
name: undefined
},
btn: [
{
type: 'success',
......@@ -117,44 +119,44 @@ export default {
name: '添加',
componentName: 'StandardsManageEdit'
},
{ type: 'error', id: '', name: '删除' },
{ id: '', name: '导入', componentName: 'DownloadTemplateImport' },
{ id: '', name: '导出' }
{ type: 'error', id: '', name: '删除' }
// { id: '', name: '导入', componentName: 'DownloadTemplateImport' },
// { id: '', name: '导出' }
],
// 表格
pageColumns: [
{ title: '依据编号', key: 'stdNum' },
{ title: '依据名称', key: 'name' },
{ 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 }
{ title: '检测依据', key: 'code' },
{ title: '检测依据名称', key: 'name' }
// { 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: [
{
type: 'stats-bars',
type: 'ios-photos',
id: '',
name: '查看替代关系',
componentName: 'SubstitutionalRelation'
},
{
type: 'compose',
type: 'md-create',
id: '',
name: '编辑',
componentName: 'StandardsManageEdit'
},
{
type: 'ios-upload',
type: 'md-add',
id: '',
name: '上传',
componentName: 'UploadModal'
},
{ type: 'ios-download', id: '', name: '下载' },
{ type: 'android-image', id: '', name: '预览' },
{ type: 'trash-a', id: '', name: '删除' }
{ type: 'ios-book', id: '', name: '预览' },
{ type: 'md-remove-circle', id: '', name: '删除' }
],
searchOpen: false,
getPage: {},
......@@ -259,7 +261,7 @@ export default {
// this.$store.dispatch('StandardInfo/getById', id).then(() => {
// this.$refs.refModal._open(this.$store.state.StandardInfo.model)
// })
const result = await soilAptitude.getById(id)
const result = await soilAptitude.standardGetById(id)
if (result) {
this.$refs.editModal._open(result)
}
......@@ -271,9 +273,8 @@ export default {
// 获取数据
_page: async function() {
// this.$refs.pageTable._page('search-form', 'StandardInfo/page')
console.log('page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.formObj)
const result = await soilAptitude.standardPage(this.formObj)
if (result) {
console.log(result)
this.$refs.pageTable._hideLoading()
......@@ -305,27 +306,16 @@ export default {
loading: true,
content: content || '确定删除该记录?',
onOk: () => {
console.log('删除')
this._delOk(ids)
// this.$store
// .dispatch('StandardInfo/deleteByIdsMore', { ids: ids.join(',') })
// .then(() => {
// if (this.$store.state.StandardInfo.success) {
// this._page()
// this.$Message.success('删除成功!')
// this.$Modal.remove()
// } else {
// this.$Modal.remove()
// }
// })
}
})
},
_delOk: async function(ids) {
const result = await soilAptitude.deleteById(ids)
const result = await soilAptitude.standardDeleteById(ids)
if (result) {
this.$message.success('删除成功')
this._page()
this.$Modal.remove()
this.$Message.success('删除成功')
}
},
// 表格内容
......
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false" :width="800" class="zIndex-1200">
<Modal v-model="showEditModal" :mask-closable="false" :width="500" class="zIndex-1200">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" id="edit-form" :model="formObj" :rules="ruleValidate" :label-width="80" inline>
<Form-item label="标准号" prop="stdNum" class="width-48">
<Input v-model="formObj.stdNum" name="stdNum" placeholder="请输入标准号不超过255个字符"/>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form-item label="检测依据" prop="code" style="width: 100%">
<Input v-model="formObj.code" name="code" placeholder="请输入检测依据"/>
</Form-item>
<Form-item label="标准名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入标准名称"/>
</Form-item>
<Form-item label="英文名称" prop="enName" class="width-48">
<Input v-model="formObj.enName" name="enName" placeholder="请输入英文名"/>
</Form-item>
<Form-item label="标准状态" prop="status" class="width-48">
<Select v-model="formObj.status" name='status'>
<Option v-for="item in statusList" :value="item.value" :key="item.value">{{ item.name }}</Option>
</Select>
</Form-item>
<Form-item label="标准类型" prop="type" class="width-48">
<Select v-model="formObj.type" name="type">
<Option v-for="item in typeList" :value="item.value" :key="item.value">{{ item.name }}</Option>
</Select>
</Form-item>
<Form-item label="发布日期" prop="publishDate" class="width-48">
<Date-picker v-model="formObj.publishDate" type="date" name="publishDate" placeholder="发布日期"
format="yyyy-MM-dd" style="width: 100%;"></Date-picker>
</Form-item>
<Form-item label="实施日期" prop="effectDate" class="width-48">
<Date-picker v-model="formObj.effectDate" type="date" name="effectDate" placeholder="实施日期"
format="yyyy-MM-dd" style="width: 100%;"></Date-picker>
</Form-item>
<Form-item label="归口单位" prop="belongUnit" class="width-48">
<Input v-model="formObj.belongUnit" name="belongUnit" placeholder="请输入归口单位"/>
</Form-item>
<Form-item label="发布单位" prop="publishUnit" class="width-48">
<Input v-model="formObj.publishUnit" name="publishUnit" placeholder="请输入发布单位"/>
</Form-item>
<Form-item label="标准介绍" prop="remark" style="width:98%">
<Input :rows="3" :maxlength="255" v-model="formObj.remark" placeholder="请输入标准介绍,不能超过256个字..."
type="textarea" name="remark"/>
<Form-item label="检测依据名称" prop="name" style="width: 100%">
<Input v-model="formObj.name" name="name" placeholder="请输入检测依据名称"/>
</Form-item>
<!-- <Form-item label="英文名称" prop="enName" class="width-48">-->
<!-- <Input v-model="formObj.enName" name="enName" placeholder="请输入英文名"/>-->
<!-- </Form-item>-->
<!-- <Form-item label="标准状态" prop="status" class="width-48">-->
<!-- <Select v-model="formObj.status" name='status'>-->
<!-- <Option v-for="item in statusList" :value="item.value" :key="item.value">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </Form-item>-->
<!-- <Form-item label="标准类型" prop="type" class="width-48">-->
<!-- <Select v-model="formObj.type" name="type">-->
<!-- <Option v-for="item in typeList" :value="item.value" :key="item.value">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </Form-item>-->
<!-- <Form-item label="发布日期" prop="publishDate" class="width-48">-->
<!-- <Date-picker v-model="formObj.publishDate" type="date" name="publishDate" placeholder="发布日期"-->
<!-- format="yyyy-MM-dd" style="width: 100%;"></Date-picker>-->
<!-- </Form-item>-->
<!-- <Form-item label="实施日期" prop="effectDate" class="width-48">-->
<!-- <Date-picker v-model="formObj.effectDate" type="date" name="effectDate" placeholder="实施日期"-->
<!-- format="yyyy-MM-dd" style="width: 100%;"></Date-picker>-->
<!-- </Form-item>-->
<!-- <Form-item label="归口单位" prop="belongUnit" class="width-48">-->
<!-- <Input v-model="formObj.belongUnit" name="belongUnit" placeholder="请输入归口单位"/>-->
<!-- </Form-item>-->
<!-- <Form-item label="发布单位" prop="publishUnit" class="width-48">-->
<!-- <Input v-model="formObj.publishUnit" name="publishUnit" placeholder="请输入发布单位"/>-->
<!-- </Form-item>-->
<!-- <Form-item label="标准介绍" prop="remark" style="width:98%">-->
<!-- <Input :rows="3" :maxlength="255" v-model="formObj.remark" placeholder="请输入标准介绍,不能超过256个字..."-->
<!-- type="textarea" name="remark"/>-->
<!-- </Form-item>-->
</Form>
</div>
<div slot="footer">
......@@ -70,28 +70,8 @@ export default {
{ key: 'publishUnit', title: '发布单位' }
],
modalTitle: '添加食品标准表',
formObj: {
belongUnit: '',
ccsNum: '',
effectDate: '',
enName: '',
classify: 0,
fileType: '',
icsClass: '',
name: '',
publishDate: '',
publishUnit: '',
status: 0,
stdNum: '',
type: 0,
remark: ''
},
ruleValidate: {
stdNum: [
{ required: true, message: '标准号不能为空', trigger: 'blur' }
],
name: [{ required: true, message: '标准名称不能为空', trigger: 'blur' }]
},
formObj: {},
ruleValidate: {},
showEditModal: false,
classifyList: [
{ value: 0, name: '判定依据' },
......@@ -133,11 +113,9 @@ export default {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
if (this.$store.state.StandardInfo.success) {
this.showEditModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
}
this._hideLoading()
},
_ok() {
......@@ -151,25 +129,12 @@ export default {
}
}
const data = this.$serialize('edit-form')
console.log(data)
// if (this.$lengthLimitVal(this.lengthLimitList, data) === false) {
// this._hideLoading()
// return
// }
if (this.$string(this.formObj.id).isEmpty()) {
// 添加
// this._save(data)
// this.$store.dispatch('StandardInfo/add', data).then(() => {
// this._resultChange('添加成功!')
// })
this._save(data)
} else {
// 编辑
// this._edit(data)
// this.$store
// .dispatch('StandardInfo/edit', { id: this.formObj.id, obj: data })
// .then(() => {
// this._resultChange('编辑成功')
// })
this._edit({ id: this.formObj.id, obj: data })
}
} else {
this.$Message.error('表单验证失败!')
......@@ -178,14 +143,13 @@ export default {
})
},
_save: async function(data) {
const result = await soilAptitude.save(data)
console.log(result)
const result = await soilAptitude.standardSave(data)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilAptitude.edit(data)
const result = await soilAptitude.standardEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
......@@ -196,7 +160,6 @@ export default {
},
_open(formObj) {
this.formId = this.$randomCode()
console.log(this.formId)
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
......@@ -204,6 +167,7 @@ export default {
this.formObj.id = ''
} else {
this.formObj = formObj
this.formObj.id = formObj.id
this.formObj.effectDate = this.formObj.effectDate
? new Date(formObj.effectDate)
: ''
......
......@@ -29,7 +29,7 @@
</label>
</div>
<div slot="footer" class="btn-width">
<Button @click="_cancel" :loading="isLoad" type="ghost">取消</Button>
<Button @click="_cancel" :loading="isLoad">取消</Button>
</div>
</Modal>
</div>
......
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