NULL1222 2 недель назад
Родитель
Сommit
8c6f9c3d16

+ 13 - 17
src/Form/headquartersServiceMaterial/add.vue

@@ -111,10 +111,11 @@
                         <el-form-item :label="$t(`辅助单位`)">
                             <el-select
                                 style="width: 100%"
-                                v-model="form.auxunit"
+                                v-model="form.auxunitid"
                                 :disabled="form.isauxunit === 0"
                                 :placeholder="$t('请选择')"
                                 clearable
+                                @change="auxunitChange"
                             >
                                 <el-option
                                     v-for="item in unitGroupData"
@@ -178,22 +179,6 @@
                             ></el-input>
                         </el-form-item>
                     </el-col>
-                    <!-- <el-col :span="24">
-                        <el-form-item :label="$t('品牌:')" prop="brand">
-                            <el-input
-                                v-model="form.brand"
-                                :placeholder="$t('请填写品牌')"
-                            ></el-input>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="24">
-                        <el-form-item :label="$t('分类:')" prop="itemclassids">
-                            <el-input
-                                v-model="form.itemclassids"
-                                :placeholder="$t('请填写分类')"
-                            ></el-input>
-                        </el-form-item>
-                    </el-col> -->
                     <el-col :span="24">
                         <el-form-item :label="$t('起订量:')" prop="start_num">
                             <el-input-number
@@ -316,6 +301,7 @@ export default {
                 isauxunit: 0, //是否启用辅助单位
                 unit: "", //主单位
                 auxunit: "", // 辅助单位
+                auxunitid: "", // 辅助单位id
                 domains: [], // 领域
                 type: "", // 型号
                 spec: "", // 规格
@@ -416,6 +402,7 @@ export default {
             if (selectedUnit) {
                 this.form.unit = selectedUnit.unitname; // 赋值名称
                 this.form.auxunit = ""; // 清空辅助单位
+                this.form.auxunitid = ""; // 清空辅助单位id
             }
             this.unitGrouplist();
         },
@@ -434,6 +421,15 @@ export default {
             });
             this.unitGroupData = res.data;
         },
