NULL1222 4 дней назад
Родитель
Сommit
f7e978c092
1 измененных файлов с 69 добавлено и 61 удалено
  1. 69 61
      src/bgj/serviceWorkItem/index.vue

+ 69 - 61
src/bgj/serviceWorkItem/index.vue

@@ -1,73 +1,81 @@
 <template>
-    <div>
-        <basicLayout
-            ref="list"
-            formPath="serviceWorkItem"
-            tableName="serviceWorkItemTable"
-            idName="sc_workpresetid"
-            :apiId="{ query: 2026051416494002, del: 2026051416503602 }"
-            :detailPath="{
-                path: '/serviceWorkItemDetail',
-            }"
+  <div>
+    <basicLayout
+      ref="list"
+      formPath="serviceWorkItem"
+      tableName="serviceWorkItemTable"
+      idName="sc_workpresetid"
+      :apiId="{ query: 2026051416494002, del: 2026051416503602 }"
+      :detailPath="{
+        path: '/serviceWorkItemDetail',
+      }"
+    >
+      <template v-slot:tbList="scope">
+        <div
+          :style="
+            getColumnColor(
+              scope.data.column.columnname,
+              scope.data.column.data[scope.data.column.columnname]
+            )
+          "
         >
-            <template v-slot:tbList="scope">
-                <div>
-                    {{
-                        formatColumnValue(
-                            scope.data.column.columnname,
-                            scope.data.column.data[scope.data.column.columnname]
-                        )
-                    }}
-                </div>
-            </template>
-            <template v-slot:tbOpreation="scope"> </template>
-        </basicLayout>
-    </div>
+          {{
+            formatColumnValue(
+              scope.data.column.columnname,
+              scope.data.column.data[scope.data.column.columnname]
+            )
+          }}
+        </div>
+      </template>
+      <template v-slot:tbOpreation="scope"> </template>
+    </basicLayout>
+  </div>
 </template>
 
 <script>
 export default {
-    data() {
-        return {
-            // 是否类型字段
-            booleanFields: ["formcheck", "servicenode","logreport"],
-
-            // 通用状态
-            commonStatusMap: {
-                0: "无",
-                1: "非必填",
-                11: "必填",
-            },
-
-            // 是否状态
-            booleanStatusMap: {
-                0: "否",
-                1: "是",
-            },
-        };
+  data() {
+    return {
+      // 是否类型字段
+      booleanFields: ["formcheck", "servicenode", "logreport"],
+      // 通用状态
+      commonStatusMap: { 0: "无", 1: "非必填", 11: "必填" },
+      // 是否状态
+      booleanStatusMap: { 0: "否", 1: "是" },
+    };
+  },
+  methods: {
+    formatColumnValue(columnName, value) {
+      const map = this.booleanFields.includes(columnName)
+        ? this.booleanStatusMap
+        : this.commonStatusMap;
+      return this.$t(map[value] || value || "--");
     },
-    methods: {
-        formatColumnValue(columnName, value) {
-            const map = this.booleanFields.includes(columnName)
-                ? this.booleanStatusMap
-                : this.commonStatusMap;
-            return this.$t(map[value] || value || "--");
-        },
-        detailGo(row) {
-            let route = this.$route;
-            if (route.path !== "/serviceWorkItemDetail") {
-                this.oldRoute = { path: route.path, query: route.query };
-                this.$store.dispatch("setHistoryRouter", this.oldRoute);
-            }
-            this.$router.push({
-                path: "/serviceWorkItemDetail",
-                query: {
-                    id: row.sc_workpresetid,
-                    rowindex: row.rowindex,
-                },
-            });
+    // 返回颜色样式
+    getColumnColor(columnName, value) {
+      if (this.booleanFields.includes(columnName)) {
+        return value === 1 ? "color:#ff0000" : "color:#666666";
+      } else {
+        if (value === 11) return "color:#ff0000";
+        if (value === 1) return "color:#008000";
+        return "";
+      }
+    },
+    detailGo(row) {
+      let route = this.$route;
+      if (route.path !== "/serviceWorkItemDetail") {
+        this.oldRoute = { path: route.path, query: route.query };
+        this.$store.dispatch("setHistoryRouter", this.oldRoute);
+      }
+      this.$router.push({
+        path: "/serviceWorkItemDetail",
+        query: {
+          id: row.sc_workpresetid,
+          rowindex: row.rowindex,
         },
+      });
     },
+  },
 };
 </script>
 <style></style>