Kaynağa Gözat

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt

xieyong 2 gün önce
ebeveyn
işleme
b2ee88b876

+ 10 - 0
src/api/bpm/components/stockBatchChange/index.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request';
+
+/** 查询库存拆合批申请详情。 */
+export async function getStockBatchChangeDetail(id) {
+  const res = await request.get(`/wms/stockBatchChangeApprove/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 220 - 0
src/views/bpm/handleTask/components/stockBatchChange/detailDialog.vue

@@ -0,0 +1,220 @@
+<template>
+  <div v-loading="loading" class="stock-batch-change-detail">
+    <el-descriptions :column="3" border size="small">
+      <el-descriptions-item label="审核代码">
+        {{ formData.changeNo || '-' }}
+      </el-descriptions-item>
+      <el-descriptions-item label="变更类型">
+        {{ changeTypeText(formData.changeType) }}
+      </el-descriptions-item>
+      <el-descriptions-item label="审批状态">
+        <el-tag :type="statusType(formData.verifyStatus)" size="small">
+          {{ statusText(formData.verifyStatus) }}
+        </el-tag>
+      </el-descriptions-item>
+      <el-descriptions-item label="当前审批人">
+        {{ formData.currentApproverName || '-' }}
+      </el-descriptions-item>
+      <el-descriptions-item label="仓库">
+        {{ formData.warehouseName || '-' }}
+      </el-descriptions-item>
+      <el-descriptions-item label="申请时间">
+        {{ formData.createTime || '-' }}
+      </el-descriptions-item>
+      <el-descriptions-item label="执行状态">
+        {{ formData.executeStatus === 2 ? '已执行' : '未执行' }}
+      </el-descriptions-item>
+      <el-descriptions-item label="申请说明" :span="3">
+        {{ formData.remark || '-' }}
+      </el-descriptions-item>
+    </el-descriptions>
+
+    <div class="section-title">批次变更明细</div>
+    <el-table
+      :data="formData.details || []"
+      border
+      size="mini"
+      max-height="420"
+    >
+      <el-table-column type="index" label="序号" width="55" align="center" />
+      <el-table-column
+        prop="systemBatchNo"
+        label="来源系统批次号"
+        min-width="145"
+        show-overflow-tooltip
+      >
+        <template slot-scope="{ row }">{{ displayValue(row.systemBatchNo) }}</template>
+      </el-table-column>
+      <el-table-column
+        prop="batchNo"
+        label="业务批次号"
+        min-width="120"
+        show-overflow-tooltip
+      >
+        <template slot-scope="{ row }">{{ displayValue(row.batchNo) }}</template>
+      </el-table-column>
+      <el-table-column prop="warehouseName" label="仓库名称" min-width="120" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.warehouseName || formData.warehouseName) }}</template>
+      </el-table-column>
+      <el-table-column prop="categoryCode" label="物品编码" min-width="120" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.categoryCode) }}</template>
+      </el-table-column>
+      <el-table-column prop="categoryName" label="物品名称" min-width="120" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.categoryName) }}</template>
+      </el-table-column>
+      <el-table-column prop="specification" label="规格" min-width="100" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.specification) }}</template>
+      </el-table-column>
+      <el-table-column prop="categoryModel" label="型号" min-width="100" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.categoryModel) }}</template>
+      </el-table-column>
+      <el-table-column prop="brandNum" label="牌号" min-width="100" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.brandNum) }}</template>
+      </el-table-column>
+      <el-table-column prop="colorKey" label="颜色" min-width="100" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.colorKey) }}</template>
+      </el-table-column>
+      <el-table-column prop="unitPrice" label="单价" min-width="100">
+        <template slot-scope="{ row }">{{ displayValue(row.unitPrice) }}</template>
+      </el-table-column>
+      <el-table-column prop="supplierName" label="供应商名称" min-width="130" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.supplierName) }}</template>
+      </el-table-column>
+      <el-table-column prop="supplierCode" label="供应商代号" min-width="120" show-overflow-tooltip>
+        <template slot-scope="{ row }">{{ displayValue(row.supplierCode) }}</template>
+      </el-table-column>
+      <el-table-column label="目标批次" min-width="145" show-overflow-tooltip>
+        <template slot-scope="{ row }">
+          {{ displayValue(row.targetSystemBatchNo || targetText(row)) }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="measureQuantity" label="计量数量" width="105">
+        <template slot-scope="{ row }">{{ displayValue(row.measureQuantity) }}</template>
+      </el-table-column>
+      <el-table-column prop="packageQuantity" label="包装数量" width="105">
+        <template slot-scope="{ row }">{{ displayValue(row.packageQuantity) }}</template>
+      </el-table-column>
+      <el-table-column prop="weight" label="重量" width="95">
+        <template slot-scope="{ row }">{{ displayValue(row.weight) }}</template>
+      </el-table-column>
+      <el-table-column prop="lockQuantity" label="锁库数量" width="105">
+        <template slot-scope="{ row }">{{ displayValue(row.lockQuantity) }}</template>
+      </el-table-column>
+      <el-table-column label="整包装分配" min-width="150" show-overflow-tooltip>
+        <template slot-scope="{ row }">
+          {{ formatPackingIds(row.packingStockIds) }}
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="锁定明细分配"
+        min-width="190"
+        show-overflow-tooltip
+      >
+        <template slot-scope="{ row }">
+          {{ formatLockAllocations(row.lockAllocations) }}
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+  import { getStockBatchChangeDetail } from '@/api/bpm/components/stockBatchChange';
+
+  export default {
+    name: 'StockBatchChangeDetail',
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        loading: false,
+        formData: {}
+      };
+    },
+    watch: {
+      businessId: {
+        immediate: true,
+        handler(id) {
+          if (id) {
+            this.getInfo(id);
+          }
+        }
+      }
+    },
+    methods: {
+      /** 加载审批业务快照,审批中不读取实时库存替换申请数据。 */
+      async getInfo(id) {
+        this.loading = true;
+        try {
+          this.formData = (await getStockBatchChangeDetail(id)) || {};
+        } finally {
+          this.loading = false;
+        }
+      },
+      changeTypeText(value) {
+        return { 1: '拆批', 2: '合批' }[value] || '-';
+      },
+      statusText(value) {
+        return (
+          { 0: '未提交', 1: '审批中', 2: '已通过', 3: '已驳回', 4: '已撤回' }[
+            value
+          ] || '-'
+        );
+      },
+      statusType(value) {
+        return value === 2 ? 'success' : value === 3 ? 'danger' : 'info';
+      },
+      targetText(row) {
+        return row.targetDetailId
+          ? `目标 ${row.targetDetailId}(审批通过后生成)`
+          : '审批通过后生成';
+      },
+      displayValue(value) {
+        return value == null || value === '' ? '-' : value;
+      },
+      formatPackingIds(value) {
+        const ids = this.parseArray(value);
+        return ids.length ? ids.join('、') : '-';
+      },
+      formatLockAllocations(value) {
+        const allocations = this.parseArray(value);
+        if (!allocations.length) {
+          return '-';
+        }
+        return allocations
+          .map(
+            (item) => `${item.lockOrderDetailId || '-'}:${item.quantity || 0}`
+          )
+          .join(';');
+      },
+      parseArray(value) {
+        if (Array.isArray(value)) {
+          return value;
+        }
+        if (!value) {
+          return [];
+        }
+        try {
+          const result = JSON.parse(value);
+          return Array.isArray(result) ? result : [];
+        } catch (error) {
+          return [];
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .stock-batch-change-detail {
+    min-height: 120px;
+  }
+
+  .section-title {
+    margin: 16px 0 8px;
+    font-weight: 600;
+  }
+</style>

+ 118 - 0
src/views/bpm/handleTask/components/stockBatchChange/submit.vue

@@ -0,0 +1,118 @@
+<template>
+  <el-col :span="16" :offset="6" v-loading="loading">
+    <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
+      <el-form-item label="审批建议" prop="reason" style="margin-bottom: 20px">
+        <el-input
+          v-model="form.reason"
+          type="textarea"
+          :rows="3"
+          maxlength="500"
+          show-word-limit
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div class="actions">
+      <el-button
+        v-click-once
+        type="success"
+        size="mini"
+        icon="el-icon-check"
+        :loading="loading"
+        @click="handleAudit(1)"
+      >
+        通过
+      </el-button>
+      <el-button
+        v-click-once
+        type="danger"
+        size="mini"
+        icon="el-icon-close"
+        :loading="loading"
+        @click="handleAudit(0)"
+      >
+        驳回
+      </el-button>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
+
+  export default {
+    name: 'StockBatchChangeSubmit',
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        loading: false,
+        form: {
+          reason: '同意'
+        },
+        rules: {
+          reason: [
+            {
+              required: true,
+              whitespace: true,
+              message: '请输入审批建议',
+              trigger: 'blur'
+            }
+          ]
+        }
+      };
+    },
+    methods: {
+      /** 校验审批意见后执行当前流程任务。 */
+      handleAudit(status) {
+        this.$refs.formRef.validate((valid) => {
+          if (valid) {
+            this.submitTask(status);
+          }
+        });
+      },
+      async submitTask(status) {
+        const API = status ? approveTaskWithVariables : rejectTask;
+        this.loading = true;
+        try {
+          const payload = {
+            id: this.taskId,
+            reason: this.form.reason
+          };
+          if (status) {
+            payload.variables = { pass: true };
+          }
+          const res = await API(payload);
+          // 仅接口明确返回成功码时关闭处理弹窗并刷新待办。
+          if (res && res.data && (res.data.code === 0 || res.data.code === '0')) {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        } finally {
+          this.loading = false;
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .actions {
+    margin: 0 0 20px 10%;
+    font-size: 14px;
+  }
+</style>

+ 30 - 5
src/views/bpm/handleTask/index.vue

@@ -438,6 +438,32 @@
       });
       });
     },
     },
     methods: {
     methods: {
+      isStockBatchChange() {
+        return (
+          String(this.listData.businessCode || '').startsWith('PCBG') ||
+          String(this.listData.pcViewRouter || '').includes('stockBatchChange') ||
+          String(this.listData.pcViewRouter || '').includes(
+            'warehouseManagement/stockLedger'
+          )
+        );
+      },
+      getBusinessComponentRouter(type) {
+        const router =
+          type === 'view'
+            ? this.listData.pcViewRouter
+            : this.listData.pcHandleRouter;
+        if (this.isStockBatchChange()) {
+          const invalidViewRouter =
+            type === 'view' &&
+            String(router || '').includes('warehouseManagement/stockLedger');
+          if (!router || invalidViewRouter) {
+            return `/bpm/handleTask/components/stockBatchChange/${
+              type === 'view' ? 'detailDialog' : 'submit'
+            }.vue`;
+          }
+        }
+        return router;
+      },
       submit(data) {
       submit(data) {
         this.$refs.bziRef.save(data);
         this.$refs.bziRef.save(data);
       },
       },
@@ -472,13 +498,12 @@
           // const subpath = formCustomCreatePath.pcHandle;
           // const subpath = formCustomCreatePath.pcHandle;
 
 
           Vue.component('async-biz-form-component', (resolve) => {
           Vue.component('async-biz-form-component', (resolve) => {
-            console.log(this.listData.pcViewRouter, '111111');
-            require([`@/views${this.listData.pcViewRouter}`], resolve);
+            const router = this.getBusinessComponentRouter('view');
+            require([`@/views${router}`], resolve);
           });
           });
           Vue.component('async-sub-form-component', (resolve) => {
           Vue.component('async-sub-form-component', (resolve) => {
-            console.log(this.listData.pcHandleRouter, '22222');
-
-            require([`@/views${this.listData.pcHandleRouter}`], resolve);
+            const router = this.getBusinessComponentRouter('handle');
+            require([`@/views${router}`], resolve);
           });
           });
           //   // 设置表单信息
           //   // 设置表单信息
           //   if (this.processInstance.processDefinition.formType === 10) {
           //   if (this.processInstance.processDefinition.formType === 10) {