|
@@ -1,6 +1,6 @@
|
|
|
import { ref, reactive, computed, toRefs, nextTick } from "vue";
|
|
|
import { ColumnProps } from "@/components/LjVxeTable/interface";
|
|
|
-import { GetSoftBedMxList, SaveSoftBedQuote } from "@/api/modules/quote";
|
|
|
+import { GetSoftBedMxList, SaveSoftBedQuote, GetSoftBedConfigureList } from "@/api/modules/quote";
|
|
|
import { ALLOW_EDIT_STATE } from "@/config/index";
|
|
|
import { ElButton, ElMessage, ElMessageBox, ElRow, ElCol, ElNotification } from "element-plus";
|
|
|
import { AuditSoftBedQuote, DeleteSoftBedQuote } from "@/api/modules/quote";
|
|
@@ -9,6 +9,7 @@ import { CommonDynamicSelect } from "@/api/modules/common";
|
|
|
import SoftBedSelect from "@/views/system/selector/softbedTemplate/select.vue";
|
|
|
import { cloneDeep } from "lodash-es";
|
|
|
import { getCurrentRecords } from "@/utils/index";
|
|
|
+import MtrldefSelect from "@/views/system/selector/mtrldefNoPrice/select.vue";
|
|
|
interface defaultState {
|
|
|
/**
|
|
|
* @description 单据当前状态
|
|
@@ -82,6 +83,13 @@ interface defaultState {
|
|
|
* @description 详情页部件配置选择弹窗
|
|
|
*/
|
|
|
showBedframe: boolean;
|
|
|
+ partsConfig: any;
|
|
|
+ headboardConfigOptions: any[];
|
|
|
+ nightstandConfigOptions: any[];
|
|
|
+ bedframeConfigOptions: any[];
|
|
|
+ configValueOptionsMap: any;
|
|
|
+ MtrldefDialogRef: any;
|
|
|
+ MtrldefDialogProps: any;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -107,7 +115,18 @@ export const useHooks = (t?: any) => {
|
|
|
showHeadboard: false,
|
|
|
showNightstand: false,
|
|
|
showBedframe: false,
|
|
|
- initParams: { arg_softbed_id: 0 }
|
|
|
+ initParams: { arg_softbed_id: 0 },
|
|
|
+ partsConfig: {
|
|
|
+ headboard: [],
|
|
|
+ nightstand: [],
|
|
|
+ bedframe: []
|
|
|
+ },
|
|
|
+ headboardConfigOptions: [],
|
|
|
+ nightstandConfigOptions: [],
|
|
|
+ bedframeConfigOptions: [],
|
|
|
+ configValueOptionsMap: {},
|
|
|
+ MtrldefDialogRef: null,
|
|
|
+ MtrldefDialogProps: {}
|
|
|
});
|
|
|
// 表格配置项
|
|
|
const columns: ColumnProps<any>[] = [
|
|
@@ -754,7 +773,9 @@ export const useHooks = (t?: any) => {
|
|
|
field: "allow_edit",
|
|
|
title: "业务修改",
|
|
|
width: 80,
|
|
|
- datatype: "checkbox"
|
|
|
+ align: "center",
|
|
|
+ datatype: "checkbox",
|
|
|
+ editRender: {}
|
|
|
},
|
|
|
{
|
|
|
field: "pzname",
|
|
@@ -775,8 +796,29 @@ export const useHooks = (t?: any) => {
|
|
|
field: "mtrlname",
|
|
|
title: "物料名称规格",
|
|
|
width: 400,
|
|
|
- render: (scope: any) => {
|
|
|
- return `${scope.row.mtrlname} ${scope.row.mtrlmode}`;
|
|
|
+ editRender: {},
|
|
|
+ editColRender: (scope: any) => {
|
|
|
+ const { $table, column, row } = scope;
|
|
|
+ let _label = column.title;
|
|
|
+ let params = {};
|
|
|
+
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <MtrldefSelect
|
|
|
+ value={row.mtrlid}
|
|
|
+ {...params}
|
|
|
+ clearable
|
|
|
+ placeholder={_label}
|
|
|
+ onOpenModal={() => fModelChoseMtrl(row, params)}
|
|
|
+ onSelect={val => rModelSetMtrl(row, val)}
|
|
|
+ onClear={() => rModelClearMtrl(row)}
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ label: () => row.mtrlname
|
|
|
+ }}
|
|
|
+ </MtrldefSelect>
|
|
|
+ </>
|
|
|
+ );
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -787,17 +829,20 @@ export const useHooks = (t?: any) => {
|
|
|
{
|
|
|
field: "cutting_length",
|
|
|
title: "下料长(mm)",
|
|
|
- datatype: "number"
|
|
|
+ datatype: "number",
|
|
|
+ editRender: {}
|
|
|
},
|
|
|
{
|
|
|
field: "cutting_width",
|
|
|
title: "下料宽(mm)",
|
|
|
- datatype: "number"
|
|
|
+ datatype: "number",
|
|
|
+ editRender: {}
|
|
|
},
|
|
|
{
|
|
|
field: "cutting_qty",
|
|
|
title: "下料数量",
|
|
|
- datatype: "number"
|
|
|
+ datatype: "number",
|
|
|
+ editRender: {}
|
|
|
},
|
|
|
{
|
|
|
field: "useqty",
|
|
@@ -820,7 +865,8 @@ export const useHooks = (t?: any) => {
|
|
|
{
|
|
|
field: "loss_rate",
|
|
|
title: "损耗率",
|
|
|
- datatype: "number"
|
|
|
+ datatype: "number",
|
|
|
+ editRender: {}
|
|
|
},
|
|
|
{
|
|
|
field: "price",
|
|
@@ -864,22 +910,50 @@ export const useHooks = (t?: any) => {
|
|
|
/**
|
|
|
* 打开部件配置弹窗
|
|
|
*/
|
|
|
- const onOpenConfigureDialog = () => {
|
|
|
- const { _mainData, enumMap } = state.LjDetailRef;
|
|
|
+ const onOpenConfigureDialog = async () => {
|
|
|
+ const { _mainData } = state.LjDetailRef;
|
|
|
+ const result = await GetSoftBedConfigureList({ softbed: _mainData });
|
|
|
+
|
|
|
+ if (result.typeList?.length > 0) {
|
|
|
+ for (const item of result.typeList) {
|
|
|
+ if (item.contfigtypename.includes("床头柜")) {
|
|
|
+ handleConfigItem(item, state.nightstandConfigOptions);
|
|
|
+ } else if (item.contfigtypename.includes("床架")) {
|
|
|
+ handleConfigItem(item, state.bedframeConfigOptions);
|
|
|
+ } else if (item.contfigtypename.includes("床头")) {
|
|
|
+ handleConfigItem(item, state.headboardConfigOptions);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
nextTick(() => {
|
|
|
state.showHeadboard = Boolean(_mainData.has_headboard);
|
|
|
state.showNightstand = Boolean(_mainData.has_nightstand);
|
|
|
state.showBedframe = Boolean(_mainData.has_bedframe);
|
|
|
-
|
|
|
state.isModalVisible = true;
|
|
|
});
|
|
|
};
|
|
|
+ const handleConfigItem = (item: any, targetArray: any[]) => {
|
|
|
+ if (item.codeList?.length > 0) {
|
|
|
+ for (const code of item.codeList) {
|
|
|
+ targetArray.push({ pzid: code.pzid, pzname: code.name });
|
|
|
+ if (code.pzid && code.pzid > 0) {
|
|
|
+ state.configValueOptionsMap[code.pzid] = [];
|
|
|
+ if (code.codeMxList?.length > 0) {
|
|
|
+ state.configValueOptionsMap[code.pzid].push(...code.codeMxList.filter(t => t.pzid === code.pzid));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
/**
|
|
|
* 确认部件配置项值
|
|
|
* @param params 返回内容
|
|
|
*/
|
|
|
const onConfirmConfigureDialog = (params: any) => {
|
|
|
const { _mainData } = state.LjDetailRef;
|
|
|
+
|
|
|
+ console.log("partsConfig :>>> ", state.partsConfig);
|
|
|
nextTick(() => {
|
|
|
_mainData.has_headboard = Number(state.showHeadboard);
|
|
|
_mainData.has_nightstand = Number(state.showNightstand);
|
|
@@ -1131,6 +1205,58 @@ export const useHooks = (t?: any) => {
|
|
|
return tableRef === state.VxeTableHeadBoardMxRef ? 1 : tableRef === state.VxeTableNightStandMxRef ? 2 : 4;
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * @description 弹窗模块:客户选择
|
|
|
+ * @param data 当前数据
|
|
|
+ * @param status 当前订单状态
|
|
|
+ * @returns Promise
|
|
|
+ */
|
|
|
+ const fModelChoseMtrl = (data: any, params: any) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ // if (!ALLOW_EDIT_STATE.includes(status)) return;
|
|
|
+
|
|
|
+ let _params = {
|
|
|
+ keyword: ""
|
|
|
+ };
|
|
|
+ state.MtrldefDialogProps = {
|
|
|
+ onSubmit: (res: any) => {
|
|
|
+ // submit
|
|
|
+ console.log("openCustDialog res", res);
|
|
|
+ nextTick(() => {
|
|
|
+ rModelSetMtrl(data, res.value[0]);
|
|
|
+ resolve(1);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onCancel: (error: any) => {
|
|
|
+ // cancel 回调
|
|
|
+ console.log("openCustDialog error", error);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ state.MtrldefDialogRef.show(_params);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description 数据赋值: 联系人
|
|
|
+ * @param data 当前数据
|
|
|
+ * @param item 当前选择的数据
|
|
|
+ */
|
|
|
+ const rModelSetMtrl = (data: any, item: any) => {
|
|
|
+ data.mtrlid = Number(item.mtrlid);
|
|
|
+ data.mtrlname = item.name;
|
|
|
+ // data.mtrlcode = item.mtrlcode;
|
|
|
+ // data.mtrlmode = item.mtrlmode;
|
|
|
+ data.unit = item.priceunit;
|
|
|
+ };
|
|
|
+
|
|
|
+ const rModelClearMtrl = (data: any) => {
|
|
|
+ data.mtrlid = 0;
|
|
|
+ data.mtrlname = "";
|
|
|
+ // data.mtrlcode = "";
|
|
|
+ // data.mtrlmode = "";
|
|
|
+ data.unit = "";
|
|
|
+ };
|
|
|
+
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
columns,
|