lkk
2024-12-30 105242d9df9bda200da395b04972b65cb22a4496
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="表名" prop="tbname">
        <el-input
          ref="inputName"
          v-model="queryParams.tbname"
          placeholder="请输入表名"
          clearable
          @keyup.enter.native="handleQuery"
          style="width: 170px"
        />
      </el-form-item>
      <el-form-item label="字段名" prop="zd">
        <el-input
          v-model="queryParams.zd"
          placeholder="请输入字段名"
          clearable
          @keyup.enter.native="handleQuery"
          style="width: 170px"
        />
      </el-form-item>
      <el-form-item label="拼音名" prop="pymzd">
        <el-input
          v-model="queryParams.pymzd"
          placeholder="请输入拼音名"
          clearable
          @keyup.enter.native="handleQuery"
          style="width: 170px"
        />
      </el-form-item>
      <el-form-item>
        <el-button :loading="loading" type="primary" @click="handleSubmit"
          >提交</el-button
        >
        <el-button @click="handleCancel">取消</el-button>
      </el-form-item>
    </el-form>
    <div class="title">必须和数据库表名、字段名严格保持一致!</div>
    <el-table
      id="ta"
      ref="tb"
      :data="pyList"
      v-loading="loading"
      border
      @current-change="handleCurrentChange"
      @selection-change="handleSelectionChange"
    >
      <el-table-column label="表名" align="center" prop="tj_project_copy"  />
      <el-table-column label="表名" align="center" prop="pro_name" />
      <el-table-column label="表名" align="center" prop="pro_eng_name" />
    </el-table>
 
    <!-- <div>
        <div class="title">必须和数据库表名、字段名严格保持一致</div>
 
    </div> -->
    <!-- <div>
      <el-form :model="queryParams">
        <el-form-item label="表名" prop="tbname">
          <el-input
            v-model="queryParams.tbname"
            placeholder="请输入表名"
          ></el-input>
        </el-form-item>
 
        <el-form-item label="字段" prop="zd">
          <el-input
            v-model="queryParams.zd"
            placeholder="请输入字段"
          ></el-input>
        </el-form-item>
 
        <el-form-item label="拼音字段" prop="pymzd">
          <el-input
            v-model="queryParams.pymzd"
            placeholder="请输入拼音字段"
          ></el-input>
        </el-form-item>
 
        <el-form-item>
          <el-button :loading="loading" type="primary" @click="handleSubmit"
            >提交</el-button
          >
          <el-button @click="handleCancel">取消</el-button>
        </el-form-item>
      </el-form>
    </div> -->
    <div class="pag">
      <div class="pag1">
        <!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :pager-count="5" :current-page.sync="currentPage1" :current-page="page"
                    :page-sizes="pageSize" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination> -->
        <!-- <pagination
            v-show="total > 0"
            :total="total"
            :pager-count="5"
            :page.sync="queryParams.page"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
          /> -->
      </div>
    </div>
  </div>
</template>
    
    <script>
import { getPinyin } from "@/api/hosp/project";
 
export default {
  dicts: ["dict_tj_status"],
  data() {
    return {
      loading: false,
      pyList:[],
      // 查询参数
      queryParams: {
        tbname: "",
        zd: "",
        pymzd: "",
      },
    };
  },
 
  created() {
    
  },
  methods: {
    handleSelectionChange(val) {
      console.log(val);
      if (val.length > 1) {
        let del_row = val.shift();
        this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
      }
      console.log(val, 999);
 
      if (val.length > 0) {
        const selectedRow = val[0];
        this.selectedFirstTable = selectedRow;
        console.log("当前选中的行数据:", this.selectedFirstTable);
        this.fetchRightTableData(selectedRow);
      } else {
        this.selectedFirstTable = null;
        this.checkList = [];
      }
    },
    // 根据选中的行数据请求右边表格数据
    fetchRightTableData(selectedRow) {
      const code = selectedRow.mzh;
      if (!code) return;
      this.loading = true;
      getRightList(code).then((response) => {
        this.checkList = response.data;
        this.loading = false;
      });
    },
 
    handleSubmit() {
      this.loading = true;
      const { tbname, zd, pymzd } = this.queryParams;
 
      // 调用 API 获取拼音
      getPinyin(tbname, zd, pymzd)
        .then((res) => {
          console.log(res, "返回的数据");
          if (res.code === 200) {
            this.pyList = res.data;
            console.log(this.pyList,9988);
            
            this.$message.success("提交成功");
          } else {
            this.$message.error(res.msg || "查询失败,请稍后重试");
          }
        })
        .catch((error) => {
          this.$message.error(error.msg || "查询失败,请稍后重试");
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // 取消操作
    handleCancel() {
      this.queryParams.tbname = '';
      this.queryParams.zd = '';
      this.queryParams.pymzd = '';
      this.$message.info('已取消');
    },
 
    handleSelectionChangeSecond(selectedRows) {
      this.selectedSecondTable = selectedRows;
      console.log("当前选中的行数据:", this.selectedSecondTable);
    },
 
    /** 搜索按钮操作 */
    handleQuery() {
      this.loading = true;
      getPinyin(this.queryParams)
        .then((res) => {
          console.log(res, 1111);
          if (res.code == 200) {
            // this.loading = false;
            // this.exaLists = res.data;
            // this.code = this.exaLists.mzh;
          }
        })
        .catch((error) => {
          //   this.loading = false;
          //   this.$message.error(res.msg || "查询失败,请稍后重试");
        });
    },
 
    /** 重置按钮操作 */
    resetQuery() {
      this.createTimeList = [];
      this.resetForm("queryForm");
      this.queryParams = {
        name: null,
        start: null,
        end: null,
        tjNum: null,
      };
 
      // 清空其他依赖数据
      this.checkList = [];
      this.exaLists = [];
    },
 
    handleCurrentChange(row) {
      this.currentRow = row;
    },
  },
};
</script>
    
    <style lang="scss" scoped>
    .title{
        margin-bottom: 20px;
        color: red;
    }
/* #ta .el-table__header-wrapper .el-checkbox {
    display: none;
  }
  
  .el-table .warning-row {
    background: #e5f3ff !important;
  }
  ::v-deep .el-table__body tr.current-row > td {
    background: #edf2fa !important;
  }
  
  .table-title {
    text-align: center;
    margin-bottom: 15px;
  }
  .row-disabled {
    color: #ccc; 
    pointer-events: none; 
    background-color: #f5f5f5; 
  }
  
  .pag {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  .pag1 {
    width: 30%;
  } */
</style>