1、开发主页内容(未完成)

master
chris 6 days ago
parent 12bb89ec3e
commit c725addaa1

@ -1,5 +1,5 @@
# 页面标题
VITE_APP_TITLE = AEO系统(开发环境)
VITE_APP_TITLE = 农业情报平台(开发环境)
# 开发环境配置
VITE_APP_ENV = 'development'

@ -1,5 +1,5 @@
# 页面标题
VITE_APP_TITLE = AEO系统
VITE_APP_TITLE = 农业情报平台
# 生产环境配置
VITE_APP_ENV = 'production'

@ -1,7 +1,7 @@
{
"name": "AEO",
"name": "pest_admin",
"version": "0.0.1",
"description": "AEO系统",
"description": "农业情报平台",
"author": "gdguanghui",
"license": "MIT",
"type": "module",
@ -17,6 +17,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "2.3.1",
"@pureadmin/utils": "^2.5.0",
"@vueup/vue-quill": "1.2.0",
"@vueuse/core": "10.11.0",
"axios": "0.28.1",
@ -35,6 +36,9 @@
"vue-router": "4.4.0"
},
"devDependencies": {
"@iconify-icons/ri": "^1.2.10",
"@iconify-json/carbon": "^1.2.5",
"@iconify/vue": "^4.2.0",
"@vitejs/plugin-vue": "5.0.5",
"sass": "1.77.5",
"unplugin-auto-import": "0.17.6",

@ -11,6 +11,9 @@ importers:
'@element-plus/icons-vue':
specifier: 2.3.1
version: 2.3.1(vue@3.4.31)
'@pureadmin/utils':
specifier: ^2.5.0
version: 2.5.0(echarts@5.5.1)(vue@3.4.31)
'@vueup/vue-quill':
specifier: 1.2.0
version: 1.2.0(vue@3.4.31)
@ -60,6 +63,15 @@ importers:
specifier: 4.4.0
version: 4.4.0(vue@3.4.31)
devDependencies:
'@iconify-icons/ri':
specifier: ^1.2.10
version: 1.2.10
'@iconify-json/carbon':
specifier: ^1.2.5
version: 1.2.5
'@iconify/vue':
specifier: ^4.2.0
version: 4.2.0(vue@3.4.31)
'@vitejs/plugin-vue':
specifier: 5.0.5
version: 5.0.5(vite@5.3.2(@types/node@22.10.1)(sass@1.77.5))(vue@3.4.31)
@ -411,12 +423,23 @@ packages:
'@floating-ui/utils@0.2.8':
resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==}
'@iconify-icons/ri@1.2.10':
resolution: {integrity: sha512-wNaXsQYK55WDUWCbcjvnwnODV4Jtsp+VC0duPanibEVu876TUYf6kdgTGtH7/GErBCNdJuJJbncG7vbOaeQi7w==}
'@iconify-json/carbon@1.2.5':
resolution: {integrity: sha512-aI3TEzOrUDGhs74zIT3ym/ZQBUEziyu8JifntX2Hb4siVzsP5sQ/QEfVdmcCUj37kQUYT3TYBSeAw2vTfCJx9w==}
'@iconify/types@2.0.0':
resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
'@iconify/utils@2.1.33':
resolution: {integrity: sha512-jP9h6v/g0BIZx0p7XGJJVtkVnydtbgTgt9mVNcGDYwaa7UhdHdI9dvoq+gKj9sijMSJKxUPEG2JyjsgXjxL7Kw==}
'@iconify/vue@4.2.0':
resolution: {integrity: sha512-CMynoz9BDWugDO2B7LU/s8L99dHCiqDGCjCki6bhVx5etZhw9x0BTV7wWRdj82jtl1yQTc+QQRcHQmSvUY6R+g==}
peerDependencies:
vue: '>=3'
'@jridgewell/gen-mapping@0.3.5':
resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==}
engines: {node: '>=6.0.0'}
@ -450,6 +473,17 @@ packages:
'@polka/url@1.0.0-next.28':
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
'@pureadmin/utils@2.5.0':
resolution: {integrity: sha512-DJyHBqxQo9Uo4GDEMbLD9xDNIn+VrOMBOyS6bgArY1a1iv4ffpDf0tA1tQ2HRFMiIcERC5abLWAASpgITM5LOQ==}
peerDependencies:
echarts: '*'
vue: '*'
peerDependenciesMeta:
echarts:
optional: true
vue:
optional: true
'@rollup/pluginutils@5.1.3':
resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==}
engines: {node: '>=14.0.0'}
@ -2397,6 +2431,14 @@ snapshots:
'@floating-ui/utils@0.2.8': {}
'@iconify-icons/ri@1.2.10':
dependencies:
'@iconify/types': 2.0.0
'@iconify-json/carbon@1.2.5':
dependencies:
'@iconify/types': 2.0.0
'@iconify/types@2.0.0': {}
'@iconify/utils@2.1.33':
@ -2411,6 +2453,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@iconify/vue@4.2.0(vue@3.4.31)':
dependencies:
'@iconify/types': 2.0.0
vue: 3.4.31
'@jridgewell/gen-mapping@0.3.5':
dependencies:
'@jridgewell/set-array': 1.2.1
@ -2442,6 +2489,11 @@ snapshots:
'@polka/url@1.0.0-next.28': {}
'@pureadmin/utils@2.5.0(echarts@5.5.1)(vue@3.4.31)':
optionalDependencies:
echarts: 5.5.1
vue: 3.4.31
'@rollup/pluginutils@5.1.3(rollup@4.28.0)':
dependencies:
'@types/estree': 1.0.6

