llj
2025-12-02 7b7d716d98e126adfbf8c5f008ed0a73f9ce5ee3
物料和客户测试修复
3个文件已修改
214 ■■■■■ 已修改文件
src/views/GyCustomer/CustomerEdit/index.vue 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/GyCustomer/index.vue 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/gyMaterial/GyMaterial.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/GyCustomer/CustomerEdit/index.vue
@@ -119,15 +119,15 @@
   
              <el-tab-pane label="其他信息" name="other">
                <el-form ref="formOther" :model="formData" label-width="100px">
                <el-form ref="formOther" :model="formData" :rules="rules" label-width="100px">
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="联系人">
                      <el-form-item label="联系人" prop="HLinkMan">
                        <el-input v-model="formData.HLinkMan" placeholder="请输入联系人"></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="联系电话">
                      <el-form-item label="联系电话" prop="HLinkPhone">
                        <el-input v-model="formData.HLinkPhone" placeholder="请输入联系电话"></el-input>
                      </el-form-item>
                    </el-col>
@@ -148,7 +148,7 @@
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="地址">
                      <el-form-item label="地址" prop="HAddress">
                        <el-input v-model="formData.HAddress" placeholder="请输入地址"></el-input>
                      </el-form-item>
                    </el-col>
@@ -220,7 +220,7 @@
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="地区">
                      <el-form-item label="地区" prop="HAreaID">
                        <el-input 
                          v-model="formData.HAreaName" 
                          placeholder="请选择地区"
@@ -280,7 +280,7 @@
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="客户状态">
                      <el-form-item label="客户状态" prop="HCusStatus">
                        <el-select v-model="formData.HCusStatus" placeholder="请选择客户状态" style="width: 100%">
                          <el-option label="潜在" value="101"></el-option>
                          <el-option label="合格" value="102"></el-option>
