wangyi
2026-01-19 7fb0a8f0ab16c149484bf043754cd10cfa94de2f
src/views/ICMO/ScICMOBillList.vue
@@ -1,5 +1,5 @@
<template>
  <div style="padding: 10px">
  <div style="padding: 10px; position: relative;">
    <el-form
      :model="queryParams"
      ref="queryForm"
@@ -9,15 +9,27 @@
      class="searchBox"
    >
      <el-row>
        <el-form-item label="日期" style="margin-left: 100px">
        <el-form-item label="开始日期" style="margin-left: 100px">
          <el-date-picker
            v-model="dateRange"
            v-model="sTime"
            type="date"
            placeholder="开始日期"
            style="width: 150px"
            :disabled="queryParams.HInitTimeCycle != -1"
            value-format="yyyy-MM-dd"
            type="daterange"
            range-separator="-"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束日期">
          <el-date-picker
            v-model="eTime"
            type="date"
            placeholder="结束日期"
            style="width: 150px"
            :disabled="queryParams.HInitTimeCycle != -1"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="日期间隔">
          <el-select
@@ -51,15 +63,134 @@
              v-for="(item, index) in organizationList"
              :key="index"
              :label="item.Name"
              :value="item.ID"
              :value="item.ID.toString()"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="单据号" prop="HBillNo">
          <el-input
            v-model="queryParams.HBillNo"
            placeholder="请输入物料编码"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="业务状态" prop="HStatus">
          <el-select v-model="queryParams.HStatus" placeholder="请选择业务状态">
            <el-option
              :label="item.label"
              :value="item.value"
              :key="index"
              v-for="(item, index) in [
                {
                  label: '开工',
                  value: '开工',
                },
                {
                  label: '计划',
                  value: '计划',
                },
                {
                  label: '计划确认',
                  value: '计划确认',
                },
                {
                  label: '下达',
                  value: '下达',
                },
                {
                  label: '全部',
                  value: '0',
                },
                {
                  label: '完工',
                  value: '完工',
                },
                {
                  label: '结案',
                  value: '结案',
                },
              ]"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否下推生成流转卡" prop="HSF" label-width="180px">
          <el-select v-model="queryParams.HSF">
            <el-option
              :label="item.label"
              :value="item.value"
              :key="item.label"
              v-for="item in [
                {
                  label: '全部',
                  value: '全部',
                },
                {
                  label: '已下推',
                  value: '已下推',
                },
                {
                  label: '未下推',
                  value: '未下推',
                },
              ]"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号" prop="HModel">
          <el-input
            v-model="queryParams.HModel"
            placeholder="请输入规格型号"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="项目号" prop="HProject">
          <el-select v-model="queryParams.HProject">
            <el-option
              :label="item.label"
              :value="item.value"
              :key="item.label"
              v-for="item in HProjectList"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="生产车间" prop="HDeptName">
          <el-select v-model="queryParams.HDeptName">
            <el-option
              :label="item.label"
              :value="item.value"
              :key="item.label"
              v-for="item in HDeptNameList"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-row>
      <el-collapse v-model="activeSeach">
        <el-collapse-item title="更多" name="1">
          <el-form-item label="单据类型" prop="HBillType">
            <el-input
              v-model="queryParams.HBillType"
              placeholder="请输入单据类型"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="唯一ID" prop="HErpID">
            <el-input
              v-model="queryParams.HErpID"
              placeholder="请输入唯一ID"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="单据号" prop="HBillNo2">
            <el-input
              v-model="HBillNo2"
              placeholder="请输入单据号"
              @keyup.enter.native="syncBill"
            >
              <el-button slot="append" @click="syncBill">重新同步</el-button>
            </el-input>
          </el-form-item>
          <el-card class="box-card">
            <div slot="header" class="clearfix"><span>过滤</span></div>
            <div>
