feat:添加操作项页面,操作项添加类型

This commit is contained in:
shijing 2025-01-16 10:58:37 +08:00
parent 29a9af5312
commit cf8cb6726b
3 changed files with 180 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="testitemAdd" v-auth="'role.create'"></el-button> <el-button type="primary" icon="el-icon-plus" @click="testitemAdd" v-auth="'testitem.create'"></el-button>
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-input v-model="query.search" placeholder="名称" clearable @keyup.enter="handleQuery"></el-input> <el-input v-model="query.search" placeholder="名称" clearable @keyup.enter="handleQuery"></el-input>
@ -10,7 +10,7 @@
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id"> <scTable ref="table" :apiObj="apiObj" :params="params" row-key="id">
<el-table-column label="#" type="index" 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="name"></el-table-column>
<el-table-column label="检验类型" prop="field_type"> <el-table-column label="检验类型" prop="field_type">
@ -34,11 +34,11 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140"> <el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope"> <template #default="scope">
<el-button link size="small" @click="testitemEdit(scope.row, scope.$index)" v-auth="'role.update'" type="primary">编辑</el-button> <el-button link size="small" @click="testitemEdit(scope.row, scope.$index)" v-auth="'testitem.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="testitemDel(scope.row, scope.$index)"> <el-popconfirm title="确定删除吗?" @confirm="testitemDel(scope.row, scope.$index)">
<template #reference> <template #reference>
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button> <el-button link size="small" v-auth="'testitem.delete'" type="danger">删除</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
</template> </template>
@ -66,6 +66,9 @@
query: { query: {
search:'' search:''
}, },
params:{
type:10,
},
saveVisible : false, saveVisible : false,
type: "add", type: "add",
titleMap: { titleMap: {

View File

@ -52,7 +52,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24" v-if="type!=='cz'">
<el-form-item label="关联检测项"> <el-form-item label="关联检测项">
<xtSelect <xtSelect
:apiObj="apiObj" :apiObj="apiObj"
@ -67,7 +67,24 @@
</xtSelect> </xtSelect>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24" v-if="type=='cz'">
<el-form-item label="关联工序">
<el-select
v-model="form.process"
placeholder="关联工序"
clearable
style="width: 100%"
>
<el-option
v-for="item in processOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="描述"> <el-form-item label="描述">
<el-input <el-input
@ -84,7 +101,7 @@
></el-input-number> ></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col> <el-col v-if="type!=='cz'">
<el-form-item label="检验类型"> <el-form-item label="检验类型">
<el-checkbox-group v-model="form.tags"> <el-checkbox-group v-model="form.tags">
<el-checkbox <el-checkbox
@ -95,7 +112,6 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="是否只读"> <el-form-item label="是否只读">
<el-switch v-model="form.readonly"></el-switch> <el-switch v-model="form.readonly"></el-switch>
@ -163,6 +179,7 @@
<script> <script>
const defaultForm = { const defaultForm = {
type:10,
name: "", name: "",
description: "", description: "",
sort: 1, sort: 1,
@ -172,9 +189,16 @@ const defaultForm = {
affects:[], affects:[],
mcate_tags: [], mcate_tags: [],
choices: [""], choices: [""],
process:''
}; };
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
props: {
type: {
type: String,
default: "",
},
},
data() { data() {
return { return {
apiObj: this.$API.qm.testitem.list, apiObj: this.$API.qm.testitem.list,
@ -216,9 +240,18 @@ export default {
}; };
}, },
mounted() { mounted() {
// this.getmcateTagsOptions(); if(this.type=="cz"){
this.form.type=20;
this.getProcess();
}
}, },
methods: { methods: {
getProcess(){
let that = this;
that.$API.mtm.process.list.req({page:0}).then(res=>{
that.processOptions = res;
})
},
async getmcateTagsOptions() { async getmcateTagsOptions() {
let that = this; let that = this;
await that.$API.mtm.material.cates.req().then((res) => { await that.$API.mtm.material.cates.req().then((res) => {
@ -253,6 +286,7 @@ export default {
// //
submit() { submit() {
let that = this; let that = this;
console.log(that.form);
that.$refs.dialogForm.validate(async (valid) => { that.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
that.isSaveing = true; that.isSaveing = true;

View File

@ -0,0 +1,134 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="testitemAdd" v-auth="'testitem.create'"></el-button>
</div>
<div class="right-panel">
<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>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" :params="params" row-key="id">
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="检验类型">
<template #default="scope">
<span>{{ test_type_[scope.row.type]}}</span>
</template>
</el-table-column>
<el-table-column label="关联工序" prop="process_name">
</el-table-column>
<el-table-column label="类型" prop="field_type">
<template #default="scope">{{ field_type_[scope.row.field_type] }}</template>
</el-table-column>
<el-table-column label="描述" prop="description"></el-table-column>
<el-table-column label="物料系列标签" prop="mcate_tags" v-if="base_code !== 'bxerp'">
<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="choices">
<template #default="scope">
<div v-for="item in scope.row.choices" :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="testitemEdit(scope.row, scope.$index)" v-auth="'testitem.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="testitemDel(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'testitem.delete'" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="saveVisible"
ref="saveDialog"
type="cz"
@success="handleSuccess"
@closed="saveVisible = false"
>
</save-dialog>
</template>
<script>
import saveDialog from "./testItem_form.vue";
export default {
name: 'testitem',
components: { saveDialog },
data() {
return {
base_code: this.$TOOL.data.get('BASE_INFO').base.base_code,
apiObj: this.$API.qm.testitem.list,
query: {
search:''
},
params:{
type:20,
},
saveVisible : false,
type: "add",
titleMap: {
add: '新增',
edit: '编辑',
show: '查看'
},
field_type_: {
"input-int":"整数",
"input-number":"小数",
"input-text":"文本",
"select-text":"单选",
"selects-text":"多选",
},
test_type_:{
20:"操作项",
},
}
},
mounted() {
},
methods: {
//
testitemAdd(){
this.saveVisible = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
testitemEdit(row){
this.saveVisible = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
async testitemDel(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("删除成功")
}
},
//
handleQuery(){
this.$refs.table.queryData(this.query)
},
//
handleSuccess(data, type){
this.$refs.table.refresh()
this.$message.success("操作成功")
}
}
}
</script>
<style scoped></style>