|
@@ -1,207 +1,178 @@
|
|
|
-<!-- 用户编辑弹窗 -->
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <ele-modal width="60%" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
|
|
|
|
|
- custom-class="ele-dialog-form" :title="isUpdate ? '修改质检' : '新增质检'" @update:visible="updateVisible">
|
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
|
|
+ <el-dialog :title="title" v-if="visible" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
|
|
|
|
|
+ :close-on-press-escape="false" append-to-body width="70%">
|
|
|
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="质检类型:" prop="categoryLevelName">
|
|
|
|
|
- <el-input v-model="form.categoryLevelName" @click.native="openCategory" readonly />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ <el-card shadow="never">
|
|
|
|
|
+ <userEditSearch @search="reload" />
|
|
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="质检名称:" prop="name">
|
|
|
|
|
- <el-input clearable v-model="form.name" placeholder="请输入质检名称" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ <!-- 数据表格 -->
|
|
|
|
|
+ <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
|
|
|
|
|
+ <template v-slot:status="{ row }">
|
|
|
|
|
+ {{ row.status ? '启用' : "停用" }}
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
|
|
+ <template v-slot:type="{ row }">
|
|
|
|
|
+ {{ getDictValue('质检标准类型', row.type) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
|
|
+ </ele-pro-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ </el-card>
|
|
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="工序:" prop="specification">
|
|
|
|
|
- <el-input clearable v-model="form.specification" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <div class="btns">
|
|
|
|
|
+ <el-button type="primary" size="small" @click="selected">选择</el-button>
|
|
|
|
|
+ <el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+</template>
|
|
|
|
|
|
|
|
|
|
+<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="产品类型:"></el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+import { getList } from '@/api/inspectionStandard';
|
|
|
|
|
+import userEditSearch from './user-edit-search.vue'
|
|
|
|
|
+import dictMixins from '@/mixins/dictMixins';
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ userEditSearch
|
|
|
|
|
+ },
|
|
|
|
|
+ mixins: [dictMixins],
|
|
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="产品类型编码:" prop="code">
|
|
|
|
|
- <el-input clearable v-model="form.code"></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ title: '选择工序',
|
|
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="状态:" prop="status">
|
|
|
|
|
- <el-switch v-model="form.status" active-color="#13ce66" inactive-color="#ff4949" :active-value="1"
|
|
|
|
|
- :inactive-value="0">
|
|
|
|
|
- </el-switch>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ // 表格列配置
|
|
|
|
|
+ columns: [
|
|
|
|
|
+ {
|
|
|
|
|
+ columnKey: 'selection',
|
|
|
|
|
+ type: 'selection',
|
|
|
|
|
+ width: 45,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ selectable: (row, index) => {
|
|
|
|
|
+ return !this.processData.some((it) => it.id == row.id);
|
|
|
|
|
+ },
|
|
|
|
|
+ reserveSelection: true,
|
|
|
|
|
+ fixed: 'left'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'code',
|
|
|
|
|
+ label: '质检编码'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '质检名称',
|
|
|
|
|
+ prop: 'name'
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="备注:" prop="remark">
|
|
|
|
|
- <el-input clearable v-model="form.remark"></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '状态',
|
|
|
|
|
+ prop: 'status',
|
|
|
|
|
+ slot: 'status'
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '版本号',
|
|
|
|
|
+ prop: 'version',
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '标准类型',
|
|
|
|
|
+ prop: 'type',
|
|
|
|
|
+ slot: 'type',
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
|
|
|
- </el-row>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <template v-slot:footer>
|
|
|
|
|
- <el-button @click="updateVisible(false)">取消</el-button>
|
|
|
|
|
- <el-button type="primary" :loading="loading" @click="save">
|
|
|
|
|
- 保存
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '标准代码',
|
|
|
|
|
+ prop: 'standardCode',
|
|
|
|
|
|
|
|
- <CategoryDialog ref="categoryRefs" @chooseCategory="changeCategory"></CategoryDialog>
|
|
|
|
|
- </ele-modal>
|
|
|
|
|
-</template>
|
|
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
-<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
|
|
|
-import { save, update } from '@/api/inspectionClassify/index';
|
|
|
|
|
|
|
+ // 表格选中数据
|
|
|
|
|
+ selection: [],
|
|
|
|
|
|
|
|
-export default {
|
|
|
|
|
- components: {
|
|
|
|
|
|
|
+ processData: [],
|
|
|
|
|
+ categoryId: null
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- props: {
|
|
|
|
|
- // 弹窗是否打开
|
|
|
|
|
- visible: Boolean,
|
|
|
|
|
- // 修改回显的数据
|
|
|
|
|
- data: Object,
|
|
|
|
|
- rootId: [Number, String],
|
|
|
|
|
- },
|
|
|
|
|
- data() {
|
|
|
|
|
- const defaultForm = {
|
|
|
|
|
- code: '',
|
|
|
|
|
- name: '',
|
|
|
|
|
- categoryLevelName: '',
|
|
|
|
|
- categoryLevelId: '',
|
|
|
|
|
- status: '',
|
|
|
|
|
- region: '',
|
|
|
|
|
- specification: ''
|
|
|
|
|
- };
|
|
|
|
|
- return {
|
|
|
|
|
- defaultForm,
|
|
|
|
|
- // 表单数据
|
|
|
|
|
- form: { ...defaultForm },
|
|
|
|
|
- // 表单验证规则
|
|
|
|
|
- rules: {
|
|
|
|
|
- name: [
|
|
|
|
|
- { required: true, message: '请输入干燥区名称', trigger: 'blur' }
|
|
|
|
|
- ],
|
|
|
|
|
- categoryLevelName: [
|
|
|
|
|
- { required: true, message: '请选择分类', trigger: 'change' }
|
|
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
- status: [
|
|
|
|
|
- { required: true, message: '请选择状态', trigger: 'change' }
|
|
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- region: [
|
|
|
|
|
- { required: true, message: '请输入位置', trigger: 'blur' }
|
|
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- // 提交状态
|
|
|
|
|
- loading: false,
|
|
|
|
|
- // 是否是修改
|
|
|
|
|
- isUpdate: false
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ watch: {
|
|
|
|
|
|
|
|
- computed: {
|
|
|
|
|
- // 是否开启响应式布局
|
|
|
|
|
- styleResponsive() {
|
|
|
|
|
- return this.$store.state.theme.styleResponsive;
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- /* 保存编辑 */
|
|
|
|
|
- save() {
|
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
- if (!this.isUpdate) {
|
|
|
|
|
- delete this.form.id;
|
|
|
|
|
- }
|
|
|
|
|
- const data = {
|
|
|
|
|
- ...this.form
|
|
|
|
|
- };
|
|
|
|
|
- const saveOrUpdate = this.isUpdate ? update : save;
|
|
|
|
|
- saveOrUpdate(data)
|
|
|
|
|
- .then((msg) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- this.$message.success(msg);
|
|
|
|
|
- this.updateVisible(false);
|
|
|
|
|
- this.$emit('done');
|
|
|
|
|
- })
|
|
|
|
|
- .catch((e) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ open(categoryId) {
|
|
|
|
|
+ this.categoryId = categoryId
|
|
|
|
|
+ this.visible = true
|
|
|
},
|
|
},
|
|
|
- /* 更新visible */
|
|
|
|
|
- updateVisible(value) {
|
|
|
|
|
- this.$emit('update:visible', value);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /* 表格数据源 */
|
|
|
|
|
+ async datasource({ page, limit, where }) {
|
|
|
|
|
+ const res = await getList({
|
|
|
|
|
+ ...where,
|
|
|
|
|
+ categoryId: this.categoryId,
|
|
|
|
|
+ pageNum: page,
|
|
|
|
|
+ size: limit
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ return res;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- openCategory() {
|
|
|
|
|
- this.$refs.categoryRefs.open(this.rootId, '选择分类')
|
|
|
|
|
|
|
+ /* 刷新表格 */
|
|
|
|
|
+ reload(where) {
|
|
|
|
|
+ this.$refs.table.reload({ page: 1, where: where });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
- changeCategory(row) {
|
|
|
|
|
- this.$set(this.form, 'categoryLevelName', row.name)
|
|
|
|
|
- this.$set(this.form, 'categoryLevelId', row.id)
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
|
|
+ handleClose() {
|
|
|
|
|
+ this.visible = false
|
|
|
|
|
+ this.$refs.table.setSelectedRows([]);
|
|
|
|
|
+ this.selection = []
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ selected() {
|
|
|
|
|
+ if (!this.selection.length) {
|
|
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let _arr = []
|
|
|
|
|
+ _arr = this.selection.map(m => {
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- watch: {
|
|
|
|
|
- visible(visible) {
|
|
|
|
|
- if (visible) {
|
|
|
|
|
- if (this.data) {
|
|
|
|
|
- this.$util.assignObject(this.form, {
|
|
|
|
|
- ...this.data,
|
|
|
|
|
- });
|
|
|
|
|
- this.isUpdate = true;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.isUpdate = false;
|
|
|
|
|
|
|
+ return {
|
|
|
|
|
+ name: m.name,
|
|
|
|
|
+ code: m.code,
|
|
|
|
|
+ qualityStandardId: m.id,
|
|
|
|
|
+ status: true,
|
|
|
|
|
+ mode: null,
|
|
|
|
|
+ version: null
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- this.$refs.form.clearValidate();
|
|
|
|
|
- this.form = { ...this.defaultForm };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ this.$emit('chooseProcess', _arr)
|
|
|
|
|
+ this.handleClose()
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
-};
|
|
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.btns {
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ padding: 10px 0;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|