@@ -363,7 +494,16 @@
          >反作废</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="push_PackingInStockBill((form = rowForm))"
          >下推包装领用申请单</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
@@ -434,9 +574,10 @@
                <span v-if="column.property.includes('日期')">{{
                  parseTime(row[column.property], "{y}-{m}-{d}")
                }}</span>
                <el-button
                  type="text"
                  @click="handleEdit(row, (OperationType = 3))"
                  @click.stop="handleEdit(row, (OperationType = 3))"
                  v-else-if="column.property == '单据号'"
                  >{{ row.单据号 }}</el-button
                >
@@ -469,14 +610,14 @@
      </el-dialog>
      <!-- 编辑 -->
      <el-dialog
        title="编辑职员"
        title="编辑生产订单"
        :visible.sync="openEdit"
        width="1480px"
        append-to-body
        class="xsckdBox"
        :before-close="close"
      >
        <edit
        <!-- <edit
          :OperationType="OperationType"
          :linterid="this.rowForm.HItemID"
          :HSouceBillType="this.rowForm.HSourceBillType"
@@ -484,7 +625,11 @@
          :copyType="copyType"
          @editCloseGy="editGyClose"
          v-if="editShow"
        />
        /> -->
        <div style="height: 70vh" v-if="openEdit">
          <iframe :src="iframeUrl" width="100%" height="100%" frameborder="0"></iframe>
        </div>
      </el-dialog>
      <el-dialog
        :title="upload.title"
