|
|
@@ -0,0 +1,193 @@
|
|
|
+<!-- 用户编辑弹窗 -->
|
|
|
+<template>
|
|
|
+ <el-dialog class="ele-dialog-form" :title="title" :visible.sync="visible" :before-close="handleClose"
|
|
|
+ :close-on-click-modal="false" :close-on-press-escape="false" width="1000px">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
+ <el-row>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="名称:" prop="inspectionName">
|
|
|
+ <el-input clearable v-model="form.inspectionName" placeholder="请输入" />
|
|
|
+ </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-col :span="12">
|
|
|
+ <el-form-item label="是否生成过程:" prop="isCreateCourse">
|
|
|
+ <el-select v-model="form.isCreateCourse" placeholder="请选择" style="width: 100%">
|
|
|
+ <el-option label="是" :value="1" />
|
|
|
+ <el-option label="否" :value="0" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="质检标准:" prop="inspectionStandard">
|
|
|
+ <el-input v-model="form.inspectionStandard"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="质检工具:" prop="inspectionTool">
|
|
|
+ <el-input v-model="form.inspectionTool"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="描述:" prop="description">
|
|
|
+ <el-input v-model="form.description"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="备注:" prop="inspectionRemark">
|
|
|
+ <el-input type="textarea" v-model="form.inspectionRemark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <template v-slot:footer>
|
|
|
+ <el-button @click="handleClose">取消</el-button>
|
|
|
+ <el-button type="primary" :loading="loading" @click="save">
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import { save, update, getById } from '@/api/inspectionProject';
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ const defaultForm = function () {
|
|
|
+ return {
|
|
|
+ id: '',
|
|
|
+ inspectionCode: '',
|
|
|
+ status: 1,
|
|
|
+ inspectionName: '',
|
|
|
+ inspectionRemark: '',
|
|
|
+ inspectionStandard: '',
|
|
|
+ inspectionTool: '',
|
|
|
+ isCreateCourse: '',
|
|
|
+ description: '',
|
|
|
+ };
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ defaultForm,
|
|
|
+ // 表单数据
|
|
|
+ form: { ...defaultForm() },
|
|
|
+ // 表单验证规则
|
|
|
+ rules: {
|
|
|
+
|
|
|
+ inspectionName: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+
|
|
|
+ status: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ visible: false,
|
|
|
+ type: null,
|
|
|
+ title: null,
|
|
|
+ loading: false,
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open(type, row) {
|
|
|
+ this.title = type == 'add' ? '新增' : '编辑'
|
|
|
+ this.type = type;
|
|
|
+ if (this.type == 'edit') {
|
|
|
+ this.form=row
|
|
|
+ }
|
|
|
+ this.visible = true;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* 保存编辑 */
|
|
|
+ save() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ if (this.type == 'add') {
|
|
|
+ delete this.form.id;
|
|
|
+ }
|
|
|
+ let URL = this.type == 'add' ? save : update
|
|
|
+ URL(this.form)
|
|
|
+ .then((msg) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.handleClose();
|
|
|
+ this.$emit('done');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ restForm() {
|
|
|
+ this.form = { ...this.defaultForm() };
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.restForm();
|
|
|
+ this.visible = false;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.location-warp {
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .detail {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-dialog:not(.ele-dialog-form) .el-dialog__body .el-form .el-form-item:last-child) {
|
|
|
+ margin-bottom: 22px;
|
|
|
+}
|
|
|
+</style>
|