yusheng 1 rok pred
rodič
commit
6ea430691c

+ 127 - 0
src/api/bpm/components/technology/route.js

@@ -0,0 +1,127 @@
+import request from '@/utils/request';
+
+export default {
+  //列表
+  list: async (params) => {
+    const res = await request.get('/main/producerouting/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //厂房列表
+  Flist: async (params) => {
+    const res = await request.get('/main/factoryarea/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+
+  //工艺路线工序参数实例-分页
+  taskinstanceParamList: async (params) => {
+    const res = await request.get('/main/producerouting/param/page', {
+      params
+    });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+
+  //工艺路线工序参数实例-保存
+  taskinstanceParamSave: async (data) => {
+    const res = await request.post('/main/producerouting/param/save', data);
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+
+  //工艺路线工序实例-分页
+  taskinstanceList: async (data) => {
+    const res = await request.post(
+      '/main/producerouting/taskinstance/page',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //工艺路线工序实例-保存
+  taskinstanceSave: async (data) => {
+    const res = await request.post(
+      '/main/producerouting/taskinstance/save',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+  //工艺路线工序实例-删除
+  taskinstanceDelete: async (data) => {
+    const res = await request.delete(
+      '/main/producerouting/taskinstance/delete',
+      { data }
+    );
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+  //获取工艺所属参数列表
+  paramList: async (params) => {
+    const res = await request.get('/main/producetask/param/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //保存工艺所属参数列表
+  paramSave: async (data) => {
+    const res = await request.post('/main/producetask/param/save', data);
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+  //详情
+  getById: async (id) => {
+    const res = await request.get(`/main/producerouting/getById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //详情
+  getCode: async () => {
+    const res = await request.get(`/main/codemanage/getCode/process_route`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //保存
+  save: async (data) => {
+    const res = await request.post('/main/producerouting/save', data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  //删除
+  delete: async (data) => {
+    const res = await request.delete('/main/producerouting/delete/' + data);
+    if (res.data.code == 0) {
+      return res.data.message;
+    }
+  },
+
+  syncRouting: async () => {
+    const res = await request.get(`/sap/sync/syncRouting`);
+    if (res.data.code == 0) {
+      return res.data.code;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  // 通过工艺路线查询工序
+  getProcessById: async (data) => {
+    const res = await request.post(
+      '/main/producerouting/taskinstance/listByRoutingIds',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  }
+};

+ 92 - 0
src/api/bpm/components/technology/version.js

@@ -0,0 +1,92 @@
+import request from '@/utils/request';
+
+/**
+ * 分页查询用户
+ * @param params 查询条件
+ */
+export async function pageList(params) {
+  let par = new URLSearchParams(params);
+  const res = await request.get(
+    `/main/produceversion/page?` + par,
+    params
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取工艺类型详情
+export async function versionDetail(id) {
+  const res = await request.get(`/main/produceversion/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 工艺类型新增、编辑
+export async function versionSave(data) {
+  const res = await request.post('/main/produceversion/save', data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+}
+
+
+// 删除
+export async function removeItem(data) {
+  const res = await request.delete('/main/produceversion/delete', {
+    data
+  });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+
+}
+
+
+
+
+
+
+// 根据工艺路线编码获取工序
+export async function getProcessByRoute(data) {
+  const res = await request.post('/main/producerouting/taskinstance/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 查询物料关联BOM子项列表
+export async function getBomSubList(data) {
+  const res = await request.get('/main/produceversion/resource/bomSubList', {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 保存bom子项列表 
+export async function saveBomList(data) {
+  const res = await request.post('/main/produceversion/resource/save', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 工艺类型同步
+export async function syncVersion(data) {
+  const res = await request.get('/sap/sync/syncVersion');
+  if (res.data.code == 0) {
+    return res.data.code;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 136 - 0
src/views/bpm/handleTask/components/technology/route/submit.vue

@@ -0,0 +1,136 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item label="审批建议" style="margin-bottom: 20px">
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        >驳回
+      </el-button>
+
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import { cancel } from '@/api/bpm/components/supplierManage/contact';
+  import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {
+      //   Parser
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          technicianId: '',
+          reason: ''
+        }
+      };
+    },
+
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+
+      async handleAudit(status) {
+        await this._approveTaskWithVariables(status);
+      },
+      async _approveTaskWithVariables(status) {
+        let variables = {
+          pass: !!status
+        };
+        let API = !!status ? approveTaskWithVariables : rejectTask;
+        API({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 217 - 0
src/views/bpm/handleTask/components/technology/route/user-detail.vue

@@ -0,0 +1,217 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <div>
+    <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>
+  </div>
+</template>
+
+<script>
+  import route from '@/api/bpm/components/technology/route.js';
+  import { pageList } from '@/api/bpm/components/technology/version.js';
+
+  export default {
+    components: {},
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      }
+    },
+    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: [],
+        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
+          }
+        ]
+      };
+    },
+    async created() {
+      this.datasource();
+      this.getVersionList();
+      const res = await route.Flist({
+        pageNum: 1,
+        size: -1,
+        type: 1
+      });
+      this.fList = res.list;
+      const data = await route.getById(this.businessId);
+      this.$util.assignObject(this.form, {
+        ...data
+      });
+    },
+    methods: {
+      /* 表格数据源 */
+      async datasource(id) {
+        if (this.businessId) {
+          const res = await route.taskinstanceList({
+            routingId: this.businessId,
+            isDetail: true,
+            pageNum: 1,
+            size: -1
+          });
+
+          let arr = res.list.map((it) => {
+            it.detail.orderNum = it.orderNum;
+            return it.detail;
+          });
+          return {
+            list: arr
+          };
+        }
+      },
+
+      async getVersionList() {
+        const res = await pageList({
+          pageNum: 1,
+          size: 100
+        });
+
+        this.versionList = res.list;
+      }
+    }
+  };
+</script>