ysy hai 1 ano
pai
achega
b1aa4b96c4

+ 1 - 0
src/enum/dict.js

@@ -7,6 +7,7 @@ export default {
   角度: 'angle',
   生命周期: 'life_cycle',
   网络状态: 'network_status',
+  计量单位: 'measuring_uint',
   金额单位: 'money_unit',
   仓库: 'warehouse',
   时间单位: 'time_unit',

+ 163 - 3
src/views/byProduct/components/addByProduct.vue

@@ -30,17 +30,74 @@
           </el-col>
         </el-row>
       </el-form>
+
+      <div v-for="(item, idx) in materialList" :key="idx">
+        <el-form
+          :ref="`form22${idx}`"
+          :model="{ pickList: item }"
+          :rules="tableRules"
+          size="mini"
+          label-position="left"
+        >
+          <div class="tableZ_box">
+            <div class="row">
+              <div class="col">
+                <div class="name">物料编码</div>
+                <div class="content">{{ item.code }}</div>
+              </div>
+              <div class="col">
+                <div class="name">物料名称</div>
+                <div class="content">{{ item.name }}</div>
+              </div>
+              <div class="col col2">
+                <div class="name">计量单位</div>
+                <div class="content">{{ item.measuringUnit }}</div>
+              </div>
+              <div class="col col3">
+                <div class="name">处置重量</div>
+                <div class="content content_num">
+                  <el-input v-model="productWeight"></el-input>
+                  <DictSelection
+                    dictName="计量单位"
+                    style="width: 160px; margin-left: 10px"
+                    v-model="productUnit"
+                  ></DictSelection>
+                </div>
+              </div>
+              <div class="col pd6">
+                <el-button type="primary" size="mini" @click="handWorkOrder()"
+                  >新增</el-button
+                >
+              </div>
+            </div>
+          </div>
+        </el-form>
+      </div>
     </div>
+
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button size="mini" type="primary" @click="save()">确 定</el-button>
+    </template>
+
     <ProductModal ref="productRefs" @changeProduct="determineChoose" />
+
+    <produceOrder
+      v-if="orderShow"
+      @close="orderShow = false"
+      @workSelect="workSelect"
+    ></produceOrder>
   </el-dialog>
 </template>
 
 <script>
   import { getCode } from '@/api/produce/workOrder';
   import ProductModal from './ProductModal.vue';
+  import produceOrder from './produceOrder.vue';
   export default {
     components: {
-      ProductModal
+      ProductModal,
+      produceOrder
     },
     data() {
       return {
@@ -49,7 +106,16 @@
         productForm: {
           code: null,
           name: null
-        }
+        },
+
+        materialList: [],
+
+        tableRules: {},
+
+        productWeight: null,
+        productUnit: null,
+
+        orderShow: false
       };
     },
 
@@ -66,15 +132,109 @@
         this.productForm.code = await getCode('dispose_code');
       },
 
+      save() {},
+
       categorySelect() {
         this.$refs.productRefs.open({}, '选择物料', '1', null);
       },
 
       determineChoose(title, row, idx) {
         if (title == '选择物料') {
-          console.log(row);
+          this.materialList[0] = row;
+
+          this.$forceUpdate();
+        }
+      },
+
+      handWorkOrder() {
+        if (!this.productWeight) {
+          return this.$message.error('请输入处置重量');
+        }
+        if (!this.productUnit) {
+          return this.$message.error('请输入处置重量单位');
         }
+        this.orderShow = true;
+      },
+
+      workSelect(ids, taskId) {
+        console.log(ids, taskId);
+
+        this.orderShow = false;
       }
     }
   };
 </script>
+
+<style lang="scss" scoped>
+  .content_num {
+    display: flex;
+    align-items: center;
+    padding: 2px;
+    --input-background-color: #f0f8f2;
+  }
+
+  .table_content {
+    margin-bottom: 10px;
+  }
+
+  .tableZ_box {
+    border: 1px solid #e3e5e5;
+    margin: 6px 0;
+
+    &:last-child {
+      border-bottom: none;
+    }
+
+    .row {
+      width: 100%;
+      display: flex;
+    }
+
+    .col {
+      width: 20%;
+      display: flex;
+      align-items: center;
+      min-width: 200px;
+      min-height: 32px;
+      border-bottom: 1px solid #e3e5e5;
+      border-right: 1px solid #e3e5e5;
+
+      &:last-child {
+        border-right: none;
+      }
+
+      .name {
+        display: flex;
+        align-items: center;
+        padding: 4px;
+        width: 80px;
+        height: 100%;
+        background-color: #d0e4d5;
+        color: #000;
+      }
+
+      .content {
+        padding: 4px 6px;
+        color: #000;
+      }
+    }
+
+    .col2 {
+      width: 10%;
+    }
+
+    .col3 {
+      width: 30%;
+    }
+
+    .pd6 {
+      padding: 0 6px;
+    }
+  }
+</style>
+
+<style>
+  :v-deep .el-form-item__error {
+    bottom: -6px !important;
+  }
+</style>

