Browse Source

工艺路线发布

yusheng 1 year ago
parent
commit
bcc042171e

+ 108 - 0
src/components/processSubmitDialog/api.js

@@ -0,0 +1,108 @@
+import request from '@/utils/request';
+export async function getProcessDefinitionBpmnXML(id) {
+  const res = await request({
+    url: '/bpm/process-definition/get-bpmn-xml?id=' + id,
+    method: 'get'
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function getTaskAssignRuleList(query) {
+  const res = await request({
+    url: '/bpm/task-assign-rule/list',
+    method: 'get',
+    params: query
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function processInstanceCreateAPI(data) {
+  const res = await request(
+    {
+      url: '/bpm/process-instance/create',
+      method: 'post',
+      data
+    },
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function getModelPage(query) {
+  const res = await request({
+    url: '/bpm/model/page',
+    method: 'get',
+    params: query
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function getProcessDefinitionInfo(params) {
+  const res = await request({
+    url: `/bpm/process-definition/get`,
+    method: 'get',
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function listAllUserBind() {
+  const res = await request.get('/main/user/listAllUserBind');
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取用户组精简信息列表
+export async function listSimpleUserGroups() {
+  const res = await request({
+    url: '/bpm/user-group/list-all-simple',
+    method: 'get'
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+/**
+ * 产品分类指定code查询
+ */
+
+export async function getProduceTreeByCode(code) {
+  const res = await request.get(
+    `/main/categoryLevel/getProduceTreeByPid?code=${code}`,
+    {}
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//工艺路线不走流程直接发布
+export async function produceroutingRelease(data) {
+  const res = await request(
+    {
+      url: '/main/producerouting/release',
+      method: 'post',
+      data
+    },
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 448 - 0
src/components/processSubmitDialog/processSubmitDialog.vue

@@ -0,0 +1,448 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible="processSubmitDialogFlag"
+    title="提交审核"
+    append-to-body
+    :close-on-click-modal="false"
+    width="50%"
+    :before-close="cancel"
+    :maxable="true"
+    :resizable="true"
+  >
+    <!--    <el-steps :active="active" align-center style="transform: scale(0.8)">-->
+    <!--      <el-step title="流程发起"></el-step>-->
+    <!--      <el-step title="流程通知"></el-step>-->
+    <!--    </el-steps>-->
+
+    <el-form
+      ref="form"
+      :rules="rules"
+      class="el-form-box"
+      :model="form"
+      label-width="80px"
+    >
+      <el-row v-show="active == 0">
+        <el-col :span="12">
+          <el-form-item label="流程分类">
+            <ele-tree-select
+              @change="changeLCFL"
+              clearable
+              ref="processTypeRef"
+              filterable
+              :data="LCFLList"
+              v-model="form.LCFL"
+              childrenKey="children"
+              valueKey="id"
+              labelKey="name"
+              placeholder="请选择"
+              default-expand-all
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="发起流程">
+            <el-select
+              filterable
+              v-model="form.FQLC"
+              @change="changeFQLC"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in processList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row v-show="active == 0">
+        <el-col :span="12">
+          <el-form-item label="流程名称">
+            <el-input v-model="form.name" clearable></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="流程标识">
+            <el-input v-model="form.key" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <headerTitle
+        v-show="active == 0"
+        title="流程执行人/流程图"
+        style="margin-top: 30px"
+      ></headerTitle>
+      <el-table
+        v-show="active == 0"
+        :data="datasource"
+        border
+        style="margin-bottom: 10px"
+      >
+        <el-table-column
+          label="任务节点"
+          align="center"
+          prop="taskDefinitionName"
+          width="140"
+          fixed
+        />
+        <el-table-column
+          label="执行人"
+          align="center"
+          prop="options"
+          min-width="140px"
+        >
+          <template v-slot="scope">
+            <div v-if="scope.row.type !== 60 && scope.row.options.length > 0">
+              <el-tag
+                size="medium"
+                :key="option"
+                v-for="option in scope.row.options"
+              >
+                {{ getAssignRuleOptionName(scope.row, option) }}
+              </el-tag>
+            </div>
+
+            <el-tag size="medium" v-if="scope.row.type === 60">
+              {{ getAssignRuleOptionName(scope.row) }}
+            </el-tag>
+          </template>
+        </el-table-column>
+      </el-table>
+      <my-process-viewer
+        v-show="active == 0"
+        style="min-width: 100%; height: 200px"
+        key="designer"
+        v-model="bpmnXML"
+      />
+      <el-table v-show="active == 1" :data="form.noticeScope" border>
+        <el-table-column
+          label="类型"
+          align="center"
+          prop="taskDefinitionName"
+          width="140"
+          fixed
+        />
+        <el-table-column
+          label="结果"
+          align="center"
+          prop="options"
+          min-width="140px"
+        >
+        </el-table-column>
+      </el-table>
+    </el-form>
+
+    <div slot="footer">
+      <!--      <el-button-->
+      <!--        type="primary"-->
+      <!--        size="small"-->
+      <!--        v-if="active == 0"-->
+      <!--        @click="() => (active = 1)"-->
+      <!--        >下一步-->
+      <!--      </el-button>-->
+      <!--      <el-button-->
+      <!--        type="primary"-->
+      <!--        size="small"-->
+      <!--        v-if="active == 1"-->
+      <!--        @click="() => (active = 0)"-->
+      <!--        >上一步-->
+      <!--      </el-button>-->
+      <el-button type="primary" size="small" @click="submit" v-click-once
+        >提交</el-button
+      >
+      <el-button
+        v-if="isNotNeedProcess"
+        type="primary"
+        size="small"
+        @click="submit1"
+        v-click-once
+        >提交并发布</el-button
+      >
+      <el-button size="small" @click="cancel">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+<script>
+  import {
+    getModelPage,
+    getProcessDefinitionBpmnXML,
+    getProcessDefinitionInfo,
+    getTaskAssignRuleList,
+    listAllUserBind,
+    listSimpleUserGroups,
+    processInstanceCreateAPI,
+    getProduceTreeByCode,
+    produceroutingRelease
+  } from './api';
+  import { treeClassifyCodeEnum } from '@/enum/dict';
+  import { listRoles } from '@/api/system/role';
+  import { listOrganizations } from '@/api/system/organization';
+  import dictMixins from '@/mixins/dictMixins';
+  import { getByCode } from '@/api/system/dictionary-data';
+
+  export default {
+    name: 'processSubmitDialog',
+    mixins: [dictMixins],
+    props: {
+      processSubmitDialogFlag: {
+        type: Boolean,
+        default: false
+      },
+      isNotNeedProcess: {
+        type: Boolean,
+        default: false
+      },
+      approvalStatus: {
+        type: Number,
+        default: 2
+      },
+      apiFunName: {
+        type: String,
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          LCFL: '',
+          FQLC: '',
+          processDefinitionId: '',
+          name: '',
+          businessId: '',
+          noticeScope: [],
+          businessKey: '',
+          formCreateUserId: ''
+        },
+        produceroutingRelease,
+        active: 0,
+        bpmnXML: null,
+        LCFLList: [],
+        processList: [],
+        datasource: [],
+        roleOptions: [],
+        deptOptions: [],
+        deptTreeOptions: [],
+        postOptions: [],
+        userOptions: [],
+        userGroupOptions: [],
+        dictList: {},
+        rules: {}
+      };
+    },
+    async created() {
+      let typeObj = await getProduceTreeByCode('PROCESS001');
+      this.LCFLList = typeObj[0].children;
+
+      // 获得角色列表
+      this.roleOptions = [];
+      listRoles({
+        current: 1,
+        size: 9999
+      }).then((data) => {
+        this.roleOptions.push(...data.list);
+      });
+      // 获得部门列表
+      this.deptOptions = [];
+      this.deptTreeOptions = [];
+      listOrganizations().then((data) => {
+        this.deptOptions.push(...data);
+        this.deptTreeOptions.push(...this.handleTree(data, 'id'));
+      });
+      // 获得岗位列表 暂无岗位概念
+      this.postOptions = [];
+      /*listSimplePosts().then(response => {
+    this.postOptions.push(...response.data);
+  });*/
+      // 获得用户列表
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+      // 获得用户组列表
+      this.userGroupOptions = [];
+      listSimpleUserGroups().then((response) => {
+        this.userGroupOptions.push(...response);
+      });
+
+      //this.dictEnum['工作流任务分配自定义脚本']
+      await this.getDictList(this.dictEnum['工作流任务分配自定义脚本']);
+      await this.getDictList(this.dictEnum['工种类型']);
+    },
+    methods: {
+      init(row = {}) {
+        this.form = { ...this.form, ...row };
+        // this.form.businessId = row.id;
+        // this.form.businessKey = row.businessKey;
+        // this.form.formCreateUserId = row.createUserId;
+        this.getDefaultInfo(row.businessKey);
+      },
+      async getDefaultInfo(businessKey) {
+        let info = await getProcessDefinitionInfo({ code: businessKey });
+        this.form.LCFL = info?.category;
+        this.form.FQLC = info?.modelId;
+        this.form.name = info?.name;
+        this.form.key = info?.key;
+        this.form.processDefinitionId = info?.id;
+        if (this.form.LCFL) await this.getProcessList(this.form.LCFL);
+        if (this.form.FQLC) {
+          await this.getProcessDefinitionBpmnXMLInfo(info.id);
+          await this.getTaskAssignRuleListInfo({
+            modelId: info.modelId,
+            processDefinitionId: info.id
+          });
+        }
+      },
+      async changeLCFL(val) {
+        this.bpmnXML = null;
+        this.form.processDefinitionId = null;
+        this.form.FQLC = null;
+        await this.getProcessList(val);
+      },
+      async getProcessList(val) {
+        let params = {
+          pageNo: 1,
+          pageSize: 999,
+          processTypeId: val
+        };
+        const { list } = await getModelPage(params);
+        this.processList = list.filter((item) => item.processDefinition);
+      },
+      async changeFQLC(val) {
+        if (!val) return;
+        let find = this.processList.find((item) => item.id === val) || {};
+        this.form.name = find.name;
+        this.form.key = find.key;
+        this.form.processDefinitionId = find.processDefinition.id;
+        await this.getProcessDefinitionBpmnXMLInfo(find.processDefinition.id);
+        await this.getTaskAssignRuleListInfo({
+          modelId: find.id,
+          processDefinitionId: find.processDefinition.id
+        });
+      },
+      async getProcessDefinitionBpmnXMLInfo(val) {
+        // 加载流程图
+        this.bpmnXML = await getProcessDefinitionBpmnXML(val);
+      },
+      async getTaskAssignRuleListInfo(find) {
+        this.datasource = await getTaskAssignRuleList({
+          modelId: find.modelId,
+          processDefinitionId: find.processDefinitionId
+        });
+      },
+      getAssignRuleOptionName(row, option) {
+        if (row.type == 10) {
+          for (const roleOption of this.roleOptions) {
+            if (roleOption.id === option) {
+              return roleOption.name;
+            }
+          }
+        } else if (row.type === 20 || row.type === 21) {
+          for (const deptOption of this.deptOptions) {
+            if (deptOption.id === option) {
+              return deptOption.name;
+            }
+          }
+        } else if (row.type === 22) {
+          option = option + ''; // 转换成 string
+          return this.getDictV(this.dictEnum['工种类型'], option);
+        } else if (row.type === 30 || row.type === 31 || row.type === 32) {
+          for (const userOption of this.userOptions) {
+            if (userOption.id === option) {
+              return userOption.nickname || userOption.name;
+            }
+          }
+        } else if (row.type === 40) {
+          for (const userGroupOption of this.userGroupOptions) {
+            if (userGroupOption.id === option) {
+              return userGroupOption.name;
+            }
+          }
+        } else if (row.type === 50) {
+          option = option + ''; // 转换成 string
+          return this.getDictV(
+            this.dictEnum['工作流任务分配自定义脚本'],
+            option
+          );
+        } else if (row.type === 60) {
+          return row.variableName;
+        }
+        return '未知(' + option + ')';
+      },
+      /**
+       * 构造树型结构数据
+       * @param {*} data 数据源
+       * @param {*} id id字段 默认 'id'
+       * @param {*} parentId 父节点字段 默认 'parentId'
+       * @param {*} children 孩子节点字段 默认 'children'
+       * @param {*} rootId 根Id 默认 0
+       */
+      handleTree(data, id, parentId, children, rootId) {
+        id = id || 'id';
+        parentId = parentId || 'parentId';
+        children = children || 'children';
+        rootId =
+          rootId ||
+          Math.min.apply(
+            Math,
+            data.map((item) => {
+              return item[parentId];
+            })
+          ) ||
+          0;
+        //对源数据深度克隆
+        const cloneData = JSON.parse(JSON.stringify(data));
+        //循环所有项
+        const treeData = cloneData.filter((father) => {
+          let branchArr = cloneData.filter((child) => {
+            //返回每一项的子级数组
+            return father[id] == child[parentId];
+          });
+          branchArr.length > 0 ? (father.children = branchArr) : '';
+          //返回第一层
+          return father[parentId] == rootId;
+        });
+        return treeData !== '' ? treeData : data;
+      },
+      getDictV(code, val) {
+        if (!this.dictList[code]) return '';
+        return this.dictList[code].find((item) => item.value == val)?.label;
+      },
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList[code] = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: values[0],
+            label: item[values[0]]
+          };
+        });
+      },
+      async submit() {
+        await processInstanceCreateAPI(this.form);
+        this.$message('提交审核成功');
+        this.$emit('reload');
+        this.cancel();
+      },
+      async submit1() {
+        let params = {
+          id: this.form.businessId,
+          approvalStatus: this.approvalStatus,
+          ...this.form
+        };
+        await this[this.apiFunName](params);
+        //await processInstanceUpdateStatusAPI(params);
+        this.$message('提交发布成功');
+        this.$emit('reload');
+        this.cancel();
+      },
+      cancel() {
+        this.$emit('update:processSubmitDialogFlag', false);
+      }
+    }
+  };
+</script>
+<style scoped lang="scss"></style>

+ 285 - 250
src/views/technology/route/components/user-detail.vue

@@ -1,270 +1,305 @@
 <!-- 用户编辑弹窗 -->
 <template>
-    <ele-modal width="1060px" :visible="visible" :append-to-body="true" :close-on-click-modal="false"
-        custom-class="ele-dialog-form" title="修改工艺详情" @update:visible="updateVisible" :maxable="true">
-        <header-title title="基本信息"> </header-title>
-        <el-form ref="form" :model="form" :rules="rules" label-width="140px">
-            <el-row>
-                <el-col :span="8">
-                    <el-form-item label="工艺路线编码:" prop="code">
-                        {{ form.code }}
-                    </el-form-item>
-                </el-col>
-
-                <el-col :span="8">
-                    <el-form-item label="工艺路线组名称:" prop="name">
-                        {{ form.name }}
-                    </el-form-item>
-                </el-col>
-                <el-col :span="8">
-                    <el-form-item label="所属工厂:" prop="factoryId">
-                        <el-select v-model="form.factoryId" placeholder="请选择" filterable disabled>
-                            <el-option v-for="item in fList" :key="item.id" :label="item.name" :value="item.id">
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
-
-                <el-col :span="8">
-                    <el-form-item label="工艺类型:" prop="produceVersionId">
-                        <el-select v-model="form.produceVersionId" filterable placeholder="请选择" :style="{ width: '100%' }"
-                            disabled>
-                            <el-option v-for="item in versionList" :key="item.code" :label="item.code + '-' + item.name"
-                                :value="item.id">
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
-
-
-                <el-col :span="8">
-                    <el-form-item label="工艺路线版本:" prop="version">
-                        {{ form.version }}
-                    </el-form-item>
-                </el-col>
-                <el-col :span="8">
-                    <el-form-item label="状态:" prop="status">
-                        <el-select v-model="form.status" placeholder="" filterable disabled>
-                            <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value">
-                            </el-option>
-                        </el-select>
-                    </el-form-item>
-                </el-col>
-
-
-            </el-row>
-
-        </el-form>
-
-        <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="datasource" row-key="id">
-            <template v-slot:orderNum="{ row }">
-                {{ row.orderNum }}
-            </template>
-
-
-        </ele-pro-table>
-
-        <template v-slot:footer>
-            <el-button type="primary" @click="save">
-                确定
-            </el-button>
-
-
-        </template>
-
-
-
-
-
-
-    </ele-modal>
+  <ele-modal
+    width="80%"
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="工艺详情"
+    @update:visible="updateVisible"
+    :maxable="true"
+  >
+    <!-- <header-title title="基本信息"> </header-title> -->
+    <div class="switch">
+      <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
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="140px"
+      v-if="activeComp == 'main'"
+    >
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="工艺路线编码:" prop="code">
+            {{ form.code }}
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="工艺路线组名称:" prop="name">
+            {{ form.name }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="所属工厂:" prop="factoryId">
+            <el-select
+              v-model="form.factoryId"
+              placeholder="请选择"
+              filterable
+              disabled
+            >
+              <el-option
+                v-for="item in fList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="工艺类型:" prop="produceVersionId">
+            <el-select
+              v-model="form.produceVersionId"
+              filterable
+              placeholder="请选择"
+              :style="{ width: '100%' }"
+              disabled
+            >
+              <el-option
+                v-for="item in versionList"
+                :key="item.code"
+                :label="item.code + '-' + item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="工艺路线版本:" prop="version">
+            {{ form.version }}
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="状态:" prop="status">
+            <el-select v-model="form.status" placeholder="" filterable disabled>
+              <el-option
+                v-for="item in statusList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <ele-pro-table
+      ref="table"
+      :needPage="false"
+      :columns="columns"
+      :datasource="datasource"
+      row-key="id"
+      v-if="activeComp == 'main'"
+    >
+      <template v-slot:orderNum="{ row }">
+        {{ row.orderNum }}
+      </template>
+    </ele-pro-table>
+    <bpmDetail
+      v-if="activeComp == 'bpm' && form.processInstanceId"
+      :id="form.processInstanceId"
+    ></bpmDetail>
+
+    <template v-slot:footer>
+      <el-button @click="close"> 返回 </el-button>
+    </template>
+  </ele-modal>
 </template>
-  
-<script>
 
-import route from '@/api/technology/route';
-import { pageList } from '@/api/technology/version/version.js';
+<script>
+  import route from '@/api/technology/route';
+  import { pageList } from '@/api/technology/version/version.js';
+  import bpmDetail from '@/views/bpm/processInstance/businessDetail.vue';
 
-export default {
+  export default {
     components: {
-
+      bpmDetail
     },
     props: {
-        // 弹窗是否打开
-        visible: Boolean,
-        // 修改回显的数据
-        data: Object
+      // 弹窗是否打开
+      visible: Boolean,
+      // 修改回显的数据
+      data: Object
     },
     data() {
-        const defaultForm = {
-            code: '',
-            name: '',
-            factoryId: '',
-            status: -1,
-            categoryId: '',
-            produceVersionId: '',
-            version: '1.0',
-            id: '',
-
-        };
-        return {
-            defaultForm,
-            fList: [], //仓库列表
-
-            // 表单数据
-            form: { ...defaultForm },
-
-            statusList: [
-                { label: '草稿', value: -1 },
-                { label: '失效', value: 0 },
-                { label: '生效', value: 1 }
-            ],
-
-            // 表单验证规则
-            rules: {
-
-
-            },
-            versionList: [],
-            // 提交状态
-            loading: false,
-            // 是否是修改
-            isUpdate: false,
-
-            columns: [
-
-                {
-                    prop: 'orderNum',
-                    label: '排序',
-                    align: 'center',
-                    slot: 'orderNum',
-                    minWidth: 120
-                },
-                {
-                    prop: 'code',
-                    label: '工序编码',
-                    // sortable: 'custom',
-                    showOverflowTooltip: true,
-                    align: 'center',
-                    minWidth: 110
-                },
-
-
-                {
-                    prop: 'name',
-                    label: '工序名称',
-                    showOverflowTooltip: true,
-                    align: 'center',
-                    minWidth: 110
-                },
-                {
-                    align: 'center',
-                    prop: 'controlName',
-                    label: '工序控制码',
-                    showOverflowTooltip: true,
-                    minWidth: 110
-                },
-                {
-                    prop: 'workCenterName',
-                    label: '所属工作中心',
-                    align: 'center',
-                    showOverflowTooltip: true,
-                    minWidth: 110
-                },
-
-
-            ],
-
-
-        };
+      const defaultForm = {
+        code: '',
+        name: '',
+        factoryId: '',
+        status: -1,
+        categoryId: '',
+        produceVersionId: '',
+        version: '1.0',
+        id: '',
+        processInstanceId:''
+      };
+      return {
+        activeComp: 'main',
+        tabOptions: [
+          { key: 'main', name: '详情' },
+          { key: 'bpm', name: '审批流程' }
+        ],
+        defaultForm,
+        fList: [], //仓库列表
+
+        // 表单数据
+        form: { ...defaultForm },
+
+        statusList: [
+          { label: '草稿', value: -1 },
+          { label: '失效', value: 0 },
+          { label: '生效', value: 1 }
+        ],
+
+        // 表单验证规则
+        rules: {},
+        versionList: [],
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false,
+
+        columns: [
+          {
+            prop: 'orderNum',
+            label: '排序',
+            align: 'center',
+            slot: 'orderNum',
+            minWidth: 120
+          },
+          {
+            prop: 'code',
+            label: '工序编码',
+            // sortable: 'custom',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'name',
+            label: '工序名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            align: 'center',
+            prop: 'controlName',
+            label: '工序控制码',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'workCenterName',
+            label: '所属工作中心',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          }
+        ]
+      };
     },
     computed: {
-
-        // 是否开启响应式布局
-        styleResponsive() {
-            return this.$store.state.theme.styleResponsive;
-        }
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
     },
-    
-    methods: {
-        
-
-        /* 表格数据源 */
-        async datasource(id) {
-            console.log(111111);
-           
-            if (this.data.id) {
-                const res = await route.taskinstanceList({
-                    routingId: this.data.id,
-                    isDetail: true,
-                    pageNum: 1,
-                    size: -1
-                });
-
-                let arr = res.list.map((it) => {
-                    it.detail.orderNum = it.orderNum
-                    return it.detail
-                });
-                return {
-                    list: arr,
-                };
-            }
-        },
-
-
-        /* 保存编辑 */
-        save() { 
-            this.$emit('close')
-        },
-
-        async getVersionList() {
-            
-            const res = await pageList({
-                pageNum: 1,
-                size: 100
-            });
-
-            this.versionList = res.list;
-        },
-
-
-        /* 更新visible */
-        updateVisible(value) {
-            this.$emit('update:visible', value);
-        },
-
-
 
+    methods: {
+      /* 表格数据源 */
+      async datasource(id) {
+        console.log(111111);
+
+        if (this.data.id) {
+          const res = await route.taskinstanceList({
+            routingId: this.data.id,
+            isDetail: true,
+            pageNum: 1,
+            size: -1
+          });
+
+          let arr = res.list.map((it) => {
+            it.detail.orderNum = it.orderNum;
+            return it.detail;
+          });
+          return {
+            list: arr
+          };
+        }
+      },
+
+      /* 保存编辑 */
+      close() {
+        this.$emit('close');
+      },
+
+      async getVersionList() {
+        const res = await pageList({
+          pageNum: 1,
+          size: 100
+        });
+
+        this.versionList = res.list;
+      },
+
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      }
     },
 
     watch: {
-        async visible(visible) {
-
-            if (visible) {
-                
-                this.datasource();
-                this.getVersionList()
-
-                const res = await route.Flist({
-                    pageNum: 1,
-                    size: -1,
-                    type: 1
-                });
-                this.fList = res.list;
-                
-                if (this.data) {
-                    const res = await route.getById(this.data.id);
-                    this.$util.assignObject(this.form, {
-                        ...res
-                    });
+      async visible(visible) {
+        if (visible) {
+          this.activeComp = 'main';
+          this.datasource();
+          this.getVersionList();
+
+          const res = await route.Flist({
+            pageNum: 1,
+            size: -1,
+            type: 1
+          });
+          this.fList = res.list;
+
+          if (this.data) {
+            const res = await route.getById(this.data.id);
+            this.$util.assignObject(this.form, {
+              ...res
+            });
+            console.log(this.form,'')
 
-                    this.isUpdate = true;
-                }
-            } else {
-                this.$refs.form.clearValidate();
-                this.form = { ...this.defaultForm };
-            }
+            this.isUpdate = true;
+          }
+        } else {
+          this.$refs.form.clearValidate();
+          this.form = { ...this.defaultForm };
         }
+      }
     }
-};
-</script>
+  };
+</script>

+ 55 - 4
src/views/technology/route/index.vue

@@ -68,9 +68,19 @@
             :underline="false"
             icon="el-icon-edit"
             @click="openEdit(row)"
+            v-if="[0, 3].includes(row.approvalStatus)"
           >
             修改
           </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="approve(row)"
+            v-if="[0, 3].includes(row.approvalStatus)"
+          >
+            发布
+          </el-link>
 
           <el-link
             type="primary"
@@ -82,7 +92,7 @@
           </el-link>
 
           <el-popconfirm
-            v-if="row.status != 1"
+            v-if="row.status != 1 && [0, 3].includes(row.approvalStatus)"
             class="ele-action"
             title="确定要删除当前工序吗?"
             @confirm="remove(row)"
@@ -113,6 +123,16 @@
       @close="detailEdit = false"
       ref="UserDetailRef"
     ></UserDetail>
+    <process-submit-dialog
+      api-fun-name="purchaseinquiryStatusAPI"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      :isNotNeedProcess="true"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+      :apiFunName="'produceroutingRelease'"
+
+    ></process-submit-dialog>
   </div>
 </template>
 
@@ -123,6 +143,9 @@
   import UserDetail from './components/user-detail.vue';
   import historyModal from './components/historyModal.vue';
   import route from '@/api/technology/route';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
+  import { reviewStatus } from '@/enum/dict';
+
   export default {
     name: 'technologyRoute',
     mixins: [tabMixins],
@@ -130,7 +153,8 @@
       UserSearch,
       UserEdit,
       UserDetail,
-      historyModal
+      historyModal,
+      processSubmitDialog
     },
     data() {
       return {
@@ -199,7 +223,16 @@
             filterMultiple: false,
             columnKey: 'status'
           },
-
+          {
+            prop: 'approvalStatus',
+            label: '审核状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100,
+            formatter: (_row, _column, cellValue) => {
+              return reviewStatus[_row.approvalStatus];
+            }
+          },
           {
             prop: 'factoriesName',
             label: '所属工厂',
@@ -217,7 +250,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 220,
+            width: 280,
             align: 'left',
             resizable: false,
             slot: 'action'
@@ -228,6 +261,7 @@
         selection: [],
         // 当前编辑数据
         current: null,
+        processSubmitDialogFlag: false,
         // 是否显示编辑弹窗
         showEdit: false,
         detailEdit: false,
@@ -333,7 +367,24 @@
           })
           .catch(() => {});
       },
+      approve(res) {
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: res.id,
+            businessKey: 'routing_approve',
+            formCreateUserId: res.createUserId,
+            routingId:res.id,
+            variables: {
+              businessCode: res.code,
+              businessName: res.name,
+              businessType: ' 版本:' + res.version
+            }
+          };
 
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
       // 刷新数据
       refreshData() {
         this.loading = true;