yangfeng
2023-08-07 a2586ce70485035d77746ff9c18364f408f4c6aa
src/views/sales/quotation/AddQuotationDialog.vue
@@ -5,6 +5,8 @@
      :visible.sync="editConfig.visible"
      :width="dialogWidth"
      :before-close="handleClose"
      append-to-body
      custom-class="iframe-dialog"
    >
      <el-form
        ref="form"
@@ -22,11 +24,24 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
                <el-form-item label="客户名称" prop="client_id">
                <el-form-item label="客户名称" prop="client_name">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.client_id"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('client', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('client')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('client')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
@@ -66,9 +81,22 @@
              <el-col :span="12">
                <el-form-item label="联系人姓名" prop="contact_id">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.contact_id"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                    <el-autocomplete
                      v-model="editConfig.infomation.contact_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'contact')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('contact', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('contact')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('contact')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
@@ -80,7 +108,7 @@
                    size="mini"
                    style="width: 63%"
                  >
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.name" :value="item.id">
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
@@ -193,21 +221,33 @@
          </div> -->
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> -->
        <el-button type="primary" size="small" @click="saveClick('form')">保存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
      <!-- 选择客户 -->
      <SelectClientDialog
        v-if="editSelectClientConfig.editVisible"
        :edit-common-config="editSelectClientConfig"
        @selClient="selClient"
      />
      <!-- 选择联系人 -->
      <SelectContactDialog
        v-if="editSelectContactConfig.editVisible"
        :edit-common-config="editSelectContactConfig"
        @selClient="selClient"
      />
    </el-dialog>
  </div>
</template>
<script>
// import CommonSelectView from "@/components/makepager/CommonSelectView"
// import CommonFormTableView from "@/components/makepager/CommonFormTableView"
import { getAllData } from "@/api/client/client"
import { getAddQuotation, getUpdateQuotation } from "@/api/sales/quotation"
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog"
export default {
  name: "QuotationDialog",
  props: {
@@ -222,10 +262,16 @@
      }
    }
  },
  // components: { CommonSelectView, CommonFormTableView },
  components: { SelectClientDialog, SelectContactDialog },
  computed: {
    searchCommonHeight() {
      return this.$refs.searchCommonView.offsetHeight
    },
    clientList() {
      return this.$store.state.getClientName.clientList
    },
    contactNamelist() {
      return this.$store.state.getClientName.contactNamelist
    }
  },
  data() {
@@ -240,11 +286,7 @@
      },
      memberOptions: [],
      quotationStatusOptions: [{ id: 1, name: "不知道" }], // 报价单状态
      currencyOptions: [
        { value: "1", label: "人民币(¥)" },
        { value: "2", label: "英镑(£)" },
        { value: "3", label: "欧元(€)" }
      ], // 币种
      currencyOptions: [], // 币种
      approvalWorkflowOptions: [], // 审批流程
      productTableList: {},
      showSummary: {
@@ -252,10 +294,24 @@
        total: true,
        sumProp: ["other1", "other2", "other3", "other4"],
        mergeNumber: 3
      }
      },
      editSelectClientConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      editSelectContactConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      clientId: this.editCommonConfig.infomation.client_id,
      contactId: this.editCommonConfig.infomation.contact_id
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geContact")
    this.setTableForm()
    this.getCommonData()
  },
@@ -263,8 +319,8 @@
    getCommonData() {
      getAllData()
        .then((res) => {
          // 缺 币种 报价单状态
          this.memberOptions = res.data.member
          this.quotationStatusOptions = res.data.quotationStatus
        })
        .catch((err) => {
          console.log(err)
@@ -320,9 +376,9 @@
      let data = this.editConfig.infomation
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        client_id: parseInt(data.client_id) || 0,
        client_id: parseInt(this.clientId) || 0,
        conditions: data.conditions || "",
        contact_id: data.contact_id || 0,
        contact_id: parseInt(this.contactId) || 0,
        file: data.file || "",
        member_id: data.member_id || 0,
        number: data.number || "",
@@ -334,6 +390,57 @@
    },
    handleClose() {
      this.editConfig.visible = false
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
      } else if (value === "contact") {
        restaurants = this.contactNamelist
      }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
    createStateFilter(queryString) {
      return (state) => {
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    handleSelectClient(value, item) {
      console.log(value)
      if (value === "client") {
        this.clientId = item.id
      } else {
        this.contactId = item.id
      }
    },
    selClientClick(value) {
      if (value === "client") {
        this.editSelectClientConfig.editVisible = true
      } else if (value === "contact") {
        this.editSelectContactConfig.editVisible = true
      }
    },
    selClient(row, value) {
      console.log(value)
      if (value === "contact") {
        this.editConfig.infomation.contact_name = row.name
        this.contactId = row.id
      } else {
        this.editConfig.infomation.client_name = row.name
        this.clientId = row.id
      }
    },
    // 清除已选择用户
    clearupClient(value) {
      if (value === "client") {
        this.editConfig.infomation.client_name = ""
        this.clientId = 0
      } else {
        this.editConfig.infomation.contact_name = ""
        this.contactId = 0
      }
    },
    // 添加附件
    addAnnexClick() {},
@@ -377,58 +484,54 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.add-quotation {
  .basic-info {
    .basic-info-title {
      background-color: #f4f8fe;
      padding-left: 10px;
      font-size: 15px;
      font-weight: bold;
      color: #666;
      height: 42px;
      line-height: 42px;
    }
    .basic-info-view {
      margin-top: 10px;
      padding-right: 40px;
      .custom-name {
        display: flex;
        .common-select-btn {
          margin-left: 5px;
          font-size: 18px;
::v-deep {
  .iframe-dialog .el-dialog__body {
    .basic-info {
      .basic-info-title {
        background-color: #f4f8fe;
        padding-left: 10px;
        font-size: 15px;
        font-weight: bold;
        color: #666;
        height: 42px;
        line-height: 42px;
      }
      .basic-info-view {
        margin-top: 10px;
        padding-right: 40px;
        .custom-name,
        .common-select {
          display: flex;
          .common-select-sel {
            width: 270px;
          }
          .common-select-btn {
            margin-left: 5px;
            font-size: 16px;
            cursor: pointer;
          }
        }
      }
      .common-select {
      .annex-view {
        display: flex;
        .common-select-sel {
          width: 270px;
        }
        .common-select-btn {
          margin-left: 5px;
          font-size: 16px;
          cursor: pointer;
        color: #6166d3;
        .setFormat {
          margin-left: 10px;
        }
      }
    }
    .annex-view {
    .unflod-collapse {
      display: flex;
      height: 30px;
      justify-content: center;
      align-items: center;
      color: #6166d3;
      .setFormat {
        margin-left: 10px;
      }
    }
  }
  .unflod-collapse {
    display: flex;
    height: 30px;
    justify-content: center;
    align-items: center;
    color: #6166d3;
  }
  .dialog-footer {
    background-color: #f5f5f5;
    height: 55px;
    line-height: 55px;
    .dialog-footer {
      background-color: #f5f5f5;
      height: 55px;
      line-height: 55px;
    }
  }
}
</style>