fix:检验项和检验表静态页面

This commit is contained in:
shijing 2024-12-12 15:47:46 +08:00
parent 24252a4995
commit fd79baf73a
2 changed files with 385 additions and 0 deletions

195
src/views/qm/checkForm.vue Normal file
View File

@ -0,0 +1,195 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="tableAdd" v-auth="'role.create'"></el-button>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="query.search" placeholder="检验表名称" clearable @keyup.enter="handleQuery"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" hidePagination>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="名称" prop="name" min-width="100"></el-table-column>
<el-table-column label="标识" prop="code" min-width="100"></el-table-column>
<el-table-column label="描述" prop="description" min-width="150"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope">
<el-button link size="small" @click="roleEdit(scope.row, scope.$index)" v-auth="'role.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="roleDel(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<el-dialog :title="titleMap[type]" v-model="limitedVisible" :width="600">
<el-form :model="addForm" :rules="rules" ref="addForm" autocomplete ="off" label-width="100px" label-position="left">
<el-form-item label="名称" prop="name" auto>
<el-input v-model="addForm.name" clearable></el-input>
</el-form-item>
<el-form-item label="标识">
<el-input v-model="addForm.code" clearable></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input v-model="addForm.description" clearable></el-input>
</el-form-item>
<el-form-item label="检验项">
<el-input v-model="addForm.description" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="limitedVisible=false" > </el-button>
<el-button v-if="type!=='show'" type="primary" :loading="isSaving" @click="submitHandle()"> </el-button>
</template>
</el-dialog>
</template>
<script>
const defaultForm = {
id:"",
name: "",
code: "",
description: "",
perms:[],
};
export default {
name: 'dept',
data() {
return {
apiObj:null,
selection: [],
checkList: [],
search: {
keyword: null
},
query: {},
isSaving: false,
limitedVisible : false,
checkStrictly:true,
type: "add",
titleMap: {
add: '新增',
edit: '编辑',
show: '查看'
},
//
addForm: defaultForm,
//
rules: {
name: [
{required: true, message: '请输入名称'}
],
},
menu: {
list: [],
checked: [],
props: {
emitPath: false,
children: 'children',
// label: 'name',
/*label: (data)=>{
return data.meta.title
}*/
}
},
}
},
mounted() {
this.getTestItem();
},
methods: {
//
getTestItem(){
var res = this.$API.system.role.list.req();
this.tableData = res.results;
},
//
tableAdd(){
this.limitedVisible = true;
this.type = "add";
this.$nextTick(()=>{
this.$refs.menu.setCheckedKeys([])
})
this.addForm = Object.assign({}, defaultForm);
},
//
submitHandle(){
let that = this;
this.addForm.perms = this.menu.checked;
this.$refs.addForm.validate( (valid) => {
if (valid) {
this.isSaveing = true;
let res;
if(this.type==='add'){
this.$API.system.role.create.req(that.addForm).then(res=>{
this.isSaveing = false;
this.limitedVisible = false;
this.$refs.table.refresh();
}).catch(e=>{this.isSaveing = false;})
}else{
this.$API.system.role.update.req(that.addForm.id,that.addForm).then(res=>{
this.isSaveing = false;
this.limitedVisible = false;
this.$refs.table.refresh();
}).catch(e=>{this.isSaveing = false;})
}
}
})
},
//
roleEdit(row){
this.type='edit';
this.addForm.id=row.id;
this.addForm.name=row.name;
this.addForm.code=row.code;
this.addForm.description=row.description;
this.limitedVisible = true;
this.$nextTick(()=>{
this.$refs.menu.setCheckedKeys(row.perms)
})
},
//
async roleDel(row){
var id = row.id;
var res = await this.$API.system.role.delete.req(id);
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//
selectionChange(selection){
this.selection = selection;
},
//
handleQuery(){
this.$refs.table.queryData(this.query)
},
//
handleSaveSuccess(data, type){
if(type=='add'){
this.$refs.table.refresh()
}else if(type=='edit'){
this.$refs.table.refresh()
}
}
}
}
</script>
<style scoped>
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;}
</style>

190
src/views/qm/testItem.vue Normal file
View File

@ -0,0 +1,190 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="roleAdd" v-auth="'role.create'"></el-button>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="query.search" placeholder="名称" clearable @keyup.enter="handleQuery"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" hidePagination>
<!-- <el-table-column type="selection" width="50"></el-table-column> -->
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="类型" prop="field_type" min-width="100"></el-table-column>
<el-table-column label="描述" prop="description" min-width="100"></el-table-column>
<el-table-column label="物料系列标签" prop="mcate_tags">
<template #default="scope">
<span v-for="item in scope.row.mcate_tags" :key="item">{{ item }}</span>
</template>
</el-table-column>
<el-table-column label="选项" prop="options">
<template #default="scope">
<div v-for="item in scope.row.options" :key="item">{{ item }}</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope">
<el-button link size="small" @click="roleEdit(scope.row, scope.$index)" v-auth="'role.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="roleDel(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<el-dialog :title="titleMap[type]" v-model="limitedVisible" :width="600">
<el-form :model="addForm" :rules="rules" ref="addForm" autocomplete =off label-width="100px" label-position="left">
<el-form-item label="名称" prop="name" auto>
<el-input v-model="addForm.name" clearable></el-input>
</el-form-item>
<el-form-item label="标识">
<el-input v-model="addForm.code" clearable></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input v-model="addForm.description" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="limitedVisible=false" > </el-button>
<el-button v-if="type!=='show'" type="primary" :loading="isSaving" @click="submitHandle()"> </el-button>
</template>
</el-dialog>
</template>
<script>
const defaultForm = {
id:"",
name: "",
code: "",
description: "",
perms:[],
};
export default {
name: 'dept',
data() {
return {
apiObj: this.$API.qm.testitem.list,
selection: [],
checkList: [],
search: {
keyword: null
},
query: {},
isSaving: false,
limitedVisible : false,
checkStrictly:true,
type: "add",
titleMap: {
add: '新增',
edit: '编辑',
show: '查看'
},
//
addForm: defaultForm,
//
rules: {
name: [
{required: true, message: '请输入角色名称'}
],
},
menu: {
list: [],
checked: [],
props: {
emitPath: false,
children: 'children',
// label: 'name',
/*label: (data)=>{
return data.meta.title
}*/
}
},
}
},
mounted() {
},
methods: {
//
roleAdd(){
this.limitedVisible = true;
this.type = "add";
this.$nextTick(()=>{
this.$refs.menu.setCheckedKeys([])
})
this.addForm = Object.assign({}, defaultForm);
},
submitHandle(){
let that = this;
this.addForm.perms = this.menu.checked;
this.$refs.addForm.validate( (valid) => {
if (valid) {
this.isSaveing = true;
let res;
if(this.type==='add'){
this.$API.qm.testitem.create.req(that.addForm).then(res=>{
this.isSaveing = false;
this.limitedVisible = false;
this.$refs.table.refresh();
}).catch(e=>{this.isSaveing = false;})
}else{
this.$API.qm.testitem.update.req(that.addForm.id,that.addForm).then(res=>{
this.isSaveing = false;
this.limitedVisible = false;
this.$refs.table.refresh();
}).catch(e=>{this.isSaveing = false;})
}
}
})
},
//
roleEdit(row){
this.type='edit';
this.addForm.id=row.id;
this.addForm.name=row.name;
this.addForm.code=row.code;
this.addForm.description=row.description;
this.limitedVisible = true;
},
//
async roleDel(row){
var id = row.id;
var res = await this.$API.qm.testitem.delete.req(id);
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//
selectionChange(selection){
this.selection = selection;
},
//
handleQuery(){
this.$refs.table.queryData(this.query)
},
//
handleSaveSuccess(data, type){
if(type=='add'){
this.$refs.table.refresh()
}else if(type=='edit'){
this.$refs.table.refresh()
}
}
}
}
</script>
<style scoped></style>