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,14 +63,14 @@
              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="HMaterNumber">
        <el-form-item label="单据号" prop="HBillNo">
          <el-input
            v-model="queryParams.HMaterNumber"
            v-model="queryParams.HBillNo"
            placeholder="请输入物料编码"
            @keyup.enter.native="handleQuery"
          />
@@ -68,8 +80,8 @@
            <el-option
              :label="item.label"
              :value="item.value"
              :key="item.label"
              v-for="item in [
              :key="index"
              v-for="(item, index) in [
                {
                  label: '开工',
                  value: '开工',
@@ -562,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
                >
@@ -597,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"
@@ -612,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"
@@ -711,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: [],
@@ -728,7 +747,7 @@
      openPrintList: false,
      printListShow: false,
      HClassTag: "ForFilteringSchemes", //过滤条件的class类
      HBillType: "1202",
      HBillType: "3710",
      openBtnHide: false,
      btnHideShow: false,
      rowHideShow: false,
@@ -761,6 +780,7 @@
        { label: "近30天", value: 29 },
        { label: "近半年", value: 180 },
        { label: "近一年", value: 365 },
        { label: "任意间隔", value: -1 },
      ],
      hPriceTypeList: ["成本价", "结算价"],
      addBtnShow: false,
@@ -781,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, // 上一次选中的行
@@ -800,7 +819,7 @@
      dateRange: [],
      // 查询参数
      queryParams: {
        HOrgID: null,
        HOrgID: sessionStorage["OrganizationID"],
        HName: null,
        HNumber: null,
        Comparator1: "",
@@ -833,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,
@@ -858,8 +884,7 @@
        updateSupport: 0,
        // 设置上传的请求头部
        // headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: "http://47.96.97.237/API/Gy_Source/Gy_Source_Excel",
        url: "",
      },
      uploadData: [],
      alluploadList: [],
@@ -870,18 +895,26 @@
      uploadTotal: 0,
    };
  },
  mounted() {},
  mounted() {
    window.editGyClose = () => {
      this.editGyClose(); // 组件内的方法绑定到windows
    };
  },
  created() {
    // this.form.Organization = sessionStorage["Organization"];
    this.queryParams.HOrgID = sessionStorage["OrganizationID"];
    // 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`, {
      axios.get(`${this.$baseUrl}/Sc_ICMOBill/Sc_ICMOBillViewApi`, {
        params: {
          BillNo: this.HBillNo2,
          BillType: "3710",
@@ -889,16 +922,18 @@
      });
    },
    async get_HDeptNameList() {
      let res = await axios.get(`${this.baseURL}/Sc_ICMOBill/GetHDeptList`, {
      let res = await axios.get(`${this.$baseUrl}/Sc_ICMOBill/GetHDeptList`, {
        params: { HOrgID: sessionStorage["OrganizationID"] },
      });
      console.log(res);
      this.HDeptNameList = res.data.data.map((e) => {
        return { label: e.HName, value: e.HItemID };
      });
      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`);
      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 };
      });
@@ -946,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) {
@@ -981,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);
@@ -1031,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"];
      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 + "'";
      }
      let Organization = this.organizationList.find(
        (e) => (e.ID = this.queryParams.HOrgID)
        (e) => e.ID == this.queryParams.HOrgID
      )?.Name;
      console.log(this.queryParams.HOrgID);
      console.log(Organization);
      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 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 = [];
@@ -1173,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}`);
@@ -1182,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,
@@ -1330,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) {
@@ -1472,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,
          },
        })
@@ -1530,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;
@@ -1555,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) => {
@@ -1587,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;
@@ -1608,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"],
            },
          }
        );
@@ -1635,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"],
            },
          }
        );
@@ -1662,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"],
            },
          }
        );
@@ -1688,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;
@@ -1755,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,
        },