|
@@ -21,7 +21,7 @@
|
|
<template #header>
|
|
<template #header>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:supplier:add']">新增供应商</el-button>
|
|
|
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['warehouse:productSupplier:add']">新增供应商</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -30,19 +30,31 @@
|
|
<el-table v-loading="loading" border :data="supplierList" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" border :data="supplierList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="供应商" align="center" prop="name" />
|
|
<el-table-column label="供应商" align="center" prop="name" />
|
|
- <el-table-column label="联系人名称" align="center" prop="contactName" />
|
|
|
|
- <el-table-column label="联系人电话" align="center" prop="contactPhone" />
|
|
|
|
- <el-table-column label="联系人地址" align="center" prop="address" />
|
|
|
|
|
|
+ <el-table-column label="联系人名称" align="center" prop="contactName">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ scope.row.contactName||'--' }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="联系人电话" align="center" prop="contactPhone">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ scope.row.contactPhone||'--' }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="联系人地址" align="center" prop="address">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ scope.row.address||'--' }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-tooltip content="编辑" placement="top">
|
|
<el-tooltip content="编辑" placement="top">
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:supplier:edit']">编辑</el-button>
|
|
|
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['warehouse:productSupplier:edit']">编辑</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip content="详情" placement="top">
|
|
<el-tooltip content="详情" placement="top">
|
|
- <el-button link type="primary" icon="View" @click="handleDetail(scope.row)" v-hasPermi="['system:supplier:query']">详情</el-button>
|
|
|
|
|
|
+ <el-button link type="primary" icon="View" @click="handleDetail(scope.row)" v-hasPermi="['warehouse:productSupplier:query']">详情</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip content="删除" placement="top">
|
|
<el-tooltip content="删除" placement="top">
|
|
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:supplier:remove']">删除</el-button>
|
|
|
|
|
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['warehouse:productSupplier:remove']">删除</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -115,8 +127,8 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <div class="dialog-footer">
|
|
|
|
- <el-button @click="detailDialog.visible = false">关闭</el-button>
|
|
|
|
|
|
+ <div class="dialog-footer" style="text-align: center">
|
|
|
|
+ <el-button size="large" @click="detailDialog.visible = false">关闭</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -131,43 +143,45 @@
|
|
|
|
|
|
interface DialogOption {
|
|
interface DialogOption {
|
|
visible: boolean;
|
|
visible: boolean;
|
|
- title?: string;
|
|
|
|
|
|
+ title ? : string;
|
|
}
|
|
}
|
|
|
|
|
|
- interface PageData<T, Q> {
|
|
|
|
|
|
+ interface PageData < T, Q > {
|
|
form: T;
|
|
form: T;
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: number;
|
|
pageNum: number;
|
|
pageSize: number;
|
|
pageSize: number;
|
|
- params: Record<string, any>;
|
|
|
|
|
|
+ params: Record < string,
|
|
|
|
+ any > ;
|
|
} & Q;
|
|
} & Q;
|
|
- rules?: Record<string, any[]>;
|
|
|
|
|
|
+ rules ? : Record < string,
|
|
|
|
+ any[] > ;
|
|
}
|
|
}
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
- const supplierList = ref<SupplierVO[]>([]);
|
|
|
|
|
|
+ const supplierList = ref < SupplierVO[] > ([]);
|
|
const buttonLoading = ref(false);
|
|
const buttonLoading = ref(false);
|
|
const loading = ref(true);
|
|
const loading = ref(true);
|
|
const showSearch = ref(true);
|
|
const showSearch = ref(true);
|
|
- const ids = ref<Array<string | number>>([]);
|
|
|
|
|
|
+ const ids = ref < Array < string | number >> ([]);
|
|
const single = ref(true);
|
|
const single = ref(true);
|
|
const multiple = ref(true);
|
|
const multiple = ref(true);
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
|
|
|
- const queryFormRef = ref<FormInstance>();
|
|
|
|
- const supplierFormRef = ref<FormInstance>();
|
|
|
|
|
|
+ const queryFormRef = ref < FormInstance > ();
|
|
|
|
+ const supplierFormRef = ref < FormInstance > ();
|
|
|
|
|
|
- const dialog = reactive<DialogOption>({
|
|
|
|
|
|
+ const dialog = reactive < DialogOption > ({
|
|
visible: false,
|
|
visible: false,
|
|
title: ''
|
|
title: ''
|
|
});
|
|
});
|
|
|
|
|
|
- const detailDialog = reactive<DialogOption>({
|
|
|
|
|
|
+ const detailDialog = reactive < DialogOption > ({
|
|
visible: false
|
|
visible: false
|
|
});
|
|
});
|
|
|
|
|
|
- const detailForm = reactive<SupplierForm>({
|
|
|
|
|
|
+ const detailForm = reactive < SupplierForm > ({
|
|
id: undefined,
|
|
id: undefined,
|
|
name: undefined,
|
|
name: undefined,
|
|
contactName: undefined,
|
|
contactName: undefined,
|
|
@@ -184,20 +198,21 @@
|
|
address: undefined,
|
|
address: undefined,
|
|
description: undefined,
|
|
description: undefined,
|
|
}
|
|
}
|
|
- const data = reactive<PageData<SupplierForm, SupplierQuery>>({
|
|
|
|
- form: { ...initFormData },
|
|
|
|
- queryParams: {
|
|
|
|
- pageNum: 1,
|
|
|
|
- pageSize: 10,
|
|
|
|
- name: undefined,
|
|
|
|
- params: {}
|
|
|
|
- },
|
|
|
|
- rules: {
|
|
|
|
- name: [
|
|
|
|
- { required: true, message: "供应商不能为空", trigger: "blur" }
|
|
|
|
- ],
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ const data = reactive < PageData < SupplierForm,
|
|
|
|
+ SupplierQuery >> ({
|
|
|
|
+ form: { ...initFormData },
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ name: undefined,
|
|
|
|
+ params: {}
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ name: [
|
|
|
|
+ { required: true, message: "供应商不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
@@ -219,7 +234,7 @@
|
|
/** 表单重置 */
|
|
/** 表单重置 */
|
|
const reset = () => {
|
|
const reset = () => {
|
|
form.value = { ...initFormData };
|
|
form.value = { ...initFormData };
|
|
- supplierFormRef.value?.resetFields();
|
|
|
|
|
|
+ supplierFormRef.value ?.resetFields();
|
|
}
|
|
}
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
@@ -230,7 +245,7 @@
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
- queryFormRef.value?.resetFields();
|
|
|
|
|
|
+ queryFormRef.value ?.resetFields();
|
|
handleQuery();
|
|
handleQuery();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -249,9 +264,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
- const handleUpdate = async (row?: SupplierVO) => {
|
|
|
|
|
|
+ const handleUpdate = async (row ? : SupplierVO) => {
|
|
reset();
|
|
reset();
|
|
- const _id = row?.id || ids.value[0]
|
|
|
|
|
|
+ const _id = row ?.id || ids.value[0]
|
|
const res = await getSupplier(_id);
|
|
const res = await getSupplier(_id);
|
|
Object.assign(form.value, res.data);
|
|
Object.assign(form.value, res.data);
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
@@ -264,13 +279,13 @@
|
|
Object.assign(detailForm, res.data);
|
|
Object.assign(detailForm, res.data);
|
|
detailDialog.visible = true;
|
|
detailDialog.visible = true;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- proxy?.$modal.msgError("获取详情失败");
|
|
|
|
|
|
+ proxy ?.$modal.msgError("获取详情失败");
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
const submitForm = () => {
|
|
const submitForm = () => {
|
|
- supplierFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
|
+ supplierFormRef.value ?.validate(async (valid: boolean) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
buttonLoading.value = true;
|
|
buttonLoading.value = true;
|
|
if (form.value.id) {
|
|
if (form.value.id) {
|
|
@@ -278,7 +293,7 @@
|
|
} else {
|
|
} else {
|
|
await addSupplier(form.value).finally(() => buttonLoading.value = false);
|
|
await addSupplier(form.value).finally(() => buttonLoading.value = false);
|
|
}
|
|
}
|
|
- proxy?.$modal.msgSuccess("操作成功");
|
|
|
|
|
|
+ proxy ?.$modal.msgSuccess("操作成功");
|
|
dialog.visible = false;
|
|
dialog.visible = false;
|
|
await getList();
|
|
await getList();
|
|
}
|
|
}
|
|
@@ -286,17 +301,17 @@
|
|
}
|
|
}
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
- const handleDelete = async (row?: SupplierVO) => {
|
|
|
|
- const _ids = row?.id || ids.value;
|
|
|
|
- await proxy?.$modal.confirm('是否确认删除供应商编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
|
|
|
|
|
+ const handleDelete = async (row ? : SupplierVO) => {
|
|
|
|
+ const _ids = row ?.id || ids.value;
|
|
|
|
+ await proxy ?.$modal.confirm('是否确认删除供应商编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
|
await delSupplier(_ids);
|
|
await delSupplier(_ids);
|
|
- proxy?.$modal.msgSuccess("删除成功");
|
|
|
|
|
|
+ proxy ?.$modal.msgSuccess("删除成功");
|
|
await getList();
|
|
await getList();
|
|
}
|
|
}
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
const handleExport = () => {
|
|
const handleExport = () => {
|
|
- proxy?.download('warehouse/productSupplier/export', {
|
|
|
|
|
|
+ proxy ?.download('warehouse/productSupplier/export', {
|
|
...queryParams.value
|
|
...queryParams.value
|
|
}, `supplier_${new Date().getTime()}.xlsx`)
|
|
}, `supplier_${new Date().getTime()}.xlsx`)
|
|
}
|
|
}
|
|
@@ -368,4 +383,4 @@
|
|
border-top: 1px solid #dcdfe6;
|
|
border-top: 1px solid #dcdfe6;
|
|
padding: 12px 20px;
|
|
padding: 12px 20px;
|
|
}
|
|
}
|
|
-</style>
|
|
|
|
|
|
+</style>
|