695593266@qq.com 1 год назад
Родитель
Сommit
b729c51db8
29 измененных файлов с 2831 добавлено и 482 удалено
  1. 104 8
      src/api/sample/index.js
  2. 64 12
      src/views/byProduct/index.vue
  3. 94 95
      src/views/entrust/components/order-search.vue
  4. 157 147
      src/views/operationControl/index.vue
  5. 2 2
      src/views/outsourcing/components/search.vue
  6. 1 1
      src/views/outsourcing/index.vue
  7. 18 2
      src/views/produce/components/jobBooking/components/batchSemiProductJobBom.vue
  8. 3 2
      src/views/produce/components/jobBooking/components/byProductBom.vue
  9. 15 0
      src/views/produce/components/jobBooking/components/jobBom.vue
  10. 15 0
      src/views/produce/components/jobBooking/components/jobDdBom.vue
  11. 17 2
      src/views/produce/components/jobBooking/components/semiProductJobBom.vue
  12. 36 7
      src/views/produce/components/jobBooking/index.vue
  13. 17 1
      src/views/produce/components/new_produceOrder.vue
  14. 2 2
      src/views/produce/components/outsourcing/outsourceList.vue
  15. 28 0
      src/views/produce/components/warehousing/components/newJobDdBom.vue
  16. 38 0
      src/views/produce/components/warehousing/index.vue
  17. 6 0
      src/views/produce/components/workPlan/components/sampleListDialog.vue
  18. 12 2
      src/views/produce/components/workPlan/edit.vue
  19. 8 8
      src/views/produce/components/workPlan/index.vue
  20. 9 1
      src/views/produce/index.vue
  21. 9 8
      src/views/produceOrder/index.vue
  22. 296 0
      src/views/sample/components/addOrEditSample.vue
  23. 77 0
      src/views/sample/components/baseInfo.vue
  24. 339 0
      src/views/sample/components/edit.vue
  25. 226 0
      src/views/sample/components/equipmentDialog.vue
  26. 244 0
      src/views/sample/components/sampleTable.vue
  27. 86 88
      src/views/sample/components/search.vue
  28. 684 0
      src/views/sample/detailList.vue
  29. 224 94
      src/views/sample/index.vue

+ 104 - 8
src/api/sample/index.js

@@ -1,23 +1,119 @@
 import request from '@/utils/request';
 
