|
|
@@ -0,0 +1,404 @@
|
|
|
+<template>
|
|
|
+ <ele-modal :visible.sync="visible" :title="title" width="45vw" append-to-body>
|
|
|
+ <div class="switch" v-if="type == 'detail'">
|
|
|
+ <div class="switch_left">
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ v-for="item in tabOptions"
|
|
|
+ :key="item.key"
|
|
|
+ :class="{ active: activeComp == item.key }"
|
|
|
+ @click="activeComp = item.key"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-form
|
|
|
+ v-show="activeComp == 'main'"
|
|
|
+ ref="form"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="100px"
|
|
|
+ class="create-form"
|
|
|
+ >
|
|
|
+ <el-steps :active="active" align-center style="margin-bottom: 10px">
|
|
|
+ <el-step title="基本信息"> </el-step>
|
|
|
+ <el-step title="关联变更"></el-step>
|
|
|
+ <el-step title="问题对象"></el-step>
|
|
|
+ <el-step title="影响对象"></el-step>
|
|
|
+ <el-step title="参考对象"></el-step>
|
|
|
+ </el-steps>
|
|
|
+
|
|
|
+ <el-row :gutter="15" v-show="active == 0">
|
|
|
+ <questionInfo
|
|
|
+ ref="info"
|
|
|
+ v-if="pageType == 1"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ />
|
|
|
+ <changeInfo
|
|
|
+ ref="info"
|
|
|
+ v-if="pageType == 2"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ />
|
|
|
+ <noticeInfo
|
|
|
+ ref="info"
|
|
|
+ v-if="pageType == 3"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ />
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="15" v-show="active == 1">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="questionColumns"
|
|
|
+ :datasource="this.form.relationObjList"
|
|
|
+ height="20vh"
|
|
|
+ :selection.sync="selection"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ <template v-slot:category="{ row }">
|
|
|
+ <span v-for="item in row.category.split(',')" :key="item">
|
|
|
+ {{ getDictValue('问题类型', item) }}</span
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template v-slot:type="{ row }">
|
|
|
+ <span>{{ getDictValue('变更类型', row.type + '') }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="del('selection', 'relationObjList')"
|
|
|
+ >移除</el-button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
+ <div
|
|
|
+ class="add-product"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="addEquipment('EquipmentDialogRef', 'relationObjList')"
|
|
|
+ >
|
|
|
+ <i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="15" v-show="active == 2">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="objColumns"
|
|
|
+ :datasource="this.form.problemObjList"
|
|
|
+ height="20vh"
|
|
|
+ :selection.sync="objSelection"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="del('objSelection', 'problemObjList')"
|
|
|
+ >移除</el-button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
+ <div
|
|
|
+ class="add-product"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="addEquipment('objEquipmentDialogRef', 'problemObjList')"
|
|
|
+ >
|
|
|
+ <i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="15" v-show="active == 3">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="objColumns"
|
|
|
+ :datasource="this.form.influenceObjList"
|
|
|
+ height="20vh"
|
|
|
+ :selection.sync="influenceSelection"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="del('influenceSelection', 'influenceObjList')"
|
|
|
+ >移除</el-button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
+ <div
|
|
|
+ class="add-product"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="addEquipment('objEquipmentDialogRef', 'influenceObjList')"
|
|
|
+ >
|
|
|
+ <i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="15" v-show="active == 4">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="objColumns"
|
|
|
+ :datasource="this.form.referenceObjList"
|
|
|
+ height="20vh"
|
|
|
+ :selection.sync="referenceSelection"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ size="small"
|
|
|
+ @click="del('referenceSelection', 'referenceObjList')"
|
|
|
+ >移除</el-button
|
|
|
+ ></template
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
+ <div
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ class="add-product"
|
|
|
+ @click="addEquipment('objEquipmentDialogRef', 'referenceObjList')"
|
|
|
+ >
|
|
|
+ <i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <template v-slot:footer>
|
|
|
+ <el-button @click="prev" :disabled="active == 0">上一步</el-button>
|
|
|
+ <el-button @click="next" :disabled="active == 4">下一步</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="save"
|
|
|
+ :loading="loading"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ >
|
|
|
+ 确定
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ </template>
|
|
|
+ <bpmDetail v-if="activeComp==='bpm'&&form.processInstanceId" :id="form.processInstanceId"></bpmDetail>
|
|
|
+
|
|
|
+ <EquipmentDialog ref="EquipmentDialogRef" @choose="choose" />
|
|
|
+ <objEquipmentDialog ref="objEquipmentDialogRef" @choose="choose" />
|
|
|
+ </ele-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import questionInfo from './questionInfo';
|
|
|
+import changeInfo from './changeInfo';
|
|
|
+import noticeInfo from './noticeInfo';
|
|
|
+
|
|
|
+import EquipmentDialog from './EquipmentDialog';
|
|
|
+import objEquipmentDialog from './objEquipmentDialog';
|
|
|
+import dictMixins from '@/mixins/dictMixins';
|
|
|
+import bpmDetail from '@/views/bpm/processInstance/detail.vue';
|
|
|
+
|
|
|
+import { questionColumns, objColumns } from './data.js';
|
|
|
+import { questionSave,questionDetails } from '@/api/changeManagement/question';
|
|
|
+import { requestSave,requestDetails } from '@/api/changeManagement/request';
|
|
|
+import { noticeSave, noticeDetails } from '@/api/changeManagement/notice';
|
|
|
+
|
|
|
+import fileUpload from '@/components/upload/fileUpload';
|
|
|
+import { listAllUserBind } from '@/api/system/user/index';
|
|
|
+const defaultForm = function () {
|
|
|
+ return {
|
|
|
+ relationObjList: [],
|
|
|
+ problemObjList: [],
|
|
|
+ influenceObjList: [],
|
|
|
+ referenceObjList: []
|
|
|
+ };
|
|
|
+};
|
|
|
+export default {
|
|
|
+ mixins: [dictMixins],
|
|
|
+
|
|
|
+ components: {
|
|
|
+ fileUpload,
|
|
|
+ bpmDetail,
|
|
|
+ // workOrder,
|
|
|
+ // produceOrder,
|
|
|
+ questionInfo,
|
|
|
+ // productionPlan,
|
|
|
+ EquipmentDialog,
|
|
|
+ objEquipmentDialog,
|
|
|
+ changeInfo,
|
|
|
+ noticeInfo
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ //关联对象类型 objType 1:生产计划 2:生产订单 3:生产工单
|
|
|
+ //关联变更类型 objType 1:问题报告 2:变更申请 3:变更通知
|
|
|
+ return {
|
|
|
+ activeComp: 'main',
|
|
|
+ tabOptions: [
|
|
|
+ { key: 'main', name: '详情' },
|
|
|
+ { key: 'bpm', name: '流程详情' }
|
|
|
+ ],
|
|
|
+ questionColumns: questionColumns
|
|
|
+ .map((item) => {
|
|
|
+ if (item.columnKey == 'selection') {
|
|
|
+ return {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter((item) => item.columnKey != 'action'),
|
|
|
+ objColumns,
|
|
|
+ visible: false,
|
|
|
+ loading: false,
|
|
|
+ active: 0,
|
|
|
+ activeList: '',
|
|
|
+ userOptions: [],
|
|
|
+ form: { ...defaultForm() },
|
|
|
+ // 表单验证规则
|
|
|
+ rules: {
|
|
|
+ type: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
+ name: [{ required: true, message: '请选择', trigger: 'change' }],
|
|
|
+ relationType: [{ required: true, message: '请选择', trigger: 'change' }]
|
|
|
+ },
|
|
|
+ type: '',
|
|
|
+ pageType: '1',
|
|
|
+ title: '创建',
|
|
|
+ selection: [],
|
|
|
+ influenceSelection: [],
|
|
|
+ objSelection: [],
|
|
|
+ referenceSelection: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ computed: {
|
|
|
+ // 是否开启响应式布局
|
|
|
+ styleResponsive() {
|
|
|
+ return this.$store.state.theme.styleResponsive;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.userOptions = [];
|
|
|
+ listAllUserBind().then((data) => {
|
|
|
+ this.userOptions.push(...data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ del(selection, list) {
|
|
|
+ let ids = this[selection].map((item) => item.id);
|
|
|
+ this.form[list] = this.form[list].filter(
|
|
|
+ (item) => !ids.includes(item.id)
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async next() {
|
|
|
+ let infoData = await this.$refs.info.getValue();
|
|
|
+ if (!infoData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.active++;
|
|
|
+ },
|
|
|
+ prev() {
|
|
|
+ this.active--;
|
|
|
+ },
|
|
|
+ addEquipment(ref, list) {
|
|
|
+ this.activeList = list;
|
|
|
+ this.$refs[ref].open(this.form[list]);
|
|
|
+ },
|
|
|
+ open(type, row, pageType) {
|
|
|
+ this.pageType = pageType;
|
|
|
+ this.visible = true;
|
|
|
+ (this.activeComp = 'main'), (this.type = type);
|
|
|
+ if (type != 'add') {
|
|
|
+ this.form = JSON.parse(JSON.stringify(row));
|
|
|
+ this.form.category = this.form.category.split(',');
|
|
|
+ this.form.type = this.form.type + '';
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.info.setValue(this.form);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.title = type == 'add' ? '新增' : type == 'edit' ? '修改' : '详情';
|
|
|
+ },
|
|
|
+
|
|
|
+ cancel() {
|
|
|
+ this.active = 0;
|
|
|
+ this.$refs.info?.cancel();
|
|
|
+ this.form = { ...defaultForm() };
|
|
|
+ this.visible = false;
|
|
|
+ },
|
|
|
+ choose(data) {
|
|
|
+ this.form[this.activeList] = data;
|
|
|
+
|
|
|
+ if (this.active == 1) {
|
|
|
+ this.getChangeData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getChangeData() {
|
|
|
+ ['problemObjList', 'influenceObjList', 'referenceObjList'].forEach(
|
|
|
+ (key) => {
|
|
|
+ this.form[key] = [];
|
|
|
+ }
|
|
|
+ );
|
|
|
+ //获取关联数据
|
|
|
+ this.form.relationObjList.forEach(async (item) => {
|
|
|
+ let api =
|
|
|
+ item.objType == 1
|
|
|
+ ? questionDetails
|
|
|
+ : item.objType == 2
|
|
|
+ ? requestDetails
|
|
|
+ : noticeDetails;
|
|
|
+ const data = await api(item.id);
|
|
|
+ ['problemObjList', 'influenceObjList', 'referenceObjList'].forEach(
|
|
|
+ (key) => {
|
|
|
+ this.form[key].push(...data[key]);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 保存编辑 */
|
|
|
+ async save() {
|
|
|
+ // let data = JSON.parse(JSON.stringify(this.form));
|
|
|
+ let infoData = await this.$refs.info.getValue();
|
|
|
+ if (!infoData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ infoData.category = infoData.category.toString();
|
|
|
+ Object.assign(infoData, {
|
|
|
+ relationObjList: this.form.relationObjList,
|
|
|
+ problemObjList: this.form.problemObjList,
|
|
|
+ influenceObjList: this.form.influenceObjList,
|
|
|
+ referenceObjList: this.form.referenceObjList
|
|
|
+ });
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ let api =
|
|
|
+ this.pageType == 1
|
|
|
+ ? questionSave
|
|
|
+ : this.pageType == 2
|
|
|
+ ? requestSave
|
|
|
+ : noticeSave;
|
|
|
+ api(infoData)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success('成功');
|
|
|
+ this.cancel();
|
|
|
+ this.$emit('refresh');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.add-product {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ font-size: 30px;
|
|
|
+ color: #1890ff;
|
|
|
+ margin: 10px 0;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.create-form .el-form-item {
|
|
|
+ margin-bottom: 15px !important;
|
|
|
+}
|
|
|
+</style>
|