@ -182,3 +182,7 @@ aside {
margin-bottom: 10px;
}
}
p {
margin: 0;
}

@ -0,0 +1,61 @@
import { ref } from "vue";
import reDialog from "./index.vue";
import { useTimeoutFn } from "@vueuse/core";
import { withInstall } from "@pureadmin/utils";
const dialogStore = ref([]);
/** 打开弹框 */
const addDialog = (options) => {
const open = () =>
dialogStore.value.push(Object.assign(options, { visible: true }));
if (options?.openDelay) {
useTimeoutFn(() => {
open();
}, options.openDelay);
} else {
open();
}
};
/** 关闭弹框 */
const closeDialog = (options, index, args) => {
dialogStore.value[index].visible = false;
options.closeCallBack && options.closeCallBack({ options, index, args });
const closeDelay = options?.closeDelay ?? 200;
useTimeoutFn(() => {
dialogStore.value.splice(index, 1);
}, closeDelay);
};
/**
* @description 更改弹框自身属性值
* @param value 属性值
* @param key 属性默认`title`
* @param index 弹框索引默认`0`代表只有一个弹框对于嵌套弹框要改哪个弹框的属性值就把该弹框索引赋给`index`
*/
const updateDialog = (value, key = "title", index = 0) => {
dialogStore.value[index][key] = value;
};
/** 关闭所有弹框 */
const closeAllDialog = () => {
dialogStore.value = [];
};
/** 使`addDialog`
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L4
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L12
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L22
*/
const ReDialog = withInstall(reDialog);
export {
ReDialog,
dialogStore,
addDialog,
closeDialog,
updateDialog,
closeAllDialog,
};

@ -0,0 +1,187 @@
<template>
<el-dialog
v-for="(options, index) in dialogStore"
:key="index"
v-bind="options"
v-model="options.visible"
:fullscreen="fullscreen ? true : options?.fullscreen ? true : false"
@closed="handleClose(options, index)"
@opened="eventsCallBack('open', options, index)"
@openAutoFocus="eventsCallBack('openAutoFocus', options, index)"
@closeAutoFocus="eventsCallBack('closeAutoFocus', options, index)"
>
<!-- header -->
<template
v-if="options?.fullscreenIcon || options?.headerRenderer"
#header="{ close, titleId, titleClass }"
>
<div
v-if="options?.fullscreenIcon"
class="flex items-center justify-between"
>
<span :id="titleId" :class="titleClass">{{ options?.title }}</span>
<i
v-if="!options?.fullscreen"
:class="fullscreenClass"
@click="
() => {
fullscreen = !fullscreen;
eventsCallBack(
'fullscreenCallBack',
{ ...options, fullscreen },
index,
true
);
}
"
>
<!-- <IconifyIconOffline
class="pure-dialog-svg"
:icon="
options?.fullscreen
? ExitFullscreen
: fullscreen
? ExitFullscreen
: Fullscreen
"
/> -->
</i>
</div>
<component
:is="options?.headerRenderer({ close, titleId, titleClass })"
v-else
/>
</template>
<component
v-bind="options?.props"
:is="options.contentRenderer({ options, index })"
@close="args => handleClose(options, index, args)"
/>
<!-- footer -->
<template v-if="!options?.hideFooter" #footer>
<template v-if="options?.footerRenderer">
<component :is="options?.footerRenderer({ options, index })" />
</template>
<span v-else>
<template v-for="(btn, key) in footerButtons(options)" :key="key">
<el-popconfirm
v-if="btn.popconfirm"
v-bind="btn.popconfirm"
@confirm="
btn.btnClick({
dialog: { options, index },
button: { btn, index: key }
})
"
>
<template #reference>
<el-button v-bind="btn">{{ btn?.label }}</el-button>
</template>
</el-popconfirm>
<el-button
v-else
v-bind="btn"
:loading="key === 1 && sureBtnMap[index]?.loading"
@click="
btn.btnClick({
dialog: { options, index },
button: { btn, index: key }
})
"
>
{{ btn?.label }}
</el-button>
</template>
</span>
</template>
</el-dialog>
</template>
<script setup>
import { dialogStore } from "./index";
import { ref, computed } from "vue";
import { isFunction } from "@pureadmin/utils";
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
const sureBtnMap = ref({});
const fullscreen = ref(false);
const footerButtons = computed(() => {
return (options) => {
return options?.footerButtons?.length > 0
? options.footerButtons
: ([
{
label: "取消",
text: true,
bg: true,
btnClick: ({ dialog: { options, index } }) => {
const done = () =>
closeDialog(options, index, { command: "cancel" });
if (options?.beforeCancel && isFunction(options?.beforeCancel)) {
options.beforeCancel(done, { options, index });
} else {
done();
}
}
},
{
label: "确定",
type: "primary",
text: true,
bg: true,
popconfirm: options?.popconfirm,
btnClick: ({ dialog: { options, index } }) => {
if (options?.sureBtnLoading) {
sureBtnMap.value[index] = Object.assign(
{},
sureBtnMap.value[index],
{
loading: true
}
);
}
const closeLoading = () => {
if (options?.sureBtnLoading) {
sureBtnMap.value[index].loading = false;
}
};
const done = () => {
closeLoading();
closeDialog(options, index, { command: "sure" });
};
if (options?.beforeSure && isFunction(options?.beforeSure)) {
options.beforeSure(done, { options, index, closeLoading });
} else {
done();
}
}
}
]);
};
});
const fullscreenClass = computed(() => {
return [
"el-icon",
"el-dialog__close",
"-translate-x-2",
"cursor-pointer",
"hover:!text-[red]"
];
});
function eventsCallBack( event, options, index, isClickFullScreen = false ) {
if (!isClickFullScreen) fullscreen.value = options?.fullscreen ?? false;
if (options?.[event] && isFunction(options?.[event])) {
return options?.[event]({ options, index });
}
}
function handleClose( options, index, args = { command: "close" }) {
closeDialog(options, index, args);
eventsCallBack("close", options, index);
}
</script>

