otherFindEnterprise.vue
5.7 KB
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
<template>
<div>
<el-dialog :title="props.title" v-model="state.openDialog" width="1000px" append-to-body destroy-on-close @close="handleClose(false)">
<el-form ref="queryForm" :model="state.queryParams" :rules="queryRules" label-position="left" label-width="80px">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item label="国家" prop="country">
<el-select v-model="state.queryParams.country" placeholder="请选择国家" clearable filterable>
<el-option v-for="(item, index) in state.countryList" :key="index" :label="item.gj" :value="item.jcCode"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="企业名称" prop="ename">
<el-input v-model.trim="state.queryParams.ename" placeholder="请输入企业名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-button type="primary" icon="Search" v-debounceClick="()=>handleSearch()">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- <el-table :data="state.tableList" style="width: 100%" @selection-change="handleSelectionChange" border v-loading="state.isLoading" class="own_table" max-height="400px">
<el-table-column v-for="(table, index) in state.tableColumns" :key="'table'+index" :label="table.label" :prop="table.prop" :min-width="table.width">
<template #default="scope">
<template v-if="table.limitLength">
{{scope.row[table.prop].substring(0, table.limitLength)}}
</template>
</template>
</el-table-column>
<el-table-column label="操作" min-width="40%">
<template #default="scope">
<slot name="cop" :row="scope.row"></slot>
</template>
</el-table-column>
</el-table>
<pagination
v-show="state.total > 0"
:total="state.total"
:page.sync="state.queryParams.pageNum"
:limit.sync="state.queryParams.pageSize"
@pagination="getList"
/>-->
</el-dialog>
</div>
</template>
<script setup lang="ts">
import * as api from '../interface/api.ts'
import { loginMain } from '../store'
import { storeToRefs } from 'pinia';
import router from "../router";
let loginAct = loginMain()
let { getStoreToken, getUserInfo } = storeToRefs(loginAct)
let queryForm = ref<FormInstance>()
const emit = defineEmits(["handleClose"]);
let props = defineProps({
title: {
default: "",
type: String
},
open: {
default: false,
type: Boolean
},
openName: {
type: String,
required: true,
default: ""
},
})
let state = reactive( {
openDialog: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
tableList: [],
// { "regStatus": "存续", "estiblishTime": "1995-12-25 00:00:00.0", "regCapital": "120000万人民币", "companyType": 1, "matchType": "公司名称匹配", "type": 1, "legalPersonName": "王晓秋", "regNumber": "310115400033897", "creditCode": "913101156073392545", "name": "联合汽车电子有限公司", "id": 466517252, "orgNumber": "60733925-4", "base": "上海" }
isLoading: false,
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
ename: null,
country: null,
},
tableColumns: [
{
label: "企业名称",
prop: "name"
},{
label: "统一信用代码",
prop: "creditCode",
width: "55%"
},{
label: "法定代表人",
prop: "legalPersonName",
width: "30%"
},{
label: "状态",
prop: "regStatus",
width: "20%"
},{
label: "注册资本",
prop: "regCapital",
width: "40%"
},{
label: "成立日期",
prop: "estiblishTime",
limitLength: 10,
width: "33%"
},
],
countryList: []
})
let queryRules = reactive<FormRules>({
country: [
{ required: true, message: "国家不能为空", trigger: ["blur","change"] }
],
ename: [
{ required: true, message: "企业名称不能为空", trigger: ["blur","change"] }
]
})
let handleClose = (isRefresh: boolean) => {
emit('handleClose', props.openName, false, isRefresh)
}
let handleSearch = () => {
router.push("/otherEnterpriseList?name=" + state.queryParams.ename + "&country=" + state.queryParams.country)
}
let handleSelectionChange = (selection: Array<any>) => {
state.ids = selection.map((item: Object) => item.id)
state.single = selection.length !== 1
state.multiple = !selection.length
}
let getList = () => {
queryForm.value.validate((valid: boolean, fields: Object)=> {
if (valid) {
state.isLoading = true
api.searchCompany(state.queryParams).then((res: Object)=> {
state.tableList = res.data.rows
}).finally(()=> {
state.isLoading = false
})
}
})
}
let getCountryList = () => {
api.getInfoList({},'/web/worldBox/getAllCountry').then((res: any)=> {
state.countryList = res.data
state.countryList.forEach((item: any)=> {
if (item.jcCode === "CN") {
state.countryList.splice(state.countryList.indexOf(item), 1)
}
})
})
}
let reset = () => {
state.queryParams.ename = null
state.tableList = []
}
watchEffect(()=> {
state.openDialog = props.open
if (props.open) {
reset()
getCountryList()
}
})
onMounted(()=>{
})
</script>
<style scoped>
</style>