@@ -14,10 +14,7 @@ | |||
auto-complete="off" | |||
placeholder="账号" | |||
> | |||
<i | |||
slot="prefix" | |||
class="el-input__icon input-icon el-icon-user" | |||
/> | |||
<i slot="prefix" class="el-input__icon input-icon el-icon-user" /> | |||
</el-input> | |||
</el-form-item> | |||
<el-form-item prop="password"> | |||
@@ -28,10 +25,7 @@ | |||
placeholder="密码" | |||
@keyup.enter.native="handleLogin" | |||
> | |||
<i | |||
slot="prefix" | |||
class="el-input__icon input-icon el-icon-lock" | |||
/> | |||
<i slot="prefix" class="el-input__icon input-icon el-icon-lock" /> | |||
</el-input> | |||
</el-form-item> | |||
<el-form-item v-if="captchaEnabled" prop="code"> | |||
@@ -75,10 +69,6 @@ | |||
</div> | |||
</el-form-item> | |||
</el-form> | |||
<!-- 底部 --> | |||
<div class="el-login-footer"> | |||
<span>Copyright © 2024 zhushi All Rights Reserved.</span> | |||
</div> | |||
</div> | |||
</template> | |||
@@ -93,8 +83,8 @@ export default { | |||
return { | |||
codeUrl: '', | |||
loginForm: { | |||
username: 'admin', | |||
password: 'admin123', | |||
username: '', // admin | |||
password: '', // admin123 | |||
rememberMe: false, | |||
code: '', | |||
uuid: '' |
@@ -1,9 +1,9 @@ | |||
<template> | |||
<div class="app-container"> | |||
<el-form | |||
:model="queryParams" | |||
ref="queryForm" | |||
v-show="showSearch" | |||
ref="queryForm" | |||
:model="queryParams" | |||
size="small" | |||
:inline="true" | |||
class="app-container--search" | |||
@@ -58,54 +58,59 @@ | |||
icon="el-icon-search" | |||
size="mini" | |||
@click="handleQuery" | |||
>搜索</el-button | |||
> | |||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" | |||
>重置</el-button | |||
> | |||
>搜索</el-button> | |||
<el-button | |||
icon="el-icon-refresh" | |||
size="mini" | |||
@click="resetQuery" | |||
>重置</el-button> | |||
</el-form-item> | |||
</el-form> | |||
<el-row :gutter="10" class="mb8"> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:add']" | |||
type="primary" | |||
plain | |||
icon="el-icon-plus" | |||
size="mini" | |||
@click="handleAdd" | |||
v-hasPermi="['system:operationGoods:add']" | |||
>新增</el-button | |||
> | |||
>新增</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:edit']" | |||
type="success" | |||
plain | |||
icon="el-icon-edit" | |||
size="mini" | |||
:disabled="single" | |||
@click="handleUpdate" | |||
>修改</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> </el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:remove']" | |||
type="danger" | |||
plain | |||
icon="el-icon-delete" | |||
size="mini" | |||
:disabled="multiple" | |||
@click="handleDelete" | |||
v-hasPermi="['system:operationGoods:remove']" | |||
>删除</el-button | |||
> | |||
>删除</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:export']" | |||
type="warning" | |||
plain | |||
icon="el-icon-download" | |||
size="mini" | |||
@click="handleExport" | |||
v-hasPermi="['system:operationGoods:export']" | |||
>导出</el-button | |||
> | |||
>导出</el-button> | |||
</el-col> | |||
<right-toolbar | |||
:showSearch.sync="showSearch" | |||
@queryTable="getList" | |||
></right-toolbar> | |||
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" /> | |||
</el-row> | |||
<el-table | |||
@@ -114,7 +119,7 @@ | |||
@selection-change="handleSelectionChange" | |||
> | |||
<el-table-column type="selection" width="55" align="center" /> | |||
<el-table-column label="主键ID" align="center" prop="id" v-if="false" /> | |||
<el-table-column v-if="false" label="主键ID" align="center" prop="id" /> | |||
<el-table-column label="商品" align="center"> | |||
<template slot-scope="scope"> | |||
<div class="goods--info"> | |||
@@ -145,13 +150,19 @@ | |||
align="center" | |||
prop="initPrice" | |||
/> | |||
<el-table-column width="300" label="备注" align="center" prop="remark" /> | |||
<el-table-column | |||
width="320" | |||
label="备注" | |||
width="120" | |||
label="创建时间" | |||
align="center" | |||
prop="remark" | |||
show-overflow-tooltip | |||
/> | |||
prop="createDate" | |||
> | |||
<template slot-scope="scope"> | |||
<span>{{ | |||
parseTime(scope.row.createDate, '{y}-{m}-{d} {h}:{i}:{s}') | |||
}}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
width="120" | |||
label="是否启用" | |||
@@ -175,13 +186,19 @@ | |||
> | |||
<template slot-scope="scope"> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:edit']" | |||
size="mini" | |||
type="text" | |||
icon="el-icon-edit" | |||
@click="handleUpdate(scope.row)" | |||
>修改</el-button> | |||
<el-button | |||
v-hasPermi="['system:operationGoods:remove']" | |||
size="mini" | |||
type="text" | |||
icon="el-icon-delete" | |||
@click="handleDelete(scope.row)" | |||
v-hasPermi="['system:operationGoods:remove']" | |||
>删除</el-button | |||
> | |||
>删除</el-button> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
@@ -203,11 +220,15 @@ | |||
label-width="80px" | |||
label-position="top" | |||
> | |||
<el-form-item label="商品名称" prop="goodsSkuName" v-show="isEdit"> | |||
<el-input v-model="form.goodsSkuName" /> | |||
<el-form-item v-show="isEdit" label="商品名称" prop="goodsSkuName"> | |||
<el-input v-model="form.goodsSkuName" type="textarea" rows="4" /> | |||
</el-form-item> | |||
<el-form-item label="商品编号" prop="goodsSkuSn" v-show="isEdit"> | |||
<el-input v-model="form.goodsSkuSn" /> | |||
<el-form-item v-show="isEdit" label="商品编号" prop="goodsSkuSn"> | |||
<el-input | |||
v-model="form.goodsSkuSn" | |||
type="textarea" | |||
:disabled="isEdit" | |||
/> | |||
</el-form-item> | |||
<el-form-item label="商品URL" prop="goodsSkuUrl"> | |||
<el-input | |||
@@ -215,6 +236,7 @@ | |||
type="textarea" | |||
rows="4" | |||
placeholder="请输入商品URL" | |||
:disabled="isEdit" | |||
/> | |||
<p class="tips"> | |||
系统会根据商品URL,自动获取商品名称、编号、基准价格、备注信息, | |||
@@ -226,13 +248,17 @@ | |||
<el-row> | |||
<el-col :span="12"> | |||
<el-form-item label="平台" prop="platform"> | |||
<el-select v-model="form.platform" placeholder="请选择平台"> | |||
<el-select | |||
v-model="form.platform" | |||
placeholder="请选择平台" | |||
:disabled="isEdit" | |||
> | |||
<el-option | |||
v-for="dict in dict.type.zs_operation_platform" | |||
:key="dict.value" | |||
:label="dict.label" | |||
:value="dict.value" | |||
></el-option> | |||
/> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
@@ -244,16 +270,20 @@ | |||
:key="dict.value" | |||
:label="dict.label" | |||
:value="dict.value" | |||
></el-option> | |||
/> | |||
</el-select> | |||
</el-form-item> | |||
</el-col> | |||
</el-row> | |||
<el-form-item label="基准价格" prop="initPrice" v-show="isEdit"> | |||
<el-input v-model="form.initPrice" placeholder="请输入基准价格" /> | |||
<el-form-item v-show="isEdit" label="基准价格" prop="initPrice"> | |||
<el-input | |||
v-model="form.initPrice" | |||
placeholder="请输入基准价格" | |||
:disabled="isEdit" | |||
/> | |||
</el-form-item> | |||
<el-form-item label="备注" prop="remark" v-show="isEdit"> | |||
<el-form-item v-show="isEdit" label="备注" prop="remark"> | |||
<el-input | |||
v-model="form.remark" | |||
type="textarea" | |||
@@ -263,9 +293,16 @@ | |||
</el-form> | |||
<div slot="footer" class="dialog-footer"> | |||
<el-button :loading="buttonLoading" type="primary" @click="submitForm" | |||
>确 定</el-button | |||
> | |||
<span | |||
v-if="errorMsg" | |||
class="error-msg" | |||
style="color: red; margin-right: 10px" | |||
>{{ errorMsg }}</span> | |||
<el-button | |||
:loading="buttonLoading" | |||
type="primary" | |||
@click="submitForm" | |||
>{{ errorMsg ? '重 试' : '确 定' }}</el-button> | |||
<el-button @click="cancel">取 消</el-button> | |||
</div> | |||
</el-dialog> | |||
@@ -278,12 +315,12 @@ import { | |||
getOperationGoods, | |||
delOperationGoods, | |||
addOperationGoods, | |||
updateOperationGoods, | |||
} from "@/api/system/operationGoods"; | |||
updateOperationGoods | |||
} from '@/api/system/operationGoods' | |||
export default { | |||
name: "OperationGoods", | |||
dicts: ["zs_is_disabled", "zs_operation_platform"], | |||
name: 'OperationGoods', | |||
dicts: ['zs_is_disabled', 'zs_operation_platform'], | |||
data() { | |||
return { | |||
// 按钮loading | |||
@@ -303,11 +340,13 @@ export default { | |||
// 商品配置表格数据 | |||
operationGoodsList: [], | |||
// 弹出层标题 | |||
title: "", | |||
title: '', | |||
// 是否显示弹出层 | |||
open: false, | |||
// 是否编辑 | |||
isEdit: false, | |||
// 错误信息 | |||
errorMsg: '', | |||
// 查询参数 | |||
queryParams: { | |||
pageNum: 1, | |||
@@ -315,42 +354,42 @@ export default { | |||
goodsSkuName: undefined, | |||
goodsSkuSn: undefined, | |||
platform: undefined, | |||
isDisabled: undefined, | |||
isDisabled: undefined | |||
}, | |||
// 表单参数 | |||
form: {}, | |||
// 表单校验 | |||
rules: { | |||
id: [{ required: true, message: "主键ID不能为空", trigger: "blur" }], | |||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | |||
goodsSkuUrl: [ | |||
{ required: true, message: "商品URL不能为空", trigger: "blur" }, | |||
{ required: true, message: '商品URL不能为空', trigger: 'blur' } | |||
], | |||
platform: [ | |||
{ required: true, message: "平台不能为空", trigger: "blur" }, | |||
{ required: true, message: '平台不能为空', trigger: 'blur' } | |||
], | |||
isDisabled: [ | |||
{ required: true, message: "是否启用不能为空", trigger: "blur" }, | |||
], | |||
}, | |||
}; | |||
{ required: true, message: '是否启用不能为空', trigger: 'blur' } | |||
] | |||
} | |||
} | |||
}, | |||
created() { | |||
this.getList(); | |||
this.getList() | |||
}, | |||
methods: { | |||
/** 查询商品配置列表 */ | |||
getList() { | |||
this.loading = true; | |||
this.loading = true | |||
listOperationGoods(this.queryParams).then((response) => { | |||
this.operationGoodsList = response.rows; | |||
this.total = response.total; | |||
this.loading = false; | |||
}); | |||
this.operationGoodsList = response.rows | |||
this.total = response.total | |||
this.loading = false | |||
}) | |||
}, | |||
// 取消按钮 | |||
cancel() { | |||
this.open = false; | |||
this.reset(); | |||
this.open = false | |||
this.reset() | |||
}, | |||
// 表单重置 | |||
reset() { | |||
@@ -362,112 +401,116 @@ export default { | |||
platform: undefined, | |||
initPrice: undefined, | |||
remark: undefined, | |||
isDisabled: undefined, | |||
}; | |||
this.resetForm("form"); | |||
isDisabled: undefined | |||
} | |||
this.resetForm('form') | |||
}, | |||
/** 开关切换 */ | |||
handleSwitch(row) { | |||
updateOperationGoods(row).then((response) => { | |||
this.getList(); | |||
}); | |||
this.getList() | |||
}) | |||
}, | |||
/** 搜索按钮操作 */ | |||
handleQuery() { | |||
this.queryParams.pageNum = 1; | |||
this.getList(); | |||
this.queryParams.pageNum = 1 | |||
this.getList() | |||
}, | |||
/** 重置按钮操作 */ | |||
resetQuery() { | |||
this.resetForm("queryForm"); | |||
this.handleQuery(); | |||
this.resetForm('queryForm') | |||
this.handleQuery() | |||
}, | |||
// 多选框选中数据 | |||
handleSelectionChange(selection) { | |||
this.ids = selection.map((item) => item.id); | |||
this.single = selection.length !== 1; | |||
this.multiple = !selection.length; | |||
this.ids = selection.map((item) => item.id) | |||
this.single = selection.length !== 1 | |||
this.multiple = !selection.length | |||
}, | |||
/** 新增按钮操作 */ | |||
handleAdd() { | |||
this.reset(); | |||
this.open = true; | |||
this.title = "添加商品配置"; | |||
this.isEdit = false; | |||
this.reset() | |||
this.open = true | |||
this.title = '添加商品配置' | |||
this.isEdit = false | |||
}, | |||
/** 修改按钮操作 */ | |||
handleUpdate(row) { | |||
this.loading = true; | |||
this.reset(); | |||
const id = row.id || this.ids; | |||
this.loading = true | |||
this.reset() | |||
const id = row.id || this.ids | |||
getOperationGoods(id).then((response) => { | |||
this.loading = false; | |||
this.form = response.data; | |||
this.open = true; | |||
this.title = "修改商品配置"; | |||
this.isEdit = true; | |||
}); | |||
this.loading = false | |||
this.form = response.data | |||
this.open = true | |||
this.title = '修改商品配置' | |||
this.isEdit = true | |||
}) | |||
}, | |||
/** 提交按钮 */ | |||
submitForm() { | |||
this.$refs["form"].validate((valid) => { | |||
this.$refs['form'].validate((valid) => { | |||
if (valid) { | |||
this.buttonLoading = true; | |||
this.buttonLoading = true | |||
if (this.form.id != null) { | |||
updateOperationGoods(this.form) | |||
.then((response) => { | |||
this.$modal.msgSuccess("修改成功"); | |||
this.open = false; | |||
this.getList(); | |||
this.$modal.msgSuccess('修改成功') | |||
this.open = false | |||
this.getList() | |||
}) | |||
.finally(() => { | |||
this.buttonLoading = false; | |||
}); | |||
this.buttonLoading = false | |||
}) | |||
} else { | |||
addOperationGoods(this.form) | |||
.then((response) => { | |||
this.$modal.msgSuccess("新增成功"); | |||
this.open = false; | |||
this.getList(); | |||
this.$modal.msgSuccess('新增成功') | |||
this.open = false | |||
this.getList() | |||
this.errorMsg = '' | |||
}) | |||
.catch((error) => { | |||
this.errorMsg = error.message + ',请重试。' | |||
}) | |||
.finally(() => { | |||
this.buttonLoading = false; | |||
}); | |||
this.buttonLoading = false | |||
}) | |||
} | |||
} | |||
}); | |||
}) | |||
}, | |||
/** 删除按钮操作 */ | |||
handleDelete(row) { | |||
const ids = row.id || this.ids; | |||
const ids = row.id || this.ids | |||
this.$modal | |||
.confirm('是否确认删除商品配置编号为"' + ids + '"的数据项?') | |||
.then(() => { | |||
this.loading = true; | |||
return delOperationGoods(ids); | |||
this.loading = true | |||
return delOperationGoods(ids) | |||
}) | |||
.then(() => { | |||
this.loading = false; | |||
this.getList(); | |||
this.$modal.msgSuccess("删除成功"); | |||
this.loading = false | |||
this.getList() | |||
this.$modal.msgSuccess('删除成功') | |||
}) | |||
.catch(() => {}) | |||
.finally(() => { | |||
this.loading = false; | |||
}); | |||
this.loading = false | |||
}) | |||
}, | |||
/** 导出按钮操作 */ | |||
handleExport() { | |||
this.download( | |||
"system/operationGoods/export", | |||
'system/operationGoods/export', | |||
{ | |||
...this.queryParams, | |||
...this.queryParams | |||
}, | |||
`operationGoods_${new Date().getTime()}.xlsx` | |||
); | |||
}, | |||
}, | |||
}; | |||
) | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="scss" scoped> |
@@ -3,91 +3,115 @@ | |||
<el-row :gutter="10" class="mb8"> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:add']" | |||
type="primary" | |||
plain | |||
icon="el-icon-plus" | |||
size="mini" | |||
@click="handleAdd" | |||
v-hasPermi="['system:operationWarnconfig:add']" | |||
>新增</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:edit']" | |||
type="success" | |||
plain | |||
icon="el-icon-edit" | |||
size="mini" | |||
:disabled="single" | |||
@click="handleUpdate" | |||
v-hasPermi="['system:operationWarnconfig:edit']" | |||
>修改</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:remove']" | |||
type="danger" | |||
plain | |||
icon="el-icon-delete" | |||
size="mini" | |||
:disabled="multiple" | |||
@click="handleDelete" | |||
v-hasPermi="['system:operationWarnconfig:remove']" | |||
>删除</el-button> | |||
</el-col> | |||
<el-col :span="1.5"> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:export']" | |||
type="warning" | |||
plain | |||
icon="el-icon-download" | |||
size="mini" | |||
@click="handleExport" | |||
v-hasPermi="['system:operationWarnconfig:export']" | |||
>导出</el-button> | |||
</el-col> | |||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |||
<right-toolbar | |||
:show-search.sync="showSearch" | |||
@queryTable="getList" | |||
/> | |||
</el-row> | |||
<el-table v-loading="loading" :data="operationWarnconfigList" @selection-change="handleSelectionChange"> | |||
<el-table | |||
v-loading="loading" | |||
:data="operationWarnconfigList" | |||
@selection-change="handleSelectionChange" | |||
> | |||
<el-table-column type="selection" width="55" align="center" /> | |||
<el-table-column label="主键ID" align="center" prop="id" v-if="false"/> | |||
<el-table-column label="价格变化比例阈值" align="center" prop="priceChangeThreshold" /> | |||
<el-table-column v-if="false" label="主键ID" align="center" prop="id" /> | |||
<el-table-column | |||
label="价格变化比例阈值" | |||
align="center" | |||
prop="priceChangeThreshold" | |||
/> | |||
<el-table-column label="监控频率" align="center" prop="monitorFrequency"> | |||
<template slot-scope="scope"> | |||
<dict-tag :options="dict.type.zs_operation_monitor_frequency" :value="scope.row.monitorFrequency"/> | |||
<dict-tag | |||
:options="dict.type.zs_operation_monitor_frequency" | |||
:value="scope.row.monitorFrequency" | |||
/> | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="预警方式" align="center" prop="warnTypes"> | |||
<template slot-scope="scope"> | |||
<dict-tag :options="dict.type.zs_operation_warn_types" :value="scope.row.warnTypes"/> | |||
<dict-tag | |||
:options="dict.type.zs_operation_warn_types" | |||
:value="scope.row.warnTypes" | |||
/> | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="预警时间段" align="center" prop="warnTimeRange"> | |||
<template slot-scope="scope"> | |||
<dict-tag :options="dict.type.zs_operation_warn_time_range" :value="scope.row.warnTimeRange"/> | |||
<dict-tag | |||
:options="dict.type.zs_operation_warn_time_range" | |||
:value="scope.row.warnTimeRange" | |||
/> | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="备注" align="center" prop="remark" /> | |||
<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 slot-scope="scope"> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:edit']" | |||
size="mini" | |||
type="text" | |||
icon="el-icon-edit" | |||
@click="handleUpdate(scope.row)" | |||
v-hasPermi="['system:operationWarnconfig:edit']" | |||
>修改</el-button> | |||
<el-button | |||
v-hasPermi="['system:operationWarnconfig:remove']" | |||
size="mini" | |||
type="text" | |||
icon="el-icon-delete" | |||
@click="handleDelete(scope.row)" | |||
v-hasPermi="['system:operationWarnconfig:remove']" | |||
>删除</el-button> | |||
</template> | |||
</el-table-column> | |||
</el-table> | |||
<pagination | |||
v-show="total>0" | |||
v-show="total > 0" | |||
:total="total" | |||
:page.sync="queryParams.pageNum" | |||
:limit.sync="queryParams.pageSize" | |||
@@ -98,17 +122,25 @@ | |||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | |||
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> | |||
<el-form-item label="监控阈值" prop="priceChangeThreshold"> | |||
<el-input v-model="form.priceChangeThreshold" type="number" placeholder="请输入" style="width: 100px;" /> | |||
<span style="margin-left: 10px;">单位:百分比</span> | |||
<el-input | |||
v-model="form.priceChangeThreshold" | |||
type="number" | |||
placeholder="请输入" | |||
style="width: 100px" | |||
/> | |||
<span style="margin-left: 10px">单位:百分比</span> | |||
</el-form-item> | |||
<el-form-item label="监控频率" prop="monitorFrequency"> | |||
<el-select v-model="form.monitorFrequency" placeholder="请选择监控频率"> | |||
<el-select | |||
v-model="form.monitorFrequency" | |||
placeholder="请选择监控频率" | |||
> | |||
<el-option | |||
v-for="dict in dict.type.zs_operation_monitor_frequency" | |||
:key="dict.value" | |||
:label="dict.label" | |||
:value="dict.value" | |||
></el-option> | |||
/> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="预警方式" prop="warnTypes"> | |||
@@ -118,7 +150,7 @@ | |||
:key="dict.value" | |||
:label="dict.label" | |||
:value="dict.value" | |||
></el-option> | |||
/> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="预警时间" prop="warnTimeRange"> | |||
@@ -128,15 +160,23 @@ | |||
:key="dict.value" | |||
:label="dict.label" | |||
:value="dict.value" | |||
></el-option> | |||
/> | |||
</el-select> | |||
</el-form-item> | |||
<el-form-item label="备注" prop="remark"> | |||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> | |||
<el-input | |||
v-model="form.remark" | |||
type="textarea" | |||
placeholder="请输入内容" | |||
/> | |||
</el-form-item> | |||
</el-form> | |||
<div slot="footer" class="dialog-footer"> | |||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | |||
<el-button | |||
:loading="buttonLoading" | |||
type="primary" | |||
@click="submitForm" | |||
>确 定</el-button> | |||
<el-button @click="cancel">取 消</el-button> | |||
</div> | |||
</el-dialog> | |||
@@ -144,11 +184,21 @@ | |||
</template> | |||
<script> | |||
import { listOperationWarnconfig, getOperationWarnconfig, delOperationWarnconfig, addOperationWarnconfig, updateOperationWarnconfig } from "@/api/system/operationWarnconfig"; | |||
import { | |||
listOperationWarnconfig, | |||
getOperationWarnconfig, | |||
delOperationWarnconfig, | |||
addOperationWarnconfig, | |||
updateOperationWarnconfig | |||
} from '@/api/system/operationWarnconfig' | |||
export default { | |||
name: "OperationWarnconfig", | |||
dicts: ['zs_operation_monitor_frequency', 'zs_operation_warn_types', 'zs_operation_warn_time_range'], | |||
name: 'OperationWarnconfig', | |||
dicts: [ | |||
'zs_operation_monitor_frequency', | |||
'zs_operation_warn_types', | |||
'zs_operation_warn_time_range' | |||
], | |||
data() { | |||
return { | |||
// 按钮loading | |||
@@ -168,41 +218,39 @@ export default { | |||
// 预警配置表格数据 | |||
operationWarnconfigList: [], | |||
// 弹出层标题 | |||
title: "", | |||
title: '', | |||
// 是否显示弹出层 | |||
open: false, | |||
// 查询参数 | |||
queryParams: { | |||
pageNum: 1, | |||
pageSize: 10, | |||
pageSize: 10 | |||
}, | |||
// 表单参数 | |||
form: {}, | |||
// 表单校验 | |||
rules: { | |||
id: [ | |||
{ required: true, message: "主键ID不能为空", trigger: "blur" } | |||
], | |||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | |||
} | |||
}; | |||
} | |||
}, | |||
created() { | |||
this.getList(); | |||
this.getList() | |||
}, | |||
methods: { | |||
/** 查询预警配置列表 */ | |||
getList() { | |||
this.loading = true; | |||
listOperationWarnconfig(this.queryParams).then(response => { | |||
this.operationWarnconfigList = response.rows; | |||
this.total = response.total; | |||
this.loading = false; | |||
}); | |||
this.loading = true | |||
listOperationWarnconfig(this.queryParams).then((response) => { | |||
this.operationWarnconfigList = response.rows | |||
this.total = response.total | |||
this.loading = false | |||
}) | |||
}, | |||
// 取消按钮 | |||
cancel() { | |||
this.open = false; | |||
this.reset(); | |||
this.open = false | |||
this.reset() | |||
}, | |||
// 表单重置 | |||
reset() { | |||
@@ -213,89 +261,101 @@ export default { | |||
warnTypes: undefined, | |||
warnTimeRange: undefined, | |||
remark: undefined | |||
}; | |||
this.resetForm("form"); | |||
} | |||
this.resetForm('form') | |||
}, | |||
/** 搜索按钮操作 */ | |||
handleQuery() { | |||
this.queryParams.pageNum = 1; | |||
this.getList(); | |||
this.queryParams.pageNum = 1 | |||
this.getList() | |||
}, | |||
/** 重置按钮操作 */ | |||
resetQuery() { | |||
this.resetForm("queryForm"); | |||
this.handleQuery(); | |||
this.resetForm('queryForm') | |||
this.handleQuery() | |||
}, | |||
// 多选框选中数据 | |||
handleSelectionChange(selection) { | |||
this.ids = selection.map(item => item.id) | |||
this.single = selection.length!==1 | |||
this.ids = selection.map((item) => item.id) | |||
this.single = selection.length !== 1 | |||
this.multiple = !selection.length | |||
}, | |||
/** 新增按钮操作 */ | |||
handleAdd() { | |||
this.reset(); | |||
this.open = true; | |||
this.title = "添加预警配置"; | |||
this.reset() | |||
this.open = true | |||
this.title = '添加预警配置' | |||
}, | |||
/** 修改按钮操作 */ | |||
handleUpdate(row) { | |||
this.loading = true; | |||
this.reset(); | |||
this.loading = true | |||
this.reset() | |||
const id = row.id || this.ids | |||
getOperationWarnconfig(id).then(response => { | |||
this.loading = false; | |||
this.form = response.data; | |||
this.open = true; | |||
this.title = "修改预警配置"; | |||
}); | |||
getOperationWarnconfig(id).then((response) => { | |||
this.loading = false | |||
this.form = response.data | |||
this.open = true | |||
this.title = '修改预警配置' | |||
}) | |||
}, | |||
/** 提交按钮 */ | |||
submitForm() { | |||
this.$refs["form"].validate(valid => { | |||
this.$refs['form'].validate((valid) => { | |||
if (valid) { | |||
this.buttonLoading = true; | |||
this.buttonLoading = true | |||
if (this.form.id != null) { | |||
updateOperationWarnconfig(this.form).then(response => { | |||
this.$modal.msgSuccess("修改成功"); | |||
this.open = false; | |||
this.getList(); | |||
}).finally(() => { | |||
this.buttonLoading = false; | |||
}); | |||
updateOperationWarnconfig(this.form) | |||
.then((response) => { | |||
this.$modal.msgSuccess('修改成功') | |||
this.open = false | |||
this.getList() | |||
}) | |||
.finally(() => { | |||
this.buttonLoading = false | |||
}) | |||
} else { | |||
addOperationWarnconfig(this.form).then(response => { | |||
this.$modal.msgSuccess("新增成功"); | |||
this.open = false; | |||
this.getList(); | |||
}).finally(() => { | |||
this.buttonLoading = false; | |||
}); | |||
addOperationWarnconfig(this.form) | |||
.then((response) => { | |||
this.$modal.msgSuccess('新增成功') | |||
this.open = false | |||
this.getList() | |||
}) | |||
.finally(() => { | |||
this.buttonLoading = false | |||
}) | |||
} | |||
} | |||
}); | |||
}) | |||
}, | |||
/** 删除按钮操作 */ | |||
handleDelete(row) { | |||
const ids = row.id || this.ids; | |||
this.$modal.confirm('是否确认删除预警配置编号为"' + ids + '"的数据项?').then(() => { | |||
this.loading = true; | |||
return delOperationWarnconfig(ids); | |||
}).then(() => { | |||
this.loading = false; | |||
this.getList(); | |||
this.$modal.msgSuccess("删除成功"); | |||
}).catch(() => { | |||
}).finally(() => { | |||
this.loading = false; | |||
}); | |||
const ids = row.id || this.ids | |||
this.$modal | |||
.confirm('是否确认删除预警配置编号为"' + ids + '"的数据项?') | |||
.then(() => { | |||
this.loading = true | |||
return delOperationWarnconfig(ids) | |||
}) | |||
.then(() => { | |||
this.loading = false | |||
this.getList() | |||
this.$modal.msgSuccess('删除成功') | |||
}) | |||
.catch(() => {}) | |||
.finally(() => { | |||
this.loading = false | |||
}) | |||
}, | |||
/** 导出按钮操作 */ | |||
handleExport() { | |||
this.download('system/operationWarnconfig/export', { | |||
...this.queryParams | |||
}, `operationWarnconfig_${new Date().getTime()}.xlsx`) | |||
this.download( | |||
'system/operationWarnconfig/export', | |||
{ | |||
...this.queryParams | |||
}, | |||
`operationWarnconfig_${new Date().getTime()}.xlsx` | |||
) | |||
} | |||
} | |||
}; | |||
} | |||
</script> |
@@ -142,6 +142,7 @@ | |||
> | |||
{{ scope.row.goodsSkuName }} | |||
</el-link> | |||
<em style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" :title="scope.row.remark">{{ scope.row.remark }}</em> | |||
<em>{{ scope.row.goodsSkuSn }}</em> | |||
<em>¥{{ scope.row.initPrice }}</em> | |||
</div> | |||
@@ -215,7 +216,7 @@ | |||
> | |||
<template slot-scope="scope"> | |||
<el-button | |||
v-if="scope.row.status == 1" | |||
v-if="scope.row.status == 0" | |||
v-hasPermi="['system:operationWarnresult:edit']" | |||
size="mini" | |||
type="text" |