123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <!-- @format -->
- <script lang="ts" setup>
- import type { FormInstance, FormRules } from 'element-plus'
- import { useRegister } from '~/pages/register/useRegister'
- import { getCategoryListApi, getDictListApi } from '~/api/model/common'
- const { params, nextStep } = useRegister()
- const countryList = ref()
- const categoryList = ref()
- const businessTypesList = ref()
- const annualPurchaseAmountList = ref()
- const companySizeList = ref()
- const ruleFormRef = ref<FormInstance>()
- const rules = ref<FormRules>({
- country: [
- {
- required: true,
- message: 'Country must be selected',
- trigger: 'change',
- },
- ],
- companyName: [
- {
- required: true,
- message: 'CompanyName must be filled in',
- trigger: 'blur',
- },
- ],
- purchaseCategory: [
- {
- required: true,
- message: 'Category must be selected',
- trigger: 'change',
- },
- ],
- companyType: [
- {
- required: true,
- message: 'CompanyType must be selected',
- trigger: 'change',
- },
- ],
- annualPurchaseAmount: [
- {
- required: true,
- message: 'AnnualPurchaseAmount must be selected',
- trigger: 'change',
- },
- ],
- companySize: [
- {
- required: true,
- message: 'CompanySize must be selected',
- trigger: 'blur',
- },
- ],
- })
- async function getCountryList() {
- const list = await getDictListApi('A070')
- countryList.value = list
- }
- async function getBusinessTypesList() {
- const list = await getDictListApi('A071')
- businessTypesList.value = list
- }
- async function getAnnualPurchaseAmountList() {
- const list = await getDictListApi('A072')
- annualPurchaseAmountList.value = list
- }
- async function getCompanySizeList() {
- const list = await getDictListApi('A167')
- companySizeList.value = list
- }
- async function getCategoryList() {
- const list = await getCategoryListApi({
- all: false,
- })
- categoryList.value = list
- }
- async function submitForm(formEl: FormInstance | undefined) {
- if (!formEl)
- return
- await formEl.validate((valid, fields) => {
- if (valid)
- nextStep()
- else
- console.log('error submit!', fields)
- })
- }
- getCountryList()
- getCategoryList()
- getCompanySizeList()
- getBusinessTypesList()
- getAnnualPurchaseAmountList()
- </script>
- <template>
- <div>
- <div class="fw-500 mb-24px text-40px text-#000">
- Company
- </div>
- <el-form
- ref="ruleFormRef"
- :model="params"
- :rules="rules"
- label-width="auto"
- size="default"
- status-icon
- >
- <el-form-item label="Country" prop="country" class="custom-form-item">
- <el-select v-model="params.country" placeholder="Country" filterable>
- <el-option
- v-for="(item, index) in countryList"
- :key="index"
- class="!h-50px !lh-50px"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item
- label="Company Name"
- class="custom-form-item"
- prop="companyName"
- >
- <el-input
- v-model="params.companyName"
- placeholder="Company name"
- class="h-50px"
- />
- </el-form-item>
- <el-form-item
- label="Category"
- prop="purchaseCategory"
- class="custom-form-item"
- >
- <el-select v-model="params.purchaseCategory" placeholder="Category" multiple>
- <el-option
- v-for="(item, index) in categoryList"
- :key="index"
- class="!h-50px !lh-50px"
- :label="item.title"
- :value="item.key"
- />
- </el-select>
- </el-form-item>
- <el-form-item
- label="Business Types"
- prop="companyType"
- class="custom-form-item"
- >
- <el-select v-model="params.companyType" placeholder="Business Types">
- <el-option
- v-for="(item, index) in businessTypesList"
- :key="index"
- class="!h-50px !lh-50px"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item
- label="Annual sourcing budget"
- prop="annualPurchaseAmount"
- class="custom-form-item"
- >
- <el-select
- v-model="params.annualPurchaseAmount"
- placeholder="Annual sourcing budget"
- >
- <el-option
- v-for="(item, index) in annualPurchaseAmountList"
- :key="index"
- class="!h-50px !lh-50px"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item
- label="company size"
- prop="companySize"
- class="custom-form-item"
- >
- <el-select
- v-model="params.companySize"
- placeholder="company size"
- >
- <el-option
- v-for="(item, index) in companySizeList"
- :key="index"
- class="!h-50px !lh-50px"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="Website" class="custom-form-item">
- <el-input
- v-model="params.website"
- placeholder="website"
- class="h-50px"
- />
- </el-form-item>
- <el-form-item class="form-footer mt-50px">
- <!-- <el-button
- class="!bg-#fff !text-#5B463E !w-48% !h-50px !text-18px !fw-500 !b-rd-6px b-#5B463E"
- @click="backStep"
- >
- Back
- </el-button>
- <el-button
- class="!bg-#C58C64 !text-#fff !ml-0 !w-48% !h-50px !text-18px !fw-500 !b-rd-6px"
- @click="submitForm(ruleFormRef)"
- >
- Next
- </el-button> -->
- <el-button class="!bg-#C58C64 !text-#fff !w-full !h-50px !text-16px !fw-500 !b-rd-6px " @click="submitForm(ruleFormRef)">
- Next
- </el-button>
- </el-form-item>
- </el-form>
- </div>
- </template>
- <style lang="less" scoped>
- :deep(.custom-form-item) {
- width: 100%;
- margin-bottom: 22px;
- display: block !important;
- .el-select__wrapper {
- height: 50px !important;
- }
- .el-form-item__label-wrap {
- margin-left: unset !important;
- .el-form-item__label {
- margin-bottom: 5px;
- font-size: 16px !important;
- color: #5b463e !important;
- }
- }
- .el-checkbox {
- .el-checkbox__input {
- &.is-checked {
- .el-checkbox__inner {
- color: #CC9879 !important;
- background-color: #CC9879 !important;
- border: 1px solid #CC9879 !important;
- }
- }
- .el-checkbox__inner {
- &:hover {
- border-color: #CC9879 !important;
- }
- }
- }
- &.is-checked {
- .el-checkbox__label {
- color: #CC9879 !important;
- }
- }
- }
- }
- ::v-deep(.form-footer) {
- .el-form-item__content {
- display: flex;
- justify-content: space-between;
- }
- }
- </style>
|