diff --git a/package-lock.json b/package-lock.json index a41ab4a..10d40d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,7 +64,7 @@ }, "node_modules/@amap/amap-jsapi-loader": { "version": "1.0.1", - "resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz", "integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==" }, "node_modules/@ampproject/remapping": { diff --git a/src/views/company/edit.vue b/src/views/company/edit.vue index 94e2b70..00671ff 100644 --- a/src/views/company/edit.vue +++ b/src/views/company/edit.vue @@ -1,344 +1,321 @@ <template> - <div class="edit-popup"> - <el-form - ref="formRef" - :model="formData" - label-width="90px" - :rules="formRules" - > - <!-- <div style="font-size: 1.2rem; margin: 10px 0">公司基本信息创建</div> --> - <el-col :span="24" class="el-card pt-6"> - <div class="tit">公司基本信息创建</div> - <el-row> - <el-col :span="8"> - <el-form-item label="公司名称" prop="company_name"> - <el-input - v-model="formData.company_name" - placeholder="请输入公司名称" - clearable - :disabled="isDisabled" - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="社会代码" prop="organization_code"> - <el-input - :disabled="isDisabled" - v-model="formData.organization_code" - placeholder="请输入社会代码" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="7"> - <el-form-item - label="公司类型" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="company_type" - > - <el-select - :disabled="isDisabled" - v-model="formData.company_type" - placeholder="请选择公司类型" - clearable - @change="company_type_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.dictTypeLists" - :key="index" - :label="item.name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3"> - <el-form-item - label="省" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="province" - > - <el-select - :disabled="isDisabled" - v-model="formData.province" - placeholder="请选择省" - clearable - @change="province_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.provinceOptions" - :key="index" - :label="item.province_name" - :value="item.province_code" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3"> - <el-form-item - label="市" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="city" - > - <el-select - :disabled="isDisabled" - v-model="formData.city" - placeholder="请选择市" - clearable - @change="city_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.cityOptions" - :key="index" - :label="item.city_name" - :value="item.city_code" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3" v-if="isArea"> - <el-form-item - label="区" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="area" - > - <el-select - :disabled="isDisabled" - v-model="formData.area" - placeholder="请选择区" - clearable - @change="area_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.areaOptions" - :key="index" - :label="item.area_name" - :value="item.area_code" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3" v-if="isStreet"> - <el-form-item - label="镇" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="street" - > - <el-select - :disabled="isDisabled" - v-model="formData.street" - placeholder="请选择镇" - clearable - @change="street_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.streetOptions" - :key="index" - :label="item.street_name" - :value="item.street_code" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3" v-if="isVillage"> - <el-form-item - label="村" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="village" - > - <el-select - :disabled="isDisabled" - v-model="formData.village" - placeholder="请选择村" - clearable - @change="village_change" - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.villageOptions" - :key="index" - :label="item.village_name" - :value="item.village_code" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="3" v-if="isBrigade"> - <el-form-item - label="队" - :rules="[ - { required: true, message: '不可为空', trigger: 'blur' }, - ]" - prop="brigade" - > - <el-select - :disabled="isDisabled" - v-model="formData.brigade" - placeholder="请选择队" - clearable - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.brigadeOptions" - :key="index" - :label="item.brigade_name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="4"> - <el-form-item label="地址" prop="address"> - <el-input - :disabled="isDisabled" - v-model="formData.address" - placeholder="请输入地址" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="23"> - <el-form-item label="负责区域" prop="region"> - <el-checkbox-group - v-model="formData.responsible_area" - @change="handleCheckedCitiesChange" - :disabled="isDisabled" - > - <el-checkbox - :disabled=" - formData[regionType] == city[regionType + '_code'] || - formData[regionType] == city.id || - city.disabled - " - v-for="city in datas[regionType + 'Options']" - :key="city[regionType + '_name']" - :label=" - regionType == 'brigade' - ? city.id + '' - : city[regionType + '_code'] + '' - " - >{{ city[regionType + "_name"] }}</el-checkbox - > - </el-checkbox-group> - </el-form-item> - </el-col> - </el-row> - </el-col> - <el-col :span="24" class="el-card pt-6"> - <div class="tit">主要联系人</div> - <el-row> - <div style="display: flex; justify-content: left"> - <div class="headimg"> - <el-upload - :disabled="isDisabled" - v-model="formData.avatar" - class="avatar-uploader-head" - :data="{ cid: 1 }" - action="https://worker-task.lihaink.cn/api/upload/image" - :show-file-list="false" - :on-success="handleAvatarSuccessAvatar" - > - <img - v-if="formData.avatar" - :src="formData.avatar" - class="avatar" - /> - <el-icon v-else class="avatar-uploader-icon"> - <Plus /> - </el-icon> - </el-upload> - </div> - <div class="right"> - <el-row> - <el-col :span="8"> - <el-form-item label="姓名" prop="master_name"> - <el-input - :disabled="isDisabled" - v-model="formData.master_name" - placeholder="请输入姓名" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="10"> - <el-form-item label="职务" prop="master_position"> - <el-input - :disabled="isDisabled" - v-model="formData.master_position" - placeholder="请输入职务" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="手机" prop="master_phone"> - <el-input - :disabled="isDisabled" - v-model="formData.master_phone" - placeholder="请输入手机" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="10"> - <el-form-item label="邮箱"> - <el-input - :disabled="isDisabled" - v-model="formData.master_email" - placeholder="请输入邮箱" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="8"> - <el-form-item label="性别" prop="sex"> - <el-select - :disabled="isDisabled" - v-model="formData.sex" - placeholder="请选择性别" - :style="{ width: '100%' }" - > - <el-option label="男" value="1" /> - <el-option label="女" value="2" /> - </el-select> - </el-form-item> - </el-col> - <el-col :span="10"> - <el-form-item label="身份证"> - <el-input - :disabled="isDisabled" - v-model="formData.id_card" - placeholder="请输入身份证" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <!-- <el-col :span="10"> + <div class="edit-popup"> + <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules"> + <!-- <div style="font-size: 1.2rem; margin: 10px 0">公司基本信息创建</div> --> + <el-col :span="24" class="el-card pt-6"> + <div class="tit">公司基本信息创建</div> + <el-row> + <el-col :span="8"> + <el-form-item label="公司名称" prop="company_name"> + <el-input + v-model="formData.company_name" + placeholder="请输入公司名称" + clearable + :disabled="isDisabled" + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="社会代码" prop="organization_code"> + <el-input + :disabled="isDisabled" + v-model="formData.organization_code" + placeholder="请输入社会代码" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="7"> + <el-form-item + label="公司类型" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="company_type" + > + <el-select + :disabled="isDisabled" + v-model="formData.company_type" + placeholder="请选择公司类型" + clearable + @change="company_type_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.dictTypeLists" + :key="index" + :label="item.name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3"> + <el-form-item + label="省" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="province" + > + <el-select + :disabled="isDisabled" + v-model="formData.province" + placeholder="请选择省" + clearable + @change="province_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.provinceOptions" + :key="index" + :label="item.province_name" + :value="item.province_code" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3"> + <el-form-item + label="市" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="city" + > + <el-select + :disabled="isDisabled" + v-model="formData.city" + placeholder="请选择市" + clearable + @change="city_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.cityOptions" + :key="index" + :label="item.city_name" + :value="item.city_code" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3" v-if="isArea"> + <el-form-item + label="区" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="area" + > + <el-select + :disabled="isDisabled" + v-model="formData.area" + placeholder="请选择区" + clearable + @change="area_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.areaOptions" + :key="index" + :label="item.area_name" + :value="item.area_code" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3" v-if="isStreet"> + <el-form-item + label="镇" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="street" + > + <el-select + :disabled="isDisabled" + v-model="formData.street" + placeholder="请选择镇" + clearable + @change="street_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.streetOptions" + :key="index" + :label="item.street_name" + :value="item.street_code" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3" v-if="isVillage"> + <el-form-item + label="村" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="village" + > + <el-select + :disabled="isDisabled" + v-model="formData.village" + placeholder="请选择村" + clearable + @change="village_change" + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.villageOptions" + :key="index" + :label="item.village_name" + :value="item.village_code" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="3" v-if="isBrigade"> + <el-form-item + label="队" + :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" + prop="brigade" + > + <el-select + :disabled="isDisabled" + v-model="formData.brigade" + placeholder="请选择队" + clearable + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.brigadeOptions" + :key="index" + :label="item.brigade_name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="4"> + <el-form-item label="地址" prop="address"> + <el-input + :disabled="isDisabled" + v-model="formData.address" + placeholder="请输入地址" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="23"> + <el-form-item label="负责区域" prop="region"> + <el-checkbox-group + v-model="formData.responsible_area" + @change="handleCheckedCitiesChange" + :disabled="isDisabled" + > + <el-checkbox + :disabled=" + formData[regionType] == city[regionType + '_code'] || + formData[regionType] == city.id || + city.disabled + " + v-for="city in datas[regionType + 'Options']" + :key="city[regionType + '_name']" + :label=" + regionType == 'brigade' + ? city.id + '' + : city[regionType + '_code'] + '' + " + >{{ city[regionType + '_name'] }}</el-checkbox + > + </el-checkbox-group> + </el-form-item> + </el-col> + </el-row> + </el-col> + <el-col :span="24" class="el-card pt-6"> + <div class="tit">主要联系人</div> + <el-row> + <div style="display: flex; justify-content: left"> + <div class="headimg"> + <el-upload + :disabled="isDisabled" + v-model="formData.avatar" + class="avatar-uploader-head" + :data="{ cid: 1 }" + action="https://worker-task.lihaink.cn/api/upload/image" + :show-file-list="false" + :on-success="handleAvatarSuccessAvatar" + > + <img v-if="formData.avatar" :src="formData.avatar" class="avatar" /> + <el-icon v-else class="avatar-uploader-icon"> + <Plus /> + </el-icon> + </el-upload> + </div> + <div class="right"> + <el-row> + <el-col :span="8"> + <el-form-item label="姓名" prop="master_name"> + <el-input + :disabled="isDisabled" + v-model="formData.master_name" + placeholder="请输入姓名" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="职务" prop="master_position"> + <el-input + :disabled="isDisabled" + v-model="formData.master_position" + placeholder="请输入职务" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="手机" prop="master_phone"> + <el-input + :disabled="isDisabled" + v-model="formData.master_phone" + placeholder="请输入手机" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="邮箱"> + <el-input + :disabled="isDisabled" + v-model="formData.master_email" + placeholder="请输入邮箱" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="8"> + <el-form-item label="性别" prop="sex"> + <el-select + :disabled="isDisabled" + v-model="formData.sex" + placeholder="请选择性别" + :style="{ width: '100%' }" + > + <el-option label="男" value="1" /> + <el-option label="女" value="2" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="10"> + <el-form-item label="身份证"> + <el-input + :disabled="isDisabled" + v-model="formData.id_card" + placeholder="请输入身份证" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <!-- <el-col :span="10"> <el-form-item label="片区经理" prop="area_manager_name"> <el-input :disabled="isDisabled" @@ -350,177 +327,174 @@ ></el-input> </el-form-item> </el-col> --> - </el-row> - </div> - </div> - </el-row> - </el-col> - <el-col :span="24" class="el-card pt-6"> - <div class="tit">其他联系人</div> - - <el-row> - <template - v-for="(item, index) in formData.other_contacts" - :key="index" - > - <el-col :span="12"> - <el-form-item label="姓名" prop="field120"> - <el-input - :disabled="isDisabled" - v-model="item.name" - placeholder="请输入姓名" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> + </el-row> + </div> + </div> + </el-row> </el-col> - <el-col :span="12"> - <el-form-item label="职务" prop="field121"> - <el-input - :disabled="isDisabled" - v-model="item.position" - placeholder="请输入职务" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="手机" prop="field122"> - <el-input - :disabled="isDisabled" - v-model="item.phone" - placeholder="请输入手机" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="邮箱"> - <el-input - :disabled="isDisabled" - v-model="item.email" - placeholder="请输入邮箱" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - </template> + <el-col :span="24" class="el-card pt-6"> + <div class="tit">其他联系人</div> - <el-col :span="24"> - <el-form-item label prop="field126"> - <el-button - type="primary" - :disabled="isDisabled" - size="medium" - @click="other" - >添加联系人</el-button - > - <el-button - v-if="formData.other_contacts.length" - type="primary" - :disabled="isDisabled" - size="medium" - @click="otherdelete" - >删除</el-button - > - </el-form-item> - </el-col> - </el-row> - </el-col> - <!-- <div style="font-size: 1.2rem; margin: 10px 0">资质信息</div> --> - <el-col :span="24" class="el-card pt-6"> - <div class="tit">资质信息</div> + <el-row> + <template v-for="(item, index) in formData.other_contacts" :key="index"> + <el-col :span="12"> + <el-form-item label="姓名" prop="field120"> + <el-input + :disabled="isDisabled" + v-model="item.name" + placeholder="请输入姓名" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="职务" prop="field121"> + <el-input + :disabled="isDisabled" + v-model="item.position" + placeholder="请输入职务" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="手机" prop="field122"> + <el-input + :disabled="isDisabled" + v-model="item.phone" + placeholder="请输入手机" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="邮箱"> + <el-input + :disabled="isDisabled" + v-model="item.email" + placeholder="请输入邮箱" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + </template> - <el-row> - <el-col :span="12"> - <el-form-item label="公司资质" required> - <el-upload - :disabled="isDisabled" - v-model="formData.qualification.business_license" - class="avatar-uploader pl-3" - :data="{ cid: 1 }" - action="https://worker-task.lihaink.cn/api/upload/image" - :show-file-list="false" - :on-success="handleAvatarSuccess" - > - <img - v-if="formData.qualification.business_license" - :src="formData.qualification.business_license" - class="avatar" - /> - <el-icon v-else class="avatar-uploader-icon"> - <Plus /> - </el-icon> - </el-upload> - </el-form-item> - <el-form-item class="others" label="其他资质"> - <div - v-for="(v, i) in formData.qualification.other_qualifications" - :key="i" - class="otherimg" - > - <img :src="v" @click="clickdelete(i)" /> - </div> - <el-upload - v-if="imgflag" - :disabled="isDisabled" - class="avatar-uploader pl-3" - :data="{ cid: 1 }" - action="https://worker-task.lihaink.cn/api/upload/image" - :show-file-list="false" - :on-success="handleAvatarSuccess_two" - style="margin-bottom: 12px" - > - <el-icon class="avatar-uploader-icon"> - <Plus /> - </el-icon> - </el-upload> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label-width="120px" label="开户许可证" required> - <el-upload - :disabled="isDisabled" - v-model="formData.qualification.business_licenseB" - class="avatar-uploader pl-3" - :data="{ cid: 1 }" - action="https://worker-task.lihaink.cn/api/upload/image" - :show-file-list="false" - :on-success="handleAvatarSuccessB" - > - <img - v-if="formData.qualification.business_licenseB" - :src="formData.qualification.business_licenseB" - class="avatar" - /> - <el-icon v-else class="avatar-uploader-icon"> - <Plus /> - </el-icon> - </el-upload> - </el-form-item> - </el-col> - </el-row> - </el-col> - <!-- <div style="font-size: 1.2rem; margin: 10px 0">电子合同</div> --> - <!-- <el-col v-if="isshow" :span="24" class="el-card pt-6"> --> - <el-col v-if="false" :span="24" class="el-card pt-6"> - <div class="tit">电子合同</div> + <el-col :span="24"> + <el-form-item label prop="field126"> + <el-button + type="primary" + :disabled="isDisabled" + size="medium" + @click="other" + >添加联系人</el-button + > + <el-button + v-if="formData.other_contacts.length" + type="primary" + :disabled="isDisabled" + size="medium" + @click="otherdelete" + >删除</el-button + > + </el-form-item> + </el-col> + </el-row> + </el-col> + <!-- <div style="font-size: 1.2rem; margin: 10px 0">资质信息</div> --> + <el-col :span="24" class="el-card pt-6"> + <div class="tit">资质信息</div> - <el-row> - <el-col :span="12"> - <el-form-item label="签约方" prop="field130"> - <el-input - v-model="formData.party_a_name" - placeholder="请选择签约方" - clearable - :style="{ width: '100%' }" - :disabled="!partyDisabled || isDisabled" - @click="openCompany" - ></el-input> - <!-- <el-select + <el-row> + <el-col :span="12"> + <el-form-item label="公司资质" required> + <el-upload + :disabled="isDisabled" + v-model="formData.qualification.business_license" + class="avatar-uploader pl-3" + :data="{ cid: 1 }" + action="https://worker-task.lihaink.cn/api/upload/image" + :show-file-list="false" + :on-success="handleAvatarSuccess" + > + <img + v-if="formData.qualification.business_license" + :src="formData.qualification.business_license" + class="avatar" + /> + <el-icon v-else class="avatar-uploader-icon"> + <Plus /> + </el-icon> + </el-upload> + </el-form-item> + <el-form-item class="others" label="其他资质"> + <div + v-for="(v, i) in formData.qualification.other_qualifications" + :key="i" + class="otherimg" + > + <img :src="v" @click="clickdelete(i)" /> + </div> + <el-upload + v-if="imgflag" + :disabled="isDisabled" + class="avatar-uploader pl-3" + :data="{ cid: 1 }" + action="https://worker-task.lihaink.cn/api/upload/image" + :show-file-list="false" + :on-success="handleAvatarSuccess_two" + style="margin-bottom: 12px" + > + <el-icon class="avatar-uploader-icon"> + <Plus /> + </el-icon> + </el-upload> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="120px" label="开户许可证" required> + <el-upload + :disabled="isDisabled" + v-model="formData.qualification.business_licenseB" + class="avatar-uploader pl-3" + :data="{ cid: 1 }" + action="https://worker-task.lihaink.cn/api/upload/image" + :show-file-list="false" + :on-success="handleAvatarSuccessB" + > + <img + v-if="formData.qualification.business_licenseB" + :src="formData.qualification.business_licenseB" + class="avatar" + /> + <el-icon v-else class="avatar-uploader-icon"> + <Plus /> + </el-icon> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-col> + <!-- <div style="font-size: 1.2rem; margin: 10px 0">电子合同</div> --> + <!-- <el-col v-if="isshow" :span="24" class="el-card pt-6"> --> + <el-col v-if="false" :span="24" class="el-card pt-6"> + <div class="tit">电子合同</div> + + <el-row> + <el-col :span="12"> + <el-form-item label="签约方" prop="field130"> + <el-input + v-model="formData.party_a_name" + placeholder="请选择签约方" + clearable + :style="{ width: '100%' }" + :disabled="!partyDisabled || isDisabled" + @click="openCompany" + ></el-input> + <!-- <el-select :disabled="partyDisabled" v-model="formData.party_a_name" placeholder="请选择签约方" @@ -534,60 +508,52 @@ :value="item.id" ></el-option> </el-select> --> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item - label-width="100px" - label="被签约公司" - prop="field131" - > - <el-input - :disabled="true" - v-model="formData.company_name" - placeholder="请输入被签约公司" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item - label-width="100px" - label="合同类型" - prop="contract_type" - > - <el-select - :disabled="isDisabled" - v-model="formData.contract.contract_type" - placeholder="请选择合同类型" - clearable - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in datas.contract_type" - :key="index" - :label="item.name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - </el-col> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="100px" label="被签约公司" prop="field131"> + <el-input + :disabled="true" + v-model="formData.company_name" + placeholder="请输入被签约公司" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="100px" label="合同类型" prop="contract_type"> + <el-select + :disabled="isDisabled" + v-model="formData.contract.contract_type" + placeholder="请选择合同类型" + clearable + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in datas.contract_type" + :key="index" + :label="item.name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> - <el-col :span="12"> - <el-form-item label-width="100px" label="合同编号" prop="field133"> - <el-input - placeholder="系统自动生成" - v-model="formData.contract.contract_no" - clearable - :style="{ width: '100%' }" - :disabled="true" - ></el-input> - </el-form-item> - </el-col> - </el-row> - </el-col> - <!-- <el-col v-if="isshow" :span="24" class="el-card pt-6"> + <el-col :span="12"> + <el-form-item label-width="100px" label="合同编号" prop="field133"> + <el-input + placeholder="系统自动生成" + v-model="formData.contract.contract_no" + clearable + :style="{ width: '100%' }" + :disabled="true" + ></el-input> + </el-form-item> + </el-col> + </el-row> + </el-col> + <!-- <el-col v-if="isshow" :span="24" class="el-card pt-6"> <el-row> <el-col :span="24"> <el-form-item label="合同上传" required> @@ -608,661 +574,631 @@ </el-row> </el-col> --> - <el-col :span="24" class="el-card pt-6"> - <el-form-item label prop="field139"> - <el-button v-if="isEdit" type="primary" size="medium" @click="create" - >完成</el-button - > - <el-button - v-if="isDisabled == false && isEdit == false" - type="primary" - :disabled="isDisabled" - size="medium" - @click="create" - >创建</el-button - > - </el-form-item> - </el-col> - </el-form> - <el-dialog v-model="isCompany" title="选择签约方" width="60%"> - <DialogIndex @customEvent="customEvent" :type="indexType" /> - </el-dialog> - <el-dialog v-model="isMan" title="选择管理人员" width="60%"> - <DialogIndexMan @customEvent="customEventMan" /> - </el-dialog> - <el-dialog v-model="isAreaManager" title="选择片区经理" width="60%"> - <DialogIndexMan @customEvent="EventAreaManager" :type="8" /> - </el-dialog> - </div> + <el-col :span="24" class="el-card pt-6"> + <el-form-item label prop="field139"> + <el-button v-if="isEdit" type="primary" size="medium" @click="create" + >完成</el-button + > + <el-button + v-if="isDisabled == false && isEdit == false" + type="primary" + :disabled="isDisabled" + size="medium" + @click="create" + >创建</el-button + > + </el-form-item> + </el-col> + </el-form> + <el-dialog v-model="isCompany" title="选择签约方" width="60%"> + <DialogIndex @customEvent="customEvent" :type="indexType" /> + </el-dialog> + <el-dialog v-model="isMan" title="选择管理人员" width="60%"> + <DialogIndexMan @customEvent="customEventMan" /> + </el-dialog> + <el-dialog v-model="isAreaManager" title="选择片区经理" width="60%"> + <DialogIndexMan @customEvent="EventAreaManager" :type="8" /> + </el-dialog> + </div> </template> 1 <script lang="ts" setup name="companyEdit"> -import type { - FormInstance, - UploadProps, - ElMessage, - UploadUserFile, -} from "element-plus"; -import Popup from "@/components/popup/index.vue"; +import type { FormInstance, UploadProps, ElMessage, UploadUserFile } from 'element-plus' +import Popup from '@/components/popup/index.vue' import { - apiCompanyAdd, - apiCompanyEdit, - apiCompanyDetail, - apiCompanyLists, - companyResponsibleArea, -} from "@/api/company"; + apiCompanyAdd, + apiCompanyEdit, + apiCompanyDetail, + apiCompanyLists, + companyResponsibleArea +} from '@/api/company' import { - apiCityList, - apiAreaList, - apiStreetList, - apiProvinceList, - apiVillageList, - apiBrigadeList, -} from "@/api/common"; -import { dictDataLists } from "@/api/setting/dict"; -import { timeFormat } from "@/utils/util"; -import DialogIndex from "./dialog_index.vue"; -import DialogIndexMan from "./dialog_index_man.vue"; -import type { PropType } from "vue"; -import useMultipleTabs from "@/hooks/useMultipleTabs"; -import useUserStore from "@/stores/modules/user"; -const userStore = useUserStore(); -const { removeTab } = useMultipleTabs(); -const router = useRouter(); -const route = useRoute(); -let isshow = ref(true); -let imgflag = ref(true); -let isDisabled = ref(false); + apiCityList, + apiAreaList, + apiStreetList, + apiProvinceList, + apiVillageList, + apiBrigadeList +} from '@/api/common' +import { dictDataLists } from '@/api/setting/dict' +import { timeFormat } from '@/utils/util' +import DialogIndex from './dialog_index.vue' +import DialogIndexMan from './dialog_index_man.vue' +import type { PropType } from 'vue' +import useMultipleTabs from '@/hooks/useMultipleTabs' +import useUserStore from '@/stores/modules/user' +const userStore = useUserStore() +const { removeTab } = useMultipleTabs() +const router = useRouter() +const route = useRoute() +let isshow = ref(true) +let imgflag = ref(true) +let isDisabled = ref(false) if (route.query.flag) { - isshow = false; + isshow = false } if (route.query.isshow) { - imgflag = false; - isDisabled = true; + imgflag = false + isDisabled = true } -console.log(isDisabled); +console.log(isDisabled) // 公司类型 -const indexType = ref(0); +const indexType = ref(0) -let isEdit = ref(false); +let isEdit = ref(false) defineProps({ - dictData: { - type: Object as PropType<Record<string, any[]>>, - default: () => ({}), - }, -}); -const emit = defineEmits(["success", "close"]); -const formRef = shallowRef<FormInstance>(); -const popupRef = shallowRef<InstanceType<typeof Popup>>(); -const mode = ref(); + dictData: { + type: Object as PropType<Record<string, any[]>>, + default: () => ({}) + } +}) +const emit = defineEmits(['success', 'close']) +const formRef = shallowRef<FormInstance>() +const popupRef = shallowRef<InstanceType<typeof Popup>>() +const mode = ref() if (route.query.read) { - isDisabled = route.query.read; + isDisabled = route.query.read } if (route.query.edit) { - isEdit = route.query.edit; + isEdit = route.query.edit } // 表单数据 const formData = reactive({ - admin_id: "", - admin_name: "", - area_manager: "", - area_manager_name: "", - id: "", - // level_two: '', - // level_one: '', - company_name: "", - organization_code: "", - province: "", - city: "", - area: "", - street: "", - village: "", - brigade: "", - address: "", - responsible_area: [], - company_type: "", - avatar: "", - sex: "1", - id_card: "", - master_name: "", - master_position: "", - master_phone: "", - master_email: "", - other_contacts: [], - qualification: { - business_license: "", - business_licenseB: "", - other_qualifications: [], - bank_accountB: [], - bank_account: [], - }, - contract: { - contract_type: "", - party_a: 0, - file: "", - contract_no: "系统自动生成", - type: 1, - }, - //签约方 - party_a_name: "", - file_image: "", - // status: '' -}); + admin_id: '', + admin_name: '', + area_manager: '', + area_manager_name: '', + id: '', + // level_two: '', + // level_one: '', + company_name: '', + organization_code: '', + province: '', + city: '', + area: '', + street: '', + village: '', + brigade: '', + address: '', + responsible_area: [], + company_type: '', + avatar: '', + sex: '1', + id_card: '', + master_name: '', + master_position: '', + master_phone: '', + master_email: '', + other_contacts: [], + qualification: { + business_license: '', + business_licenseB: '', + other_qualifications: [], + bank_accountB: [], + bank_account: [] + }, + contract: { + contract_type: '', + party_a: 0, + file: '', + contract_no: '系统自动生成', + type: 1 + }, + //签约方 + party_a_name: '', + file_image: '' + // status: '' +}) if (userStore.userInfo.root == 0) { - formData.contract.party_a = userStore.userInfo.company?.id; - formData.party_a_name = userStore.userInfo.company?.company_name; + formData.contract.party_a = userStore.userInfo.company?.id + formData.party_a_name = userStore.userInfo.company?.company_name } const datas = reactive({ - provinceOptions: [], - cityOptions: [], - areaOptions: [], - streetOptions: [], - villageOptions: [], - brigadeOptions: [], - dictTypeLists: [], - contract_type: [], - company_list: [], -}); -const fileList = ref<UploadUserFile[]>([]); + provinceOptions: [], + cityOptions: [], + areaOptions: [], + streetOptions: [], + villageOptions: [], + brigadeOptions: [], + dictTypeLists: [], + contract_type: [], + company_list: [] +}) +const fileList = ref<UploadUserFile[]>([]) // 表单验证 const formRules = reactive<any>({ - company_name: [ - { - required: true, - message: "请输入公司名称", - trigger: ["blur"], - }, - ], - organization_code: [ - { - required: true, - message: "请输入组织机构代码", - trigger: ["blur"], - }, - ], - master_name: [ - { - required: true, - message: "请输入主联系人姓名", - trigger: ["blur"], - }, - ], - master_position: [ - { - required: true, - message: "请输入主联系人职务", - trigger: ["blur"], - }, - ], - master_phone: [ - { - required: true, - message: "请输入主联系人手机", - trigger: ["blur"], - }, - ], - account: [ - { - required: true, - message: "请输入账号", - trigger: ["blur"], - }, - ], - password: [ - { - required: true, - message: "请输入密码", - trigger: ["blur"], - }, - ], -}); -const isCompany = ref(false); -const isMan = ref(false); -const isAreaManager = ref(false); -const isArea = ref(false); -const isStreet = ref(false); -const isVillage = ref(false); -const isBrigade = ref(false); -const partyDisabled = ref(true); + company_name: [ + { + required: true, + message: '请输入公司名称', + trigger: ['blur'] + } + ], + organization_code: [ + { + required: true, + message: '请输入组织机构代码', + trigger: ['blur'] + } + ], + master_name: [ + { + required: true, + message: '请输入主联系人姓名', + trigger: ['blur'] + } + ], + master_position: [ + { + required: true, + message: '请输入主联系人职务', + trigger: ['blur'] + } + ], + master_phone: [ + { + required: true, + message: '请输入主联系人手机', + trigger: ['blur'] + } + ], + account: [ + { + required: true, + message: '请输入账号', + trigger: ['blur'] + } + ], + password: [ + { + required: true, + message: '请输入密码', + trigger: ['blur'] + } + ] +}) +const isCompany = ref(false) +const isMan = ref(false) +const isAreaManager = ref(false) +const isArea = ref(false) +const isStreet = ref(false) +const isVillage = ref(false) +const isBrigade = ref(false) +const partyDisabled = ref(true) function customEvent(data: any) { - isCompany.value = false; - formData.contract.party_a = data.id; - formData.party_a_name = data.company_name; + isCompany.value = false + formData.contract.party_a = data.id + formData.party_a_name = data.company_name } function customEventMan(data: any) { - isMan.value = false; - formData.admin_name = data.name; - formData.admin_id = data.id; + isMan.value = false + formData.admin_name = data.name + formData.admin_id = data.id } //区域管理人员 function EventAreaManager(data: any) { - isAreaManager.value = false; - formData.area_manager_name = data.name; - formData.area_manager = data.id; + isAreaManager.value = false + formData.area_manager_name = data.name + formData.area_manager = data.id } function openCompany() { - isCompany.value = true; + isCompany.value = true } // 当前选择的负责区域列表 // const formData.responsible_area = ref([]); // 当前应当显示的区域 -const regionType = ref(""); -const wathcFlag = ref(0); //标记第一次页面刷新的数据更新 +const regionType = ref('') +const wathcFlag = ref(0) //标记第一次页面刷新的数据更新 watch( - () => formData[regionType.value], - (newValue, oldValue) => { - if (wathcFlag.value == 0) return wathcFlag.value++; - formData.responsible_area = []; - formData.responsible_area.push(newValue + ""); - } -); + () => formData[regionType.value], + (newValue, oldValue) => { + if (wathcFlag.value == 0) return wathcFlag.value++ + formData.responsible_area = [] + formData.responsible_area.push(newValue + '') + } +) // 多选区域 const handleCheckedCitiesChange = (value: string[]) => { - // console.log("选的值", value); -}; + // console.log("选的值", value); +} // 获取详情 const setFormData = async (data: Record<any, any>) => { - // console.log(formData); + // console.log(formData); - for (const key in formData) { - if (data[key] != null && data[key] != undefined) { - //@ts-ignore - formData[key] = data[key]; + for (const key in formData) { + if (data[key] != null && data[key] != undefined) { + //@ts-ignore + formData[key] = data[key] + } } - } -}; +} const getDetail = async (row: Record<string, any>) => { - const data = await apiCompanyDetail({ - id: row.id, - }); - setFormData(data); -}; + const data = await apiCompanyDetail({ + id: row.id + }) + setFormData(data) +} //上传图片1 -const handleAvatarSuccess: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.qualification.business_license = response.data.uri; -}; -const handleAvatarSuccessB: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.qualification.business_licenseB = response.data.uri; -}; +const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.qualification.business_license = response.data.uri +} +const handleAvatarSuccessB: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.qualification.business_licenseB = response.data.uri +} //上传图片2 -const handleAvatarSuccess_two: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.qualification.other_qualifications.push(response.data.uri); - // console.log(formData.qualification.other_qualifications); -}; -const handleAvatarSuccess_twoB: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.qualification.bank_accountB = response.data.uri; -}; +const handleAvatarSuccess_two: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.qualification.other_qualifications.push(response.data.uri) + // console.log(formData.qualification.other_qualifications); +} +const handleAvatarSuccess_twoB: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.qualification.bank_accountB = response.data.uri +} //上传文件3 -const handleAvatarSuccess_three: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.file_image = response.data.uri; - formData.contract.file = response.data.uri; - fileList.value[0].url = response.data.uri; - fileList.value[0].name = "合同文件"; -}; +const handleAvatarSuccess_three: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.file_image = response.data.uri + formData.contract.file = response.data.uri + fileList.value[0].url = response.data.uri + fileList.value[0].name = '合同文件' +} //增加其他联系人 function other() { - formData.other_contacts.push({ - name: "", - position: "", - phone: "", - email: "", - }); + formData.other_contacts.push({ + name: '', + position: '', + phone: '', + email: '' + }) } //删除其他联系人 function otherdelete() { - formData.other_contacts.pop({ - name: "", - position: "", - phone: "", - email: "", - }); + formData.other_contacts.pop({ + name: '', + position: '', + phone: '', + email: '' + }) } function company_type_change(type: any) { - //区 - const arr = [30, 14, 15]; - if (arr.indexOf(type) > -1) { - isArea.value = true; - isStreet.value = false; - isVillage.value = false; - isBrigade.value = false; - formData.street = ""; - formData.village = ""; - formData.brigade = ""; - regionType.value = "area"; - return true; - } - //镇 - if (type == 16) { - isArea.value = true; - isStreet.value = true; - isVillage.value = false; - isBrigade.value = false; - formData.village = ""; - formData.brigade = ""; - partyDisabled.value = true; - indexType.value = 30; - regionType.value = "street"; - return true; - } - if (type != 16) { - partyDisabled.value = false; - } - //村 - if (type == 17) { - isArea.value = true; - isStreet.value = true; - isVillage.value = true; - isBrigade.value = false; - formData.brigade = ""; - regionType.value = "village"; - return true; - } + //区 + const arr = [30, 14, 15] + if (arr.indexOf(type) > -1) { + isArea.value = true + isStreet.value = false + isVillage.value = false + isBrigade.value = false + formData.street = '' + formData.village = '' + formData.brigade = '' + regionType.value = 'area' + return true + } + //镇 + if (type == 16) { + isArea.value = true + isStreet.value = true + isVillage.value = false + isBrigade.value = false + formData.village = '' + formData.brigade = '' + partyDisabled.value = true + indexType.value = 30 + regionType.value = 'street' + return true + } + if (type != 16) { + partyDisabled.value = false + } + //村 + if (type == 17) { + isArea.value = true + isStreet.value = true + isVillage.value = true + isBrigade.value = false + formData.brigade = '' + regionType.value = 'village' + return true + } - //队 - if (type == 18) { - isArea.value = true; - isStreet.value = true; - isVillage.value = true; - isBrigade.value = true; - regionType.value = "brigade"; - return true; - } + //队 + if (type == 18) { + isArea.value = true + isStreet.value = true + isVillage.value = true + isBrigade.value = true + regionType.value = 'brigade' + return true + } } //获取省份 function province_change(value: string) { - getCityList(); + getCityList() } function city_change(value: string) { - getAreaList(); + getAreaList() } function area_change(value: string) { - getStreetList(); + getStreetList() } function street_change(value: string) { - getVillageList(); + getVillageList() } function village_change(value: string) { - getBrigadeList(); + getBrigadeList() } // function brigade_change(value: string) { // formData.brigade = value // } const getProvinceList = async () => { - let data = await apiProvinceList({}); - datas["provinceOptions"] = data; -}; + const data = await apiProvinceList({}) + datas['provinceOptions'] = data +} const getCityList = async () => { - let data = await apiCityList({ city: formData.province }); - datas["cityOptions"] = data; -}; + const data = await apiCityList({ city: formData.province }) + datas['cityOptions'] = data +} const getAreaList = async () => { - let data = await apiAreaList({ area: formData.city }); - datas["areaOptions"] = data; -}; + const data = await apiAreaList({ area: formData.city }) + datas['areaOptions'] = data +} const getStreetList = async () => { - let data = await apiStreetList({ street: formData.area }); - // let f = await companyResponsibleArea({ - // key: "area", - // value: formData.area, - // }); - // data.forEach((item: any) => { - // if (f.find((t: any) => item.area_code == t)) item.disabled = true; - // else item.disabled = false; - // }); - datas["streetOptions"] = data; -}; + const data = await apiStreetList({ street: formData.area }) + if (formData.company_type == 16) { + ResponsibleArea('area', formData.area) + } + datas['streetOptions'] = data +} const getVillageList = async () => { - let data = await apiVillageList({ village: formData.street }); - // let f = await companyResponsibleArea({ - // key: "street", - // value: formData.street, - // }); - // data.forEach((item: any) => { - // if (f.find((t: any) => item.street_code == t)) item.disabled = true; - // else item.disabled = false; - // }); - datas["villageOptions"] = data; -}; + const data = await apiVillageList({ village: formData.street }) + if (formData.company_type == 17) { + ResponsibleArea('street', formData.street) + } + datas['villageOptions'] = data +} const getBrigadeList = async () => { - let data = await apiBrigadeList(); - // // 获取已选择的小队 - // let f = await companyResponsibleArea({ - // key: "village", - // value: formData.village, - // }); - // data.forEach((item: any) => { - // if (f.find((t: any) => item.id == t + "")) item.disabled = true; - // else item.disabled = false; - // }); - datas["brigadeOptions"] = data; -}; -getProvinceList(); + const data = await apiBrigadeList() + if (formData.company_type == 18) { + ResponsibleArea('village', formData.village) + } + // // 获取已选择的小队 + + datas['brigadeOptions'] = data +} +getProvinceList() + +const ResponsibleArea = async (key: any, value: any) => { + const f = await companyResponsibleArea({ + key: key, + value: value + }) + f.forEach((item: any) => { + if (f.find((t: any) => item.id == t + '')) item.disabled = true + else item.disabled = false + }) +} const getcontract_type = async () => { - const data = await dictDataLists({ type_id: 7 }); - datas["contract_type"] = data["lists"]; -}; + const data = await dictDataLists({ type_id: 7 }) + datas['contract_type'] = data['lists'] +} const getdictTypeLists = async () => { - const data = await dictDataLists({ type_id: 6 }); - datas["dictTypeLists"] = data["lists"]; -}; + const data = await dictDataLists({ type_id: 6 }) + datas['dictTypeLists'] = data['lists'] +} const getDetails = async () => { - const data = await apiCompanyDetail({ - id: route.query.id, - }); - if (data.company_type == 16) { - indexType.value = 30; - partyDisabled.value = true; - } - Object.keys(formData).forEach((key) => { - const stringArr = [ - "province", - "city", - "area", - "street", - "village", - "brigade", - ]; - if (data[key] != null && data[key] != undefined) { - formData[key] = data[key]; - // if ( - // key == "qualification" && - // formData.qualification.other_qualifications - // ) { - // try { - // if ( - // Array.isArray( - // JSON.parse(formData.qualification.other_qualifications) - // ) - // ) { - // formData.qualification.other_qualifications = JSON.parse( - // formData.qualification.other_qualifications - // ); - // } else { - // const str = formData.qualification.other_qualifications; - // formData.qualification.other_qualifications = []; - // formData.qualification.other_qualifications.push(str); - // } - // } catch (error) { - // const str = formData.qualification.other_qualifications; - // formData.qualification.other_qualifications = []; - // formData.qualification.other_qualifications.push(str); - // } - // } + const data = await apiCompanyDetail({ + id: route.query.id + }) + if (data.company_type == 16) { + indexType.value = 30 + partyDisabled.value = true } - if (stringArr.includes(key)) formData[key] = formData[key].toString(); - }); - await getCityList(); - await getAreaList(); - await getStreetList(); - await getVillageList(); - await getBrigadeList(); - formData["party_a_name"] = data.contract?.party_a_info.company_name; - // formData['file_image'] = data.contract?.file - // if (data.contract?.file) { - // fileList.value[0].url = data.contract?.file - // fileList.value[0].name = '合同文件' - // } - company_type_change(formData.company_type); -}; + Object.keys(formData).forEach((key) => { + const stringArr = ['province', 'city', 'area', 'street', 'village', 'brigade'] + if (data[key] != null && data[key] != undefined) { + formData[key] = data[key] + // if ( + // key == "qualification" && + // formData.qualification.other_qualifications + // ) { + // try { + // if ( + // Array.isArray( + // JSON.parse(formData.qualification.other_qualifications) + // ) + // ) { + // formData.qualification.other_qualifications = JSON.parse( + // formData.qualification.other_qualifications + // ); + // } else { + // const str = formData.qualification.other_qualifications; + // formData.qualification.other_qualifications = []; + // formData.qualification.other_qualifications.push(str); + // } + // } catch (error) { + // const str = formData.qualification.other_qualifications; + // formData.qualification.other_qualifications = []; + // formData.qualification.other_qualifications.push(str); + // } + // } + } + if (stringArr.includes(key)) formData[key] = formData[key].toString() + }) + await getCityList() + await getAreaList() + await getStreetList() + await getVillageList() + await getBrigadeList() + formData['party_a_name'] = data.contract?.party_a_info.company_name + // formData['file_image'] = data.contract?.file + // if (data.contract?.file) { + // fileList.value[0].url = data.contract?.file + // fileList.value[0].name = '合同文件' + // } + company_type_change(formData.company_type) +} const clickdelete = (index) => { - if (!route.query.read) { - formData.qualification.other_qualifications.splice(index, 1); - } -}; + if (!route.query.read) { + formData.qualification.other_qualifications.splice(index, 1) + } +} -getdictTypeLists(); -getcontract_type(); +getdictTypeLists() +getcontract_type() -const handleAvatarSuccessAvatar: UploadProps["onSuccess"] = ( - response, - uploadFile -) => { - if (response.code == 0) { - ElMessage.error(response.msg); - return; - } - formData.avatar = response.data.uri; -}; +const handleAvatarSuccessAvatar: UploadProps['onSuccess'] = (response, uploadFile) => { + if (response.code == 0) { + ElMessage.error(response.msg) + return + } + formData.avatar = response.data.uri +} const create = async () => { - await formRef.value?.validate(); - const data = JSON.parse(JSON.stringify({ ...formData })); - data.qualification.other_qualifications = JSON.stringify( - data.qualification.other_qualifications - ); - if (route.query.id) { - await apiCompanyEdit(data); - } else { - await apiCompanyAdd(data); - } - removeTab(); - router.back(); -}; -route.query.id && getDetails(); + await formRef.value?.validate() + const data = JSON.parse(JSON.stringify({ ...formData })) + data.qualification.other_qualifications = JSON.stringify( + data.qualification.other_qualifications + ) + if (route.query.id) { + await apiCompanyEdit(data) + } else { + await apiCompanyAdd(data) + } + removeTab() + router.back() +} +route.query.id && getDetails() defineExpose({ - open, - setFormData, - getDetail, -}); + open, + setFormData, + getDetail +}) </script> <style lang="scss"> .tit { - font-size: 1.2rem; - translate: 1vw -1vw; + font-size: 1.2rem; + translate: 1vw -1vw; } .avatar-uploader .el-upload { - width: 10vw; - height: 6.3vw; - background-color: #fff; - border: 1px dashed var(--el-border-color); - border-radius: 6px; - cursor: pointer; - position: relative; - overflow: hidden; - transition: var(--el-transition-duration-fast); + width: 10vw; + height: 6.3vw; + background-color: #fff; + border: 1px dashed var(--el-border-color); + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; + transition: var(--el-transition-duration-fast); } .headimg { - margin-left: 18px; - margin-bottom: 18px; - width: 120px; - height: 140px; - overflow: hidden; - border: 1px dashed var(--el-border-color); - border-radius: 6px; - flex-shrink: 0; + margin-left: 18px; + margin-bottom: 18px; + width: 120px; + height: 140px; + overflow: hidden; + border: 1px dashed var(--el-border-color); + border-radius: 6px; + flex-shrink: 0; } .avatar-uploader-head .el-upload { - width: 120px; - height: 140px; - background-color: #fff; - cursor: pointer; - position: relative; - overflow: hidden; - transition: var(--el-transition-duration-fast); + width: 120px; + height: 140px; + background-color: #fff; + cursor: pointer; + position: relative; + overflow: hidden; + transition: var(--el-transition-duration-fast); } .avatar-uploader .el-upload:hover { - border-color: var(--el-color-primary); + border-color: var(--el-color-primary); } .el-icon.avatar-uploader-icon { - font-size: 28px; - color: #8c939d; - width: 178px; - height: 178px; - text-align: center; + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + text-align: center; } .el-icon.avatar-uploader-icon { - font-size: 28px; - color: #8c939d; - width: 178px; - height: 178px; - text-align: center; + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + text-align: center; } .otherimg { - img { - width: 10vw; - height: 6.3vw; - border-radius: 5px; - margin-left: 12px; - margin-bottom: 12px; - } + img { + width: 10vw; + height: 6.3vw; + border-radius: 5px; + margin-left: 12px; + margin-bottom: 12px; + } } + .el-card { - margin-bottom: 10px; + margin-bottom: 10px; } + .tit { - margin-top: 15px; + margin-top: 15px; } + .others { - width: 100% !important; + width: 100% !important; } </style> diff --git a/src/views/company/index.vue b/src/views/company/index.vue index 20d6f50..baa69f5 100644 --- a/src/views/company/index.vue +++ b/src/views/company/index.vue @@ -1,93 +1,89 @@ <template> - <div> - <el-card class="!border-none mb-4" shadow="never"> - <el-form class="mb-[-16px] formdata" :model="queryParams" inline> - <el-form-item label="公司名称" prop="company_name"> - <el-input - class="w-[280px]" - v-model="queryParams.company_name" - clearable - placeholder="请输入公司名称" - /> - </el-form-item> - <el-form-item label="区" prop="area" v-show="company_type_show"> - <el-input - class="w-[280px]" - v-model="queryParams.area" - clearable - placeholder="请输入区" - /> - </el-form-item> - <el-form-item label="镇" prop="street" v-show="company_type_show"> - <el-input - class="w-[280px]" - v-model="queryParams.street" - clearable - placeholder="请输入镇" - /> - </el-form-item> - <el-form-item - label="公司类型" - prop="company_type" - v-show="company_type_show" - > - <el-select - v-model="queryParams.company_type" - placeholder="请选择公司类型" - clearable - class="w-[280px]" - > - <el-option - v-for="(item, index) in datas.dictTypeLists" - :key="index" - :label="item.name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - <el-form-item label="片区经理" prop="area_manager"> - <el-input - class="w-[280px]" - v-model="queryParams.area_manager" - clearable - placeholder="请输入片区经理" - /> - </el-form-item> - <el-form-item label="是否签约" prop="is_contract"> - <el-select - v-model="queryParams.is_contract" - placeholder="是否签约" - clearable - class="w-[240px]" - > - <el-option label="已签约" value="1"></el-option> - <el-option label="未签约" value="0"></el-option> - </el-select> - </el-form-item> - <el-form-item> - <el-button type="primary" @click="resetPage">查询</el-button> - <el-button @click="resetParams">重置</el-button> - </el-form-item> - </el-form> - </el-card> - <el-card class="!border-none" v-loading="pager.loading" shadow="never"> - <router-link - v-perms="['company/add:edit']" - :to="{ - path: getRoutePath('company/add:edit'), - query: { - flag: true, - }, - }" - > - <el-button type="primary" class="mb-4"> - <template #icon> - <icon name="el-icon-Plus" /> - </template> - 创建 - </el-button> - </router-link> - <!-- <router-link + <div> + <el-card class="!border-none mb-4" shadow="never"> + <el-form class="mb-[-16px] formdata" :model="queryParams" inline> + <el-form-item label="公司名称" prop="company_name"> + <el-input + class="w-[280px]" + v-model="queryParams.company_name" + clearable + placeholder="请输入公司名称" + /> + </el-form-item> + <el-form-item label="区" prop="area" v-show="company_type_show"> + <el-input + class="w-[280px]" + v-model="queryParams.area" + clearable + placeholder="请输入区" + /> + </el-form-item> + <el-form-item label="镇" prop="street" v-show="company_type_show"> + <el-input + class="w-[280px]" + v-model="queryParams.street" + clearable + placeholder="请输入镇" + /> + </el-form-item> + <el-form-item label="公司类型" prop="company_type" v-show="company_type_show"> + <el-select + v-model="queryParams.company_type" + placeholder="请选择公司类型" + clearable + class="w-[280px]" + > + <el-option + v-for="(item, index) in datas.dictTypeLists" + :key="index" + :label="item.name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + <el-form-item label="片区经理" prop="area_manager"> + <el-input + class="w-[280px]" + v-model="queryParams.area_manager" + clearable + placeholder="请输入片区经理" + /> + </el-form-item> + <el-form-item label="是否签约" prop="is_contract"> + <el-select + v-model="queryParams.is_contract" + placeholder="是否签约" + clearable + class="w-[240px]" + > + <el-option label="已签约" value="1"></el-option> + <el-option label="未签约" value="0"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-form> + </el-card> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <router-link + v-perms="['company/add:edit']" + :to="{ + path: getRoutePath('company/add:edit'), + query: { + flag: true + } + }" + > + <el-button type="primary" class="mb-4"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 创建 + </el-button> + </router-link> + <!-- <router-link :to="{ path: getRoutePath('company/add:edit'), query: { @@ -100,494 +96,436 @@ 我的公司 </el-button></router-link --> - <div class="mt-4"> - <el-table :data="pager.lists" @selection-change="handleSelectionChange"> - <el-table-column - label="id" - prop="id" - show-overflow-tooltip - width="60" - /> - <el-table-column - label="公司名称" - prop="company_name" - show-overflow-tooltip - /> - <el-table-column - label="公司类型" - prop="company_type" - show-overflow-tooltip - /> - <el-table-column label="区县" prop="area" show-overflow-tooltip /> - <el-table-column label="乡镇" prop="street" show-overflow-tooltip /> - <el-table-column - label="主联系人" - prop="master_name" - show-overflow-tooltip - /> - <el-table-column - label="联系方式" - prop="master_phone" - show-overflow-tooltip - /> - <el-table-column - label="片区经理" - prop="area_manager" - show-overflow-tooltip - /> - <el-table-column - label="是否签约" - prop="is_contract" - show-overflow-tooltip - > - <template #default="{ row }"> - <span v-if="row.is_contract == 1" style="color: #67c23a" - >已签约</span - > - <span v-else style="color: #fe0000">未签约</span> - </template></el-table-column - > - <el-table-column - label="操作" - align="center" - width="510" - fixed="right" - > - <template #default="{ row }"> - <div style="display: flex"> - <el-button type="primary" link> - <router-link - :to="{ - path: getRoutePath('auth.admin/lists'), - query: { - company_id: row.id, - read: true, - }, - }" - >查看成员</router-link - > - </el-button> - <el-button type="primary" link> - <router-link - :to="{ - path: getRoutePath('company/subordinate/lists'), - query: { - company_id: row.id, - read: true, - }, - }" - >下属公司</router-link - > - </el-button> - <el-button v-perms="['company/add:edit']" type="primary" link> - <router-link - :to="{ - path: getRoutePath('company/add:edit'), - query: { - id: row.id, - read: true, - isshow: true, - }, - }" - >详情</router-link - > - </el-button> - <el-button v-perms="['company/add:edit']" type="primary" link> - <router-link - :to="{ - path: getRoutePath('company/add:edit'), - query: { - id: row.id, - edit: true, - }, - }" - >编辑</router-link - > - </el-button> - <el-button - v-perms="['company/delete']" - type="danger" - link - @click="handleDelete(row.id)" - >删除</el-button - > - <el-button - v-if="row.is_authentication == 0" - v-perms="['company/authentication']" - type="primary" - link - @click="handleAuthentication(row.id)" - >企业认证</el-button - > - <template v-if="row.is_authentication && row.is_contract == 0"> - <el-button - v-if=" - Array.isArray(row.contract) && row.contract.length == 0 - " - v-perms="['company/initiate_contract']" - type="primary" - link - @click="showChangeCompany(row)" - >生成合同</el-button - > - <el-button - v-else-if="row.contract?.check_status == 1" - v-perms="['company/initiate_contract']" - type="warning" - link - @click="auditing" - >审核中</el-button - > - <el-button - v-else-if="row.contract?.check_status == 2" - v-perms="['company/Draftingcontracts']" - type="primary" - link - @click="showCreateConctPop(row)" - >发送合同</el-button - > - <el-button - v-else-if="row.contract?.check_status == 3" - v-perms="['company/postsms']" - type="primary" - link - @click="(showPop = true), (contractId = row.id)" - >发送短信</el-button - > - </template> - </div> - </template> - </el-table-column> - </el-table> - </div> - <div class="flex mt-4 justify-end"> - <pagination v-model="pager" @change="getLists" /> - </div> - </el-card> - <el-dialog - v-model="showInitiateContractPop" - @close="offInitiateContractPop" - > - <h1>重要提醒</h1> - <div> - <div class="content">请确认信息是否有误</div> - <el-card> - <el-col :span="24" class="el-card pt-6"> - <el-row> - <el-col :span="12"> - <el-form-item - label-width="100px" - label="签约方" - prop="field130" - > - <el-select - v-model="contractFormData.party_a" - placeholder="请选择签约方" - clearable - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in company_list" - :key="index" - :label="item.company_name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item - label-width="100px" - label="被签约公司" - prop="field131" - > - <el-input - :disabled="true" - v-model="contractFormData.party_b_name" - placeholder="请输入被签约公司" - clearable - :style="{ width: '100%' }" - ></el-input> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item - label-width="100px" - label="合同类型" - prop="contract_type" - > - <el-select - v-model="contractFormData.contract_type" - placeholder="请选择合同类型" - clearable - :style="{ width: '100%' }" - > - <el-option - v-for="(item, index) in contract_type" - :key="index" - :label="item.name" - :value="item.id" - ></el-option> - </el-select> - </el-form-item> - </el-col> - - <el-col :span="12"> - <el-form-item - label-width="100px" - label="合同编号" - prop="field133" - > - <el-input - placeholder="系统自动生成" - v-model="contractFormData.contract_no" - clearable - :style="{ width: '100%' }" - :disabled="true" - ></el-input> - </el-form-item> - </el-col> - </el-row> - </el-col> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column label="id" prop="id" show-overflow-tooltip width="60" /> + <el-table-column label="公司名称" prop="company_name" show-overflow-tooltip /> + <el-table-column label="公司类型" prop="company_type" show-overflow-tooltip /> + <el-table-column label="区县" prop="area" show-overflow-tooltip /> + <el-table-column label="乡镇" prop="street" show-overflow-tooltip /> + <el-table-column label="主联系人" prop="master_name" show-overflow-tooltip /> + <el-table-column label="联系方式" prop="master_phone" show-overflow-tooltip /> + <el-table-column label="片区经理" prop="area_manager" show-overflow-tooltip /> + <el-table-column label="是否签约" prop="is_contract" show-overflow-tooltip> + <template #default="{ row }"> + <span v-if="row.is_contract == 1" style="color: #67c23a">已签约</span> + <span v-else style="color: #fe0000">未签约</span> + </template></el-table-column + > + <el-table-column label="操作" align="center" width="510" fixed="right"> + <template #default="{ row }"> + <div style="display: flex"> + <el-button type="primary" link> + <router-link + :to="{ + path: getRoutePath('user.user/lists'), + query: { + company_id: row.id, + read: true + } + }" + >查看成员</router-link + > + </el-button> + <el-button type="primary" link> + <router-link + :to="{ + path: getRoutePath('company/subordinate/lists'), + query: { + company_id: row.id, + read: true + } + }" + >下属公司</router-link + > + </el-button> + <el-button v-perms="['company/add:edit']" type="primary" link> + <router-link + :to="{ + path: getRoutePath('company/add:edit'), + query: { + id: row.id, + read: true, + isshow: true + } + }" + >详情</router-link + > + </el-button> + <el-button v-perms="['company/add:edit']" type="primary" link> + <router-link + :to="{ + path: getRoutePath('company/add:edit'), + query: { + id: row.id, + edit: true + } + }" + >编辑</router-link + > + </el-button> + <el-button + v-perms="['company/delete']" + type="danger" + link + @click="handleDelete(row.id)" + >删除</el-button + > + <el-button + v-if="row.is_authentication == 0" + v-perms="['company/authentication']" + type="primary" + link + @click="handleAuthentication(row.id)" + >企业认证</el-button + > + <template v-if="row.is_authentication && row.is_contract == 0"> + <el-button + v-if=" + Array.isArray(row.contract) && row.contract.length == 0 + " + v-perms="['company/initiate_contract']" + type="primary" + link + @click="showChangeCompany(row)" + >生成合同</el-button + > + <el-button + v-else-if="row.contract?.check_status == 1" + v-perms="['company/initiate_contract']" + type="warning" + link + @click="auditing" + >审核中</el-button + > + <el-button + v-else-if="row.contract?.check_status == 2" + v-perms="['company/Draftingcontracts']" + type="primary" + link + @click="showCreateConctPop(row)" + >发送合同</el-button + > + <el-button + v-else-if="row.contract?.check_status == 3" + v-perms="['company/postsms']" + type="primary" + link + @click=";(showPop = true), (contractId = row.id)" + >发送短信</el-button + > + </template> + </div> + </template> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> </el-card> - </div> - <p class="btn_menu"> - <el-button type="primary" size="large" @click="InitiateContract" - >确认创建</el-button - > - <el-button type="info" size="large" @click="offInitiateContractPop" - >返回</el-button - > - </p> - </el-dialog> - <el-dialog v-model="showPop" @close="offPop"> - <h1>重要提醒</h1> - <div class="content" v-if="showConctactPop"> - 请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送. - </div> - <div class="content" v-else> - 确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约 - </div> - <p class="btn_menu"> - <el-button - type="primary" - size="large" - v-if="showConctactPop" - @click="creContct" - >确认创建</el-button - > - <el-button type="primary" size="large" v-else @click="sendMsg" - >确认</el-button - > - <el-button type="info" size="large" @click="offPop">返回</el-button> - </p> - </el-dialog> - </div> + <el-dialog v-model="showInitiateContractPop" @close="offInitiateContractPop"> + <h1>重要提醒</h1> + <div> + <div class="content">请确认信息是否有误</div> + <el-card> + <el-col :span="24" class="el-card pt-6"> + <el-row> + <el-col :span="12"> + <el-form-item label-width="100px" label="签约方" prop="field130"> + <el-select + v-model="contractFormData.party_a" + placeholder="请选择签约方" + clearable + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in company_list" + :key="index" + :label="item.company_name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label-width="100px" + label="被签约公司" + prop="field131" + > + <el-input + :disabled="true" + v-model="contractFormData.party_b_name" + placeholder="请输入被签约公司" + clearable + :style="{ width: '100%' }" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label-width="100px" + label="合同类型" + prop="contract_type" + > + <el-select + v-model="contractFormData.contract_type" + placeholder="请选择合同类型" + clearable + :style="{ width: '100%' }" + > + <el-option + v-for="(item, index) in contract_type" + :key="index" + :label="item.name" + :value="item.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> + + <el-col :span="12"> + <el-form-item label-width="100px" label="合同编号" prop="field133"> + <el-input + placeholder="系统自动生成" + v-model="contractFormData.contract_no" + clearable + :style="{ width: '100%' }" + :disabled="true" + ></el-input> + </el-form-item> + </el-col> + </el-row> + </el-col> + </el-card> + </div> + <p class="btn_menu"> + <el-button type="primary" size="large" @click="InitiateContract" + >确认创建</el-button + > + <el-button type="info" size="large" @click="offInitiateContractPop">返回</el-button> + </p> + </el-dialog> + <el-dialog v-model="showPop" @close="offPop"> + <h1>重要提醒</h1> + <div class="content" v-if="showConctactPop"> + 请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送. + </div> + <div class="content" v-else> + 确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约 + </div> + <p class="btn_menu"> + <el-button type="primary" size="large" v-if="showConctactPop" @click="creContct" + >确认创建</el-button + > + <el-button type="primary" size="large" v-else @click="sendMsg">确认</el-button> + <el-button type="info" size="large" @click="offPop">返回</el-button> + </p> + </el-dialog> + </div> </template> <script lang="ts" setup name="companyLists"> -import { usePaging } from "@/hooks/usePaging"; -import { useDictData } from "@/hooks/useDictOptions"; -import useUserStore from "@/stores/modules/user"; +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import useUserStore from '@/stores/modules/user' import { - apiCompanyLists, - companyListTwo, - apiCompanyDelete, - generateGontract, - sendMsgApi, - authentication, - apiCompanyDetail, - initiate_contract, -} from "@/api/company"; -import { timeFormat } from "@/utils/util"; -import feedback from "@/utils/feedback"; -import { dictDataLists } from "@/api/setting/dict"; -import { getRoutePath } from "@/router"; -import DialogIndex from "./dialog_index.vue"; + apiCompanyLists, + companyListTwo, + apiCompanyDelete, + generateGontract, + sendMsgApi, + authentication, + apiCompanyDetail, + initiate_contract +} from '@/api/company' +import { timeFormat } from '@/utils/util' +import feedback from '@/utils/feedback' +import { dictDataLists } from '@/api/setting/dict' +import { getRoutePath } from '@/router' +import DialogIndex from './dialog_index.vue' -const userStore = useUserStore(); -console.log(userStore.userInfo.company_id); -const route = useRoute(); -const company_type_show = ref(true); +const userStore = useUserStore() +console.log(userStore.userInfo.company_id) +const route = useRoute() +const company_type_show = ref(true) // 创建合同与发送短信 //弹窗 -const showPop = ref(false); -const showConctactPop = ref(false); +const showPop = ref(false) +const showConctactPop = ref(false) const offPop = () => { - showPop.value = false; - showConctactPop.value = false; -}; -const InitiateContractPop = ref(false); -const showInitiateContractPop = ref(false); + showPop.value = false + showConctactPop.value = false +} +const InitiateContractPop = ref(false) +const showInitiateContractPop = ref(false) const offInitiateContractPop = () => { - showInitiateContractPop.value = false; - InitiateContractPop.value = false; -}; + showInitiateContractPop.value = false + InitiateContractPop.value = false +} // 创建合同的id -const contractId = ref(""); +const contractId = ref('') // 合同 const contractFormData = ref({ - party_a: "", - party_a_name: "", - party_b: "", - party_b_name: "", - contract_type: "", - contract_no: "", -}); + party_a: '', + party_a_name: '', + party_b: '', + party_b_name: '', + contract_type: '', + contract_no: '' +}) -const company_list = ref([]); -const contract_type = ref([]); +const company_list = ref([]) +const contract_type = ref([]) const getDetails = async (id: any) => { - const data = await apiCompanyDetail({ - id: id, - }); - companyListTwo().then((res) => { - company_list.value = res; - }); - dictDataLists({ type_id: 7 }).then((res) => { - contract_type.value = res.lists; - }); - contractFormData.value.party_b = data.id; - contractFormData.value.party_b_name = data.company_name; - if (userStore.userInfo.company.id) { - contractFormData.value.party_a = userStore.userInfo.company.id; - contractFormData.value.party_a_name = - userStore.userInfo.company.company_name; - } else { - contractFormData.value.party_a = ""; - contractFormData.value.party_a_name = ""; - } -}; + const data = await apiCompanyDetail({ + id: id + }) + companyListTwo().then((res) => { + company_list.value = res + }) + dictDataLists({ type_id: 7 }).then((res) => { + contract_type.value = res.lists + }) + contractFormData.value.party_b = data.id + contractFormData.value.party_b_name = data.company_name + if (userStore.userInfo.company.id) { + contractFormData.value.party_a = userStore.userInfo.company.id + contractFormData.value.party_a_name = userStore.userInfo.company.company_name + } else { + contractFormData.value.party_a = '' + contractFormData.value.party_a_name = '' + } +} const showChangeCompany = (row: any) => { - contractId.value = row.id; - getDetails(row.id); - // showPop.value = true - ShowInitiateContractPop(); -}; + contractId.value = row.id + getDetails(row.id) + // showPop.value = true + ShowInitiateContractPop() +} const ShowInitiateContractPop = () => { - (InitiateContractPop.value = true), (showInitiateContractPop.value = true); -}; + ;(InitiateContractPop.value = true), (showInitiateContractPop.value = true) +} const showCreateConctPop = (row) => { - (showPop.value = true), - (showConctactPop.value = true), - (contractId.value = row.id); -}; + ;(showPop.value = true), (showConctactPop.value = true), (contractId.value = row.id) +} const InitiateContract = () => { - initiate_contract({ - id: contractId.value, - ...contractFormData.value, - }).catch((res) => { - console.log(res); - }); - offInitiateContractPop(); -}; + initiate_contract({ + id: contractId.value, + ...contractFormData.value + }).catch((res) => { + console.log(res) + }) + offInitiateContractPop() +} const creContct = () => { - generateGontract({ id: contractId.value }).catch((res) => { - console.log(res); - }); - offPop(); -}; + generateGontract({ id: contractId.value }).catch((res) => { + console.log(res) + }) + offPop() +} const sendMsg = () => { - sendMsgApi({ id: contractId.value }); - offPop(); -}; + sendMsgApi({ id: contractId.value }) + offPop() +} // 创建合同与发送短信结束 // 查询条件 const queryParams = reactive({ - company_name: "", - area: "", - street: "", - company_type: "", - area_manager: "", - // 是否签约 - is_contract: "", -}); + company_name: '', + area: '', + street: '', + company_type: '', + area_manager: '', + // 是否签约 + is_contract: '' +}) if (route.query.company_type) { - company_type_show.value = false; - queryParams["company_type"] = route.query.company_type?.toString() || ""; + company_type_show.value = false + queryParams['company_type'] = route.query.company_type?.toString() || '' } const datas = reactive({ - dictTypeLists: [], -}); + dictTypeLists: [] +}) const getdictTypeLists = async () => { - const data = await dictDataLists({ type_id: 6 }); - datas["dictTypeLists"] = data["lists"]; -}; -getdictTypeLists(); + const data = await dictDataLists({ type_id: 6 }) + datas['dictTypeLists'] = data['lists'] +} +getdictTypeLists() // 选中数据 -const selectData = ref<any[]>([]); +const selectData = ref<any[]>([]) // 表格选择后回调事件 const handleSelectionChange = (val: any[]) => { - selectData.value = val.map(({ id }) => id); -}; + selectData.value = val.map(({ id }) => id) +} // 获取字典数据 -const { dictData } = useDictData(""); +const { dictData } = useDictData('') // 分页相关 const { pager, getLists, resetParams, resetPage } = usePaging({ - fetchFun: apiCompanyLists, - params: queryParams, -}); + fetchFun: apiCompanyLists, + params: queryParams +}) // 删除 const handleDelete = async (id: number | any[]) => { - await feedback.confirm("确定要删除?"); - await apiCompanyDelete({ id }); - getLists(); -}; + await feedback.confirm('确定要删除?') + await apiCompanyDelete({ id }) + getLists() +} const handleAuthentication = async (id: number | any[]) => { - await feedback.confirm("确定要认证?"); - await authentication({ id }); - getLists(); -}; + await feedback.confirm('确定要认证?') + await authentication({ id }) + getLists() +} // 审核中 const auditing = () => { - ElMessage.warning("请等待合同审核完成!"); -}; + ElMessage.warning('请等待合同审核完成!') +} -getLists(); +getLists() </script> <style lang="scss"> .btn { - position: absolute; + position: absolute; } h1 { - text-align: center; - font-weight: bold; - font-size: 30px; - color: red; - margin-bottom: 10px; + text-align: center; + font-weight: bold; + font-size: 30px; + color: red; + margin-bottom: 10px; } .content { - font-size: 20px; + font-size: 20px; } .info { - color: red; - font-weight: bold; - font-size: 18px; - display: inline-block; - margin: 0 5px; + color: red; + font-weight: bold; + font-size: 18px; + display: inline-block; + margin: 0 5px; } .btn_menu { - margin-top: 10vh; - display: flex; - justify-content: space-around; + margin-top: 10vh; + display: flex; + justify-content: space-around; } .formdata { - .el-form-item { - width: 20%; - } + .el-form-item { + width: 20%; + } } </style> diff --git a/src/views/consumer/lists/index.vue b/src/views/consumer/lists/index.vue index 42a5540..729d9a8 100644 --- a/src/views/consumer/lists/index.vue +++ b/src/views/consumer/lists/index.vue @@ -165,13 +165,18 @@ import { getRoutePath } from '@/router' import { getUserList, creatContact, sendMsgApi } from '@/api/consumer' import { ClientMap } from '@/enums/appEnums' import feedback from '@/utils/feedback' +const route = useRoute() const queryParams = reactive({ keyword: '', channel: '', create_time_start: '', - create_time_end: '' + create_time_end: '', + company_id: '' }) +if (route.query.company_id) { + queryParams.company_id = route.query.company_id +} const contractId = ref(0) const showPop = ref(false) const showConctactPop = ref(false) diff --git a/yarn.lock b/yarn.lock index 0e32fee..51a5b42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4,7 +4,7 @@ "@amap/amap-jsapi-loader@^1.0.1": version "1.0.1" - resolved "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz" + resolved "https://registry.npmjs.org/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz" integrity sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw== "@ampproject/remapping@^2.1.0":