|
@@ -75,44 +75,6 @@
|
|
|
</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" /> -->
|
|
@@ -139,8 +101,10 @@ 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 dialog from "@/utils/dialog";
|
|
|
// import SetSubspecsDialog from "./components/setSubspecs.vue";
|
|
|
+import InsterMxDialog from "./components/insterMx.vue";
|
|
|
+import InsterPzDialog from "./components/insterPz.vue";
|
|
|
|
|
|
interface detailProp {
|
|
|
/**
|
|
@@ -337,26 +301,120 @@ const toMove = async (refName: string, action: number) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const pzFormData = ref({
|
|
|
+ itemname: "辅料",
|
|
|
+ bj_pzname: ""
|
|
|
+});
|
|
|
+/**
|
|
|
+ * @description 配置插入明细行
|
|
|
+ * @param refName 表格ref名称
|
|
|
+ * @param type 0:最后插入,1:插入列
|
|
|
+ */
|
|
|
+const FuncInsertRowPz = (refName: string, type: number) => {
|
|
|
+ const _ref = dynamicRef(refName);
|
|
|
+ const $table = _ref.element;
|
|
|
+ let insertParam = null;
|
|
|
+
|
|
|
+ if ($table) {
|
|
|
+ let { visibleData } = $table.getTableData();
|
|
|
+
|
|
|
+ // 判断插入位置
|
|
|
+ if (type == 1) {
|
|
|
+ let currentRecod = $table.getCurrentRecord();
|
|
|
+ insertParam = currentRecod;
|
|
|
+ } else {
|
|
|
+ insertParam = -1;
|
|
|
+ }
|
|
|
+ // 收集下拉数据
|
|
|
+ let itEnum = [{ value: "辅料" }];
|
|
|
+
|
|
|
+ let pzEnum = [
|
|
|
+ { value: "价外物料1" },
|
|
|
+ { value: "价外物料1做法" },
|
|
|
+ { value: "价外物料2" },
|
|
|
+ { value: "价外物料2做法" },
|
|
|
+ { value: "价外物料3" },
|
|
|
+ { value: "价外物料3做法" },
|
|
|
+ { value: "价外物料4" },
|
|
|
+ { value: "价外物料4做法" },
|
|
|
+ { value: "价外物料5" }
|
|
|
+ ];
|
|
|
+
|
|
|
+ console.log("itEnum :>> ", itEnum);
|
|
|
+ dialog(InsterPzDialog, {
|
|
|
+ formData: pzFormData.value,
|
|
|
+ itemnameEnum: itEnum,
|
|
|
+ bjPznameEnum: pzEnum
|
|
|
+ }).then((data: any) => {
|
|
|
+ $table.insertAt(data, insertParam).then(async ({ row }) => {
|
|
|
+ // $table.reloadData(visibleData);
|
|
|
+
|
|
|
+ const $table1 = dynamicRef(refName).element;
|
|
|
+
|
|
|
+ if ($table1) {
|
|
|
+ let visibleData1 = $table1.getTableData().visibleData;
|
|
|
+
|
|
|
+ visibleData1.map((o, idx) => {
|
|
|
+ o.printid = idx + 1;
|
|
|
+ return o;
|
|
|
+ });
|
|
|
+
|
|
|
+ await $table1.reloadData(visibleData1);
|
|
|
+ resetMergeCells(() => {
|
|
|
+ dynamicRef(refName).scrollTo(row, "bj_namemx");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
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: () => FuncInsertRowPz("VxeTableMxRef", 0)
|
|
|
+ }),
|
|
|
+ buttonDefault({
|
|
|
+ label: "插行",
|
|
|
+ divider: true,
|
|
|
+ clickFunc: () => FuncInsertRowPz("VxeTableMxRef", 1)
|
|
|
+ }),
|
|
|
+ buttonDefault({
|
|
|
+ label: "删行",
|
|
|
+ limited: () => editType.value != 1,
|
|
|
+ // disabledTextCallBack: (data: any) => {
|
|
|
+ // if (editType.value != 3) {
|
|
|
+ // return "不是清单补充,无法操作";
|
|
|
+ // }
|
|
|
+ // return "";
|
|
|
+ // },
|
|
|
+ divider: true,
|
|
|
+ clickFunc: () => {
|
|
|
+ const $table = VxeTableMxRef.value.element;
|
|
|
+ if ($table) {
|
|
|
+ let curRow = $table.getCurrentRecord();
|
|
|
+ console.log("curRow :>> ", curRow);
|
|
|
+ if (!curRow) {
|
|
|
+ ElMessage.warning("请先选择要删除的行");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // $table.remove(curRow);
|
|
|
+
|
|
|
+ const $table = VxeTableMxRef.value.element;
|
|
|
+ if ($table) {
|
|
|
+ $table.removeCurrentRow();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // ElMessage.warning("已经取消审批流程操作!");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }),
|
|
|
buttonDefault({
|
|
|
label: "上移",
|
|
|
clickFunc: () => toMove("VxeTableMxRef", 1)
|
|
@@ -368,39 +426,140 @@ const qdActionYW: detailAction[] = [
|
|
|
})
|
|
|
];
|
|
|
|
|
|
+const qdFormData = ref({
|
|
|
+ itemname: "",
|
|
|
+ bj_pzname: "",
|
|
|
+ bj_pzname_mx: "",
|
|
|
+ bj_pzname_mx_mx: ""
|
|
|
+});
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description 插入明细行
|
|
|
+ * @param refName 表格ref名称
|
|
|
+ * @param type 0:最后插入,1:插入列
|
|
|
+ */
|
|
|
+const FuncInsertRow = (refName: string, type: number) => {
|
|
|
+ const _ref = dynamicRef(refName);
|
|
|
+ const $table = _ref.element;
|
|
|
+ let insertParam = null;
|
|
|
+
|
|
|
+ if ($table) {
|
|
|
+ let { visibleData } = $table.getTableData();
|
|
|
+
|
|
|
+ // 判断插入位置
|
|
|
+ if (type == 1) {
|
|
|
+ let currentRecod = $table.getCurrentRecord();
|
|
|
+ insertParam = currentRecod;
|
|
|
+ } else {
|
|
|
+ insertParam = -1;
|
|
|
+ }
|
|
|
+ // 收集下拉数据
|
|
|
+ let itEnum = visibleData
|
|
|
+ .map(t => {
|
|
|
+ return {
|
|
|
+ value: t.itemname
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .filter(t => t);
|
|
|
+
|
|
|
+ itEnum = [...new Set(itEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
|
|
|
+
|
|
|
+ let pzEnum = visibleData
|
|
|
+ .map(t => {
|
|
|
+ return {
|
|
|
+ value: t.bj_pzname
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .filter(t => t);
|
|
|
+
|
|
|
+ pzEnum = [...new Set(pzEnum.map(item => JSON.stringify(item)))].map((item: any) => JSON.parse(item));
|
|
|
+
|
|
|
+ console.log("itEnum :>> ", itEnum);
|
|
|
+ dialog(InsterMxDialog, {
|
|
|
+ formData: qdFormData.value,
|
|
|
+ itemnameEnum: itEnum,
|
|
|
+ bjPznameEnum: pzEnum
|
|
|
+ }).then((data: any) => {
|
|
|
+ $table.insertAt(data, insertParam).then(({ row }) => {
|
|
|
+ // $table.reloadData(visibleData);
|
|
|
+ _ref.scrollTo(row, "bj_namemx");
|
|
|
+
|
|
|
+ if (type == 1) {
|
|
|
+ const $table1 = dynamicRef(refName).element;
|
|
|
+
|
|
|
+ if ($table1) {
|
|
|
+ let visibleData1 = $table1.getTableData().visibleData;
|
|
|
+
|
|
|
+ $table1.reloadData(visibleData1);
|
|
|
+ resetMergeCellsQd();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const qdAction: detailAction[] = [
|
|
|
buttonDefault({
|
|
|
label: "增行",
|
|
|
- clickFunc: () => {
|
|
|
- interIndex.value = -1;
|
|
|
- LjDialogQdRowAdd.value.show();
|
|
|
- }
|
|
|
+ limited: () => editType.value != 3,
|
|
|
+ // disabledTextCallBack: (data: any) => {
|
|
|
+ // if (editType.value != 3) {
|
|
|
+ // return "不是清单补充,无法操作";
|
|
|
+ // }
|
|
|
+ // return "";
|
|
|
+ // },
|
|
|
+ clickFunc: () => FuncInsertRow("QdTableRef", 0)
|
|
|
}),
|
|
|
buttonDefault({
|
|
|
label: "插行",
|
|
|
+ limited: () => editType.value != 3,
|
|
|
+ // disabledTextCallBack: (data: any) => {
|
|
|
+ // console.log("editType.value != 3 :>> ", editType.value != 3);
|
|
|
+ // if (editType.value != 3) {
|
|
|
+ // return "不是清单补充,无法操作";
|
|
|
+ // }
|
|
|
+ // return "";
|
|
|
+ // },
|
|
|
+ clickFunc: () => FuncInsertRow("QdTableRef", 1)
|
|
|
+ }),
|
|
|
+ buttonDefault({
|
|
|
+ label: "删行",
|
|
|
+ limited: () => editType.value != 3,
|
|
|
+ // disabledTextCallBack: (data: any) => {
|
|
|
+ // if (editType.value != 3) {
|
|
|
+ // return "不是清单补充,无法操作";
|
|
|
+ // }
|
|
|
+ // return "";
|
|
|
+ // },
|
|
|
+ divider: true,
|
|
|
clickFunc: () => {
|
|
|
const $table = QdTableRef.value.element;
|
|
|
- const curRecords = $table?.getCurrentRecord();
|
|
|
- if (curRecords) {
|
|
|
- interIndex.value = $table.getRowIndex(curRecords);
|
|
|
+ if ($table) {
|
|
|
+ let curRow = $table.getCurrentRecord();
|
|
|
+ console.log("curRow :>> ", curRow);
|
|
|
+ if (!curRow) {
|
|
|
+ ElMessage.warning("请先选择要删除的行");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // $table.remove(curRow);
|
|
|
+
|
|
|
+ const $table = QdTableRef.value.element;
|
|
|
+ if ($table) {
|
|
|
+ $table.removeCurrentRow();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // ElMessage.warning("已经取消审批流程操作!");
|
|
|
+ });
|
|
|
}
|
|
|
- LjDialogQdRowAdd.value.show();
|
|
|
}
|
|
|
}),
|
|
|
- // buttonDefault({
|
|
|
- // label: "删行",
|
|
|
- // divider: true,
|
|
|
- // clickFunc: () => {
|
|
|
- // ElMessageBox.prompt(`是否确定删除当前行?`, "提示", {
|
|
|
- // confirmButtonText: "确定",
|
|
|
- // cancelButtonText: "取消"
|
|
|
- // })
|
|
|
- // .then(({ value }) => {})
|
|
|
- // .catch(() => {
|
|
|
- // // ElMessage.warning("已经取消审批流程操作!");
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }),
|
|
|
buttonDefault({
|
|
|
label: "上移",
|
|
|
clickFunc: () => toMove("QdTableRef", 1)
|
|
@@ -1100,32 +1259,27 @@ const autoRowDragend = async data => {
|
|
|
// }, 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);
|
|
|
-};
|
|
|
+// 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();
|
|
|
+// }
|
|
|
+// })
|
|
|
+// ];
|
|
|
</script>
|