Просмотр исходного кода

终端工单模板 增加“是否工单完结时生成质保卡”字段

NULL1222 2 недель назад
Родитель
Сommit
9b2456347d

+ 85 - 32
src/Form/terminalWorkBillModule/add.vue

@@ -1,7 +1,11 @@
 <template>
     <div>
-        <el-button size="mini" type="primary" @click="show">
-            {{ title_btn ? $t(title_btn) : $t('新 建') }}
+        <el-button
+            :size="btn_size ? btn_size : 'small'"
+            type="primary"
+            @click="show"
+        >
+            {{ title_btn ? $t(title_btn) : $t("新 建") }}
         </el-button>
         <el-dialog
             :title="title_drawer ? $t(title_drawer) : $t(`新建工单模板`)"
@@ -20,7 +24,11 @@
                 >
                     <el-col :span="24">
                         <el-form-item :label="$t('模板名称:')" prop="name">
-                            <el-input ref="nameInput" v-model="form.name" :placeholder="$t('请填写')"></el-input>
+                            <el-input
+                                ref="nameInput"
+                                v-model="form.name"
+                                :placeholder="$t('请填写')"
+                            ></el-input>
                         </el-form-item>
                     </el-col>
                     <el-col :span="24">
@@ -37,26 +45,45 @@
                     </el-col>
                     <el-col :span="24">
                         <el-form-item>
-                            <el-checkbox v-model="form.isworkorder" :true-label="1" :false-label="0">
-                                {{ $t('是否有后续工单') }}
+                            <el-checkbox
+                                v-model="form.isworkorder"
+                                :true-label="1"
+                                :false-label="0"
+                            >
+                                {{ $t("是否有后续工单") }}
+                            </el-checkbox>
+                            <el-checkbox
+                                v-model="form.ispoints"
+                                :true-label="1"
+                                :false-label="0"
+                            >
+                                {{ $t("是否积分计算") }}
                             </el-checkbox>
-
-                            <el-checkbox v-model="form.ispoints" :true-label="1" :false-label="0">
-                                {{ $t('是否积分计算') }}
+                            <el-checkbox
+                                v-model="form.iswarrantycard"
+                                :true-label="1"
+                                :false-label="0"
+                            >
+                                {{ $t("是否工单完结时生成质保卡") }}
                             </el-checkbox>
                         </el-form-item>
                     </el-col>
                 </el-form>
             </el-row>
             <div class="dialog-footer">
-                <el-button size="small" @click="onCancel" class="normal-btn-width">{{ $t('取 消') }}</el-button>
+                <el-button
+                    size="small"
+                    @click="onCancel"
+                    class="normal-btn-width"
+                    >{{ $t("取 消") }}</el-button
+                >
                 <el-button
                     :loading="loading"
                     class="normal-btn-width"
                     size="small"
                     :type="title_btn == '编辑' ? 'warning' : 'primary'"
                     @click="onSubmit"
-                    >{{ title_btn == '编辑' ? $t('保 存') : $t('确 定') }}
+                    >{{ title_btn == "编辑" ? $t("保 存") : $t("确 定") }}
                 </el-button>
             </div>
         </el-dialog>