-
-/**
- * 列表
- */
+// 列表
 export async function getList(data) {
-  const res = await request.get('/mes/sample/page', {params:data});
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/sample/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//保存
+export async function saveData(data) {
+  const res = await request.post(`/qms/sample/save`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
+// 列表
+export async function getSampleQWorkOrderIdPage(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/sample/getSampleQWorkOrderId?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 详情页面
+
+export async function getById(id) {
+  const res = await request.get(`/qms/sample/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function disposeSubmit(data) {
+  const res = await request.post(`/qms/sample/dispose`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 列表
+export async function getSampleSmallWhole(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(
+    `/qms/qualitysample/getSampleSmallWhole?` + par,
+    {}
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function getQualitySampleList(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/qualitysample/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 //删除
-export async function deleteLine(data) {
-  const res = await request.delete('/mes/sample/delete', {data});
+export async function removeItem(data) {
+  const res = await request.delete('/qms/sample/delete', {
+    data
+  });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//修改
+export async function updateData(data) {
+  const res = await request.put('/qms/sample/update', data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 样品处置
+export async function disposeApi(data) {
+  const res = await request.post('/qms/sample/dispose', data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 样品删除
+export async function removeSample(data) {
+  const res = await request.delete('/qms/qualityinventory/delete', {
+    data
+  });
   if (res.data.code == 0) {
     return res.data.message;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+export async function getWarehouseList(data) {
+  const res = await request.post(`/wms/warehouse/select/warehouseList`, {
+    params: { status: 1 }
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 64 - 12
src/views/byProduct/index.vue

@@ -16,7 +16,9 @@
         @update:selection="handleSelectionChange"
       >
         <template v-slot:toolbar>
-          <el-button type="primary" size="mini" @click="handByProd">新建回收单</el-button>
+          <el-button type="primary" size="mini" @click="handByProd"
+            >新建回收单</el-button
+          >
         </template>
 
         <template v-slot:formedNum="{ row }">
@@ -28,22 +30,58 @@
         </template>
 
         <template v-slot:action="{ row }">
-          <el-button type="text" size="mini">详情</el-button>
+          <!-- <el-button type="text" size="mini">详情</el-button> -->
+          <el-button type="text" size="mini" @click="disopseProduct(row)"
+            >处置</el-button
+          >
         </template>
       </ele-pro-table>
     </el-card>
 
-
     <addByProduct v-if="addByProductShow" @close="close"></addByProduct>
-    
 
+    <el-dialog
+      title="仓库处置"
+      :visible.sync="visible"
+      v-if="visible"
+      :before-close="handleClose"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      width="500px"
+    >
+      <el-form size="mini" :model="form" label-width="96px">
+        <el-form-item label="仓库" prop="warehouseList">
+          <el-select
+            v-model="form.warehouseId"
+            filterable
+            placeholder="请选择仓库"
+          >
+            <el-option
+              v-for="item in warehouseList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+
+      <template slot="footer">
+        <el-button size="mini" @click="visible = false">取 消</el-button>
+        <el-button size="mini" type="primary" @click="warehouseSave"
+          >保 存</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
 <script>
   import { getPage } from '@/api/byProduct/index';
   import byProductSearch from './components/byProduct-search.vue';
-  import  addByProduct from './components/addByProduct.vue';
+  import addByProduct from './components/addByProduct.vue';
 
   export default {
     components: {
@@ -57,13 +95,18 @@
         loading: false,
         selection: [],
 
-        addByProductShow: false
+        addByProductShow: false,
+        visible: false,
+        warehouseList: [],
+        form: {
+          warehouseId: ''
+        }
       };
     },
     computed: {
       columns() {
         return [
-        {
+          {
             columnKey: 'index',
             label: '序号',
             type: 'index',
@@ -180,18 +223,27 @@
         this.$refs.table.reload({ page: 1, where });
       },
 
+      handleClose() {
+        this.visible = false;
+      },
+
+      warehouseSave() {
+        this.visible = false;
+      },
+
+      disopseProduct(item) {
+        this.visible = true;
+      },
 
       handByProd() {
         this.addByProductShow = true;
       },
       close(val) {
-        if(val) {
-           this.reload();
-
+        if (val) {
+          this.reload();
         }
         this.addByProductShow = false;
-      },
-      
+      }
     }
   };
 </script>

+ 94 - 95
src/views/entrust/components/order-search.vue

@@ -58,40 +58,40 @@
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="请托工厂:">
           <el-select
-              style="width: 100%"
-              v-model="where.factoriesId"
-              placeholder="请选择"
-              clearable
+            style="width: 100%"
+            v-model="where.factoriesId"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in factoryList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
             >
-              <el-option
-                v-for="item in factoryList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id"
-              >
-              </el-option>
-            </el-select>
+            </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-select
-              style="width: 100%"
-              v-model="where.beEntrustedFactoriesId"
-              placeholder="请选择"
-              clearable
+            style="width: 100%"
+            v-model="where.beEntrustedFactoriesId"
+            placeholder="请选择"
+            clearable
+          >
+            <el-option
+              v-for="item in factoryList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
             >
-              <el-option
-                v-for="item in factoryList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id"
-              >
-              </el-option>
-            </el-select>
+            </el-option>
+          </el-select>
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+      <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="组织机构:">
           <auth-selection
             data-type="Array"
@@ -99,8 +99,8 @@
             style="width: 100%"
           ></auth-selection>
         </el-form-item>
-      </el-col>
-      
+      </el-col> -->
+
       <el-col v-bind="styleResponsive ? { lg: 24, md: 24 } : { span: 24 }">
         <el-form-item>
           <div style="display: flex; justify-content: end">
@@ -123,79 +123,78 @@
 </template>
 
 <script>
-import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 
-export default {
-  props: [],
-  data() {
-    // 默认表单数据
-    const defaultWhere = {
-      type: '',
-      relationType: '',
-      name: '',
-      code: '',
-      status: '',
-      createTime: [],
-      createUserName: '',
-      beEntrustedFactoriesId:'',
-      factoriesId:'',
-      deptIds: ''
-    };
-    return {
-      // 表单数据
-      where: { ...defaultWhere },
-      factoryList:[],
-      options: [
-        { label: '草稿', value: 0 },
-        { label: '审核中', value: 1 },
-        { label: '审核通过', value: 2 },
-        { label: '生产工单', value: 3 },
-        { label: '已处置', value: 4 }
-      ]
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  watch: {},
-  created() {
-    this.getFactoryList();
-    
-  },
-  methods: {
-    async getFactoryList() {
-      const { list } = await warehouseDefinition.getFactoryarea({
-        pageNum: 1,
-        size: 999,
-        type: 1
-      });
-      this.factoryList = list || [];
+  export default {
+    props: [],
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        type: '',
+        relationType: '',
+        name: '',
+        code: '',
+        status: '',
+        createTime: [],
+        createUserName: '',
+        beEntrustedFactoriesId: '',
+        factoriesId: '',
+        deptIds: ''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+        factoryList: [],
+        options: [
+          { label: '草稿', value: 0 },
+          { label: '审核中', value: 1 },
+          { label: '审核通过', value: 2 },
+          { label: '生产工单', value: 3 },
+          { label: '已处置', value: 4 }
+        ]
+      };
     },
-    /* 搜索 */
-    search() {
-      const where = { ...this.where };
-      if (where.createTime?.length) {
-        where.startTime = where.createTime[0];
-        where.endTime = where.createTime[1];
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
       }
-      delete where.createTime;
-      this.$emit('search', where);
     },
-    /*  重置 */
-    reset() {
-      this.where = { ...this.defaultWhere };
-      this.search();
+    watch: {},
+    created() {
+      this.getFactoryList();
+    },
+    methods: {
+      async getFactoryList() {
+        const { list } = await warehouseDefinition.getFactoryarea({
+          pageNum: 1,
+          size: 999,
+          type: 1
+        });
+        this.factoryList = list || [];
+      },
+      /* 搜索 */
+      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;
-}
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
 </style>

+ 157 - 147
src/views/operationControl/index.vue

@@ -1,74 +1,78 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-		<div class="form-wrapper">
-		  <el-form
-		    :model="formData"
-		    label-width="0"
-		    :show-message="false"
-		    ref="formRef"
-			:rules="rules"
-		  >
-		    <el-descriptions title="" :column="1" border>
-		      <el-descriptions-item
-		        label="日期方式"
-		      >
-					<span slot="label" class="label-required">日期方式</span>
-					<el-form-item prop="formingNum">
-						<DictSelection
-							dictName="日期方式"
-							clearable
-							v-model="formData.dateType"
-							@change="changeType"
-						>
-						</DictSelection>
-					</el-form-item>
-		      </el-descriptions-item>
-		      <el-descriptions-item
-				v-if="formData.dateType==2"
-		      >
-		        <span slot="label" class="label-required"><i>*</i> 指定日期</span>
-		        <el-form-item prop="appointTime" class="w100">
-		          <el-date-picker
-		            class="w100"
-		            v-model="formData.appointTime"
-		            type="datetime"
-		            value-format="yyyy-MM-dd HH:mm:ss"
-		          ></el-date-picker> </el-form-item
-		      ></el-descriptions-item>
-			  <el-descriptions-item
-			    label="关闭工单"
-			  >
-					<span slot="label" class="label-required">关闭工单</span>
-					<el-form-item prop="orderClose">
-						  <el-radio v-model="formData.orderClose" :label="1">启用</el-radio>
-						  <el-radio v-model="formData.orderClose" :label="0">禁用</el-radio>
-					</el-form-item>
-			  </el-descriptions-item>
-			  <el-descriptions-item
-			    label="报工操作"
-			  >
-					<span slot="label" class="label-required">报工操作</span>
-					<el-form-item prop="reportWork">
-						  <el-radio v-model="formData.reportWork" :label="1">启用</el-radio>
-						  <el-radio v-model="formData.reportWork" :label="0">禁用</el-radio>
-					</el-form-item>
-			  </el-descriptions-item>
-			  <el-descriptions-item
-			    label="货物移动"
-			  >
-					<span slot="label" class="label-required">货物移动</span>
-					<el-form-item prop="goodsMovement">
-						  <el-radio v-model="formData.goodsMovement" :label="1">启用</el-radio>
-						  <el-radio v-model="formData.goodsMovement" :label="0">禁用</el-radio>
-					</el-form-item>
-			  </el-descriptions-item>
-		    </el-descriptions>
-		  </el-form>
-		  <div class="footer">
-		    <el-button type="primary" @click="confirm" :loading="saveLoading">保存</el-button>
-		  </div>
-		</div>
+      <div class="form-wrapper">
+        <el-form
+          :model="formData"
+          label-width="0"
+          :show-message="false"
+          ref="formRef"
+          :rules="rules"
+        >
+          <el-descriptions title="" :column="1" border>
+            <el-descriptions-item label="日期方式">
+              <span slot="label" class="label-required">日期方式</span>
+              <el-form-item prop="formingNum">
+                <DictSelection
+                  dictName="日期方式"
+                  clearable
+                  v-model="formData.dateType"
+                  @change="changeType"
+                >
+                </DictSelection>
+              </el-form-item>
+            </el-descriptions-item>
+            <el-descriptions-item v-if="formData.dateType == 2">
+              <span slot="label" class="label-required"><i>*</i> 指定日期</span>
+              <el-form-item prop="appointTime" class="w100">
+                <el-date-picker
+                  class="w100"
+                  v-model="formData.appointTime"
+                  type="datetime"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                ></el-date-picker> </el-form-item
+            ></el-descriptions-item>
+            <el-descriptions-item label="关闭工单">
+              <span slot="label" class="label-required">关闭工单</span>
+              <el-form-item prop="orderClose">
+                <el-radio v-model="formData.orderClose" :label="1"
+                  >启用</el-radio
+                >
+                <el-radio v-model="formData.orderClose" :label="0"
+                  >禁用</el-radio
+                >
+              </el-form-item>
+            </el-descriptions-item>
+            <el-descriptions-item label="报工操作">
+              <span slot="label" class="label-required">报工操作</span>
+              <el-form-item prop="reportWork">
+                <el-radio v-model="formData.reportWork" :label="1"
+                  >启用</el-radio
+                >
+                <el-radio v-model="formData.reportWork" :label="0"
+                  >禁用</el-radio
+                >
+              </el-form-item>
+            </el-descriptions-item>
+            <el-descriptions-item label="货物移动">
+              <span slot="label" class="label-required">货物移动</span>
+              <el-form-item prop="goodsMovement">
+                <el-radio v-model="formData.goodsMovement" :label="1"
+                  >启用</el-radio
+                >
+                <el-radio v-model="formData.goodsMovement" :label="0"
+                  >禁用</el-radio
+                >
+              </el-form-item>
+            </el-descriptions-item>
+          </el-descriptions>
+        </el-form>
+        <div class="footer">
+          <el-button type="primary" @click="confirm" :loading="saveLoading"
+            >保存</el-button
+          >
+        </div>
+      </div>
     </el-card>
   </div>
 </template>
@@ -82,93 +86,99 @@
     controlUpdate
   } from '@/api/operationControl/index.js';
   export default {
-	mixins: [dictMixins],
-    data () {
+    mixins: [dictMixins],
+    data() {
       return {
-		  // 加载状态
-		  loading: false,
-		  formData:{
-			  dateType:1,
-			  orderClose:1,
-			  reportWork:1,
-			  goodsMovement:1,
-			  appointTime:''
-		  },
-		  fnType:1,
-		  saveLoading:false,
-		  rules:{
-			  appointTime: [{ required: true, message: '请选择指定日期', trigger: 'change' }]
-		  }
+        // 加载状态
+        loading: false,
+        formData: {
+          dateType: 1,
+          orderClose: 1,
+          reportWork: 1,
+          goodsMovement: 1,
+          appointTime: ''
+        },
+        fnType: 1,
+        saveLoading: false,
+        rules: {
+          appointTime: [
+            { required: true, message: '请选择指定日期', trigger: 'change' }
+          ]
+        }
       };
     },
-    computed: {
+    computed: {},
+    async created() {
+      this.getInfoData();
     },
-	async created() {
-		this.getInfoData()
-	},
     methods: {
-		changeType(val){
-			if(val==2){
-				const time = dayjs( new Date().getTime() ).format('YYYY-MM-DD HH:mm:ss');
-				this.$set(this.formData,'appointTime',time)
-			}
-		},
-		async getInfoData(){
-			const res = await getInfo()
-			if(typeof res == 'string'){
-				this.fnType = 1
-			}else{
-				this.formData = res
-				this.fnType = 2
-			}
-		},
-		confirm(){
-			const saveOrUpdate = this.fnType == 1?controlSave:controlUpdate
-			if(this.formData.dateType==1){
-				delete this.formData.appointTime
-			}
-			 this.$refs.formRef.validate((valid) => {
-			  if (valid) {
-				this.saveLoading = true
-				saveOrUpdate(this.formData).then(res=>{
-					this.$message.success(res)
-					this.saveLoading = false
-					this.getInfoData()
-				}).catch(()=>{
-					this.saveLoading = false
-				})
-			  } else {
-				return false;
-			  }
-			})
-		}
-     
+      changeType(val) {
+        if (val == 2) {
+          const time = dayjs(new Date().getTime()).format(
+            'YYYY-MM-DD HH:mm:ss'
+          );
+          this.$set(this.formData, 'appointTime', time);
+        }
+      },
+      async getInfoData() {
+        const res = await getInfo();
+        if (typeof res == 'string') {
+          this.fnType = 1;
+        } else {
+          this.formData = res;
+          this.fnType = 2;
+        }
+      },
+      confirm() {
+        const saveOrUpdate =
+          this.fnType == 1 || !this.fnType ? controlSave : controlUpdate;
+
+        if (this.formData.dateType == 1) {
+          delete this.formData.appointTime;
+        }
+        this.$refs.formRef.validate((valid) => {
+          if (valid) {
+            this.saveLoading = true;
+            saveOrUpdate(this.formData)
+              .then((res) => {
+                this.$message.success(res);
+                this.saveLoading = false;
+                this.getInfoData();
+              })
+              .catch(() => {
+                this.saveLoading = false;
+              });
+          } else {
+            return false;
+          }
+        });
+      }
     }
   };
 </script>
 
 <style lang="scss" scoped>
-	.form-wrapper{
-		width: 40%;
-		margin: 10px auto;
-		.el-form-item{
-			margin-bottom: 0;
-		}
-		.w100{
-			width: 100%!important;
-		}
-		.footer{
-			width: 100%;
-			margin: 20px auto 0;
-			display: flex;
-			align-items: center;
-			justify-content: flex-end;
-		}
-		.label-required{
-			i{
-				color: red;
-				font-style: normal;
-			}
-		}
-	}
+  .form-wrapper {
+    width: 40%;
+    margin: 10px auto;
+    .el-form-item {
+      margin-bottom: 0;
+    }
+    .w100 {
+      width: 100% !important;
+    }
+    .footer {
+      width: 100%;
+      margin: 20px auto 0;
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+    }
+    .label-required {
+      i {
+        color: red;
+        font-style: normal;
+      }
+    }
+  }
 </style>

+ 2 - 2
src/views/outsourcing/components/search.vue

@@ -40,14 +40,14 @@
         </el-form-item>
       </el-col>
 
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+      <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="组织机构:">
           <auth-selection
             v-model="where.deptIds"
             style="width: 100%"
           ></auth-selection>
         </el-form-item>
-      </el-col>
+      </el-col> -->
 
       <el-col
         style="display: flex; justify-content: flex-end"

+ 1 - 1
src/views/outsourcing/index.vue

@@ -106,7 +106,7 @@
             :underline="false"
             @click="handleRelease(row)"
           >
-            发布
+            提交
           </el-link>
         </template>
       </ele-pro-table>

+ 18 - 2
src/views/produce/components/jobBooking/components/batchSemiProductJobBom.vue

@@ -217,7 +217,13 @@
           v-model="row.extInfo.notType"
           filterable
           placeholder="请选择"
-          :disabled="isDetails"
+          :disabled="
+            (isDetails ||
+              taskObj.type == 2 ||
+              taskObj.type == 3 ||
+              taskObj.type == 6) &&
+            clientEnvironmentId != 3
+          "
         >
           <el-option
             v-for="item in notTypeList"
@@ -260,10 +266,13 @@
             size="mini"
             class="content_num"
             v-model="row.extInfo.taskId"
-            clearable
             filterable
             placeholder="请选择"
             @change="(e) => selectName(e, $index)"
+            :disabled="
+              (taskObj.type == 2 || taskObj.type == 3 || taskObj.type == 6) &&
+              clientEnvironmentId != 3
+            "
           >
             <el-option
               v-for="item in stepsList"
@@ -1451,6 +1460,7 @@
           type: 'warning'
         })
           .then(() => {
+            // console.log(total, '总数------------------');
             ids.forEach((sitem, sindex) => {
               this.list.forEach((item, index) => {
                 let id = item.id || item.instanceId;
@@ -1460,6 +1470,12 @@
               });
             });
           })
+          .then(() => {
+            if (this.list.length == 0) {
+              this.$set(this.item.workReportInfo, 'formedNum', 0);
+              this.$set(this.item.workReportInfo, 'notFormedNum', 0);
+            }
+          })
           .catch(() => {});
       }
     },

+ 3 - 2
src/views/produce/components/jobBooking/components/byProductBom.vue

@@ -37,13 +37,13 @@
               @click="penalize(index)"
               >处置</div
             >
-            <div
+            <!-- <div
               v-if="isDetails"
               class="penalize"
               :style="{ background: item.warehouseId ? '#FFA07A' : '' }"
               @click="handleView(item.warehouseName)"
               >查看</div
-            >
+            > -->
           </div>
         </div>
       </div>
@@ -52,6 +52,7 @@
     <el-dialog
       title="仓库处置"
       :visible.sync="visible"
+      v-if="visible"
       :before-close="handleClose"
       :close-on-click-modal="false"
       :close-on-press-escape="false"

+ 15 - 0
src/views/produce/components/jobBooking/components/jobBom.vue

@@ -253,6 +253,21 @@
         handler(newVal) {
           // this.$set(this.item, 'workReportInfo', newVal.workReportInfo);
           console.log(newVal, '修改后的数据');
+          if (newVal.product && newVal.product.length != 0) {
+            let formedNum = 0;
+            let notFormedNum = 0;
+
+            newVal.product.forEach((item) => {
+              if (!item.extInfo.isQualified || item.extInfo.isQualified == 1) {
+                formedNum = formedNum + Number(item.feedQuantity);
+              } else {
+                notFormedNum = notFormedNum + Number(item.feedQuantity);
+              }
+            });
+
+            this.$set(this.item.workReportInfo, 'formedNum', formedNum);
+            this.$set(this.item.workReportInfo, 'notFormedNum', notFormedNum);
+          } 
           // this.set()
           // if(this.taskObj.type == 6 ){
           //   console.log('112334',newVal)

+ 15 - 0
src/views/produce/components/jobBooking/components/jobDdBom.vue

@@ -183,6 +183,21 @@
         immediate: true,
         deep: true,
         handler(newVal) {
+          if (newVal.semiProductList && newVal.semiProductList.length != 0) {
+            let formedNum = 0;
+            let notFormedNum = 0;
+
+            newVal.semiProductList.forEach((item) => {
+              if (!item.extInfo.isQualified || item.extInfo.isQualified == 1) {
+                formedNum = formedNum + Number(item.feedQuantity);
+              } else {
+                notFormedNum = notFormedNum + Number(item.feedQuantity);
+              }
+            });
+
+            this.$set(this.item.workReportInfo, 'formedNum', formedNum);
+            this.$set(this.item.workReportInfo, 'notFormedNum', notFormedNum);
+          }
           // console.log('jhsaighajighsag',newVal)
           // if (newVal.semiProductList.length) {
           //     let formedNum = 0;

+ 17 - 2
src/views/produce/components/jobBooking/components/semiProductJobBom.vue

@@ -226,7 +226,13 @@
           v-model="row.extInfo.notType"
           filterable
           placeholder="请选择"
-          :disabled="isDetails"
+          :disabled="
+            (isDetails ||
+              taskObj.type == 2 ||
+              taskObj.type == 3 ||
+              taskObj.type == 6) &&
+            clientEnvironmentId != 3
+          "
         >
           <el-option
             v-for="item in notTypeList"
@@ -245,7 +251,6 @@
       <template v-slot:taskName="{ row, $index }">
         <div
           v-if="
-            row.extInfo.isQualified != 1 &&
             row.extInfo.notType &&
             row.extInfo.notType != 5 &&
             row.extInfo.notType != 8
@@ -272,6 +277,10 @@
             filterable
             placeholder="请选择"
             @change="(e) => selectName(e, $index)"
+            :disabled="
+              (taskObj.type == 2 || taskObj.type == 3 || taskObj.type == 6) &&
+              clientEnvironmentId != 3
+            "
           >
             <el-option
               v-for="item in stepsList"
@@ -1362,6 +1371,12 @@
               });
             });
           })
+          .then(() => {
+            if (this.list.length == 0) {
+              this.$set(this.item.workReportInfo, 'formedNum', 0);
+              this.$set(this.item.workReportInfo, 'notFormedNum', 0);
+            }
+          })
           .catch(() => {});
       }
     },

+ 36 - 7
src/views/produce/components/jobBooking/index.vue

@@ -443,7 +443,11 @@
           return [];
         }
       },
-      reportNeedFeed: {}
+      reportNeedFeed: {},
+      workPlanType: {
+        type: String,
+        default: ''
+      }
     },
 
     data() {
@@ -480,6 +484,13 @@
         },
         deep: true,
         immediate: true
+      },
+      workPlanType: {
+        handler(val) {
+          if (val == 1) {
+            this.getList(this.idsList);
+          }
+        }
       }
     },
 
@@ -714,24 +725,42 @@
                   }
                 ];
 
-                if (obj.semiProductList.length > 0) {
+                if (obj.semiProductList.length != 0) {
                   // 预制体报工
                   obj.workReportInfo.formedNum = obj.semiProductList.length;
                   let numCot = 0;
+                  let notFormedNum = 0;
                   if (obj.semiProductList.length > 0) {
                     obj.semiProductList.map((fitem) => {
-                      numCot = numCot + fitem.feedQuantity || 1;
+                      if (
+                        !fitem.extInfo.isQualified ||
+                        fitem.extInfo.isQualified == 1
+                      ) {
+                        numCot = numCot + fitem.feedQuantity || 1;
+                      } else {
+                        notFormedNum = notFormedNum + fitem.feedQuantity;
+                      }
                     });
                     obj.workReportInfo.formedNum = numCot;
+                    obj.workReportInfo.notFormedNum = notFormedNum;
                   }
-                } else if (obj.product.length > 0) {
-                  const number = obj.product.reduce((acc, pro) => {
-                    return pro.feedQuantity
+                } else if (obj.product.length != 0) {
+                  const formedNum = obj.product.reduce((acc, pro) => {
+                    return pro.feedQuantity &&
+                      (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
+                      ? acc + Number(pro.feedQuantity)
+                      : acc;
+                  }, 0);
+
+                  const notFormedNum = obj.product.reduce((acc, pro) => {
+                    return pro.feedQuantity && pro.extInfo.isQualified == 2
                       ? acc + Number(pro.feedQuantity)
                       : acc;
                   }, 0);
 
-                  obj.workReportInfo.formedNum = number;
+                  obj.workReportInfo.formedNum = formedNum;
+
+                  obj.workReportInfo.notFormedNum = notFormedNum;
                 }
 
                 obj.workReportInfo.formingNum = obj.formingNum;

+ 17 - 1
src/views/produce/components/new_produceOrder.vue

@@ -15,6 +15,7 @@
       @sort-change="onSortChange"
       @columns-change="handleColumnChange"
       :cache-key="cacheKeyUrl"
+      :row-class-name="tableRowClassName"
     >
       <!-- <template v-slot:toolbar>
         <div class="rx-bc">
@@ -362,6 +363,12 @@
         // {{  row.reportStatus }}  {{  row.feedStatus }}
       },
 
+      tableRowClassName({ row, rowIndex }) {
+        if (row.outsourceStatus == 2) {
+          return 'warning-row';
+        }
+      },
+
       /* 表格数据源 */
       datasource({ page, where }) {
         if (!this.taskObj?.id) {
@@ -458,4 +465,13 @@
   };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+  ::v-deep .el-table .warning-row {
+    background: #39d9ac;
+    // color: #39d9ac;
+  }
+
+  ::v-deep .el-table .success-row {
+    background: #f0f9eb;
+  }
+</style>

+ 2 - 2
src/views/produce/components/outsourcing/outsourceList.vue

@@ -370,7 +370,7 @@
         class="u-reset-button"
         @click="handOK(0)"
       >
-        提交
+        确认
       </el-button>
 
       <el-button
@@ -379,7 +379,7 @@
         class="u-reset-button"
         @click="handOK(1)"
       >
-        提交并发布
+        提交
       </el-button>
     </div>
 

+ 28 - 0
src/views/produce/components/warehousing/components/newJobDdBom.vue

@@ -250,6 +250,34 @@
             this.$forceUpdate();
           }
 
+          if (newVal.product.length) {
+            let formedNum = 0;
+            let noFormingNum = 0;
+            let formedWeight = 0;
+            let notFormedWeight = 0;
+
+            newVal.product.forEach((v) => {
+              // 合格品数量
+              if (v.extInfo.isQualified == 1) {
+                formedNum += 1;
+                formedWeight += Number(v.extInfo.reportWeight) || 0;
+              } else {
+                noFormingNum += 1;
+                notFormedWeight += Number(v.extInfo.reportWeight) || 0;
+              }
+            });
+
+            newVal.workReportInfo.formedNum = formedNum;
+            newVal.workReportInfo.notFormedNum = noFormingNum;
+            newVal.workReportInfo.formedWeight = parseFloat(
+              formedWeight.toFixed(3)
+            );
+            newVal.workReportInfo.notFormedWeight = parseFloat(
+              notFormedWeight.toFixed(3)
+            );
+            this.$forceUpdate();
+          }
+
           //打包信息重量相加赋值给总重量
           let formedWeight = 0;
           if (newVal.toWarehouseList && newVal.toWarehouseList.length > 0) {

+ 38 - 0
src/views/produce/components/warehousing/index.vue

@@ -585,6 +585,44 @@
                 }
               ];
 
+              if (obj.semiProductList.length != 0) {
+                // 预制体报工
+                obj.workReportInfo.formedNum = obj.semiProductList.length;
+                let numCot = 0;
+                let notFormedNum = 0;
+                if (obj.semiProductList.length > 0) {
+                  obj.semiProductList.map((fitem) => {
+                    if (
+                      !fitem.extInfo.isQualified ||
+                      fitem.extInfo.isQualified == 1
+                    ) {
+                      numCot = numCot + fitem.feedQuantity || 1;
+                    } else {
+                      notFormedNum = notFormedNum + fitem.feedQuantity;
+                    }
+                  });
+                  obj.workReportInfo.formedNum = numCot;
+                  obj.workReportInfo.notFormedNum = notFormedNum;
+                }
+              } else if (obj.product.length != 0) {
+                const formedNum = obj.product.reduce((acc, pro) => {
+                  return pro.feedQuantity &&
+                    (!pro.extInfo.isQualified || pro.extInfo.isQualified == 1)
+                    ? acc + Number(pro.feedQuantity)
+                    : acc;
+                }, 0);
+
+                const notFormedNum = obj.product.reduce((acc, pro) => {
+                  return pro.feedQuantity && pro.extInfo.isQualified == 2
+                    ? acc + Number(pro.feedQuantity)
+                    : acc;
+                }, 0);
+
+                obj.workReportInfo.formedNum = formedNum;
+
+                obj.workReportInfo.notFormedNum = notFormedNum;
+              }
+
               return {
                 ...obj
               };

+ 6 - 0
src/views/produce/components/workPlan/components/sampleListDialog.vue

@@ -241,6 +241,12 @@
             list[0].qualitySampleTemplateList[i].qualityResults =
               list[0].qualityResults;
           }
+        } else {
+          list.forEach((item) => {
+            item.qualitySampleTemplateList.forEach((it) => {
+              it.qualityResults = it.qualityResults ? item.qualityResults : 1;
+            });
+          });
         }
         this.tableData = JSON.parse(JSON.stringify(list));
         console.log(this.tableData, '33333333333333333');

+ 12 - 2
src/views/produce/components/workPlan/edit.vue

@@ -314,17 +314,27 @@
         // 计算合格率和不合格率(百分比形式)
         let sampleQualificationRate = '';
         let sampleNoQualificationRate = '';
+
         if (sampleQualifiedNumber || sampleQualifiedNumber == 0) {
           sampleQualificationRate =
             ((sampleQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
           sampleNoQualificationRate =
             ((sampleNoQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
         }
+
         if (sampleQualificationRate || sampleQualificationRate == '0.00') {
-          sampleQualificationRate = sampleQualificationRate + '%';
+          if (isNaN(sampleQualificationRate)) {
+            sampleQualificationRate = '0%';
+          } else {
+            sampleQualificationRate = sampleQualificationRate + '%';
+          }
         }
         if (sampleNoQualificationRate || sampleNoQualificationRate == '0.00') {
-          sampleNoQualificationRate = sampleNoQualificationRate + '%';
+          if (isNaN(sampleNoQualificationRate)) {
+            sampleNoQualificationRate = '0%';
+          } else {
+            sampleNoQualificationRate = sampleNoQualificationRate + '%';
+          }
         }
 
         let resultsTotal = this.form.total - sampleQuantity;

+ 8 - 8
src/views/produce/components/workPlan/index.vue

@@ -481,13 +481,13 @@
       },
 
       async openEdit(type, row) {
-        if (type == 'edit') {
-          const code = await verificationQualityInspector(row.id);
-          if (code == '-1') {
-            console.log('不是报工人');
-            return;
-          }
-        }
+        // if (type == 'edit') {
+        //   const code = await verificationQualityInspector(row.id);
+        //   if (code == '-1') {
+        //     console.log('不是报工人');
+        //     return;
+        //   }
+        // }
 
         const req = {
           workOrderId: row.id,
@@ -527,7 +527,7 @@
 
       handleClose() {
         this.visible = false;
-        this.$emit('close', false);
+        this.$emit('closeWorkPlan', '1');
       },
 
       close() {

+ 9 - 1
src/views/produce/index.vue

@@ -170,6 +170,7 @@
                   v-if="taskObj.id == -1"
                   :workListIds="workListIds"
                   ref="wareRef"
+                  :workPlanType="workPlanType"
                 ></warehousing>
 
                 <!-- // 设备 入库 -->
@@ -186,6 +187,7 @@
                   :workListIds="workListIds"
                   ref="jobRef"
                   :reportNeedFeed="reportNeedFeed"
+                  :workPlanType="workPlanType"
                 ></jobBooking>
 
                 <!-- <workPlan
@@ -252,7 +254,7 @@
     <!-- 工艺文件 -->
     <wokePopup ref="wokePopupRef"></wokePopup>
     <!-- 检验报工 -->
-    <workPlan ref="jobRefs"> </workPlan>
+    <workPlan ref="jobRefs" @closeWorkPlan="closeWorkPlan"> </workPlan>
     <!-- <workes ref="jobRefs"> </workes> -->
 
     <!-- :workListIds="workListIds" :taskId="taskObj.id" -->
@@ -345,6 +347,7 @@
         outObj: {},
         pickingShow: false,
         wokePopup: false,
+        workPlanType: '',
 
         BomObj: {},
         defaultProps: {
@@ -558,7 +561,12 @@
         );
       },
 
+      closeWorkPlan(type) {
+        this.workPlanType = type;
+      },
+
       footBtn(t) {
+        this.workPlanType = '';
         // this.operationType = t;
         // 新增判断 *** 出现弹窗的时候不然右边数据消失
         if ((t == 'work' || t == 'workStep', t === 'task')) {

+ 9 - 8
src/views/produceOrder/index.vue

@@ -17,7 +17,7 @@
         <el-tab-pane label="已延期" name="7"></el-tab-pane>
       </el-tabs>
       <!-- 数据表格 -->
-       <!--   :cache-key="cacheKeyUrl" -->
+      <!--   :cache-key="cacheKeyUrl" -->
       <ele-pro-table
         ref="table"
         :key="activeName"
@@ -338,7 +338,7 @@
             placeholder: '',
             width: 240
           },
-          
+
           {
             label: '产品名称:',
             value: 'productName',
@@ -431,12 +431,13 @@
             fixed: 'left'
           },
 
-          // {
-          //   prop: 'batchNo',
-          //   label: '批次号',
-          //   align: 'center',
-          //   minWidth: 130
-          // },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true
+          },
 
           {
             slot: 'code',

+ 296 - 0
src/views/sample/components/addOrEditSample.vue

@@ -0,0 +1,296 @@
+<template>
+  <ele-modal
+    v-if="visible"
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :append-to-body="true"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    width="80%"
+    @close="cancel"
+    :maxable="true"
+    :resizable="true"
+    :title="title"
+  >
+    <headerTitle title="基本信息"></headerTitle>
+
+    <el-form
+      label-width="120px"
+      ref="baseInfoRef"
+      :model="form"
+      :rules="rules"
+      class="el-form-box"
+    >
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="样品类型:" prop="conditionType">
+            <el-select
+              v-model="form.conditionType"
+              placeholder="请选择物品类型"
+              width="100%"
+              :disabled="type == 'detail'"
+            >
+              <el-option
+                v-for="item in sampleList"
+                :key="item.id"
+                :label="item.label"
+                :value="+item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="样品编码:">
+            <el-input
+              disabled
+              v-model="form.sampleCode"
+              maxlength="50"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <headerTitle title="样品列表"></headerTitle>
+    <sampleTable
+      ref="inventoryTable"
+      :pricingWay="form.pricingWay"
+      :isSinglePrice="false"
+      :isTotalCount="false"
+      :isDiscount="false"
+      :isTemporary="true"
+      :dataList="dataList"
+      pageName="businessOpportunity"
+      @changesMainNumberModal="changesMainNumberModal"
+    ></sampleTable>
+
+    <div slot="footer" class="footer">
+      <el-button type="primary" @click="save('baseInfoRef')">保存</el-button>
+
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import sampleTable from './sampleTable.vue';
+  import { getCode } from '@/api/login';
+  import { saveData, updateData, getById } from '@/api/sample';
+  export default {
+    components: {
+      sampleTable
+    },
+    mixins: [dictMixins],
+
+    data() {
+      return {
+        id: '',
+        title: '',
+        visible: false,
+        type: '',
+        fullscreen: false,
+        form: {
+          pricingWay: [],
+          conditionType: '',
+          categoryCode: '',
+          categoryId: '',
+          sampleCode: '',
+          categoryName: '',
+          batchNo: '',
+          brandNum: '',
+          measureUnit: '',
+          weightUnit: '',
+          weight: '',
+          specification: '',
+          modelType: ''
+        },
+        // form: copyObj(formDef),
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false,
+        gList: [], //商品分类
+        levelList: [],
+        sampleList: [
+          { id: 1, label: '整样' },
+          { id: 2, label: '小样' }
+        ],
+        rules: {
+          conditionType: [
+            { required: true, message: '请选择商品分类', trigger: 'change' }
+          ]
+        },
+        dataList: [],
+        sampleType: ''
+      };
+    },
+
+    methods: {
+      //打开弹出框
+      async open(type, row, contactCategoryId) {
+        // this.$refs.inventoryTable.resetTable()
+        // this.form.categoryLevelId = contactCategoryId;\
+
+        this.title =
+          type === 'add' ? '新增' : type === 'view' ? '详情' : '修改';
+        this.type = type;
+        this.visible = true;
+
+        this.sampleType = type;
+        console.log(this.type, this.sampleType);
+
+        if (this.sampleType == 'edit') {
+          this.id = row.id;
+          await this.getDetial(row.id);
+        } else if (this.sampleType == 'add') {
+          this.resetForm();
+          this.resetTable();
+        }
+        // console.log(row, 'row');
+
+        // this.dataList = row;
+        // if (type == 'add') {
+        //   this.isUpdate = false;
+        // } else {
+        //   this.isUpdate = true;
+        // }
+        // if (type != 'add') {
+        //   // this.getGoodsById(row.id);
+        // }
+      },
+
+      async getDetial(id) {
+        console.log(id, 'id');
+        const data = await getById(id);
+        this.form.id = this.id;
+        this.form.sampleCode = data.sampleCode;
+        this.form.conditionType = data.conditionType;
+        this.form.categoryId = data.categoryId;
+        this.form.categoryCode = data.categoryCode;
+        this.form.categoryName = data.categoryName;
+        this.form.batchNo = data.batchNo;
+        this.form.brandNum = data.brandNum;
+        this.pricingWay = [];
+        this.form.modelType = data.modelType;
+        this.form.specification = data.specification;
+        this.form.weight = data.weight;
+        this.form.weightUnit = data.weightUnit;
+
+        console.log(this.form);
+
+        // this.form.brandNum = data.brandNum;
+
+        // this.form.categoryId = data.weightUnit;
+        // this.form.categoryName = data.netWeight;
+
+        // this.form.modelType = data.modelType;
+
+        this.form.sampleVOList = data.sampleVOList;
+        this.dataList = data.sampleVOList;
+      },
+      cancel() {
+        this.handleClose();
+      },
+      save(formName) {
+        this.$refs[formName].validate(async (valid) => {
+          if (valid) {
+            if (this.dataList.length > 0) {
+              let params = {
+                ...this.form,
+                sampleVOList: this.dataList
+              };
+
+              if (this.type == 'add') {
+                delete params.sampleCode;
+                try {
+                  await saveData(params);
+                  this.loading = false;
+                  this.$message.success('成功');
+                  this.handleClose();
+                  this.$emit('done');
+                } catch (error) {
+                  this.loading = false;
+                }
+              } else {
+                try {
+                  await updateData({ ...params, id: this.id });
+                  this.loading = false;
+                  this.visible = false;
+
+                  this.$message.success(msg);
+                  this.handleClose();
+                  this.$emit('done');
+                } catch (error) {
+                  this.loading = false;
+                }
+              }
+            }
+          } else {
+            console.log('error submit!!');
+            return false;
+          }
+        });
+      },
+      // 确认选择了样品后的事件
+      async changesMainNumberModal(id, data) {
+        console.log(data);
+
+        if (this.type == 'add') {
+          this.form.sampleCode = data.sampleCode;
+        }
+        this.form.categoryCode = data.categoryCode;
+        this.form.categoryId = data.categoryId;
+        this.form.categoryName = data.categoryName;
+        this.form.batchNo = data.batchNo;
+        this.form.brandNum = data.brandNum;
+        this.form.measureUnit = data.measureUnit;
+        this.form.weight = data.weight;
+        this.form.weightUnit = data.weightUnit;
+        this.form.specification = data.specification;
+        this.form.modelType = data.modelType;
+        // data.conditionType = this.form.conditionType;
+        // this.form = { ...data };
+        // 单选
+        this.dataList = [];
+        this.dataList.push(data);
+      },
+
+      handleClose() {
+        this.$nextTick(() => {
+          this.resetForm();
+          this.resetTable();
+        });
+        this.visible = false;
+      },
+
+      resetTable() {
+        console.log('resetTable');
+        this.dataList = [];
+      },
+      resetForm() {
+        console.log('resetForm');
+        this.form = {
+          pricingWay: [],
+          conditionType: '',
+          categoryCode: '',
+          categoryId: '',
+          sampleCode: '',
+          categoryName: '',
+          batchNo: '',
+          brandNum: '',
+          measureUnit: '',
+          weightUnit: '',
+          weight: '',
+          specification: '',
+          modelType: ''
+        };
+        this.sampleType = '';
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 77 - 0
src/views/sample/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>

+ 339 - 0
src/views/sample/components/edit.vue

@@ -0,0 +1,339 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    :title="title"
+    width="80vw"
+    append-to-body
+    :maxable="true"
+  >
+    <div class="title">{{ title == '返工返修' ? '原' : '' }}产品信息</div>
+    <el-table :data="poList" border>
+      <el-table-column label="样品编码" align="center" prop="sampleCode">
+      </el-table-column>
+      <el-table-column label="物品编码" align="center" prop="categoryCode">
+      </el-table-column>
+      <el-table-column label="物品名称" align="center" prop="categoryName">
+      </el-table-column>
+      <el-table-column label="规格" align="center" prop="specification">
+      </el-table-column>
+      <el-table-column label="牌号" align="center" prop="brandNum">
+      </el-table-column>
+      <el-table-column label="型号" align="center" prop="modelType">
+      </el-table-column>
+      <el-table-column label="批次号" align="center" prop="batchNo">
+      </el-table-column>
+
+      <el-table-column label="重量" align="center" prop="weight">
+      </el-table-column>
+      <el-table-column label="重量单位" align="center" prop="weightUnit">
+      </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.$index, 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 request from '@/utils/request';
+  import { getWarehouseList } from '@/api/sample';
+  export default {
+    components: {
+      EquipmentDialog
+    },
+    data() {
+      return {
+        poList: [],
+        newPoList: [],
+        visible: false,
+        loading: false,
+        title: '返工返修',
+        originLong: '',
+        originHeight: '',
+        type: '',
+        warehouseList: []
+      };
+    },
+
+    computed: {},
+    async created() {
+      this.warehouseList = await getWarehouseList();
+    },
+    methods: {
+      open(row, type) {
+        const typeList = {
+          6: '留样',
+          8: '归批/回用',
+          3: '报废',
+          10: '退货',
+          7: '消耗'
+        };
+        console.log(row, 'row');
+        this.visible = true;
+        this.poList = row;
+        this.type = type;
+        this.title = typeList[type];
+        // if (
+        //   !row[0].productName.includes('板材') &&
+        //   !row[0].productName.includes('砌块')
+        // ) {
+        //   return;
+        // }
+        // this._calcVolume(this.poList[0].specification);
+      },
+      handleChangeDepot(index, item) {
+        console.log(index, item);
+        this.poList[index].disposeWarehouseId = item.id;
+        this.poList[index].disposeWarehouseName = 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;
+  }
+
+  .create-form .el-form-item {
+    // margin-bottom: 15px !important;
+  }
+</style>

+ 226 - 0
src/views/sample/components/equipmentDialog.vue

@@ -0,0 +1,226 @@
+<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%"
+    @onDone="onDone"
+  >
+    <div>
+      <el-row>
+        <el-col :span="24" class="topsearch">
+          <el-form>
+            <el-row>
+              <el-col :span="6">
+                <el-input
+                  v-model="code"
+                  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
+            cache-key="systemRoleTable3"
+            row-key="id"
+            height="50vh"
+          >
+          </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';
+  export default {
+    components: {
+      AssetTree
+    },
+    props: {
+      selectList: Array,
+      type: {
+        default: 2 //1多选 2单选
+      },
+      isAll: {
+        default: false
+      },
+      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,
+        selection: [],
+        ids: []
+      };
+    },
+
+    watch: {},
+    methods: {
+      async datasource({ page, limit }) {
+        const params = {
+          code: this.code,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId,
+          isProduct: true
+        };
+        const data = await getList(params);
+        this.tableList = data.list;
+        return data;
+      },
+      open(ids) {
+        this.equipmentdialog = true;
+        if (ids) {
+          this.ids = ids;
+        }
+      },
+      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();
+      },
+      onDone() {
+        this.$nextTick(() => {
+          this.$refs.equiTable.setSelectedRowKeys(this.ids);
+        });
+      },
+      // 选择
+      selected() {
+        this.$emit('choose', this.current);
+        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>

+ 244 - 0
src/views/sample/components/sampleTable.vue

@@ -0,0 +1,244 @@
+<template>
+  <el-form ref="form" :model="form" :rules="rules">
+    <ele-pro-table
+      ref="table"
+      :needPage="false"
+      :columns="columns"
+      :datasource="form.datasource"
+      class="time-form"
+      max-height="300"
+      :cache-key="cacheKeyUrl"
+    >
+      <template v-slot:toolbar>
+        <div class="headbox">
+          <div>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="handParent('')"
+              >选择</el-button
+            >
+          </div>
+        </div>
+      </template>
+    </ele-pro-table>
+
+    <EquipmentDialog
+      ref="equipmentRefs"
+      @choose="handleMainChoose"
+      :type="2"
+      :treeIds="['9']"
+    />
+  </el-form>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import EquipmentDialog from './equipmentDialog';
+  import { getCode } from '@/api/login';
+  export default {
+    mixins: [dictMixins],
+    components: {
+      EquipmentDialog
+    },
+
+    props: {
+      dataList: {
+        type: Array,
+        default: () => []
+      }
+    },
+    data() {
+      return {
+        form: {
+          datasource: this.dataList,
+          discountTotalPrice: 0
+        },
+        rules: {},
+        cacheKeyUrl: ''
+      };
+    },
+
+    computed: {
+      columns() {
+        return [
+          {
+            label: '样品编码',
+            prop: 'sampleCode',
+            width: '150',
+            align: 'center'
+          },
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            width: '150',
+            align: 'center'
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            width: '150',
+            align: 'center'
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            width: '150',
+            align: 'center'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum',
+            width: '150',
+            align: 'center'
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            align: 'center',
+            width: '150'
+          },
+          {
+            prop: 'disposeTime',
+            label: '处置时间',
+            align: 'center',
+            width: '180'
+          }
+          // { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
+          // { label: '发货条码', prop: 'barcodes', align: 'center' },
+          // { label: '包装编码', prop: 'packageNo', 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' },
+          // { prop: 'specification', label: '规格', align: 'center', width: 100, showOverflowTooltip: true },
+          // { prop: 'brandNum', label: '牌号', align: 'center', width: 100, showOverflowTooltip: true },
+          // { prop: 'modelType', label: '型号', align: 'center', width: 100, showOverflowTooltip: true },
+          // { label: '重量', prop: 'weight', align: 'center' },
+          // { label: '重量单位', prop: 'weightUnit', align: 'center' },
+          // { 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' }
+        ];
+      }
+    },
+    methods: {
+      handParent() {
+        this.$refs.equipmentRefs.open();
+      },
+
+      async handleMainChoose(val) {
+        console.log(val, '主数据根据来源得到产品');
+        if (!val) return;
+        const newData = {};
+        this.form.datasource = [];
+        val.sampleCode = await this.getSampleCode();
+        newData.sampleCode = val.sampleCode;
+        newData.categoryId = val.id;
+        newData.categoryCode = val.code;
+        newData.categoryName = val.name;
+        newData.batchNo = val.batchNo;
+        newData.brandNum = val.brandNum;
+        newData.measureUnit = val.measuringUnit;
+        newData.weight = val.netWeight;
+        newData.weightUnit = val.weightUnit;
+        newData.specification = val.specification;
+        newData.modelType = val.modelType;
+        this.form.datasource.push(newData);
+
+        this.$emit('changesMainNumberModal', this.form.productNumber, newData);
+      },
+
+      getProductDetails(productId) {},
+
+      async getSampleCode() {
+        return await getCode('sample_code');
+      }
+    },
+    watch: {
+      dataList: {
+        handler(newVal, oldVal) {
+          this.form.datasource = this.dataList;
+          console.log(this.form.datasource);
+
+          // console.log(newVal,oldVal);
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .headbox {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+
+    .amount {
+      font-size: 14px;
+      font-weight: bold;
+      padding-right: 30px;
+    }
+  }
+
+  .time-form .el-form-item {
+    margin-bottom: 0 !important;
+  }
+
+  ::v-deep .period {
+    display: flex;
+
+    .borderleftnone {
+      .el-input--medium .el-input__inner {
+        border-top-right-radius: 0;
+        border-bottom-right-radius: 0;
+      }
+    }
+
+    .borderrightnone {
+      .el-input--medium .el-input__inner {
+        border-top-left-radius: 0;
+        border-bottom-left-radius: 0;
+      }
+    }
+  }
+
+  ::v-deep .time-form tbody > tr:hover > td {
+    background-color: transparent !important;
+  }
+
+  ::v-deep .time-form .el-table tr {
+    background-color: #ffffff;
+  }
+
+  .pricebox {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    font-weight: bold;
+  }
+</style>

+ 86 - 88
src/views/sample/components/search.vue

@@ -1,87 +1,96 @@
 <!-- 搜索表单 -->
+6
 <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: 6, md: 12 } : { span: 6 }">
-          <el-form-item label="物品名称:">
-            <el-input
-              clearable
-              v-model="where.name"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-          <el-form-item label="产品编码:">
-            <el-input
-              clearable
-              v-model="where.categoryCode"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-          <el-form-item label="设备名称:">
-            <el-input
-              clearable
-              v-model="where.deviceName"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-          <el-form-item label="产品规格:">
-            <el-input
-              clearable
-              v-model="where.specification"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-          <el-form-item label="组织机构:">
-            <auth-selection data-type="Array" v-model="where.deptIds" style="width: 100%"></auth-selection>
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-          <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>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 6 } : { span: 4 }">
+        <el-form-item label="编码:">
+          <el-input clearable v-model="where.sampleCode" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 6 } : { span: 4 }">
+        <el-form-item label="物品编码:">
+          <el-input
+            clearable
+            v-model="where.categoryCode"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
+        <el-form-item label="物品名称:">
+          <el-input
+            clearable
+            v-model="where.categoryName"
+            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"
+            placeholder="请选择"
+            style="width: 100%"
+            clearable
+          >
+            <el-option label="已处理" :value="1" />
+            <el-option label="未处理" :value="2" />
+          </el-select>
+        </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.conditionType"
+            placeholder="请选择"
+            style="width: 100%"
+            clearable
+          >
+            <el-option label="整样" :value="1" />
+            <el-option label="小样" :value="2" />
+          </el-select>
+        </el-form-item>
+      </el-col> -->
+      <el-col
+        style="display: flex; justify-content: flex-end"
+        v-bind="styleResponsive ? { lg: 18, md: 6 } : { 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 {
-    props: [],
     data() {
       // 默认表单数据
       const defaultWhere = {
-        name: '',
-        deviceName: '',
-        categoryCode: '',
-        specification: '',
-        deptIds: [],
+        code: '',
+        produceTaskName: '',
+        deptIds: ''
       };
       return {
+        defaultWhere,
         // 表单数据
-        where: { ...defaultWhere },
+        where: { ...defaultWhere }
       };
     },
     computed: {
@@ -90,13 +99,10 @@
         return this.$store.state.theme.styleResponsive;
       }
     },
-    watch: {},
-    created() {},
     methods: {
       /* 搜索 */
       search() {
-        const where = { ...this.where };
-        this.$emit('search', where);
+        this.$emit('search', this.where);
       },
       /*  重置 */
       reset() {
@@ -105,12 +111,4 @@
       }
     }
   };
-  </script>
-  <style lang="scss" scoped>
-  .ele-form-actions {
-    display: flex;
-    align-items: center;
-    justify-content: flex-end;
-  }
-  </style>
-  
+</script>

+ 684 - 0
src/views/sample/detailList.vue

@@ -0,0 +1,684 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <!-- <seek-page :seekList="seekList" @search="search"></seek-page> -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]"
+        :height="500"
+        :key="key"
+        @selection-change="handleSelectionChange"
+        @update:current="kk"
+        @current-change="kk"
+      >
+        <!-- 操作列 -->
+        <template v-slot:toolbar v-if="showBtn">
+          <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.disposalStatus !== 2"
+            @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 !== 2"
+            @click="disposeList(2, row)"
+          >
+            处置
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <el-dialog :visible.sync="dialogVisible" width="35%" @close="close">
+      <el-form
+        ref="disposeForm"
+        :model="disposeForm"
+        label-width="150px"
+        :rules="rules"
+      >
+        <el-form-item label="处置方式:" prop="disposeType">
+          <el-select
+            v-model="disposeForm.disposeType"
+            placeholder="请选择"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in sampleTypeList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+
+        <template v-if="disposeForm.disposeType == 6">
+          <el-row>
+            <el-col :span="24">
+              <el-form-item label="留样日期:" prop="sampleDate" align="center">
+                <el-date-picker
+                  class="w100"
+                  v-model="disposeForm.sampleDate"
+                  type="date"
+                  value-format="yyyy-MM-dd"
+                  placeholder="请输入"
+                ></el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6"> </el-col>
+          </el-row>
+          <el-row style="margin-top: 12px">
+            <el-col :span="24">
+              <el-form-item
+                label="留样条件:"
+                prop="sampleCondition"
+                align="center"
+              >
+                <el-input
+                  v-model="disposeForm.sampleCondition"
+                  placeholder="请输入"
+                  style="width: 100%"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 12px">
+            <el-col :span="24">
+              <el-form-item
+                label="生产商/受托生产:"
+                prop="producerManufacturer"
+                align="center"
+              >
+                <el-input
+                  v-model="disposeForm.producerManufacturer"
+                  placeholder="请输入"
+                  style="width: 100%"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 12px">
+            <el-col :span="24">
+              <el-form-item
+                label="留样地点:"
+                prop="samplePlace"
+                align="center"
+              >
+                <el-input
+                  type="textarea"
+                  v-model="disposeForm.samplePlace"
+                  placeholder="请输入"
+                  style="width: 100%"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 12px">
+            <el-col :span="24">
+              <el-form-item
+                label="留样备注:"
+                prop="sampleRemark"
+                align="center"
+              >
+                <el-input
+                  type="textarea"
+                  v-model="disposeForm.sampleRemark"
+                  placeholder="请输入"
+                  style="width: 100%"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </template>
+
+        <template
+          v-if="
+            disposeForm.disposeType == 3 ||
+            disposeForm.disposeType == 6 ||
+            disposeForm.disposeType == 9
+          "
+        >
+          <el-form-item label="入库仓库:" prop="depotId" align="center">
+            <el-select style="width: 100%" v-model="disposeForm.depotId">
+              <el-option
+                v-for="item in warehouseList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+                @click.native="chooseWarehouse(item)"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+      </el-form>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消 </el-button>
+        <el-button type="primary" @click="consfirm">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <Edit ref="edit" @success="save" />
+  </div>
+</template>
+
+<script>
+  import { deepClone } from '@/utils';
+  import Edit from './components/edit.vue';
+  import { getWarehouseList } from '@/api/sample';
+
+  import dictMixins from '@/mixins/dictMixins';
+  import { unacceptedProductStatus } from '@/utils/util';
+
+  import {
+    getDetail,
+    deleteUnacceptedProductDetail,
+    dispose,
+    removeSample
+  } from '@/api/sample';
+
+  import { saveData, updateData, getById, disposeApi } from '@/api/sample';
+  export default {
+    components: {
+      Edit
+    },
+    mixins: [dictMixins],
+    data() {
+      return {
+        dataList: [],
+        key: '',
+        response: {
+          dataName: 'sampleVOList'
+        },
+        warehouseList: [],
+        disposeForm: {
+          disposeType: '',
+          sampleCondition: '',
+          sampleDate: '',
+          samplePlace: '',
+          sampleRemark: '',
+          producerManufacturer: '',
+          depotId: '',
+          depotName: ''
+        },
+        id: '',
+        ids: [],
+        sampleType: '',
+        loading: false,
+        selection: [],
+        allSelectedData: [],
+        disposeType: '',
+        dialogVisible: false,
+        current: {},
+        formData: {},
+        all: false,
+        qualityType: null,
+        sampleTypeList: [
+          { value: 6, label: '留样' },
+          { value: 8, label: '归批/回用' },
+          { value: 3, label: '报废' },
+          { value: 10, label: '退货' },
+          { value: 7, label: '消耗' }
+        ],
+        rules: {
+          disposeType: [
+            { required: true, message: '请选择处置方式', trigger: 'change' }
+          ],
+          depotId: [
+            { required: true, message: '请选择仓库', trigger: 'change' }
+          ]
+        }
+      };
+    },
+    computed: {
+      showBtn() {
+        return !this.$route.query.type;
+      },
+      // 表格列配置
+      columns() {
+        const arr = [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            selectable: (row, index) => {
+              return row.disposalStatus !== 2;
+            },
+            align: 'center'
+          },
+          {
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            label: '序号',
+            width: 55,
+            showOverflowTooltip: true
+          },
+          {
+            label: '样品编码',
+            prop: 'sampleCode',
+            width: '150',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '物品编码',
+            prop: 'categoryCode',
+            width: '150',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '物品名称',
+            prop: 'categoryName',
+            width: '180',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            width: '120',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum',
+            width: '120',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureQuantity',
+            label: '计量数量',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'weight',
+            label: '重量',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'disposeTime',
+          //   label: '处置时间',
+          //   align: 'center',
+          //   width: '180',
+          //   showOverflowTooltip: true
+          // },
+          {
+            prop: 'disposalStatus',
+            label: '处置状态',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true,
+            formatter: (row, column, cellValue) => {
+              return this.disposalStatustList[cellValue ? cellValue : 0];
+            }
+          },
+          {
+            prop: 'disposeType',
+            label: '处置类型',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true,
+            formatter: (row, column, cellValue) => {
+              return this.disposeTypeList[0][cellValue];
+            }
+          },
+          {
+            prop: 'qualityResults',
+            label: '质检结果',
+            align: 'center',
+            width: '120',
+            showOverflowTooltip: true,
+            formatter: (row, column, cellValue) => {
+              return this.qualityResultList[cellValue];
+            }
+          },
+
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            width: 180,
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+          }
+        ];
+
+        return this.$route.query.type ? arr.slice(0, -1) : arr;
+      },
+      seekList() {
+        return [
+          {
+            label: '编码:',
+            value: 'sampleCode',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '物品编码:',
+            value: 'categoryCode',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '物品名称:',
+            value: 'categoryName',
+            type: 'input',
+            placeholder: ''
+          }
+        ];
+      },
+      disposeTypeList() {
+        return [
+          {
+            1: '返工',
+            2: '返修',
+            3: '报废',
+            4: '降级使用',
+            5: '让步接收',
+            6: '留样',
+            7: '消耗',
+            8: '回用',
+            9: '转试销',
+            10: '退货'
+          }
+        ];
+      },
+      qualityResultList() {
+        return { 1: '合格', 2: '不合格' };
+      },
+      disposalStatustList() {
+        return { 0: '待处置', 1: '处置中', 2: '处置完成' };
+      }
+    },
+
+    watch: {
+      'disposeForm.disposeType': {
+        handler(newVal, oldVal) {
+          if (newVal == 6) {
+            this.rules.depotId = [];
+          } else {
+            this.rules.depotId = [
+              { required: true, message: '请选择仓库', trigger: 'change' }
+            ];
+          }
+
+          this.disposeForm.sampleCondition = '';
+          this.disposeForm.sampleDate = '';
+          this.disposeForm.samplePlace = '';
+          this.disposeForm.sampleRemark = '';
+          this.disposeForm.producerManufacturer = '';
+          this.disposeForm.depotId = '';
+          this.disposeForm.depotName = '';
+        }
+      }
+    },
+    async created() {
+      this.getList();
+      this.warehouseList = await getWarehouseList();
+      this.qualityType = this.$route.query.qualityType;
+    },
+
+    methods: {
+      kk() {
+        console.log('fany');
+      },
+      handleSelectionChange(selection) {
+        console.log('choose');
+
+        this.selection = selection;
+        // 更新所有选中的数据
+        this.allSelectedData = [
+          ...new Set([...this.allSelectedData, ...selection])
+        ];
+      },
+      handlePageChange() {
+        console.log('fan');
+
+        // 翻页时同步选中状态
+        const currentPageData = this.dataList;
+        const selectedOnCurrentPage = currentPageData.filter((item) =>
+          this.allSelectedData.some(
+            (selectedItem) => selectedItem.id === item.id
+          )
+        );
+        this.$refs.table.setSelectedRows(selectedOnCurrentPage);
+      },
+      chooseWarehouse(item) {
+        console.log(item);
+        this.disposeForm.depotId = item.id;
+        this.disposeForm.depotName = item.name;
+      },
+      async getList() {
+        let id = this.$route.query.id;
+        const arr = await getById(id);
+        this.dataList = arr.sampleVOList;
+      },
+      // /* 表格数据源 */
+
+      async datasource({ page, where, limit }) {
+        let id = this.$route.query.id;
+        // where.id = this.$route.query.id;
+        const arr = await getById(id);
+
+        return arr.sampleVOList;
+      },
+      reload(where) {
+        console.log('reload');
+        this.key = Math.random();
+        this.$nextTick(() => {
+          // this.datasource();
+          // this.$refs.table.reRenderTable();
+          // this.getList()
+          // this.$refs.table.reload({ page: 1, where: where });
+        });
+      },
+      remove(row) {
+        let ids = row ? [row.id] : this.selection.map((item) => item.id);
+        removeSample(ids).then((res) => {
+          this.$message.success('删除' + res);
+          this.reload();
+          // 删除后更新 allSelectedData
+          this.allSelectedData = this.allSelectedData.filter(
+            (item) => !ids.includes(item.id)
+          );
+        });
+      },
+      close() {
+        this.$refs.disposeForm.resetFields();
+        this.dialogVisible = false;
+        this.disposeType = '';
+      },
+      // // 处置
+      disposeList(type, row) {
+        if (type == 1) {
+          this.all = true;
+          console.log(this.selection);
+        } else {
+          this.id = row.id;
+          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 handleDispose() {
+        if (!this.formData.disposalStatus) {
+          return;
+        }
+        this.$refs.edit.open(
+          this.all ? this.selection : [this.current],
+          this.formData.disposalStatus
+        );
+        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);
+        disposeApi({
+          disposeType: Number(data.type),
+          poList: data.data
+        })
+          .then((res) => {
+            console.log(res);
+            this.$message.success('处置成功!');
+            this.reload();
+          })
+          .catch((err) => {
+            console.log(err);
+          });
+        this.dialogVisible = false;
+        this.current = null;
+      },
+      async consfirm() {
+        this.$refs['disposeForm'].validate(async (valid) => {
+          if (valid) {
+            let params = {
+              disposeType: this.disposeForm.disposeType,
+              poList: []
+            };
+            if (this.all) {
+              params.poList = this.selection.map((item) => {
+                return { ...item, ...this.disposeForm };
+              });
+            } else {
+              params.poList = [
+                { ...deepClone(this.current), ...this.disposeForm }
+              ];
+            }
+            console.log(params);
+            await disposeApi(params);
+            this.dialogVisible = false;
+            this.current = null;
+            this.$message.success('处置成功!');
+            this.reload();
+          }
+          return;
+        });
+        return;
+
+        // if (this.disposeType == 6) {
+        //   this.$refs['disposeForm'].validate(async (valid) => {
+        //     if (valid) {
+        //       const pa = { ...deepClone(this.current), ...this.disposeForm };
+        //       const params = { disposeType: this.disposeType, poList: [pa] };
+        //       await disposeApi(params);
+        //       this.dialogVisible = false;
+        //       this.current = null;
+        //       this.$message.success('处置成功!');
+        //       this.reload();
+        //       return;
+        //     } else {
+        //       console.log('error submit!!');
+        //       return false;
+        //     }
+        //   });
+        //   return;
+        // }
+        this.$refs.edit.open(
+          this.all ? this.selection : [this.current],
+          this.disposeType
+        );
+        this.dialogVisible = false;
+      },
+      submitForm(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            alert('submit!');
+          } else {
+            console.log('error submit!!');
+            return false;
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .unacceptedProductSelect {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+  }
+</style>

+ 224 - 94
src/views/sample/index.vue

@@ -1,18 +1,70 @@
 <template>
   <div class="ele-body">
-    <el-card shadow="never" v-loading="loading">
-      <order-search @search="reload" ref="searchRef"> </order-search>
+    <el-card shadow="never">
+      <seek-page :seekList="seekList" @search="search"></seek-page>
+      <el-tabs
+        v-model="activeName"
+        @tab-click="handleClick"
+        type="card"
+        style="margin-top: 5px"
+      >
+        <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>
       <ele-pro-table
         ref="table"
         :columns="columns"
         :datasource="datasource"
-        :selection.sync="selection"
+        :pageSize="20"
       >
+        <!-- 表头工具栏 -->
+
+        <template v-slot:toolbar>
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit('add')"
+          >
+            新增
+          </el-button>
+        </template>
+
+        <template v-slot:sampleCode="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="goDetail(row.id, 'detail')"
+            >{{ row.sampleCode }}</el-link
+          >
+        </template>
+
+        <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('edit', row)"
+            v-if="row.status !== 2"
+          >
+            修改
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="goDetail(row.id)"
+            v-if="row.status !== 2"
+          >
+            处置
+          </el-link>
           <el-popconfirm
             class="ele-action"
             title="确定要删除吗?"
             @confirm="remove(row)"
+            v-if="row.status !== 2"
           >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -23,158 +75,236 @@
         </template>
       </ele-pro-table>
     </el-card>
+    <!-- 新增的dialog -->
+    <sample ref="sampleRef" @done="reload"></sample>
   </div>
 </template>
-
 <script>
-  import OrderSearch from './components/search.vue';
+  import sample from './components/addOrEditSample.vue';
+  import { getList, removeItem } from '@/api/sample';
   import dictMixins from '@/mixins/dictMixins';
+  import { getByCode } from '@/api/system/dictionary-data';
 
-  import { deleteLine, getList } from '@/api/sample/index';
   export default {
+    mixins: [dictMixins],
     components: {
-      OrderSearch
+      sample
     },
-    mixins: [dictMixins],
     data() {
       return {
-        loading: false,
-        dialogVisible: false,
-        current: null,
-        selection: []
-      };
-    },
-    computed: {
-      // 表格列配置
-      columns() {
-        return [
+        columns: [
           {
+            type: 'index',
             columnKey: 'index',
+            align: 'center',
             label: '序号',
-            type: 'index',
             width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
+            showOverflowTooltip: true
           },
           {
-            prop: 'categoryCode',
-            width: 160,
+            prop: 'sampleCode',
             label: '编码',
-            align: 'center'
+            slot: 'sampleCode',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
           },
           {
-            prop: 'brandNum',
-            label: '牌号',
-            align: 'center'
+            prop: 'sourceCode',
+            label: '来源编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
           },
           {
-            prop: 'deviceName',
-            label: '设备名称',
-            align: 'center'
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
           },
           {
-            prop: 'feedQuantity',
-            label: '投料数量',
-            align: 'center'
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            showOverflowTooltip: true
           },
           {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center'
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
           },
-
           {
-            prop: 'name',
-            label: '物品名称',
-            align: 'center'
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
           },
           {
-            prop: 'notType',
-            label: '处置类型',
+            prop: 'brandNum',
+            label: '牌号',
             align: 'center',
-            slot: 'notType',
             width: 100,
-            showOverflowTooltip: true,
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1
-                ? '返工'
-                : cellValue == 2
-                ? '返修'
-                : cellValue == 3
-                ? '报废'
-                : cellValue == 4
-                ? '降级使用'
-                : cellValue == 5
-                ? '让步接收'
-                : cellValue == 6
-                ? '留样'
-                : cellValue == 7
-                ? '消耗'
-                : cellValue == 8
-                ? '回用'
-                : cellValue == 9
-                ? '转试销'
-                : '';
-            }
+            showOverflowTooltip: true
           },
           {
-            prop: 'specification',
-            label: '规格',
-            align: 'center'
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
           },
           {
-            prop: 'unit',
-            label: '计量单位',
-            align: 'center'
+            prop: 'quantity',
+            label: '样品数量',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
           },
+          // {
+          //   prop: 'unit',
+          //   label: '计量单位',
+          //   align: 'center',
+          //   width: 100,
+          //   showOverflowTooltip: true
+          // },
 
           {
-            prop: 'createTime',
-            label: '创建时间',
+            prop: 'disposeTime',
+            label: '处置时间',
             align: 'center',
-            width: 160
+            width: 180,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            slot: 'status',
+            align: 'center',
+            width: 80
           },
-
           {
             columnKey: 'action',
             label: '操作',
-            width: 100,
             align: 'center',
+            width: 180,
             resizable: false,
-            fixed: 'right',
             slot: 'action',
-            showOverflowTooltip: true
+            fixed: 'right'
+          }
+        ],
+        activeName: '1',
+        disposeStatusList: []
+      };
+    },
+    created() {
+      // this.requestDict('处置状态');
+      this.getDisposeStatus('dispose_status');
+    },
+
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '编码:',
+            value: 'sampleCode',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '来源编码:',
+            value: 'sourceCode',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '物品编码:',
+            value: 'categoryCode',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '物品名称:',
+            value: 'categoryName',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '状态:',
+            value: 'status',
+            type: 'select',
+            placeholder: '',
+            planList: [
+              { value: 0, label: '待处置' },
+              { value: 1, label: '部分处置' },
+              { value: 2, label: '处置完成' }
+            ]
           }
         ];
       }
     },
-    created() {},
-    filters: {},
+
     methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
+      datasource({ page, where, limit }) {
         return getList({
+          ...where,
           pageNum: page,
-          size: limit,
-          ...where
+          size: limit
         });
       },
-      remove(row) {
-        let ids = row ? [row.id] : this.selection.map((item) => item.id);
-        deleteLine(ids).then((res) => {
-          this.$message.success('删除' + res);
-          this.reload();
-        });
+
+      async getDisposeStatus(code) {
+        let res = await getByCode(code);
+        if (res?.code == 0) {
+          let list = res.data.map((item) => {
+            let key = Object.keys(item)[0];
+            return { value: key, label: item[key] };
+          });
+          this.disposeStatusList = list;
+        }
+      },
+
+      search(where) {
+        this.reload(where);
       },
-      /* 刷新表格 */
-      reload(where) {
+
+      reload(where = {}) {
         this.$nextTick(() => {
+          where.conditionType =
+            this.activeName == '1' ? '' : this.activeName == '2' ? '1' : '2';
           this.$refs.table.reload({ page: 1, where });
         });
+      },
+      goDetail(id, type) {
+        this.$router.push({
+          path: '/sample/detailList',
+          query: {
+            id,
+            type
+          }
+        });
+      },
+      handleClick(tab) {
+        this.activeName = tab.name;
+        this.reload();
+      },
+      openEdit(type, row) {
+        this.$refs.sampleRef.open(type, row);
+      },
+
+      remove(item) {
+        removeItem([item.id])
+          .then((message) => {
+            this.$message.success(message);
+            this.reload();
+          })
+          .catch((e) => {});
       }
     }
   };
 </script>
 
-<style lang="scss" scoped></style>
+<style scoped></style>