ソースを参照

不良品列表;

yijing 1 年間 前
コミット
3984d2a561

+ 8 - 7
src/views/unqualifiedProduct/unqualifiedList/components/create.vue

@@ -54,15 +54,14 @@
         <el-table-column label="刻码" align="center" prop="engrave">
           <template slot-scope="scope">
             <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.engrave'">
-              <el-input v-model="scope.row.engrave" size="small" style="width: 100%"
-                placeholder="输入刻码"></el-input>
+              <el-input v-model="scope.row.engrave" 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="specification">-->
+        <!--        </el-table-column>-->
 
         <el-table-column label="数量" align="center" prop="unqualifiedQuantity">
           <template slot-scope="scope">
@@ -196,9 +195,10 @@ export default {
         this.getProduceTaskList();
         return;
       }
+      console.log(row, 'row');
       if (row) {
         this.title = '修改';
-        this.detail(row);
+        this.getDetail(row);
       } else {
         this.title = '创建';
       }
@@ -255,9 +255,10 @@ export default {
       });
     },
 
-    detail(row) {
+    getDetail(row) {
+      console.log(row.id, 'row.id')
+      this.form = row;
       getDetail(row.id).then((res) => {
-        this.form = row;
         this.getProduceTaskList();
         this.form.poList = res;
       });

+ 50 - 42
src/views/unqualifiedProduct/unqualifiedList/components/edit.vue

@@ -1,6 +1,6 @@
 <template>
   <ele-modal :visible.sync="visible" :title="title" width="40vw" append-to-body :maxable="true">
-    <div class="title">{{ title == '返工返修' ? '原' : '' }}产品信息</div>
+    <div class="title">{{ title == '返工' || title == '返修' ? '原' : '' }}产品信息</div>
     <el-table :data="poList" border>
       <el-table-column label="产品名称" align="center" prop="categoryName">
       </el-table-column>
@@ -8,25 +8,25 @@
       </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="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 != '返工返修'">
+      <el-table-column label="入库仓库" align="center" prop="deptId" v-if="title != '返工返修'">
         <template slot-scope="scope">
-          <el-select v-model="scope.row.depotId">
+          <el-select v-model="scope.row.deptId">
             <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 == '返工返修'">
+    <div class="title" v-if="title == '返工' || title == '返修'">返工返修产品信息</div>
+    <el-form ref="form" label-width="90px" class="create-form" v-if="title == '返工' || title == '返修'">
       <el-table :data="newPoList" border height="20vh">
         <el-table-column label="序号" align="center" width="60">
           <template slot-scope="scope">
@@ -63,7 +63,7 @@
         </el-table-column>
       </el-table>
     </el-form>
-    <div class="add-product" @click="addEquipment" v-if="title == '返工返修'">
+    <div class="add-product" @click="addEquipment" v-if="title == '返工' || title == '返修'">
       <i class="el-icon-circle-plus-outline"></i>
     </div>
 
@@ -98,7 +98,7 @@ export default {
       newPoList: [],
       visible: false,
       loading: false,
-      title: '返工返修',
+      title: '',
       originLong: '',
       originHeight: '',
       type: '',
@@ -114,17 +114,18 @@ export default {
   },
   methods: {
     open(row, type) {
-      console.log(row, 'row')
+      console.log(row, 'row', type)
+
       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.type = type;
+      this.title = type == 1 ? '返工' : type == 2 ? '返修' : type == 3 ? '报废' : '';
+      // if (
+      //   !row[0].productName.includes('板材') &&
+      //   !row[0].productName.includes('砌块')
+      // ) {
+      //   return;
+      // }
       this._calcVolume(this.poList[0].specification);
     },
     handleChangeDepot(row, item) {
@@ -150,28 +151,34 @@ export default {
     },
     /* 保存编辑 */
     save() {
-      let isSumNew = true,
-        isDepotId = true;
-      let data = this.title == '返工返修' ? this.newPoList : this.poList;
+      let isSumNew = true;
+      let isDepotId = true;
 
-      data.forEach((item) => {
-        if (this.title == '返工返修' && !item.sumNew) {
-          isSumNew = false;
-        }
-        if (this.title != '返工返修' && !item.depotId) {
+      let data = this.title == '报废' ? this.poList : this.newPoList;
+
+      this.poList.forEach((item) => {
+        if (this.title != '返工' && !item.deptId || this.title == '返修' && !item.deptId) {
+          console.log(item, 'item')
           isDepotId = false;
         }
       });
-      if (data.length == 0) {
-        this.$alert('产品列表不能为空');
+      if (!isDepotId) {
+        this.$message.error('请选择入库仓库');
         return;
       }
-      if (!isSumNew) {
-        this.$alert('数量不能为空');
+
+      if (this.newPoList.length == 0) {
+        this.$message.error('产品列表不能为空');
         return;
       }
-      if (!isDepotId) {
-        this.$alert('请选择入库仓库');
+      this.newPoList.forEach((item) => {
+        if (this.title == '返工' && item.sumNew == '' || this.title == '返修' && item.sumNew == '') {
+          isSumNew = false;
+        }
+      });
+
+      if (!isSumNew) {
+        this.$message.error('数量不能为空');
         return;
       }
       this.$emit('success', { data, type: this.type });
@@ -179,13 +186,15 @@ export default {
     },
     // 封装计算体积方法
     _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;
+      let modelArr = string?.split('*');
+      if (modelArr) {
+        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() {
@@ -229,8 +238,8 @@ export default {
       if (!row.name.includes('板材') && !row.name.includes('砌块')) {
         return true;
       }
-      let currentLong = Number(row.specification.split('*')[0]);
-      let currentHeight = row.specification.split('*')[2];
+      let currentLong = Number(row.specification?.split('*')[0]);
+      let currentHeight = row.specification?.split('*')[2];
       currentHeight = Number(
         currentHeight.substr(0, currentHeight.indexOf('cm'))
       );
@@ -290,5 +299,4 @@ export default {
   margin: 10px 0;
   cursor: pointer;
 }
-
 </style>

+ 136 - 29
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -1,42 +1,92 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <order-search @search="getList" ref="searchRef"> </order-search>
+      <order-search @search="reload" ref="searchRef"> </order-search>
       <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" :pageSize="20"
-                     :pageSizes="[20, 30, 40, 50, 100]">
+        :pageSizes="[20, 30, 40, 50, 100]">
         <!-- 操作列 -->
         <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>-->
+          <!--          <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.disposalStatus == null" @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.disposalStatus == null"
-            @click="disposeList(2, row)">
+          <!--          <el-popconfirm class="ele-action" title="确定要删除吗?" v-if="row.disposalStatus == null" @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.disposalStatus == null" @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-dialog :visible.sync="dialogVisible" width="35%" @close="close" title="处置">
+
+      <el-form ref="form1" :model="formData" label-width="80px">
+        <el-row :gutter="24">
+          <el-col :span="12">
+            <el-form-item label="产品编码">
+              <el-input v-model="formData.categoryCode" disabled></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="产品名称">
+              <el-input v-model="formData.categoryName" disabled></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="24">
+          <el-col :span="12">
+            <el-form-item label="批次号">
+              <el-input v-model="formData.batchNo" disabled></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="刻码">
+              <el-input v-model="formData.engrave" disabled></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="24">
+          <el-col :span="12">
+            <el-form-item label="类型">
+              <template>
+                <template v-if="this.qualityType == 1">
+                  <el-select v-model="formData.disposalStatus" placeholder="请选择" style="width: 100%;" clearable>
+                    <el-option v-for="item in disposalStatusListType" :key="item.value" :label="item.label"
+                      :value="item.value">
+                    </el-option>
+                  </el-select>
+                </template>
+                <template v-if="this.qualityType == 2">
+                  <el-select v-model="formData.disposalStatus" placeholder="请选择" style="width: 100%;" clearable>
+                    <el-option v-for="item in disposalStatusList" :key="item.value" :label="item.label"
+                      :value="item.value">
+                    </el-option>
+                  </el-select>
+                </template>
+              </template>
+              <!-- <DictSelection dictName="不良品处理类型" :filterArr="all ? ['返工返修'] : []" v-model="current.disposalStatus" /> -->
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消 </el-button>
-        <el-button type="primary" @click="dispose()">确 定</el-button>
-      </span>
+        <el-button type="primary" @click="handleDispose()">确 定</el-button>
+      </div>
     </el-dialog>
     <Edit ref="edit" @success="save" />
   </div>
@@ -67,8 +117,56 @@ export default {
       // datasource: [],
       disposeType: '',
       dialogVisible: false,
-      current: null,
-      all: false
+      current: {},
+      formData: {},
+      all: false,
+      qualityType: null,
+      //来料
+      disposalStatusListType: [
+        {
+          value: 5,
+          label: '让步接收'
+        },
+        {
+          value: 9,
+          label: '退货'
+        },
+      ],
+      //生产
+      disposalStatusList: [
+        {
+          value: 1,
+          label: '返工'
+        },
+        {
+          value: 2,
+          label: '返修'
+        },
+        {
+          value: 3,
+          label: '报废'
+        },
+        {
+          value: 4,
+          label: '降级使用'
+        },
+        {
+          value: 5,
+          label: '让步接收'
+        },
+        {
+          value: 6,
+          label: '留样'
+        },
+        {
+          value: 7,
+          label: '消耗'
+        },
+        {
+          value: 8,
+          label: '回用'
+        },
+      ],
     };
   },
   computed: {
@@ -81,7 +179,7 @@ export default {
           columnKey: 'selection',
           align: 'center',
           selectable: (row, index) => {
-            return row.status == 0; //
+            return row.status == 0;
           }
         },
         {
@@ -200,6 +298,7 @@ export default {
   },
   created() {
     // this.getList();
+    this.qualityType = this.$route.query.qualityType;
   },
 
   methods: {
@@ -220,6 +319,12 @@ export default {
       console.log(arr, 'arr')
       return arr.list;
     },
+    reload(where) {
+      this.$nextTick(() => {
+        if (this.$refs.searchRef && this.$refs.searchRef.reload)
+          this.$refs.searchRef.reload({ page: 1, where: where });
+      })
+    },
     remove(row) {
       let ids = row ? [row.id] : this.selection.map((item) => item.id);
       deleteUnacceptedProductDetail(ids).then((res) => {
@@ -229,7 +334,7 @@ export default {
     },
     close() {
       this.all = false;
-      this.disposeType = ''
+      this.formData.disposalStatus = ''
     },
     // // 处置
     disposeList(type, row) {
@@ -237,15 +342,17 @@ export default {
         this.all = true;
       } else {
         this.current = row;
+        console.log(this.current, 'row');
       }
+      this.formData = { ...row };
       this.dialogVisible = true;
       // let ids = this.current ? [this.current.id] : this.selection.map((item) => item.id);
     },
-    async dispose() {
-      if (!this.disposeType) {
+    async handleDispose() {
+      if (!this.formData.disposalStatus) {
         return;
       }
-      this.$refs.edit.open(this.all ? this.selection : [this.current], this.disposeType);
+      this.$refs.edit.open(this.all ? this.selection : [this.current], this.formData.disposalStatus);
       this.dialogVisible = false;
     },
     async save(data) {
@@ -264,7 +371,7 @@ export default {
       this.dialogVisible = false;
       this.current = null;
       this.$message.success('处置成功!');
-      this.getList();
+      this.reload();
     }
   }
 };

+ 20 - 16
src/views/unqualifiedProduct/unqualifiedList/index.vue

@@ -4,22 +4,25 @@
       <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:qualityType="{ row }">
+          {{ getDictValue('质检计划类型', row.qualityType) }}
+        </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 v-if="row.qualityType == null" type="primary" :underline="false" icon="el-icon-truck"
+            @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-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>
@@ -117,12 +120,12 @@ export default {
           align: 'center',
           showOverflowTooltip: true,
         },
-        // {
-        //   prop: 'slottingType',
-        //   label: '状态',
-        //   align: 'center',
-        //   slot: 'SlottingType'
-        // },
+        {
+          prop: 'qualityType',
+          slot: 'qualityType',
+          label: '质检类型',
+          align: 'center',
+        },
         {
           prop: 'status',
           label: '状态',
@@ -156,7 +159,8 @@ export default {
       this.$router.push({
         path: '/unqualifiedProduct/unqualifiedList/detailList',
         query: {
-          id: row.id
+          id: row.id,
+          qualityType: row.qualityType
         }
       });
     },

+ 1 - 1
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
       '/api': {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.107:18086',
-        target: 'http://192.168.1.251:18186',
+        target: 'http://192.168.1.251:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''