@@ -64,15 +91,20 @@
 </template>
 <script>
 export default {
-    name: 'add',
-    props: { title_btn: String, title_drawer: String, data: Object },
+    name: "add",
+    props: {
+        btn_size: String,
+        title_btn: String,
+        title_drawer: String,
+        data: Object,
+    },
     data() {
         return {
             typeOptions: [], //工单类型
             typeProps: {
-                value: 'value',
-                label: 'label',
-                children: 'children',
+                value: "value",
+                label: "label",
+                children: "children",
                 checkStrictly: true, //允许只选一级
             },
             loading: false,
@@ -80,22 +112,38 @@ export default {
             currentData: {},
             form: {
                 sc_workorder_templateid: 0,
-                name: '', //模板名称
-                type: '', //工单类型
+                name: "", //模板名称
+                type: "", //工单类型
                 isused: 0, //是否启用
                 isworkorder: 0, //是否有后续工单 否0,是1 默认否
                 ispoints: 0, //是否积分计算 否0,是1 默认否
+                iswarrantycard: 0, //是否工单完结时生成质保卡 否0,是1 默认否
             },
             rules: {
-                name: [{ required: true, message: this.$t('请填写模板名称'), trigger: 'blur' }],
-                type: [{ required: true, message: this.$t('请选择工单类型'), trigger: 'change' }],
+                name: [
+                    {
+                        required: true,
+                        message: this.$t("请填写模板名称"),
+                        trigger: "blur",
+                    },
+                ],
+                type: [
+                    {
+                        required: true,
+                        message: this.$t("请选择工单类型"),
+                        trigger: "change",
+                    },
+                ],
             },
         };
     },
     methods: {
         async getWorktype() {
-            const res = await this.$store.dispatch('optiontypeselect', 'endcustomerserviceworktype');
-            console.log('工单类型', res.data);
+            const res = await this.$store.dispatch(
+                "optiontypeselect",
+                "endcustomerserviceworktype"
+            );
+            console.log("工单类型", res.data);
             this.typeOptions = res.data.map((item) => {
                 return {
                     value: item.value,
@@ -114,9 +162,11 @@ export default {
         show() {
             this.getWorktype();
             this.dialogFormVisible = true;
-            if (this.title_btn == '编辑') {
+            if (this.title_btn == "编辑") {
                 this.form = Object.assign({}, this.form, this.data);
-                this.form.type = this.data.type ? this.data.type.split('/') : [];
+                this.form.type = this.data.type
+                    ? this.data.type.split("/")
+                    : [];
             }
             this.$nextTick(() => {
                 this.$refs.nameInput.focus();
@@ -124,23 +174,23 @@ export default {
         },
         onSubmit() {
             console.log(this.form);
-            this.$refs['form'].validate(async (valid) => {
+            this.$refs["form"].validate(async (valid) => {
                 if (!valid) return false;
                 this.loading = true;
-                this.form.type = this.form.type.join('/');
+                this.form.type = this.form.type.join("/");
                 const res = await this.$api.requested({
-                    id: '2026051511251702',
+                    id: "2026051511251702",
                     content: this.form,
                 });
                 this.tool.showMessage(res, () => {
                     setTimeout(() => {
                         this.loading = false;
-                        this.$emit('onSuccess');
-                        this.$refs['form'].resetFields();
+                        this.$emit("onSuccess");
+                        this.$refs["form"].resetFields();
                         this.dialogFormVisible = false;
-                        this.$store.dispatch('changeDetailDrawer', true);
+                        this.$store.dispatch("changeDetailDrawer", true);
                         this.$router.push({
-                            path: '/terminalWorkBillModuleDetail',
+                            path: "/terminalWorkBillModuleDetail",
                             query: {
                                 id: res.data.sc_workorder_templateid,
                                 rowindex: res.data.rowindex,
@@ -152,11 +202,14 @@ export default {
         },
         onCancel() {
             this.dialogFormVisible = false;
-            this.$refs['form'].resetFields();
+            this.$refs["form"].resetFields();
         },
         async queryType(type) {
             if (this.options[type].length == 0) {
-                const res = await this.$store.dispatch('optiontypeselect', type);
+                const res = await this.$store.dispatch(
+                    "optiontypeselect",
+                    type
+                );
                 this.options[type] = res.data;
             }
         },

+ 66 - 37
src/HDrpManagement/terminalWorkBillModule/index.vue

@@ -12,10 +12,27 @@
         >
             <template v-slot:tbList="scope">
                 <div v-if="scope.data.column.columnname == 'isworkorder'">
-                    {{ scope.data.column.data.isworkorder == 1 ? $t('是') : $t('否') }}
+                    {{
+                        scope.data.column.data.isworkorder == 1
+                            ? $t("是")
+                            : $t("否")
+                    }}
                 </div>
                 <div v-else-if="scope.data.column.columnname == 'ispoints'">
-                    {{ scope.data.column.data.ispoints == 1 ? $t('是') : $t('否') }}
+                    {{
+                        scope.data.column.data.ispoints == 1
+                            ? $t("是")
+                            : $t("否")
+                    }}
+                </div>
+                <div
+                    v-else-if="scope.data.column.columnname == 'iswarrantycard'"
+                >
+                    {{
+                        scope.data.column.data.iswarrantycard == 1
+                            ? $t("是")
+                            : $t("否")
+                    }}
                 </div>
                 <div v-else-if="scope.data.column.columnname == 'isused'">
                     <el-switch
@@ -23,15 +40,22 @@
                         :inactive-value="0"
                         :value="scope.data.column.data.isused"
                         size="small"
-                        :loading="switchLoadingId === scope.data.column.data.sc_workorder_templateid"
+                        :loading="
+                            switchLoadingId ===
+                            scope.data.column.data.sc_workorder_templateid
+                        "
                         @change="switchChange(scope.data.column.data, $event)"
                     ></el-switch>
                 </div>
                 <div v-else>
                     {{
                         scope.data.column.data[[scope.data.column.columnname]]
-                            ? $t(scope.data.column.data[[scope.data.column.columnname]])
-                            : '--'
+                            ? $t(
+                                  scope.data.column.data[
+                                      [scope.data.column.columnname]
+                                  ]
+                              )
+                            : "--"
                     }}
                 </div>
             </template>
@@ -49,44 +73,49 @@ export default {
     },
     methods: {
         switchChange(data, newVal) {
-            const actionText = newVal == 1 ? '启用' : '禁用';
-            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;
-                        this.switchLoadingId = data.sc_workorder_templateid;
-                        const res = await this.$api.requested({
-                            id: '2026051513140102',
-                            content: {
-                                sc_workorder_templateid: data.sc_workorder_templateid,
-                                isused: newVal,
-                            },
-                        });
-                        this.tool.showMessage(res, () => {
-                            setTimeout(() => {
-                                instance.confirmButtonLoading = false;
-                                this.switchLoadingId = null;
-                                done();
-                                this.$refs.list.listData();
-                            }, 500);
-                        });
-                    } else {
-                        done();
-                    }
-                },
-            }).catch(() => {});
+            const actionText = newVal == 1 ? "启用" : "禁用";
+            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;
+                            this.switchLoadingId = data.sc_workorder_templateid;
+                            const res = await this.$api.requested({
+                                id: "2026051513140102",
+                                content: {
+                                    sc_workorder_templateid:
+                                        data.sc_workorder_templateid,
+                                    isused: newVal,
+                                },
+                            });
+                            this.tool.showMessage(res, () => {
+                                setTimeout(() => {
+                                    instance.confirmButtonLoading = false;
+                                    this.switchLoadingId = null;
+                                    done();
+                                    this.$refs.list.listData();
+                                }, 500);
+                            });
+                        } else {
+                            done();
+                        }
+                    },
+                }
+            ).catch(() => {});
         },
         detailGo(row) {
             let route = this.$route;
-            if (route.path !== '/terminalWorkBillModuleDetail') {
+            if (route.path !== "/terminalWorkBillModuleDetail") {
                 this.oldRoute = { path: route.path, query: route.query };
-                this.$store.dispatch('setHistoryRouter', this.oldRoute);
+                this.$store.dispatch("setHistoryRouter", this.oldRoute);
             }
             this.$router.push({
-                path: '/terminalWorkBillModuleDetail',
+                path: "/terminalWorkBillModuleDetail",
                 query: {
                     id: row.sc_workorder_templateid,
                     rowindex: row.rowindex,

+ 115 - 80
src/HDrpManagement/terminalWorkBillModule/modules/detail.vue

@@ -20,6 +20,7 @@
                     class="inline-16"
                     title_btn="编辑"
                     title_drawer="编辑工单模板"
+                    btn_size="mini"
                     :data="mainData"
                     @onSuccess="queryMainData"
                 ></Edit>
@@ -29,37 +30,44 @@
                     size="mini"
                     :loading="btnLoading"
                     @click="onToggleUsed(1, '启用')"
-                >{{ $t('启 用') }}</el-button>
+                    >{{ $t("启 用") }}</el-button
+                >
                 <el-button
                     v-if="mainData.isused == 1"
                     type="warning"
                     size="mini"
                     :loading="btnLoading"
                     @click="onToggleUsed(0, '禁用')"
-                >{{ $t('禁 用') }}</el-button>
-                <el-button type="danger" @click="onDelete" size="mini">{{ $t(`删 除`) }}</el-button>
+                    >{{ $t("禁 用") }}</el-button
+                >
+                <el-button type="danger" @click="onDelete" size="mini">{{
+                    $t(`删 除`)
+                }}</el-button>
             </template>
             <div slot="slot0">
                 <taskDetail> </taskDetail>
             </div>
             <div slot="slot1">
-                <base-info v-if="detailInfo" :detailInfo="detailInfo"></base-info>
+                <base-info
+                    v-if="detailInfo"
+                    :detailInfo="detailInfo"
+                ></base-info>
             </div>
         </basicDetails>
     </div>
 </template>
 
 <script>
-import Edit from '@/Form/terminalWorkBillModule/add';
-import BaseInfo from '@/HDrpManagement/projectChange/modules/modules/baseInfo/baseInfo';
-import taskDetail from './taskDetail/index';
+import Edit from "@/Form/terminalWorkBillModule/add";
+import BaseInfo from "@/HDrpManagement/projectChange/modules/modules/baseInfo/baseInfo";
+import taskDetail from "./taskDetail/index";
 export default {
-    name: 'detail',
+    name: "detail",
     data() {
         return {
             mainData: {},
             mainAreaData: [],
-            detailInfo: '',
+            detailInfo: "",
             processDetailList: [],
             btnLoading: false,
         };
@@ -72,42 +80,51 @@ export default {
     },
     methods: {
         onToggleUsed(value, actionText) {
-            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: '2026051513140102',
-                            content: {
-                                sc_workorder_templateid: this.$route.query.id,
-                                isused: value,
-                            },
-                        });
-                        this.tool.showMessage(res, () => {
-                            setTimeout(() => {
-                                instance.confirmButtonLoading = false;
-                                done();
-                                this.queryMainData();
-                            }, 500);
-                        });
-                    } else {
-                        done();
-                    }
-                },
-            }).catch(() => {});
+            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: "2026051513140102",
+                                content: {
+                                    sc_workorder_templateid:
+                                        this.$route.query.id,
+                                    isused: value,
+                                },
+                            });
+                            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',
-            })
+            this.$confirm(
+                this.$t("是否确认删除此工单模板") + "?",
+                this.$t("提示"),
+                {
+                    confirmButtonText: this.$t("确定"),
+                    cancelButtonText: this.$t("取消"),
+                    type: "warning",
+                }
+            )
                 .then(async () => {
                     const res = await this.$api.requested({
-                        id: '2026051513141202',
+                        id: "2026051513141202",
                         content: {
                             sc_workorder_templateids: [this.$route.query.id],
                         },
@@ -116,16 +133,16 @@ export default {
                         this.$message.error(res.data[0].errmsg);
                     } else {
                         this.$message({
-                            message: this.$t('删除成功'),
-                            type: 'success',
+                            message: this.$t("删除成功"),
+                            type: "success",
                         });
-                        this.$store.dispatch('changeDetailDrawer', false);
+                        this.$store.dispatch("changeDetailDrawer", false);
                     }
                 })
                 .catch(() => {
                     this.$message({
-                        type: 'info',
-                        message: this.$t('已取消删除'),
+                        type: "info",
+                        message: this.$t("已取消删除"),
                     });
                 });
         },
@@ -138,30 +155,30 @@ export default {
             });
             this.mainData = res.data;
             this.changeDataStructure();
-            console.log('this.mainData', this.mainData);
+            console.log("this.mainData", this.mainData);
         },
         changeDataStructure() {
             let that = this;
             this.mainAreaData = [
                 {
-                    label: '模板名称',
+                    label: "模板名称",
                     value: this.mainData.name,
                 },
                 {
-                    label: '工单类型',
+                    label: "工单类型",
                     value: this.mainData.type,
                 },
                 {
-                    label: '是否启用',
-                    value: this.mainData.isused ? '是' : '否',
+                    label: "是否启用",
+                    value: this.mainData.isused ? "是" : "否",
                     style: function () {
                         let style = {};
                         switch (that.mainData.isused) {
                             case 1:
-                                style = { color: '#ff0000' };
+                                style = { color: "#ff0000" };
                                 break;
                             case 0:
-                                style = { color: '#666666' };
+                                style = { color: "#666666" };
                                 break;
                             default:
                                 break;
@@ -170,16 +187,16 @@ export default {
                     },
                 },
                 {
-                    label: '是否后续工单',
-                    value: this.mainData.isworkorder ? '是' : '否',
+                    label: "是否后续工单",
+                    value: this.mainData.isworkorder ? "是" : "否",
                     style: function () {
                         let style = {};
                         switch (that.mainData.isworkorder) {
                             case 1:
-                                style = { color: '#ff0000' };
+                                style = { color: "#ff0000" };
                                 break;
                             case 0:
-                                style = { color: '#666666' };
+                                style = { color: "#666666" };
                                 break;
                             default:
                                 break;
@@ -188,16 +205,34 @@ export default {
                     },
                 },
                 {
-                    label: '是否积分计算',
-                    value: this.mainData.ispoints ? '是' : '否',
+                    label: "是否积分计算",
+                    value: this.mainData.ispoints ? "是" : "否",
                     style: function () {
                         let style = {};
                         switch (that.mainData.ispoints) {
                             case 1:
-                                style = { color: '#ff0000' };
+                                style = { color: "#ff0000" };
+                                break;
+                            case 0:
+                                style = { color: "#666666" };
+                                break;
+                            default:
+                                break;
+                        }
+                        return style;
+                    },
+                },
+                {
+                    label: "是否工单完结时生成质保卡",
+                    value: this.mainData.iswarrantycard ? "是" : "否",
+                    style: function () {
+                        let style = {};
+                        switch (that.mainData.iswarrantycard) {
+                            case 1:
+                                style = { color: "#ff0000" };
                                 break;
                             case 0:
-                                style = { color: '#666666' };
+                                style = { color: "#666666" };
                                 break;
                             default:
                                 break;
@@ -209,24 +244,24 @@ export default {
             this.detailInfo = {
                 baseInfo: [
                     {
-                        label: '模板名称',
+                        label: "模板名称",
                         value: this.mainData.name,
                     },
                     {
-                        label: '工单类型',
+                        label: "工单类型",
                         value: this.mainData.type,
                     },
                     {
-                        label: '是否启用',
-                        value: this.mainData.isused ? '是' : '否',
+                        label: "是否启用",
+                        value: this.mainData.isused ? "是" : "否",
                         style: function () {
                             let style = {};
                             switch (that.mainData.isused) {
                                 case 1:
-                                    style = { color: '#ff0000' };
+                                    style = { color: "#ff0000" };
                                     break;
                                 case 0:
-                                    style = { color: '#666666' };
+                                    style = { color: "#666666" };
                                     break;
                                 default:
                                     break;
@@ -235,16 +270,16 @@ export default {
                         },
                     },
                     {
-                        label: '是否后续工单',
-                        value: this.mainData.isworkorder ? '是' : '否',
+                        label: "是否后续工单",
+                        value: this.mainData.isworkorder ? "是" : "否",
                         style: function () {
                             let style = {};
                             switch (that.mainData.isworkorder) {
                                 case 1:
-                                    style = { color: '#ff0000' };
+                                    style = { color: "#ff0000" };
                                     break;
                                 case 0:
-                                    style = { color: '#666666' };
+                                    style = { color: "#666666" };
                                     break;
                                 default:
                                     break;
@@ -253,16 +288,16 @@ export default {
                         },
                     },
                     {
-                        label: '是否积分计算',
-                        value: this.mainData.ispoints ? '是' : '否',
+                        label: "是否积分计算",
+                        value: this.mainData.ispoints ? "是" : "否",
                         style: function () {
                             let style = {};
                             switch (that.mainData.ispoints) {
                                 case 1:
-                                    style = { color: '#ff0000' };
+                                    style = { color: "#ff0000" };
                                     break;
                                 case 0:
-                                    style = { color: '#666666' };
+                                    style = { color: "#666666" };
                                     break;
                                 default:
                                     break;
@@ -272,10 +307,10 @@ 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.createby },
+                    { label: "创建时间", value: this.mainData.createdate },
+                    { label: "最近编辑人", value: this.mainData.changeby },
+                    { label: "最近编辑时间", value: this.mainData.changedate },
                 ],
             };
         },
@@ -284,7 +319,7 @@ export default {
             this.flag = false;
             tabIndex = this.$route.query.tabIndex;
             this.$router.replace({
-                path: '/serveWorkTaskDetail',
+                path: "/serveWorkTaskDetail",
                 query: { id: id, rowindex: rowindex, tabIndex: tabIndex },
             });
             this.queryMainData(id);