Commit 5c553dd2 by 前端

Merge branch 'develop' into 'master'

上线合并

See merge request !998
2 parents 2f472807 d58b3f7c
Pipeline #281 for 5c553dd2 skipped in 0 seconds
Showing 59 changed files with 1286 additions and 369 deletions
This diff could not be displayed because it is too large.
......@@ -60,7 +60,7 @@
{
"kind": "route",
"path": "src/views/purchase/singleReview.vue",
"line": 408,
"line": 410,
"column": 3,
"reason": "dynamic-expression",
"note": "返回目标由来源页运行时决定"
......
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- when: never
stages:
- verify
default:
ci_disabled:
stage: verify
before_script:
- node -e "const [major,minor]=process.versions.node.split('.').map(Number); if(major!==20||minor<19){throw new Error('Node 20.19+ and <21 is required')}"
- node -e "const {execFileSync}=require('node:child_process'); const [major,minor]=execFileSync(process.platform==='win32'?'npm.cmd':'npm',['--version'],{encoding:'utf8'}).trim().split('.').map(Number); if(major!==10||minor<8){throw new Error('npm 10.8+ and <11 is required')}"
- npm ci --legacy-peer-deps
knowledge_graph_check:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- npm run knowledge:test
- npm run knowledge:check
allow_failure: false
affected_tests:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- npm run test:affected -- --format json
full_unit_tests:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: manual
allow_failure: true
script:
- npm run test:unit -- --ci
- echo "CI is temporarily disabled because no GitLab Runner is available."
......@@ -12,8 +12,8 @@
"env": "develop",
"swaggerPath": "/swagger-rop/api-docs",
"snapshot": "src/libs/rop/__snapshots__/smartcarlife.swagger.json",
"sha256": "5324f2c256ac54fadecd80e69111ebc407eb74e0535168973441680019e19ac7",
"syncedAt": "2026-08-21T09:21:56.374Z",
"sha256": "cbc17da14d9e2a5197a3355d5237d824c1b52ff61a1e0a2567be0b9371fccf04",
"syncedAt": "2026-09-02T09:12:01.448Z",
"methodCount": 1633
}
]
......
const SCENE_TYPE_MAP = {
0: { bizType: 2, bizTypeName: "权益" },
1: { bizType: 1, bizTypeName: "轻改" },
7: { bizType: 7, bizTypeName: "二手车" },
};
const SCENE_CODE_MAP = {
......@@ -11,6 +12,7 @@ const SCENE_CODE_MAP = {
110102: { bizType: 2, bizTypeName: "权益" },
110201: { bizType: "延保", bizTypeName: "延保" },
110202: { bizType: "延保", bizTypeName: "延保" },
120101: { bizType: 7, bizTypeName: "二手车" },
};
export function collectSceneCodes(value) {
......
......@@ -370,4 +370,11 @@ export function importLightChangePhone(data) {
export function getCourseCategoryList(data = {}) {
data.method = `${path}servicecenter.course.category.list`;
return request(data, RequestMethods.POST);
}
\ No newline at end of file
}
/**
* 等级考试-根据职务查询品牌筛选选项
*/
export function getCarBrandList(data = {}) {
data.method = "risk.manage.api.level.exam.position.brand.query";
return request(data, RequestMethods.POST);
}
export function formatProductId(value) {
return value || "-";
}
export function createProductIdFilter() {
return {
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
placeholder: "请输入产品ID",
};
}
export function createProductIdColumn(options = {}) {
return {
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
formatter: cellValue => formatProductId(cellValue.upgradeGoodsCommodityCode),
...options,
};
}
import {
createProductIdColumn,
createProductIdFilter,
formatProductId,
} from "./productId";
describe("product ID UI config", () => {
it("builds the shared fuzzy-search filter", () => {
expect(createProductIdFilter()).toEqual({
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
placeholder: "请输入产品ID",
});
});
it("builds a product ID column from the API response field", () => {
const column = createProductIdColumn({ width: 120 });
expect(column.label).toBe("产品ID");
expect(column.prop).toBe("upgradeGoodsCommodityCode");
expect(column.width).toBe(120);
expect(column.formatter({
upgradeGoodsCommodityCode: "U2509010001",
})).toBe("U2509010001");
});
it.each([undefined, null, ""])("shows missing historical product IDs as a dash", (value) => {
expect(formatProductId(value)).toBe("-");
});
});
module.exports = file => () => import('@/views/' + file)
module.exports = file => () => import(
/* webpackExclude: /\.(?:spec|test)\.js$/ */
"@/views/" + file,
);
const mockGetGoodsInfoById = jest.fn();
jest.mock("@api/commodity", () => ({
getGoodsInfoById: mockGetGoodsInfoById,
}));
jest.mock("@api/productManage", () => ({
addProductManage: jest.fn(),
UpdateProductManage: jest.fn(),
}));
jest.mock("@/main", () => ({
baseConfig: {
equitySceneType: [],
extendedPosiType: [],
membraneTypeList: [],
supplierCode: [],
},
}));
jest.mock("./sourceMaterial.vue", () => ({
name: "SourceMaterial",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./specifications.vue", () => ({
name: "Specifications",
render(createElement) {
return createElement("div");
},
}));
const DrawerUpdate = require("./drawerUpdate.vue").default;
function createGoodsDetail() {
return {
baseGoodsName: "测试产品",
distributionType: 0,
goodsInfo: {
goodsCode: "P001",
goodsName: "测试产品",
goodsType: 1,
scrmFlag: "N",
secondaryGoodsType: -1,
supplierCode: "S001",
thirdLevelGoodsType: -1,
},
goodsSpecificationNameList: [],
id: 1,
shoppingMallFlag: 0,
status: 1,
upgradeGoodsList: [{
id: 11,
merchantGoodsInfos: [],
providerIds: [],
purchaseGoodsInfos: [{ id: 22 }],
specificationData: "默认规格",
upgradeGoodsAreaList: [],
}],
};
}
describe("产品编辑详情映射", () => {
beforeEach(() => {
mockGetGoodsInfoById.mockResolvedValue(createGoodsDetail());
});
afterEach(() => {
jest.clearAllMocks();
});
it("将采购上架记录保留到单规格和多规格编辑行", async () => {
const context = {
addToUpgradeGoodsList: jest.fn(),
baseConfig: { supplierCode: [] },
copyUpgradeGoodsList: [],
extendedPosiType: [],
pageDisabled: false,
productFormData: {},
setUpdateGoodsInfo: jest.fn(),
show: false,
};
DrawerUpdate.methods.getGoodsInfo.call(context, { id: 1 });
await Promise.resolve();
await Promise.resolve();
expect(context.setUpdateGoodsInfo).toHaveBeenCalledTimes(1);
const [goodsInfoData] = context.setUpdateGoodsInfo.mock.calls[0];
expect(goodsInfoData.goodsSpecificationSingleList[0].purchaseGoodsInfos).toEqual([{ id: 22 }]);
expect(goodsInfoData.goodsSpecificationList[0].purchaseGoodsInfos).toEqual([{ id: 22 }]);
});
});
......@@ -26,6 +26,7 @@ import { applicableModelTypeList, BaseData, priceUnitTypeList } from '@/common/c
import { deepClone } from '@/common/util'
import { baseConfig } from '@/main'
import { convertYuanToWan } from '@/views/goods/filterOption'
import { pickSkuShelfRelations } from "./goodsStatus";
import sourceMaterial from './sourceMaterial.vue'
import specifications from './specifications.vue'
......@@ -185,7 +186,7 @@ export default {
serviceItemArr: val.upgradeGoodsServiceItemsList || [],
extendServiceItemArr: val.upgradeGoodsServiceItemsList || [],
entityCardFlag: val.entityCardFlag == 'Y',
merchantGoodsInfos: val?.merchantGoodsInfos,
...pickSkuShelfRelations(val),
djCost: val.djCost,
// 编辑产品价格输入框限制
oldupgradePrice: val.upgradePrice,
......
const GOODS_STATUS_TEXT = {
0: "待上架",
1: "已上架",
2: "部分上架",
3: "草稿",
};
export function formatGoodsStatus(status) {
return GOODS_STATUS_TEXT[status];
}
export function createGoodsStatusOptions() {
return Object.entries(GOODS_STATUS_TEXT).map(([confId, confValue]) => ({
confId: Number(confId),
confValue,
}));
}
export function hasSkuShelfRelations(sku) {
return [sku?.merchantGoodsInfos, sku?.purchaseGoodsInfos]
.some(relations => Array.isArray(relations) && relations.length > 0);
}
export function pickSkuShelfRelations(sku) {
return {
merchantGoodsInfos: sku?.merchantGoodsInfos,
purchaseGoodsInfos: sku?.purchaseGoodsInfos,
};
}
import {
createGoodsStatusOptions,
formatGoodsStatus,
hasSkuShelfRelations,
pickSkuShelfRelations,
} from "./goodsStatus";
describe("产品管理商品状态", () => {
it.each([
{
name: "普通商品上架记录非空时禁止删除 SKU",
sku: { merchantGoodsInfos: [{ id: 1 }], purchaseGoodsInfos: [] },
},
{
name: "采购上架记录非空时禁止删除 SKU",
sku: { merchantGoodsInfos: [], purchaseGoodsInfos: [{ id: 2 }] },
},
])("$name", ({ sku }) => {
expect(hasSkuShelfRelations(sku)).toBe(true);
});
it.each([
undefined,
null,
{},
{ merchantGoodsInfos: null, purchaseGoodsInfos: null },
{ merchantGoodsInfos: [], purchaseGoodsInfos: [] },
])("上架关联为空时允许删除 SKU:%p", (sku) => {
expect(hasSkuShelfRelations(sku)).toBe(false);
});
it("将详情接口中的两类上架关系透传到编辑行", () => {
const merchantGoodsInfos = [{ id: 1 }];
const purchaseGoodsInfos = [{ id: 2 }];
expect(pickSkuShelfRelations({ merchantGoodsInfos, purchaseGoodsInfos })).toEqual({
merchantGoodsInfos,
purchaseGoodsInfos,
});
});
it.each([
[0, "待上架"],
[1, "已上架"],
[2, "部分上架"],
[3, "草稿"],
["1", "已上架"],
])("商品状态 %p 显示为 %s", (status, expected) => {
expect(formatGoodsStatus(status)).toBe(expected);
});
it("未知商品状态保持为空,由表格按默认方式展示", () => {
expect(formatGoodsStatus()).toBeUndefined();
expect(formatGoodsStatus(4)).toBeUndefined();
});
it("商品状态筛选项与列文案共用同一映射", () => {
expect(createGoodsStatusOptions()).toEqual([
{ confId: 0, confValue: "待上架" },
{ confId: 1, confValue: "已上架" },
{ confId: 2, confValue: "部分上架" },
{ confId: 3, confValue: "草稿" },
]);
});
});
......@@ -181,6 +181,7 @@ import ApplicableAreaQuerySelect from "@/views/goods/components/applicable-area-
import drawerDetail from "./drawerDetail.vue";
import drawerSkuDetail from "./drawerSkuDetail.vue";
import drawerUpdate from "./drawerUpdate.vue";
import { createGoodsStatusOptions, formatGoodsStatus } from "./goodsStatus";
export default {
name: "Commodity",
......@@ -486,12 +487,7 @@ export default {
}[cellValue.status];
},
formatter: (cellValue) => {
return {
0: "待上架",
1: "上架",
2: "部分上架",
3: "草稿",
}[cellValue.status];
return formatGoodsStatus(cellValue.status);
},
},
{
......@@ -522,24 +518,7 @@ export default {
// 基本数据
baseData: {
productTypeList: [],
statusList: [
{
confId: 0,
confValue: "待上架",
},
{
confId: 1,
confValue: "上架",
},
{
confId: 2,
confValue: "部分上架",
},
{
confId: 3,
confValue: "草稿",
},
],
statusList: createGoodsStatusOptions(),
supplierCodeList: [], // 供应方
brandMerchantCodeList: [], // 品牌方
showSkuListOptions: [
......
......@@ -512,7 +512,7 @@
</td>
<td style="width: 60px">
<el-button type="text"
:disabled="(row.item.merchantGoodsInfos && row.item.merchantGoodsInfos.length > 0) || goodsInfoData.scrmFlag == 'Y' || pageData.pageDisabled"
:disabled="hasSkuShelfRelations(row.item) || goodsInfoData.scrmFlag === 'Y' || pageData.pageDisabled"
@click="delspecificationValueList(row.originalIndex)">
删除
</el-button>
......@@ -763,6 +763,7 @@ import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVi
// import ApplicableAreaSelect from "@/views/goods/components/applicable-area-select/index.vue";
import carSeriesDialog from "./carSeriesDialog.vue";
import extendServiceItemsDialog from "./extendServiceItemsDialog.vue";
import { hasSkuShelfRelations, pickSkuShelfRelations } from "./goodsStatus";
import serviceItemsDialog from "./serviceItemsDialog.vue";
import specsManage from "./specsManage.vue";
import SupplierSelect from "./SupplierSelect.vue";
......@@ -1035,6 +1036,7 @@ export default {
},
},
methods: {
hasSkuShelfRelations,
// ========== 批量赋值方法 ==========
/**
* 批量设置产品编码
......@@ -2031,6 +2033,7 @@ export default {
item.supplySource = temp.supplySource;
item.remark = temp.remark;
item.merchantGoodsExist = temp.merchantGoodsExist;
Object.assign(item, pickSkuShelfRelations(temp));
break;
}
}
......
......@@ -496,7 +496,7 @@
<td style="width: 60px">
<el-button type="text"
:disabled="row.item.merchantGoodsInfos && row.item.merchantGoodsInfos.length > 0"
:disabled="hasSkuShelfRelations(row.item)"
@click="delgoodsSpecificationSingleList(row.originalIndex)">
删除
</el-button>
......@@ -650,6 +650,7 @@ import useResizableColumns from "@/views/goods/productManage/mixins/useResizable
import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVirtualScroll";
import carSeriesDialog from "./carSeriesDialog.vue";
import extendServiceItemsDialog from "./extendServiceItemsDialog.vue";
import { hasSkuShelfRelations } from "./goodsStatus";
import serviceItemsDialog from "./serviceItemsDialog.vue";
import SupplierSelect from "./SupplierSelect.vue";
......@@ -851,6 +852,7 @@ export default {
});
},
methods: {
hasSkuShelfRelations,
...mapMutations("goodsInfoData", ["setUpdateGoodsInfo"]),
...mapActions({
get: "d2admin/base/get",
......
import { shallowMount } from "@vue/test-utils";
import Vue from "vue";
Vue.config.ignoredElements = [/^el-/, /^d2-/];
jest.mock("@api/productManage", () => ({
getCarSeriesList: jest.fn(),
getExtendServiceItems: jest.fn(),
getProductServiceItems: jest.fn(),
}));
jest.mock("@/main", () => ({
baseConfig: {
equitySceneType: [],
extendedPosiType: [],
membraneTypeList: [],
supplierCode: [],
},
}));
jest.mock("@/views/goods/components/applicable-area-query-select/index.vue", () => ({
name: "ApplicableAreaQuerySelect",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./carSeriesDialog.vue", () => ({
name: "CarSeriesDialog",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./extendServiceItemsDialog.vue", () => ({
name: "ExtendServiceItemsDialog",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./serviceItemsDialog.vue", () => ({
name: "ServiceItemsDialog",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./specsManage.vue", () => ({
name: "SpecsManage",
render(createElement) {
return createElement("div");
},
}));
jest.mock("./SupplierSelect.vue", () => ({
name: "SupplierSelect",
render(createElement) {
return createElement("div");
},
}));
const MultipleSpecificationForm = require("./multipleSpecificationForm.vue").default;
const SingleSpecificationForm = require("./singleSpecificationForm.vue").default;
const ElButtonStub = {
props: {
disabled: {
type: Boolean,
default: false,
},
},
render(createElement) {
return createElement("button", {
attrs: { disabled: this.disabled },
}, this.$slots.default);
},
};
let wrapper;
function createGoodsInfoData(listKey, { goodsInfoOverrides = {}, skuOverrides = {} } = {}) {
const sku = {
merchantGoodsInfos: [],
providerIds: [],
purchaseGoodsInfos: [{ id: 2 }],
selectCarSerise: [],
serviceItemArr: [],
specificationData: "测试规格",
specsValueList: ["测试规格"],
statusFlag: 0,
upgradeGoodsAreaList: [],
...skuOverrides,
};
return {
goodsSpecificationList: [],
goodsSpecificationNameList: [{ specificationName: "规格" }],
goodsSpecificationSingleList: [],
goodsType: null,
scrmFlag: "N",
specificationDetailList: [{
specificationName: "规格",
specificationValueList: [{ specificationValue: "测试规格" }],
}],
supplierCode: "",
upgradeGoodsList: [sku],
[listKey]: [sku],
...goodsInfoOverrides,
};
}
function createWrapper(component, listKey, {
goodsInfoOverrides = {},
pageDataOverrides = {},
runMounted = false,
skuOverrides = {},
} = {}) {
const goodsInfoData = createGoodsInfoData(listKey, { goodsInfoOverrides, skuOverrides });
const TestComponent = {
...component,
computed: {
...component.computed,
goodsInfoData() {
return goodsInfoData;
},
},
};
if (!runMounted) {
TestComponent.mounted = function mounted() {};
}
return shallowMount(TestComponent, {
mocks: {
$$: (value, key) => value?.[key],
$store: {
commit: jest.fn(),
dispatch: jest.fn().mockResolvedValue([]),
state: {
d2admin: {
user: { info: {} },
},
},
},
},
provide: {
pageData: {
addOrEdit: "edit",
pageDisabled: false,
...pageDataOverrides,
},
},
stubs: {
"el-button": ElButtonStub,
},
});
}
describe("产品编辑 SKU 删除按钮", () => {
afterEach(() => {
wrapper?.destroy();
jest.clearAllMocks();
});
it.each([
["单规格", SingleSpecificationForm, "goodsSpecificationSingleList"],
["多规格", MultipleSpecificationForm, "goodsSpecificationList"],
])("%s SKU 有采购上架记录时删除按钮置灰", (name, component, listKey) => {
wrapper = createWrapper(component, listKey);
const buttons = wrapper.find(".body-table").findAll("button");
const deleteButton = buttons.wrappers.find(button => button.text().trim() === "删除");
expect(deleteButton.element.disabled).toBe(true);
});
it("多规格挂载重建 SKU 后仍保留采购上架禁删状态", async () => {
wrapper = createWrapper(MultipleSpecificationForm, "goodsSpecificationList", { runMounted: true });
await wrapper.vm.$nextTick();
const deleteButton = wrapper.find(".body-table").findAll("button").wrappers.find(button => button.text().trim() === "删除");
expect(wrapper.vm.goodsInfoData.goodsSpecificationList[0].purchaseGoodsInfos).toEqual([{ id: 2 }]);
expect(deleteButton.element.disabled).toBe(true);
});
it.each([
[
"单规格无上架关联时允许删除",
SingleSpecificationForm,
"goodsSpecificationSingleList",
{ skuOverrides: { purchaseGoodsInfos: [] } },
false,
],
[
"多规格无上架关联时允许删除",
MultipleSpecificationForm,
"goodsSpecificationList",
{ skuOverrides: { purchaseGoodsInfos: [] } },
false,
],
[
"多规格普通上架关联非空时禁止删除",
MultipleSpecificationForm,
"goodsSpecificationList",
{ skuOverrides: { merchantGoodsInfos: [{ id: 1 }], purchaseGoodsInfos: [] } },
true,
],
[
"多规格 SCRM 商品禁止删除",
MultipleSpecificationForm,
"goodsSpecificationList",
{ goodsInfoOverrides: { scrmFlag: "Y" }, skuOverrides: { purchaseGoodsInfos: [] } },
true,
],
[
"多规格页面只读时禁止删除",
MultipleSpecificationForm,
"goodsSpecificationList",
{ pageDataOverrides: { pageDisabled: true }, skuOverrides: { purchaseGoodsInfos: [] } },
true,
],
])("%s", (name, component, listKey, options, expectedDisabled) => {
wrapper = createWrapper(component, listKey, options);
const deleteButton = wrapper.find(".body-table").findAll("button").wrappers.find(button => button.text().trim() === "删除");
expect(deleteButton.element.disabled).toBe(expectedDisabled);
});
});
import { shallowMount } from "@vue/test-utils";
const mockGetList = jest.fn().mockResolvedValue({ list: [] });
const mockGetAllCategory = jest.fn().mockResolvedValue({ list: [] });
const mockGetParkStore = jest.fn().mockResolvedValue([]);
const mockSearchServiceMerchant = jest.fn().mockResolvedValue({ list: [] });
jest.mock("@api/product", () => ({
getAllCategory: mockGetAllCategory,
getList: mockGetList,
}));
jest.mock("@api/serviceManage", () => ({
searchServiceMerchant: mockSearchServiceMerchant,
}));
jest.mock("@api/editCustomer", () => ({
getParkStore: mockGetParkStore,
}));
jest.mock("@api/grounding", () => ({
batchSetValidMinSellPrice: jest.fn(),
batchUpdateBatchCopy: jest.fn(),
purchaseGoodsInfoDeleteById: jest.fn(),
purchaseGoodsInfoImport: jest.fn(),
purchaseGoodsInfoPage: jest.fn(),
purchaseGoodsInfoUpdateBatchOffShelf: jest.fn(),
purchaseGoodsInfoUpdateBatchPrice: jest.fn(),
purchaseGoodsInfoUpdateBatchWaitAudit: jest.fn(),
purchaseGoodsInfoUpdateStatus: jest.fn(),
}));
jest.mock("@/main", () => ({
baseConfig: {},
}));
jest.mock("./components/batchCopyDialog.vue", () => ({
name: "BatchCopyDialog",
render(createElement) {
return createElement("div");
},
}));
const PurchaseOnShelves = require("./index.vue").default;
let currentRow;
let wrapper;
const AuthButtonStub = {
props: {
showBtnIds: {
type: Array,
default: () => [],
},
},
render(createElement) {
return createElement("button", {
attrs: {
"data-auth-id": this.showBtnIds[0],
},
});
},
};
const D2ContainerStub = {
render(createElement) {
return createElement("div", this.$slots.default);
},
};
const EmptyStub = {
render(createElement) {
return createElement("div");
},
};
const D2TableStub = {
render(createElement) {
return createElement("div", [
this.$scopedSlots["auth-button"]({ scope: currentRow }),
]);
},
};
function createWrapper(row) {
currentRow = row;
return shallowMount(PurchaseOnShelves, {
mocks: {
$store: {
commit: jest.fn(),
dispatch: jest.fn().mockResolvedValue([]),
state: {
d2admin: {
user: {
dowloadList: [],
info: {},
updateList: [],
updateRefesh: false,
},
},
},
},
},
stubs: {
AuthButton: AuthButtonStub,
D2Container: D2ContainerStub,
D2Dialog: EmptyStub,
D2FileImportDialog: EmptyStub,
D2Table: D2TableStub,
D2TableHeader: EmptyStub,
},
});
}
describe("purchase goods delete button visibility", () => {
afterEach(() => {
wrapper.destroy();
jest.clearAllMocks();
});
it("shows delete for an off-shelf record that was previously on shelf", () => {
wrapper = createWrapper({
lastOnShelfTime: "2026-08-27 10:00:00",
status: 0,
});
expect(wrapper.find("[data-auth-id='9031404']").exists()).toBe(true);
});
it("hides delete for an on-shelf record without a previous shelf time", () => {
wrapper = createWrapper({
lastOnShelfTime: "",
status: 1,
});
expect(wrapper.find("[data-auth-id='9031404']").exists()).toBe(false);
});
});
......@@ -107,7 +107,7 @@
<auth-button :data="scope.scope" :show-btn-ids="['9031407']" />
</span>
<!-- 删除 -->
<span style="margin-right: 10px;" v-if="!scope.scope.lastOnShelfTime">
<span v-if="canDeletePurchaseGoods(scope.scope)" style="margin-right: 10px;">
<auth-button :data="scope.scope" :show-btn-ids="['9031404']" />
</span>
<!-- 上架/下架 -->
......@@ -154,6 +154,8 @@ import { baseConfig } from '@/main'
import batchCopyDialog from './components/batchCopyDialog.vue'
import { getBatchPriceSelectionSummary, hasUnsupportedPurchaseCostType } from './utils/batchPrice'
import { getPurchaseCostTypeText, purchaseCostTypeList } from './utils/purchaseCost'
import { canDeletePurchaseGoods } from "./utils/purchaseGoodsStatus";
export default {
components: { batchCopyDialog },
name: 'PurchaseOnShelves',
......@@ -641,6 +643,7 @@ export default {
}),
...mapMutations('d2admin/user', ['setUpdateRefesh']),
...mapActions('d2admin/user', ['actionSetDownloadList']),
canDeletePurchaseGoods,
selectAddAttr(value) {
this.searchForm.goodsType = value?.[0]
this.searchForm.secondaryGoodsType = value?.[1]
......
const DELETABLE_PURCHASE_GOODS_STATUS = ["0", "3", "4"];
export function canDeletePurchaseGoods(record) {
const status = record?.status;
if (typeof status !== "number" && typeof status !== "string") {
return false;
}
return DELETABLE_PURCHASE_GOODS_STATUS.includes(String(status));
}
import { canDeletePurchaseGoods } from "./purchaseGoodsStatus";
describe("purchase goods delete visibility", () => {
it.each([3, 4, 0, "3", "4", "0"])("allows deletion when status is %s", (status) => {
expect(canDeletePurchaseGoods({
status,
lastOnShelfTime: "2026-08-27 10:00:00",
})).toBe(true);
});
it.each([1, "1", "", " ", null, undefined, false, true, 2])("hides deletion when status is %s", (status) => {
expect(canDeletePurchaseGoods({ status })).toBe(false);
});
it("hides deletion when the purchase goods record is missing", () => {
expect(canDeletePurchaseGoods()).toBe(false);
});
});
......@@ -102,6 +102,7 @@ import {
operatorreviewOperatorAudit,
operatorreviewView,
} from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
......@@ -191,6 +192,7 @@ export default {
addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName",
},
createProductIdColumn(),
{
label: "供应商名称",
prop: 'thirdPartyName',
......
......@@ -350,6 +350,11 @@ export default {
prop: "upgradeGoodsName",
},
{
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称",
prop: "thirdPartyName",
width: 100,
......@@ -683,8 +688,9 @@ export default {
"goodsType",
"goodsTypeName",
];
if (this.page == "factory")
if (this.page == "factory") {
delete params.shippingWarehouseId;
}
for (let idx = 0; idx < this.tableList.length; idx++) {
const item = this.tableList[idx];
if (this.nowPurNumList[idx] && this.nowPurNumList[idx] != 0) {
......
......@@ -170,6 +170,7 @@ import {
operatorreviewView,
purchaseOrderDetail,
} from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import ExamineRecord from "./examineRecord.vue";
......@@ -224,6 +225,7 @@ export default {
addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName",
},
createProductIdColumn(),
{
label: "供应商名称",
prop: "thirdPartyName",
......@@ -402,7 +404,10 @@ export default {
}
// 采购订单-自采入库显示膜卷号
if (this.showFilmRollNo) {
this.tableParams.tableColumns.splice(5, 0, {
const carNameColumnIndex = this.tableParams.tableColumns.findIndex(
item => item.prop === "carName",
);
this.tableParams.tableColumns.splice(carNameColumnIndex, 0, {
label: "膜卷号",
prop: "filmRollNo",
type: "slot",
......
......@@ -105,6 +105,7 @@ import {
operatorreviewView,
purchaseOrderReject,
} from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
......@@ -184,6 +185,7 @@ export default {
addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName",
},
createProductIdColumn(),
{
label: "供应商名称",
prop: 'thirdPartyName',
......
......@@ -30,6 +30,7 @@
</template>
<script>
import { createProductIdFilter } from "@/common/productId";
import { Util, deepClone } from '@/common/util'
import { director_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, director_statusOptions_table } from './constant'
import { mapActions, mapState } from 'vuex'
......@@ -54,7 +55,8 @@ export default {
merchantName: '',
sortType: 2,
orderTimeStr: [],
purchasingPattern: ''
purchasingPattern: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -65,6 +67,7 @@ export default {
type: 'input',
isClear: true
},
createProductIdFilter(),
{
label: '下单时间',
name: 'placeOrderTimeStr',
......@@ -382,4 +385,3 @@ export default {
}
</script>
<style lang="scss" scoped></style>
......@@ -66,6 +66,7 @@
<script>
import { mapActions, mapState } from "vuex";
import { getManagerReviewPageApi, getMerchantList, managerreviewManagerAudit, managerReviewReject } from "@/api/purchaseShopping.js";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import CheckDialog from "./components/CheckDialog";
import orderDeatilDialog from "./components/orderDetailDialog";
......@@ -92,6 +93,7 @@ export default {
sortType: 2,
orderTimeStr: [],
purchasingPattern: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -102,6 +104,7 @@ export default {
type: "input",
isClear: true,
},
createProductIdFilter(),
{
label: "下单时间",
name: "placeOrderTimeStr",
......
......@@ -54,6 +54,7 @@
</template>
<script>
import { createProductIdFilter } from "@/common/productId";
import { Util, deepClone } from '@/common/util'
import { business_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, business_statusOptions_table } from './constant'
import { mapActions, mapState } from 'vuex'
......@@ -79,7 +80,8 @@ export default {
sortType: 2,
orderTimeStr: [],
purchasingPattern: '',
onlyAllocateOrder: false
onlyAllocateOrder: false,
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -90,6 +92,7 @@ export default {
type: 'input',
isClear: true
},
createProductIdFilter(),
{
label: '下单时间',
name: 'placeOrderTimeStr',
......
......@@ -73,6 +73,7 @@
<script>
import { mapActions, mapState } from "vuex";
import { getMerchantList, getPurchaseOrderList, operatorreviewOperatorAudit, operatorreviewPage, purchaseOrderCancelOrCheck } from "@/api/purchaseShopping.js";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import CheckDialog from "./components/CheckDialog";
import orderDeatilDialog from "./components/orderDetailDialog";
......@@ -97,6 +98,7 @@ export default {
sortType: 2,
orderTimeStr: [],
purchasingPattern: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -107,6 +109,7 @@ export default {
type: "input",
isClear: true,
},
createProductIdFilter(),
{
label: "下单时间",
name: "placeOrderTimeStr",
......
......@@ -416,6 +416,11 @@ export default {
prop: "upgradeGoodsName",
},
{
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称",
prop: "thirdPartyName",
width: 100,
......@@ -518,6 +523,7 @@ export default {
signStatusList: [],
thirdPartyName: "",
thirdPartyCode: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -652,6 +658,13 @@ export default {
isClear: true,
keyFn: this.keyDowmGetList,
},
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
],
selectedList: [],
getListApi: getPurchaseOrderShipmentList,
......@@ -669,6 +682,11 @@ export default {
prop: "upgradeGoodsName",
},
{
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称",
prop: "thirdPartyName",
width: 100,
......
......@@ -178,6 +178,7 @@ import {
operatorreviewOperatorAudit,
operatorreviewView,
} from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import {
getyqMerchantList,
getServicemerchantrefList
......@@ -264,6 +265,7 @@ export default {
addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName",
},
createProductIdColumn(),
{
label: "供应商名称",
prop: 'thirdPartyName',
......
......@@ -83,6 +83,7 @@
<script>
import { getShippingEntityInfoAll } from "@api/serviceManage";
import { directorCheck, directorReject, operatorreviewView, purchaseOrderDetail } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import ExamineRecord from "./components/examineRecord.vue";
......@@ -120,6 +121,7 @@ export default {
addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName",
},
createProductIdColumn(),
{
label: "供应商名称",
prop: 'thirdPartyName',
......
<template>
<div class="left-container">
<div class="data-view">
<div v-for="item in submitArr" :key="item.name" class="item">
<div class="name">{{ item.name }}</div>
<div class="value">{{ item.value(dataView) }}</div>
<div v-for="item in submitArr"
:key="item.name"
class="item">
<div class="name">
{{ item.name }}
</div>
<div class="value">
{{ item.value(dataView) }}
</div>
</div>
</div>
<div class="examination-result">
<div class="title">考试结果等级分布</div>
<echart-bar
class="echart"
:xData="xData"
:yData="yData"
id="resultRef"
></echart-bar>
<div class="title">
考试结果等级分布
</div>
<EchartBar id="resultRef"
class="echart"
:x-data="xData"
:y-data="yData">
</EchartBar>
<div class="hint">
<div
v-for="(item, index) in queryData.examLevelDTOS"
class="item"
:key="index"
>
<div v-for="(item, index) in queryData.examLevelDTOS"
:key="index"
class="item">
<span>{{ item.levelName }}:</span>
<span>{{ item.minScore + "-" + item.maxScore }}</span>
<span>{{ `${item.minScore}-${item.maxScore}` }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import echartBar from "./echartBar.vue"
import echartBar from "./echartBar.vue";
export default {
components: { echartBar },
props: {
dataView: {
type: Object,
default: () => {}
},
queryData: {
type: Object,
default: () => {}
}
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue)
},
deep: true,
immediate: true
}
},
components: { EchartBar: echartBar },
props: {
dataView: {
type: Object,
default: () => {},
},
queryData: {
type: Object,
default: () => {},
},
},
data() {
return {
submitArr: [
{
name: "已提交人数",
value: (obj) => {
console.log(obj)
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-"
}
},
{
name: "已提交人均得分",
value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-"
}
}
],
xData: [],
yData: []
}
},
methods: {
initEchartData(data) {
console.log(data)
let xData = []
data.scoreDistributions.forEach((item) => {
xData.push(item.levelName)
})
this.xData = xData
this.yData = data.scoreDistributions
}
}
}
data() {
return {
submitArr: [
{
name: "已提交人数",
value: (obj) => {
console.log(obj);
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-";
},
},
{
name: "已提交人均得分",
value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-";
},
},
],
xData: [],
yData: [],
};
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue);
},
deep: true,
immediate: true,
},
},
methods: {
initEchartData(data) {
console.log(data);
let xData = [];
data.scoreDistributions.forEach((item) => {
xData.push(item.levelName);
});
this.xData = xData;
this.yData = data.scoreDistributions;
},
},
};
</script>
<style lang="scss" scoped>
.left-container {
min-width: 800px;
.data-view {
display: flex;
align-items: center;
.item {
flex: 1;
height: 100px;
border-radius: 4px;
background: #f8faff;
margin-right: 16px;
padding: 16px 20px;
box-sizing: border-box;
margin-bottom: 16px;
.name {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-bottom: 8px;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
}
}
}
.examination-result {
position: relative;
.title {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.hint {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 52px;
right: 45px;
.item {
display: flex;
align-items: center;
color: #000000a6;
font-size: 11px;
font-weight: 400;
margin-bottom: 7px;
}
}
}
// min-width: 800px;
.data-view {
display: flex;
align-items: center;
.item {
flex: 1;
height: 100px;
border-radius: 4px;
background: #f8faff;
margin-right: 16px;
padding: 16px 20px;
box-sizing: border-box;
margin-bottom: 16px;
.name {
color: #333333;
font-size: 14px;
font-weight: 400;
margin-bottom: 8px;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
}
}
}
.examination-result {
position: relative;
.title {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.hint {
display: flex;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 52px;
right: 45px;
.item {
display: flex;
align-items: center;
color: #000000a6;
font-size: 11px;
font-weight: 400;
margin-bottom: 7px;
}
}
}
}
</style>
......@@ -2,107 +2,112 @@
<template>
<div class="dataView">
<d2-container>
<div class="title">数据概览</div>
<div class="title">
数据概览
</div>
<div class="content">
<div class="left">
<left-data-view
:dataView="dataViewObj"
:queryData="queryData"
></left-data-view>
<LeftDataView :data-view="dataViewObj"
:query-data="queryData">
</LeftDataView>
</div>
<div class="right">
<right-data-view :dataView="dataViewObj"></right-data-view>
<RightDataView :data-view="dataViewObj"></RightDataView>
</div>
</div>
<div class="database">
<dataTable :dataView="dataViewObj" :queryData="queryData"> </dataTable>
<DataTable :data-view="dataViewObj" :query-data="queryData">
</DataTable>
</div>
</d2-container>
</div>
</template>
<script>
import leftDataView from "./components/leftView.vue"
import rightDataView from "./components/rightView.vue"
import dataTable from "./components/dataTable.vue"
import { getLevelExamOverView } from "@api/serviceCentre"
import { getLevelExamOverView } from "@api/serviceCentre";
import dataTable from "./components/dataTable.vue";
import leftDataView from "./components/leftView.vue";
import rightDataView from "./components/rightView.vue";
export default {
name: "dataView",
components: {
leftDataView,
rightDataView,
dataTable
},
data() {
return {
dataViewObj: {
submitted: 0,
avg: 0,
topPersons: [],
scoreDistributions: []
}
}
},
props: {
queryData: {
type: Object,
default: () => {}
}
},
watch: {
queryData: {
handler(val) {
setTimeout(() => {
this.getLevelExamOverViewData()
}, 0)
},
deep: true,
immediate: true
}
},
mounted() {
this.getLevelExamOverViewData()
},
methods: {
async getLevelExamOverViewData() {
try {
let params = {
id: this.queryData.id
}
let result = await getLevelExamOverView(params)
console.log(result)
this.dataViewObj = result
} catch (err) {
this.$message.error(err?.message || "获取失败")
}
}
}
}
name: "dataView",
components: {
LeftDataView: leftDataView,
RightDataView: rightDataView,
DataTable: dataTable,
},
props: {
queryData: {
type: Object,
default: () => {},
},
},
data() {
return {
dataViewObj: {
submitted: 0,
avg: 0,
topPersons: [],
scoreDistributions: [],
},
};
},
watch: {
queryData: {
handler(val) {
setTimeout(() => {
this.getLevelExamOverViewData();
}, 0);
},
deep: true,
immediate: true,
},
},
mounted() {
this.getLevelExamOverViewData();
},
methods: {
async getLevelExamOverViewData() {
try {
let params = {
id: this.queryData.id,
};
let result = await getLevelExamOverView(params);
console.log(result);
this.dataViewObj = result;
} catch (err) {
this.$message.error(err?.message || "获取失败");
}
},
},
};
</script>
<style lang="scss" scoped>
.dataView {
padding: 0 20px;
.title {
height: 50px;
border-bottom: 1px solid #e5e5e5;
background: #ffffff;
color: #333333;
font-size: 16px;
font-weight: 500;
padding: 13px 0 13px 20px;
box-sizing: border-box;
}
.content {
background: #ffffff;
padding: 16px 20px;
display: flex;
.left {
width: calc(100% - 376px);
}
}
.database {
background: #ffffff;
}
padding: 0 20px;
.title {
height: 50px;
border-bottom: 1px solid #e5e5e5;
background: #ffffff;
color: #333333;
font-size: 16px;
font-weight: 500;
padding: 13px 0 13px 20px;
box-sizing: border-box;
}
.content {
background: #ffffff;
padding: 16px 20px;
display: flex;
width: 100%;
box-sizing: border-box;
.left {
width: calc(100% - 376px);
}
}
.database {
background: #ffffff;
}
}
</style>
......@@ -158,6 +158,7 @@
<script>
import { getTransferGoodsInfo, getTransferAuitInfo } from "@/api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { baseConfig } from "@/main";
import { Util, deepClone } from "@/common/util";
import EllipsisTooltip from "./EllipsisTooltip.vue";
......@@ -251,6 +252,7 @@ export default {
label: "产品名称",
prop: "goodsName",
},
createProductIdColumn(),
{
label: "产品编码",
prop: "productCode",
......
......@@ -10,8 +10,7 @@
:search-form="searchForm">
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
<el-button size="small"
type="primary"
@click="handleSearch">
查询
......@@ -61,6 +60,7 @@ export default {
yqMerchantNameStr: "",
orderMerchantName: "",
inventoryType: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -128,10 +128,19 @@ export default {
optionLabel: "confValue",
optionsName: "inventoryTypeList",
},
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
],
getListApi: getInventoryTransactionRecordsPage,
// 表格参数
tableParams: {
needUnique: true,
mutiSelectUniqueKey: "uniqueVal",
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
......@@ -145,6 +154,11 @@ export default {
prop: "upgradeGoodsName",
},
{
label: "产品ID",
prop: "commodityCode",
width: 100,
},
{
label: "产品编码",
prop: "productCode",
},
......@@ -372,7 +386,10 @@ export default {
productCode: "",
businessCode: "",
queryFlowTypes: [],
yqMerchantNameStr: "",
orderMerchantName: "",
inventoryType: "",
commodityCode: "",
};
this.$refs.purchasementReviewTable.refreshTable(true);
},
......
......@@ -208,6 +208,12 @@ export default {
optionId: "confId",
optionLabel: "confValue",
optionsName: "inventoryTypeList",
}, {
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
}],
getListApi: getMerchantGoodsStockReduceRecord,
tableParams: {
......@@ -226,6 +232,10 @@ export default {
prop: "upgradeGoodsName",
width: "160px",
}, {
label: "产品ID",
prop: "commodityCode",
width: 100,
}, {
label: "规格",
prop: "specificationData",
width: "160px",
......
......@@ -57,6 +57,7 @@ import {
yqRelatedList,
} from "@api/stockManage";
import { mapActions, mapState } from "vuex";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
// import allocationDetailDialog from "../transferOperationsReviewDetailDialog"
export default {
......@@ -70,6 +71,7 @@ export default {
userInfo: this.$store.state.d2admin.user.info,
searchForm: {
allocateCode: "",
commodityCode: "",
callInName: "",
billStatus: "",
deliveryStatus: "",
......@@ -90,6 +92,7 @@ export default {
maxlength: "20",
isClear: true,
},
createProductIdFilter(),
{
label: "调入仓库",
name: "callInName",
......@@ -351,6 +354,7 @@ export default {
handleReset() {
this.searchForm = {
allocateCode: "",
commodityCode: "",
callInName: "",
billStatus: "",
deliveryStatus: "",
......
......@@ -245,6 +245,7 @@ import {
stockAllocateInfo,
stockAllocateOperatorReject,
} from "@api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
......@@ -310,6 +311,7 @@ export default {
label: "产品名称",
prop: "goodsName",
},
createProductIdColumn(),
{
label: "产品编码",
prop: "productCode",
......
......@@ -279,6 +279,7 @@ import {
stockAllocateOperatorAudit,
stockAllocateYqMerchantList,
} from "@api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main";
import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
......@@ -320,6 +321,7 @@ export default {
label: "产品名称",
prop: "goodsName",
},
createProductIdColumn(),
{
label: "产品编码",
prop: "productCode",
......
......@@ -57,6 +57,7 @@ import {
yqRelatedList,
} from "@api/stockManage";
import { mapActions, mapState } from "vuex";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util";
// import allocationDetailDialog from "../transferOperationsReviewDetailDialog"
export default {
......@@ -70,6 +71,7 @@ export default {
userInfo: this.$store.state.d2admin.user.info,
searchForm: {
allocateCode: "",
commodityCode: "",
callInName: "",
billStatus: "",
deliveryStatus: "",
......@@ -90,6 +92,7 @@ export default {
maxlength: "20",
isClear: true,
},
createProductIdFilter(),
{
label: "调入仓库",
name: "callInName",
......@@ -345,6 +348,7 @@ export default {
handleReset() {
this.searchForm = {
allocateCode: "",
commodityCode: "",
callInName: "",
billStatus: "",
deliveryStatus: "",
......
<!-- 调拨发货 -->
<template>
<d2-container class="container">
<template #header>
<div class="header">
<d2-search ref="showSearch" class="show-search" :form-data="showFormData" :search-form="searchForm">
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" handle size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
</template>
<div class="d2-container-content">
<d2-table-header>
<span>
<!-- 导出暂时不做 -->
<!-- <span style="margin-right: 10px">
<d2-container class="container">
<template #header>
<div class="header">
<d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
:search-form="searchForm">
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary"
handle>
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
</template>
<div class="d2-container-content">
<d2-table-header>
<span>
<!-- 导出暂时不做 -->
<!-- <span style="margin-right: 10px">
<auth-button category="Button" :show-btn-ids="['9081101']" />
</span> -->
<auth-button category="Button" :show-btn-ids="['9081102']" />
</span>
</d2-table-header>
<d2-table ref="transferShipmentTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi"
:search-form="tableSearchForm" :selectable-fn="selectableFn" :table-data="tableData"
:table-params="tableParams" @selectionTable="handleSelectionChange">
<template #receiver="scope">
<div v-if="scope.scope.receiver">
<el-popover v-if="scope.scope.receiver.length > 12" effect="dark" placement="top" trigger="hover"
width="300">
<div class="merchant-name-box">
{{ spanFilter(scope.scope.receiver) }}
</div>
<template #reference>
<div>
{{ spanFilter(scope.scope.receiver, 12) }}
</div>
</template>
</el-popover>
<div v-else>
{{ scope.scope.receiver }}
</div>
</div>
<span v-else>-</span>
</template>
<template #address="scope">
<div v-if="scope.scope.address">
<el-popover v-if="scope.scope.address.length > 12" effect="dark" placement="top" trigger="hover"
width="300">
<div class="merchant-name-box">
{{ spanFilter(scope.scope.address) }}
</div>
<template #reference>
<div>
{{ spanFilter(scope.scope.address, 12) }}
</div>
</template>
</el-popover>
<div v-else>
{{ scope.scope.address }}
</div>
</div>
<span v-else>-</span>
</template>
<template #auth-button="scope">
<div>
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9081103']" />
</span>
<span v-if="scope.scope.deliveryStatus != 2 && scope.scope.billStatus != 7"
style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9081104']" />
</span>
<auth-button v-if="scope.scope.billStatus != 7 && scope.scope.deliveryStatus == 1"
:data="scope.scope" :show-btn-ids="['9081105']" />
</div>
</template>
</d2-table>
</div>
<ShipmentDialog v-if="shipmentVisible" :params-obj="shipmentDialogData" :table-list="shipmentTableList"
:visible.sync="shipmentVisible" @shipmentClose="shipmentDialogClose">
</ShipmentDialog>
<RejectDialog v-if="rejectVisible" :reject-data="rejectData" :visible.sync="rejectVisible"
@rejectClose="handleRejectClose">
</RejectDialog>
<TransferDetailDialog v-if="transferDetailVisible" :params-obj="transferObj" :visible.sync="transferDetailVisible">
</TransferDetailDialog>
</d2-container>
<auth-button category="Button" :show-btn-ids="['9081102']" />
</span>
</d2-table-header>
<d2-table ref="transferShipmentTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="tableSearchForm"
:selectable-fn="selectableFn"
:table-data="tableData"
:table-params="tableParams"
@selectionTable="handleSelectionChange">
<template #receiver="scope">
<div v-if="scope.scope.receiver">
<el-popover v-if="scope.scope.receiver.length > 12"
effect="dark"
placement="top"
trigger="hover"
width="300">
<div class="merchant-name-box">
{{ spanFilter(scope.scope.receiver) }}
</div>
<template #reference>
<div>
{{ spanFilter(scope.scope.receiver, 12) }}
</div>
</template>
</el-popover>
<div v-else>
{{ scope.scope.receiver }}
</div>
</div>
<span v-else>-</span>
</template>
<template #address="scope">
<div v-if="scope.scope.address">
<el-popover v-if="scope.scope.address.length > 12"
effect="dark"
placement="top"
trigger="hover"
width="300">
<div class="merchant-name-box">
{{ spanFilter(scope.scope.address) }}
</div>
<template #reference>
<div>
{{ spanFilter(scope.scope.address, 12) }}
</div>
</template>
</el-popover>
<div v-else>
{{ scope.scope.address }}
</div>
</div>
<span v-else>-</span>
</template>
<template #auth-button="scope">
<div>
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9081103']" />
</span>
<span v-if="scope.scope.deliveryStatus != 2 && scope.scope.billStatus != 7"
style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9081104']" />
</span>
<auth-button v-if="scope.scope.billStatus != 7 && scope.scope.deliveryStatus == 1"
:data="scope.scope"
:show-btn-ids="['9081105']" />
</div>
</template>
</d2-table>
</div>
<ShipmentDialog v-if="shipmentVisible"
:params-obj="shipmentDialogData"
:table-list="shipmentTableList"
:visible.sync="shipmentVisible"
@shipmentClose="shipmentDialogClose">
</ShipmentDialog>
<RejectDialog v-if="rejectVisible"
:reject-data="rejectData"
:visible.sync="rejectVisible"
@rejectClose="handleRejectClose">
</RejectDialog>
<TransferDetailDialog v-if="transferDetailVisible"
:params-obj="transferObj"
:visible.sync="transferDetailVisible">
</TransferDetailDialog>
</d2-container>
</template>
<script>
......@@ -117,6 +142,7 @@ export default {
goodsName: "",
productCode: "",
callOutName: "",
commodityCode: "",
},
tableSearchForm: {},
tableData: [],
......@@ -166,13 +192,20 @@ export default {
type: "input",
isClear: true,
},
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
],
getListApi: getTransferShipmentList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
mutiSelectUniqueKey: "id",
mutiSelectUniqueKey: "detailId",
mutiSelectName: "list",
tableOption: {
width: "140",
......@@ -193,6 +226,11 @@ export default {
prop: "goodsName",
},
{
label: "产品ID",
prop: "commodityCode",
width: 100,
},
{
label: "产品编码",
prop: "productCode",
},
......@@ -422,8 +460,9 @@ export default {
},
shipmentDialogClose(obj) {
this.shipmentVisible = false;
if (obj)
if (obj) {
this.$refs.transferShipmentTable.refreshTable(true);
}
},
// 查看详情
handleDetail(row) {
......@@ -454,8 +493,9 @@ export default {
},
handleRejectClose(obj) {
this.rejectVisible = false;
if (obj)
if (obj) {
this.$refs.transferShipmentTable.refreshTable(true);
}
},
},
};
......
......@@ -12,9 +12,9 @@
:search-form="searchForm">
<template #filmRollNo>
<el-input v-model.trim="searchForm.filmRollNo"
placeholder="请输入膜卷号"
:clearable="true"
:maxlength="50"
placeholder="请输入膜卷号"
:style="{ width: '100%' }"
@input="filmRollNoInput" />
</template>
......@@ -179,6 +179,12 @@ export default {
}, {
label: "膜卷号",
addHtml: "filmRollNo",
}, {
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
}],
getListApi: getGoodsWarehousingList,
tableParams: {
......@@ -197,6 +203,10 @@ export default {
prop: "upgradeGoodsName",
width: "160px",
}, {
label: "产品ID",
prop: "commodityCode",
width: 100,
}, {
label: "规格",
prop: "specificationData",
width: "160px",
......
......@@ -60,7 +60,7 @@
{{ getSelectText(i) }}
</template>
<template v-else>
{{ componentData[i.key] || '-' }}
{{ formatViewText(componentData[i.key]) }}
</template>
</template>
......@@ -118,7 +118,7 @@
{{ (i.options.find(o => o.value === componentData[i.key]) && i.options.find(o => o.value === componentData[i.key]).label) || '-' }}
</template>
<template v-else>
{{ componentData[i.key] || '-' }}
{{ formatViewText(componentData[i.key]) }}
</template>
</template>
</el-form-item>
......@@ -159,7 +159,7 @@
label-width="100px"
:prop="isViewMode ? '' : `guaranteeList.${itemIdx}.guaranteeStandard`"
:rules="{ required: true, message: '请输入兜底标准', trigger: 'change' }">
<span v-if="isViewMode">{{ item.guaranteeStandard || '-' }}{{ isRateIndicator(item.guaranteeIndex) ? '%' : '' }}</span>
<span v-if="isViewMode">{{ item.guaranteeStandard }}{{ isRateIndicator(item.guaranteeIndex) ? '%' : '' }}</span>
<el-input v-else
v-model="item.guaranteeStandard"
placeholder="请输入"
......@@ -539,6 +539,12 @@ export default {
}
},
methods: {
formatViewText(value) {
if (value === null || value === undefined || value === "") {
return "-";
}
return String(value);
},
// 获取兜底指标列表
getBackstopData() {
const baseSceneCode = this.baseSceneCode;
......
......@@ -25,6 +25,15 @@ describe("mapDetailResponse", () => {
expect(detail.bizTypeName).toBe("延保");
});
it("详情应使用精确场景码识别二手车", () => {
const detail = mapDetailResponse({
sceneType: 7,
baseSceneCode: 120101,
});
expect(detail.bizType).toBe(7);
expect(detail.bizTypeName).toBe("二手车");
});
it("列表业务兜底应优先于旧 sceneType 映射", () => {
const detail = mapDetailResponse(
{ sceneType: "0" },
......
......@@ -24,6 +24,12 @@ describe("mapOverviewRow", () => {
expect(row.bizType).toBe(2);
});
it("二手车场景应映射为列表业务大类文案", () => {
const row = mapOverviewRow({ sceneType: "7" });
expect(row.bizTypeName).toBe("二手车");
expect(row.bizType).toBe(7);
});
it("应保留详情显隐需要的品牌和场景上下文", () => {
const row = mapOverviewRow({
brandIds: [3454, 3503],
......
......@@ -7,10 +7,15 @@ describe("mapSceneType", () => {
[100101, { bizType: 1, bizTypeName: "轻改" }],
[110201, { bizType: "延保", bizTypeName: "延保" }],
[110101, { bizType: 2, bizTypeName: "权益" }],
[120101, { bizType: 7, bizTypeName: "二手车" }],
])("场景码 %s 应映射到对应业务大类", (baseSceneCode, expected) => {
expect(mapSceneType("0", { baseSceneCode })).toEqual(expected);
});
it("缺少精确场景码时应使用二手车 sceneType 回显", () => {
expect(mapSceneType("7")).toEqual({ bizType: 7, bizTypeName: "二手车" });
});
it("sceneList 精确场景码应优先于旧 sceneType", () => {
expect(mapSceneType("0", {
sceneList: [{ baseSceneCode: 110202 }],
......
const fs = require("fs");
const os = require("os");
const path = require("path");
const webpack = require("webpack");
const PROJECT_ROOT = path.resolve(__dirname, "../../..");
const VIEW_IMPORTER = path.resolve(PROJECT_ROOT, "src/libs/util.import.production.js");
globalThis.setImmediate ||= (callback, ...args) => setTimeout(callback, 0, ...args);
globalThis.clearImmediate ||= handle => clearTimeout(handle);
function writeFixture(filePath, content) {
fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, content, "utf8");
}
function compileProductionViewContext() {
const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), "dj-view-context-"));
const sourceRoot = path.join(fixtureRoot, "src");
const outputPath = path.join(fixtureRoot, "dist");
writeFixture(
path.join(sourceRoot, "libs/util.import.production.js"),
fs.readFileSync(VIEW_IMPORTER, "utf8"),
);
writeFixture(
path.join(sourceRoot, "views/realPage.js"),
"module.exports = 'real page';\n",
);
writeFixture(
path.join(sourceRoot, "views/buildBreaker.spec.js"),
"module.exports = require('fs');\n",
);
writeFixture(
path.join(sourceRoot, "views/buildBreaker.test.js"),
"module.exports = require('path');\n",
);
writeFixture(
path.join(fixtureRoot, "entry.js"),
"const loadView = require('./src/libs/util.import.production');\nloadView('realPage');\n",
);
return new Promise((resolve, reject) => {
webpack({
mode: "development",
target: "web",
cache: false,
entry: path.join(fixtureRoot, "entry.js"),
output: {
path: outputPath,
filename: "bundle.js",
},
resolve: {
alias: {
"@": sourceRoot,
},
extensions: [".js"],
},
optimization: {
minimize: false,
},
}, (error, stats) => {
const result = stats?.toJson({ all: false, errors: true });
fs.rmSync(fixtureRoot, { recursive: true, force: true });
if (error) {
reject(error);
return;
}
if (result.errors.length) {
reject(new Error(result.errors.map(item => item.message).join("\n")));
return;
}
resolve();
});
});
}
describe("production view import context", () => {
it("excludes spec and test modules from the browser bundle", async () => {
await expect(compileProductionViewContext()).resolves.toBeUndefined();
});
});
const fs = require("fs");
const path = require("path");
const SOURCE_ROOT = path.resolve(__dirname, "../../../../src");
function readSource(file) {
return fs.readFileSync(path.resolve(SOURCE_ROOT, file), "utf8");
}
describe("purchase and transfer approval product ID coverage", () => {
it.each([
"views/purchase/procurementReview.vue",
"views/purchase/managerReview.vue",
"views/purchase/directorReview.vue",
"views/purchase/procurementBusiness.vue",
"views/stockManage/transferOperationsReview/index.vue",
"views/stockManage/transferCommercialReview/index.vue",
])("adds the product ID filter to %s", (file) => {
const source = readSource(file);
expect(source).toContain("commodityCode: \"");
expect(source).toContain("createProductIdFilter()");
});
it.each([
"views/purchase/components/orderDetailDialog.vue",
"views/purchase/components/CheckDialog.vue",
"views/purchase/components/rejectDialog.vue",
"views/purchase/singleReview.vue",
"views/purchase/singleBusinessReview.vue",
"views/stockManage/components/transferDetailDialog.vue",
"views/stockManage/transferOperationsReview/handleReview.vue",
"views/stockManage/transferOperationsReview/handleReject.vue",
])("adds the product ID column to %s", (file) => {
const source = readSource(file);
const tableConfig = source.slice(source.indexOf("tableColumns:"));
const productNameIndex = Math.max(
tableConfig.indexOf("label: \"产品名称\""),
tableConfig.indexOf("label: '产品名称'"),
);
const productIdIndex = tableConfig.indexOf("createProductIdColumn()");
expect(productNameIndex).toBeGreaterThanOrEqual(0);
expect(productIdIndex).toBeGreaterThan(productNameIndex);
});
it.each([
"views/stockManage/transferOperationsReview/index.vue",
"views/stockManage/transferCommercialReview/index.vue",
])("keeps product ID in the reset model for %s", (file) => {
const source = readSource(file);
expect(source.match(/commodityCode: ""/g)).toHaveLength(2);
});
it("keeps the film-roll column anchored before the car column", () => {
const detailSource = readSource("views/purchase/components/orderDetailDialog.vue");
expect(detailSource).toContain("item => item.prop === \"carName\"");
expect(detailSource).not.toContain("tableColumns.splice(5, 0");
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!