2022-10-01 09:12:01 +08:00
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<!-- <el-form
|
|
|
|
:model="queryParams"
|
|
|
|
ref="queryRef"
|
|
|
|
v-show="showSearch"
|
|
|
|
:inline="true"
|
|
|
|
@submit.prevent
|
|
|
|
>
|
2023-07-11 17:21:34 +08:00
|
|
|
<el-form-item :label="t('admin.form.name', {type: {type: t('admin.common.company')}})" prop="name">
|
2022-10-01 09:12:01 +08:00
|
|
|
<el-input
|
|
|
|
v-model="queryParams.name"
|
2023-07-11 17:21:34 +08:00
|
|
|
:placeholder="t('admin.form.placeholder', {type:t('admin.common.company')})"
|
2022-10-01 09:12:01 +08:00
|
|
|
clearable
|
|
|
|
size="small"
|
|
|
|
style="width: 240px"
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" icon="Search" size="small" @click="handleQuery"
|
2023-07-11 17:21:34 +08:00
|
|
|
> {{ t('admin.common.search') }}</el-button
|
2022-10-01 09:12:01 +08:00
|
|
|
>
|
|
|
|
<el-button icon="Refresh" size="small" @click="resetQuery"
|
2023-07-11 17:21:34 +08:00
|
|
|
> {{ t('admin.common.reset') }}</el-button
|
2022-10-01 09:12:01 +08:00
|
|
|
>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form> -->
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
plain
|
|
|
|
icon="Plus"
|
|
|
|
size="small"
|
|
|
|
@click="handleAdd"
|
2023-07-11 17:21:34 +08:00
|
|
|
>
|
|
|
|
{{ t("admin.common.add") }}</el-button
|
2022-10-01 09:12:01 +08:00
|
|
|
>
|
|
|
|
</el-col>
|
|
|
|
<!-- <right-toolbar
|
|
|
|
v-model:showSearch="showSearch"
|
|
|
|
@queryTable="getList"
|
|
|
|
></right-toolbar> -->
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<!-- 表格数据 -->
|
|
|
|
<el-table v-loading="loading" :data="dataList">
|
2023-07-11 17:21:34 +08:00
|
|
|
<el-table-column :label="t('admin.common.dataNumber')" prop="id" />
|
2022-10-01 09:12:01 +08:00
|
|
|
<el-table-column
|
2023-07-11 17:21:34 +08:00
|
|
|
:label="t('admin.form.name', { type: t('admin.common.company') })"
|
2022-10-01 09:12:01 +08:00
|
|
|
prop="enterpriseName"
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
/>
|
|
|
|
<el-table-column
|
|
|
|
label="所在地"
|
|
|
|
prop="address"
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
/>
|
|
|
|
<!-- province--city--district -->
|
2022-10-31 17:46:09 +08:00
|
|
|
<el-table-column label="所属领域" prop="territoryStr" />
|
2023-07-11 17:21:34 +08:00
|
|
|
<el-table-column :label="t('admin.form.contact')" prop="contactUser" />
|
2023-07-17 15:47:45 +08:00
|
|
|
<el-table-column :label="t('webContact.phone')" prop="contactPhone" />
|
2023-07-11 17:21:34 +08:00
|
|
|
<!-- <el-zh-column label="创建日期" align="center" prop="created_at">
|
2022-10-01 09:12:01 +08:00
|
|
|
<template #default="{ row }">
|
|
|
|
<span>{{ dayjs(row.created_at).format("YYYY-MM-DD HH:mm:ss") }}</span>
|
|
|
|
</template>
|
2023-07-11 17:21:34 +08:00
|
|
|
</el-zh-column> -->
|
2022-10-01 09:12:01 +08:00
|
|
|
<el-table-column
|
2023-07-11 17:21:34 +08:00
|
|
|
:label="t('admin.common.operation')"
|
2022-10-01 09:12:01 +08:00
|
|
|
align="center"
|
|
|
|
class-name="small-padding fixed-width"
|
|
|
|
>
|
|
|
|
<template #default="{ row }">
|
|
|
|
<el-button
|
|
|
|
size="small"
|
|
|
|
type="text"
|
|
|
|
icon="Edit"
|
|
|
|
@click="handleUpdate(row)"
|
2023-07-11 17:21:34 +08:00
|
|
|
>{{ t("admin.common.edit") }}</el-button
|
2022-10-01 09:12:01 +08:00
|
|
|
>
|
|
|
|
<el-button
|
|
|
|
size="small"
|
|
|
|
type="text"
|
|
|
|
icon="Delete"
|
|
|
|
@click="handleDelete(row.id)"
|
2023-07-11 17:21:34 +08:00
|
|
|
>
|
|
|
|
{{ t("admin.common.delete") }}</el-button
|
2022-10-01 09:12:01 +08:00
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
v-show="total > 0"
|
|
|
|
:total="total"
|
|
|
|
v-model:page="queryParams.pageNum"
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
@pagination="getList"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- 添加或修改数据配置对话框 -->
|
|
|
|
<el-dialog
|
|
|
|
:title="title"
|
|
|
|
v-model="showEditDialog"
|
|
|
|
width="750px"
|
|
|
|
append-to-body
|
|
|
|
>
|
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
|
<el-form-item label="企业名称:" prop="enterpriseName">
|
|
|
|
<el-input
|
|
|
|
v-model="form.enterpriseName"
|
2023-07-11 17:21:34 +08:00
|
|
|
:placeholder="
|
|
|
|
t('admin.form.placeholder', { type: t('admin.common.company') })
|
|
|
|
"
|
2022-10-01 09:12:01 +08:00
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="联系人:">
|
|
|
|
<el-input v-model="form.contactUser" placeholder="请输入专家姓名" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="联系电话:">
|
|
|
|
<el-input v-model="form.contactPhone" placeholder="默认专家电话" />
|
|
|
|
</el-form-item>
|
2022-10-31 17:46:09 +08:00
|
|
|
<el-form-item label="所在地">
|
|
|
|
<el-input v-model="form.address" placeholder="请输入所在地" />
|
|
|
|
</el-form-item>
|
|
|
|
<!-- <div class="hide_required">
|
2022-10-01 09:12:01 +08:00
|
|
|
<CityOptions v-model="form" :labelWidth="100" :is_required="false" />
|
2022-10-31 17:46:09 +08:00
|
|
|
</div> -->
|
2022-10-01 09:12:01 +08:00
|
|
|
|
|
|
|
<div class="hide_required">
|
2022-10-31 17:46:09 +08:00
|
|
|
<FieldSingle v-model="form" :labelWidth="100" />
|
2022-10-01 09:12:01 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<el-form-item label="合作内容:" prop="content">
|
|
|
|
<el-input
|
|
|
|
v-model="form.content"
|
|
|
|
type="textarea"
|
|
|
|
:autosize="{ minRows: 4, maxRows: 6 }"
|
|
|
|
placeholder="请输入想要合作的需求"
|
|
|
|
></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<div class="dialog-footer">
|
2023-07-17 15:47:45 +08:00
|
|
|
<el-button type="primary" @click="submitForm">{{
|
|
|
|
t("admin.common.confirm")
|
|
|
|
}}</el-button>
|
2022-10-01 09:12:01 +08:00
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2022-12-07 11:22:32 +08:00
|
|
|
// import CityOptions from "@/views/components/CityOptions";
|
2022-10-01 09:12:01 +08:00
|
|
|
import FieldSingle from "@/views/components/FieldSingle";
|
|
|
|
|
2023-07-11 17:21:34 +08:00
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
const { t } = useI18n();
|
2022-10-01 09:12:01 +08:00
|
|
|
import {
|
|
|
|
expertWantEnterpriseList,
|
|
|
|
updateExpertWantEnterprise,
|
|
|
|
insertExpertWantEnterprise,
|
|
|
|
deleteExpertWantEnterpriseByIds,
|
|
|
|
} from "@/api/admin/expert/demand";
|
2022-12-07 11:22:32 +08:00
|
|
|
// import dayjs from "dayjs";
|
2022-10-01 09:12:01 +08:00
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
2023-07-17 15:47:45 +08:00
|
|
|
import modal from "@/plugins/modal";
|
2022-10-01 09:12:01 +08:00
|
|
|
import { cloneDeep } from "lodash-unified";
|
|
|
|
|
|
|
|
const dataList = ref([]);
|
|
|
|
const showEditDialog = ref(false);
|
|
|
|
const loading = ref(true);
|
|
|
|
// const showSearch = ref(true);
|
|
|
|
const total = ref(0);
|
|
|
|
const title = ref("");
|
|
|
|
const formRef = ref();
|
|
|
|
|
|
|
|
// const formData = reactive({
|
|
|
|
// industrys: [],
|
|
|
|
// });
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
form: {
|
|
|
|
industrys: [],
|
|
|
|
},
|
|
|
|
queryParams: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
// mode: 2,
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
enterpriseName: [
|
|
|
|
{ required: true, message: "企业名称不能为空", trigger: "blur" },
|
|
|
|
],
|
|
|
|
content: [{ required: true, message: "合作内容不能为空", trigger: "blur" }],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
|
|
/** 查询数据列表 */
|
|
|
|
const getList = async () => {
|
|
|
|
loading.value = true;
|
|
|
|
const resp = await expertWantEnterpriseList(queryParams.value);
|
|
|
|
dataList.value = resp.rows;
|
|
|
|
total.value = resp.total;
|
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
function handleQuery() {
|
|
|
|
queryParams.value.pageNum = 1;
|
|
|
|
getList();
|
|
|
|
}
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
// function resetQuery() {
|
|
|
|
// proxy.resetForm("queryRef");
|
|
|
|
// handleQuery();
|
|
|
|
// }
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
function handleDelete(id) {
|
2023-07-17 15:47:45 +08:00
|
|
|
modal.confirm(`是否确认删除数据编号为"${id}"的数据项?`).then(
|
2022-10-01 09:12:01 +08:00
|
|
|
async () => {
|
|
|
|
await deleteExpertWantEnterpriseByIds({ ids: [id] });
|
|
|
|
getList();
|
|
|
|
ElMessage.success("删除成功");
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 重置新增的表单以及其他数据 */
|
|
|
|
function reset() {
|
|
|
|
form.value = {
|
|
|
|
// id: undefined,
|
|
|
|
// name: undefined,
|
|
|
|
// contact: undefined,
|
|
|
|
// contact_mobile: undefined,
|
|
|
|
industrys: [],
|
|
|
|
// mode: 2,
|
|
|
|
// content: undefined,
|
|
|
|
};
|
|
|
|
if (formRef.value) {
|
|
|
|
formRef.value.resetFields();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** 添加数据 */
|
|
|
|
function handleAdd() {
|
|
|
|
reset();
|
|
|
|
showEditDialog.value = true;
|
|
|
|
title.value = "添加数据";
|
|
|
|
}
|
|
|
|
/** 修改数据 */
|
|
|
|
function handleUpdate(row) {
|
|
|
|
reset();
|
|
|
|
form.value = cloneDeep(row);
|
|
|
|
form.value.industrys =
|
2022-10-31 17:46:09 +08:00
|
|
|
form.value.territory
|
|
|
|
?.split("-")
|
|
|
|
.filter((el) => el != "")
|
|
|
|
.map((el) => parseInt(el)) ?? [];
|
2022-10-01 09:12:01 +08:00
|
|
|
showEditDialog.value = true;
|
|
|
|
title.value = "修改数据";
|
|
|
|
}
|
2022-10-31 17:46:09 +08:00
|
|
|
|
2022-10-01 09:12:01 +08:00
|
|
|
/** 提交按钮 */
|
|
|
|
function submitForm() {
|
|
|
|
formRef.value.validate(async (valid) => {
|
2022-10-31 17:46:09 +08:00
|
|
|
form.value.territory = form.value.industrys.join("-");
|
2022-10-01 09:12:01 +08:00
|
|
|
if (valid) {
|
|
|
|
if (form.value.id) {
|
|
|
|
await updateExpertWantEnterprise(form.value);
|
|
|
|
ElMessage.success("修改成功");
|
|
|
|
showEditDialog.value = false;
|
|
|
|
getList();
|
|
|
|
} else {
|
|
|
|
await insertExpertWantEnterprise(form.value);
|
|
|
|
ElMessage.success("修改成功");
|
|
|
|
showEditDialog.value = false;
|
|
|
|
getList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/** 取消按钮 */
|
|
|
|
function cancel() {
|
|
|
|
showEditDialog.value = false;
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
getList();
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.hide_required {
|
|
|
|
::v-deep .el-form-item__label {
|
|
|
|
&::before {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|