|
|
@@ -0,0 +1,357 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :title="!dataForm.id ? '新增' : '修改'"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="visible"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ :model="dataForm"
|
|
|
+ :rules="dataRule"
|
|
|
+ ref="dataForm"
|
|
|
+ @keyup.enter.native="dataFormSubmit()"
|
|
|
+ label-width="80px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="名称" prop="qualitySchemeTemplateName">
|
|
|
+ <el-input
|
|
|
+ v-model="dataForm.qualitySchemeTemplateName"
|
|
|
+ placeholder="质检方案名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="编码" prop="qualitySchemeTemplateCode">
|
|
|
+ <el-input
|
|
|
+ v-model="dataForm.qualitySchemeTemplateCode"
|
|
|
+ placeholder="质检方案编码"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8"
|
|
|
+ ><el-form-item label="状态 " prop="status">
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ class="ele-block"
|
|
|
+ v-model="dataForm.status"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option label="失效" :value="0" />
|
|
|
+ <el-option label="有效" :value="1" />
|
|
|
+ </el-select> </el-form-item
|
|
|
+ ></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="list"
|
|
|
+ height="calc(100vh - 605px)"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ cache-key="inspectionClassify"
|
|
|
+ row-key="qualityLevelId"
|
|
|
+ :selection.sync="selection"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button @click="handAdd" size="mini" type="primary"
|
|
|
+ >新增质检项</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:textType="{ row }">
|
|
|
+ {{
|
|
|
+ row.textType == 1
|
|
|
+ ? '数值'
|
|
|
+ : row.textType == 2
|
|
|
+ ? '选择'
|
|
|
+ : row.textType == 3
|
|
|
+ ? '上下限'
|
|
|
+ : row.textType == 4
|
|
|
+ ? '规格'
|
|
|
+ : row.textType == 5
|
|
|
+ ? '时间'
|
|
|
+ : row.textType == 6
|
|
|
+ ? '范围'
|
|
|
+ : row.textType == 7
|
|
|
+ ? '文本'
|
|
|
+ : ''
|
|
|
+ }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:type="{ row }">
|
|
|
+ {{ getDictValue('质检标准类型', row.qualityStandardType) }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:defaultValue="{ row }">
|
|
|
+ <div
|
|
|
+ style="width: 100%; display: flex; justify-content: space-between"
|
|
|
+ >
|
|
|
+ <div style="width: 8%">
|
|
|
+ <el-input v-model="row.symbol" disabled> </el-input>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-if="row.textType == 3"
|
|
|
+ style="
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ width: 75%;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-input style="width: 45%" v-model="row.minValue"></el-input>
|
|
|
+ <span> -</span>
|
|
|
+ <el-input
|
|
|
+ style="width: 45%; margin-left: 10px"
|
|
|
+ v-model="row.maxValue"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-else style="width: 75%">
|
|
|
+ <el-input v-model="row.defaultValue" placeholder="请输入">
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div style="width: 15%">
|
|
|
+ <el-input v-model="row.unit" disabled> </el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:action="{ row, $index }">
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除当前质检项吗?"
|
|
|
+ @confirm="handDel($index)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
+ </span>
|
|
|
+ <termPop ref="termRef" @selectChange="selectChange"></termPop>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import termPop from '@/views/qualityInspectionPlan/inspectionClassify/index.vue';
|
|
|
+ export default {
|
|
|
+ components: { termPop },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ dataForm: {
|
|
|
+ id: 0,
|
|
|
+ qualitySchemeTemplateName: '',
|
|
|
+ qualitySchemeTemplateCode: '',
|
|
|
+ inspectionItemId: '',
|
|
|
+ status: '',
|
|
|
+ deleted: '',
|
|
|
+ createTime: '',
|
|
|
+ createUserId: '',
|
|
|
+ updateTime: '',
|
|
|
+ updateUserId: '',
|
|
|
+ tenantId: '',
|
|
|
+ deptId: '',
|
|
|
+ factoriesId: ''
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryLevelName',
|
|
|
+ label: '质检类型',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'inspectionName',
|
|
|
+ label: '质检名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'defaultValue',
|
|
|
+ slot: 'defaultValue',
|
|
|
+ label: '工艺参数',
|
|
|
+ align: 'center',
|
|
|
+ width: 500
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ dataRule: {
|
|
|
+ // qualitySchemeTemplateName: [
|
|
|
+ // { required: true, message: '质检方案名称不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // qualitySchemeTemplateCode: [
|
|
|
+ // { required: true, message: '质检方案编码不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // inspectionItemId: [
|
|
|
+ // { required: true, message: '质检项id不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // status: [
|
|
|
+ // { required: true, message: '状态 0 失效 1 有效不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // deleted: [
|
|
|
+ // { required: true, message: '是否删除:0 正常,1 删除不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // createTime: [
|
|
|
+ // { required: true, message: '创建时间不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // createUserId: [
|
|
|
+ // { required: true, message: '创建人ID不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // updateTime: [
|
|
|
+ // { required: true, message: '最后更新时间不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // updateUserId: [
|
|
|
+ // { required: true, message: '最后更新人ID不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // tenantId: [
|
|
|
+ // { required: true, message: '租户ID不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // deptId: [
|
|
|
+ // { required: true, message: '组织id不能为空', trigger: 'blur' }
|
|
|
+ // ],
|
|
|
+ // factoriesId: [
|
|
|
+ // { required: true, message: '工厂id不能为空', trigger: 'blur' }
|
|
|
+ // ]
|
|
|
+ },
|
|
|
+ list: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handAdd() {
|
|
|
+ this.$refs.termRef.open(this.list);
|
|
|
+ },
|
|
|
+ selectionChange(selection) {
|
|
|
+ console.log(selection, 'selection');
|
|
|
+ },
|
|
|
+ selectChange(list) {
|
|
|
+ this.list = list;
|
|
|
+ },
|
|
|
+ handDel(index) {
|
|
|
+ this.$confirm('是否删除该质检项', '删除', {
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.list.splice(index, 1);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ init(id) {
|
|
|
+ this.dataForm.id = id || 0;
|
|
|
+ this.visible = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['dataForm'].resetFields();
|
|
|
+ if (this.dataForm.id) {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(
|
|
|
+ `/qms/qualitytemplate/info/${this.dataForm.id}`
|
|
|
+ ),
|
|
|
+ method: 'get',
|
|
|
+ params: this.$http.adornParams()
|
|
|
+ }).then(({ data }) => {
|
|
|
+ if (data && data.code === 0) {
|
|
|
+ this.dataForm.qualitySchemeTemplateName =
|
|
|
+ data.qualityTemplate.qualitySchemeTemplateName;
|
|
|
+ this.dataForm.qualitySchemeTemplateCode =
|
|
|
+ data.qualityTemplate.qualitySchemeTemplateCode;
|
|
|
+ this.dataForm.inspectionItemId =
|
|
|
+ data.qualityTemplate.inspectionItemId;
|
|
|
+ this.dataForm.status = data.qualityTemplate.status;
|
|
|
+ this.dataForm.deleted = data.qualityTemplate.deleted;
|
|
|
+ this.dataForm.createTime = data.qualityTemplate.createTime;
|
|
|
+ this.dataForm.createUserId = data.qualityTemplate.createUserId;
|
|
|
+ this.dataForm.updateTime = data.qualityTemplate.updateTime;
|
|
|
+ this.dataForm.updateUserId = data.qualityTemplate.updateUserId;
|
|
|
+ this.dataForm.tenantId = data.qualityTemplate.tenantId;
|
|
|
+ this.dataForm.deptId = data.qualityTemplate.deptId;
|
|
|
+ this.dataForm.factoriesId = data.qualityTemplate.factoriesId;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 表单提交
|
|
|
+ dataFormSubmit() {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(
|
|
|
+ `/qms/qualitytemplate/${!this.dataForm.id ? 'save' : 'update'}`
|
|
|
+ ),
|
|
|
+ method: 'post',
|
|
|
+ data: this.$http.adornData({
|
|
|
+ id: this.dataForm.id || undefined,
|
|
|
+ qualitySchemeTemplateName:
|
|
|
+ this.dataForm.qualitySchemeTemplateName,
|
|
|
+ qualitySchemeTemplateCode:
|
|
|
+ this.dataForm.qualitySchemeTemplateCode,
|
|
|
+ inspectionItemId: this.dataForm.inspectionItemId,
|
|
|
+ status: this.dataForm.status,
|
|
|
+ deleted: this.dataForm.deleted,
|
|
|
+ createTime: this.dataForm.createTime,
|
|
|
+ createUserId: this.dataForm.createUserId,
|
|
|
+ updateTime: this.dataForm.updateTime,
|
|
|
+ updateUserId: this.dataForm.updateUserId,
|
|
|
+ tenantId: this.dataForm.tenantId,
|
|
|
+ deptId: this.dataForm.deptId,
|
|
|
+ factoriesId: this.dataForm.factoriesId
|
|
|
+ })
|
|
|
+ }).then(({ data }) => {
|
|
|
+ if (data && data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit('refreshDataList');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|