+        auxunitChange(e) {
+            // 根据 ID 找到对应的对象
+            let selectedAuxunit = this.unitGroupData.find(
+                (item) => item.unitgroupid === e
+            );
+            if (selectedAuxunit) {
+                this.form.auxunit = selectedAuxunit.unitgroupname; // 赋值名称
+            }
+        },
         async queryMain(fn) {
             const res = await this.$api.requested({
                 id: 2026051509000001,

+ 14 - 3
src/Form/ourServiceMaterial/add.vue

@@ -105,10 +105,11 @@
                         <el-form-item :label="$t(`辅助单位`)">
                             <el-select
                                 style="width: 100%"
-                                v-model="form.auxunit"
+                                v-model="form.auxunitid"
                                 :disabled="form.isauxunit === 0"
                                 :placeholder="$t('请选择')"
                                 clearable
+                                @change="auxunitChange"
                             >
                                 <el-option
                                     v-for="item in unitGroupData"
@@ -294,6 +295,7 @@ export default {
                 isauxunit: 0, //是否启用辅助单位
                 unit: "", //主单位
                 auxunit: "", // 辅助单位
+                auxunitid: "", // 辅助单位id
                 domains: [], // 领域
                 type: "", // 型号
                 spec: "", // 规格
@@ -301,7 +303,6 @@ export default {
                 increment: "1", // 增量
                 remarks: "", // 备注
                 pic: "", // 图片
-                status: 1, // 状态
                 shelf: 0, // 是否上架
                 unitid: "", //主单位id
             },
@@ -327,7 +328,7 @@ export default {
                         trigger: "blur",
                     },
                 ],
-                unit: [
+                unitid: [
                     {
                         required: true,
                         message: this.$t("请选择主单位"),
@@ -392,6 +393,7 @@ export default {
             if (selectedUnit) {
                 this.form.unit = selectedUnit.unitname; // 赋值名称
                 this.form.auxunit = ""; // 清空辅助单位
+                this.form.auxunitid = ""; // 清空辅助单位id
             }
             this.unitGrouplist();
         },
@@ -410,6 +412,15 @@ export default {
             });
             this.unitGroupData = res.data;
         },
+        auxunitChange(e) {
+            // 根据 ID 找到对应的对象
+            let selectedAuxunit = this.unitGroupData.find(
+                (item) => item.unitgroupid === e
+            );
+            if (selectedAuxunit) {
+                this.form.auxunit = selectedAuxunit.unitgroupname; // 赋值名称
+            }
+        },
         async queryMain(fn) {
             const res = await this.$api.requested({
                 id: 2026051510000003,

+ 1 - 0
src/bgj/headquartersServiceMaterial/modules/baseInfo.vue

@@ -57,5 +57,6 @@ export default {
 /deep/.el-descriptions-item__label {
     font-size: 14px;
     color: rgb(163, 163, 163) !important;
+    white-space: nowrap;
 }
 </style>

+ 20 - 5
src/bgj/headquartersServiceMaterial/modules/detail.vue

@@ -93,7 +93,10 @@
                             nameKey="sc_itemsaleclassids"
                             message="确定删除当前分类吗?"
                             :id="scope.data.sc_itemsaleclassid"
-                            @deleteSuccess="$refs.saleClass.listData()"
+                            @deleteSuccess="
+                                $refs.saleClass.listData();
+                                queryMainData($route.query.id);
+                            "
                         ></delete-btn>
                     </template>
                 </saleClass>
@@ -184,7 +187,11 @@ export default {
                 },
                 {
                     label: "品牌",
-                    value: this.mainData.brand,
+                    value: Array.isArray(this.mainData.brand)
+                        ? this.mainData.brand
+                              .map((item) => item.brandname)
+                              .join(",")
+                        : "--",
                 },
                 {
                     label: "领域",
@@ -268,17 +275,25 @@ export default {
                     },
                     {
                         label: "品牌",
-                        value: this.mainData.brand,
+                        value: Array.isArray(this.mainData.brand)
+                            ? this.mainData.brand
+                                  .map((item) => item.brandname)
+                                  .join(",")
+                            : "--",
                     },
                     {
                         label: "分类",
-                        value: this.mainData.itemclassids,
+                        value: Array.isArray(this.mainData.itemClassList)
+                            ? this.mainData.itemClassList
+                                  .map((item) => item.itemclassfullname)
+                                  .join(",")
+                            : "--",
                     },
                     {
                         label: "领域",
                         value: Array.isArray(this.mainData.domains)
                             ? this.mainData.domains.join(",")
-                            : this.mainData.domains,
+                            : "--",
                     },
                     {
                         label: "备注",

+ 5 - 24
src/bgj/ourServiceMaterial/index.vue

@@ -11,6 +11,7 @@
             }"
             @checkboxCallBack="rows"
             :is_cache="true"
+            :isExport="false"
         >
             <template #titleRight>
                 <turnOn
@@ -35,7 +36,9 @@
                 ></batchRemoval>
                 <!-- v-if="tool.checkAuth($route.name, 'batchRemoval')" -->
                 <selectAllAndRemove
+                    v-if="$refs.list"
                     class="inline-16"
+                    :basicLayout="$refs.list"
                     :where="$refs.list.param.content.where"
                     :queryApiId="2026051510000002"
                     @selectAllAndRemoveSuccess="onSuccess"
@@ -78,24 +81,6 @@
                 </div>
             </template>
             <template v-slot:tbList="scope">
-                <!-- <div v-if="scope.data.column.columnname === 'status'">
-                    <span
-                        :style="
-                            tool.getStatusColor(
-                                scope.data.column.data[
-                                    [scope.data.column.columnname]
-                                ]
-                            )
-                        "
-                        >{{
-                            $t(
-                                scope.data.column.data[
-                                    [scope.data.column.columnname]
-                                ]
-                            )
-                        }}</span
-                    >
-                </div> -->
                 <div v-if="scope.data.column.columnname === 'isenable'">
                     <span
                         :style="
@@ -197,10 +182,8 @@ export default {
             this.$refs.list.listData();
         },
         selectChange() {
-            const where = this.$refs.list.param.content.where;
-            where.isenable = this.selectParam.isenable;
-            where.domain = this.selectParam.domain;
             this.$refs.list.param.content.pageNumber = 1;
+            this.$refs.list.param.content.where = this.selectParam;
             this.$refs.list.listData();
         },
         async fieldData() {
@@ -211,9 +194,7 @@ export default {
             this.tradefield = res.data;
         },
         listData() {
-            const where = this.$refs.list.param.content.where;
-            where.isenable = this.selectParam.isenable;
-            where.domain = this.selectParam.domain;
+            this.$refs.list.param.content.where = this.selectParam;
             this.$refs.list.listData();
         },
     },

+ 128 - 75
src/bgj/ourServiceMaterial/modules/detail.vue

@@ -17,6 +17,7 @@
             <div slot="tags"></div>
             <template slot="customOperation">
                 <Edit
+                    v-if="mainData.isenable == 0"
                     class="inline-16"
                     title_btn="编辑"
                     title_drawer="编辑服务物料"
@@ -24,6 +25,29 @@
                     :data="mainData"
                     @onSuccess="queryMainData"
                 ></Edit>
+                <el-button
+                    v-if="mainData.isenable == 0"
+                    type="primary"
+                    size="mini"
+                    :loading="btnLoading"
+                    @click="onToggleUsed(1, '启用', '2026051512000001')"
+                    >{{ $t("启 用") }}</el-button
+                >
+                <el-button
+                    v-if="mainData.isenable == 1"
+                    type="warning"
+                    size="mini"
+                    :loading="btnLoading"
+                    @click="onToggleUsed(0, '停用', '2026051512000002')"
+                    >{{ $t("停 用") }}</el-button
+                >
+                <el-button
+                    v-if="mainData.isenable == 0"
+                    type="danger"
+                    @click="onDelete"
+                    size="mini"
+                    >{{ $t(`移 除`) }}</el-button
+                >
             </template>
             <div slot="slot0">
                 <base-info
@@ -32,31 +56,7 @@
                 ></base-info>
             </div>
             <div slot="slot1">
-                <saleClass ref="saleClass" :data="mainData">
-                    <template v-slot:addClass="scope">
-                        <addClass
-                            v-if="
-                                tool.checkAuth($route.name, 'salerClass') &&
-                                mainData.status === '新建'
-                            "
-                            :data="scope.data"
-                            @onSuccess="
-                                $refs.saleClass.listData();
-                                queryMainData($route.query.id);
-                            "
-                        />
-                    </template>
-                    <template v-slot:delProduct="scope">
-                        <delete-btn
-                            v-if="tool.checkAuth($route.name, 'salerClass')"
-                            :nameId="20230214111502"
-                            nameKey="sa_itemsaleclassids"
-                            message="确定删除当前分类吗?"
-                            :id="scope.data.sa_itemsaleclassid"
-                            @deleteSuccess="$refs.saleClass.listData()"
-                        ></delete-btn>
-                    </template>
-                </saleClass>
+                <saleClass ref="saleClass" :data="mainData"> </saleClass>
             </div>
         </basicDetails>
     </div>
@@ -65,8 +65,7 @@
 <script>
 import Edit from "@/Form/ourServiceMaterial/add";
 import BaseInfo from "@/bgj/headquartersServiceMaterial/modules/baseInfo";
-import saleClass from "@/bgj/headquartersServiceMaterial/modules/saleClass.vue";
-import addClass from "@/bgj/headquartersServiceMaterial/modules/addClass";
+import saleClass from "./saleClass";
 export default {
     name: "detail",
     data() {
@@ -74,9 +73,10 @@ export default {
             mainData: {},
             mainAreaData: {},
             detailInfo: "",
+            btnLoading: false,
         };
     },
-    components: { Edit, BaseInfo, saleClass, addClass },
+    components: { Edit, BaseInfo, saleClass },
     methods: {
         async queryMainData() {
             const res = await this.$api.requested({
@@ -113,14 +113,6 @@ export default {
                     label: "计量单位",
                     value: this.mainData.unit,
                 },
-                {
-                    label: "起订量",
-                    value: this.mainData.start_num,
-                },
-                {
-                    label: "增量",
-                    value: this.mainData.increment,
-                },
                 {
                     label: "erp品号",
                     value: this.mainData.erpitemno,
@@ -129,10 +121,6 @@ export default {
                     label: "erp品名",
                     value: this.mainData.erpitemname,
                 },
-                {
-                    label: "品牌",
-                    value: this.mainData.brand,
-                },
                 {
                     label: "领域",
                     value: Array.isArray(this.mainData.domains)
@@ -144,32 +132,23 @@ export default {
                     value: this.mainData.marketprice,
                 },
                 {
-                    label: "上/下架",
-                    value: this.mainData.shelf == 1 ? "上架" : "下架",
-                    style: () => {
-                        let color =
-                            this.mainData.shelf == 1
-                                ? this.tool.getStatusColor("上架", true)
-                                : this.tool.getStatusColor("下架", true);
-                        return { color: color };
-                    },
+                    label: "品牌",
+                    value: Array.isArray(this.mainData.brand)
+                        ? this.mainData.brand
+                              .map((item) => item.brandname)
+                              .join(",")
+                        : "--",
                 },
                 {
-                    label: "状态",
-                    value: this.mainData.status == 1 ? "新建" : "审核",
+                    label: "使用状态",
+                    value: this.mainData.isenable == 1 ? "启用" : "停用",
                     style: () => {
                         let color =
-                            this.mainData.status == 1
-                                ? this.tool.getStatusColor("新建", true)
-                                : this.tool.getStatusColor("审核", true);
+                            this.mainData.isenable == 1
+                                ? this.tool.getStatusColor("启用", true)
+                                : this.tool.getStatusColor("停用", true);
                         return { color: color };
                     },
-                    // style: function () {
-                    //     let style = that.tool.getStatusColor(
-                    //         that.mainData.status
-                    //     );
-                    //     return style;
-                    // },
                 },
             ];
             this.detailInfo = {
@@ -183,13 +162,13 @@ export default {
                         value: this.mainData.code,
                     },
                     {
-                        label: "状态",
-                        value: this.mainData.status == 1 ? "新建" : "审核",
+                        label: "使用状态",
+                        value: this.mainData.isenable == 1 ? "启用" : "停用",
                         style: () => {
                             let color =
-                                this.mainData.status == 1
-                                    ? this.tool.getStatusColor("新建", true)
-                                    : this.tool.getStatusColor("审核", true);
+                                this.mainData.isenable == 1
+                                    ? this.tool.getStatusColor("启用", true)
+                                    : this.tool.getStatusColor("停用", true);
                             return { color: color };
                         },
                     },
@@ -215,11 +194,19 @@ export default {
                     },
                     {
                         label: "品牌",
-                        value: this.mainData.brand,
+                        value: Array.isArray(this.mainData.brand)
+                            ? this.mainData.brand
+                                  .map((item) => item.brandname)
+                                  .join(",")
+                            : "--",
                     },
                     {
                         label: "分类",
-                        value: this.mainData.itemclassids,
+                        value: Array.isArray(this.mainData.itemClassList)
+                            ? this.mainData.itemClassList
+                                  .map((item) => item.itemclassfullname)
+                                  .join(",")
+                            : "--",
                     },
                     {
                         label: "领域",
@@ -233,17 +220,83 @@ export default {
                     },
                 ],
                 systemInfo: [
-                    { label: "创建人", value: this.mainData.createby },
-                    { label: "创建时间", value: this.mainData.createdate },
-                    { label: "最近编辑人", value: this.mainData.changeby },
-                    { label: "最近编辑时间", value: this.mainData.changedate },
-                    { label: "上架人", value: this.mainData.onsaleby },
-                    { label: "上架时间", value: this.mainData.shefl_time },
-                    { label: "审核人", value: this.mainData.checkby },
-                    { label: "审核时间", value: this.mainData.checkdate },
+                    {
+                        label: "添加至本站时间",
+                        value: this.mainData.createdate,
+                    },
+                    { label: "启用时间", value: this.mainData.enable_time },
+                    {
+                        label: "停用时间",
+                        value: this.mainData.disable_time,
+                    },
                 ],
             };
         },
+        onToggleUsed(value, actionText, id) {
+            this.$confirm(
+                this.$t(`确认${actionText}当前服务物料吗`) + "?",
+                this.$t("提示"),
+                {
+                    confirmButtonText: this.$t("确定"),
+                    cancelButtonText: this.$t("取消"),
+                    type: "warning",
+                    beforeClose: async (action, instance, done) => {
+                        if (action === "confirm") {
+                            instance.confirmButtonLoading = true;
+                            const res = await this.$api.requested({
+                                id: id,
+                                content: {
+                                    sc_item_localids: this.$route.query.id,
+                                },
+                            });
+                            this.tool.showMessage(res, () => {
+                                setTimeout(() => {
+                                    instance.confirmButtonLoading = false;
+                                    done();
+                                    this.queryMainData();
+                                }, 500);
+                            });
+                        } else {
+                            done();
+                        }
+                    },
+                }
+            ).catch(() => {});
+        },
+        onDelete() {
+            this.$confirm(
+                this.$t("是否确认移除本服务物料") + "?",
+                this.$t("提示"),
+                {
+                    confirmButtonText: this.$t("确定"),
+                    cancelButtonText: this.$t("取消"),
+                    type: "warning",
+                }
+            )
+                .then(async () => {
+                    const res = await this.$api.requested({
+                        id: "2026051510000004",
+                        content: {
+                            sc_item_localid: this.$route.query.id,
+                        },
+                    });
+                    if (res.code === 0) {
+                        this.$message.error(res.data[0].errmsg);
+                    } else {
+                        this.$message({
+                            message: this.$t("移除成功"),
+                            type: "success",
+                        });
+                        this.$store.dispatch("changeDetailDrawer", false);
+                    }
+                })
+                .catch(() => {
+                    this.$message({
+                        type: "info",
+                        message: this.$t("已取消移除"),
+                    });
+                });
+        },
         // 监听切换数据,上一页,下一页
         pageChange(id, rowindex, tabIndex) {
             this.flag = false;

+ 104 - 0
src/bgj/ourServiceMaterial/modules/saleClass.vue

@@ -0,0 +1,104 @@
+
+<template>
+    <div>
+        <div style="display: flex; align-items: center">
+            <slot
+                name="addClass"
+                :data="{ checkArr: checkArr, data: data }"
+            ></slot>
+        </div>
+        <div style="margin-top: 15px">
+            <table-new-layout
+                :layout="tablecols"
+                :data="list"
+                :opwidth="200"
+                :custom="true"
+                :width="true"
+                :height="tableHieght"
+                fixedName="operation"
+            >
+                <template v-slot:customcol="scope">
+                    <p>
+                        {{ $t(scope.column.data[scope.column.columnname]) }}
+                    </p>
+                </template>
+                <template v-slot:opreation="scope">
+                    <slot name="delProduct" :data="scope.data"></slot>
+                </template>
+            </table-new-layout>
+        </div>
+        <div style="margin-top: 16px; text-align: right">
+            <el-pagination
+                background
+                small
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="params.content.pageNumber"
+                :page-size="params.content.pageSize"
+                layout="total, prev, pager, next, jumper"
+                :total="total"
+            >
+            </el-pagination>
+        </div>
+    </div>
+</template>
+
+<script>
+export default {
+    props: ["data"],
+    data() {
+        return {
+            tableHieght: "calc(100vh - 371px)",
+            tablecols: [],
+            list: [],
+            total: 0,
+            params: {
+                id: 20220927090206,
+                content: {
+                    itemid: "",
+                    itemno: "",
+                    itemtype: 2, //1=总部 2=本地
+                    pageNumber: 1,
+                    pageSize: 20,
+                    where: {
+                        condition: "",
+                    },
+                },
+            },
+            options: [],
+            productList: "",
+            currentProduct: {},
+            checkArr: [],
+        };
+    },
+    methods: {
+        async listData() {
+            this.params.content.itemid = this.data.sc_itemid;
+            this.params.content.itemno = this.data.code;
+            const res = await this.$api.requested(this.params);
+            this.list = res.data;
+            this.total = res.total;
+            this.checkArr = this.list.map((item) => item.itemclassid);
+            console.log(this.list);
+        },
+        handleSizeChange(val) {
+            // console.log(`每页 ${val} 条`);
+            this.params.content.pageSize = val;
+            this.listData();
+        },
+        handleCurrentChange(val) {
+            // console.log(`当前页: ${val}`);
+            this.params.content.pageNumber = val;
+            this.listData();
+        },
+    },
+    created() {
+        this.listData();
+        this.tablecols = this.tool.tabelCol(
+            this.$route.name
+        ).materialClassificationTable.tablecols;
+    },
+};
+</script>
+<style scoped>
+</style>

+ 14 - 8
src/bgj/ourServiceMaterial/modules/selectAllAndRemove.vue

@@ -9,17 +9,22 @@
 <script>
 export default {
     name: "selectAllAndRemove",
-    props: ["where", "queryApiId"],
+    props: ["where", "queryApiId", "basicLayout"],
     methods: {
         onshow() {
-            this.onSelectAllAndRemove();
+            this.selectAll();
+        },
+        selectAll() {
+            const basicLayout = this.basicLayout;
+            const elTable = basicLayout.$refs.table.$refs.tables;
+            basicLayout.list.forEach((row) => {
+                elTable.toggleRowSelection(row, true);
+            });
+            this.$nextTick(() => {
+                this.onSelectAllAndRemove();
+            });
         },
         async onSelectAllAndRemove() {
-            // const basicLayout = this.$parent.$refs.list;
-            // const elTable = basicLayout.$refs.table.$refs.tables;
-            // basicLayout.list.forEach((row) => {
-            //     elTable.toggleRowSelection(row, true);
-            // });
             this.$confirm(
                 this.$t("是否确定移除全部物料") + "?",
                 this.$t("提示"),
@@ -52,7 +57,8 @@ export default {
                     });
                 })
                 .catch(async () => {
-                    // elTable.clearSelection();
+                    const elTable = this.basicLayout.$refs.table.$refs.tables;
+                    elTable.clearSelection();
                     this.$message({
                         type: "info",
                         message: this.$t("已取消全选并移除"),