yusheng 1 ماه پیش
والد
کامیت
2f93efed16

+ 184 - 0
src/api/purchasingManage/purchaseOrder.js

@@ -0,0 +1,184 @@
+import request from '@/utils/request';
+import { download } from '@/utils/file';
+/**
+ * 获取信息列表
+ */
+export async function getTableList(params) {
+  const res = await request.get(`/eom/purchaseorder/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 获取信息详情
+ */
+export async function getpurchaseorderDetail(id) {
+  const res = await request.get(`/eom/purchaseorder/getById/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 获取信息详情
+ */
+export async function getByIdCondition(id,productType) {
+  const res = await request.get(`/eom/purchaseorder/getByIdCondition/${id}?productType=${productType}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 更新信息
+ */
+export async function UpdateInformation(data) {
+  const res = await request.put(`/eom/purchaseorder/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 新增信息
+ */
+export async function addInformation(data) {
+  const res = await request.post(`/eom/purchaseorder/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 删除
+ */
+export async function deleteInformation(data) {
+  const res = await request.delete('/eom/purchaseorder/delete', { data });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 提交
+ */
+export async function submit(data) {
+  const res = await request.post(`/bpm/purchaseOrderApprove/submit`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 获取采购询价表信息
+ */
+export async function getPurchaseinquiryAPI(id) {
+  const res = await request.get(`/eom/purchaseinquiry/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 通过合同ID获取采购计划
+ */
+export async function getPurchasePlanByContractIdAPI(id) {
+  const res = await request.get(`/eom/purchaseplan/getByContractId/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ *
+ */
+export async function getProductsBySource(data) {
+  const res = await request.post(`/eom/purchaseorder/getProductsBySource`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ *
+ */
+export async function getInquiry2Order(data) {
+  const res = await request.post(`/eom/purchaseinquiry/getInquiry2Order`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 根据订单统计数值查询单据详情
+ */
+export async function getProductsNumberDetail(data) {
+  const res = await request.post(`/eom/purchaseorder/getProductsNumberDetail`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 获取委外数据
+ */
+export async function applyoutsource(id) {
+  const res = await request.get(`/mes/applyoutsource/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 通过物品编码获取供应商
+ */
+export async function getSupplierInfo(productId) {
+  const res = await request.get(`/eom/contact/getContactByProductId/${productId}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 获取采购物品清单历史单价
+ */
+export async function queryHistoricalUnitPrice(productId) {
+  const res = await request.post(`/eom/purchaseorder/queryHistoricalUnitPrice/${productId}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 导出采购单
+ */
+export async function getExport(id) {
+  const res = await request.get(
+    `/eom/purchaseorder/export/${id}`,
+    {
+      responseType: 'blob'
+    },
+
+  );
+
+  download(res.data, '采购订单.xlsx');
+}
+
+
+// 更新状态
+export async function batchCompleted(data) {
+  const res = await request.patch(`/eom/purchaseorder/v1/batchCompleted`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 294 - 0
src/components/orderListDialog/orderListDialog.vue

@@ -0,0 +1,294 @@
+<template>
+  <ele-modal
+    title="选择订单"
+    custom-class="ele-dialog-form long-dialog-form"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+    :maxable="true"
+    :resizable="true"
+  >
+    <el-card shadow="never">
+      <searchTable @search="reload"></searchTable>
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        row-key="id"
+        height="calc(100vh - 500px)"
+        class="dict-table"
+        @cell-click="cellClick"
+        :initLoad="false"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id"
+            ><i></i
+          ></el-radio>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <div class="btns" slot="footer">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import searchTable from './searchTable.vue';
+  import { getTableList } from '@/api/purchasingManage/purchaseOrder';
+
+  export default {
+    components: {
+      searchTable
+    },
+    props: {
+      searchParams: {
+        type: Object,
+        default: () => {}
+      },
+      isOutsourcing: ''
+    },
+
+    data() {
+      return {
+        partbId: '',
+        visible: false,
+        currentIndex: null,
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            width: 100,
+            type: 'action',
+            slot: 'action',
+            label: '选择',
+
+            columnKey: 'action',
+            align: 'center'
+          },
+          {
+            prop: 'orderNo',
+            label: '订单编码',
+            align: 'center',
+            slot: 'orderNo',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'sourceTypeName',
+            label: '订单类型',
+            align: 'center',
+            sortable: true,
+            showOverflowTooltip: true,
+            minWidth: 200,
+            fixed: 'left'
+          },
+          {
+            prop: 'productNames',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'productCodes',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
+          {
+            prop: 'contractName',
+            label: '合同名称',
+            align: 'center',
+            slot: 'contractName',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          // {
+          //   prop: 'deliveryDate',
+          //   label: '交货日期',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   minWidth: 200
+          // },
+          // {
+          //   prop: 'purchaseTypeName',
+          //   label: '采购订单类型',
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   minWidth: 140
+          // },
+          {
+            prop: 'partaName',
+            label: '采购方名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            prop: 'partaLinkName',
+            label: '采购方联系人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+
+          {
+            prop: 'partaTel',
+            label: '采购方联系电话',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'partbName',
+            label: '供应商名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'partbLinkName',
+            label: '供应商联系人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'partbTel',
+            label: '供应商联系电话',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'payAmount',
+            label: '金额(元)',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          }
+        ],
+
+        radio: null
+      };
+    },
+
+    methods: {
+      open(partbId) {
+        this.radio = null;
+        this.current = null;
+        this.visible = true;
+        this.partbId = partbId;
+        this.$nextTick(() => {
+          this.$refs.table.reload({
+            pageNum: 1
+          });
+        });
+      },
+
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return getTableList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          orderStatus: 2,
+          isOutsourcing: 1,
+          partbId: this.partbId,
+          ...this.searchParams
+        });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        where = {
+          ...where,
+          ...this.searchParams
+        };
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+
+      handleNodeClick(data, node) {
+        this.reload({ categoryId: data.id });
+      },
+
+      // 单击获取id
+      cellClick(row) {
+        this.current = row;
+        console.log(row);
+        this.radio = row.id;
+      },
+      handleClose() {
+        this.visible = false;
+        this.current = null;
+        this.radio = '';
+      },
+
+      selected() {
+        if (!this.current) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        this.$emit('changeParent', this.current, this.currentIndex);
+        this.handleClose();
+      },
+      selected1(row) {
+        this.$emit('changeParent', row);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+
+  .table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 95 - 0
src/components/orderListDialog/searchTable.vue

@@ -0,0 +1,95 @@
+<!-- 搜索表单 -->
+<template>
+  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
+</template>
+<script>
+export default {
+  data() {
+    return {};
+  },
+  computed: {
+    // 表格列配置
+    seekList() {
+      return [
+        {
+          label: '关键字:',
+          value: 'keyWord',
+          type: 'input',
+          placeholder: '收货单编码/采购订单编码/送货单号/产品名称'
+        },
+        {
+          label: '收货单编码:',
+          value: 'receiveNo',
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '采购订单编码:',
+          value: 'orderNo',
+          type: 'input',
+          placeholder: '请输入',
+        },
+        {
+          label: '采购订单类型:',
+          value: 'sourceTypeName',
+          labelWidth:130,
+          width: 360,
+          type: 'input',
+          placeholder: '请输入',
+        },
+        {
+          label: '产品名称:',
+          value: 'productName',
+          width: 380,
+          type: 'input',
+          placeholder: '请输入',
+        },
+        {
+          label: '供应商名称:',
+          value: 'supplierName',
+          labelWidth:130,
+          width: 360,
+          type: 'input',
+          placeholder: '请输入',
+        },
+        {
+          label: '送货单号:',
+          value: 'sendNoteNo',
+          width: 380,
+          type: 'input',
+          placeholder: '请输入'
+        },
+        {
+          label: '发运状态',
+          value: 'logisticStatus',
+          type: 'select',
+          placeholder: '请选择',
+          width: 380,
+          planList: [
+            { value: 0, label: '未发运' },
+            { value: 1, label: '已发运' }
+          ]
+        },
+
+        {
+          label: '创建时间:',
+          value: 'createTime',
+          type: 'date',
+          dateType: 'datetimerange',
+          placeholder: '',
+          width: 380,
+          valueAr: ['createTimeStart', 'createTimeEnd']
+        },
+      ];
+    }
+  },
+  methods: {
+    /* 搜索 */
+    search(e) {
+      this.$emit('search', {
+        ...e
+      });
+    }
+  }
+};
+</script>

+ 104 - 6
src/views/recordComponents/workOrderReport.vue

@@ -175,10 +175,11 @@
             />
           </el-form-item>
         </el-col>
+
         <el-col
           :span="8"
           v-if="
-            pageName == 'QualityInspection' || pageName == 'productionRecords'
+            pageName == 'productionRecords' || pageName == 'QualityInspection'
           "
         >
           <el-form-item label="供应商" required prop="supplierName">
@@ -191,6 +192,17 @@
             />
           </el-form-item>
         </el-col>
+        <el-col :span="8" v-if="pageName == 'QualityInspection'">
+          <el-form-item label="采购订单" required prop="purchaseOrderNo">
+            <el-input
+              clearable
+              v-model="addForm.purchaseOrderNo"
+              @click.native="openOrd"
+              placeholder="请选择"
+              readonly
+            />
+          </el-form-item>
+        </el-col>
         <el-col :span="8" v-if="pageName == 'QualityInspection'">
           <el-form-item
             label="检查卸车是否到位"
@@ -334,12 +346,16 @@
 
     <parentList
       :classType="
-        pageName == 'solidWasteRecord' || pageName == 'QualityInspection'
+        pageName == 'solidWasteRecord' ||
+        pageName == 'QualityInspection' ||
+        pageName == 'productionRecords'
           ? '2'
           : '1'
       "
       :type="
-        pageName == 'solidWasteRecord' || pageName == 'QualityInspection'
+        pageName == 'solidWasteRecord' ||
+        pageName == 'QualityInspection' ||
+        pageName == 'productionRecords'
           ? '19'
           : '17'
       "
@@ -357,6 +373,10 @@
       >
       <el-button @click="handleClose">取 消</el-button>
     </template>
+    <orderListDialog
+      ref="orderListDialogRef"
+      @changeParent="orderListDialogSuccess"
+    ></orderListDialog>
   </ele-modal>
 </template>
 
@@ -368,15 +388,19 @@
     getById
   } from '@/api/recordRules/index.js';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import orderListDialog from '@/components/orderListDialog/orderListDialog.vue';
   import { getUserPage } from '@/api/system/organization';
   import { getteampage, getTeam } from '@/api/main/index.js';
   import WithView from '@/components/upload/WithViewNew.vue';
+  import dayjs from 'dayjs';
+  import { getTableList } from '@/api/purchasingManage/purchaseOrder';
 
   export default {
     mixins: [dictMixins],
     components: {
       deptSelect,
       parentList,
+      orderListDialog,
       WithView
     },
     props: {
@@ -460,7 +484,9 @@
         supplierId: '',
         supplierName: '',
         productLineId: null,
-        productLineName: ''
+        productLineName: '',
+        purchaseOrderId: '',
+        purchaseOrderNo: ''
       };
 
       return {
@@ -505,7 +531,7 @@
                 const start = new Date(this.addForm.checkStartTime).getTime();
                 const finish = new Date(value).getTime();
                 const now = Date.now();
-                if (finish <= start) {
+                if (finish < start) {
                   callback(new Error('报工时间必须大于检查开始时间'));
                 } else if (finish > now) {
                   callback(new Error('报工时间不能超过当前时间'));
@@ -534,7 +560,12 @@
           executeUsersIds: [
             { required: true, message: '请选择', trigger: 'blur' },
             { required: true, message: '请选择', trigger: 'change' }
+          ],
+          purchaseOrderNo: [
+            { required: true, message: '请选择', trigger: 'blur' },
+            { required: true, message: '请选择', trigger: 'change' }
           ]
+
           // productLineId: [
           //   { required: true, message: '请选择场站', trigger: 'blur' },
           //   { required: true, message: '请选择场站', trigger: 'change' }
@@ -670,6 +701,21 @@
         this.addForm.contactId = data.id;
         this.addForm.supplierName = data.name;
         this.addForm.supplierId = data.id;
+        if (this.pageName == 'QualityInspection') {
+          //来煤获取采购订单
+          getTableList({
+            pageNum: 1,
+            size: 999,
+            orderStatus: 2,
+            isOutsourcing: 1,
+            partbId: data.id
+          }).then((res) => {
+            if (res.list?.length == 1) {
+              this.addForm.purchaseOrderId = res.list[0].id;
+              this.addForm.purchaseOrderNo = res.list[0].orderNo;
+            }
+          });
+        }
       },
       // 获取工单详情
       async getOrderDetials(id) {
@@ -704,10 +750,51 @@
             }
             return i;
           });
-          // this.$util.assignObject(this.addForm, data);
+          //      <el-col :span="8">
+          //   <el-form-item label="检查时间" required prop="checkStartTime">
+          //     <el-date-picker
+          //       v-model="addForm.checkStartTime"
+          //       type="datetime"
+          //       format="yyyy-MM-dd HH:mm:ss"
+          //       value-format="yyyy-MM-dd HH:mm:ss"
+          //       placeholder="选择日期"
+          //       style="width: 100%"
+          //       :picker-options="{
+          //         disabledDate: (time) => time.getTime() > Date.now()
+          //       }"
+          //     >
+          //     </el-date-picker>
+          //   </el-form-item>
+          // </el-col>
+          // <el-col :span="8">
+          //   <el-form-item label="报工时间" required prop="checkFinishTime">
+          //     <el-date-picker
+          //       v-model="addForm.checkFinishTime"
+          //       type="datetime"
+          //       format="yyyy-MM-dd HH:mm:ss"
+          //       value-format="yyyy-MM-dd HH:mm:ss"
+          //       placeholder="选择日期"
+          //       style="width: 100%"
+          //       :picker-options="{
+          //         disabledDate: (time) => time.getTime() > Date.now()
+          //       }"
+          //     >
+          //     </el-date-picker>
+          //   </el-form-item>
+          // </el-col>
           Object.assign(this.addForm, data);
           this.addForm.unloadCheckStatus = this.addForm.unloadCheckStatus || 1;
 
+          this.addForm.checkStartTime =
+            this.addForm.checkStartTime ||
+            dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
+          this.addForm.checkFinishTime =
+            this.addForm.checkFinishTime ||
+            dayjs(new Date()).format('YYYY-M-D HH:mm:ss');
+          console.log(
+            this.addForm.checkStartTime,
+            'this.addForm.checkStartTime'
+          );
           // 处理数据
           this.addForm.executeUsersIds = this.addForm.executeUsers
             .map((i) => i.userId)
@@ -768,6 +855,17 @@
           this.loading = false;
         }
       },
+      openOrd() {
+        if (!this.addForm.supplierId) {
+          this.$message.warning('请先选择供应商!');
+          return;
+        }
+        this.$refs.orderListDialogRef.open(this.addForm.supplierId);
+      },
+      orderListDialogSuccess(data) {
+        this.addForm.purchaseOrderId = data.id;
+        this.addForm.purchaseOrderNo = data.orderNo;
+      },
       setValue() {
         if (this.title == '报工') {
           this.addForm.detailList.forEach((item, index) => {