Forráskód Böngészése

不良品列表;

yijing 1 éve
szülő
commit
c9702ea774

+ 127 - 0
src/api/unacceptedProduct/index.js

@@ -0,0 +1,127 @@
+import request from '@/utils/request';
+
+
+/**
+ * 不合格品台账列表
+ */
+export async function getList(data) {
+  const res = await request.post('/mes/unqualified_products/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 不合格品台账列表详情
+ */
+export async function getDetail(data) {
+  const res = await request.get('/mes/unqualified_products_detail/query/' + data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//不合格品新建/修改
+export async function unqualifiedProductsAdd(data) {
+  const res = await request.post('/mes/unqualified_products/' + (data.id ? 'update' : 'add'), data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//不合格品处置
+export async function dispose(data) {
+  const res = await request.post('mes/unqualified_products_detail/dispose', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除
+export async function deleteUnacceptedProduct(data) {
+  const res = await request.delete('/mes/unqualified_products/delete/' + data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除详情
+export async function deleteUnacceptedProductDetail(data) {
+  const res = await request.delete('/mes/unqualified_products_detail/delete', { data });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 返工返修台账
+ */
+export async function getReworkList(data) {
+  const res = await request.post('/mes/return_repair_work/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除返工返修台账
+export async function deleteReworkList(data) {
+  const res = await request.delete('/mes/return_repair_work/delete' , {data});
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// // 下达
+// export async function releaseWorkOrder({ id, teamId }) {
+//   const res = await request.get(
+//     `/aps/workorder/releaseWorkOrder/${id}/${teamId}`
+//   );
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+/**
+ * 返工返修转换
+ */
+ export async function transformation(data,type) {
+  const res = await request.post('/mes/return_repair_work/transformation?type='+type, data);
+    return res.data
+  
+}
+/**
+ * 试销品台账
+ */
+ export async function trialProducts(data) {
+  const res = await request.post('/mes/trial_products/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除试销品台账
+export async function deleteTrialProducts(data) {
+  const res = await request.delete('/mes/trial_products/delete' , {data});
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 报废品台账
+ */
+ export async function scrapProducts(data) {
+  const res = await request.post('/mes/scrap_products/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 删除报废品台账
+export async function deleteScrapProducts(data) {
+  const res = await request.delete('/mes/scrap_products/delete' , {data});
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 186 - 0
src/components/ProductionVersion/ProductionVersion.vue

@@ -0,0 +1,186 @@
+<template>
+  <el-dialog title="选择工艺路线" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="true"
+    :close-on-press-escape="false" append-to-body width="80%">
+    <el-card shadow="never">
+
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
+        class="dict-table" @cell-click="cellClick">
+        <!-- 表头工具栏 -->
+
+        
+
+        <template v-slot:status="{ row }">
+          {{ checkStatus(row) }}
+        </template>
+
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+        </template>
+      </ele-pro-table>
+
+    </el-card>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+
+
+import { routeList } from '@/api/aps';
+// import productionSearch from './production-search.vue'
+export default {
+  components: { 
+    // productionSearch
+    },
+  data() {
+    return {
+      visible: false,
+      // 表格列配置
+      columns: [
+        {
+          prop: 'code',
+          label: '工艺路线组编码',
+          // sortable: 'custom',
+          showOverflowTooltip: true,
+          align: 'center',
+
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '工艺路线名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+
+
+        {
+          prop: 'version',
+          label: '工艺路线版本',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          prop: 'produceVersionName',
+          label: '生产版本',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          slot: 'status',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          action: 'action',
+          slot: 'action',
+          align: 'center',
+          label: '选择'
+        }
+      ],
+      statusList: [
+        { label: '草稿', value: -1 },
+        { label: '失效', value: 0 },
+        { label: '生效', value: 1 }
+      ],
+      categoryLevelId: '9',
+      radio: null
+    }
+  },
+
+  watch: {
+
+  },
+  methods: {
+
+    checkStatus(row) {
+      let obj = this.statusList.find((it) => it.value == row.status);
+      return obj.label;
+    },
+    /* 表格数据源 */
+    datasource({ page, where, limit }) {
+      return routeList({
+        ...where,
+        pageNum: page,
+        size: limit,
+  
+      });
+    },
+
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
+    },
+    open(item) {
+      if (item) {
+        this.current = {
+          id: item.id,
+          name: item.name,
+        }
+        this.radio = item.id
+      }
+      this.visible = true
+    },
+    // 单击获取id
+    cellClick (row) {
+        this.current = row
+        this.radio = row.id
+    },
+
+    handleClose() {
+      this.visible = false
+ 
+    },
+    selected() {
+      if (!this.current) {
+        return this.$message.warning('请选择工艺路线')
+      }
+      this.$emit('changeProduct', this.current)
+      this.handleClose()
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+
+.table_col {
+  padding-left: 10px;
+
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+
+.topsearch {
+  margin-bottom: 15px;
+}
+</style>

+ 20 - 1
src/utils/util.js

@@ -1,4 +1,4 @@
-import { getAction } from '@/api/flowable/manage';
+// import { getAction } from '@/api/flowable/manage';
 
 import store from '@/store';
 
@@ -33,3 +33,22 @@ export function randomString(len) {
   }
   return pwd;
 }
+
+export function unacceptedProductStatus(v) {
+  let status = '';
+  switch (v) {
+    case 0:
+      status = '待处理';
+      break;
+    case 1:
+      status = '处理中';
+      break;
+    case 2:
+      status = '已处理';
+      break;
+    case 3:
+      status = '已完结';
+      break;
+  }
+  return status;
+}

+ 0 - 715
src/views/inspectionWork/edit copy.vue

@@ -1,715 +0,0 @@
-<template>
-  <div class="ele-body">
-    <el-card shadow="never">
-      <header-title title="基本信息">
-        <el-button @click="cancel">返回</el-button>
-        <el-button type="primary" @click="save" :loading="loading" v-if="type != 'detail'">保存</el-button>
-        <el-button type="primary" @click="handleReporting" :loading="loading" v-if="type != 'detail'">报工完成</el-button>
-      </header-title>
-      <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type" :qualityType1="qualityType"
-        @changeModel="changeModel" @changeNumber="changeNumber"></base-info>
-      <el-row>
-        <header-title title="质检内容">
-          <el-button type="primary" :loading="loading" v-if="type != 'detail'"
-            @click="batchQuality(null, null, 'report')">批量质检</el-button>
-        </header-title>
-        <el-tabs v-model="activeName" @tab-click="handleClick">
-          <el-tab-pane label="来源清单" name="1"></el-tab-pane>
-          <el-tab-pane label="样品清单" name="2"></el-tab-pane>
-          <el-tab-pane label="质检方案" name="3"></el-tab-pane>
-        </el-tabs>
-      </el-row>
-      <!--  -->
-      <el-row style="margin-top: 24px">
-        <el-table v-show="activeName === '1'" v-if="packingList.length > 0" ref="showPackingListTable"
-          :data="paginatedPackingList" tooltip-effect="dark" :max-height="300" border row-key="id"
-          @selection-change="handleSelectionChange1">
-          <el-table-column type="selection" width="55" align="center" :reserve-selection="true"
-            :selectable="checkSelectable"></el-table-column>
-          <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
-          <template v-for="column in tableColumns">
-            <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
-              :width="column.width" :align="column.align"></el-table-column>
-          </template>
-        </el-table>
-        <el-pagination v-show="activeName === '1' && packingList.length > 0" @size-change="handleSizeChange"
-          @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 20, 50, 100]"
-          :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next" :total="packingList.length"
-          style="margin-top: 16px" />
-        <!--  -->
-        <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
-          :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id">
-          <el-table-column label="序号" type="index" width="50" align="center" fixed="left"></el-table-column>
-          <template v-for="column in tableColumns">
-            <el-table-column :key="column.prop" :label="column.label" :prop="column.prop" :fixed="column.fixed"
-              :show-overflow-tooltip="true" :width="column.width" :align="column.align">
-              <template slot-scope="scope">
-                <template v-if="column.prop === 'categoryCode'">
-                  <el-link type="primary" :underline="false" @click="handleDetail(scope.$index, scope.row, 'detail')">
-                    {{ scope.row.categoryCode }}
-                  </el-link>
-                </template>
-                <template v-else-if="column.prop === 'weight'">
-                  <el-input type="number" v-model="scope.row.weight" :min="0"></el-input>
-                </template>
-                <template v-else>
-                  {{ scope.row[column.prop] }}
-                </template>
-              </template>
-            </el-table-column>
-          </template>
-          <el-table-column label="处置状态" prop="disposalStatus" align="center" width="80" fixed="right"
-            :show-overflow-tooltip="true">
-            <template slot-scope="scope">
-              <span v-if="scope.row.disposalStatus == 1 && form.qualityType == 2">返工</span>
-              <span v-if="scope.row.disposalStatus == 2 && form.qualityType == 2">返修</span>
-              <span v-if="scope.row.disposalStatus == 3">报废</span>
-              <span v-if="scope.row.disposalStatus == 4 && form.qualityType == 2">降级使用</span>
-              <span v-if="scope.row.disposalStatus == 5 && form.qualityType == 2">让步接收</span>
-              <span v-if="scope.row.disposalStatus == 6">留样</span>
-              <span v-if="scope.row.disposalStatus == 7">消耗</span>
-              <span v-if="scope.row.disposalStatus == 8">回用</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="处置时间" prop="disposeTime" align="center" width="100" fixed="right"
-            :show-overflow-tooltip="true">
-          </el-table-column>
-          <el-table-column label="质检状态" prop="qualityStatus" align="center" width="120" fixed="right"
-            :show-overflow-tooltip="true">
-            <template slot-scope="scope">
-              <span v-if="scope.row.qualityStatus == 0">未检</span>
-              <span v-if="scope.row.qualityStatus == 1">已检</span>
-              <span v-if="scope.row.qualityStatus == 2">待检</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="质检结果" prop="qualityResults" align="center" width="110" fixed="right"
-            :show-overflow-tooltip="true">
-            <template slot-scope="scope">
-              <el-select v-model="scope.row.qualityResults" placeholder="请选择" style="width: 100%;"
-                :disabled="type == 'detail'" size="mini">
-                <el-option v-for="item in qualityResultsList" :key="item.value" :label="item.label" :value="item.value">
-                </el-option>
-              </el-select>
-            </template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="120" fixed="right" v-if="type != 'detail'">
-            <template slot-scope="scope">
-              <el-link :type="scope.row.isValid ? 'primary' : 'danger'" :underline="false"
-                @click="handleDetail(scope.$index, scope.row, 'report')">
-                质检
-              </el-link>
-              <el-link type='primary' :underline="false" @click="handleDispose(scope.$index, scope.row, 'dispose')">处置
-              </el-link>
-            </template>
-          </el-table-column>
-        </el-table>
-        <el-pagination v-show="activeName === '2'" v-if="sampleList" @size-change="handleSampleSizeChange"
-          @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
-          :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
-          layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
-          style="margin-top: 10px"></el-pagination>
-        <!--  -->
-        <el-table v-show="activeName === '3'" ref="showSchemeListTable" :data="paginatedSchemeList"
-          tooltip-effect="dark" :max-height="300" border row-key="id">
-          <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
-          <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
-          </el-table-column>
-          <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName" align="center"></el-table-column>
-          <el-table-column label="质检类型" prop="categoryLevelClassName" align="center"></el-table-column>
-          <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
-          <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
-          <el-table-column label="工艺参数" prop="defaultValue" align="center">
-          </el-table-column>
-        </el-table>
-        <el-pagination v-show="activeName === '3'" @size-change="handleSchemeSizeChange"
-          @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
-          :page-sizes="[10, 20, 50, 100]" :page-size="schemePagination.pageSize"
-          layout="total, sizes, prev, pager, next, jumper" :total="schemeList.length"
-          style="margin-top: 10px"></el-pagination>
-      </el-row>
-    </el-card>
-
-    <sampleListDialog ref="detailRef" @handleConfirm="handleConfirm" @handleDispose="handleDispose"></sampleListDialog>
-    <sampleDisposeDialog ref="disposeRef" @handleDisposeConfirm="handleDisposeConfirm"></sampleDisposeDialog>
-  </div>
-</template>
-
-<script>
-import baseInfo from './components/baseInfo.vue';
-
-import { getCode } from '@/api/login';
-import { save, update, getById, exeReportWork, queryQualitySamplContent, queryQualityTempleContent, queryQualityInventory } from '@/api/inspectionWork';
-
-import dictMixins from '@/mixins/dictMixins';
-
-// import term from './term';
-import sampleListDialog from './components/sampleListDialog.vue';
-import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
-
-import { finishPageTab } from '@/utils/page-tab-util';
-export default {
-  components: {
-    baseInfo,
-    // term
-    sampleListDialog,
-    sampleDisposeDialog
-  },
-  mixins: [dictMixins],
-
-  data() {
-    const defaultForm = function () {
-      return {
-        code: '',
-        qualityType: null,
-        qualityModeproduceRoutingId: '',
-        produceRoutingName: '',
-        produceTaskId: '',
-        produceTaskName: '',
-        productName: '',
-        productCode: '',
-        batchNo: '',
-        specification: '',
-        modelType: '',
-        brandNo: '',
-        total: '',
-        qualifiedNumber: '',
-        noQualifiedNumber: '',
-        groupId: '',
-        groupName: '',
-        qualityId: '',
-        qualityName: '',
-        qualityTime: '',
-        hours: '',
-        qualificationRate: '',
-        noQualificationRate: '',
-        totalWeight: '',
-        sampleNumber: '',
-        imgUrl: [],
-        qualityTimeStart: '',
-        qualityTimeEnd: ''
-      };
-    };
-    return {
-      defaultForm,
-      // 表单数据
-      form: { ...defaultForm() },
-      voList: [],
-
-      // 表单验证规则
-      categoryParamList: [],
-      type: '',
-      title: '',
-      loading: false,
-
-      tabTaskId: null,
-      activeName: '2',
-      qualityResultsList: [{
-        value: 1,
-        label: '合格'
-      },
-      {
-        value: 2,
-        label: '不合格'
-      },
-      {
-        value: 3,
-        label: '让步接收'
-      }],
-      tableColumns: [
-        {
-          label: '编码',
-          prop: 'categoryCode',
-          width: '160',
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          label: '名称',
-          prop: 'categoryName',
-          width: '150',
-          align: 'center'
-        },
-        { label: '批次号', prop: 'batchNo', align: 'center' },
-        { label: '发货条码', prop: 'barcodes', align: 'center' },
-        { label: '包装编码', prop: 'packageNo', align: 'center' },
-        // { label: '包装数量', prop: 'packingQuantity', align: 'center' },
-        { label: '包装单位', prop: 'packingUnit', align: 'center' },
-        { label: '计量数量', prop: 'measureQuantity', align: 'center' },
-        { label: '计量单位', prop: 'measureUnit', align: 'center' },
-        { label: '物料代号', prop: 'materielDesignation', align: 'center' },
-        { label: '客户代号', prop: 'clientCode', align: 'center' },
-        { label: '刻码', prop: 'engrave', align: 'center' },
-        { label: '重量', prop: 'weight', align: 'center', width: "100" },
-        { label: '重量单位', prop: 'weightUnit', align: 'center', width: "100" },
-        { label: '仓库', prop: 'warehouseName', align: 'center' },
-        { label: '货区', prop: 'areaName', align: 'center' },
-        { label: '货架', prop: 'goodsShelfName', align: 'center' },
-        { label: '货位', prop: 'goodsAllocationName', align: 'center' },
-        { label: '生产日期', prop: 'productionDate', align: 'center' },
-        { label: '采购日期', prop: 'purchaseDate', align: 'center' },
-      ],
-
-      packingList: [],
-      pagination: {
-        currentPage: 1,
-        pageSize: 10,
-        total: 0
-      },
-
-      sampleList: [],
-      samplePagination: {
-        currentPage: 1,
-        pageSize: 10,
-        total: 0
-      },
-      schemeList: [],
-      schemePagination: {
-        currentPage: 1,
-        pageSize: 10,
-        total: 0
-      },
-      isValid: true,
-      isStatus: true,
-      SampleListbyReportList: [],
-      qualityTimeStart: ''
-
-    };
-  },
-  watch: {
-    '$route.query.id': {
-      handler(id) {
-        if (id) {
-          this.getDetail();
-        } else {
-          this.form = { ...defaultForm() };
-
-        }
-      }
-    },
-  },
-  computed: {
-    paginatedPackingList() {
-      const start =
-        (this.pagination.currentPage - 1) * this.pagination.pageSize;
-      const end = start + this.pagination.pageSize;
-      return this.packingList.slice(start, end);
-    },
-    // 分页后的样品列表
-    paginatedSampleList() {
-      const { currentPage, pageSize } = this.samplePagination;
-      const start = (currentPage - 1) * pageSize;
-      const end = start + pageSize;
-      return this.sampleList?.slice(start, end);
-    },
-    // 分页后的质检方案列表
-    paginatedSchemeList() {
-      const { currentPage, pageSize } = this.schemePagination;
-      const start = (currentPage - 1) * pageSize;
-      const end = start + pageSize;
-      return this.schemeList?.slice(start, end);
-    }
-  },
-  created() {
-    this.open()
-    if (this.$route.query.id) {
-      this.getDetail();
-    }
-  },
-  methods: {
-
-    checkSelectable(row, index) {
-      // 只有当质检方式为抽检(qualityMode=2)时才可选
-      return this.form.qualityMode === 2;
-    },
-    changeModel(val) {
-      this.form.qualityMode = val;
-      if (this.form.qualityMode == 1) {
-        if (this.schemeList.length == 0) {
-          for (let i = 0; i < this.packingList.length; i++) {
-            console.log(this.packingList[i], 'selection[i]')
-            this.$set(this.packingList[i], 'qualityStatus', 2)
-          }
-        }
-
-        this.sampleList = this.packingList;
-        this.samplePagination.currentPage = 1;
-        this.samplePagination.total = this.packingList.length;
-      } else {
-        this.sampleList = [];
-      }
-    },
-    changeNumber(val) {
-      if (this.form.qualityMode !== 2) {
-        return;
-      }
-      if (val <= 0) {
-        this.$refs.showPackingListTable.clearSelection();
-        return;
-      }
-
-      if (val > this.packingList.length) {
-        this.$message.warning('取样数量不能大于物料明细总数!');
-        return;
-      }
-      const rows = this.packingList.slice(0, val);
-      rows.forEach((row) => {
-        this.$refs.showPackingListTable.toggleRowSelection(row);
-      });
-
-    },
-    getNowDate() {
-      let date = new Date(),
-        obj = {
-          year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
-          month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
-          strDate: date.getDate(), // 获取当前日(1-31)
-          hour: date.getHours(), //获取当前小时(0 ~ 23)
-          minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
-          second: date.getSeconds() //获取当前秒数(0 ~ 59)
-        };
-      Object.keys(obj).forEach((key) => {
-        if (obj[key] < 10) obj[key] = `0${obj[key]}`;
-      });
-      return obj;
-    },
-    handleSelectionChange1(selection) {
-      console.log(selection, '勾选列表');
-      this.form.sampleNumber = selection.length;
-      if (this.form.qualityMode === 2) {
-        this.selectedList = selection;
-
-        if (this.schemeList.length == 0) {
-          for (let i = 0; i < selection.length; i++) {
-            console.log(selection[i], 'selection[i]')
-            this.$set(selection[i], 'qualityStatus', 2)
-          }
-        }
-
-        // if (this.qualityType == 2 && selection.length > 0) {
-        //   const ProductSampleList = [];
-
-        //   selection.forEach(oldItem => {
-        //     const count = oldItem.measureQuantity;
-        //     const newMeasureQuantity = oldItem.measureQuantity / count;
-        //     const newWeight = parseFloat((oldItem.weight / count).toFixed(2))
-        //     console.log(count, newMeasureQuantity, newWeight)
-        //     delete oldItem.id;
-
-        //     for (let i = 0; i < count; i++) {
-        //       ProductSampleList.push({
-        //         ...oldItem,
-        //         measureQuantity: newMeasureQuantity,
-        //         weight: newWeight
-        //       });
-        //     }
-        //   });
-        //   this.sampleList = ProductSampleList;
-        //   this.samplePagination.currentPage = 1;
-        //   this.samplePagination.total = selection.length;
-        // } else {
-          this.sampleList = selection;
-          this.samplePagination.currentPage = 1;
-          this.samplePagination.total = selection.length;
-          this.form.sampleNumber = selection.length;
-        // }
-      }
-    },
-
-    async open() {
-      this.type = this.$route.query.type;
-      this.qualityType = this.$route.query.qualityType;
-      this.title = this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
-
-      if (this.type == 'add') {
-        const code = await getCode('quality_work_order_code');
-        this.form.code = code;
-      } else {
-        if (this.$route.query.qualityTimeStart != '' || this.$route.query.qualityTimeStart != null || this.$route.query.qualityTimeStart != undefined) {
-          this.qualityTimeStart = this.getNowTime();
-          console.log(this.qualityTimeStart, '开始报工时间')
-        }
-      }
-    },
-    getNowTime() {
-      const nowDate = this.getNowDate()
-      return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate + ' ' + nowDate.hour + ':' + nowDate.minute + ':' + nowDate.second
-    },
-    getNowTimes() {
-      const nowDate = this.getNowDate()
-      return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate
-    },
-    async getDetail() {
-
-      getById(this.$route.query.id).then((res) => {
-        this.form = res.data;
-
-        this.tabTaskId =
-          this.categoryParamList[0] && this.categoryParamList[0].id;
-
-        if (this.form.groupId) {
-          this.$nextTick(() => {
-            this.$refs.baseInfoRefs?.getUserList({
-              groupId: this.form.groupId
-            });
-          });
-        }
-        if (this.form.produceRoutingId) {
-          this.$nextTick(() => {
-            this.$refs.baseInfoRefs?.getTaskList();
-          })
-        }
-      });
-      await this.queryQualityInventory()
-      await this.queryQualitySamplContent()
-      await this.queryQualityTempleContent()
-    },
-    async queryQualityInventory() {
-      let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
-      console.log(res, '清单列表');
-      this.packingList = res;
-      this.samplePagination.currentPage = 1;
-      this.samplePagination.total = this.packingList.length;
-    },
-    async queryQualitySamplContent() {
-      const res = await queryQualitySamplContent({ qualityWorkerId: this.$route.query.id })
-      let addStatus = res.map((item) => {
-        item.isValid = true;
-        item.disposeTime = item.disposeTime ? item.disposeTime.split(' ')[0] : null;
-        item.sampleDate = item.sampleDate ? item.sampleDate.split(' ')[0] : null;
-        return {
-          ...item
-        }
-      })
-      console.log(addStatus, '样品清单')
-
-      //生产
-      if (this.qualityType == 2 && addStatus[0]?.measureQuantity) {
-        const ProductSampleList = [];
-
-        addStatus.forEach(oldItem => {
-          const count = oldItem.measureQuantity;
-          const newMeasureQuantity = oldItem.measureQuantity / count;
-          const newWeight = parseFloat((oldItem.weight / count).toFixed(2))
-          console.log(count, newMeasureQuantity, newWeight)
-          delete oldItem.id;
-
-          for (let i = 0; i < count; i++) {
-            ProductSampleList.push({
-              ...oldItem,
-              measureQuantity: newMeasureQuantity,
-              weight: newWeight
-            });
-          }
-        });
-
-        this.sampleList = ProductSampleList;
-        this.samplePagination.currentPage = 1;
-        this.samplePagination.total = this.sampleList.length;
-      } else {
-        //样品
-        this.sampleList = addStatus;
-        this.samplePagination.currentPage = 1;
-        this.samplePagination.total = this.sampleList.length;
-      }
-    },
-    async queryQualityTempleContent() {
-      const res = await queryQualityTempleContent({ qualityWorkerId: this.$route.query.id })
-      console.log(res, '222');
-      // 方案
-      this.schemeList = res;
-      this.schemePagination.currentPage = 1;
-      this.schemePagination.total = this.schemeList.length;
-    },
-    handleClick(tab) {
-      this.activeName = tab.name;
-    },
-    // 来料清单列表分页方法
-    handleSizeChange(val) {
-      this.pagination.pageSize = val;
-      this.pagination.currentPage = 1;
-    },
-    handleCurrentChange(val) {
-      this.pagination.currentPage = val;
-    },
-
-    // 样品列表分页方法
-    handleSampleSizeChange(val) {
-      this.samplePagination.pageSize = val;
-      this.samplePagination.currentPage = 1;
-    },
-    handleSampleCurrentChange(val) {
-      this.samplePagination.currentPage = val;
-    },
-    // 质检方案分页方法
-    handleSchemeSizeChange(val) {
-      this.schemePagination.pageSize = val;
-      this.schemePagination.currentPage = 1;
-    },
-    handleSchemeCurrentChange(val) {
-      this.schemePagination.currentPage = val;
-    },
-    /* 保存编辑 */
-    save() {
-      this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
-        if (!valid) {
-          return false;
-        }
-        this.loading = true;
-        let URL =
-          this.type == 'add' ? save : this.type == 'edit' ? update : '';
-
-        this.form.qualityTimeStart = new Date(this.qualityTimeStart)
-
-        delete this.form['qualityTimeEnd']
-
-        let params = {
-          ...this.form,
-          sampleList: this.sampleList,
-          planTemplateList: this.schemeList,
-          qualityInventoryList: this.packingList
-        }
-        URL(params)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.cancel();
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
-    },
-    update() {
-      this.loading = true;
-      this.form['status'] = 1;
-      update({ ...this.form })
-        .then((msg) => {
-          this.loading = false;
-          this.$message.success(msg);
-          this.$emit('done');
-        })
-        .catch((e) => {
-          this.loading = false;
-        });
-    },
-    restForm() {
-      this.form = { ...this.defaultForm() };
-      this.$nextTick(() => {
-        this.$refs.baseInfoRefs.$refs.form1.clearValidate();
-      });
-    },
-    cancel() {
-      finishPageTab();
-      this.$router.go(-1);
-    },
-    handleDetail(index, row, type) {
-      if (!this.sampleList[index] || !this.schemeList) {
-        return;
-      }
-      const selectedData = [];
-      selectedData.push(this.sampleList[index])
-
-      this.$refs.detailRef.openDia(index, row, type, selectedData, null);
-    },
-    handleDispose(index, row, type) {
-      if (!this.sampleList[index]) {
-        return;
-      }
-
-      this.sampleList[index].sampleDate = this.getNowTimes();
-
-      this.sampleList[index].disposeTime = this.getNowTimes();
-
-      console.log(index, row, type, this.qualityType)
-
-      this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
-    },
-    // 报工
-    handleReporting(index, row) {
-      this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
-        if (!valid) {
-          return false;
-        }
-
-        for (let i = 0; i < this.sampleList.length; i++) {
-
-          const qualityStatus = this.sampleList[i].qualityStatus;
-
-          if (qualityStatus == '2') {
-            this.$message.error('请完成以下样品质检!')
-            this.loading = false;
-            return
-          }
-        }
-
-        this.form.qualityTimeEnd = new Date(this.getNowTime())
-        this.form.qualityTimeStart = new Date(this.qualityTimeStart)
-        let params = {
-          ...this.form,
-          sampleList: this.sampleList,
-          planTemplateList: this.schemeList,
-          qualityInventoryList: this.packingList
-        }
-        console.log(params, 'params')
-        exeReportWork(params)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.cancel();
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      })
-    },
-    // 处理确认事件
-    handleDisposeConfirm(row, index) {
-      if (index > -1) {
-        this.$set(this.sampleList, index, row)
-      }
-    },
-    //确认报工
-    handleConfirm(list, index) {
-      console.log(list)
-
-      // 检查有效性
-      for (const item of list) {
-        for (const child of item.qualitySampleTemplateList) {
-
-          console.log(child, 'child')
-          if (!child.qualityResultContent || !child.qualityResults) {
-            this.$message.error('请完善报工内容!');
-            return;
-          }
-        }
-      }
-      console.log(list, 'listlistlistlist')
-      list.forEach((item) => {
-        if (item.qualitySampleTemplateList.some(child => child.qualityResults === 2)) {
-          item.isValid = false;
-          item.qualityResults = 2;
-        } else {
-          item.isValid = true;
-          item.qualityResults = 1;
-        }
-        item.qualityStatus = 1;
-      })
-      if (index != null) {
-        this.$set(this.sampleList, index, list[0]);
-      } else {
-        this.$set(this.sampleList, null, list);
-      }
-      console.log(this.sampleList, '222表')
-
-    },
-    // 批量质检
-    batchQuality(index, row, type) {
-      this.$refs.detailRef.openDia(null, null, type, this.sampleList, null)
-    }
-  }
-};
-</script>
-
-<style lang="scss" scoped></style>

+ 223 - 0
src/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue

@@ -0,0 +1,223 @@
+<template>
+  <el-dialog title="选择产品" :visible.sync="equipmentdialog" :before-close="handleClose" :close-on-click-modal="true"
+    :close-on-press-escape="false" append-to-body width="60%">
+    <div>
+      <el-row>
+        <el-col :span="24" class="topsearch">
+          <el-form>
+            <el-row>
+              <el-col :span="6">
+                <el-input v-model="searchKey" placeholder="关键词" size="small"></el-input>
+              </el-col>
+
+              <el-col :span="6" style="margin-left: 10px">
+                <el-button type="primary" size="small" @click="reload">搜索</el-button>
+                <el-button size="small" @click="reset">重置</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="6" class="tree_col">
+          <AssetTree @handleNodeClick="handleNodeClick" :treeIds="treeIds" :paramsType="'type'" ref="treeList" />
+        </el-col>
+        <el-col :span="18" class="table_col" v-if="equipmentdialog">
+          <ele-pro-table ref="equiTable" :columns="columns" :datasource="datasource" :selection.sync="selection"
+            :current.sync="current" highlight-current-row @select="handleSelect" cache-key="systemRoleTable3" aaaaaa
+            row-key="id" height="50vh" @done="setSelect">
+          </ele-pro-table>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import AssetTree from '@/components/AssetTree/index.vue';
+import { getList } from '@/api/classifyManage/index';
+export default {
+  components: {
+    AssetTree
+  },
+  props: {
+    selectList: Array,
+    type: {
+      default: 1 //1多选 2单选
+    },
+    treeIds: {
+      default: () => {
+        return ['9'];
+      }
+    }
+  },
+  data() {
+    return {
+      equipmentdialog: false,
+      current: null,
+      columns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          reserveSelection: true,
+          show: this.type == 1
+        },
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'code',
+          label: '物品编码',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          slot: 'code'
+        },
+        {
+          prop: 'name',
+          label: '物品名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'brandNum',
+          label: '牌号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        }
+      ],
+      tableList: [],
+      categoryLevelId: null,
+      code: null,
+      searchKey: '',
+      selection: []
+    };
+  },
+
+  watch: {},
+  methods: {
+    async datasource({ page, limit }) {
+      const params = {
+        code: this.code,
+        searchKey: this.searchKey,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.categoryLevelId,
+        isProduct: true
+      };
+      const data = await getList(params);
+      this.tableList = data.list;
+      return data;
+    },
+    open() {
+      this.equipmentdialog = true;
+      this.setSelect();
+    },
+    handleNodeClick(data) {
+      this.categoryLevelId = data.id;
+      this.reload();
+    },
+    reload() {
+      this.$refs.equiTable.reload();
+    },
+    handleClose() {
+      this.equipmentdialog = false;
+      this.code = '';
+      this.$refs.equiTable.clearSelection();
+    },
+    reset() {
+      this.code = null;
+      this.reload();
+    },
+    // 设置选中
+    setSelect() {
+      // this.$nextTick(() => {
+      //   this.tableList.forEach((row) => {
+      //     this.selectList?.forEach((selected, index) => {
+      //       if (selected.productCode === row.code) {
+      //         this.$refs.equiTable.toggleRowSelection(row, true);
+      //       }
+      //     });
+      //   });
+      // });
+    },
+    // 取消选中
+    handleSelect(selection, row) {
+      // if (!selection.find((i) => i.id === row.id)) {
+      //   const index = this.selectList.findIndex(
+      //     (itm) => row.code == itm.productCode
+      //   );
+      //   console.log(index);
+      //   if (index > -1) {
+      //     this.selectList.splice(index, 1);
+      //   }
+      // }
+    },
+    // 选择
+    selected() {
+
+
+      let list = this.type == 1 ? this.selection : [this.current]
+      this.$emit('choose', JSON.parse(JSON.stringify(list)));
+      this.handleClose();
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  max-height: 530px;
+  overflow: auto;
+}
+
+.table_col {
+  padding-left: 10px;
+
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+
+.topsearch {
+  margin-bottom: 15px;
+}
+</style>

+ 77 - 0
src/views/unqualifiedProduct/unqualifiedList/components/baseInfo.vue

@@ -0,0 +1,77 @@
+<template>
+  <el-form ref="form1" :model="form" label-width="120px">
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="编码:" prop="sampleCode">
+          <el-input clearable v-model="form.sampleCode" placeholder="请输入" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="物品名称:" prop=" categoryName">
+          <el-input v-model="form.categoryName" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="物品编码:" prop=" categoryCode">
+          <el-input v-model="form.categoryCode" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="批次号:" prop=" batchNo">
+          <el-input v-model="form.batchNo" disabled />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="规格:" prop=" specification">
+          <el-input v-model="form.specification" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="型号:" prop=" modelType">
+          <el-input v-model="form.modelType" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="牌号:" prop=" brandNo">
+          <el-input v-model="form.brandNo" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="重量:" prop="weight">
+          <el-input type="number" v-model="form.weight" disabled />
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+<script>
+//接口
+import { rules } from 'eslint-config-prettier';
+
+export default {
+  components: {
+  },
+  props: {
+    form: {
+      type: Object,
+      default: () => { }
+    },
+    btnType: {
+      type: String,
+      default: ''
+    }
+  },
+  watch: {},
+  data() {
+    return {
+    };
+  },
+  created() {
+  },
+  methods: {
+  }
+};
+</script>
+<style lang="scss" scoped></style>

+ 406 - 0
src/views/unqualifiedProduct/unqualifiedList/components/create.vue

@@ -0,0 +1,406 @@
+<template>
+  <ele-modal :visible.sync="visible" :title="title" width="80vw" append-to-body @close="cancel" :maxable="true">
+    <el-form ref="form" :model="form" :rules="rules" label-width="90px" class="create-form">
+      <el-row :gutter="15">
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="编码:">
+            <el-input :maxlength="20" v-model="form.code" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="来源编码:">
+            <el-input :maxlength="20" v-model="form.unqualifiedSourceCode" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="数量:">
+            <el-input :maxlength="20" v-model="form.unqualifiedQuantity" disabled />
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="工艺路线:">
+            <el-input @click.native="openVersion" clearable v-model="form.produceRoutingName" />
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="工序:">
+            <el-select style="width: 100%" v-model="form.produceTaskId" placeholder="请选择" clearable
+              @change="produceTaskChange">
+              <el-option v-for="item in produceTaskList" :key="item.id" :label="item.name" :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="批次号:">
+            <el-input :maxlength="20" v-model="form.batchNo" disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-table :data="form.poList" border height="40vh">
+        <el-table-column label="序号" align="center" width="60">
+          <template slot-scope="scope">
+            <span>{{ scope.$index + 1 }}</span>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="产品名称" align="center" prop="productName">
+        </el-table-column>
+        <el-table-column label="产品编码" align="center" prop="productCode">
+        </el-table-column>
+        <el-table-column label="牌号" align="center" prop="brandNo">
+        </el-table-column>
+        <el-table-column label="刻码" align="center" prop="engravingCode">
+          <template slot-scope="scope">
+            <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.engravingCode'">
+              <el-input v-model="scope.row.engravingCode" size="small" style="width: 100%"
+                placeholder="输入刻码"></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <!-- <el-table-column label="型号" align="center" prop="model">
+        </el-table-column> -->
+        <el-table-column label="规格" align="center" prop="specification">
+        </el-table-column>
+
+        <el-table-column label="数量" align="center" prop="unqualifiedQuantity">
+          <template slot-scope="scope">
+            <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.unqualifiedQuantity'" :rules="[
+              {
+                required: true,
+                message: '请输入数量',
+                trigger: 'blur'
+              },
+              { validator: validatePass, trigger: 'change' }
+            ]">
+              <el-input :disabled="!!scope.row.id" v-model.number="scope.row.unqualifiedQuantity" size="small"
+                oninput="value=value.replace(/[^\d]/g,'')" style="width: 100%" placeholder="输入数量" @input="
+                  inputNumber(scope.$index, scope.row.unqualifiedQuantity)
+                  "></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column label="工艺路线" align="center" prop="produceRoutingName">
+        </el-table-column>
+        <el-table-column label="工序" align="center" prop="produceTaskName">
+        </el-table-column>
+
+        <el-table-column label="原因" align="center" prop="unqualifiedReason">
+          <template slot-scope="scope">
+            <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.unqualifiedReason'" :rules="{
+              required: true,
+              message: '请输入原因',
+              trigger: 'blur'
+            }">
+              <el-input v-model="scope.row.unqualifiedReason" size="small" style="width: 100%"
+                placeholder="输入原因"></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" width="70">
+          <template slot-scope="scope">
+            <el-link type="danger" :underline="false" @click="handleDeleteItem(scope.$index, scope.row.id)">
+              删除
+            </el-link>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="add-product" @click="addEquipment">
+        <i class="el-icon-circle-plus-outline"></i>
+      </div>
+    </el-form>
+    <template v-slot:footer>
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" @click="save" :loading="loading">
+        确定
+      </el-button>
+    </template>
+
+    <!-- 选择产品 -->
+    <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose">
+    </EquipmentDialog>
+    <ProductionVersion ref="versionRefs" @changeProduct="changeProduct"></ProductionVersion>
+  </ele-modal>
+</template>
+
+<script>
+import EquipmentDialog from '../components/EquipmentDialog.vue';
+import ProductionVersion from '@/components/ProductionVersion/ProductionVersion.vue';
+import { getProduceTaskList } from '@/api/aps';
+import {
+  unqualifiedProductsAdd,
+  getDetail,
+  deleteUnacceptedProductDetail
+} from '@/api/unacceptedProduct/index';
+export default {
+  components: {
+    EquipmentDialog,
+    ProductionVersion
+  },
+  data() {
+    return {
+      validatePass: (rule, value, callback) => {
+        if (!value) {
+          callback(new Error('数量不能为0'));
+        } else {
+          callback();
+        }
+      },
+      visible: false,
+      loading: false,
+      produceTaskList: [],
+      form: {
+        poList: [],
+        code: '',
+        unqualifiedSourceCode: '',
+        unqualifiedSourceId: '',
+
+        unqualifiedQuantity: '',
+        type: '',
+        status: null,
+        reviewerId: null,
+        reviewerName: '',
+        createUserName: '',
+        brandNo: '',
+        produceRoutingId: '',
+        produceRoutingName: '',
+        produceTaskId: '',
+        produceTaskName: '',
+        batchNo: ''
+      },
+      // 表单验证规则
+      rules: {
+        deliveryTime: [
+          { required: true, message: '请选择交付日期', trigger: 'change' }
+        ]
+      },
+
+      title: '创建'
+    };
+  },
+
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  created() { },
+  methods: {
+    open(row, type) {
+      this.visible = true;
+      if (type == 'add') {
+        this.title = '创建';
+        this.form = row;
+        this.getProduceTaskList();
+        return;
+      }
+      if (row) {
+        this.title = '修改';
+        this.detail(row);
+      } else {
+        this.title = '创建';
+      }
+    },
+    //选择工艺路线
+    openVersion() {
+      this.$refs.versionRefs.open();
+    },
+    //工艺路线回调
+    changeProduct(data) {
+      this.form.produceRoutingId = data.id;
+      this.form.produceRoutingName = data.name;
+      this.form.produceTaskId = '';
+      this.form.produceTaskName = '';
+      this.getProduceTaskList();
+    },
+    async getProduceTaskList() {
+      const res = await getProduceTaskList({
+        isDetail: true,
+        pageNum: 1,
+        routingId: this.form.produceRoutingId,
+        size: -1
+      });
+      this.produceTaskList = res.list;
+    },
+    produceTaskChange() {
+      if (!this.form.produceTaskId) {
+        return;
+      }
+      this.form.produceTaskName = this.produceTaskList.find(
+        (item) => item.id == this.form.produceTaskId
+      ).name;
+      this.form.poList.forEach((item, index) => {
+        this.$set(
+          this.form.poList[index],
+          'produceRoutingId',
+          this.form.produceRoutingId
+        );
+        this.$set(
+          this.form.poList[index],
+          'produceRoutingName',
+          this.form.produceRoutingName
+        );
+        this.$set(
+          this.form.poList[index],
+          'produceTaskId',
+          this.form.produceTaskId
+        );
+        this.$set(
+          this.form.poList[index],
+          'produceTaskName',
+          this.form.produceTaskName
+        );
+      });
+    },
+
+    detail(row) {
+      getDetail(row.id).then((res) => {
+        this.form = row;
+        this.getProduceTaskList();
+        this.form.poList = res;
+      });
+    },
+    cancel() {
+      this.form = {
+        poList: [],
+        code: '',
+        workOrderId: '',
+        productCode: '',
+        productName: '',
+        specifications: '',
+        unqualifiedQuantity: '',
+        type: '',
+        status: null,
+        reviewerId: null,
+        reviewerName: '',
+        createUserName: '',
+        brandNo: '',
+        produceRoutingId: '',
+        produceRoutingName: '',
+        produceTaskId: '',
+        produceTaskName: '',
+        batchNo: ''
+      };
+      this.$refs.form.clearValidate();
+      this.visible = false;
+    },
+    // 删除产品
+    handleDeleteItem(index, id) {
+      this.$confirm('确认删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancleButtonText: '取消',
+        type: 'warning'
+      })
+        .then((res) => {
+          if (id) {
+            deleteUnacceptedProductDetail([id]).then((res) => {
+              this.form.poList.splice(index, 1);
+            });
+          } else {
+            this.form.poList.splice(index, 1);
+          }
+        })
+        .catch(() => { });
+
+      this.inputNumber();
+    },
+    addEquipment() {
+      this.$refs.equipmentRefs.open();
+    },
+    /* 保存编辑 */
+    save() {
+      console.log(this.form.poList);
+      this.$refs.form.validate((valid) => {
+        if (!valid) {
+          return false;
+        }
+        if (!this.form.poList.length) {
+          return this.$message.warning('产品列表不能为空!');
+        }
+        for (let key in this.form) {
+          if (key.includes('create')) {
+            this.form[key] = '';
+          }
+        }
+        this.form.poList.forEach((item) => {
+          for (let key in item) {
+            if (key.includes('create')) {
+              item[key] = '';
+            }
+          }
+        });
+        this.loading = true;
+        unqualifiedProductsAdd(this.form)
+          .then((res) => {
+            this.loading = false;
+            this.$message.success('成功');
+            this.cancel();
+            this.$emit('refresh');
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      });
+    },
+
+    // 确定选择
+    confirmChoose(data) {
+      let list = [];
+      list = data.map((item, index) => {
+        if (item.productCode) {
+          return item;
+        } else {
+          return {
+            productCode: item.code,
+            productName: item.name,
+            // productUnitWeight: item.netWeight,
+            // weightUnit: item.weightUnit,
+            specification: item.specification,
+            brandNo: item.brandNum,
+            unqualifiedQuantity: '',
+            unqualifiedReason: '',
+            produceRoutingId: '',
+            produceRoutingName: '',
+            produceTaskId: '',
+            produceTaskName: ''
+          };
+        }
+      });
+
+      this.form.poList = this.form.poList.concat(list);
+
+      this.produceTaskChange();
+      this.inputNumber();
+    },
+
+    inputNumber() {
+      this.form.unqualifiedQuantity = 0;
+      this.form.poList.forEach((item) => {
+        this.form.unqualifiedQuantity += Number(item.unqualifiedQuantity) || 0;
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.basic-details-title {
+  margin: 10px 0;
+}
+
+.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>

+ 86 - 0
src/views/unqualifiedProduct/unqualifiedList/components/detail-search.vue

@@ -0,0 +1,86 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form label-width="90px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <el-form-item label="产品名称:">
+          <el-input clearable v-model="where.productName" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <el-form-item label="产品编码:">
+          <el-input clearable v-model="where.productCode" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <el-form-item label="产品规格:">
+          <el-input clearable v-model="where.specification" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <el-form-item label="状态:">
+          <el-input clearable v-model="where.status" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <el-form-item label-width="0px">
+          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
+            查询
+          </el-button>
+          <el-button @click="reset" icon="el-icon-refresh-left" type="primary">重置</el-button>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  props: [],
+  data() {
+    // 默认表单数据
+    const defaultWhere = {
+      productName: '',
+      status: '',
+      createTime: []
+    };
+    return {
+      // 表单数据
+      where: { ...defaultWhere },
+      teamList: []
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  watch: {},
+  created() { },
+  methods: {
+    /* 搜索 */
+    search() {
+      const where = { ...this.where };
+      if (where.createTime?.length) {
+        where.startTime = where.createTime[0];
+        where.endTime = where.createTime[1];
+      }
+      delete where.createTime;
+      this.$emit('search', where);
+    },
+    /*  重置 */
+    reset() {
+      this.where = { ...this.defaultWhere };
+      this.search();
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.ele-form-actions {
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+}
+</style>

+ 294 - 0
src/views/unqualifiedProduct/unqualifiedList/components/edit.vue

@@ -0,0 +1,294 @@
+<template>
+  <ele-modal :visible.sync="visible" :title="title" width="40vw" append-to-body :maxable="true">
+    <div class="title">{{ title == '返工返修' ? '原' : '' }}产品信息</div>
+    <el-table :data="poList" border>
+      <el-table-column label="产品名称" align="center" prop="productName">
+      </el-table-column>
+      <el-table-column label="产品编码" align="center" prop="productCode">
+      </el-table-column>
+      <!-- <el-table-column label="刻码" align="center" prop="engravingCode">
+        </el-table-column> -->
+      <el-table-column label="规格" align="center" prop="specification">
+      </el-table-column>
+      <el-table-column label="数量" align="center" prop="unqualifiedQuantity">
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime">
+      </el-table-column>
+      <el-table-column label="创建人" align="center" prop="reviewerName">
+      </el-table-column>
+      <el-table-column label="入库仓库" align="center" prop="depotId" v-if="title != '返工返修'">
+        <template slot-scope="scope">
+          <el-select v-model="scope.row.depotId">
+            <el-option v-for="item in warehouseList" :key="item.id" :value="item.id" :label="item.name"
+              @click.native="handleChangeDepot(scope.row, item)"></el-option>
+          </el-select>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="title" v-if="title == '返工返修'">返工返修产品信息</div>
+    <el-form ref="form" label-width="90px" class="create-form" v-if="title == '返工返修'">
+      <el-table :data="newPoList" border height="20vh">
+        <el-table-column label="序号" align="center" width="60">
+          <template slot-scope="scope">
+            <span>{{ scope.$index + 1 }}</span>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="产品名称" align="center" prop="productNameNew">
+        </el-table-column>
+        <el-table-column label="产品编码" align="center" prop="productCodeNew">
+        </el-table-column>
+        <!-- <el-table-column label="刻码" align="center" prop="engravingCode">
+        </el-table-column> -->
+        <!-- <el-table-column label="型号" align="center" prop="model">
+        </el-table-column> -->
+        <el-table-column label="规格" align="center" prop="specificationNew">
+        </el-table-column>
+
+        <el-table-column label="数量" align="center" prop="sumNew">
+          <template slot-scope="scope">
+            <el-form-item label-width="0px" :prop="'newPoList.' + scope.$index + '.sumNew'">
+              <el-input v-model.number="scope.row.sumNew" size="small" oninput="value=value.replace(/[^\d]/g,'')"
+                style="width: 100%" placeholder="输入数量" @input="inputNumber(scope.row)"></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="操作" align="center" width="70">
+          <template slot-scope="scope">
+            <el-link type="danger" :underline="false" @click="handleDeleteItem(scope.$index)">
+              删除
+            </el-link>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-form>
+    <div class="add-product" @click="addEquipment" v-if="title == '返工返修'">
+      <i class="el-icon-circle-plus-outline"></i>
+    </div>
+
+    <template v-slot:footer>
+      <el-button @click="cancel">取消</el-button>
+
+      <el-button type="primary" @click="save" :loading="loading">
+        提交
+      </el-button>
+    </template>
+
+    <!-- 选择产品 -->
+    <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose" :type="2">
+    </EquipmentDialog>
+  </ele-modal>
+</template>
+
+<script>
+import EquipmentDialog from './EquipmentDialog.vue';
+import {
+  warehouseList
+
+  // queryKilnXCH
+} from '@/api/inspectionWork/index';
+export default {
+  components: {
+    EquipmentDialog
+  },
+  data() {
+    return {
+      poList: [],
+      newPoList: [],
+      visible: false,
+      loading: false,
+      title: '返工返修',
+      originLong: '',
+      originHeight: '',
+      type: '',
+      warehouseList: []
+    };
+  },
+
+  computed: {},
+  created() {
+    warehouseList({ params: { status: 1 } }).then((res) => {
+      this.warehouseList = res;
+    });
+  },
+  methods: {
+    open(row, type) {
+      console.log(row, 'row')
+      this.visible = true;
+      this.poList = row;
+      this.type = type
+      this.title = type == 1 ? '返工返修' : type == 2 ? '报废' : '试销品';
+      if (
+        !row[0].productName.includes('板材') &&
+        !row[0].productName.includes('砌块')
+      ) {
+        return;
+      }
+      this._calcVolume(this.poList[0].specification);
+    },
+    handleChangeDepot(row, item) {
+      row.depotName = item.name;
+    },
+    cancel() {
+      this.visible = false;
+    },
+    // 删除产品
+    handleDeleteItem(index, id) {
+      this.$confirm('确认删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancleButtonText: '取消',
+        type: 'warning'
+      })
+        .then((res) => {
+          this.newPoList.splice(index, 1);
+        })
+        .catch(() => { });
+    },
+    addEquipment() {
+      this.$refs.equipmentRefs.open();
+    },
+    /* 保存编辑 */
+    save() {
+      let isSumNew = true,
+        isDepotId = true;
+      let data = this.title == '返工返修' ? this.newPoList : this.poList;
+
+      data.forEach((item) => {
+        if (this.title == '返工返修' && !item.sumNew) {
+          isSumNew = false;
+        }
+        if (this.title != '返工返修' && !item.depotId) {
+          isDepotId = false;
+        }
+      });
+      if (data.length == 0) {
+        this.$alert('产品列表不能为空');
+        return;
+      }
+      if (!isSumNew) {
+        this.$alert('数量不能为空');
+        return;
+      }
+      if (!isDepotId) {
+        this.$alert('请选择入库仓库');
+        return;
+      }
+      this.$emit('success', { data, type: this.type });
+      this.cancel();
+    },
+    // 封装计算体积方法
+    _calcVolume(string) {
+      let modelArr = string.split('*');
+      let originLong = Number(modelArr[0]);
+      let originWide = Number(modelArr[1]);
+      let originHeight = modelArr[2].substr(0, modelArr[2].indexOf('cm'));
+      this.originLong = originLong;
+      this.originHeight = originHeight;
+      return originLong * originWide * originHeight;
+    },
+    // 封装计算修补信息规格*块数的总体积
+    _calcModelVSWordcount() {
+      // 计算修补规格体积
+      let cutedVolume = 0;
+      let sumVolume = 0;
+      this.newPoList.map((item) => {
+        if (item.sumNew > 0 && item.specificationNew) {
+          cutedVolume =
+            this._calcVolume(item.specificationNew) * Number(item.sumNew);
+          sumVolume += cutedVolume;
+        }
+      });
+      return sumVolume;
+    },
+    // 输入块数计算规格体积是否超出原规格体积
+    inputNumber(row) {
+      if (
+        !row.productNameNew.includes('板材') &&
+        !row.productNameNew.includes('砌块')
+      ) {
+        return;
+      }
+      // 计算原规格体积
+      let originVolume = 0;
+      let sumVolume = 0;
+      originVolume = this._calcVolume(this.poList[0].specification);
+      console.log(originVolume, 'originVolume');
+      // 计算修补总体积
+      sumVolume = this._calcModelVSWordcount();
+      console.log(sumVolume, 'sumVolume');
+
+      if (sumVolume > originVolume) {
+        row.sumNew = 0;
+        this.$alert('修补规格总体积不能大于原规格体积!');
+      }
+    },
+    // 判断产品规格
+    modelChange(row) {
+      // 判断修补规格高度不能大于原规格高度
+      if (!row.name.includes('板材') && !row.name.includes('砌块')) {
+        return true;
+      }
+      let currentLong = Number(row.specification.split('*')[0]);
+      let currentHeight = row.specification.split('*')[2];
+      currentHeight = Number(
+        currentHeight.substr(0, currentHeight.indexOf('cm'))
+      );
+      if (currentLong > this.originLong) {
+        this.$alert('修补规格长度不能大于原规格长度!');
+        return false;
+      }
+      if (currentHeight > this.originHeight) {
+        this.$alert('修补规格高度不能大于原规格高度!');
+        return false;
+      }
+      return true;
+    },
+    // 确定选择
+    confirmChoose(data) {
+      console.log(data, 'data');
+      let list = [];
+      let is = true;
+      if (data.length > 0) {
+        list = JSON.parse(JSON.stringify(data)).map((item) => {
+          is = this.modelChange(item);
+          return {
+            productCodeNew: item.code,
+            productNameNew: item.name,
+            // productUnitWeight: item.netWeight,
+            // weightUnit: item.weightUnit,
+            specificationNew: item.specification,
+            sumNew: ''
+          };
+        });
+        if (!is) {
+          return;
+        }
+        this.newPoList = this.newPoList.concat(list);
+      }
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.basic-details-title {
+  margin: 10px 0;
+}
+
+.title {
+  font-size: 16px;
+  line-height: 45px;
+}
+
+.add-product {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+  font-size: 30px;
+  color: #1890ff;
+  margin: 10px 0;
+  cursor: pointer;
+}
+
+</style>

+ 92 - 0
src/views/unqualifiedProduct/unqualifiedList/components/order-search.vue

@@ -0,0 +1,92 @@
+<!-- 搜索表单 -->
+6
+<template>
+  <el-form label-width="77px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
+    <el-row :gutter="24">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="来源编码:">
+          <el-input clearable v-model="where.unqualifiedSourceCode" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="编码:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="创建人:">
+          <el-input clearable v-model="where.reviewerName" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="创建时间:">
+          <el-date-picker class="w100" style="width: 100%" v-model="where.createTime" type="daterange"
+            range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']">
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="工序:">
+          <el-input clearable v-model="where.produceTaskName" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 4 }">
+        <el-form-item label="状态:">
+          <el-select v-model="where.status" style="width:100%">
+            <el-option v-for="item in statusList" :key="item.code" :value="item.code" :label="item.name"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col style="display: flex; justify-content: flex-end"
+        v-bind="styleResponsive ? { lg: 12, md: 12 } : { span: 12 }">
+        <div class="ele-form-actions">
+          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
+            查询
+          </el-button>
+          <el-button @click="reset">重置</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  data() {
+    // 默认表单数据
+    const defaultWhere = {
+      code: '',
+      produceTaskName: '',
+      deptIds: ''
+    };
+    return {
+      defaultWhere,
+      // 表单数据
+      where: { ...defaultWhere },
+      statusList: [
+        { name: '待处理', code: 0 },
+        { name: '处理中', code: 1 },
+        { name: '已处理', code: 2 },
+      ],
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  methods: {
+    /* 搜索 */
+    search() {
+      this.$emit('search', this.where);
+    },
+    /*  重置 */
+    reset() {
+      this.where = { ...this.defaultWhere };
+      this.search();
+    }
+  }
+};
+</script>

+ 275 - 0
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -0,0 +1,275 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <order-search @search="getList" ref="searchRef"> </order-search>
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection">
+        <!-- 操作列 -->
+        <template v-slot:toolbar>
+          <el-button type="primary" slot="reference" :disabled="selection.length == 0"
+            @click="disposeList(1)">批量处置</el-button>
+
+          <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove" style="margin-left: 10px">
+            <template v-slot:reference>
+              <el-button :disabled="selection.length == 0" type="danger">批量删除</el-button>
+            </template>
+          </el-popconfirm>
+        </template>
+        <template v-slot:action="{ row }">
+          <el-popconfirm class="ele-action" title="确定要删除吗?" v-if="row.status == 0" @confirm="remove(row)">
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+          <el-link slot="reference" type="primary" :underline="false" icon="el-icon-edit" v-if="row.status == 0"
+            @click="disposeList(2, row)">
+            处置
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <el-dialog :visible.sync="dialogVisible" width="10%" @close="close">
+      <DictSelection dictName="不良品处理类型" :filterArr="all ? ['返工返修'] : []" v-model="disposeType" />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消 </el-button>
+        <el-button type="primary" @click="dispose()">确 定</el-button>
+      </span>
+    </el-dialog>
+    <Edit ref="edit" @success="save" />
+  </div>
+</template>
+
+<script>
+import OrderSearch from './components/detail-search.vue';
+import Edit from './components/edit.vue';
+
+import dictMixins from '@/mixins/dictMixins';
+import { unacceptedProductStatus } from '@/utils/util';
+
+import {
+  getDetail,
+  deleteUnacceptedProductDetail,
+  dispose
+} from '@/api/unacceptedProduct/index';
+export default {
+  components: {
+    OrderSearch,
+    Edit
+  },
+  mixins: [dictMixins],
+  data() {
+    return {
+      loading: false,
+      selection: [],
+      datasource: [],
+      disposeType: '',
+      dialogVisible: false,
+      current: null,
+      all: false
+    };
+  },
+  computed: {
+    // 表格列配置
+    columns() {
+      return [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          selectable: (row, index) => {
+            return row.status == 0; //
+          }
+        },
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'code',
+          label: '编码',
+          align: 'center'
+        },
+        {
+          prop: 'workOrderId',
+          label: '工单号',
+          align: 'center'
+        },
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center'
+        },
+        {
+          prop: 'engravingCode',
+          label: '刻码',
+          align: 'center'
+        },
+        {
+          prop: 'productName',
+          label: '产品名称',
+          align: 'center'
+        },
+        {
+          prop: 'productCode',
+          label: '产品编码',
+          align: 'center'
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center'
+        },
+        {
+          prop: 'brandNo',
+          label: '牌号',
+          align: 'center'
+        },
+
+        {
+          prop: 'unqualifiedQuantity',
+          label: '数量',
+          align: 'center',
+          width: 60
+        },
+        {
+          prop: 'produceRoutingName',
+          label: '工艺路线',
+          align: 'center'
+        },
+        {
+          prop: 'produceTaskName',
+          label: '工序',
+          align: 'center'
+        },
+        {
+          prop: 'unqualifiedReason',
+          label: '原因',
+          align: 'center'
+        },
+
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          width: 160
+        },
+        {
+          prop: 'reviewerName',
+          label: '创建人',
+          align: 'center'
+        },
+        {
+          prop: 'type',
+          label: '处置类型',
+          align: 'center',
+          // slot: 'SlottingType'
+          formatter: (row, column, cellValue) => {
+            return this.getDictValue('不良品处理类型', cellValue + '');
+          }
+        },
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          formatter: (row, column, cellValue) => {
+            return unacceptedProductStatus(cellValue);
+          }
+        },
+
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 150,
+          align: 'center',
+          resizable: false,
+          fixed: 'right',
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ];
+    }
+  },
+  created() {
+    this.getList();
+  },
+
+  methods: {
+    getList() {
+      getDetail(this.$route.query.id).then((res) => {
+        this.datasource = res;
+      });
+    },
+    // /* 表格数据源 */
+    // async datasource({ page, limit, where }) {
+    //   const result = await getDetail(this.$route.query.id);
+    //   console.log(result, 'result');
+    //   return {
+    //     list: result,
+    //     count: result.length
+    //   };
+    // },
+    remove(row) {
+      let ids = row ? [row.id] : this.selection.map((item) => item.id);
+      deleteUnacceptedProductDetail(ids).then((res) => {
+        this.$message.success('删除' + res);
+        this.getList();
+      });
+    },
+    close() {
+      this.all = false;
+      this.disposeType = ''
+    },
+    // // 处置
+    disposeList(type, row) {
+      if (type == 1) {
+        this.all = true;
+      } else {
+        this.current = row;
+      }
+      this.dialogVisible = true;
+      // let ids = this.current ? [this.current.id] : this.selection.map((item) => item.id);
+    },
+    async dispose() {
+      if (!this.disposeType) {
+        return;
+      }
+      this.$refs.edit.open(this.all ? this.selection : [this.current], this.disposeType);
+      this.dialogVisible = false;
+    },
+    async save(data) {
+      if (data.data && data.data.length > 0) {
+        data.data.forEach((item) => {
+          item['fid'] = item.id || this.current.id;
+        });
+      }
+      let ids =
+        data.type == 1 ? [this.current.id] : data.data.map((item) => item.id);
+      await dispose({
+        id: ids,
+        disposeType: Number(data.type),
+        poList: data.data
+      });
+      this.dialogVisible = false;
+      this.current = null;
+      this.$message.success('处置成功!');
+      this.getList();
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.unacceptedProductSelect {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+</style>

+ 212 - 0
src/views/unqualifiedProduct/unqualifiedList/index.vue

@@ -0,0 +1,212 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <order-search @search="reload" ref="searchRef"> </order-search>
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
+
+
+        <!-- 操作列 -->
+        <template v-slot:toolbar>
+          <el-button type="primary" @click="open()">新建</el-button>
+        </template>
+        <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" icon="el-icon-truck" v-if="row.status == 0" @click="open(row)">
+            编辑
+          </el-link>
+          <el-popconfirm class="ele-action" title="确定要删除吗?" v-if="row.status == 0" @confirm="remove(row)">
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+          <el-link type="primary" :underline="false" icon="el-icon-edit" @click="detail(row)">
+            处置
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <Create ref="create" @refresh="reload" />
+  </div>
+</template>
+
+<script>
+import OrderSearch from './components/order-search.vue';
+import dictMixins from '@/mixins/dictMixins';
+import { unacceptedProductStatus } from '@/utils/util';
+import Create from './components/create';
+
+import { getList, deleteUnacceptedProduct } from '@/api/unacceptedProduct/index';
+export default {
+  components: {
+    OrderSearch,
+    Create
+  },
+  mixins: [dictMixins],
+  data() {
+    return {
+      visible: false,
+      loading: false,
+      releasParams: {
+        teamId: '',
+        id: ''
+      },
+
+      current: null
+    };
+  },
+  computed: {
+    // 表格列配置
+    columns() {
+      return [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'code',
+          label: '编码',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'unqualifiedSourceCode',
+          label: '来源编码',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'unqualifiedQuantity',
+          label: '数量',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'produceRoutingName',
+          label: '工艺路线',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'produceTaskName',
+          label: '工序',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        {
+          prop: 'reviewerName',
+          label: '创建人',
+          align: 'center',
+          showOverflowTooltip: true,
+        },
+        // {
+        //   prop: 'slottingType',
+        //   label: '状态',
+        //   align: 'center',
+        //   slot: 'SlottingType'
+        // },
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          formatter: (row, column, cellValue) => {
+            return unacceptedProductStatus(cellValue);
+          }
+        },
+
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 240,
+          align: 'center',
+          resizable: false,
+          fixed: 'right',
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ];
+    }
+  },
+  created() {
+  },
+  filters: {
+
+  },
+  methods: {
+    //处置
+    detail(row) {
+      this.$router.push({
+        path: '/unqualifiedProduct/unqualifiedList/detailList',
+        query: {
+          id: row.id
+        }
+      });
+    },
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return getList({
+        pageNum: page,
+        size: limit,
+        ...where
+      });
+    },
+    open(row) {
+      this.$refs.create.open(row ? JSON.parse(JSON.stringify(row)) : '');
+    },
+    remove(row) {
+      deleteUnacceptedProduct(row.id).then((res) => {
+        this.$message.success('删除' + res);
+        this.reload();
+      });
+    },
+    // // 下达
+    // toRelease(row) {
+    //   this.current = row;
+    //   this.visible = true;
+    // },
+    // // 下达
+    // confirm(row) {
+    //   this.$confirm('确认下发选中的任务吗?', '提示', {
+    //     confirmButtonText: '确定',
+    //     cancleButtonText: '取消',
+    //     type: 'warning'
+    //   })
+    //     .then(async () => {
+    //       const res = await issuedPutMeshWorkOrder({
+    //         id: [row.id],
+    //         status: 1
+    //       });
+    //       this.$message.success('任务下发成功!');
+    //       this.reload();
+    //     })
+    //     .catch(() => {});
+    // },
+    /* 刷新表格 */
+    reload(where) {
+      this.$nextTick(() => {
+        this.$refs.table.reload({ page: 1, where });
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped></style>