Commit 2fb6c7b0 authored by wdy's avatar wdy

样品库样品种类

parent eeed2ff2
import request from '@/utils/request'
// 查询列表
export function queryList(params) {
return request({
url: '/wbchemistrymapping/queryWbChemistryMappingByPagination',
method: 'get',
params
})
}
// 添加基础信息接口
export function add(data) {
return request({
url: '/wbchemistrymapping/add',
method: 'post',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
// 根据id查询基础信息接口
export function getDetailById(id) {
return request({
url: '/wbchemistrymapping/detail/' + id,
method: 'get'
})
}
// 编辑基础信息接口
export function updataInfo(data) {
return request({
url: '/wbchemistrymapping/update',
method: 'put',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
// 逻辑删除基础信息接口
export function deleteLogical(id) {
return request({
url: '/wbchemistrymapping/deleteLogical/' + id,
method: 'delete'
})
}
......@@ -15,7 +15,7 @@
</el-form-item>
<el-form-item label="name" prop="name">
<el-input
v-model="queryParams.name"
v-model="queryParams.dname"
placeholder="请输入名称"
clearable
size="small"
......@@ -25,7 +25,7 @@
</el-form-item>
<el-form-item>
<el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
<el-button type="primary" style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
<el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item>
<div style="float: right">
<el-form-item>
......@@ -57,29 +57,19 @@
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="qty" prop="qty" :show-overflow-tooltip="true">
<el-table-column label="dname" prop="dname" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.qty || '-' }}
{{ scope.row.dname || '-' }}
</template>
</el-table-column>
<el-table-column label="name" prop="name" :show-overflow-tooltip="true">
<el-table-column label="dno" prop="dno" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.name || '-' }}
{{ scope.row.dno || '-' }}
</template>
</el-table-column>
<el-table-column label="max_qty" prop="max_qty" :show-overflow-tooltip="true">
<el-table-column label="remarks" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.max_qty || '-' }}
</template>
</el-table-column>
<el-table-column label="min_qty" prop="min_qty" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.min_qty || '-' }}
</template>
</el-table-column>
<el-table-column label="unit" prop="unit" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.unit || '-' }}
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column label="操作人" prop="createName" :show-overflow-tooltip="true">
......@@ -87,9 +77,9 @@
{{ scope.row.createName || '-' }}
</template>
</el-table-column>
<el-table-column label="操作时间" prop="create_date" :show-overflow-tooltip="true">
<el-table-column label="操作时间" prop="createDate" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.create_date || '-' }}
{{ scope.row.createDate || '-' }}
</template>
</el-table-column>
<el-table-column label="操作">
......@@ -122,28 +112,56 @@
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- 新增修改弹出 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false" @close="cancel">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="pn" prop="pn">
<el-input v-model.trim="form.pn" :maxlength="30" placeholder="请输入pn" />
</el-form-item>
<el-form-item label="dname" prop="dname">
<el-input v-model.trim="form.dname" :maxlength="30" placeholder="请输入dname" />
</el-form-item>
<el-form-item label="dno" prop="dno">
<el-input v-model.trim="form.dno" :maxlength="30" placeholder="请输入dno" />
</el-form-item>
<el-form-item label="remarks" prop="remarks">
<el-input v-model.trim="form.remarks" :maxlength="30" placeholder="请输入remarks" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {queryList} from '@/api/sample/basicInformation'
import { add, deleteLogical, getDetailById, queryList, updataInfo } from '@/api/sample/sampleType'
import { parseTime } from '@/utils'
export default {
name: 'Index',
data() {
return {
title: '',
open: false,
form: {},
rules: {
pn: [{ required: true, message: '请输入pn', trigger: 'blur' }],
dname: [{ required: true, message: '请输入name', trigger: 'blur' }]
},
total: 0,
loading: false,
queryParams: {
page: 1,
rows: 10,
pn: '',
name: ''
dname: ''
},
statusOptions: {},
basicinfoMationList: []
......@@ -153,17 +171,67 @@ export default {
this.getList()
},
methods: {
handleDelete() {
// 删除
handleDelete(row) {
const id = row.businessId
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
deleteLogical(id).then(res => {
if (res.code === 200) {
this.$message.success('操作成功')
this.getList()
}
})
})
},
handleUpdate() {
// 修改
handleUpdate(row) {
const id = row.businessId
getDetailById(id).then(res => {
this.form = res.data
this.open = true
this.title = '修改样品种类表单'
})
},
// 提交
submitForm() {
this.$refs.form.validate((valid) => {
if (valid) {
// 校验通过,提交表单或进行其他操作
if (this.form.businessId !== undefined) {
updataInfo(this.form).then(res => {
if (res.code === 200) {
this.open = false
this.$message.success('操作成功')
this.getList()
this.reFrom()
} else if (res.code === null) {
this.$message.error(res.message)
}
})
} else {
add(this.form).then(res => {
if (res.code === 200) {
this.open = false
this.$message.success('操作成功')
this.getList()
this.reFrom()
} else if (res.code === null) {
this.$message.error(res.message)
}
})
}
}
})
},
// 初始化获取数据
getList() {
this.loading = true
queryList(this.queryParams).then(res => {
console.log('res', res)
res.rows.createDate = parseTime(res.rows.createDate, '{y}-{m}-{d}')
this.total = res.total
this.basicinfoMationList = res.rows
this.loading = false
......@@ -180,15 +248,31 @@ export default {
page: 1,
rows: 10,
pn: '',
name: ''
dname: ''
}
this.getList()
},
handleAdd() {
this.open = true
this.title = '添加样品种类表单'
},
handleExport() {
},
cancel() {
this.open = false
this.reFrom()
},
// 清空表单
reFrom() {
this.form = {
businessId: undefined,
pn: '',
dname: '',
dno: '',
remarks: ''
}
this.$refs.form.clearValidate()
}
}
}
......
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