陈婷婷
昨天 a4989ac2090626b23c630a097f5f773f08f8f949
src/views/system/user/GyDriverEdit.vue
@@ -67,18 +67,17 @@
              />
            </el-form-item>
            <el-form-item label="所属公司" prop="HDeptID">
            <el-form-item label="所属承运商" prop="HCompID">
              <div class="dept-select">
                <el-input
                  v-model="formData.HDeptName"
                  placeholder="请选择所属公司"
                  placeholder="请选择所属承运商"
                  readonly
                  clearable
                  :disabled="isViewMode"
                />
                <el-input
                  type="hidden"
                  v-model="formData.HDeptID"
                  v-model="formData.HCompID"
                  style="display: none"
                />
                <el-button
@@ -87,6 +86,7 @@
                  @click="openDeptDialog"
                  :disabled="isViewMode"
                  style="margin-left: 10px"
                  disabled
                >
                </el-button>
              </div>
@@ -99,7 +99,7 @@
                v-model="formData.checkboxHStopflag"
                :true-label="1"
                :false-label="0"
                :disabled="!canEditStopFlag"
                disabled
                @change="handleStopFlagChange"
              >
                是否禁用
@@ -253,13 +253,14 @@
    <!-- 部门选择弹窗 -->
    <el-dialog
      title="dialogTitle"
      title="承运商"
      :visible.sync="openData"
      width="90%"
      top="5vh"
      append-to-body
      disabled
    >
    <Dept @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="deptShow" />
    <GySupplier  ref="supplierRef"@deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="deptShow" />
      
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="deptClickSub">确 定</el-button>
@@ -272,10 +273,10 @@
<script>
import axios from "axios";
import Dept from "@/views/component/dept";
import GySupplier from '@/views/basic/gy/gySupplier.vue'
export default {
  name: "GyDriverEdit",
  components: { Dept},
  components: { GySupplier},
  props: {
    OperationType: {
      type: Number,
@@ -313,14 +314,14 @@
        HNumber: "",
        HName: "",
        HHelpCode: "",
        HDeptName: "",
        HDeptID: "0",
        HDeptName:sessionStorage["HSupName"],
        HCompID: sessionStorage["HSupID"],
        HDepNumber: "",
        HIDCard: "",
        HPhone: "",
        HDriverCardType: "A1",
        HEmpType: "固定",
        HStopflag: "0",
        HStopflag: 0,
        checkboxHStopflag: 0,
        HRemark: "",
        HUSEORGID: "",
@@ -399,14 +400,19 @@
        this.openData = false;
    },
    deptClickSub() {
      if (this.deptform && this.deptform.HItemID) {
      this.formData.HDeptName = this.deptform.部门名称;
      this.formData.HDeptID = this.deptform.HItemID;
      this.openData = false;
      this.deptShow = false;
    } else {
      this.$modal.msgWarning("请先选择一个部门");
    }
      // 直接从子组件获取当前选中的行数据
      const selectedRow = this.$refs.supplierRef?.rowForm;
      if (selectedRow && selectedRow.HItemID) {
        // 设置表单数据
        this.formData.HDeptName = selectedRow.供应商名称 || selectedRow.HName;
        this.formData.HCompID = selectedRow.HItemID;
        this.openData = false;
        this.deptShow = false;
        this.$modal.msgSuccess("已选择承运商:" + this.formData.HDeptName);
      } else {
        this.$modal.msgWarning("请先选择一个承运商");
      }
    },
    deptDialogVisible() {
      this.deptform = {};
@@ -438,6 +444,8 @@
        case 1: // 新增
          this.orgDisabled = true;
          this.formData.HItemID = "0";
          this.formData.HDeptName =sessionStorage["HSupName"];
          this.formData.HCompID = sessionStorage["HSupID"];
          break;
          
        case 2: // 复制
@@ -529,10 +537,10 @@
      
      if (data.禁用标识) {
        this.formData.checkboxHStopflag = 1;
        this.formData.HStopflag = "1";
        this.formData.HStopflag = 1;
      } else {
        this.formData.checkboxHStopflag = 0;
        this.formData.HStopflag = "0";
        this.formData.HStopflag = 0;
      }
    },
    
@@ -573,7 +581,7 @@
        const sMainStr = JSON.stringify(saveData);
        const res = await axios.post(`${this.$baseUrl}/Gy_Driver/AddBill1`, {
          oMain: `${sMainStr};${sessionStorage.getItem("HUserName")};${
            sessionStorage.getItem("OrganizationID") || 100038
            sessionStorage.getItem("OrganizationID")
          }`,
        });
        
@@ -631,14 +639,14 @@
    
    handleStopFlagChange(value) {
      this.formData.HStopflag = value ? "1" : "0";
      this.formData.HStopflag = value ? 1 : 0;
    },
    
  
    openDeptDialog() {
        this.deptShow = false;
       this.dialogTitle = "部门列表";
        this.deptShow = true;
        this.dialogTitle = "承运商列表";
        this.deptShow = false;
        this.openData = true;
    },