@@ -548,6 +548,7 @@
    this.initData()
    this.loadOrganizations()
    this.handleOperationType()
    this.setConditionalRules()
  },
  methods: {
    initData() {
@@ -708,44 +709,95 @@
    },
    
    // 保存
    handleSave() {
      this.$refs.form.validate(valid => {
        if (valid) {
          if (!this.validateForm()) {
            return
          }
          const formData = { ...this.formData }
          formData.HStopflag = formData.HStopflag ? 'true' : 'false'
          let url = `${this.baseURL}/Gy_Customer/AddBill`
          let params = { oMain: JSON.stringify(formData) + ';' + this.user }
          if (this.operationType === 3) {
            // 编辑保存
            url = `${this.baseURL}/Gy_Customer/AddBill1`
            params = {
              oMain: JSON.stringify(formData) + ';' + this.linterid + ';' + this.user + ';Gy_Customer_Edit'
            }
          }
          axios.post(url, params)
            .then(response => {
              if (response.data.count === 1) {
                this.$modal.msgSuccess(response.data.Message)
                this.saveDisabled = true
                this.saveConfig()
                this.openEdit = false
                this.$emit('editClose', true)
              } else {
                this.$modal.msgError(response.data.Message)
              }
            })
            .catch(error => {
              this.$modal.msgError('保存失败!')
            })
        }
    async handleSave() {
      const validMain = await new Promise(resolve => {
        this.$refs.form.validate(valid => resolve(valid))
      })
      let validOther = true
      if (this.$refs.formOther) {
        validOther = await new Promise(resolve => {
          this.$refs.formOther.validate(valid => resolve(valid))
        })
      }
      if (validMain && validOther) {
        if (!this.validateForm()) {
          return
        }
        const formData = { ...this.formData }
        formData.HStopflag = formData.HStopflag ? 'true' : 'false'
        let url = `${this.baseURL}/Gy_Customer/AddBill`
        let params = { oMain: JSON.stringify(formData) + ';' + this.user }
        if (this.operationType === 3) {
          // 编辑保存
          url = `${this.baseURL}/Gy_Customer/AddBill1`
          params = {
            oMain: JSON.stringify(formData) + ';' + this.linterid + ';' + this.user + ';Gy_Customer_Edit'
          }
        }
        axios.post(url, params)
          .then(response => {
            if (response.data.count === 1) {
              this.$modal.msgSuccess(response.data.Message)
              this.saveDisabled = true
              this.saveConfig()
              this.openEdit = false
              this.$emit('editClose', true)
            } else {
              this.$modal.msgError(response.data.Message)
            }
          })
          .catch(error => {
            this.$modal.msgError('保存失败!')
          })
      }
    },
    setConditionalRules() {
      this.rules.HLinkMan = [
        { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '请输入联系人' }
      ]
      this.rules.HLinkPhone = [
        { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '请输入联系电话' }
      ]
      this.rules.HAddress = [
        { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '请输入地址' }
      ]
      this.rules.HAreaID = [
        { validator: this.validateRequiredIfAdd, trigger: 'change', message: '请选择地区' }
      ]
      this.rules.HCusStatus = [
        { validator: this.validateRequiredIfAdd, trigger: 'change', message: '请选择客户状态' }
      ]
    },
    validateRequiredIfAdd(rule, value, callback) {
      if (this.operationType !== 1) {
        return callback()
      }
      if (value === null || value === undefined) {
        return callback(new Error(rule.message || '该项为必填'))
      }
      if (typeof value === 'string' && value.trim() === '') {
        return callback(new Error(rule.message || '该项为必填'))
      }
      if (value === '0') {
        return callback(new Error(rule.message || '该项为必填'))
      }
      return callback()
    },
    
    // 表单验证
src/views/GyCustomer/index.vue
@@ -29,14 +29,14 @@
                  <el-row>
                    <el-col :span="7">
                      <el-select v-model="queryParams.ColName" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select v-model="queryParams.Comparator" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
@@ -51,14 +51,14 @@
                  <el-row>
                    <el-col :span="7">
                      <el-select v-model="queryParams.ColName1" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select v-model="queryParams.Comparator1" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
@@ -73,14 +73,14 @@
                  <el-row>
                    <el-col :span="7">
                      <el-select v-model="queryParams.ColName2" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select v-model="queryParams.Comparator2" placeholder="请选择" style="width: 100%">
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
@@ -301,12 +301,12 @@
        HNumber: null,
        HName: null,
        HNumber2: null,
        ColName: "0",
        ColName1: "0",
        ColName2: "0",
        Comparator: "0",
        Comparator1: "0",
        Comparator2: "0",
        ColName: "",
        ColName1: "",
        ColName2: "",
        Comparator: "",
        Comparator1: "",
        Comparator2: "",
        ColContent: "",
        ColContent1: "",
        ColContent2: "",
@@ -739,6 +739,13 @@
    },
    handleRefresh() {
      if (this.$refs.tableData && this.$refs.tableData.clearSelection) {
        this.$refs.tableData.clearSelection();
      }
      this.selectedRow = null;
      this.ids = [];
      this.single = true;
      this.multiple = true;
      this.getList();
    },
@@ -798,7 +805,7 @@
    rowStyle({ row, rowIndex }) {
      if (this.ids.includes(row.hmainid)) {
        return { background: "#ecf5ff" };
        return {  };
      }
    },
src/views/gyMaterial/GyMaterial.vue
@@ -78,7 +78,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
@@ -93,7 +93,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
@@ -120,7 +120,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
@@ -135,7 +135,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
@@ -162,7 +162,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
@@ -177,7 +177,7 @@
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
@@ -642,12 +642,12 @@
        HModel: null,
        HOrgID: null,
        HProject: null,
        ColName: "0",
        ColName1: "0",
        ColName2: "0",
        Comparator: "0",
        Comparator1: "0",
        Comparator2: "0",
        ColName: "",
        ColName1: "",
        ColName2: "",
        Comparator: "",
        Comparator1: "",
        Comparator2: "",
        ColContent: "",
        ColContent1: "",
        ColContent2: "",
@@ -713,7 +713,9 @@
        .then((response) => {
          let data = response.data.data[0];
          this.user = data.Czymc;
          this.getOrganizations();
          this.queryParams.HOrgID = data.HUSEORGID;
          this.getTreeData();
          this.getProjectOptions();
          this.getList();
@@ -730,9 +732,9 @@
        .then((response) => {
          if (response.data.count == 1) {
            this.organizationOptions = response.data.data;
            if (this.organizationOptions.length > 0) {
              this.queryParams.HOrgID = this.organizationOptions[0].ID;
            }
            // if (this.organizationOptions.length > 0) {
            //   this.queryParams.HOrgID = this.organizationOptions[0].ID;
            // }
          }
        })
        .catch((error) => {
@@ -1128,6 +1130,14 @@
    },
    
    handleRefresh() {
      // 刷新时清除表格选择并重置相关状态,保证复制/编辑/删除/审核等按钮被禁用
      if (this.$refs.tableData && this.$refs.tableData.clearSelection) {
        this.$refs.tableData.clearSelection();
      }
      this.selectedRow = null;
      this.ids = [];
      this.single = true;
      this.multiple = true;
      this.getList();
    },
    
@@ -1224,7 +1234,8 @@
    // 行样式
    rowStyle({ row, rowIndex }) {
      if (this.ids.includes(row.hmainid)) {
        return { background: "#ecf5ff" };
        return {  };
        // background: "#ecf5ff"
      }
    },