|
|
@@ -12,6 +12,79 @@
|
|
|
>
|
|
|
<header-title title="基本信息"></header-title>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="质检分类:" prop="qualityStandardId">
|
|
|
+ <el-cascader-panel
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="form.categoryLevelId"
|
|
|
+ :options="categoryLevelList"
|
|
|
+ @change="handleChange"
|
|
|
+ :props="{ label: 'name', value: 'id', checkStrictly: true }"
|
|
|
+ ref="cascaderRef"
|
|
|
+ ></el-cascader-panel>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <!-- <el-col :span="12">
|
|
|
+ <el-form-item label="标准名称:" prop="qualityStandardId">
|
|
|
+ <el-select
|
|
|
+ v-model="form.qualityStandardId"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.name"
|
|
|
+ v-for="item in qualityStandardList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col> -->
|
|
|
+ </el-row>
|
|
|
+ <!-- <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="质检方式:" prop="mode">
|
|
|
+ <el-select
|
|
|
+ v-model="form.mode"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option label="自检" :value="1" />
|
|
|
+ <el-option label="互检" :value="2" />
|
|
|
+ <el-option label="专检" :value="3" />
|
|
|
+ <el-option label="军检" :value="4" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="状态:" prop="status">
|
|
|
+ <el-select
|
|
|
+ v-model="form.status"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option label="停用" :value="0" />
|
|
|
+ <el-option label="启用" :value="1" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注:" prop="remark">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="form.remark"
|
|
|
+ type="textarea"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
<headerTitle title="质检工具">
|
|
|
<el-button type="primary" size="small" @click="handleAdd"
|
|
|
>新增</el-button
|
|
|
@@ -101,6 +174,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ -->
|
|
|
</el-form>
|
|
|
|
|
|
<template v-slot:footer>
|
|
|
@@ -121,6 +195,7 @@
|
|
|
import { getList } from '@/api/inspectionStandard';
|
|
|
import ProductModal from '@/views/inspectionProject/components/ProductModal.vue';
|
|
|
import fileUpload from '@/components/addDoc/index.vue';
|
|
|
+ import { getTreeByIds } from '@/api/classifyManage';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -136,16 +211,17 @@
|
|
|
},
|
|
|
data() {
|
|
|
const defaultForm = {
|
|
|
- categoryLevelId: 0,
|
|
|
+ categoryLevelId: null,
|
|
|
categoryLevelName: '',
|
|
|
- id: 0,
|
|
|
- inspectionItemId: 0,
|
|
|
- mode: 0,
|
|
|
- qualityStandardId: 0,
|
|
|
+ categoryLevelClassName: '',
|
|
|
+ id: null,
|
|
|
+ inspectionItemId: null,
|
|
|
+ mode: null,
|
|
|
+ qualityStandardId: null,
|
|
|
remark: '',
|
|
|
- rootCategoryLevelId: 0,
|
|
|
- sort: 0,
|
|
|
- status: 0,
|
|
|
+ rootCategoryLevelId: null,
|
|
|
+ sort: null,
|
|
|
+ status: null,
|
|
|
postscriptList: [],
|
|
|
postscriptRemoveIds: [],
|
|
|
toolList: [],
|
|
|
@@ -155,16 +231,41 @@
|
|
|
return {
|
|
|
defaultForm,
|
|
|
// 表单数据
|
|
|
- form: { ...defaultForm },
|
|
|
+ form: JSON.parse(JSON.stringify(defaultForm)),
|
|
|
|
|
|
qualityStandardList: [],
|
|
|
// 表单验证规则
|
|
|
- rules: {},
|
|
|
+ rules: {
|
|
|
+ qualityStandardId: [
|
|
|
+ { required: true, message: '请选择质检标准', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ inspectionName: [
|
|
|
+ { required: true, message: '请输入质检名称', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ inspectionCode: [
|
|
|
+ { required: true, message: '请输入质检编码', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+
|
|
|
+ // unitName:
|
|
|
+ textType: [
|
|
|
+ { required: true, message: '请选择参数类型', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+
|
|
|
+ inspectionStandard: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
|
|
|
// 提交状态
|
|
|
loading: false,
|
|
|
// 是否是修改
|
|
|
- isUpdate: false
|
|
|
+ isUpdate: false,
|
|
|
+ // 质检分类列表
|
|
|
+ categoryLevelList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -184,8 +285,23 @@
|
|
|
|
|
|
created() {
|
|
|
this.getListFn();
|
|
|
+ this.getCategoryLevelList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 选择分类
|
|
|
+ handleChange(e) {
|
|
|
+ const node = this.$refs.cascaderRef.getCheckedNodes();
|
|
|
+ console.log('node', node);
|
|
|
+ if (node && node.length > 0) {
|
|
|
+ this.form.categoryLevelName = node[0].label;
|
|
|
+ this.form.categoryLevelClassName = node[0].pathNodes
|
|
|
+ .map((i) => i.label)
|
|
|
+ .join('-');
|
|
|
+ } else {
|
|
|
+ this.form.categoryLevelName = '';
|
|
|
+ this.form.categoryLevelClassName = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
defaultInput(value) {
|
|
|
console.log(this.form.symbol, '0000 symbol');
|
|
|
if (this.form.textType !== '1') {
|
|
|
@@ -215,25 +331,31 @@
|
|
|
},
|
|
|
/* 保存编辑 */
|
|
|
save() {
|
|
|
+ console.log('this.form', this.form);
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
this.loading = true;
|
|
|
- if (!this.isUpdate) {
|
|
|
- delete this.form.id;
|
|
|
- }
|
|
|
|
|
|
try {
|
|
|
- console.log('this.form', this.form);
|
|
|
- // await update(this.form);
|
|
|
+ const body = JSON.parse(JSON.stringify(this.form));
|
|
|
|
|
|
- // this.loading = false;
|
|
|
- // this.form = {};
|
|
|
- // this.$message.success('修改成功');
|
|
|
- // this.updateVisible(false);
|
|
|
- // this.$emit('done');
|
|
|
+ if (Array.isArray(body.categoryLevelId)) {
|
|
|
+ body.categoryLevelId =
|
|
|
+ body.categoryLevelId[body.categoryLevelId.length - 1];
|
|
|
+ }
|
|
|
|
|
|
+ await update(body);
|
|
|
+ this.$message.success('保存成功');
|
|
|
+
|
|
|
+ // 关闭弹窗
|
|
|
+ this.updateVisible(false);
|
|
|
+ // 触发父组件刷新
|
|
|
+ this.$emit('done');
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
} catch (error) {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
@@ -283,6 +405,11 @@
|
|
|
this.form.postscriptRemoveIds.push(row.id);
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ async getCategoryLevelList() {
|
|
|
+ const { data } = await getTreeByIds({ ids: '12' });
|
|
|
+ console.log('data 质检分类', data);
|
|
|
+ this.categoryLevelList = data;
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -292,6 +419,7 @@
|
|
|
this.$util.assignObject(this.form, {
|
|
|
...this.data
|
|
|
});
|
|
|
+ console.log('this.data', this.data, this.form);
|
|
|
this.isUpdate = true;
|
|
|
} else {
|
|
|
const code = await getCode('inspection_code');
|