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 1313 additions and 296 deletions
This diff could not be displayed because it is too large.
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
{ {
"kind": "route", "kind": "route",
"path": "src/views/purchase/singleReview.vue", "path": "src/views/purchase/singleReview.vue",
"line": 408, "line": 410,
"column": 3, "column": 3,
"reason": "dynamic-expression", "reason": "dynamic-expression",
"note": "返回目标由来源页运行时决定" "note": "返回目标由来源页运行时决定"
......
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- when: never
stages: stages:
- verify - verify
default: ci_disabled:
stage: verify stage: verify
before_script: when: manual
- 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')}" allow_failure: true
- 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'
script: script:
- npm run test:unit -- --ci - echo "CI is temporarily disabled because no GitLab Runner is available."
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
"env": "develop", "env": "develop",
"swaggerPath": "/swagger-rop/api-docs", "swaggerPath": "/swagger-rop/api-docs",
"snapshot": "src/libs/rop/__snapshots__/smartcarlife.swagger.json", "snapshot": "src/libs/rop/__snapshots__/smartcarlife.swagger.json",
"sha256": "5324f2c256ac54fadecd80e69111ebc407eb74e0535168973441680019e19ac7", "sha256": "cbc17da14d9e2a5197a3355d5237d824c1b52ff61a1e0a2567be0b9371fccf04",
"syncedAt": "2026-08-21T09:21:56.374Z", "syncedAt": "2026-09-02T09:12:01.448Z",
"methodCount": 1633 "methodCount": 1633
} }
] ]
......
const SCENE_TYPE_MAP = { const SCENE_TYPE_MAP = {
0: { bizType: 2, bizTypeName: "权益" }, 0: { bizType: 2, bizTypeName: "权益" },
1: { bizType: 1, bizTypeName: "轻改" }, 1: { bizType: 1, bizTypeName: "轻改" },
7: { bizType: 7, bizTypeName: "二手车" },
}; };
const SCENE_CODE_MAP = { const SCENE_CODE_MAP = {
...@@ -11,6 +12,7 @@ const SCENE_CODE_MAP = { ...@@ -11,6 +12,7 @@ const SCENE_CODE_MAP = {
110102: { bizType: 2, bizTypeName: "权益" }, 110102: { bizType: 2, bizTypeName: "权益" },
110201: { bizType: "延保", bizTypeName: "延保" }, 110201: { bizType: "延保", bizTypeName: "延保" },
110202: { bizType: "延保", bizTypeName: "延保" }, 110202: { bizType: "延保", bizTypeName: "延保" },
120101: { bizType: 7, bizTypeName: "二手车" },
}; };
export function collectSceneCodes(value) { export function collectSceneCodes(value) {
......
...@@ -371,3 +371,10 @@ export function getCourseCategoryList(data = {}) { ...@@ -371,3 +371,10 @@ export function getCourseCategoryList(data = {}) {
data.method = `${path}servicecenter.course.category.list`; data.method = `${path}servicecenter.course.category.list`;
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
* 等级考试-根据职务查询品牌筛选选项
*/
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 ...@@ -26,6 +26,7 @@ import { applicableModelTypeList, BaseData, priceUnitTypeList } from '@/common/c
import { deepClone } from '@/common/util' import { deepClone } from '@/common/util'
import { baseConfig } from '@/main' import { baseConfig } from '@/main'
import { convertYuanToWan } from '@/views/goods/filterOption' import { convertYuanToWan } from '@/views/goods/filterOption'
import { pickSkuShelfRelations } from "./goodsStatus";
import sourceMaterial from './sourceMaterial.vue' import sourceMaterial from './sourceMaterial.vue'
import specifications from './specifications.vue' import specifications from './specifications.vue'
...@@ -185,7 +186,7 @@ export default { ...@@ -185,7 +186,7 @@ export default {
serviceItemArr: val.upgradeGoodsServiceItemsList || [], serviceItemArr: val.upgradeGoodsServiceItemsList || [],
extendServiceItemArr: val.upgradeGoodsServiceItemsList || [], extendServiceItemArr: val.upgradeGoodsServiceItemsList || [],
entityCardFlag: val.entityCardFlag == 'Y', entityCardFlag: val.entityCardFlag == 'Y',
merchantGoodsInfos: val?.merchantGoodsInfos, ...pickSkuShelfRelations(val),
djCost: val.djCost, djCost: val.djCost,
// 编辑产品价格输入框限制 // 编辑产品价格输入框限制
oldupgradePrice: val.upgradePrice, 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- ...@@ -181,6 +181,7 @@ import ApplicableAreaQuerySelect from "@/views/goods/components/applicable-area-
import drawerDetail from "./drawerDetail.vue"; import drawerDetail from "./drawerDetail.vue";
import drawerSkuDetail from "./drawerSkuDetail.vue"; import drawerSkuDetail from "./drawerSkuDetail.vue";
import drawerUpdate from "./drawerUpdate.vue"; import drawerUpdate from "./drawerUpdate.vue";
import { createGoodsStatusOptions, formatGoodsStatus } from "./goodsStatus";
export default { export default {
name: "Commodity", name: "Commodity",
...@@ -486,12 +487,7 @@ export default { ...@@ -486,12 +487,7 @@ export default {
}[cellValue.status]; }[cellValue.status];
}, },
formatter: (cellValue) => { formatter: (cellValue) => {
return { return formatGoodsStatus(cellValue.status);
0: "待上架",
1: "上架",
2: "部分上架",
3: "草稿",
}[cellValue.status];
}, },
}, },
{ {
...@@ -522,24 +518,7 @@ export default { ...@@ -522,24 +518,7 @@ export default {
// 基本数据 // 基本数据
baseData: { baseData: {
productTypeList: [], productTypeList: [],
statusList: [ statusList: createGoodsStatusOptions(),
{
confId: 0,
confValue: "待上架",
},
{
confId: 1,
confValue: "上架",
},
{
confId: 2,
confValue: "部分上架",
},
{
confId: 3,
confValue: "草稿",
},
],
supplierCodeList: [], // 供应方 supplierCodeList: [], // 供应方
brandMerchantCodeList: [], // 品牌方 brandMerchantCodeList: [], // 品牌方
showSkuListOptions: [ showSkuListOptions: [
......
...@@ -512,7 +512,7 @@ ...@@ -512,7 +512,7 @@
</td> </td>
<td style="width: 60px"> <td style="width: 60px">
<el-button type="text" <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)"> @click="delspecificationValueList(row.originalIndex)">
删除 删除
</el-button> </el-button>
...@@ -763,6 +763,7 @@ import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVi ...@@ -763,6 +763,7 @@ import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVi
// import ApplicableAreaSelect from "@/views/goods/components/applicable-area-select/index.vue"; // import ApplicableAreaSelect from "@/views/goods/components/applicable-area-select/index.vue";
import carSeriesDialog from "./carSeriesDialog.vue"; import carSeriesDialog from "./carSeriesDialog.vue";
import extendServiceItemsDialog from "./extendServiceItemsDialog.vue"; import extendServiceItemsDialog from "./extendServiceItemsDialog.vue";
import { hasSkuShelfRelations, pickSkuShelfRelations } from "./goodsStatus";
import serviceItemsDialog from "./serviceItemsDialog.vue"; import serviceItemsDialog from "./serviceItemsDialog.vue";
import specsManage from "./specsManage.vue"; import specsManage from "./specsManage.vue";
import SupplierSelect from "./SupplierSelect.vue"; import SupplierSelect from "./SupplierSelect.vue";
...@@ -1035,6 +1036,7 @@ export default { ...@@ -1035,6 +1036,7 @@ export default {
}, },
}, },
methods: { methods: {
hasSkuShelfRelations,
// ========== 批量赋值方法 ========== // ========== 批量赋值方法 ==========
/** /**
* 批量设置产品编码 * 批量设置产品编码
...@@ -2031,6 +2033,7 @@ export default { ...@@ -2031,6 +2033,7 @@ export default {
item.supplySource = temp.supplySource; item.supplySource = temp.supplySource;
item.remark = temp.remark; item.remark = temp.remark;
item.merchantGoodsExist = temp.merchantGoodsExist; item.merchantGoodsExist = temp.merchantGoodsExist;
Object.assign(item, pickSkuShelfRelations(temp));
break; break;
} }
} }
......
...@@ -496,7 +496,7 @@ ...@@ -496,7 +496,7 @@
<td style="width: 60px"> <td style="width: 60px">
<el-button type="text" <el-button type="text"
:disabled="row.item.merchantGoodsInfos && row.item.merchantGoodsInfos.length > 0" :disabled="hasSkuShelfRelations(row.item)"
@click="delgoodsSpecificationSingleList(row.originalIndex)"> @click="delgoodsSpecificationSingleList(row.originalIndex)">
删除 删除
</el-button> </el-button>
...@@ -650,6 +650,7 @@ import useResizableColumns from "@/views/goods/productManage/mixins/useResizable ...@@ -650,6 +650,7 @@ import useResizableColumns from "@/views/goods/productManage/mixins/useResizable
import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVirtualScroll"; import useTableVirtualScroll from "@/views/goods/productManage/mixins/useTableVirtualScroll";
import carSeriesDialog from "./carSeriesDialog.vue"; import carSeriesDialog from "./carSeriesDialog.vue";
import extendServiceItemsDialog from "./extendServiceItemsDialog.vue"; import extendServiceItemsDialog from "./extendServiceItemsDialog.vue";
import { hasSkuShelfRelations } from "./goodsStatus";
import serviceItemsDialog from "./serviceItemsDialog.vue"; import serviceItemsDialog from "./serviceItemsDialog.vue";
import SupplierSelect from "./SupplierSelect.vue"; import SupplierSelect from "./SupplierSelect.vue";
...@@ -851,6 +852,7 @@ export default { ...@@ -851,6 +852,7 @@ export default {
}); });
}, },
methods: { methods: {
hasSkuShelfRelations,
...mapMutations("goodsInfoData", ["setUpdateGoodsInfo"]), ...mapMutations("goodsInfoData", ["setUpdateGoodsInfo"]),
...mapActions({ ...mapActions({
get: "d2admin/base/get", 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 @@ ...@@ -107,7 +107,7 @@
<auth-button :data="scope.scope" :show-btn-ids="['9031407']" /> <auth-button :data="scope.scope" :show-btn-ids="['9031407']" />
</span> </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']" /> <auth-button :data="scope.scope" :show-btn-ids="['9031404']" />
</span> </span>
<!-- 上架/下架 --> <!-- 上架/下架 -->
...@@ -154,6 +154,8 @@ import { baseConfig } from '@/main' ...@@ -154,6 +154,8 @@ import { baseConfig } from '@/main'
import batchCopyDialog from './components/batchCopyDialog.vue' import batchCopyDialog from './components/batchCopyDialog.vue'
import { getBatchPriceSelectionSummary, hasUnsupportedPurchaseCostType } from './utils/batchPrice' import { getBatchPriceSelectionSummary, hasUnsupportedPurchaseCostType } from './utils/batchPrice'
import { getPurchaseCostTypeText, purchaseCostTypeList } from './utils/purchaseCost' import { getPurchaseCostTypeText, purchaseCostTypeList } from './utils/purchaseCost'
import { canDeletePurchaseGoods } from "./utils/purchaseGoodsStatus";
export default { export default {
components: { batchCopyDialog }, components: { batchCopyDialog },
name: 'PurchaseOnShelves', name: 'PurchaseOnShelves',
...@@ -641,6 +643,7 @@ export default { ...@@ -641,6 +643,7 @@ export default {
}), }),
...mapMutations('d2admin/user', ['setUpdateRefesh']), ...mapMutations('d2admin/user', ['setUpdateRefesh']),
...mapActions('d2admin/user', ['actionSetDownloadList']), ...mapActions('d2admin/user', ['actionSetDownloadList']),
canDeletePurchaseGoods,
selectAddAttr(value) { selectAddAttr(value) {
this.searchForm.goodsType = value?.[0] this.searchForm.goodsType = value?.[0]
this.searchForm.secondaryGoodsType = value?.[1] 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 { ...@@ -102,6 +102,7 @@ import {
operatorreviewOperatorAudit, operatorreviewOperatorAudit,
operatorreviewView, operatorreviewView,
} from "@/api/purchaseShopping.js"; } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue"; import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
...@@ -191,6 +192,7 @@ export default { ...@@ -191,6 +192,7 @@ export default {
addHtml: "upgradeGoodsName", addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
createProductIdColumn(),
{ {
label: "供应商名称", label: "供应商名称",
prop: 'thirdPartyName', prop: 'thirdPartyName',
......
...@@ -350,6 +350,11 @@ export default { ...@@ -350,6 +350,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称", label: "供应商名称",
prop: "thirdPartyName", prop: "thirdPartyName",
width: 100, width: 100,
...@@ -683,8 +688,9 @@ export default { ...@@ -683,8 +688,9 @@ export default {
"goodsType", "goodsType",
"goodsTypeName", "goodsTypeName",
]; ];
if (this.page == "factory") if (this.page == "factory") {
delete params.shippingWarehouseId; delete params.shippingWarehouseId;
}
for (let idx = 0; idx < this.tableList.length; idx++) { for (let idx = 0; idx < this.tableList.length; idx++) {
const item = this.tableList[idx]; const item = this.tableList[idx];
if (this.nowPurNumList[idx] && this.nowPurNumList[idx] != 0) { if (this.nowPurNumList[idx] && this.nowPurNumList[idx] != 0) {
......
<!-- 发货单详情弹窗 --> <!-- 发货单详情弹窗 -->
<template> <template>
<div> <div>
<d2-dialog title="详细信息" :is-visible="detailVisible" class="stockMonthDailog" width="1400px" :no-cancel="true" <d2-dialog btn-ok-label="关闭"
btn-ok-label="关闭" @closeDialog="handleClose" @confirmDialog="handleClose"> class="stockMonthDailog"
title="详细信息"
width="1400px"
:is-visible="detailVisible"
:no-cancel="true"
@closeDialog="handleClose"
@confirmDialog="handleClose">
<div class="detail-info"> <div class="detail-info">
<div> <div>
发货单号: 发货单号:
...@@ -25,9 +31,13 @@ ...@@ -25,9 +31,13 @@
<div class="detail-info m-b-33" style="justify-content: flex-start; align-items: flex-start;"> <div class="detail-info m-b-33" style="justify-content: flex-start; align-items: flex-start;">
签收凭证: 签收凭证:
<div v-if="detailInfo.uploadFileUrl"> <div v-if="detailInfo.uploadFileUrl">
<el-image v-for="(url, index) in detailInfo.uploadFileUrl.split(',')" :key="index" :src="url" <el-image v-for="(url, index) in detailInfo.uploadFileUrl.split(',')"
:key="index"
class="sign-image"
fit="cover"
style="width: 36px; height: 36px; margin-right: 8px; cursor: pointer;"
:preview-src-list="detailInfo.uploadFileUrl.split(',')" :preview-src-list="detailInfo.uploadFileUrl.split(',')"
style="width: 36px; height: 36px; margin-right: 8px; cursor: pointer;" class="sign-image" fit="cover" /> :src="url" />
</div> </div>
<div v-else> <div v-else>
- -
...@@ -41,9 +51,15 @@ ...@@ -41,9 +51,15 @@
<span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{ item.specificationData }}</span> <span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{ item.specificationData }}</span>
</div> </div>
<div> <div>
产品ID:
<span>{{ item.upgradeCommodityCode }}</span>
</div>
<div>
发货数量: 发货数量:
<span>{{ item.purchaseNumber + (membraneTypeList.includes(item.goodsType) ? '卷' : '件') }}</span> <span>{{ item.purchaseNumber + (membraneTypeList.includes(item.goodsType) ? '卷' : '件') }}</span>
<el-button v-if="item.deliveryCardList && item.deliveryCardList.length > 0" type="text" class="lookNumber" <el-button v-if="item.deliveryCardList && item.deliveryCardList.length > 0"
class="lookNumber"
type="text"
@click="lookNumber(item.deliveryCardList)"> @click="lookNumber(item.deliveryCardList)">
查看卡号 查看卡号
</el-button> </el-button>
...@@ -53,19 +69,26 @@ ...@@ -53,19 +69,26 @@
<span>{{ item.stockNum + (membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span> <span>{{ item.stockNum + (membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span>
</div> </div>
</div> </div>
<d2-table v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0" ref="recordTable" <d2-table v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0"
:table-data="item.goodsWarehousingList" :table-params="tableParams" :has-page="false"> ref="recordTable"
:has-page="false"
:table-data="item.goodsWarehousingList"
:table-params="tableParams">
<template #filmRollNo="scope"> <template #filmRollNo="scope">
<div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1"> <div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1">
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1"> <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1">
<el-popover placement="top" width="200" trigger="hover"> <el-popover placement="top"
trigger="hover"
width="200">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title"> <div class="title">
膜卷号 膜卷号
</div> </div>
<div v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex" class="merchant-item"> <div v-for="(subItem, subIndex) in scope.scope.filmRollList"
:key="subIndex"
class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
</div> </div>
...@@ -87,10 +110,18 @@ ...@@ -87,10 +110,18 @@
</div> </div>
</template> </template>
</d2-dialog> </d2-dialog>
<d2-dialog title="查看发货卡号" :is-visible="innerVisible" width="500px" :no-cancel="true" btn-ok-label="关闭" <d2-dialog btn-ok-label="关闭"
@closeDialog="innerVisible = false" @confirmDialog="innerVisible = false"> title="查看发货卡号"
<d2-table ref="recordTable" class="deliveryCardCon" :table-data="tableDataCardList" :table-params="innerParams" width="500px"
:has-page="false"> :is-visible="innerVisible"
:no-cancel="true"
@closeDialog="innerVisible = false"
@confirmDialog="innerVisible = false">
<d2-table ref="recordTable"
class="deliveryCardCon"
:has-page="false"
:table-data="tableDataCardList"
:table-params="innerParams">
</d2-table> </d2-table>
</d2-dialog> </d2-dialog>
</div> </div>
......
...@@ -170,6 +170,7 @@ import { ...@@ -170,6 +170,7 @@ import {
operatorreviewView, operatorreviewView,
purchaseOrderDetail, purchaseOrderDetail,
} from "@/api/purchaseShopping.js"; } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import ExamineRecord from "./examineRecord.vue"; import ExamineRecord from "./examineRecord.vue";
...@@ -224,6 +225,7 @@ export default { ...@@ -224,6 +225,7 @@ export default {
addHtml: "upgradeGoodsName", addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
createProductIdColumn(),
{ {
label: "供应商名称", label: "供应商名称",
prop: "thirdPartyName", prop: "thirdPartyName",
...@@ -402,7 +404,10 @@ export default { ...@@ -402,7 +404,10 @@ export default {
} }
// 采购订单-自采入库显示膜卷号 // 采购订单-自采入库显示膜卷号
if (this.showFilmRollNo) { 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: "膜卷号", label: "膜卷号",
prop: "filmRollNo", prop: "filmRollNo",
type: "slot", type: "slot",
......
...@@ -105,6 +105,7 @@ import { ...@@ -105,6 +105,7 @@ import {
operatorreviewView, operatorreviewView,
purchaseOrderReject, purchaseOrderReject,
} from "@/api/purchaseShopping.js"; } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue"; import StockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
...@@ -184,6 +185,7 @@ export default { ...@@ -184,6 +185,7 @@ export default {
addHtml: "upgradeGoodsName", addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
createProductIdColumn(),
{ {
label: "供应商名称", label: "供应商名称",
prop: 'thirdPartyName', prop: 'thirdPartyName',
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
</template> </template>
<script> <script>
import { createProductIdFilter } from "@/common/productId";
import { Util, deepClone } from '@/common/util' import { Util, deepClone } from '@/common/util'
import { director_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, director_statusOptions_table } from './constant' import { director_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, director_statusOptions_table } from './constant'
import { mapActions, mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
...@@ -54,7 +55,8 @@ export default { ...@@ -54,7 +55,8 @@ export default {
merchantName: '', merchantName: '',
sortType: 2, sortType: 2,
orderTimeStr: [], orderTimeStr: [],
purchasingPattern: '' purchasingPattern: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -65,6 +67,7 @@ export default { ...@@ -65,6 +67,7 @@ export default {
type: 'input', type: 'input',
isClear: true isClear: true
}, },
createProductIdFilter(),
{ {
label: '下单时间', label: '下单时间',
name: 'placeOrderTimeStr', name: 'placeOrderTimeStr',
...@@ -382,4 +385,3 @@ export default { ...@@ -382,4 +385,3 @@ export default {
} }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -3,11 +3,17 @@ ...@@ -3,11 +3,17 @@
<d2-container class="container"> <d2-container class="container">
<template #header> <template #header>
<div class="header"> <div class="header">
<d2-search ref="showSearch" :labelWidth="labelWidth" class="show-search" :form-data="showFormData" <d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
:label-width="labelWidth"
:search-form="searchForm"> :search-form="searchForm">
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" handle size="small" type="primary"> <el-button :id="tableParams.btnId"
size="small"
type="primary"
handle>
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> <el-button size="small" @click="handleReset">
...@@ -25,18 +31,27 @@ ...@@ -25,18 +31,27 @@
<auth-button category="Button" :show-btn-ids="['9090704']" /> <auth-button category="Button" :show-btn-ids="['9090704']" />
</span> </span>
</d2-table-header> </d2-table-header>
<d2-table ref="purchaseAndDeliveryTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" <d2-table ref="purchaseAndDeliveryTable"
:search-form="tableSearchForm" :table-params="tableParams" @searchChange="searchChange" :before-search-fn="beforeSearchFn"
@selectionTable="handleSelectionTable" @setTableFinishFun="setTableFinishFun"> :get-list-api="getListApi"
:search-form="tableSearchForm"
:table-params="tableParams"
@searchChange="searchChange"
@selectionTable="handleSelectionTable"
@setTableFinishFun="setTableFinishFun">
<template #upgradeGoodsName="scope"> <template #upgradeGoodsName="scope">
<div> <div>
<img v-if="scope.scope.refundStatus == 'Y'" alt="" class="return" src="@/assets/retrun.png"> <img v-if="scope.scope.refundStatus == 'Y'"
alt=""
class="return"
src="@/assets/retrun.png">
<span>{{ scope.scope.upgradeGoodsName }}</span> <span>{{ scope.scope.upgradeGoodsName }}</span>
</div> </div>
</template> </template>
<template #suitCarTypeList="scope"> <template #suitCarTypeList="scope">
<div> <div>
<el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length" effect="dark" <el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length"
effect="dark"
placement="top"> placement="top">
<template #content> <template #content>
<div class="car-type-list"> <div class="car-type-list">
...@@ -58,8 +73,7 @@ ...@@ -58,8 +73,7 @@
</span> </span>
<!-- 确认发货 --> <!-- 确认发货 -->
<!-- style="margin-right: 10px;" --> <!-- style="margin-right: 10px;" -->
<span <span v-if="scope.scope.refundStatus != 'Y' && (scope.scope.deliveryStatus == 1 || scope.scope.deliveryStatus == 3)"
v-if="scope.scope.refundStatus != 'Y' && (scope.scope.deliveryStatus == 1 || scope.scope.deliveryStatus == 3)"
style="margin-right: 10px;"> style="margin-right: 10px;">
<auth-button :data="scope.scope" :show-btn-ids="['9090702']" /> <auth-button :data="scope.scope" :show-btn-ids="['9090702']" />
</span> </span>
...@@ -77,20 +91,36 @@ ...@@ -77,20 +91,36 @@
</template> </template>
</d2-table> </d2-table>
</div> </div>
<FactoryDeliveryDetailDialog v-if="detailVisible" :record-info="detailInfo" :visible.sync="detailVisible"> <FactoryDeliveryDetailDialog v-if="detailVisible"
:record-info="detailInfo"
:visible.sync="detailVisible">
</FactoryDeliveryDetailDialog> </FactoryDeliveryDetailDialog>
<EditOrderDialog v-if="editVisible" page="factory" :params-obj="dialogData" :table-list="editTableList" <EditOrderDialog v-if="editVisible"
:visible.sync="editVisible" @editClose="editClose"> page="factory"
:params-obj="dialogData"
:table-list="editTableList"
:visible.sync="editVisible"
@editClose="editClose">
</EditOrderDialog> </EditOrderDialog>
<!-- :config="rejectConfig.setting" :dialog-config="rejectConfig.config" :config="rejectConfig.setting" --> <!-- :config="rejectConfig.setting" :dialog-config="rejectConfig.config" :config="rejectConfig.setting" -->
<baseDialog :dialog-config="rejectConfig.config" :is-show.sync="rejectVisible" @handleClick="handleRejectConfirm"> <baseDialog :dialog-config="rejectConfig.config"
:is-show.sync="rejectVisible"
@handleClick="handleRejectConfirm">
<!-- <d2-dialog v-if="rejectVisible" :is-visible="rejectVisible" title="驳回提2" @confirmDialog="handleRejectConfirm" <!-- <d2-dialog v-if="rejectVisible" :is-visible="rejectVisible" title="驳回提2" @confirmDialog="handleRejectConfirm"
@closeDialog="handleRejectClose"> --> @closeDialog="handleRejectClose"> -->
<div class="reject-dialog"> <div class="reject-dialog">
<el-form ref="delivery-dialog-form" label-width="150px" :model="rejectData" :rules="rejectRules"> <el-form ref="delivery-dialog-form"
label-width="150px"
:model="rejectData"
:rules="rejectRules">
<el-form-item label="驳回原因:" prop="rejectCause"> <el-form-item label="驳回原因:" prop="rejectCause">
<el-input v-model.trim="rejectData.rejectCause" class="dis-in-block reject-input" maxlength="50" <el-input v-model.trim="rejectData.rejectCause"
placeholder="请输入驳回原因" :rows="3" show-word-limit type="textarea" /> class="dis-in-block reject-input"
maxlength="50"
placeholder="请输入驳回原因"
type="textarea"
show-word-limit
:rows="3" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -121,7 +151,7 @@ export default { ...@@ -121,7 +151,7 @@ export default {
}, },
data() { data() {
return { return {
labelWidth: '100px', labelWidth: "100px",
editVisible: false, editVisible: false,
editTableList: [], editTableList: [],
reg: { reg: {
...@@ -154,6 +184,7 @@ export default { ...@@ -154,6 +184,7 @@ export default {
merchantName: "", merchantName: "",
deliveryStatus: "", deliveryStatus: "",
sendOutMerchantName: "", sendOutMerchantName: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -225,18 +256,26 @@ export default { ...@@ -225,18 +256,26 @@ export default {
isClear: true, isClear: true,
}, },
{ {
label: '供应商名称', label: "供应商名称",
name: 'thirdPartyName', name: "thirdPartyName",
type: 'input', type: "input",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList keyFn: this.keyDowmGetList,
}, { },
label: '供应商编码', {
name: 'thirdPartyCode', label: "供应商编码",
type: 'input', name: "thirdPartyCode",
type: "input",
isClear: true, isClear: true,
keyFn: this.keyDowmGetList keyFn: this.keyDowmGetList,
} },
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
], ],
selectedList: [], selectedList: [],
getListApi: warehousedeliverPage, getListApi: warehousedeliverPage,
...@@ -254,9 +293,14 @@ export default { ...@@ -254,9 +293,14 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: '供应商名称', label: "产品ID",
prop: 'thirdPartyName', prop: "upgradeGoodsCommodityCode",
width: 100 width: 100,
},
{
label: "供应商名称",
prop: "thirdPartyName",
width: 100,
}, },
{ {
label: "产品编码", label: "产品编码",
...@@ -276,9 +320,9 @@ export default { ...@@ -276,9 +320,9 @@ export default {
}, },
}, },
{ {
label: '供应商编码', label: "供应商编码",
prop: 'thirdPartyCode', prop: "thirdPartyCode",
width: 100 width: 100,
}, },
{ {
label: "系列", label: "系列",
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
<script> <script>
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { getManagerReviewPageApi, getMerchantList, managerreviewManagerAudit, managerReviewReject } from "@/api/purchaseShopping.js"; import { getManagerReviewPageApi, getMerchantList, managerreviewManagerAudit, managerReviewReject } from "@/api/purchaseShopping.js";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import CheckDialog from "./components/CheckDialog"; import CheckDialog from "./components/CheckDialog";
import orderDeatilDialog from "./components/orderDetailDialog"; import orderDeatilDialog from "./components/orderDetailDialog";
...@@ -92,6 +93,7 @@ export default { ...@@ -92,6 +93,7 @@ export default {
sortType: 2, sortType: 2,
orderTimeStr: [], orderTimeStr: [],
purchasingPattern: "", purchasingPattern: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -102,6 +104,7 @@ export default { ...@@ -102,6 +104,7 @@ export default {
type: "input", type: "input",
isClear: true, isClear: true,
}, },
createProductIdFilter(),
{ {
label: "下单时间", label: "下单时间",
name: "placeOrderTimeStr", name: "placeOrderTimeStr",
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
</template> </template>
<script> <script>
import { createProductIdFilter } from "@/common/productId";
import { Util, deepClone } from '@/common/util' import { Util, deepClone } from '@/common/util'
import { business_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, business_statusOptions_table } from './constant' import { business_statusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchasingPatternOptions, business_statusOptions_table } from './constant'
import { mapActions, mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
...@@ -79,7 +80,8 @@ export default { ...@@ -79,7 +80,8 @@ export default {
sortType: 2, sortType: 2,
orderTimeStr: [], orderTimeStr: [],
purchasingPattern: '', purchasingPattern: '',
onlyAllocateOrder: false onlyAllocateOrder: false,
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -90,6 +92,7 @@ export default { ...@@ -90,6 +92,7 @@ export default {
type: 'input', type: 'input',
isClear: true isClear: true
}, },
createProductIdFilter(),
{ {
label: '下单时间', label: '下单时间',
name: 'placeOrderTimeStr', name: 'placeOrderTimeStr',
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<script> <script>
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { getMerchantList, getPurchaseOrderList, operatorreviewOperatorAudit, operatorreviewPage, purchaseOrderCancelOrCheck } from "@/api/purchaseShopping.js"; import { getMerchantList, getPurchaseOrderList, operatorreviewOperatorAudit, operatorreviewPage, purchaseOrderCancelOrCheck } from "@/api/purchaseShopping.js";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import CheckDialog from "./components/CheckDialog"; import CheckDialog from "./components/CheckDialog";
import orderDeatilDialog from "./components/orderDetailDialog"; import orderDeatilDialog from "./components/orderDetailDialog";
...@@ -97,6 +98,7 @@ export default { ...@@ -97,6 +98,7 @@ export default {
sortType: 2, sortType: 2,
orderTimeStr: [], orderTimeStr: [],
purchasingPattern: "", purchasingPattern: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -107,6 +109,7 @@ export default { ...@@ -107,6 +109,7 @@ export default {
type: "input", type: "input",
isClear: true, isClear: true,
}, },
createProductIdFilter(),
{ {
label: "下单时间", label: "下单时间",
name: "placeOrderTimeStr", name: "placeOrderTimeStr",
......
...@@ -416,6 +416,11 @@ export default { ...@@ -416,6 +416,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称", label: "供应商名称",
prop: "thirdPartyName", prop: "thirdPartyName",
width: 100, width: 100,
...@@ -518,6 +523,7 @@ export default { ...@@ -518,6 +523,7 @@ export default {
signStatusList: [], signStatusList: [],
thirdPartyName: "", thirdPartyName: "",
thirdPartyCode: "", thirdPartyCode: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -652,6 +658,13 @@ export default { ...@@ -652,6 +658,13 @@ export default {
isClear: true, isClear: true,
keyFn: this.keyDowmGetList, keyFn: this.keyDowmGetList,
}, },
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
], ],
selectedList: [], selectedList: [],
getListApi: getPurchaseOrderShipmentList, getListApi: getPurchaseOrderShipmentList,
...@@ -669,6 +682,11 @@ export default { ...@@ -669,6 +682,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "产品ID",
prop: "upgradeGoodsCommodityCode",
width: 100,
},
{
label: "供应商名称", label: "供应商名称",
prop: "thirdPartyName", prop: "thirdPartyName",
width: 100, width: 100,
......
...@@ -178,6 +178,7 @@ import { ...@@ -178,6 +178,7 @@ import {
operatorreviewOperatorAudit, operatorreviewOperatorAudit,
operatorreviewView, operatorreviewView,
} from "@/api/purchaseShopping.js"; } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { import {
getyqMerchantList, getyqMerchantList,
getServicemerchantrefList getServicemerchantrefList
...@@ -264,6 +265,7 @@ export default { ...@@ -264,6 +265,7 @@ export default {
addHtml: "upgradeGoodsName", addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
createProductIdColumn(),
{ {
label: "供应商名称", label: "供应商名称",
prop: 'thirdPartyName', prop: 'thirdPartyName',
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<script> <script>
import { getShippingEntityInfoAll } from "@api/serviceManage"; import { getShippingEntityInfoAll } from "@api/serviceManage";
import { directorCheck, directorReject, operatorreviewView, purchaseOrderDetail } from "@/api/purchaseShopping.js"; import { directorCheck, directorReject, operatorreviewView, purchaseOrderDetail } from "@/api/purchaseShopping.js";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import ExamineRecord from "./components/examineRecord.vue"; import ExamineRecord from "./components/examineRecord.vue";
...@@ -120,6 +121,7 @@ export default { ...@@ -120,6 +121,7 @@ export default {
addHtml: "upgradeGoodsName", addHtml: "upgradeGoodsName",
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
createProductIdColumn(),
{ {
label: "供应商名称", label: "供应商名称",
prop: 'thirdPartyName', prop: 'thirdPartyName',
......
<template> <template>
<div class="left-container"> <div class="left-container">
<div class="data-view"> <div class="data-view">
<div v-for="item in submitArr" :key="item.name" class="item"> <div v-for="item in submitArr"
<div class="name">{{ item.name }}</div> :key="item.name"
<div class="value">{{ item.value(dataView) }}</div> class="item">
<div class="name">
{{ item.name }}
</div>
<div class="value">
{{ item.value(dataView) }}
</div>
</div> </div>
</div> </div>
<div class="examination-result"> <div class="examination-result">
<div class="title">考试结果等级分布</div> <div class="title">
<echart-bar 考试结果等级分布
</div>
<EchartBar id="resultRef"
class="echart" class="echart"
:xData="xData" :x-data="xData"
:yData="yData" :y-data="yData">
id="resultRef" </EchartBar>
></echart-bar>
<div class="hint"> <div class="hint">
<div <div v-for="(item, index) in queryData.examLevelDTOS"
v-for="(item, index) in queryData.examLevelDTOS"
class="item"
:key="index" :key="index"
> class="item">
<span>{{ item.levelName }}:</span> <span>{{ item.levelName }}:</span>
<span>{{ item.minScore + "-" + item.maxScore }}</span> <span>{{ `${item.minScore}-${item.maxScore}` }}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import echartBar from "./echartBar.vue" import echartBar from "./echartBar.vue";
export default { export default {
components: { echartBar }, components: { EchartBar: echartBar },
props: { props: {
dataView: { dataView: {
type: Object, type: Object,
default: () => {} default: () => {},
}, },
queryData: { queryData: {
type: Object, type: Object,
default: () => {} default: () => {},
}
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue)
}, },
deep: true,
immediate: true
}
}, },
data() { data() {
...@@ -57,37 +55,47 @@ export default { ...@@ -57,37 +55,47 @@ export default {
{ {
name: "已提交人数", name: "已提交人数",
value: (obj) => { value: (obj) => {
console.log(obj) console.log(obj);
return obj.submitted || obj.submitted === 0 ? obj.submitted : "-" return obj.submitted || obj.submitted === 0 ? obj.submitted : "-";
} },
}, },
{ {
name: "已提交人均得分", name: "已提交人均得分",
value: (obj) => { value: (obj) => {
return obj.avg || obj.avg === 0 ? obj.avg : "-" return obj.avg || obj.avg === 0 ? obj.avg : "-";
} },
} },
], ],
xData: [], xData: [],
yData: [] yData: [],
} };
},
watch: {
dataView: {
handler(newValue, oldValue) {
this.initEchartData(newValue);
},
deep: true,
immediate: true,
},
}, },
methods: { methods: {
initEchartData(data) { initEchartData(data) {
console.log(data) console.log(data);
let xData = [] let xData = [];
data.scoreDistributions.forEach((item) => { data.scoreDistributions.forEach((item) => {
xData.push(item.levelName) xData.push(item.levelName);
}) });
this.xData = xData this.xData = xData;
this.yData = data.scoreDistributions this.yData = data.scoreDistributions;
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.left-container { .left-container {
min-width: 800px; // min-width: 800px;
.data-view { .data-view {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -2,36 +2,45 @@ ...@@ -2,36 +2,45 @@
<template> <template>
<div class="dataView"> <div class="dataView">
<d2-container> <d2-container>
<div class="title">数据概览</div> <div class="title">
数据概览
</div>
<div class="content"> <div class="content">
<div class="left"> <div class="left">
<left-data-view <LeftDataView :data-view="dataViewObj"
:dataView="dataViewObj" :query-data="queryData">
:queryData="queryData" </LeftDataView>
></left-data-view>
</div> </div>
<div class="right"> <div class="right">
<right-data-view :dataView="dataViewObj"></right-data-view> <RightDataView :data-view="dataViewObj"></RightDataView>
</div> </div>
</div> </div>
<div class="database"> <div class="database">
<dataTable :dataView="dataViewObj" :queryData="queryData"> </dataTable> <DataTable :data-view="dataViewObj" :query-data="queryData">
</DataTable>
</div> </div>
</d2-container> </d2-container>
</div> </div>
</template> </template>
<script> <script>
import leftDataView from "./components/leftView.vue" import { getLevelExamOverView } from "@api/serviceCentre";
import rightDataView from "./components/rightView.vue" import dataTable from "./components/dataTable.vue";
import dataTable from "./components/dataTable.vue" import leftDataView from "./components/leftView.vue";
import { getLevelExamOverView } from "@api/serviceCentre" import rightDataView from "./components/rightView.vue";
export default { export default {
name: "dataView", name: "dataView",
components: { components: {
leftDataView, LeftDataView: leftDataView,
rightDataView, RightDataView: rightDataView,
dataTable DataTable: dataTable,
},
props: {
queryData: {
type: Object,
default: () => {},
},
}, },
data() { data() {
return { return {
...@@ -39,45 +48,39 @@ export default { ...@@ -39,45 +48,39 @@ export default {
submitted: 0, submitted: 0,
avg: 0, avg: 0,
topPersons: [], topPersons: [],
scoreDistributions: [] scoreDistributions: [],
}
}
}, },
props: { };
queryData: {
type: Object,
default: () => {}
}
}, },
watch: { watch: {
queryData: { queryData: {
handler(val) { handler(val) {
setTimeout(() => { setTimeout(() => {
this.getLevelExamOverViewData() this.getLevelExamOverViewData();
}, 0) }, 0);
}, },
deep: true, deep: true,
immediate: true immediate: true,
} },
}, },
mounted() { mounted() {
this.getLevelExamOverViewData() this.getLevelExamOverViewData();
}, },
methods: { methods: {
async getLevelExamOverViewData() { async getLevelExamOverViewData() {
try { try {
let params = { let params = {
id: this.queryData.id id: this.queryData.id,
} };
let result = await getLevelExamOverView(params) let result = await getLevelExamOverView(params);
console.log(result) console.log(result);
this.dataViewObj = result this.dataViewObj = result;
} catch (err) { } catch (err) {
this.$message.error(err?.message || "获取失败") this.$message.error(err?.message || "获取失败");
}
} }
} },
} },
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -97,6 +100,8 @@ export default { ...@@ -97,6 +100,8 @@ export default {
background: #ffffff; background: #ffffff;
padding: 16px 20px; padding: 16px 20px;
display: flex; display: flex;
width: 100%;
box-sizing: border-box;
.left { .left {
width: calc(100% - 376px); width: calc(100% - 376px);
} }
......
...@@ -158,6 +158,7 @@ ...@@ -158,6 +158,7 @@
<script> <script>
import { getTransferGoodsInfo, getTransferAuitInfo } from "@/api/stockManage"; import { getTransferGoodsInfo, getTransferAuitInfo } from "@/api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import { Util, deepClone } from "@/common/util"; import { Util, deepClone } from "@/common/util";
import EllipsisTooltip from "./EllipsisTooltip.vue"; import EllipsisTooltip from "./EllipsisTooltip.vue";
...@@ -251,6 +252,7 @@ export default { ...@@ -251,6 +252,7 @@ export default {
label: "产品名称", label: "产品名称",
prop: "goodsName", prop: "goodsName",
}, },
createProductIdColumn(),
{ {
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
:search-form="searchForm"> :search-form="searchForm">
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" <el-button size="small"
size="small"
type="primary" type="primary"
@click="handleSearch"> @click="handleSearch">
查询 查询
...@@ -61,6 +60,7 @@ export default { ...@@ -61,6 +60,7 @@ export default {
yqMerchantNameStr: "", yqMerchantNameStr: "",
orderMerchantName: "", orderMerchantName: "",
inventoryType: "", inventoryType: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -128,10 +128,19 @@ export default { ...@@ -128,10 +128,19 @@ export default {
optionLabel: "confValue", optionLabel: "confValue",
optionsName: "inventoryTypeList", optionsName: "inventoryTypeList",
}, },
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
], ],
getListApi: getInventoryTransactionRecordsPage, getListApi: getInventoryTransactionRecordsPage,
// 表格参数 // 表格参数
tableParams: { tableParams: {
needUnique: true,
mutiSelectUniqueKey: "uniqueVal",
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list", listName: "list",
tableColumns: [ tableColumns: [
...@@ -145,6 +154,11 @@ export default { ...@@ -145,6 +154,11 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
}, },
{ {
label: "产品ID",
prop: "commodityCode",
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
}, },
...@@ -372,7 +386,10 @@ export default { ...@@ -372,7 +386,10 @@ export default {
productCode: "", productCode: "",
businessCode: "", businessCode: "",
queryFlowTypes: [], queryFlowTypes: [],
yqMerchantNameStr: "",
orderMerchantName: "",
inventoryType: "", inventoryType: "",
commodityCode: "",
}; };
this.$refs.purchasementReviewTable.refreshTable(true); this.$refs.purchasementReviewTable.refreshTable(true);
}, },
......
...@@ -208,6 +208,12 @@ export default { ...@@ -208,6 +208,12 @@ export default {
optionId: "confId", optionId: "confId",
optionLabel: "confValue", optionLabel: "confValue",
optionsName: "inventoryTypeList", optionsName: "inventoryTypeList",
}, {
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
}], }],
getListApi: getMerchantGoodsStockReduceRecord, getListApi: getMerchantGoodsStockReduceRecord,
tableParams: { tableParams: {
...@@ -226,6 +232,10 @@ export default { ...@@ -226,6 +232,10 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
width: "160px", width: "160px",
}, { }, {
label: "产品ID",
prop: "commodityCode",
width: 100,
}, {
label: "规格", label: "规格",
prop: "specificationData", prop: "specificationData",
width: "160px", width: "160px",
......
<!-- 发货单详情弹窗 --> <!-- 发货单详情弹窗 -->
<template> <template>
<div> <div>
<d2-dialog title="详细信息" :is-visible="detailVisible" class="stockMonthDailog" width="1400px" :no-cancel="true" :isShowFooter="false" @closeDialog="handleClose" @confirmDialog="handleClose"> <d2-dialog class="stockMonthDailog"
title="详细信息"
width="1400px"
:is-show-footer="false"
:is-visible="detailVisible"
:no-cancel="true"
@closeDialog="handleClose"
@confirmDialog="handleClose">
<div class="address-info"> <div class="address-info">
<div class="info-item" v-for="(item, index) in infoList" :key="index" :class="{ 'remark-item': item.isRemark }"> <div v-for="(item, index) in infoList"
:key="index"
class="info-item"
:class="{ 'remark-item': item.isRemark }">
<span class="label-name">{{ item.label }}:</span> <span class="label-name">{{ item.label }}:</span>
<ellipsis-tooltip class="label-value" :content="detailInfo[item.prop]" /> <EllipsisTooltip class="label-value" :content="detailInfo[item.prop]" />
</div> </div>
</div> </div>
<template v-for="(item, index) in detailInfo.deliveryDetailList"> <template v-for="(item, index) in detailInfo.deliveryDetailList">
<div class="table-wrap" :key="index"> <div :key="index" class="table-wrap">
<div class="detail-info border-b"> <div class="detail-info border-b">
<div class="item wid-40"> <div class="item wid-40">
产品名称: 产品名称:
<span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{item.specificationData}}</span> <span>{{ item.upgradeGoodsName }}&nbsp;&nbsp;&nbsp;&nbsp; {{ item.specificationData }}</span>
</div> </div>
<div class="item wid-30"> <div class="item wid-20">
产品ID:
<span>{{ item.upgradeCommodityCode }}</span>
</div>
<div class="item wid-20">
发货数量: 发货数量:
<span>{{ item.purchaseNumber + (baseConfig.membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span> <span>{{ item.purchaseNumber + (baseConfig.membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span>
</div> </div>
<div class="item wid-30"> <div class="item wid-20">
可用库存数量: 可用库存数量:
<span>{{ item.stockNum + (baseConfig.membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span> <span>{{ item.stockNum + (baseConfig.membraneTypeList.includes(item.goodsType) ? '米' : '件') }}</span>
</div> </div>
</div> </div>
<d2-table ref="recordTable" v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0" :table-data="item.goodsWarehousingList" :table-params="tableParams" :has-page="false"> <d2-table v-if="item.deliveryCardList === null || item.deliveryCardList.length == 0"
ref="recordTable"
:has-page="false"
:table-data="item.goodsWarehousingList"
:table-params="tableParams">
<template slot="filmRollNo" slot-scope="scope"> <template slot="filmRollNo" slot-scope="scope">
<div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1"> <div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1">
{{ scope.scope.filmRollList[0] }} {{ scope.scope.filmRollList[0] }}
</div> </div>
<div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1"> <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1">
<el-popover placement="top" width="200" trigger="hover"> <el-popover placement="top"
trigger="hover"
width="200">
<div class="film-roll-box"> <div class="film-roll-box">
<div class="title">膜卷号</div> <div class="title">
<div class="merchant-item" v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex"> 膜卷号
</div>
<div v-for="(subItem, subIndex) in scope.scope.filmRollList"
:key="subIndex"
class="merchant-item">
{{ subItem }} {{ subItem }}
</div> </div>
</div> </div>
...@@ -57,13 +81,27 @@ ...@@ -57,13 +81,27 @@
</template> </template>
<script> <script>
import { Util, deepClone } from '@/common/util' import { mapActions, mapState } from "vuex";
import { mapActions, mapState } from 'vuex' import { getDeliveryDetail } from "@/api/stockManage.js";
import { getDeliveryDetail } from '@/api/stockManage.js' import { deepClone, Util } from "@/common/util";
import { baseConfig } from '@/main' import { baseConfig } from "@/main";
import EllipsisTooltip from '../../components/EllipsisTooltip.vue' import EllipsisTooltip from "../../components/EllipsisTooltip.vue";
export default { export default {
name: 'DeliveryDetailDialog', name: "DeliveryDetailDialog",
components: {
EllipsisTooltip,
},
props: {
detailVisible: {
type: Boolean,
default: false,
},
recordInfo: {
type: Object,
default: () => { },
},
},
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
...@@ -71,108 +109,95 @@ export default { ...@@ -71,108 +109,95 @@ export default {
searchFormSearch: {}, searchFormSearch: {},
// tableData: [], // tableData: [],
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: 'list', listName: "list",
// singleSelectUniqueKey: 'id', // singleSelectUniqueKey: 'id',
tableOption: false, tableOption: false,
tableColumns: [{ tableColumns: [{
label: '入库数量', label: "入库数量",
prop: 'increaseStockNum', prop: "increaseStockNum",
// width: '200px' // width: '200px'
formatter: (cellValue) => { formatter: (cellValue) => {
return (cellValue.increaseStockNum || cellValue.increaseStockNum == 0) ? (baseConfig.membraneTypeList.includes(cellValue.goodsType) ? parseFloat(cellValue.increaseStockNum / cellValue.alternateUnits).toFixed(2) : parseFloat(cellValue.increaseStockNum).toFixed(2)) + (baseConfig.membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-' return (cellValue.increaseStockNum || cellValue.increaseStockNum == 0) ? (baseConfig.membraneTypeList.includes(cellValue.goodsType) ? Number.parseFloat(cellValue.increaseStockNum / cellValue.alternateUnits).toFixed(2) : Number.parseFloat(cellValue.increaseStockNum).toFixed(2)) + (baseConfig.membraneTypeList.includes(cellValue.goodsType) ? "米" : "件") : "-";
} },
}, { }, {
label: '膜卷号', label: "膜卷号",
name: '', name: "",
type: 'slot', type: "slot",
addHtml: 'filmRollNo' addHtml: "filmRollNo",
}, { }, {
label: '入库仓库', label: "入库仓库",
prop: 'yqMerchantName' prop: "yqMerchantName",
// width: '150px' // width: '150px'
}, { }, {
label: '入库门店', label: "入库门店",
prop: 'merchantName' prop: "merchantName",
// width: '200px' // width: '200px'
}] }],
}, },
baseData: {}, baseData: {},
infoList: [ infoList: [
{ label: '收货人', prop: 'contactName' }, { label: "收货人", prop: "contactName" },
{ label: '收货人电话', prop: 'contactPhone' }, { label: "收货人电话", prop: "contactPhone" },
{ label: '收货地址', prop: 'contactAddress' }, { label: "收货地址", prop: "contactAddress" },
{ label: '发货单号', prop: 'deliveryNumber' }, { label: "发货单号", prop: "deliveryNumber" },
{ label: '发货仓库', prop: 'shippingWarehouseName' }, { label: "发货仓库", prop: "shippingWarehouseName" },
{ label: '承运公司', prop: 'deliveryCompany' }, { label: "承运公司", prop: "deliveryCompany" },
{ label: '发货时间', prop: 'deliveryDate' } { label: "发货时间", prop: "deliveryDate" },
] ],
} };
},
components: {
EllipsisTooltip
},
props: {
detailVisible: {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => { }
}
}, },
computed: { computed: {
}, },
mounted() { mounted() {
this.getDetail() this.getDetail();
}, },
methods: { methods: {
...mapActions({ ...mapActions({
get: 'd2admin/base/get', get: "d2admin/base/get",
close: 'd2admin/page/close' close: "d2admin/page/close",
}), }),
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm) this.searchFormSearch = deepClone(this.searchForm);
resolve() resolve();
}) });
}, },
getDetail() { getDetail() {
var params = { id: deepClone(this.recordInfo.id) } let params = { id: deepClone(this.recordInfo.id) };
getDeliveryDetail(params).then(res => { getDeliveryDetail(params).then((res) => {
this.detailInfo = res this.detailInfo = res;
if (this.detailInfo.deliveryDate) { if (this.detailInfo.deliveryDate) {
this.detailInfo.deliveryDate = Util.dateFormate(this.detailInfo.deliveryDate, 'YYYY-MM-DD HH:mm:ss') this.detailInfo.deliveryDate = Util.dateFormate(this.detailInfo.deliveryDate, "YYYY-MM-DD HH:mm:ss");
} }
const _deliveryDetailList = this.detailInfo.deliveryDetailList const _deliveryDetailList = this.detailInfo.deliveryDetailList;
if (_deliveryDetailList && _deliveryDetailList.length > 0) { if (_deliveryDetailList && _deliveryDetailList.length > 0) {
_deliveryDetailList.forEach(info => { _deliveryDetailList.forEach((info) => {
const _goodsWarehousingList = info.goodsWarehousingList const _goodsWarehousingList = info.goodsWarehousingList;
if (_goodsWarehousingList && _goodsWarehousingList.length > 0) { if (_goodsWarehousingList && _goodsWarehousingList.length > 0) {
_goodsWarehousingList.forEach(item => { _goodsWarehousingList.forEach((item) => {
item.goodsType = info.goodsType item.goodsType = info.goodsType;
// 换算单位 // 换算单位
item.alternateUnits = info?.stockNum / info?.purchaseNumber item.alternateUnits = info?.stockNum / info?.purchaseNumber;
}) });
} }
}) });
} }
}) });
}, },
handleClose() { handleClose() {
this.$emit('dialogClose') this.$emit("dialogClose");
} },
}
}
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.detail-info { .detail-info {
display: flex; display: flex;
...@@ -188,8 +213,8 @@ export default { ...@@ -188,8 +213,8 @@ export default {
.wid-40 { .wid-40 {
width: 40%; width: 40%;
} }
.wid-30 { .wid-20 {
width: 30%; width: 20%;
} }
span { span {
color: #333333ff; color: #333333ff;
......
...@@ -57,6 +57,7 @@ import { ...@@ -57,6 +57,7 @@ import {
yqRelatedList, yqRelatedList,
} from "@api/stockManage"; } from "@api/stockManage";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
// import allocationDetailDialog from "../transferOperationsReviewDetailDialog" // import allocationDetailDialog from "../transferOperationsReviewDetailDialog"
export default { export default {
...@@ -70,6 +71,7 @@ export default { ...@@ -70,6 +71,7 @@ export default {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
searchForm: { searchForm: {
allocateCode: "", allocateCode: "",
commodityCode: "",
callInName: "", callInName: "",
billStatus: "", billStatus: "",
deliveryStatus: "", deliveryStatus: "",
...@@ -90,6 +92,7 @@ export default { ...@@ -90,6 +92,7 @@ export default {
maxlength: "20", maxlength: "20",
isClear: true, isClear: true,
}, },
createProductIdFilter(),
{ {
label: "调入仓库", label: "调入仓库",
name: "callInName", name: "callInName",
...@@ -351,6 +354,7 @@ export default { ...@@ -351,6 +354,7 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
allocateCode: "", allocateCode: "",
commodityCode: "",
callInName: "", callInName: "",
billStatus: "", billStatus: "",
deliveryStatus: "", deliveryStatus: "",
......
...@@ -245,6 +245,7 @@ import { ...@@ -245,6 +245,7 @@ import {
stockAllocateInfo, stockAllocateInfo,
stockAllocateOperatorReject, stockAllocateOperatorReject,
} from "@api/stockManage"; } from "@api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue"; import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
...@@ -310,6 +311,7 @@ export default { ...@@ -310,6 +311,7 @@ export default {
label: "产品名称", label: "产品名称",
prop: "goodsName", prop: "goodsName",
}, },
createProductIdColumn(),
{ {
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
......
...@@ -279,6 +279,7 @@ import { ...@@ -279,6 +279,7 @@ import {
stockAllocateOperatorAudit, stockAllocateOperatorAudit,
stockAllocateYqMerchantList, stockAllocateYqMerchantList,
} from "@api/stockManage"; } from "@api/stockManage";
import { createProductIdColumn } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import { baseConfig } from "@/main"; import { baseConfig } from "@/main";
import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue"; import stockDetailDialog from "@/views/stockManage/components/stockDetailDialog.vue";
...@@ -320,6 +321,7 @@ export default { ...@@ -320,6 +321,7 @@ export default {
label: "产品名称", label: "产品名称",
prop: "goodsName", prop: "goodsName",
}, },
createProductIdColumn(),
{ {
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
......
...@@ -57,6 +57,7 @@ import { ...@@ -57,6 +57,7 @@ import {
yqRelatedList, yqRelatedList,
} from "@api/stockManage"; } from "@api/stockManage";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { createProductIdFilter } from "@/common/productId";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
// import allocationDetailDialog from "../transferOperationsReviewDetailDialog" // import allocationDetailDialog from "../transferOperationsReviewDetailDialog"
export default { export default {
...@@ -70,6 +71,7 @@ export default { ...@@ -70,6 +71,7 @@ export default {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
searchForm: { searchForm: {
allocateCode: "", allocateCode: "",
commodityCode: "",
callInName: "", callInName: "",
billStatus: "", billStatus: "",
deliveryStatus: "", deliveryStatus: "",
...@@ -90,6 +92,7 @@ export default { ...@@ -90,6 +92,7 @@ export default {
maxlength: "20", maxlength: "20",
isClear: true, isClear: true,
}, },
createProductIdFilter(),
{ {
label: "调入仓库", label: "调入仓库",
name: "callInName", name: "callInName",
...@@ -345,6 +348,7 @@ export default { ...@@ -345,6 +348,7 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
allocateCode: "", allocateCode: "",
commodityCode: "",
callInName: "", callInName: "",
billStatus: "", billStatus: "",
deliveryStatus: "", deliveryStatus: "",
......
...@@ -3,10 +3,16 @@ ...@@ -3,10 +3,16 @@
<d2-container class="container"> <d2-container class="container">
<template #header> <template #header>
<div class="header"> <div class="header">
<d2-search ref="showSearch" class="show-search" :form-data="showFormData" :search-form="searchForm"> <d2-search ref="showSearch"
class="show-search"
:form-data="showFormData"
:search-form="searchForm">
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" handle size="small" type="primary"> <el-button :id="tableParams.btnId"
size="small"
type="primary"
handle>
查询 查询
</el-button> </el-button>
<el-button size="small" @click="handleReset"> <el-button size="small" @click="handleReset">
...@@ -25,12 +31,20 @@ ...@@ -25,12 +31,20 @@
<auth-button category="Button" :show-btn-ids="['9081102']" /> <auth-button category="Button" :show-btn-ids="['9081102']" />
</span> </span>
</d2-table-header> </d2-table-header>
<d2-table ref="transferShipmentTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" <d2-table ref="transferShipmentTable"
:search-form="tableSearchForm" :selectable-fn="selectableFn" :table-data="tableData" :before-search-fn="beforeSearchFn"
:table-params="tableParams" @selectionTable="handleSelectionChange"> :get-list-api="getListApi"
:search-form="tableSearchForm"
:selectable-fn="selectableFn"
:table-data="tableData"
:table-params="tableParams"
@selectionTable="handleSelectionChange">
<template #receiver="scope"> <template #receiver="scope">
<div v-if="scope.scope.receiver"> <div v-if="scope.scope.receiver">
<el-popover v-if="scope.scope.receiver.length > 12" effect="dark" placement="top" trigger="hover" <el-popover v-if="scope.scope.receiver.length > 12"
effect="dark"
placement="top"
trigger="hover"
width="300"> width="300">
<div class="merchant-name-box"> <div class="merchant-name-box">
{{ spanFilter(scope.scope.receiver) }} {{ spanFilter(scope.scope.receiver) }}
...@@ -49,7 +63,10 @@ ...@@ -49,7 +63,10 @@
</template> </template>
<template #address="scope"> <template #address="scope">
<div v-if="scope.scope.address"> <div v-if="scope.scope.address">
<el-popover v-if="scope.scope.address.length > 12" effect="dark" placement="top" trigger="hover" <el-popover v-if="scope.scope.address.length > 12"
effect="dark"
placement="top"
trigger="hover"
width="300"> width="300">
<div class="merchant-name-box"> <div class="merchant-name-box">
{{ spanFilter(scope.scope.address) }} {{ spanFilter(scope.scope.address) }}
...@@ -76,18 +93,26 @@ ...@@ -76,18 +93,26 @@
<auth-button :data="scope.scope" :show-btn-ids="['9081104']" /> <auth-button :data="scope.scope" :show-btn-ids="['9081104']" />
</span> </span>
<auth-button v-if="scope.scope.billStatus != 7 && scope.scope.deliveryStatus == 1" <auth-button v-if="scope.scope.billStatus != 7 && scope.scope.deliveryStatus == 1"
:data="scope.scope" :show-btn-ids="['9081105']" /> :data="scope.scope"
:show-btn-ids="['9081105']" />
</div> </div>
</template> </template>
</d2-table> </d2-table>
</div> </div>
<ShipmentDialog v-if="shipmentVisible" :params-obj="shipmentDialogData" :table-list="shipmentTableList" <ShipmentDialog v-if="shipmentVisible"
:visible.sync="shipmentVisible" @shipmentClose="shipmentDialogClose"> :params-obj="shipmentDialogData"
:table-list="shipmentTableList"
:visible.sync="shipmentVisible"
@shipmentClose="shipmentDialogClose">
</ShipmentDialog> </ShipmentDialog>
<RejectDialog v-if="rejectVisible" :reject-data="rejectData" :visible.sync="rejectVisible" <RejectDialog v-if="rejectVisible"
:reject-data="rejectData"
:visible.sync="rejectVisible"
@rejectClose="handleRejectClose"> @rejectClose="handleRejectClose">
</RejectDialog> </RejectDialog>
<TransferDetailDialog v-if="transferDetailVisible" :params-obj="transferObj" :visible.sync="transferDetailVisible"> <TransferDetailDialog v-if="transferDetailVisible"
:params-obj="transferObj"
:visible.sync="transferDetailVisible">
</TransferDetailDialog> </TransferDetailDialog>
</d2-container> </d2-container>
</template> </template>
...@@ -117,6 +142,7 @@ export default { ...@@ -117,6 +142,7 @@ export default {
goodsName: "", goodsName: "",
productCode: "", productCode: "",
callOutName: "", callOutName: "",
commodityCode: "",
}, },
tableSearchForm: {}, tableSearchForm: {},
tableData: [], tableData: [],
...@@ -166,13 +192,20 @@ export default { ...@@ -166,13 +192,20 @@ export default {
type: "input", type: "input",
isClear: true, isClear: true,
}, },
{
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
},
], ],
getListApi: getTransferShipmentList, getListApi: getTransferShipmentList,
// 表格参数 // 表格参数
tableParams: { tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list", listName: "list",
mutiSelectUniqueKey: "id", mutiSelectUniqueKey: "detailId",
mutiSelectName: "list", mutiSelectName: "list",
tableOption: { tableOption: {
width: "140", width: "140",
...@@ -193,6 +226,11 @@ export default { ...@@ -193,6 +226,11 @@ export default {
prop: "goodsName", prop: "goodsName",
}, },
{ {
label: "产品ID",
prop: "commodityCode",
width: 100,
},
{
label: "产品编码", label: "产品编码",
prop: "productCode", prop: "productCode",
}, },
...@@ -422,8 +460,9 @@ export default { ...@@ -422,8 +460,9 @@ export default {
}, },
shipmentDialogClose(obj) { shipmentDialogClose(obj) {
this.shipmentVisible = false; this.shipmentVisible = false;
if (obj) if (obj) {
this.$refs.transferShipmentTable.refreshTable(true); this.$refs.transferShipmentTable.refreshTable(true);
}
}, },
// 查看详情 // 查看详情
handleDetail(row) { handleDetail(row) {
...@@ -454,8 +493,9 @@ export default { ...@@ -454,8 +493,9 @@ export default {
}, },
handleRejectClose(obj) { handleRejectClose(obj) {
this.rejectVisible = false; this.rejectVisible = false;
if (obj) if (obj) {
this.$refs.transferShipmentTable.refreshTable(true); this.$refs.transferShipmentTable.refreshTable(true);
}
}, },
}, },
}; };
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
:search-form="searchForm"> :search-form="searchForm">
<template #filmRollNo> <template #filmRollNo>
<el-input v-model.trim="searchForm.filmRollNo" <el-input v-model.trim="searchForm.filmRollNo"
placeholder="请输入膜卷号"
:clearable="true" :clearable="true"
:maxlength="50" :maxlength="50"
placeholder="请输入膜卷号"
:style="{ width: '100%' }" :style="{ width: '100%' }"
@input="filmRollNoInput" /> @input="filmRollNoInput" />
</template> </template>
...@@ -179,6 +179,12 @@ export default { ...@@ -179,6 +179,12 @@ export default {
}, { }, {
label: "膜卷号", label: "膜卷号",
addHtml: "filmRollNo", addHtml: "filmRollNo",
}, {
label: "产品ID",
name: "commodityCode",
type: "input",
isClear: true,
maxlength: 20,
}], }],
getListApi: getGoodsWarehousingList, getListApi: getGoodsWarehousingList,
tableParams: { tableParams: {
...@@ -197,6 +203,10 @@ export default { ...@@ -197,6 +203,10 @@ export default {
prop: "upgradeGoodsName", prop: "upgradeGoodsName",
width: "160px", width: "160px",
}, { }, {
label: "产品ID",
prop: "commodityCode",
width: 100,
}, {
label: "规格", label: "规格",
prop: "specificationData", prop: "specificationData",
width: "160px", width: "160px",
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
{{ getSelectText(i) }} {{ getSelectText(i) }}
</template> </template>
<template v-else> <template v-else>
{{ componentData[i.key] || '-' }} {{ formatViewText(componentData[i.key]) }}
</template> </template>
</template> </template>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
{{ (i.options.find(o => o.value === componentData[i.key]) && i.options.find(o => o.value === componentData[i.key]).label) || '-' }} {{ (i.options.find(o => o.value === componentData[i.key]) && i.options.find(o => o.value === componentData[i.key]).label) || '-' }}
</template> </template>
<template v-else> <template v-else>
{{ componentData[i.key] || '-' }} {{ formatViewText(componentData[i.key]) }}
</template> </template>
</template> </template>
</el-form-item> </el-form-item>
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
label-width="100px" label-width="100px"
:prop="isViewMode ? '' : `guaranteeList.${itemIdx}.guaranteeStandard`" :prop="isViewMode ? '' : `guaranteeList.${itemIdx}.guaranteeStandard`"
:rules="{ required: true, message: '请输入兜底标准', trigger: 'change' }"> :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 <el-input v-else
v-model="item.guaranteeStandard" v-model="item.guaranteeStandard"
placeholder="请输入" placeholder="请输入"
...@@ -539,6 +539,12 @@ export default { ...@@ -539,6 +539,12 @@ export default {
} }
}, },
methods: { methods: {
formatViewText(value) {
if (value === null || value === undefined || value === "") {
return "-";
}
return String(value);
},
// 获取兜底指标列表 // 获取兜底指标列表
getBackstopData() { getBackstopData() {
const baseSceneCode = this.baseSceneCode; const baseSceneCode = this.baseSceneCode;
......
...@@ -25,6 +25,15 @@ describe("mapDetailResponse", () => { ...@@ -25,6 +25,15 @@ describe("mapDetailResponse", () => {
expect(detail.bizTypeName).toBe("延保"); expect(detail.bizTypeName).toBe("延保");
}); });
it("详情应使用精确场景码识别二手车", () => {
const detail = mapDetailResponse({
sceneType: 7,
baseSceneCode: 120101,
});
expect(detail.bizType).toBe(7);
expect(detail.bizTypeName).toBe("二手车");
});
it("列表业务兜底应优先于旧 sceneType 映射", () => { it("列表业务兜底应优先于旧 sceneType 映射", () => {
const detail = mapDetailResponse( const detail = mapDetailResponse(
{ sceneType: "0" }, { sceneType: "0" },
......
...@@ -24,6 +24,12 @@ describe("mapOverviewRow", () => { ...@@ -24,6 +24,12 @@ describe("mapOverviewRow", () => {
expect(row.bizType).toBe(2); expect(row.bizType).toBe(2);
}); });
it("二手车场景应映射为列表业务大类文案", () => {
const row = mapOverviewRow({ sceneType: "7" });
expect(row.bizTypeName).toBe("二手车");
expect(row.bizType).toBe(7);
});
it("应保留详情显隐需要的品牌和场景上下文", () => { it("应保留详情显隐需要的品牌和场景上下文", () => {
const row = mapOverviewRow({ const row = mapOverviewRow({
brandIds: [3454, 3503], brandIds: [3454, 3503],
......
...@@ -7,10 +7,15 @@ describe("mapSceneType", () => { ...@@ -7,10 +7,15 @@ describe("mapSceneType", () => {
[100101, { bizType: 1, bizTypeName: "轻改" }], [100101, { bizType: 1, bizTypeName: "轻改" }],
[110201, { bizType: "延保", bizTypeName: "延保" }], [110201, { bizType: "延保", bizTypeName: "延保" }],
[110101, { bizType: 2, bizTypeName: "权益" }], [110101, { bizType: 2, bizTypeName: "权益" }],
[120101, { bizType: 7, bizTypeName: "二手车" }],
])("场景码 %s 应映射到对应业务大类", (baseSceneCode, expected) => { ])("场景码 %s 应映射到对应业务大类", (baseSceneCode, expected) => {
expect(mapSceneType("0", { baseSceneCode })).toEqual(expected); expect(mapSceneType("0", { baseSceneCode })).toEqual(expected);
}); });
it("缺少精确场景码时应使用二手车 sceneType 回显", () => {
expect(mapSceneType("7")).toEqual({ bizType: 7, bizTypeName: "二手车" });
});
it("sceneList 精确场景码应优先于旧 sceneType", () => { it("sceneList 精确场景码应优先于旧 sceneType", () => {
expect(mapSceneType("0", { expect(mapSceneType("0", {
sceneList: [{ baseSceneCode: 110202 }], 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!