|
@@ -33,11 +33,11 @@
|
|
|
<el-button @click="handleOpenNewTable">{{ $t("common.add") }}</el-button>
|
|
|
<el-button @click="fDelete">{{ $t("common.delText") }}</el-button>
|
|
|
<el-button @click="fBan">{{ $t("common.disable") }}</el-button>
|
|
|
- <el-button @click="fBan">价格表复制</el-button>
|
|
|
+ <el-button @click="handleShowPriceListForm">价格表复制</el-button>
|
|
|
<el-button @click="handleCopyMtrldef">物料复制</el-button>
|
|
|
- <el-button @click="handleCopyMtrldef">批修改</el-button>
|
|
|
- <el-button @click="handleCopyMtrldef">批修改单价</el-button>
|
|
|
- <el-button @click="handleCopyMtrldef">读取单价</el-button>
|
|
|
+ <el-button @click="handleShowCopyForm">批修改</el-button>
|
|
|
+ <el-button @click="handleModifyPrice">批修改单价</el-button>
|
|
|
+ <el-button>读取单价</el-button>
|
|
|
</el-button-group>
|
|
|
</template>
|
|
|
</LjVxeTable>
|
|
@@ -64,24 +64,64 @@
|
|
|
</div>
|
|
|
</LjDialog>
|
|
|
|
|
|
- <!-- <el-dialog v-model="copyFormVisible" title="价格表复制" width="500" draggable append-to-body>
|
|
|
- <el-form :model="formParam" label-width="80px">
|
|
|
- <el-form-item label="工艺利润率">
|
|
|
- <el-input type="number" v-model="formParam.rate" clearable form min="0"></el-input>
|
|
|
+ <el-dialog v-model="copyFormVisible" title="物料批修改" width="500" draggable append-to-body>
|
|
|
+ <el-form label-width="80px">
|
|
|
+ <el-form-item label="修改字段">
|
|
|
+ <el-select v-model="copyFormCol" value-key="title" @change="copyFormValue = ''">
|
|
|
+ <el-option v-for="(col, index) in copyFormOption" :key="index" :label="col.title" :value="col"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="修改内容">
|
|
|
+ <el-input v-model="copyFormValue" :type="copyFormCol.datatype ?? 'text'"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="copyFormVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handleCopyFormConfirm">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog v-model="priceListFormVisiable" title="价格表选择" width="500" draggable append-to-body>
|
|
|
+ <el-form label-width="80px">
|
|
|
+ <el-form-item label="源头" v-if="priceListVisiable">
|
|
|
+ <el-select v-model="priceListFormParams.pricelistid_from">
|
|
|
+ <el-option
|
|
|
+ v-for="(col, index) in priceListEnum"
|
|
|
+ :key="index"
|
|
|
+ :label="col.pricelistname"
|
|
|
+ :value="col.pricelistid"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="比例" required>
|
|
|
+ <el-input v-model="priceListFormParams.rate" type="number" min="0"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="目标" v-if="priceListVisiable">
|
|
|
+ <el-select v-model="priceListFormParams.pricelistid_to">
|
|
|
+ <el-option
|
|
|
+ v-for="(col, index) in priceListEnum"
|
|
|
+ :key="index"
|
|
|
+ :label="col.pricelistname"
|
|
|
+ :value="col.pricelistid"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="BatchModifyRate">确认</el-button>
|
|
|
+ <el-button @click="copyFormVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handlePriceListCopyConfirm">确认</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </el-dialog> -->
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="baseinfo_mtrldeflist">
|
|
|
import { ref, onMounted, provide } from "vue";
|
|
|
-import { getMtrlDefList } from "@/api/modules/basicinfo";
|
|
|
+import { getMtrlDefList, ModifyMtrlDefList, CopyMtrlDef } from "@/api/modules/basicinfo";
|
|
|
+import { getPriceList } from "@/api/modules/saleprice";
|
|
|
import { useHooks as useHooks_mtrltype } from "@/views/baseinfo/mtrltype/hooks/index";
|
|
|
import Detail from "./detail.vue";
|
|
|
import { useHooks } from "./hooks/index";
|
|
@@ -97,7 +137,7 @@ import { getCurrentRecords } from "@/utils/index";
|
|
|
const dwname = "web_mtrldeflist";
|
|
|
const mainData = ref({});
|
|
|
const mtrltype = ref({});
|
|
|
-const initParams = ref({ mtrltypeids: undefined as Number[], pricelistid: 0 });
|
|
|
+const initParams = ref({ mtrltypeids: undefined as Number[] });
|
|
|
const tableProps = {
|
|
|
height: "auto",
|
|
|
editConfig: { trigger: "click", mode: "cell" }
|
|
@@ -115,7 +155,23 @@ const layoutSetting = {
|
|
|
};
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
-const { VxeTableRef, LjDetailRef, VxeTableMxRef, columns, fDelete, fSave, fBan } = useHooks(t);
|
|
|
+const {
|
|
|
+ VxeTableRef,
|
|
|
+ LjDetailRef,
|
|
|
+ VxeTableMxRef,
|
|
|
+ columns,
|
|
|
+ fDelete,
|
|
|
+ fSave,
|
|
|
+ fBan,
|
|
|
+ copyFormVisible,
|
|
|
+ copyFormCol,
|
|
|
+ copyFormValue,
|
|
|
+ copyFormOption,
|
|
|
+ priceListEnum,
|
|
|
+ priceListFormVisiable,
|
|
|
+ priceListFormParams,
|
|
|
+ priceListVisiable
|
|
|
+} = useHooks(t);
|
|
|
const { gMtrltypeList } = useHooks_mtrltype(t);
|
|
|
const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
|
|
|
|
|
@@ -235,6 +291,123 @@ const handleCopyMtrldef = () => {
|
|
|
LjDrawerRef.value.show();
|
|
|
};
|
|
|
|
|
|
+const handleShowCopyForm = () => {
|
|
|
+ const { curRecords } = getCurrentRecords(VxeTableRef.value);
|
|
|
+
|
|
|
+ console.log("curRecords :>> ", curRecords);
|
|
|
+ if (!curRecords.length) {
|
|
|
+ ElMessage.warning(t("business.tips.mattress.records"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ copyFormVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const handleCopyFormConfirm = () => {
|
|
|
+ console.log(copyFormCol);
|
|
|
+
|
|
|
+ const { curRecords } = getCurrentRecords(VxeTableRef.value);
|
|
|
+
|
|
|
+ console.log("curRecords :>> ", curRecords);
|
|
|
+ if (!curRecords.length) {
|
|
|
+ ElMessage.warning(t("business.tips.mattress.records"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ curRecords.forEach(element => {
|
|
|
+ element[copyFormCol.value.field] = copyFormValue.value;
|
|
|
+ });
|
|
|
+
|
|
|
+ ModifyMtrlDefList({ list: curRecords })
|
|
|
+ .then(() => {
|
|
|
+ copyFormVisible.value = false;
|
|
|
+
|
|
|
+ ElMessage.success("修改成功!");
|
|
|
+ VxeTableRef?.value.refresh();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "操作取消"
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleShowPriceListForm = () => {
|
|
|
+ const { curRecords } = getCurrentRecords(VxeTableRef.value);
|
|
|
+
|
|
|
+ console.log("curRecords :>> ", curRecords);
|
|
|
+ if (!curRecords.length) {
|
|
|
+ ElMessage.warning(t("business.tips.mattress.records"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ priceListFormVisiable.value = true;
|
|
|
+ priceListVisiable.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const handlePriceListCopyConfirm = () => {
|
|
|
+ const { curRecords } = getCurrentRecords(VxeTableRef.value);
|
|
|
+
|
|
|
+ console.log("curRecords :>> ", curRecords);
|
|
|
+ if (!curRecords.length) {
|
|
|
+ ElMessage.warning(t("business.tips.mattress.records"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ curRecords.forEach(element => {
|
|
|
+ element[copyFormCol.value.field] = copyFormValue.value;
|
|
|
+ });
|
|
|
+
|
|
|
+ let mtrlids = [];
|
|
|
+
|
|
|
+ if (!priceListVisiable.value) {
|
|
|
+ mtrlids = curRecords.map(item => item.mtrlid);
|
|
|
+ }
|
|
|
+
|
|
|
+ ElMessageBox.confirm(`是否确定要更新价格表单价?`, "询问", {
|
|
|
+ confirmButtonText: "是",
|
|
|
+ cancelButtonText: "否",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ CopyMtrlDef({
|
|
|
+ pricelistid_from: priceListFormParams.value.pricelistid_from,
|
|
|
+ pricelistid_to: priceListFormParams.value.pricelistid_to,
|
|
|
+ rate: priceListFormParams.value.rate,
|
|
|
+ mtrlids
|
|
|
+ }).then(() => {
|
|
|
+ priceListFormVisiable.value = false;
|
|
|
+
|
|
|
+ ElMessage.success(`更新价格表单价成功!`);
|
|
|
+ VxeTableRef?.value.refresh();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "操作取消"
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleModifyPrice = () => {
|
|
|
+ const { curRecords } = getCurrentRecords(VxeTableRef.value);
|
|
|
+
|
|
|
+ console.log("curRecords :>> ", curRecords);
|
|
|
+ if (!curRecords.length) {
|
|
|
+ ElMessage.warning(t("business.tips.mattress.records"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ priceListVisiable.value = false;
|
|
|
+ priceListFormVisiable.value = true;
|
|
|
+
|
|
|
+ priceListFormParams.value.pricelistid_from = curRecords[0].pricelistid;
|
|
|
+ priceListFormParams.value.pricelistid_to = curRecords[0].pricelistid;
|
|
|
+ priceListFormParams.value.rate = 1;
|
|
|
+};
|
|
|
+
|
|
|
// 返回绑定的事件
|
|
|
const tableEvents = {
|
|
|
"cell-dblclick": handleDBlClickTable
|