123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131 |
- <template>
- <LjDetail
- name="mattressInterfaceDetail"
- ref="LjDetailRef"
- v-bind="detailProps"
- :data="mainData"
- v-model:order-status="orderStatus"
- :action="orderDefaultAction"
- @after-mounted="funcAfterMound"
- :if-layout-editable="false"
- :search-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
- :basic-group-col="{ xs: 3, sm: 3, md: 3, lg: 3, xl: 3 }"
- >
- <template #mattressYW>
- <LjVxeTable
- ref="VxeTableMxRef"
- row-key="key"
- table-cls=""
- :data="mattressYWList"
- :columns="columns_yw"
- :dwname="DwnameEnum.mattressInterfaceYw"
- :request-auto="false"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :cellClassName="cellClassNameFn"
- >
- </LjVxeTable>
- </template>
- <template #tabNavRight="scope" v-if="orderStatus">
- <div class="flx-center flx-end flx-1 ml-24" v-if="scope.active == 'mattressYW'">
- <LjHeaderMenu group-cls="flx-start" :action="qdActionYW"></LjHeaderMenu>
- </div>
- <div class="flx-center flx-end flx-1 ml-24" v-else-if="scope.active == 'mattressQD'">
- <LjHeaderMenu group-cls="flx-start" :action="qdAction"></LjHeaderMenu>
- </div>
- </template>
- <template #mattressQD>
- <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
- <template #left>
- <LjVxeTable
- ref="YwTableRef"
- row-key="key"
- table-cls="h-full"
- :data="mattressYWList"
- :columns="columns_yw_qd"
- :dwname="DwnameEnum.mattressInterfaceYw"
- :request-auto="false"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- >
- </LjVxeTable>
- </template>
- <div class="main-box flx-col">
- <LjVxeTable
- ref="QdTableRef"
- row-key="key"
- table-cls="h-full"
- :data="mattressQDList"
- :columns="columns_qd"
- :dwname="DwnameEnum.mattressInterfaceQd"
- :request-auto="false"
- :table-props="tableProps_qd"
- :tool-button="['setting']"
- collapseButtons
- @setMergeCells="resetMergeCellsQd"
- @row-dragend="autoRowDragend"
- >
- </LjVxeTable>
- </div>
- </LjFoldLayout>
- </template>
- </LjDetail>
- <LjDialog ref="LjDialogQdRowAdd" class="is-selector" :style="{ padding: 0 }" width="480px">
- <template #header>
- <div class="flx-1">
- <span class="text-h5-b">产品清单新增</span>
- </div>
- </template>
- <!-- <div class="flx-1 h-full">
- <LjHeaderMenu :action="qdDefaultAction" />
- {{ interIndex }}
- <el-form :model="qdFormParam" label-width="80px">
- <el-form-item label="项目">
- <el-select v-model="qdFormParam.itemname" placeholder="请选择部门">
- <el-option v-for="(col, index) in itemnameEnum" :key="index" :label="col.label" :value="col.value"></el-option>
- </el-select>
- <el-autocomplete
- v-model="qdFormParam.itemname"
- :fetch-suggestions="querySearch"
- :trigger-on-focus="false"
- clearable
- class="inline-input w-50"
- placeholder="Please Input"
- @select="handleSelect"
- />
- </el-form-item>
- <el-form-item label="二级项目">
- <el-select v-model="qdFormParam.bj_pzname">
- <el-option v-for="(col, index) in itemnameEnum" :key="index" :label="col.label" :value="col.value"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="明细项目">
- <el-select v-model="qdFormParam.bj_pzname_mx">
- <el-option v-for="(col, index) in itemnameEnum" :key="index" :label="col.label" :value="col.value"></el-option>
- </el-select>
- </el-form-item>
- 核价系统物料名称
- </el-form>
- </div> -->
- </LjDialog>
- <MattressDialog ref="MattressDialogRef" v-bind="MattressDialogProps" />
- <MtrldefErpDialog ref="MtrldefErpDialogRef" v-bind="MtrldefErpDialogProps" />
- <!-- <SetSubspecsDialog ref=SetSubspecsDialogRef" /> -->
- </template>
- <script setup lang="tsx" name="mattressInterfaceDetail">
- import { ref, watch, reactive, inject, onMounted, computed, nextTick, onBeforeMount } from "vue";
- import { DwnameEnum } from "@/enums/dwnameEnum";
- import LjDetail from "@/components/LjDetail/index.vue";
- import { DetailProp } from "@/components/LjDetail/interface";
- import { useI18n } from "vue-i18n";
- import { useRoute, useRouter } from "vue-router";
- import { useHooks } from "./hooks/index";
- import { useAuthButtons } from "@/hooks/useAuthButtons";
- import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2 } from "@/api/modules/common";
- import { SaveMattressInterface, GetResetWiptype, UpdateL1Basicinfo } from "@/api/modules/quote";
- import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
- import mittBus from "@/utils/mittBus";
- import { MittEnum } from "@/enums/mittEnum";
- import MattressDialog from "@/views/system/selector/mattress/index.vue";
- import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
- import { formatToDate } from "@/utils/dateUtil";
- import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
- import { detailAction } from "@/components/LjDetail/interface";
- import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
- import LjDialog from "@/components/LjDialog/index.vue";
- // import dialog from "@/utils/dialog";
- // import SetSubspecsDialog from "./components/setSubspecs.vue";
- interface detailProp {
- /**
- * @argument any 页面数据
- */
- data?: any;
- /**
- * @argument string 请求数据的api ==> 非必传
- */
- requestApi?: (params: any) => Promise<any>;
- /**
- * @argument any 基础信息,表格展示数据
- */
- // columns?: any;
- /**
- * @description 是否可编辑
- */
- status: "edit" | "new" | string;
- enum?: any;
- }
- const props = withDefaults(defineProps<detailProp>(), {});
- const { t } = useI18n();
- const route = useRoute();
- const router = useRouter();
- const {
- VxeTableMxRef,
- YwTableRef,
- QdTableRef,
- orderStatus,
- LjDetailRef,
- columns_detail,
- columns_yw,
- columns_yw_qd,
- columns_qd,
- mainData,
- editType,
- mattressYWList,
- mattressQDList,
- MattressDialogRef,
- MattressDialogProps,
- MtrldefErpDialogRef,
- MtrldefErpDialogProps,
- tableProps_mx,
- tableProps_qd,
- workgrpEnum,
- workgrpEnum2,
- configureTypeEnum,
- RetriveMattressInterface,
- RefreshMattressInterfaceList,
- RefreshMattressInterfaceQdList,
- fModelChoseMattress,
- toExcel,
- toCreateMtrl,
- toCreateORDelMtrlPf,
- // toUpdateL1Planprice,
- YWAudit,
- JSAudit,
- JS2Audit,
- resetMergeCellsQd,
- resetMergeCells,
- funcAddRowQd,
- funcCmpCC,
- dynamicRef
- } = useHooks(t);
- const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
- const initParams = ref({ mattressid: 0 as Number });
- const layoutSetting = reactive({});
- const SetSubspecsDialogRef = ref();
- const detailProps = reactive<DetailProp>({
- dwname: DwnameEnum.mattressInterfaceDetail,
- columns: columns_detail,
- basicDefault: {},
- header: {
- foldright: {
- width: 80
- },
- fieldNames: {
- code: "sptcode",
- codeLabel: t("table.u_spt.sptcode") + ":",
- name: "name"
- }
- },
- mould: [
- {
- id: "mattressYW",
- type: "table",
- label: "产品配置"
- },
- {
- id: "mattressQD",
- type: "table",
- label: "产品清单"
- }
- ]
- });
- const tabRemove: Function = inject("tabRemove") as Function;
- const loadingStatus = reactive({
- save: false,
- synchsL1: false
- });
- const cellClassNameFn = (data: any, editable) => {
- let { column, row } = data;
- if (editable) {
- if (column.field == "bj_pzname") {
- if (
- (["垫层", "辅料"].includes(row.itemname) && row.bj_pzname.indexOf("说明") == -1) ||
- [
- "边带",
- "面层裥棉图案",
- "底层裥棉图案",
- "大侧裥棉图案",
- "小侧1裥棉图案",
- "小侧2裥棉图案",
- "小侧3裥棉图案",
- "拉手刺绣及其他工艺项目所有"
- ].includes(row.bj_pzname)
- ) {
- return "vxecol-danger";
- }
- }
- }
- return null;
- };
- const moveData = async (refName: string, index: number, nextIndex: number) => {
- const $table = dynamicRef(refName).element;
- // const $table = QdTableRef.value.element;
- let { visibleData } = $table.getTableData();
- const curRecords = $table?.getCurrentRecord();
- let prevRow = visibleData[nextIndex];
- visibleData[nextIndex] = visibleData[index];
- visibleData[index] = prevRow;
- visibleData.map((o, idx) => {
- o.printid = idx + 1;
- return o;
- });
- $table.reloadData(visibleData);
- await $table.setCurrentRow(curRecords);
- if (refName == "VxeTableMxRef") {
- resetMergeCells(() => {
- setTimeout(() => {
- $table.scrollToRow(curRecords);
- }, 0);
- });
- } else if (refName == "QdTableRef") {
- resetMergeCellsQd(() => {
- setTimeout(() => {
- $table.scrollToRow(curRecords);
- }, 0);
- });
- }
- };
- const toMove = async (refName: string, action: number) => {
- // const $table = QdTableRef.value.element;
- const $table = dynamicRef(refName).element;
- let curRecords = $table?.getCurrentRecord();
- let visibleData = $table.getTableData().visibleData;
- if (!curRecords) {
- ElMessage.warning("请先选择要移动的行");
- return;
- }
- let curIdx = visibleData.findIndex(t => t === curRecords);
- console.log("curIdx :>> ", curIdx);
- if (action == 1) {
- // 上移
- if (curIdx == 0) {
- ElMessage.warning("已经是第一条了");
- return;
- }
- moveData(refName, curIdx, curIdx - 1);
- } else if (action == -1) {
- // 下移
- if (curIdx == visibleData.length - 1) {
- ElMessage.warning("已经是最后一条了");
- return;
- }
- moveData(refName, curIdx, curIdx + 1);
- }
- };
- const qdActionYW: detailAction[] = [
- // buttonDefault({
- // label: "增行",
- // clickFunc: () => {
- // interIndex.value = -1;
- // LjDialogQdRowAdd.value.show();
- // }
- // }),
- // buttonDefault({
- // label: "插行",
- // divider: true,
- // clickFunc: () => {
- // const $table = QdTableRef.value.element;
- // const curRecords = $table?.getCurrentRecord();
- // if (curRecords) {
- // interIndex.value = $table.getRowIndex(curRecords);
- // }
- // LjDialogQdRowAdd.value.show();
- // }
- // }),
- buttonDefault({
- label: "上移",
- clickFunc: () => toMove("VxeTableMxRef", 1)
- }),
- buttonDefault({
- label: "下移",
- clickFunc: () => toMove("VxeTableMxRef", -1),
- divider: true
- })
- ];
- const qdAction: detailAction[] = [
- buttonDefault({
- label: "增行",
- clickFunc: () => {
- interIndex.value = -1;
- LjDialogQdRowAdd.value.show();
- }
- }),
- buttonDefault({
- label: "插行",
- clickFunc: () => {
- const $table = QdTableRef.value.element;
- const curRecords = $table?.getCurrentRecord();
- if (curRecords) {
- interIndex.value = $table.getRowIndex(curRecords);
- }
- LjDialogQdRowAdd.value.show();
- }
- }),
- // buttonDefault({
- // label: "删行",
- // divider: true,
- // clickFunc: () => {
- // ElMessageBox.prompt(`是否确定删除当前行?`, "提示", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消"
- // })
- // .then(({ value }) => {})
- // .catch(() => {
- // // ElMessage.warning("已经取消审批流程操作!");
- // });
- // }
- // }),
- buttonDefault({
- label: "上移",
- clickFunc: () => toMove("QdTableRef", 1)
- }),
- buttonDefault({
- label: "下移",
- clickFunc: () => toMove("QdTableRef", -1),
- divider: true
- }),
- buttonDefault({
- label: "清单增加默认项目",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcAddRowQd()
- }),
- buttonDefault({
- label: "辅助计算生产尺寸",
- divider: true,
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcCmpCC()
- }),
- buttonDefault({
- label: "批量设置",
- clickFunc: async () => {
- let _cur = QdTableRef.value.currentEditCell;
- if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
- return ElMessage.warning("此列暂不支持批量设置(仅支持实际用量、工组)");
- }
- // return mattressQDList.value.length == 0;
- // nextTick(() => {
- const $table = QdTableRef.value.element;
- const { visibleData } = $table.getTableData();
- let _data = [];
- if (visibleData) {
- let _val = visibleData[_cur.rowIndex];
- _data = visibleData.map((o, idx) => {
- if (o.actual_useqty > 0 && idx > _cur.rowIndex) {
- o[_cur.field] = _val[_cur.field];
- if (_cur.field == "wrkgrpid1") {
- o.wrkgrpcode1 = _val.wrkgrpcode1;
- } else if (_cur.field == "wrkgrpid2") {
- o.wrkgrpcode2 = _val.wrkgrpcode2;
- }
- }
- if (_cur.field == "actual_useqty") {
- if (o.useqty > 0 && idx > _cur.rowIndex) {
- o[_cur.field] = _val[_cur.field];
- }
- }
- return o;
- });
- await $table.reloadData(_data);
- resetMergeCellsQd();
- ElMessage.success("批设成功(有实际用量的数据行)");
- }
- }
- })
- ];
- const orderDefaultAction = [
- buttonDefault({
- label: t("common.cancelText"),
- icon: "iconchevron-left",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- // router.replace(
- // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
- // );
- const _cur = mainData.value[0];
- router.push({
- name: "mattressInterfaceDetail",
- params: {
- id: _cur.mattressid
- },
- query: {
- code: _cur.mattresscode
- },
- replace: true
- });
- }
- }),
- buttonDefault({
- label: t("common.saveText"),
- loading: () => loadingStatus.save,
- limited: () => !orderStatus.value,
- clickFunc: async item => {
- try {
- await LjDetailRef.value.toValidateForm();
- let $tableYW = VxeTableMxRef.value.element;
- let { visibleData } = $tableYW.getTableData();
- visibleData.map(o => {
- console.log("tableYW visibleData o :>> ", o);
- if (
- (["垫层", "辅料"].includes(o.itemname) && o.bj_pzname.indexOf("说明") == -1) ||
- [
- "边带",
- "面层裥棉图案",
- "底层裥棉图案",
- "大侧裥棉图案",
- "小侧1裥棉图案",
- "小侧2裥棉图案",
- "小侧3裥棉图案",
- "拉手刺绣及其他工艺项目所有"
- ].includes(o.bj_pzname)
- ) {
- if (o.bj_namemx == "") {
- VxeTableMxRef.value.scrollTo(o, "bj_namemx");
- throw new Error("产品配置:【" + o.bj_pzname + "】的明细是必填项,请输入/选择");
- }
- }
- return o;
- });
- ElMessageBox.confirm("是否确定要保存吗?", "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- }).then(async () => {
- loadingStatus.save = true;
- try {
- // const { visibleData } = QdTableRef.value.element.getTableData();
- // console.log(" mattressQDList.value :>> ", mattressQDList.value);
- // console.log("QdTableRef visibleData :>> ", visibleData);
- const res = await SaveMattressInterface({
- mattress: LjDetailRef.value?._mainData,
- interfaceList: mattressYWList.value,
- qdList: mattressQDList.value
- })
- .then(res => {
- ElNotification({
- title: "温馨提示",
- message: t("sys.api.sueccessToSave"),
- type: "success"
- });
- // tabRemove(route.fullPath);
- // router.replace(
- // `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
- // );
- const _cur = LjDetailRef.value?._mainData;
- router.push({
- name: "mattressInterfaceDetail",
- params: {
- id: _cur.mattressid
- },
- query: {
- code: _cur.mattresscode
- },
- replace: true
- });
- // LjDetailRef.value.refresh();
- loadingStatus.save = false;
- })
- .catch(error => {
- console.log("error !! :>> ", error);
- loadingStatus.save = false;
- });
- } catch (error) {
- loadingStatus.save = false;
- ElMessage.error(t("sys.api.operationFailed"));
- }
- });
- } catch (error) {
- console.log("errorerrorerrorerror :>> ", typeof error, error);
- if (error.hasOwnProperty("message")) {
- ElMessage.error(error.message);
- } else {
- for (const key in error) {
- if (Object.prototype.hasOwnProperty.call(error, key)) {
- const element = error[key];
- ElMessage.error(element[0].message);
- }
- }
- }
- return false;
- }
- }
- }),
- [
- buttonDefault({
- label: "刷新带出配置",
- limited: () => {
- return !orderStatus.value || editType.value == 3;
- },
- clickFunc: item => {
- RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 1, LjDetailRef.value?._mainData.erp_configcodetype);
- }
- }),
- buttonDefault({
- label: "复制配置",
- limited: () => {
- return !orderStatus.value || editType.value == 3;
- },
- clickFunc: item => {
- fModelChoseMattress().then((res: any) => {
- RefreshMattressInterfaceList(res.mattressid, 1);
- });
- }
- }),
- buttonDefault({
- label: "重新生成配置项目",
- limited: () => {
- return !orderStatus.value || editType.value != 1;
- },
- disabledTextCallBack: (data: any) => {
- if (data.yw_flag == 1) {
- return "已业务补充审核,无法操作";
- }
- return "";
- },
- clickFunc: item => {
- RefreshMattressInterfaceList(LjDetailRef.value?._mainData.mattressid, 0, LjDetailRef.value?._mainData.erp_configcodetype);
- }
- })
- ],
- [
- buttonDefault({
- label: "刷新清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 1);
- }
- }),
- buttonDefault({
- label: "复制清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- fModelChoseMattress().then((res: any) => {
- RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
- });
- }
- }),
- buttonDefault({
- label: "重新生成清单",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- RefreshMattressInterfaceQdList(LjDetailRef.value?._mainData.mattressid, 0);
- }
- })
- ],
- [
- buttonDefault({
- label: "增行",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {}
- }),
- buttonDefault({
- label: "插行",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {},
- divider: true
- }),
- buttonDefault({
- label: "上移",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {}
- }),
- buttonDefault({
- label: "下移",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {},
- divider: true
- }),
- buttonDefault({
- label: "清单增加默认项目",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcAddRowQd()
- }),
- buttonDefault({
- label: "辅助计算生产尺寸",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: () => funcCmpCC()
- })
- ],
- buttonDefault({
- label: "重置半成品归属列数据",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: async () => {
- const $table = QdTableRef.value.element;
- if ($table) {
- const { visibleData } = $table.getTableData();
- let res = await GetResetWiptype({ qdList: visibleData });
- let arr = visibleData.map(o => {
- let _itm = res.qdList.find(itm => itm.printid == o.printid);
- if (_itm) {
- o.wip_type = _itm.wip_type;
- !o.wrkgrpcode2 && (o.wrkgrpcode2 = _itm.o.wrkgrpcode2);
- }
- return o;
- });
- $table.reloadData(arr);
- resetMergeCellsQd();
- }
- }
- }),
- [
- buttonDefault({
- label: "业务补充",
- power: 79,
- limited: () => {
- return !!orderStatus.value || LjDetailRef.value?._mainData.xd_flag == 1;
- },
- disabledTextCallBack: (data: any) => {
- if (data.yw_flag == 1) {
- return "已业务补充审核,无法修改";
- }
- return "";
- },
- clickFunc: item => {
- routeToEdit(1);
- }
- }),
- buttonDefault({
- label: "业务审核",
- power: 80,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- YWAudit(1, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- buttonDefault({
- label: "业务撤审",
- power: 81,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- YWAudit(0, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- })
- ],
- [
- buttonDefault({
- label: "产品补充",
- power: 82,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (data.js1_flag == 1) {
- return "已产品补充审核,无法修改";
- }
- return "";
- },
- clickFunc: item => {
- routeToEdit(2);
- }
- }),
- buttonDefault({
- label: "产品补充审核",
- power: 83,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JSAudit(1, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- buttonDefault({
- label: "产品补充撤审",
- power: 84,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JSAudit(0, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- })
- ],
- [
- buttonDefault({
- label: "清单补充",
- power: 85,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (data.js2_flag == 1) {
- return "已清单补充审核,无法修改";
- }
- return "";
- },
- clickFunc: item => {
- routeToEdit(3);
- }
- }),
- buttonDefault({
- label: "清单补充审核",
- power: 86,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JS2Audit(1, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- }),
- buttonDefault({
- label: "清单补充撤审",
- power: 87,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- const curRecords = [LjDetailRef.value?._mainData];
- JS2Audit(0, curRecords, () => {
- LjDetailRef.value.refresh();
- });
- }
- })
- ],
- buttonDefault({
- label: "覆盖配置到副规格产品",
- limited: () => {
- return !!orderStatus.value || LjDetailRef.value?._mainData.child_count == 0;
- },
- disabledTextCallBack: (data: any) => {
- if (data.child_count == 0) {
- return "没有副规格产品,无法操作";
- }
- return "";
- },
- clickFunc: item => {
- // dialog(SetSubspecsDialog, {
- // mattressid: initParams.value.mattressid
- // }).then((data: any) => {
- // console.log(data);
- // });
- alert("功能维护中!");
- // SetSubspecsDialogRef.value.show();
- }
- }),
- buttonDefault({
- label: "生成/更新物料",
- power: 88,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- toCreateMtrl(1, [LjDetailRef.value?._mainData.mattressid]);
- }
- }),
- [
- buttonDefault({
- label: "生成金蝶清单",
- power: 90,
- disabledTextCallBack: (data: any) => {
- console.log("生成金蝶清单 disabledTextCallBack data", data);
- if (data.js2_flag == 0) {
- return "床垫清单未审核,无法生成金蝶清单";
- }
- return "";
- },
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- toCreateORDelMtrlPf(1, [LjDetailRef.value?._mainData.mattressid]);
- }
- })
- // buttonDefault({
- // label: "删除金蝶清单",
- // power: 91,
- // clickFunc: item => {
- // toCreateORDelMtrlPf(0, LjDetailRef.value?._mainData.mattressid);
- // }
- // })
- // buttonDefault({
- // label: "更新计划价",
- // power: 91,
- // limited: () => {
- // return !!orderStatus.value;
- // },
- // clickFunc: item => {
- // toUpdateL1Planprice(LjDetailRef.value?._mainData.mattressid);
- // }
- // })
- ],
- buttonDefault({
- label: "同步L1资料",
- // limited: () => {
- // return !orderStatus.value;
- // },
- loading: () => loadingStatus.synchsL1,
- clickFunc: async () => {
- try {
- loadingStatus.synchsL1 = true;
- let res = await UpdateL1Basicinfo();
- if (res) {
- ElNotification({
- title: "同步成功",
- message: `物料:${res.mtrlnum}个 <br/>工组:${res.wkgnum}个 <br/>物料类别:${res.mtrltypenum}个`,
- dangerouslyUseHTMLString: true,
- type: "warning"
- });
- }
- loadingStatus.synchsL1 = false;
- } catch (error) {
- loadingStatus.synchsL1 = false;
- console.error(error);
- }
- }
- }),
- buttonDefault({
- label: t("common.back"),
- clickFunc: item => {
- router.push(`/erpapi/mattressInterface`);
- }
- })
- ];
- const routeToEdit = (type: any) => {
- console.log("routeToEdit mainData :>> ", mainData, route.fullPath);
- const _cur = mainData.value[0];
- // router.replace(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
- router.push({
- name: "mattressInterfaceEditYw",
- params: {
- id: _cur.mattressid
- },
- query: {
- code: _cur.mattresscode,
- type: type
- },
- replace: true
- });
- };
- /**
- * @description 页面数据加载完成
- */
- const funcAfterMound = async () => {
- console.log("onMounted detail sale start!!!! :>> ", orderStatus.value);
- if (!orderStatus.value) {
- // 详情页
- // gotoSummy(8000);
- } else {
- // 新增/编辑
- tableProps_mx.value.editConfig.enabled = true;
- tableProps_qd.value.editConfig.enabled = true;
- // tableProps_mx_yw.value.editConfig.enabled = true;
- // tableProps_mx_qd.value.editConfig.enabled = true;
- }
- console.log("onMounted detail sale start!!!! :>> ", tableProps_mx.value.editConfig);
- console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
- if (orderStatus.value != "new") {
- }
- };
- onBeforeMount(() => {
- if (route.params?.id) {
- // 刷新数据
- initParams.value.mattressid = Number(route.params?.id);
- editType.value = Number(route.query?.type);
- }
- });
- onMounted(async () => {
- console.log("route onMounted:>> ", route);
- console.log("route onMounted:>> ", route.params);
- console.log("route onMounted:>> ", route.params.id);
- const result = await GetERPWrkGrpList();
- if (result.workgroupList) {
- workgrpEnum.value = result.workgroupList.map(item => {
- return {
- label: item.wrkGrpName,
- value: item.wrkGrpid,
- code: item.wrkgrpcode
- };
- });
- // columns_qd.value = columns_qd.value.map(item => {
- // if (item.field == "wrkgrpid") {
- // item.editRender.options = workgrpEnum.value;
- // }
- // return item;
- // });
- }
- const result2 = await GetERPWrkGrpList2();
- workgrpEnum2.value = result2.datatable ?? [];
- if (route.params?.id) {
- // 刷新数据
- // initParams.value.mattressid = Number(route.params?.id);
- // editType.value = Number(route.query?.type);
- console.log("detail onMounted initParams.value :>> ", initParams.value);
- console.log("领用工组领用工组领用工组领用工组 columns_qd.value :>> ", columns_qd.value);
- await RetriveMattressInterface(initParams.value.mattressid.valueOf());
- }
- });
- /** 发现4.11~4.13版本reloadData加载超慢放弃使用 */
- const autoRowDragend = async data => {
- const $table = QdTableRef.value.element;
- $table.clearMergeCells();
- // setTimeout(() => {
- nextTick(() => {
- console.time("autoRowDragend");
- console.log("autoRowDragend data :>> ", data);
- console.log(`拖拽完成,被拖拽行:${data.oldRow.itemname} 目标行:${data.newRow.itemname} 目标位置:${data.dragPos}`);
- // resetMergeCellsQd();
- // console.time("autoRowDragend getTableData");
- // const { visibleData } = $table.getTableData();
- // console.timeEnd("autoRowDragend getTableData");
- // console.time("autoRowDragend arr");
- // let arr = visibleData.map((o, idx) => {
- // o.printid = idx + 1;
- // return o;
- // });
- // console.timeEnd("autoRowDragend arr");
- // console.time("autoRowDragend reloadData");
- // await $table.reloadData(arr);
- // console.timeEnd("autoRowDragend reloadData");
- console.time("autoRowDragend autoMergeCells");
- let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
- console.timeEnd("autoRowDragend autoMergeCells");
- console.time("autoRowDragend setMergeCells");
- $table.setMergeCells(mergeCells);
- console.timeEnd("autoRowDragend setMergeCells");
- console.timeEnd("autoRowDragend");
- });
- // }, 1000);
- };
- const LjDialogQdRowAdd = ref();
- const interIndex = ref(0);
- const qdFormParam = ref({
- itemname: "",
- bj_pzname: "",
- bj_pzname_mx: "",
- u_mtrl_price_mtrlname: ""
- });
- const qdDefaultAction = [
- buttonDefault({
- label: t("common.cancelText"),
- icon: "iconchevron-left",
- clickFunc: item => {
- LjDialogQdRowAdd.value.hide();
- }
- }),
- buttonDefault({
- label: t("common.okText"),
- clickFunc: async item => {
- LjDialogQdRowAdd.value.hide();
- }
- })
- ];
- const querySearch = (queryString: string, cb: any) => {
- const results = queryString ? restaurants.value.filter(createFilter(queryString)) : restaurants.value;
- // call callback function to return suggestions
- cb(results);
- };
- </script>
|