@@ -583,15 +728,17 @@
import dayjs from "dayjs";
export default {
  name: "GySource",
  name: "ScICMOBillList",
  components: { RowSettings },
  props: {
    openPage: { type: String },
  },
  data() {
    return {
      iframeUrl: "",
      activeSeach: "",
      HModName: "Cg_POOrderBillList",
      HModName: "Sc_ICMOBillList",
      rowList:[],
      editShow: false,
      openEdit: false,
      totalNameList: [],
@@ -600,11 +747,12 @@
      openPrintList: false,
      printListShow: false,
      HClassTag: "ForFilteringSchemes", //过滤条件的class类
      HBillType: "1202",
      HBillType: "3710",
      openBtnHide: false,
      btnHideShow: false,
      rowHideShow: false,
      openRowHide: false,
      HBillNo2: "",
      copyType: 0,
      comparatorList: [
        { label: "=", value: "=" },
@@ -632,6 +780,7 @@
        { label: "近30天", value: 29 },
        { label: "近半年", value: 180 },
        { label: "近一年", value: 365 },
        { label: "任意间隔", value: -1 },
      ],
      hPriceTypeList: ["成本价", "结算价"],
      addBtnShow: false,
@@ -643,6 +792,8 @@
      materialShow: false, //物料数据组件
      deptform: {}, //弹窗选中数据
      openData: false, //数据弹窗
      HProjectList: [], // 项目号列表
      HDeptNameList: [], // 车间列表
      dialogTitle: "",
      zuzhiId: "",
      organizationList: JSON.parse(sessionStorage.getItem("organizationList")), //组织列表
@@ -650,7 +801,6 @@
      OperationType: null, //保存类型(新增1修改3)
      HInterID: null,
      baseURL: process.env.VUE_APP_BASE_API || "http://47.96.97.237/API/",
      user: "admin",
      currentRow: [],
      lastSelectedRowIndex: null, // 用于记录上次点击的行索引
      lastSelectedRow: null, // 上一次选中的行
@@ -669,7 +819,7 @@
      dateRange: [],
      // 查询参数
      queryParams: {
        HOrgID: null,
        HOrgID: sessionStorage["OrganizationID"],
        HName: null,
        HNumber: null,
        Comparator1: "",
@@ -678,7 +828,10 @@
        ColContent1: "",
        ColContent2: "",
        ColContent: "",
        timeSpan: 29,
        HStatus: "开工",
        HSF: "全部",
        HProject: "",
        HInitTimeCycle: 29,
        HBeginDate: dayjs(new Date()).subtract(29, "d").format("YYYY-MM-DDTHH:mm:ss"),
        HEndDate: dayjs(new Date()).format("YYYY-MM-DDTHH:mm:ss"),
      },
@@ -699,7 +852,14 @@
      btResList: [],
      tableData: [], //收料通知单列表(分页显示)
      dataList: [],
      titleData: ["HItemID", "Hprocid", "HUSEORGID", "HCREATEORGID", "HParentID"], //不需要显示的字段 可扩展
      titleData: [
        "HItemID",
        "hmainid",
        "Hprocid",
        "HUSEORGID",
        "HCREATEORGID",
        "HParentID",
      ], //不需要显示的字段 可扩展
      pageSizes: [50, 100, 500, 5000, 50000],
      page: 1,
      pageSize: 50,
@@ -724,8 +884,7 @@
        updateSupport: 0,
        // 设置上传的请求头部
        // headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: "http://47.96.97.237/API/Gy_Source/Gy_Source_Excel",
        url: "",
      },
      uploadData: [],
      alluploadList: [],
@@ -736,12 +895,52 @@
      uploadTotal: 0,
    };
  },
  mounted() {},
  mounted() {
    window.editGyClose = () => {
      this.editGyClose(); // 组件内的方法绑定到windows
    };
  },
  created() {
    // set upload URL from configured baseURL
    this.upload.url = this.$baseUrl + "Gy_Source/Gy_Source_Excel";
    this.riqiChange();
    this.get_HProjectList();
    this.get_HDeptNameList();
    this.getList();
  },
  beforeDestroy() {
    // 组件销毁时清理全局方法,避免内存泄漏
    delete window.editGyClose;
  },
  methods: {
    syncBill() {
      axios.get(`${this.$baseUrl}/Sc_ICMOBill/Sc_ICMOBillViewApi`, {
        params: {
          BillNo: this.HBillNo2,
          BillType: "3710",
        },
      });
    },
    async get_HDeptNameList() {
      let res = await axios.get(`${this.$baseUrl}/Sc_ICMOBill/GetHDeptList`, {
        params: { HOrgID: sessionStorage["OrganizationID"] },
      });
      this.HDeptNameList = [
        { label: "全部车间", value: 0 },
        ...res.data.data.map((e) => {
          return { label: e.HName, value: e.HItemID };
        }),
      ];
    },
    async get_HProjectList() {
      let res = await axios.get(`${this.$baseUrl}/Gy_Material/Get_HProject`);
      this.HProjectList = res.data.data.map((e) => {
        return { label: e.HName, value: e.HItemID };
      });
    },
    push_PackingInStockBill(row) {
      console.log(row);
    },
    onDateScanOptionChangerHandler(e) {
      this.queryParams.timeSpan = e;
      if (e == -1) {
@@ -782,7 +981,7 @@
    defaintOperationByCompanyName() {
      var result = false;
      axios
        .get(this.baseURL + "/Xt_getInfo/getCompanyName")
        .get(this.$baseUrl + "/Xt_getInfo/getCompanyName")
        .then((res) => {
          var data1 = res.data;
          if (data1.count == 1) {
@@ -817,6 +1016,9 @@
      this.getList();
    },
    riqiChange() {
      if (this.queryParams.HInitTimeCycle == -1) {
        return;
      }
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * this.queryParams.HInitTimeCycle);
@@ -867,65 +1069,37 @@
      this.dbEmitData(this.deptform, this.dialogTypeNum);
      this.deptform = {};
    },
    fetchData() {
      //登录用户信息
      axios
        .get(
          "http://47.96.97.237/API/Web/GetUser?UserName=001&PassWord=123456&HOrgName=100038"
        )
        .then((res) => {
          let data = res.data.data[0];
          this.zuzhiId = data.HUSEORGID; //根据登录用户获取默认的组织ID
          this.queryParams.HOrgID = data.HUSEORGID;
          this.user = data.Czymc;
          axios
            .get(this.baseURL + "/Web/GetOrganizations", {})
            .then((res) => {
              if (res.data.count == 1) {
                this.organizationList = res.data.data; //组织列表
              }
              this.handleQuery();
              // this.getList();
            })
            .catch((error) => {
              this.$modal.msgError("接口请求失败!");
            });
        })
        .catch((error) => {
          this.$modal.msgError("接口请求失败!");
        });
    },
    async getList() {
      this.tableShow = false;
      this.loading = true;
      if (this.pageSize == 0) {
        this.pageSize = 50;
      }
      this.queryParams.HOrgID = sessionStorage["OrganizationID"]
      // this.queryParams.HOrgID = 100038
      // this.sWhere += ` and CONVERT(varchar(100),日期, 23) >= '2020-01-01' and CONVERT(varchar(100),日期, 23) <= '2030-01-01'`;
      // 收料通知单列表
      if (this.dateRange.length > 0) {
        this.sWhere +=
          " and CONVERT(varchar(100),日期, 23) >= '" + this.dateRange[0] + "'";
        this.sWhere +=
          " and CONVERT(varchar(100),日期, 23) <= '" + this.dateRange[1] + "'";
      if (this.sTime) {
        this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.sTime + "'";
        this.sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + this.eTime + "'";
      }
      console.log()
      let Organization = this.organizationList.find(e => e.ID = this.queryParams.HOrgID)?.Name
      try{
        let res = await axios.get(this.baseURL + "/Xs_SeOutStockBill/list_byPage", {
          params: {
            sWhere: this.sWhere,
            user: this.user,
            Organization: Organization,
            page: this.page,
            size: this.pageSize,
          },
        });
      let Organization = this.organizationList.find(
        (e) => e.ID == this.queryParams.HOrgID
      )?.Name;
      console.log(this.queryParams.HOrgID);
      console.log(Organization);
      try {
        let res = await axios.get(
          this.$baseUrl + "/LEMS/MES_IF_ICMOBillList_Json_byPage",
          {
            params: {
              sWhere: this.sWhere,
              user: sessionStorage["HUserName"],
              Organization: Organization,
              page: this.page,
              size: this.pageSize,
            },
          }
        );
        this.tyResList = [...JSON.parse(JSON.stringify(res.data.data))]; //总数据
        let data1 = res.data;
        let option = [];
@@ -1009,7 +1183,12 @@
            }
          }
          option.data = result;
          this.DisPlay_HideColumn(this.HModName, this.user, option, this.dataList);
          this.DisPlay_HideColumn(
            this.HModName,
            sessionStorage["HUserName"],
            option,
            this.dataList
          );
        }
      } catch (err) {
        this.$modal.msgError(`获取收料通知单错误: ${err}`);
@@ -1018,7 +1197,7 @@
    DisPlay_HideColumn(HModName, user, option, dataOption) {
      this.totalNameList = [];
      axios
        .get(this.baseURL + "/Xt_grdAlignment_WMES/grdAlignmentWMESList", {
        .get(this.$baseUrl + "/Xt_grdAlignment_WMES/grdAlignmentWMESList", {
          params: {
            HModName: HModName,
            user: user,
@@ -1166,22 +1345,26 @@
      this.selectedRow = row; // 记录当前选中的行
      this.lastSelectedRowIndex = this.tableData.indexOf(row);
      this.$refs.tableData.toggleRowSelection(row);
      if (this.openPage) {
        this.$emit('deptEmit', this.rowList, 10)
      }
    },
    //选中行高亮样式
    rowStyle({ row, rowIndex }) {
      if (this.ids.includes(row.HItemID)) {
      if (this.ids.includes(row.hmainid)) {
        return { background: "#ecf5ff" };
      }
    },
    //双击行
    handleDblclick(row, column, cell, event) {
      this.OperationType = 3;
      this.handleEdit();
      this.handleEdit(row, this.OperationType);
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      // this.rowForm = {}
      this.ids = selection.map((item) => item.HItemID);
      this.rowList=selection
      this.ids = selection.map((item) => item.hmainid);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
      if (!this.single) {
@@ -1265,20 +1448,29 @@
        }
        this.sWhere += " and " + this.queryParams.ColName2 + " " + com2;
      }
      if (this.queryParams.HNumber) {
        this.sWhere += " and 生产资源代码 like '%" + this.queryParams.HNumber + "%'";
      }
      if (this.queryParams.HName) {
        this.sWhere += " and 生产资源名称 like '%" + this.queryParams.HName + "%'";
      if (this.queryParams.HBillNo) {
        this.sWhere += " and 单据号 like '%" + this.queryParams.HBillNo + "%'";
      }
      if (this.queryParams.HBeginDate && this.queryParams.HEndDate) {
        console.log(this.queryParams.HBeginDate, this.queryParams.HEndDate);
        this.sWhere += `  and CONVERT(varchar(100),日期, 23) >= '${this.queryParams.HBeginDate}' and CONVERT(varchar(100),日期, 23) <= '${this.queryParams.HEndDate}'`;
      if (this.queryParams.HMaterName) {
        this.sWhere += " and 产品代码 like '%" + this.queryParams.HMaterName + "%'";
      }
      if (this.queryParams.HOrgID) {
        this.sWhere += " and HOrgID = '" + this.queryParams.HOrgID + "'";
      if (this.queryParams.HDeptName && this.queryParams.HDeptName != 0) {
        this.sWhere += " and HDeptID = " + HDeptName;
      }
      if (this.queryParams.HStatus && this.queryParams.HStatus != 0) {
        this.sWhere += " and 状态  like '%" + this.queryParams.HStatus + "%'";
      }
      if (this.queryParams.HBillType) {
        this.sWhere += " and 单据类型 like '%" + this.queryParams.HBillType + "%'";
      }
      if (this.queryParams.HErpID) {
        sWhere += " and 唯一ID like '%" + this.queryParams.HErpID + "%'";
      }
      if (this.queryParams.HModel) {
        this.sWhere += " and 规格型号 like '%" + this.queryParams.HModel + "%'";
      }
      this.sWhere += this.addSWhereByOpenType();
      // this.sWhere += this.getOrgIDByUser();
      this.searchOpen = false;
@@ -1299,10 +1491,10 @@
    getOrgIDByUser() {
      var res = "";
      axios
        .get(this.baseURL + "/Xt_User/getOrgIDListByUser", {
        .get(this.$baseUrl + "/Xt_User/getOrgIDListByUser", {
          params: {
            HModName: this.HModName,
            user: this.user,
            user: sessionStorage["HUserName"],
            HOrgID: this.zuzhiId,
          },
        })
@@ -1357,13 +1549,16 @@
    //打开新增组件弹窗
    handleAddEdit() {
      this.rowForm.HItemID = 0;
      this.iframeUrl = `/iframe/ScICMOBillEdit?HInterID=0&OperationType=1`;
      this.$nextTick(() => {
        this.openEdit = true;
        this.editShow = true;
      });
    },
    //打开修改组件弹窗
    handleEdit() {
    handleEdit(row, OperationType) {
      console.log(row);
      this.iframeUrl = `/iframe/ScICMOBillEdit?HInterID=${row.hmainid}&OperationType=${OperationType}&HEntryID=${row.hsubid}`;
      this.$nextTick(() => {
        this.openEdit = true;
        this.editShow = true;
@@ -1382,14 +1577,14 @@
        .then(() => {
          if (!this.rowForm.审核人) {
            axios
              .get(this.baseURL + "/Xs_SeOutStockBill/DeltetSeOutStockBill", {
              .get(this.$baseUrl + "/Xs_SeOutStockBill/DeltetSeOutStockBill", {
                params: {
                  HInter: this.rowForm.hmainid.toString(),
                  HsupId: this.rowForm.HsupId,
                  HQty: this.rowForm.HQty,
                  HSourceInterID: this.rowForm.HSourceInterID,
                  HSourceEntryID: this.rowForm.HSourceEntryID,
                  user: this.user,
                  user: sessionStorage["HUserName"],
                },
              })
              .then((res) => {
@@ -1414,8 +1609,12 @@
      var InterID = form.HItemID || form.HInterID || form.hmainid;
      //逻辑审核方法
      axios
        .get(this.baseURL + "/Xs_SeOutStockBill/CheckXs_SeOutStockBill", {
          params: { HInterID: InterID, TypeError: num, CurUserName: this.user },
        .get(this.$baseUrl + "/Xs_SeOutStockBill/CheckXs_SeOutStockBill", {
          params: {
            HInterID: InterID,
            TypeError: num,
            CurUserName: sessionStorage["HUserName"],
          },
        })
        .then((res) => {
          let result = res.data;
@@ -1435,12 +1634,12 @@
      let HInterID = form.HItemID || form.HInterID || form.hmainid;
      try {
        let res = await axios.get(
          `${this.baseURL}/Xs_SeOutStockBill/CloseXs_SeOutStockBill`,
          `${this.$baseUrl}/Xs_SeOutStockBill/CloseXs_SeOutStockBill`,
          {
            params: {
              HInterID: HInterID,
              Type: num,
              user: this.user,
              user: sessionStorage["HUserName"],
            },
          }
        );
@@ -1462,13 +1661,13 @@
      let HEntryID = form.HEntryID || form.hsubid;
      try {
        let res = await axios.get(
          `${this.baseURL}/Xs_SeOutStockBill/CloseRowXs_SeOutStockBill`,
          `${this.$baseUrl}/Xs_SeOutStockBill/CloseRowXs_SeOutStockBill`,
          {
            params: {
              HInterID: HInterID,
              HEntryID: HEntryID,
              ISAudit: num,
              CurUserName: this.user,
              CurUserName: sessionStorage["HUserName"],
            },
          }
        );
@@ -1489,12 +1688,12 @@
      let HInterID = form.HItemID || form.HInterID || form.hmainid;
      try {
        let res = await axios.get(
          `${this.baseURL}/Xs_SeOutStockBill/CancellXs_SeOutStockBill`,
          `${this.$baseUrl}/Xs_SeOutStockBill/CancellXs_SeOutStockBill`,
          {
            params: {
              HInterID: HInterID,
              Type: num,
              user: this.user,
              user: sessionStorage["HUserName"],
            },
          }
        );
@@ -1515,8 +1714,12 @@
      var InterID = form.HItemID || form.HInterID;
      //逻辑审核方法
      axios
        .get(this.baseURL + "/Gy_Employee/StopGy_Employee", {
          params: { HInterID: InterID, IsStop: num, CurUserName: this.user },
        .get(this.$baseUrl + "/Gy_Employee/StopGy_Employee", {
          params: {
            HInterID: InterID,
            IsStop: num,
            CurUserName: sessionStorage["HUserName"],
          },
        })
        .then((res) => {
          let result = res.data;
@@ -1582,10 +1785,10 @@
        }
      }
      var sSubStr = JSON.stringify(num);
      var sMainSub = sSubStr + "&和" + this.user;
      var sMainSub = sSubStr + "&和" + sessionStorage["HUserName"];
      axios({
        method: "post",
        url: this.baseURL + "/Gy_Source/Gy_Source_btnSave",
        url: this.$baseUrl + "/Gy_Source/Gy_Source_btnSave",
        data: {
          sMainSub: sMainSub,
        },