Jelajahi Sumber

成品放行审批

lucw 8 bulan lalu
induk
melakukan
a71cc2bfc2

+ 10 - 0
src/api/checklistrecord/index.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+// /mes/checklistrecord/getById/{id} 根据ID查询
+export async function checklistrecordGetById(id) {
+  const res = await request.get(`/mes/checklistrecord/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 10 - 0
src/api/checklisttemplate/index.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+// /mes/checklisttemplate/getById/{id}
+export async function checklisttemplateGetById(id) {
+  const res = await request.get(`/mes/checklisttemplate/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 437 - 0
src/views/bpm/handleTask/components/mesWorkOrderChecklist/detailDialog.vue

@@ -0,0 +1,437 @@
+<template>
+  <div style="margin-top: 10px; padding: 0 20px">
+    <el-form
+      ref="formRef"
+      :model="form"
+      :rules="rules"
+      label-width="100px"
+      disabled
+    >
+      <header-title title="基本信息"></header-title>
+
+      <el-row :gutter="10">
+        <el-col :span="8">
+          <el-form-item label="放行单编码">
+            <el-input
+              v-model="form.code"
+              placeholder="系统自动生成"
+              disabled
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="放行单名称" prop="name">
+            <el-input v-model="form.name" placeholder="请输入"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <header-title title="物品清单"> </header-title>
+
+      <ele-pro-table
+        ref="table"
+        row-key="userId"
+        :columns="ordersColumns"
+        :datasource="form.orders"
+      >
+        <template v-slot:action="{ row }">
+          <el-link icon="el-icon-edit" type="primary" :underline="false"
+            >详情</el-link
+          >
+        </template>
+      </ele-pro-table>
+
+      <header-title title="生产放行规则"> </header-title>
+
+      <ele-pro-table
+        ref="scTable"
+        row-key="id"
+        :columns="detailsColumns"
+        :datasource="scDetails"
+      >
+        <template v-slot:isPass="{ row }">
+          <el-radio-group v-model="row.isPass">
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="2">否</el-radio>
+          </el-radio-group>
+        </template>
+        <template v-slot:remark="{ row }">
+          <el-input
+            type="textarea"
+            v-model="row.remark"
+            placeholder="请输入备注"
+            :rows="1"
+          ></el-input>
+        </template>
+      </ele-pro-table>
+
+      <table
+        class="detail-table"
+        key="first-table"
+        style="width: 500px; margin: 15px 0"
+      >
+        <tr>
+          <td>结论</td>
+          <td>
+            <el-radio-group v-model="form.workConclution">
+              <el-radio :label="0">不符合规定</el-radio>
+              <el-radio :label="1">符合规定</el-radio>
+            </el-radio-group>
+          </td>
+        </tr>
+        <tr>
+          <td>验收人</td>
+          <td>
+            <div class="mask-box">
+              <el-input
+                v-model="form.workCheckUserName"
+                placeholder="请输选择验收人"
+                readonly
+              ></el-input>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>验收时间</td>
+          <td>
+            <el-date-picker
+              v-model="form.workCheckTime"
+              type="datetime"
+              placeholder="选择日期时间"
+              style="width: 100%"
+              value-format="yyyy-MM-dd HH:mm:ss"
+            ></el-date-picker>
+          </td>
+        </tr>
+      </table>
+
+      <header-title title="质检放行规则"></header-title>
+
+      <ele-pro-table
+        ref="zjTable"
+        row-key="id"
+        :columns="detailsColumns"
+        :datasource="zjDetails"
+      >
+        <template v-slot:isPass="{ row }">
+          <el-radio-group v-model="row.isPass">
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="2">否</el-radio>
+          </el-radio-group>
+        </template>
+        <template v-slot:remark="{ row }">
+          <el-input
+            type="textarea"
+            v-model="row.remark"
+            placeholder="请输入备注"
+            :rows="1"
+          ></el-input>
+        </template>
+      </ele-pro-table>
+
+      <table
+        class="detail-table"
+        key="tow"
+        style="width: 500px; margin: 15px 0"
+      >
+        <tr>
+          <td>结论</td>
+          <td>
+            <el-radio-group v-model="form.qualityConclution">
+              <el-radio :label="0">不符合规定</el-radio>
+              <el-radio :label="1">符合规定</el-radio>
+            </el-radio-group>
+          </td>
+        </tr>
+        <tr>
+          <td>验收人</td>
+          <td>
+            <div class="mask-box" @click="openSelectUser(1)">
+              <el-input
+                v-model="form.qualityCheckUserName"
+                placeholder="请输选择验收人"
+                readonly
+              ></el-input>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>验收时间</td>
+          <td>
+            <el-date-picker
+              v-model="form.qualityCheckTime"
+              type="datetime"
+              placeholder="选择日期时间"
+              style="width: 100%"
+              value-format="yyyy-MM-dd HH:mm:ss"
+            ></el-date-picker>
+          </td>
+        </tr>
+      </table>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import { checklisttemplateGetById } from '@/api/checklisttemplate/index';
+  import { checklistrecordGetById } from '@/api/checklistrecord/index';
+
+  export default {
+    mixins: [dictMixins],
+    components: {},
+    props: {
+      // 业务id
+      businessId: {
+        default: ''
+      }
+    },
+    mounted() {
+      console.log('this.businessId', this.businessId);
+      this.getCheckDetails(this.businessId);
+    },
+    data() {
+      const formBaseData = {
+        id: null,
+        approvalStatus: null,
+        checklistType: 0,
+        code: '',
+        createUserName: '',
+        details: [],
+        name: '',
+        orders: [],
+        processInstanceId: '',
+        qualityCheckTime: '',
+        qualityCheckUserId: null,
+        qualityCheckUserName: '',
+        qualityConclution: null,
+        templateId: 0,
+        templateName: '',
+        workCheckTime: '',
+        workCheckUserId: null,
+        workCheckUserName: '',
+        workConclution: null
+      };
+
+      return {
+        visible: false,
+        title: '放行申请单',
+        formBaseData,
+        form: JSON.parse(JSON.stringify(formBaseData)),
+        rules: {
+          name: [
+            { required: true, message: '请输入放行单名称', trigger: 'blur' },
+            { required: true, message: '请输入放行单名称', trigger: 'change' }
+          ]
+        },
+        // 类型 add / edit / detail
+        type: '',
+        // 生产工单查询条件
+        workOrderWhere: {
+          statusList: ['6']
+        },
+        loading: false,
+        butLoading: false,
+        tabOptions: [
+          { key: 'main', name: '放行单详情' },
+          { key: 'bpm', name: '流程详情' }
+        ],
+        // 当前选项
+        activeComp: 'main',
+        showSelectUser: false,
+        // 0 生产验收人 1 质检验收人
+        selectUserType: 0
+      };
+    },
+    watch: {
+      'form.details': {
+        handler(details) {
+          console.log('details', details);
+          // 区分生产放行规则 质检放行规则
+          // 根据 审核结果修改 结论
+          const scDetails = details.filter((item) => item.checkType == 1);
+          const zjDetails = details.filter((item) => item.checkType == 2);
+
+          // 当workConclution全为1 则为1 否则为0
+          if (scDetails.length > 0) {
+            const allPass = scDetails
+              .map((item) => item.isPass)
+              .every((val) => val === 1);
+            this.form.workConclution = allPass ? 1 : 0;
+          } else {
+            this.form.workConclution = null;
+          }
+
+          if (zjDetails.length > 0) {
+            const allPass = zjDetails
+              .map((item) => item.isPass)
+              .every((val) => val == 1);
+            this.form.qualityConclution = allPass ? 1 : 0;
+          } else {
+            this.form.qualityConclution = null;
+          }
+        },
+        deep: true
+      }
+    },
+    computed: {
+      ordersColumns() {
+        return [
+          {
+            width: 55,
+            type: 'index',
+            columnKey: 'index',
+            label: '序号',
+            align: 'center'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'workOrderCode',
+            label: '生产工单号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'formingNum',
+            label: '数量',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productModel',
+            label: '型号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            label: '操作',
+            columnKey: 'action',
+            slot: 'action',
+            minWidth: 120
+          }
+        ];
+      },
+      // 生产放行规则
+      scDetails() {
+        return this.form.details.filter((item) => item.checkType == 1);
+      },
+      // 质检放行规则
+      zjDetails() {
+        return this.form.details.filter((item) => item.checkType == 2);
+      },
+      detailsColumns() {
+        return [
+          {
+            width: 55,
+            type: 'index',
+            columnKey: 'index',
+            label: '序号',
+            align: 'center'
+          },
+          {
+            prop: 'mainIndicatorName',
+            label: '指标名称',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'isPass',
+            label: '审核结果',
+            align: 'center',
+            slot: 'isPass',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'remark',
+            label: '备注',
+            align: 'center',
+            slot: 'remark',
+            minWidth: 110,
+            showOverflowTooltip: true
+          }
+        ];
+      }
+    },
+    methods: {
+      // 获取放行单详情
+      async getCheckDetails(id) {
+        this.loading = true;
+        try {
+          const data = await checklistrecordGetById(id);
+          this.$util.assignObject(this.form, data);
+          console.log('this.form', this.form);
+          this.loading = false;
+        } catch (error) {
+          this.loading = false;
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .detail-table {
+    border: 1px solid #ebeef5;
+    // 实线边框
+    border-collapse: collapse;
+
+    td {
+      border: none;
+      padding: 10px 15px;
+      border: 1px solid #ebeef5;
+
+      &:first-child {
+        font-weight: 600;
+        background: #f5f7fa;
+        width: 130px;
+        text-align: center;
+      }
+    }
+  }
+
+  .mask-box {
+    position: relative;
+    &::after {
+      content: '';
+      width: 100%;
+      height: 100%;
+      position: absolute;
+      top: 0;
+      left: 0;
+      background: rgba(0, 0, 0, 0);
+      cursor: pointer;
+    }
+  }
+</style>

+ 155 - 0
src/views/bpm/handleTask/components/mesWorkOrderChecklist/submit.vue

@@ -0,0 +1,155 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="审批建议"
+
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <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 { UpdateInformation, cancel } from '@/api/bpm/components/contractManage/contractBook';
+  import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
+  import { listAllUserBind } from '@/api/system/organization';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {
+      //   Parser
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          technicianId: '',
+          reason: ''
+        },
+        userOptions: []
+      };
+    },
+    created() {
+
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+    },
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+
+
+      async handleAudit(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 ? '驳回' : ''
+            });
+          }
+        });
+      },
+
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
+          });
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm("是否确认作废?", {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          }).then(() => {
+            cancelTask({
+              id: this.id,
+              taskId: this.taskId,
+              reason: this.form.reason,
+              businessId: this.businessId,
+            }).then(() => {
+              this.$emit('handleClose');
+            }).catch(() => {
+              this.$message.error("流程作废失败");
+            });
+          }).catch(() => {});
+        }
+      },
+
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 2 - 1
vue.config.js

@@ -39,10 +39,11 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.105:18086',
 
-        target: 'http://192.168.1.251:18186',
+        // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.125:18086',
 
         // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.116:18086', // 赵沙金
 
         changeOrigin: true, // 只有这个值为true的情况下 s才表示开启跨域
         pathRewrite: {