+ 107 - 0
src/views/byProduct/components/produceOrder-search.vue

@@ -0,0 +1,107 @@
+<!-- 搜索表单 -->
+<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-select size="mini"   @change="search" v-model="where.taskId"  filterable>
+            <el-option
+              v-for="(item, index) in produceTaskList"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label-width="0px">
+          <el-button
+            size="mini"
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+          <el-button
+            size="mini"
+            @click="reset"
+            icon="el-icon-refresh-left"
+            type="primary"
+            >重置</el-button
+          >
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { produceTask } from '@/api/InTheSystem/index';
+  export default {
+    props: [],
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        taskId: '',
+        code: ''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+
+        produceTaskList: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    watch: {},
+    created() {
+      this.getTaskList();
+    },
+    methods: {
+      getTaskList() {
+        produceTask().then((res) => {
+          this.produceTaskList = res.list;
+          this.where.taskId =  res.list[0].id
+
+
+           if(this.where.taskId) {
+            this.$emit('search', this.where);
+           }
+        
+        });
+      },
+
+      /* 搜索 */
+      search() {
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+</style>

+ 249 - 0
src/views/byProduct/components/produceOrder.vue

@@ -0,0 +1,249 @@
+<template>
+  <el-dialog
+    title="工单列表"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+  >
+    <produceOrderSearch @search="reload"></produceOrderSearch>
+    <ele-pro-table
+      ref="table"
+      height="55vh"
+      :columns="columns"
+      width="30%"
+      :initLoad="false"
+      :datasource="datasource"
+      :selection.sync="selection"
+      cache-key="produceOrderZ"
+      highlight-current-row
+    >
+      <template v-slot:code="{ row }">
+        <el-link type="primary" :underline="false">{{ row.code }}</el-link>
+      </template>
+
+      <template v-slot:singleReport="{ row }">
+        <el-tag> {{ row.singleReport == 1 ? '单个报工' : '批量报工' }}</el-tag>
+      </template>
+
+      <template v-slot:formingNum="{ row }">
+        <span> {{ row.formingNum }} {{ row.unit }} </span>
+      </template>
+
+      <template v-slot:formingWeight="{ row }">
+        <span> {{ row.formingNum }} {{ row.weightUnit }} </span>
+      </template>
+    </ele-pro-table>
+
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button size="mini" type="primary" @click="handleSelect()"
+        >确 定</el-button
+      >
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+  import { pickTaskReportPage } from '@/api/produce/workOrder.js';
+
+  import produceOrderSearch from './produceOrder-search.vue';
+
+
+  export default {
+    components: { produceOrderSearch, 
+
+     },
+
+    data() {
+      return {
+        loading: false,
+        selection: [],
+
+        visible: true,
+        taskId: null
+      };
+    },
+
+    watch: {},
+
+    computed: {
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center'
+          },
+
+          {
+            prop: 'code',
+            slot: 'code',
+            label: '生产工单号',
+            align: 'center',
+            minWidth: '110'
+          },
+          {
+            prop: '',
+            label: '计划编号',
+            align: 'center'
+          },
+          {
+            prop: '',
+            label: '计划类型',
+            align: 'center'
+          },
+
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center'
+          },
+          {
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center'
+          },
+
+          {
+            prop: 'singleReport',
+            slot: 'singleReport',
+            label: '报工类型',
+            align: 'center',
+            width: 100
+          },
+
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center'
+          },
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120
+          },
+
+          {
+            prop: 'formingNum',
+            label: '要求生产数量',
+            align: 'center',
+            slot: 'formingNum',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formingWeight',
+            label: '要求生产重量',
+            slot: 'formingWeight',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedNum',
+            label: '已生产数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedWeight',
+            label: '已生产重量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'startTime',
+            label: '实际开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          }
+        ];
+      }
+    },
+
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return pickTaskReportPage({
+          pageNum: page,
+          size: limit,
+ 
+          ...where
+        });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.taskId = where.taskId || '';
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+      handleSelect() {
+        let ids = [];
+        ids = this.selection.map((item) => {
+          return item.id;
+        });
+        if (!this.taskId) {
+          return this.$message.warning('请选择工序');
+        }
+
+        this.$emit('workSelect', ids, this.taskId);
+      },
+
+      handleClose() {
+        this.$emit('close');
+      }
+    }
+  };
+</script>