Commit 0fd5d326 by 张立顺

fix bug修复

1 parent 0df3b769
...@@ -134,13 +134,12 @@ ...@@ -134,13 +134,12 @@
<el-form-item label="上牌城市" prop="registrationCityId"> <el-form-item label="上牌城市" prop="registrationCityId">
<el-cascader :key="`vcd-reg-${registrationCascaderKey}`" v-model="registrationRegionCodes" <el-cascader :key="`vcd-reg-${registrationCascaderKey}`" v-model="registrationRegionCodes"
clearable placeholder="请选择省 / 市" popper-class="vcd-base-form-popper" clearable placeholder="请选择省 / 市" popper-class="vcd-base-form-popper"
:props="registrationCascaderProps" style="width: 100%;" :props="registrationCascaderProps" style="width: 100%;" @change="onRegistrationRegionChange" />
@change="onRegistrationRegionChange" />
</el-form-item> </el-form-item>
<el-form-item label="车辆所在地" prop="carCityId"> <el-form-item label="车辆所在地" prop="carCityId">
<el-cascader :key="`vcd-car-${carLocationCascaderKey}`" v-model="carLocationRegionCodes" <el-cascader :key="`vcd-car-${carLocationCascaderKey}`" v-model="carLocationRegionCodes" clearable
clearable placeholder="请选择省 / 市" popper-class="vcd-base-form-popper" placeholder="请选择省 / 市" popper-class="vcd-base-form-popper" :props="carLocationCascaderProps"
:props="carLocationCascaderProps" style="width: 100%;" @change="onCarLocationRegionChange" /> style="width: 100%;" @change="onCarLocationRegionChange" />
</el-form-item> </el-form-item>
</div> </div>
<div class="vcd-base-form-layout__pair"> <div class="vcd-base-form-layout__pair">
...@@ -213,14 +212,14 @@ ...@@ -213,14 +212,14 @@
<el-select v-model="baseForm.sellerUserId" clearable filterable :loading="sellerStaffLoading" <el-select v-model="baseForm.sellerUserId" clearable filterable :loading="sellerStaffLoading"
placeholder="请选择销售顾问" popper-class="vcd-base-form-popper" style="width: 100%;" placeholder="请选择销售顾问" popper-class="vcd-base-form-popper" style="width: 100%;"
@change="onSellerStaffChange" @visible-change="onSellerStaffSelectVisible"> @change="onSellerStaffChange" @visible-change="onSellerStaffSelectVisible">
<el-option v-for="opt in sellerStaffOptions" :key="String(opt.id)" <el-option v-for="opt in sellerStaffOptions" :key="String(opt.uuid)"
:label="sellerStaffOptionLabel(opt)" :value="String(opt.id)" /> :label="sellerStaffOptionLabel(opt)" :value="String(opt.uuid)" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="驻店人员" prop="stationedStaff"> <el-form-item label="驻店人员" prop="stationedStaff">
<el-select v-model="baseForm.stationedStaff" clearable filterable <el-select v-model="baseForm.stationedStaff" clearable filterable :loading="stationedStaffLoading"
:loading="stationedStaffLoading" placeholder="请选择驻店人员" popper-class="vcd-base-form-popper" placeholder="请选择驻店人员" popper-class="vcd-base-form-popper" style="width: 100%;"
style="width: 100%;" @visible-change="onStationedStaffSelectVisible"> @visible-change="onStationedStaffSelectVisible">
<el-option v-for="opt in stationedStaffOptions" :key="String(opt.staffUuid)" <el-option v-for="opt in stationedStaffOptions" :key="String(opt.staffUuid)"
:label="stationedStaffOptionLabel(opt)" :value="String(opt.staffUuid)" /> :label="stationedStaffOptionLabel(opt)" :value="String(opt.staffUuid)" />
</el-select> </el-select>
...@@ -238,8 +237,8 @@ ...@@ -238,8 +237,8 @@
</div> </div>
<div class="vcd-base-form-layout__full"> <div class="vcd-base-form-layout__full">
<el-form-item label="原车主住址" prop="previousOwnerAddress"> <el-form-item label="原车主住址" prop="previousOwnerAddress">
<el-input v-model="baseForm.previousOwnerAddress" :autosize="{ minRows: 2, maxRows: 4 }" <el-input v-model="baseForm.previousOwnerAddress" :autosize="{ minRows: 2, maxRows: 4 }" clearable
clearable maxlength="200" placeholder="请输入原车主住址" show-word-limit type="textarea" /> maxlength="200" placeholder="请输入原车主住址" show-word-limit type="textarea" />
</el-form-item> </el-form-item>
</div> </div>
<div class="vcd-base-form-layout__pair"> <div class="vcd-base-form-layout__pair">
...@@ -271,8 +270,8 @@ ...@@ -271,8 +270,8 @@
value-format="yyyy-MM-dd" /> value-format="yyyy-MM-dd" />
</el-form-item> </el-form-item>
<el-form-item label="使用性质" prop="usageType"> <el-form-item label="使用性质" prop="usageType">
<el-select v-model="baseForm.usageType" placeholder="请选择使用性质" <el-select v-model="baseForm.usageType" placeholder="请选择使用性质" popper-class="vcd-base-form-popper"
popper-class="vcd-base-form-popper" style="width: 100%;"> style="width: 100%;">
<el-option v-for="opt in usageTypeOptions" :key="opt.value" :label="opt.label" <el-option v-for="opt in usageTypeOptions" :key="opt.value" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
...@@ -280,8 +279,8 @@ ...@@ -280,8 +279,8 @@
</div> </div>
<div class="vcd-base-form-layout__pair"> <div class="vcd-base-form-layout__pair">
<el-form-item label="所有人性质" prop="ownerType"> <el-form-item label="所有人性质" prop="ownerType">
<el-select v-model="baseForm.ownerType" placeholder="请选择所有人性质" <el-select v-model="baseForm.ownerType" placeholder="请选择所有人性质" popper-class="vcd-base-form-popper"
popper-class="vcd-base-form-popper" style="width: 100%;"> style="width: 100%;">
<el-option v-for="opt in ownerTypeOptions" :key="opt.value" :label="opt.label" <el-option v-for="opt in ownerTypeOptions" :key="opt.value" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
...@@ -312,8 +311,8 @@ ...@@ -312,8 +311,8 @@
</div> </div>
<div class="vcd-base-form-layout__full"> <div class="vcd-base-form-layout__full">
<el-form-item label="车况描述" prop="conditionDescription"> <el-form-item label="车况描述" prop="conditionDescription">
<el-input v-model="baseForm.conditionDescription" :autosize="{ minRows: 2, maxRows: 4 }" <el-input v-model="baseForm.conditionDescription" :autosize="{ minRows: 2, maxRows: 4 }" clearable
clearable maxlength="200" placeholder="请输入车况描述" show-word-limit type="textarea" /> maxlength="200" placeholder="请输入车况描述" show-word-limit type="textarea" />
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
...@@ -633,31 +632,6 @@ function optionalUserIdString(val) { ...@@ -633,31 +632,6 @@ function optionalUserIdString(val) {
return s === "" ? undefined : s; return s === "" ? undefined : s;
} }
/**
* 在职员工下拉与详情 sellerUserId 对齐:接口常同时返回记录主键 id 与账号 userId,
* 若选项 value 用记录 id 而详情存的是 userId,会再补一条「当前顾问」导致同名重复。
* 同一行上 userId 与 id 并存且不同时,优先 userId(与评估单 sellerUserId 常见一致)。
*/
function pickSellerStaffRowUserKey(item) {
if (!item || typeof item !== "object")
return null;
const acc = item.userId ?? item.sellerUserId ?? item.staffUserId ?? item.sysUserId;
const pk = item.id;
const accStr = acc !== null && acc !== undefined && acc !== ""
? String(acc).trim()
: "";
const pkStr = pk !== null && pk !== undefined && pk !== ""
? String(pk).trim()
: "";
if (accStr && pkStr && accStr !== pkStr)
return accStr;
if (accStr)
return accStr;
if (pkStr)
return pkStr;
return null;
}
function sellerStaffDisplayNameFromRow(item) { function sellerStaffDisplayNameFromRow(item) {
if (!item || typeof item !== "object") if (!item || typeof item !== "object")
return ""; return "";
...@@ -1936,17 +1910,6 @@ export default { ...@@ -1936,17 +1910,6 @@ export default {
fillDetailFieldAliases(d); fillDetailFieldAliases(d);
if (!t(d.sellerUserId)) {
if (t(d.sellerStaffUserId))
d.sellerUserId = d.sellerStaffUserId;
else if (t(d.saleUserId))
d.sellerUserId = d.saleUserId;
else if (t(d.saleStaffUserId))
d.sellerUserId = d.saleStaffUserId;
}
if (!t(d.sellerName) && t(d.saleStaffName))
d.sellerName = d.saleStaffName;
const plateCityLabel = t(d["上牌城市"]); const plateCityLabel = t(d["上牌城市"]);
if (plateCityLabel) { if (plateCityLabel) {
d._detailRegistrationCityText = plateCityLabel; d._detailRegistrationCityText = plateCityLabel;
...@@ -2584,14 +2547,14 @@ export default { ...@@ -2584,14 +2547,14 @@ export default {
if (!opt) if (!opt)
return ""; return "";
const n = String(opt.staffName || "").trim(); const n = String(opt.staffName || "").trim();
return n || String(opt.id ?? "").trim(); return n || String(opt.uuid ?? "").trim();
}, },
getSelectedSellerStaff() { getSelectedSellerStaff() {
const id = this.baseForm.sellerUserId; const id = this.baseForm.sellerUserId;
if (id === "" || id == null) if (id === "" || id == null)
return null; return null;
const s = String(id); const s = String(id);
return this.sellerStaffOptions.find(x => String(x.id) === s) || null; return this.sellerStaffOptions.find(x => String(x.uuid) === s) || null;
}, },
onSellerStaffChange() { onSellerStaffChange() {
const sel = this.getSelectedSellerStaff(); const sel = this.getSelectedSellerStaff();
...@@ -2626,50 +2589,37 @@ export default { ...@@ -2626,50 +2589,37 @@ export default {
if (Array.isArray(list)) if (Array.isArray(list))
rows = list.filter(item => item && typeof item === "object"); rows = list.filter(item => item && typeof item === "object");
} }
const seenIds = new Set(); const seenUuids = new Set();
const options = []; const options = [];
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
const row = rows[i]; const row = rows[i];
const key = pickSellerStaffRowUserKey(row); const uuid = row.uuid != null && row.uuid !== ""
if (key === null || seenIds.has(key)) ? String(row.uuid).trim()
: "";
if (!uuid || seenUuids.has(uuid))
continue; continue;
seenIds.add(key); seenUuids.add(uuid);
options.push({ options.push({
id: key, uuid,
staffName: sellerStaffDisplayNameFromRow(row), staffName: sellerStaffDisplayNameFromRow(row),
}); });
} }
let idForForm = idSaved; let idForForm = idSaved;
if (idSaved && !options.some(x => String(x.id) === idSaved)) { if (idForForm && !options.some(x => String(x.uuid) === idForForm)) {
for (let j = 0; j < rows.length; j++) {
const row = rows[j];
const pkStr = row.id != null && row.id !== ""
? String(row.id).trim()
: "";
if (pkStr === idSaved) {
const canon = pickSellerStaffRowUserKey(row);
if (canon && options.some(x => String(x.id) === canon)) {
idForForm = canon;
break;
}
}
}
}
if (idForForm && !options.some(x => String(x.id) === idForForm)) {
options.push({ options.push({
id: idForForm, uuid: idForForm,
staffName: nameSaved || String(d.sellerName || "").trim() || "", staffName: nameSaved || String(d.sellerName || "").trim() || "",
}); });
} }
this.sellerStaffOptions = options; this.sellerStaffOptions = options;
if (idForForm && options.some(x => String(x.id) === idForForm)) { if (idForForm && options.some(x => String(x.uuid) === idForForm)) {
this.baseForm.sellerUserId = idForForm; this.baseForm.sellerUserId = idForForm;
const hit = options.find(x => String(x.id) === idForForm); const hit = options.find(x => String(x.uuid) === idForForm);
if (hit && String(hit.staffName || "").trim()) if (hit && String(hit.staffName || "").trim())
this.baseForm.sellerName = String(hit.staffName).trim(); this.baseForm.sellerName = String(hit.staffName).trim();
} else if (nameSaved) { } else if (nameSaved) {
const hit = options.find(x => String(x.staffName || "").trim() === nameSaved); const hit = options.find(x => String(x.staffName || "").trim() === nameSaved);
this.baseForm.sellerUserId = hit ? String(hit.id) : ""; this.baseForm.sellerUserId = hit ? String(hit.uuid) : "";
} else { } else {
this.baseForm.sellerUserId = ""; this.baseForm.sellerUserId = "";
} }
...@@ -2712,8 +2662,8 @@ export default { ...@@ -2712,8 +2662,8 @@ export default {
operator: op || undefined, operator: op || undefined,
evalOrderBasicReqDTO: { evalOrderBasicReqDTO: {
sellerUserId: optionalUserIdString( sellerUserId: optionalUserIdString(
sellerSel && sellerSel.id != null && sellerSel.id !== "" sellerSel && sellerSel.uuid != null && sellerSel.uuid !== ""
? sellerSel.id ? sellerSel.uuid
: b.sellerUserId, : b.sellerUserId,
), ),
sellerName: (sellerSel && sellerSel.staffName sellerName: (sellerSel && sellerSel.staffName
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!