@ -23,6 +23,7 @@ import { download } from "@/utils/request";
import "virtual:svg-icons-register";
import SvgIcon from "@/components/SvgIcon";
import elementIcons from "@/components/SvgIcon/svgicon";
import { Icon } from "@iconify/vue";
import "./permission"; // permission control
@ -79,6 +80,7 @@ app.use(store);
app.use(plugins);
app.use(elementIcons);
app.component("svg-icon", SvgIcon);
app.component("Icon", Icon);
directive(app);

@ -1,313 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属类别">
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 200px;">
<el-option
v-for="item in customer_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:customer:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:customer:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:customer:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:customer:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户编码" align="center" prop="code" />
<el-table-column label="客户名称" align="center" prop="name" />
<el-table-column label="所属类别" align="center" prop="type">
<template #default="scope">
<dict-tag :options="customer_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="业务状态" align="center" prop="businessStatus">
<template #default="scope">
<dict-tag :options="customer_business_status" :value="scope.row.businessStatus"/>
</template>
</el-table-column>
<el-table-column label="联系人姓名" align="center" prop="contactsName" />
<el-table-column label="联系人电话" align="center" prop="contactsPhone" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
icon="edit"
type="primary"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:customer:edit']"
>修改</el-button>
<el-button
link
icon="delete"
type="danger"
@click="handleDelete(scope.row)"
v-hasPermi="['business:customer:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改客户信息对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
<el-form-item label="客户编码" prop="code">
<el-input v-model="form.code" placeholder="请输入客户编码" />
</el-form-item>
<el-form-item label="客户名称" prop="code">
<el-input v-model="form.name" placeholder="请输入客户名称" />
</el-form-item>
<el-form-item label="所属类别" prop="code">
<el-select v-model="form.type" placeholder="请选择所属类别">
<el-option
v-for="item in customer_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务状态" prop="businessStatus">
<el-select v-model="form.businessStatus" placeholder="请选择业务状态">
<el-option
v-for="item in customer_business_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="联系人姓名" prop="contactsName">
<el-input v-model="form.contactsName" placeholder="请输入联系人姓名" />
</el-form-item>
<el-form-item label="联系人电话" prop="contactsPhone">
<el-input v-model="form.contactsPhone" placeholder="请输入联系人电话" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer } from "@/api/customer/info";
import useForm from '@/hooks/useForm.js';
const defaultForm = {
id: null,
code: null,
name: null,
contactsName: null,
contactsPhone: null,
type: null,
businessStatus: null,
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
contactsName: null,
type: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerList: [],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, customerList, title, open, rules, typeOptions } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
const { customer_business_status, customer_type } = proxy.useDict('customer_business_status', 'customer_type');
getList();
function getList() {
loading.value = true;
listCustomer(queryParams.value).then(response => {
customerList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加客户信息";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getCustomer(id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改客户信息";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateCustomer(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addCustomer(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delCustomer(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/customer/export', {
...queryParams.value
}, `customer_${new Date().getTime()}.xlsx`)
}
</script>
<style lang="scss" scoped>
</style>

@ -1,320 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="所属客户" prop="customerId">
<el-input
v-model="queryParams.customerId"
placeholder="请输入所属客户"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:customer-staff:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:customer-staff:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:customer-staff:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:customer-staff:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="memberList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="所属客户" align="center" prop="customer" />
<el-table-column label="员工姓名" align="center" prop="name" />
<el-table-column label="性别" align="center" prop="sex">
<template #default="scope">
<dict-tag :options="customer_sex" :value="scope.row.sex"/>
</template>
</el-table-column>
<el-table-column label="员工职位" align="center" prop="post" />
<el-table-column label="员工电话" align="center" prop="phone" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:customer-staff:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:customer-staff:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改客户人员信息对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属客户" prop="customerId">
<el-select
v-model="form.customerId"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:remote-method="($event) => remoteMethod($event, remoteCustomer)"
:loading="remoteLoading"
>
<el-option
v-for="item in customerList"
:key="item.id"
:label="item.contactsName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="员工姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入员工姓名" />
</el-form-item>
<el-form-item label="员工性别" prop="sex">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option
v-for="item in customer_sex"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="员工职位" prop="post">
<el-input v-model="form.post" placeholder="请输入员工职位" />
</el-form-item>
<el-form-item label="员工电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入员工电话" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listCustomerStaff, getCustomerStaff, delCustomerStaff, addCustomerStaff, updateCustomerStaff } from "@/api/customer/member";
import { listCustomer } from "@/api/customer/info";
import useForm from '@/hooks/useForm.js';
import useRemote from '@/hooks/useRemote.js';
const defaultForm = {
id: null,
code: null,
name: null,
contactsName: null,
contactsPhone: null,
type: null,
businessStatus: null,
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
contactsName: null,
type: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
memberList: [],
customerList: [],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, memberList, title, open, rules, customerList } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
const { customer_sex } = proxy.useDict('customer_sex')
getList();
const { loading: remoteLoading, remoteMethod } = useRemote();
function getList() {
loading.value = true;
listCustomerStaff(queryParams.value).then(response => {
memberList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
function remoteCustomer (query) {
const params = {
pageNum: 1,
pageSize: 20,
contactsName: query
}
return listCustomer(params).then(resp => {
return customerList.value = resp.rows;
})
}
function backFillSelectData (data) {
data.customerId && (customerList.value = [{ id: data.customerId, contactsName: data.customer }])
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加人员信息";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getCustomerStaff(id).then(response => {
form.value = response.data;
backFillSelectData(response.data);
open.value = true;
title.value = "修改人员信息";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateCustomerStaff(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addCustomerStaff(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delCustomerStaff(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/customer-staff/export', {
...queryParams.value
}, `customer_${new Date().getTime()}.xlsx`)
}
</script>

@ -1,78 +1,192 @@
<template>
<div class="app-container home">
主页
<div class="app-container home" :class="{ 'hasTagsView': hasTags }">
<section class="home-top">
<div class="sort-info">
<el-row :gutter="8">
<el-col :span="index == 0 ? 6 : 3" v-for="(item, index) in infoItems" :key="index">
<div class="info-item" :style="`background-color: ${colorList[item.type].color}`">
<Icon :icon="colorList[item.type].icon" class="info-item__icon"/>
<div class="info-msg">
<p class="msg-title">{{ item.title }}</p>
<span class="msg-num">{{ item.num }}</span>
</div>
</div>
</el-col>
</el-row>
</div>
</section>
<section class="home-content">
<el-row :gutter="12" class="h-100%">
<el-col :span="4">
<el-card class="device-list">
<template #header>
<span class="card-title">设备列表</span>
</template>
<device-list />
</el-card>
</el-col>
<el-col :span="20" class="!flex flex-col">
<el-row :gutter="12" class="m-b-12px flex-1">
<el-col :span="14">
<el-card class="device-map h-100%">
<template #header>
<span class="card-title">设备地图</span>
</template>
</el-card>
</el-col>
<el-col :span="10">
<el-card class="device-info h-100%">
<template #header>
<span class="card-title">设备信息</span>
</template>
</el-card>
</el-col>
</el-row>
<el-card class="live-data h-350px">
<template #header>
<span class="card-title">实时数据</span>
</template>
</el-card>
</el-col>
</el-row>
</section>
</div>
</template>
<script setup name="Index">
const version = ref('3.8.8')
import useSettingsStore from '@/store/modules/settings'
import deviceList from './indexComponents/deviceList.vue'
const settingsStore = useSettingsStore()
const infoItems = reactive([
{
type: 'device',
title: '设备总数',
num: 12
},
{
type: 'pest',
title: '虫情监测设备',
num: 6
},
{
type: 'environment',
title: '环境监测设备',
num: 2
},
{
type: 'soil',
title: '土壤监测设备',
num: 2
},
{
type: 'online',
title: '在线设备',
num: 18
},
{
type: 'offline',
title: '离线设备',
num: 2
},
{
type: 'abnormal',
title: '异常设备',
num: 2
}
])
function goTarget(url) {
window.open(url, '__blank')
const colorList = readonly({
device:{
icon: 'carbon:devices',
color: '#329874'
},
pest:{
icon: 'carbon:pest',
color: '#b47a3e'
},
environment:{
icon: 'carbon:radar-weather',
color: '#396a98'
},
soil:{
icon: 'carbon:soil-moisture',
color: '#45969f'
},
online:{
icon: 'carbon:link',
color: '#3aa534'
},
offline:{
icon: 'carbon:unlink',
color: '#808890'
},
abnormal:{
icon: 'carbon:warning',
color: '#c04747'
}
})
const hasTags = computed(() => settingsStore.tagsView);
</script>
<style scoped lang="scss">
.home {
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eee;
height: calc(100vh - 50px);
&.hasTagsView {
height: calc(100vh - 84px);
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eee;
}
.col-item {
margin-bottom: 20px;
.home-top {
@apply m-b-12px;
}
ul {
padding: 0;
margin: 0;
.home-content {
height: calc(100% - 86px);
}
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
$infoIconSize: 38px;
ul {
list-style-type: none;
}
.info-item {
@apply flex justify-between items-center;
padding: 12px 15px;
color: #fff;
background-color: #25598a;
border-radius: 8px;
h4 {
margin-top: 0px;
&.device-num {
background-color: red;
}
h2 {
margin-top: 10px;
font-size: 26px;
font-weight: 100;
.info-msg {
@apply text-right;
}
p {
margin-top: 10px;
.msg-title {
font-size: 16px;
margin-bottom: 5px;
}
b {
font-weight: 700;
.msg-num {
font-size: 22px;
font-weight: 600;
}
}
.update-log {
ol {
display: block;
list-style-type: decimal;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0;
margin-inline-end: 0;
padding-inline-start: 40px;
}
.info-item__icon {
width: $infoIconSize;
height: $infoIconSize;
color: #ddd;
}
.device-list {
height: 100%;
}
</style>

@ -0,0 +1,58 @@
<template>
<el-tree
:data="defaultData"
node-key="id"
:expand-on-click-node="false"
>
<template #default="{ node, data }">
<div class="custom-tree-node">
<Icon :icon="treeNodeIcon(node)" class="node-icon" />
<span>{{ node.label }}</span>
</div>
</template>
</el-tree>
</template>
<script setup name="DeviceList">
const nodeIconDict = readonly({
worm: 'carbon:pest',
soil: 'carbon:soil-moisture',
met: 'carbon:radar-weather',
other: 'carbon:devices'
})
const defaultData = readonly([
{
id: 1,
label: '区域1',
children: [
{ id: 2, label: '虫情检测001', type: 'worm' },
{ id: 3, label: '气象站001', type: 'met' }
]
},
{
id: 4,
label: '区域2',
children: [
{ id: 5, label: '虫情检测002', type: 'worm' },
{ id: 6, label: '气象站002', type: 'met' }
]
}
])
function treeNodeIcon(node) {
console.log(node)
const type = node.data.type
return node.level === 1 ? 'carbon:cics-system-group' : (nodeIconDict[type] || nodeIconDict['other'])
}
</script>
<style lang="scss" scoped>
.custom-tree-node {
@apply flex items-center;
.node-icon {
@apply mr-5px color-#409EFF;
}
}
</style>

@ -1,353 +0,0 @@
<template>
<div class="app-container">
<splitpanes :horizontal="appStore.device === 'mobile'" class="default-theme">
<pane size="8">
<el-segmented :options="categoryOptions" size="large" v-model="queryParams.type" direction="vertical" @change="categoryChange"/>
</pane>
<pane size="92">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="分类名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item v-if="queryParams.type" :label="levelName">
<el-select
v-model="queryParams.pid"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:remote-method="($event) => remoteMethod($event, remoteParent)"
:loading="remoteLoading"
@blur="remoteBlur"
style="width: 200px;"
>
<el-option
v-for="item in parentList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:category:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:category:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:category:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:category:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类名称" align="center" prop="name" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:category:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:category:remove']"
>删除</el-button>
</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="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="分类名称" prop="name">
<el-input v-model="form.name" placeholder="请输入分类名称" />
</el-form-item>
<el-form-item :label="levelName" prop="pid" v-if="queryParams.type">
<el-select
v-model="form.pid"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:remote-method="($event) => remoteMethod($event, remoteParent)"
:loading="remoteLoading"
@blur="remoteBlur"
style="width: 200px;"
>
<el-option
v-for="item in parentList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</pane>
</splitpanes>
</div>
</template>
<script setup>
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/product/category";
import useForm from '@/hooks/useForm.js';
import useRemote from '@/hooks/useRemote.js';
import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css"
import useAppStore from '@/store/modules/app'
const defaultForm = {
id: null,
name: null,
type: 0,
pid: null,
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
name: null,
type: 0,
pid: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const appStore = useAppStore()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
categoryList: [],
parentList: [],
categoryOptions: [
{
value: 0,
label: '一级分类'
},
{
value: 1,
label: '二级分类'
},
{
value: 2,
label: '三级分类'
},
],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, categoryList, title, open, rules, categoryOptions, parentList } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
const { loading: remoteLoading, remoteMethod } = useRemote()
getList();
const levelName = computed(() => {
const name = categoryOptions.value.find(item => item.value == queryParams.value.type - 1).label
return `${name}名称`
})
function getList() {
loading.value = true;
listCategory(queryParams.value).then(response => {
categoryList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
function remoteParent (query) {
const params = {
pageNum: 1,
pageSize: 50,
type: queryParams.value.type - 1,
name: query
}
return listCategory(params).then(response => {
parentList.value = response.rows;
});
}
function categoryChange () {
queryParams.value.name = queryParams.value.pid = null;
form.value.type = queryParams.value.type;
handleQuery();
}
function remoteBlur() {
parentList.value = [];
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加分类";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getCategory(id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改分类";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateCategory(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addCategory(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delCategory(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/category/export', {
...queryParams.value
}, `category_${new Date().getTime()}.xlsx`)
}
</script>
<style lang="scss" scoped>
</style>

@ -1,262 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="分类名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:products-category:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:products-category:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:products-category:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:products-category:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类名称" align="center" prop="name" />
<el-table-column label="分类编码" align="center" prop="code" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:products-category:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:products-category:remove']"
>删除</el-button>
</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="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="分类名称" prop="name">
<el-input v-model="form.name" placeholder="请输入分类名称" />
</el-form-item>
<el-form-item label="分类编码" prop="code">
<el-input v-model="form.code" placeholder="请输入分类编码" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listProductsCategory, getProductsCategory, delProductsCategory, addProductsCategory, updateProductsCategory } from "@/api/product/productsCategory";
import useForm from '@/hooks/useForm.js';
const defaultForm = {
id: null,
name: null,
code: null,
remark: null
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
name: null,
code: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
categoryList: [],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, categoryList, title, open, rules } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
getList();
function getList() {
loading.value = true;
listProductsCategory(queryParams.value).then(response => {
categoryList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加品类";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getProductsCategory(id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改品类";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateProductsCategory(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addProductsCategory(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delProductsCategory(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/products-category/export', {
...queryParams.value
}, `products-category_${new Date().getTime()}.xlsx`)
}
</script>

@ -1,440 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="产品名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品别名" prop="alias">
<el-input
v-model="queryParams.alias"
placeholder="请输入产品别名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:products:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:products:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:products:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:products:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品编码" align="center" prop="code" />
<el-table-column label="产品名称" align="center" prop="name" />
<el-table-column label="产品别名" align="center" prop="alias" />
<el-table-column label="产品类型" align="center" prop="productsType" />
<el-table-column label="规格" align="center" prop="specs" />
<el-table-column label="单位" align="center" prop="unit" />
<el-table-column label="标签" align="center" prop="label" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="一级分类名称" align="center" prop="levelOne" />
<el-table-column label="二级分类名称" align="center" prop="levelTwo" />
<el-table-column label="三级分类名称" align="center" prop="levelThree" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:products:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:products:remove']"
>删除</el-button>
</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="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
<el-form-item label="产品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入产品名称" />
</el-form-item>
<el-form-item label="产品别名" prop="alias">
<el-input v-model="form.alias" placeholder="请输入产品别名" />
</el-form-item>
<el-form-item label="产品编码" prop="code">
<el-input v-model="form.code" placeholder="请输入产品编码" />
</el-form-item>
<el-form-item label="规格" prop="specs">
<el-input v-model="form.specs" placeholder="请输入规格" />
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" />
</el-form-item>
<el-form-item label="标签" prop="label">
<el-input v-model="form.label" placeholder="请输入标签" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="产品类型" prop="productsTypeId">
<el-select
v-model="form.productsTypeId"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:remote-method="($event) => remoteMethod($event, remoteProductType)"
:loading="remoteLoading"
>
<el-option
v-for="item in productTypeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="一级分类" prop="levelOneId">
<el-select
v-model="form.levelOneId"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:remote-method="($event) => remoteMethod($event, remoteCategory)"
:loading="remoteLoading"
@focus="remoteFocus(0)"
@change="handleLevelChange($event, 0)"
>
<el-option
v-for="item in categoryList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="二级分类" prop="levelTwoId">
<el-select
v-model="form.levelTwoId"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:disabled="form.levelOneId == null"
:remote-method="($event) => remoteMethod($event, remoteCategory)"
:loading="remoteLoading"
@focus="remoteFocus(1)"
@change="handleLevelChange($event, 1)"
>
<el-option
v-for="item in categoryList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="三级分类" prop="levelThreeId">
<el-select
v-model="form.levelThreeId"
filterable
remote
placeholder="请输入关键词搜索"
remote-show-suffix
:disabled="form.levelTwoId == null"
:remote-method="($event) => remoteMethod($event, remoteCategory)"
:loading="remoteLoading"
@focus="remoteFocus(2)"
@change="handleLevelChange($event, null)"
>
<el-option
v-for="item in categoryList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listProductsRecord, getProductsRecord, delProductsRecord, addProductsRecord, updateProductsRecord } from "@/api/product/productsRecord";
import { listCategory } from "@/api/product/category";
import { listProductsType } from "@/api/product/productsType";
import useForm from '@/hooks/useForm.js';
import useRemote from "@/hooks/useRemote";
const defaultForm = {
id: null,
name: null,
alias: null,
code: null,
specs: null,
unit: null,
label: null,
remark: null
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
name: null,
alias: null,
code: null,
specs: null,
unit: null,
label: null,
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordList: [],
//
categoryList: [],
//
productTypeList: [],
//
title: "",
//
open: false,
//
rules: {
},
categoryType: null, // 0: 1 2
levelPIds: ['', ''],
})
const { loading, ids, single, multiple, showSearch, total, recordList, title, open, rules, categoryList, categoryType, productTypeList, levelPIds } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
const { loading: remoteLoading, remoteMethod } = useRemote();
getList();
function getList() {
loading.value = true;
listProductsRecord(queryParams.value).then(response => {
recordList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
function remoteCategory (query) {
const params = {
pageNum: 1,
pageSize: 50,
type: categoryType.value,
name: query
}
if (categoryType.value) {
params.pid = levelPIds.value[categoryType.value - 1];
}
return listCategory(params).then(response => {
categoryList.value = response.rows;
});
}
function remoteProductType (query) {
const params = {
pageNum: 1,
pageSize: 50,
name: query
}
return listProductsType(params).then(response => {
productTypeList.value = response.rows;
});
}
function remoteFocus (type) {
// 0: 1 2
categoryList.value = [];
categoryType.value = type;
}
function handleLevelChange (id, index) {
if (index == null) return;
if (index === 0) {
form.value.levelTwoId = form.value.levelThreeId = null;
}
levelPIds.value[index] = id;
}
//
function setCategory (info) {
levelPIds.value = [info.levelOneId || '', info.levelTwoId || '']
info.levelOneId && categoryList.value.push({ id: info.levelOneId, name: info.levelOne })
info.levelTwoId && categoryList.value.push({ id: info.levelTwoId, name: info.levelTwo })
info.levelThreeId && categoryList.value.push({ id: info.levelThreeId, name: info.levelThree })
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加档案";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getProductsRecord(id).then(response => {
form.value = response.data;
setCategory(response.data)
open.value = true;
title.value = "修改档案";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateProductsRecord(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addProductsRecord(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delProductsRecord(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/products/export', {
...queryParams.value
}, `products-record_${new Date().getTime()}.xlsx`)
}
</script>

@ -1,256 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="类型" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:products-type:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:products-type:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:products-type:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:products-type:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编码" align="center" prop="code" />
<el-table-column label="类型" align="center" prop="name" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:products-type:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:products-type:remove']"
>删除</el-button>
</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="open" width="500px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="编码" prop="code">
<el-input v-model="form.code" placeholder="请输入分类编码" />
</el-form-item>
<el-form-item label="类型" prop="name">
<el-input v-model="form.name" placeholder="请输入分类名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listProductsType, getProductsType, delProductsType, addProductsType, updateProductsType } from "@/api/product/productsType";
import useForm from '@/hooks/useForm.js';
const defaultForm = {
id: null,
name: null,
code: null
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
name: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
typeList: [],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, typeList, title, open, rules } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
getList();
function getList() {
loading.value = true;
listProductsType(queryParams.value).then(response => {
typeList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加类型";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getProductsType(id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改类型";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateProductsType(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addProductsType(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delProductsType(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/products-type/export', {
...queryParams.value
}, `products-type_${new Date().getTime()}.xlsx`)
}
</script>

@ -1,486 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="110px">
<el-form-item label="供应商名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入供应商名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应商法人类型" prop="corporationType">
<el-select
v-model="queryParams.corporationType"
placeholder="请选择类型"
clearable
@keyup.enter.native="handleQuery"
style="width: 200px;"
>
<el-option
v-for="item in supplier_corporation_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="search" @click="handleQuery"></el-button>
<el-button icon="refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="plus"
@click="handleAdd"
v-hasPermi="['business:supplier:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['business:supplier:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:supplier:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="download"
@click="handleExport"
v-hasPermi="['business:supplier:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="供应商名称" align="center" prop="name" />
<el-table-column label="供应商评分" align="center" prop="score" />
<el-table-column label="供应商规模" align="center" prop="scale" />
<el-table-column label="供应商经营开始时间" align="center" prop="startTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="供应商法人类型" align="center" prop="corporationType" />
<el-table-column label="供应商股票名称" align="center" prop="stockName" />
<el-table-column label="是否小微企业" align="center" prop="smallVendors" />
<el-table-column label="供应商注册号" align="center" prop="registNo" />
<el-table-column label="供应商注册资本" align="center" prop="registCapital" />
<el-table-column label="供应商登记机关" align="center" prop="registAuthority" />
<el-table-column label="营业执照" align="center" prop="businessLicense" />
<el-table-column label="营业地址" align="center" prop="businessAddress" />
<el-table-column label="供应商注册行业" align="center" prop="registSector" />
<el-table-column label="供应商核准时间" align="center" prop="approvalTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.approvalTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="中标信息" align="center" prop="winBidInfo" />
<el-table-column label="合同信息" align="center" prop="contractInfo" />
<el-table-column label="合同有效期" align="center" prop="expirationTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.expirationTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['business:supplier:edit']"
>修改</el-button>
<el-button
link
type="danger"
icon="delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:supplier:remove']"
>删除</el-button>
</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="open" width="1000px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="供应商名称" prop="name">
<el-input v-model="form.name" placeholder="请输入供应商名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商评分" prop="score">
<el-input v-model="form.score" placeholder="请输入供应商评分" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商规模" prop="scale">
<el-select
v-model="form.scale"
placeholder="请选择规模"
clearable
>
<el-option
v-for="item in supplier_scale"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商经营开始时间" prop="startTime">
<el-date-picker clearable
v-model="form.startTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择供应商经营开始时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商股票名称" prop="stockName">
<el-input v-model="form.stockName" placeholder="请输入供应商股票名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商法人类型" prop="corporationType">
<el-select
v-model="form.corporationType"
placeholder="请选择类型"
clearable
>
<el-option
v-for="item in supplier_corporation_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否小商企业" prop="smallVendors">
<el-select
v-model="form.smallVendors"
placeholder="请选择"
clearable
>
<el-option
v-for="item in [{ value: 0, label: '否' }, { value: 1, label: '是' }]"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商注册号" prop="registNo">
<el-input v-model="form.registNo" placeholder="请输入供应商注册号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="股票曾用名" prop="stockNameUsed">
<el-input v-model="form.stockNameUsed" placeholder="请输入供应商股票曾用名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商注册资本" prop="registCapital">
<el-input v-model="form.registCapital" placeholder="请输入供应商注册资本" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商登记机关" prop="registAuthority">
<el-input v-model="form.registAuthority" placeholder="请输入供应商登记机关" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商注册行业" prop="registSector">
<el-input v-model="form.registSector" placeholder="请输入供应商注册行业" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商核准时间" prop="approvalTime">
<el-date-picker clearable
v-model="form.approvalTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择供应商核准时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="中标信息" prop="winBidInfo">
<el-input v-model="form.winBidInfo" placeholder="请输入中标信息" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同信息" prop="contractInfo">
<el-input v-model="form.contractInfo" placeholder="请输入合同信息" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同有效期" prop="expirationTime">
<el-date-picker clearable
v-model="form.expirationTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择合同有效期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="营业执照" prop="businessLicense">
<el-input v-model="form.businessLicense" placeholder="请输入营业执照" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="营业地址" prop="businessAddress">
<el-input v-model="form.businessAddress" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="附件是否上传" prop="attachment">
<el-select
v-model="form.attachment"
placeholder="请选择"
clearable
@change="attachmentChanged"
>
<el-option
v-for="item in [{ value: 0, label: '否' }, { value: 1, label: '是' }]"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.attachment">
<el-form-item label="执照相片" prop="licenseImg">
<image-upload
v-model="form.licenseImg"
:limit="1"
>
</image-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
import { listSupplierRecord, getSupplierRecord, delSupplierRecord, addSupplierRecord, updateSupplierRecord } from "@/api/supplier/record";
import ImageUpload from "@/components/ImageUpload";
import useForm from '@/hooks/useForm.js';
const defaultForm = {
id: null,
name: null,
score: null,
scale: null,
stockName: null,
stockNameUsed: null,
startTime: null,
corporationType: null,
smallVendors: null,
registNo: null,
registCapital: null,
registAuthority: null,
registSector: null,
approvalTime: null,
winBidInfo: null,
contractInfo: null,
expirationTime: null,
businessLicense: null,
businessAddress: null,
attachment: 0,
licenseImg: null,
}
const defaultParams = {
pageNum: 1,
pageSize: 10,
name: null,
corporationType: null
}
const formRef = ref(null);
const queryRef = ref(null);
const { proxy } = getCurrentInstance()
const data = reactive({
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
recordList: [],
//
title: "",
//
open: false,
//
rules: {
}
})
const { loading, ids, single, multiple, showSearch, total, recordList, title, open, rules } = toRefs(data);
const { form, validateForm, resetForm } = useForm(formRef, defaultForm)
const { form: queryParams, resetForm: resetQueryForm } = useForm(queryRef, defaultParams)
const { supplier_scale, supplier_corporation_type } = proxy.useDict('supplier_scale', 'supplier_corporation_type')
getList();
function getList() {
loading.value = true;
listSupplierRecord(queryParams.value).then(response => {
recordList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
function attachmentChanged (value) {
if (value) return;
form.value.licenseImg = null;
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
resetForm();
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
resetQueryForm();
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id)
single.value = selection.length!==1
multiple.value = !selection.length
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加档案";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const id = row.id || ids.value
getSupplierRecord(id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改档案";
});
}
/** 提交按钮 */
function submitForm() {
validateForm().then(() => {
if (form.value.id != null) {
updateSupplierRecord(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addSupplierRecord(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除分类编号为"' + ids + '"的数据项?').then(function() {
return delSupplierRecord(ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('business/supplier/export', {
...queryParams.value
}, `supplier-record_${new Date().getTime()}.xlsx`)
}
</script>

@ -1,11 +0,0 @@
<template>
<div>
</div>
</template>
<script>
</script>
<style lang="scss" scoped>
</style>

@ -1,11 +0,0 @@
<template>
<div>
</div>
</template>
<script>
</script>
<style lang="scss" scoped>
</style>
Loading…
Cancel
Save