检测方案更改

master
shaoyong 6 months ago
parent 1472cf8cb3
commit e43ce9721a

@ -42,3 +42,13 @@ export function delQcProjectType(id) {
method: 'delete' method: 'delete'
}); });
} }
export function projectTypeTree(query) {
return request({
url: '/quality/qcProjectType/projectTypeTree',
method: 'get',
params: query
});
}

@ -376,9 +376,6 @@ export default {
}, },
/**物料树点击 */ /**物料树点击 */
onNodeClick(obj) { onNodeClick(obj) {
console.log("数据在这里")
console.log(obj)
console.log(12312312312321)
if(obj.level == 1) { if(obj.level == 1) {
this.queryParams.groupId = obj.id; this.queryParams.groupId = obj.id;
this.groupId = obj.id; this.groupId = obj.id;

@ -1,18 +1,44 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px"> <el-row :gutter="20">
<el-form-item label="检测项方案编号" prop="projectTypeCode"> <el-col :span="6" :xs="24">
<ProjectTypeTree ref="ProjectTypeTree" @onNodeClick="onNodeClick" ></ProjectTypeTree>
</el-col>
<el-col :span="18" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="检验规则名称" prop="ruleName">
<el-input <el-input
v-model="queryParams.projectTypeCode" v-model="queryParams.ruleName"
placeholder="请输入检测项方案编号" placeholder="请输入检验规则名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="检测项方案名称" prop="projectTypeName"> <el-form-item label="检验规则属性" prop="propertyCode">
<el-select
v-model="queryParams.propertyCode"
placeholder="请选择检验规则属性"
clearable >
<el-option
v-for="dict in dict.type.qc_rule_prop"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="检验方式" prop="checkMode">
<el-input <el-input
v-model="queryParams.projectTypeName" v-model="queryParams.checkMode"
placeholder="请输入检测项方案名称" placeholder="请输入检验方式"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="检验工具" prop="checkTool">
<el-input
v-model="queryParams.checkTool"
placeholder="请输入检验工具"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -31,7 +57,7 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['quality:qcProjectType:add']" v-hasPermi="['quality:project:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -42,7 +68,7 @@
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['quality:qcProjectType:edit']" v-hasPermi="['quality:project:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -53,9 +79,19 @@
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['quality:qcProjectType:remove']" v-hasPermi="['quality:project:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['quality:project:import']"
>导入</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -63,40 +99,58 @@
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['quality:qcProjectType:export']" v-hasPermi="['quality:project:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-edit"
size="mini"
@click="handleUpProjectType"
>编辑方案</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="qcProjectTypeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" /> <el-table-column label="检验规则编号" align="center" prop="orderNum" width="110"/>
<el-table-column label="检测项方案编号" align="center" prop="projectTypeCode" /> <el-table-column label="检验规则名称" align="center" prop="ruleName" width="200" :show-overflow-tooltip="true"/>
<el-table-column label="检测项方案名称" align="center" :show-overflow-tooltip="true"> <el-table-column label="检验规则属性" align="center" prop="propertyCode" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/qua/quality/qcProject-data/index/' + scope.row.projectTypeCode" class="link-type"> <dict-tag
<span>{{ scope.row.projectTypeName }}</span> :options="dict.type.qc_rule_prop"
</router-link> :value="scope.row.propertyCode"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检验标准编码" align="center" prop="standardNo" /> <el-table-column label="检验方式" align="center" prop="checkMode" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="版本" align="center" prop="version" /> <el-table-column label="检验工具" align="center" prop="checkTool" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="检验标准" align="center" prop="checkStandard" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="单位" align="center" prop="unitCode" >
<template slot-scope="scope"><dict-tag :options="dict.type.unit" :value="scope.row.unitCode"/></template>
</el-table-column>
<el-table-column label="抽样方案" align="center" prop="samplePlan" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="合格判定" align="center" prop="judge" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="检测项分类" align="center" prop="itemType" width="100" :formatter="itemTypeFormat" />
<el-table-column label="合格判定比例" align="center" prop="judgeRate" width="150"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['quality:qcProjectType:edit']" v-hasPermi="['quality:project:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['quality:qcProjectType:remove']" v-hasPermi="['quality:project:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -109,36 +163,171 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</el-col>
</el-row>
<!-- 添加或修改检验方案维护对话框 --> <!-- 添加或修改检验项目维护对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px" >
<el-form-item label="检测项方案编号" prop="projectTypeCode"> <el-row>
<el-input v-model="form.projectTypeCode" placeholder="请输入检测项方案编号" /> <el-col>
<el-form-item label="检验方案" prop="projectType">
<el-select v-model="form.projectType" placeholder="请选择检验方案" style="width:100%" disabled>
<el-option
v-for="item in ProjectTypeList"
:key="item.projectTypeCode"
:label="item.projectTypeName"
:value="item.projectTypeCode"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="检验规则名称" prop="ruleName">
<el-input v-model="form.ruleName" placeholder="请输入检验规则名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="检验规则属性" prop="propertyCode">
<el-select v-model="form.propertyCode" placeholder="请选择检验规则属性" style="width:100%">
<el-option
v-for="dict in dict.type.qc_rule_prop"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="检验标准" prop="checkStandard">
<el-input type='textarea' v-model="form.checkStandard" placeholder="请输入检验标准" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="检验方式" prop="checkMode">
<el-input type='textarea' v-model="form.checkMode" placeholder="请输入检验方式" />
</el-form-item>
</el-col>
</el-row>
<template v-if="form.propertyCode === '1'">
<el-row>
<el-col>
<el-form-item label="检验工具" prop="checkTool">
<el-input type='textarea' v-model="form.checkTool" placeholder="请输入检验工具" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="单位" prop="unitCode">
<el-select v-model="form.unitCode" placeholder="请选择单位" >
<el-option
v-for="dict in dict.type.unit"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</template>
<el-row>
<el-col>
<el-form-item label="抽样方案" prop="samplePlan">
<el-input type='textarea' v-model="form.samplePlan" placeholder="抽样方案" />
</el-form-item> </el-form-item>
<el-form-item label="检测项方案名称" prop="projectTypeName"> </el-col>
<el-input v-model="form.projectTypeName" placeholder="请输入检测项方案名称" /> </el-row>
<el-row>
<el-col>
<el-form-item label="缺陷等级" prop="defectLevel">
<el-input type='textarea' v-model="form.defectLevel" placeholder="请输入检验标准" />
</el-form-item> </el-form-item>
<el-form-item label="检测标准编号" prop="standardNo"> </el-col>
<el-input v-model="form.standardNo" placeholder="请输入检测标准编号" /> </el-row>
<el-row>
<el-col>
<el-form-item label="合格判定" prop="judge">
<el-input type='textarea' v-model="form.judge" placeholder="合格判定" />
</el-form-item> </el-form-item>
<el-form-item label="版本" prop="version"> </el-col>
<el-input v-model="form.version" placeholder="请输入版本" /> </el-row>
<el-row>
<el-col>
<el-form-item label="检测项分类" prop="itemType">
<el-radio v-model="form.itemType" label="1"></el-radio>
<el-radio v-model="form.itemType" label="0"></el-radio>
</el-form-item> </el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="合格判定比例" prop="judgeRate">
<el-input type='number' v-model="form.judgeRate" placeholder="合格判定比例" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 检测项目导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listQcProjectType, getQcProjectType, delQcProjectType, addQcProjectType, updateQcProjectType } from "@/api/quality/qcProjectType"; import { listQcProjectType, delQcProjectType, addQcProjectType, updateQcProjectType } from "@/api/quality/qcProjectType";
import ProjectTypeTree from "./projectTypeTree.vue";
import { listProject, getProject, delProject, addProject, updateProject } from "@/api/quality/project";
import { getToken } from "@/utils/auth";
export default { export default {
name: "QcProjectType", name: "QcProjectType",
dicts: ["qc_rule_prop","unit"],
components:{ProjectTypeTree,},
data() { data() {
return { return {
// //
@ -154,19 +343,44 @@ export default {
// //
total: 0, total: 0,
// //
qcProjectTypeList: [], projectList: [],
// //
title: "", title: "",
// //
open: false, open: false,
//
ProjectTypeList: {},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
projectTypeCode: null, orderNum: null,
projectTypeName: null, ruleName: null,
propertyCode: null,
checkMode: null,
checkTool: null,
unitCode: null,
checkStandard: null,
attr1: null, attr1: null,
factoryCode: null, factoryCode: null,
projectType: null,
},
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: {
Authorization: "Bearer " + getToken(),
poolName: localStorage.getItem('USER_POOL_NAME_CURRENT'),
},
//
url: process.env.VUE_APP_BASE_API + "/quality/project/importData"
}, },
// //
form: {}, form: {},
@ -180,17 +394,33 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getProjectTypeList();
}, },
methods: { methods: {
/** 查询检验方案维护列表 */ /** 查询检验项目维护列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listQcProjectType(this.queryParams).then(response => { listProject(this.queryParams).then(response => {
this.qcProjectTypeList = response.rows; this.projectList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
getProjectTypeList() {
listQcProjectType().then(response => {
this.ProjectTypeList = response.rows;
});
},
//
itemTypeFormat(row, column, cellValue) {
if (cellValue != null) {
if(cellValue=='1'){
return '包装';
}else if(cellValue=='0'){
return '内容物';
}
}
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -200,15 +430,21 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
projectTypeCode: null, orderNum: null,
projectTypeName: null, ruleName: null,
propertyCode: null,
checkMode: null,
checkTool: null,
unitCode: null,
checkStandard: null,
attr1: null, attr1: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
factoryCode: null, factoryCode: null,
delFlag: null delFlag: null,
projectType: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -231,17 +467,18 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.form.projectType = this.projectType
this.open = true; this.open = true;
this.title = "添加检验方案维护"; this.title = "添加检验项目维护";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getQcProjectType(id).then(response => { getProject(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改检验方案维护"; this.title = "修改检验项目维护";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -249,13 +486,13 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateQcProjectType(this.form).then(response => { updateProject(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addQcProjectType(this.form).then(response => { addProject(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -267,8 +504,8 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除检验方案维护编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除检验项目维护编号为"' + ids + '"的数据项?').then(function() {
return delQcProjectType(ids); return delProject(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
@ -276,9 +513,55 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('quality/qcProjectType/export', { this.download('quality/project/export', {
...this.queryParams ...this.queryParams
}, `qcProjectType_${new Date().getTime()}.xlsx`) }, `project_${new Date().getTime()}.xlsx`)
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "检测项目导入";
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download('quality/project/importTemplate', {
}, `check_project_template_${new Date().getTime()}.xlsx`)
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
},
onNodeClick(obj) {
if(obj.id == 'projectType0') {
this.queryParams.projectType = '';
}else{
this.queryParams.projectType = obj.id;
}
this.projectType = obj.id;
this.handleQuery();
},
handleUpProjectType() {
if( !this.projectType || this.projectType.trim() === ''){
return this.$modal.msgWarning("请先选择左侧方案!");
}
if(this.projectType != 'projectType0') {
this.$refs.ProjectTypeTree.handleUpdate(this.projectType);
}else{
this.$modal.msgError("此方案不允许修改");
}
} }
} }
}; };

@ -0,0 +1,281 @@
<template>
<div>
<!-- 新增按钮 -->
<el-button class="groupAdd" type="primary" @click="handleAdd"
>新增方案</el-button>
<div class="head-container">
<el-input
v-model="groupName"
placeholder="请输入物料名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="options"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
class="tree-style"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span style="width:220px; display:block; word-break:keep-all; white-space:nowrap; overflow:hidden; text-overflow:ellipsis"
:title="node.label + '(' + data.id + ')'"
>{{node.label}}</span>
<span>
<el-button
v-if="node.level == 2"
class="btn-tree"
type="text"
size="medium"
@click="() => remove(node, data)">
</el-button>
<el-button
v-if="node.level == 1"
class="btn-tree"
type="text"
size="medium"
@click="() => append(data)">
</el-button>
</span>
</span>
</el-tree>
</div>
<!-- 新增方案 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="检测项方案编号" prop="projectTypeCode">
<el-input v-model="form.projectTypeCode" placeholder="请输入检测项方案编号" />
</el-form-item>
<el-form-item label="检测项方案名称" prop="projectTypeName">
<el-input v-model="form.projectTypeName" placeholder="请输入检测项方案名称" />
</el-form-item>
<el-form-item label="检测标准编号" prop="standardNo">
<el-input v-model="form.standardNo" placeholder="请输入检测标准编号" />
</el-form-item>
<el-form-item label="版本" prop="version">
<el-input v-model="form.version" placeholder="请输入版本" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listQcProjectType, projectTypeTree, getQcProjectType, delQcProjectType, addQcProjectType, updateQcProjectType } from "@/api/quality/qcProjectType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import ItemSelectMaterial from "../qcIncome/selectMaterial.vue";
export default {
name: "projectTypeTree",
comments: { Treeselect},
components: {ItemSelectMaterial},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
options: null,
//
groupName: null,
//
projectList: [],
//
nodeData: {},
//
title: "",
materialTitle: "",
//
open: false,
materialOpen: false,
defaultProps: {
children: "children",
label: "label",
isLeaf: "isLeaf",
},
//
queryParams: {
groupName: null,
attr1: null,
factoryCode: null,
},
//
form: {},
//
rules: {},
};
},
watch: {
//
groupName(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.getList();
},
methods: {
getList() {
listQcProjectType(this.queryParams).then(response => {
this.projectList = response.rows;
});
this.getProjectTypeTree();
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
groupName: null,
groupCode: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
factoryCode: null,
delFlag: null,
};
this.resetForm("form");
},
/** 查询下拉树结构 */
getProjectTypeTree() {
projectTypeTree().then((response) => {
this.options = response.data;
//this.treeInit();
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
treeInit() {
const firstTreeNode = this.options[0];
firstTreeNode.level = 1;
//this.$emit('child-event', firstTreeNode); //
},
//
handleNodeClick(data,node) {
this.nodeData.id = data.id;
this.nodeData.name = data.label;
this.nodeData.level = node.level;
this.$emit('onNodeClick', this.nodeData);
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增方案";
},
/** 修改按钮操作 */
handleUpdate(typeCode) {
this.reset();
const obj = this.projectList.find(obj => obj.projectTypeCode === typeCode);
getQcProjectType(obj.id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改方案";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateQcProjectType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addQcProjectType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/**添加树节点 */
append(data) {
// this.reset();
// this.form.groupId = data.id;
this.handleAdd();
},
/**删除树节点 */
remove(node, data) {
const obj = this.projectList.find(obj => obj.projectTypeCode === data.id);
console.log(obj);
this.$modal
.confirm('是否确认删除方案名称为"' + obj.projectTypeName + '"的数据项?')
.then(function () {
//
return delQcProjectType(obj.id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
},
};
</script>
<style>
.groupAdd {
margin: 10px auto;
width: 100%;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
font: bolder;
padding-right: 8px;
}
.custom-tree-node .btn-tree {
margin: 0 8px;
font-size: 20px;
font: bolder;
}
.tree-style {
height: 500px; /* 设置一个固定高度 */
overflow-y: auto; /* 滚动条只在垂直方向显示 */
}
</style>
Loading…
Cancel
Save