田源
2024-09-06 bf70f3cf825f44c457dba2bebd26e7af73e4b2a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
  <el-dialog
    :visible.sync="dialogVisible"
    v-dialogDrag
    top="0vh"
    title="相似项查询"
    :width="width"
    append-to-body
    @opened="openDialog"
    class="avue-dialog avue-dialog--top"
  >
    <ResembleQuery
      v-loading="loading"
      ref="ResembleQuery"
      v-bind="$attrs"
      :column="column"
      :templateOid="templateOid"
      :codeRuleOid="codeRuleOid"
      :codeClassifyOid="codeClassifyOid"
    ></ResembleQuery>
  </el-dialog>
</template>
 
<script>
import { getFormTemplate, getFormDetail } from "@/api/formTemplate";
import ResembleQuery from "./ResembleQuery";
export default {
  name: "ResembleQueryDialog",
  components: { ResembleQuery },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    codeClassifyOid: {
      type: String,
      default: "",
    },
    templateOid: {
      type: String,
      default: "",
    },
    rowOid: "",
    codeRuleOid: {
      type: String,
      default: "",
    },
    type: {
      type: String,
      default: "add",
    },
    form: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      column: [],
      loading: false,
      detailData: {},
    };
  },
  computed: {
    dialogVisible: {
      get() {
        return this.visible;
      },
      set(val) {
        this.$emit("update:visible", val);
      },
    },
  },
  methods: {
    openDialog() {
      this.loading = true;
      getFormDetail({ templateOid: this.templateOid, oid: this.rowOid })
        .then((res) => {
          this.detailData = res.data.data[0] || {};
          return getFormTemplate({
            templateOid: this.templateOid,
            codeClassifyOid: this.codeClassifyOid,
          });
        })
        .then((res) => {
          this.loading = false;
          if (
            res.data &&
            res.data.resembleTableVO.cols &&
            res.data.resembleTableVO.cols.length > 0
          ) {
            this.column = res.data.resembleTableVO.cols;
            this.$refs.ResembleQuery.resembleQuery(this.detailData);
          } else {
            this.column = [];
          }
        });
    },
  },
};
</script>
 
<style lang="less" scoped></style>