This commit is contained in:
xiaozhiyong
2023-02-09 15:51:21 +08:00
commit 08196dbf68
82 changed files with 4443 additions and 0 deletions

228
src/views/404.vue Normal file
View File

@@ -0,0 +1,228 @@
<template>
<div class="wscn-http404-container">
<div class="wscn-http404">
<div class="pic-404">
<img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404">
<img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404">
<img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404">
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
</div>
<div class="bullshit">
<div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">All rights reserved
<a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
</div>
<div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
<a href="" class="bullshit__return-home">Back to home</a>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Page404',
computed: {
message() {
return 'The webmaster said that you can not enter this page...'
}
}
}
</script>
<style lang="scss" scoped>
.wscn-http404-container{
transform: translate(-50%,-50%);
position: absolute;
top: 40%;
left: 50%;
}
.wscn-http404 {
position: relative;
width: 1200px;
padding: 0 50px;
overflow: hidden;
.pic-404 {
position: relative;
float: left;
width: 600px;
overflow: hidden;
&__parent {
width: 100%;
}
&__child {
position: absolute;
&.left {
width: 80px;
top: 17px;
left: 220px;
opacity: 0;
animation-name: cloudLeft;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
&.mid {
width: 46px;
top: 10px;
left: 420px;
opacity: 0;
animation-name: cloudMid;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1.2s;
}
&.right {
width: 62px;
top: 100px;
left: 500px;
opacity: 0;
animation-name: cloudRight;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
@keyframes cloudLeft {
0% {
top: 17px;
left: 220px;
opacity: 0;
}
20% {
top: 33px;
left: 188px;
opacity: 1;
}
80% {
top: 81px;
left: 92px;
opacity: 1;
}
100% {
top: 97px;
left: 60px;
opacity: 0;
}
}
@keyframes cloudMid {
0% {
top: 10px;
left: 420px;
opacity: 0;
}
20% {
top: 40px;
left: 360px;
opacity: 1;
}
70% {
top: 130px;
left: 180px;
opacity: 1;
}
100% {
top: 160px;
left: 120px;
opacity: 0;
}
}
@keyframes cloudRight {
0% {
top: 100px;
left: 500px;
opacity: 0;
}
20% {
top: 120px;
left: 460px;
opacity: 1;
}
80% {
top: 180px;
left: 340px;
opacity: 1;
}
100% {
top: 200px;
left: 300px;
opacity: 0;
}
}
}
}
.bullshit {
position: relative;
float: left;
width: 300px;
padding: 30px 0;
overflow: hidden;
&__oops {
font-size: 32px;
font-weight: bold;
line-height: 40px;
color: #1482f0;
opacity: 0;
margin-bottom: 20px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-fill-mode: forwards;
}
&__headline {
font-size: 20px;
line-height: 24px;
color: #222;
font-weight: bold;
opacity: 0;
margin-bottom: 10px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.1s;
animation-fill-mode: forwards;
}
&__info {
font-size: 13px;
line-height: 21px;
color: grey;
opacity: 0;
margin-bottom: 30px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.2s;
animation-fill-mode: forwards;
}
&__return-home {
display: block;
float: left;
width: 110px;
height: 36px;
background: #1482f0;
border-radius: 100px;
text-align: center;
color: #ffffff;
opacity: 0;
font-size: 14px;
line-height: 36px;
cursor: pointer;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}
@keyframes slideUp {
0% {
transform: translateY(60px);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
}
}
</style>

260
src/views/login/index.vue Normal file
View File

@@ -0,0 +1,260 @@
<template>
<div class="login-container">
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
auto-complete="on"
label-position="left"
>
<div class="title-container">
<h3 class="title">Login Form</h3>
</div>
<el-form-item prop="username">
<span class="svg-container">
<svg-icon icon-class="user" />
</span>
<el-input
ref="username"
v-model="loginForm.username"
placeholder="Username"
name="username"
type="text"
tabindex="1"
auto-complete="on"
/>
</el-form-item>
<el-form-item prop="password">
<span class="svg-container">
<svg-icon icon-class="password" />
</span>
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
:type="passwordType"
placeholder="Password"
name="password"
tabindex="2"
auto-complete="on"
@keyup.enter.native="handleLogin"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
/>
</span>
</el-form-item>
<el-button
:loading="loading"
type="primary"
style="width: 100%; margin-bottom: 30px"
@click.native.prevent="handleLogin"
>Login</el-button
>
<div class="tips">
<span style="margin-right: 20px">username: admin</span>
<span> password: any</span>
</div>
</el-form>
</div>
</template>
<script>
import { validUsername } from "@/utils/validate";
export default {
name: "Login",
data() {
const validateUsername = (rule, value, callback) => {
if (!validUsername(value)) {
callback(new Error("Please enter the correct user name"));
} else {
callback();
}
};
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error("The password can not be less than 6 digits"));
} else {
callback();
}
};
return {
loginForm: {
username: "admin",
password: "111111",
},
loginRules: {
username: [
{ required: true, trigger: "blur", validator: validateUsername },
],
password: [
{ required: true, trigger: "blur", validator: validatePassword },
],
},
loading: false,
passwordType: "password",
redirect: undefined,
};
},
watch: {
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true,
},
},
methods: {
showPwd() {
if (this.passwordType === "password") {
this.passwordType = "";
} else {
this.passwordType = "password";
}
this.$nextTick(() => {
this.$refs.password.focus();
});
},
handleLogin() {
this.$refs.loginForm.validate((valid) => {
if (valid) {
localStorage.setItem("token", "1");
this.$router.push({ path: this.redirect || "/" });
return;
this.loading = true;
this.$store
.dispatch("user/login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" });
this.loading = false;
})
.catch(() => {
this.loading = false;
});
} else {
console.log("error submit!!");
return false;
}
});
},
},
};
</script>
<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
$bg: #283443;
$light_gray: #fff;
$cursor: #fff;
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
.login-container .el-input input {
color: $cursor;
}
}
/* reset element-ui css */
.login-container {
.el-input {
display: inline-block;
height: 47px;
width: 85%;
input {
background: transparent;
border: 0px;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
color: $light_gray;
height: 47px;
caret-color: $cursor;
&:-webkit-autofill {
box-shadow: 0 0 0px 1000px $bg inset !important;
-webkit-text-fill-color: $cursor !important;
}
}
}
.el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
color: #454545;
}
}
</style>
<style lang="scss" scoped>
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;
.login-container {
min-height: 100%;
width: 100%;
background-color: $bg;
overflow: hidden;
.login-form {
position: relative;
width: 520px;
max-width: 100%;
padding: 160px 35px 0;
margin: 0 auto;
overflow: hidden;
}
.tips {
font-size: 14px;
color: #fff;
margin-bottom: 10px;
span {
&:first-of-type {
margin-right: 16px;
}
}
}
.svg-container {
padding: 6px 5px 6px 15px;
color: $dark_gray;
vertical-align: middle;
width: 30px;
display: inline-block;
}
.title-container {
position: relative;
.title {
font-size: 26px;
color: $light_gray;
margin: 0px auto 40px auto;
text-align: center;
font-weight: bold;
}
}
.show-pwd {
position: absolute;
right: 10px;
top: 7px;
font-size: 16px;
color: $dark_gray;
cursor: pointer;
user-select: none;
}
}
</style>

View File

@@ -0,0 +1,7 @@
<template></template>
<script>
export default {};
</script>
<style></style>

View File

@@ -0,0 +1,7 @@
<template></template>
<script>
export default {};
</script>
<style></style>

View File

@@ -0,0 +1,152 @@
<template>
<el-drawer
:title="controlWindows.addInfo.title"
direction="rtl"
size="40%"
:visible="controlWindows.add"
@opened="openDrawer"
:before-close="closeWindow"
>
<div class="add">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="炼厂名称" prop="refineryName">
<el-input
maxlength="50"
v-model="form.refineryName"
placeholder="请输入炼厂名称"
></el-input>
</el-form-item>
<el-form-item label="炼厂类型" prop="refineryType">
<el-select v-model="form.refineryType" placeholder="请选择炼厂类型">
<el-option
v-for="(item, index) in refineryTypeEnum"
:key="index"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="启用状态" prop="enableMark">
<el-radio-group v-model="form.enableMark">
<el-radio label="ENABLE">启用</el-radio>
<el-radio label="DISABLE">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="炼厂等级" prop="refineryLevel">
<el-select v-model="form.refineryLevel" placeholder="请选择炼厂等级">
<el-option label="A" value="A"></el-option>
<el-option label="B" value="B"></el-option>
<el-option label="C" value="C"></el-option>
<el-option label="D" value="D"></el-option>
<el-option label="E" value="E"></el-option>
</el-select>
</el-form-item>
<el-form-item label="炼厂地址" prop="address">
<el-input
type="textarea"
:rows="5"
maxlength="255"
placeholder="请输入炼厂地址"
v-model="form.address"
></el-input>
</el-form-item>
</el-form>
</div>
<div class="buttons">
<el-button @click="closeWindow">取消 </el-button>
<el-button @click="submit">确定</el-button>
</div>
</el-drawer>
</template>
<script>
import serve from "api/refineryInfo.js";
export default {
props: {
controlWindows: Object,
refineryTypeEnum: Array,
},
data() {
return {
form: {},
rules: {
refineryName: [
{ required: true, message: "请输入炼厂名称", trigger: "blur" },
],
refineryType: [
{ required: true, message: "请选择炼厂类型", trigger: "blur" },
],
enableMark: [
{ required: true, message: "请选择启用状态", trigger: "blur" },
],
refineryLevel: [
{ required: true, message: "请选择炼厂等级", trigger: "blur" },
],
address: [
{ required: true, message: "请输入炼厂地址", trigger: "blur" },
],
},
};
},
methods: {
openDrawer() {
let { id } = this.controlWindows.addInfo;
if (id) {
//回显
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo));
}
},
submit() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.judgeInterface(this.form).then((res) => {
if (res.code === 20000) {
this.$message.success(res.msg);
this.closeWindow();
}
});
}
});
},
judgeInterface(form) {
let { id } = this.controlWindows.addInfo;
if (id) return serve.update(form);
else return serve.save(form);
},
closeWindow() {
this.$emit("closeWindow");
this.$refs.form.clearValidate();
this.form = {};
this.controlWindows.addInfo = {};
this.controlWindows.add = false;
},
},
};
</script>
<style lang="scss" scoped>
.add {
padding: 20px;
.el-input,
.el-select,
.el-textarea {
width: 300px;
}
}
.buttons {
position: absolute;
left: 0;
bottom: 0;
padding-right: 40px;
width: 100%;
height: 80px;
line-height: 80px;
text-align: right;
border-top: 1px solid #f2f3f5;
.el-button {
text-align: right;
font-size: 14px;
border-radius: 5px;
}
}
</style>

View File

@@ -0,0 +1,353 @@
<template>
<div class="order">
<div class="frame">
<el-select v-model="parameter.params.id" placeholder="炼厂名称" clearable>
<el-option
v-for="item in refineryList"
:key="item.id"
:label="item.refineryName"
:value="item.id"
>
</el-option>
</el-select>
<div class="buttons">
<el-button icon="el-icon-search" @click="handleCurrentChange(1)"
>查询</el-button
>
<el-button icon="el-icon-refresh" @click="reset">重置</el-button>
</div>
</div>
<div class="table">
<div class="operation">
<el-button icon="el-icon-upload2" @click="addition">炼厂入驻</el-button>
</div>
<el-table
v-if="tableHeight"
ref="multipleTable"
:height="tableHeight"
:data="tableData"
style="width: 100%"
>
<el-table-column
prop="refineryName"
label="炼厂名称"
show-overflow-tooltip
>
</el-table-column>
<el-table-column prop="orderSerialNumber" label="炼厂类型" width="90">
<template slot-scope="{ row }">
{{
refineryTypeEnum.find((item) => item.value === row.refineryType)
.label
}}
</template>
</el-table-column>
<el-table-column prop="refineryLevel" label="炼厂等级" width="90">
</el-table-column>
<el-table-column prop="address" label="炼厂地址" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="orderSerialNumber" label="启用状态" width="80">
<template slot-scope="{ row }">
<el-switch
v-model="row.enableMark"
active-value="ENABLE"
inactive-value="DISABLE"
active-color="#13ce66"
inactive-color="#ff4949"
@change="
(val) => {
switchTrigger(val, row);
}
"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
prop="orderSerialNumber"
label="启用产品数量"
width="120"
>
</el-table-column>
<el-table-column label="时间" width="235">
<template slot-scope="{ row }">
<p class="gray">
创建时间 <span>{{ row.createTime }}</span>
</p>
<p class="gray">
更新时间 <span>{{ row.updateTime || " - -" }}</span>
</p>
</template>
</el-table-column>
<el-table-column prop="orderSerialNumber" label="操作" width="150">
<template slot-scope="{ row }">
<el-link type="primary" :underline="false" @click="update(row)"
>修改</el-link
>
<el-link type="primary" :underline="false" @click="detail(row)"
>详情</el-link
>
<el-popconfirm
title="确定删除该条数据吗?"
icon-color="red"
@confirm="deleteRow(row)"
>
<el-link slot="reference" type="primary" :underline="false"
>删除</el-link
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="parameter.currentPage"
:page-size="parameter.pageSize"
:popper-append-to-body="false"
:page-sizes="[10, 20, 30, 50]"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
<add
:controlWindows="controlWindows"
:refineryTypeEnum="refineryTypeEnum"
@closeWindow="handleCurrentChange(1)"
/>
<el-drawer
title="详情"
direction="ltr"
size="60%"
:withHeader="false"
:visible="controlWindows.detail"
>
<general-details
title="详情"
:isHeader="true"
v-if="controlWindows.detail"
:sourceData="oilCompanyMatch"
:mappingData="mappingData"
@close="controlWindows.detail = false"
>
</general-details>
</el-drawer>
</div>
</template>
<script>
import serve from "api/refineryInfo.js";
import add from "./components/add.vue";
import generalDetails from "components/generalDetails/index.vue";
export default {
data() {
return {
controlWindows: {
add: false,
addInfo: {
title: "炼厂入驻",
},
detail: false,
},
refineryTypeEnum: [
{
label: "普通炼厂",
value: "COMMON",
},
],
refineryList: [],
tableHeight: 0,
tableData: [],
total: 0,
parameter: {
currentPage: 1,
pageSize: 10,
params: {},
},
oilCompanyMatch: {},
mappingData: [
{
carTitle: "",
carItems: [
{ label: "炼厂名称", value: "refineryName" },
{ label: "炼厂类型", value: "refineryType" },
{ label: "启用状态", value: "enableMark" },
{ label: "炼厂等级", value: "refineryLevel" },
{ label: "炼厂地址", value: "address" },
{ label: "创建用户ID", value: "createUser" },
{ label: "创建时间", value: "createTime" },
{ label: "修改用户ID", value: "updateUser" },
{ label: "修改时间", value: "updateTime" },
],
},
],
};
},
components: {
add,
generalDetails,
},
mounted() {
this.$nextTick(() => {
this.heightHandle();
});
window.addEventListener(
"resize",
this.$utils.debounce(this.heightHandle, 500)
);
},
created() {
this.findByEntity();
this.getByPage();
},
methods: {
// currentPage change
handleCurrentChange(page) {
this.parameter.currentPage = page;
this.getByPage();
},
// pageSize change
handleSizeChange(size) {
this.parameter.currentPage = 1;
this.parameter.pageSize = size;
this.getByPage();
},
//table list
getByPage() {
serve.getByPage(this.parameter).then((res) => {
this.tableData = res.data.list;
this.total = res.data.totalPage;
});
},
//炼厂list
findByEntity() {
serve.findByEntity().then((res) => {
this.refineryList = res.data;
});
},
//新增
addition() {
this.controlWindows.addInfo.title = "炼厂入驻";
this.controlWindows.add = true;
},
//修改
update(row) {
this.controlWindows.addInfo.title = "炼厂修改";
Object.assign(this.controlWindows.addInfo, row);
this.controlWindows.add = true;
},
//详情
detail(row) {
this.oilCompanyMatch = row;
this.controlWindows.detail = true;
},
//删除
deleteRow(row) {
serve
.deleteRow({
id: row.id,
})
.then((res) => {
this.$message.success(res.msg);
this.getByPage();
});
},
//启用禁用
switchTrigger(val, row) {
row.enableMark = row.enableMark;
serve
.update({
id: row.id,
enableMark: val,
})
.then((res) => {
if (res.code === 20000) {
this.getByPage();
} else this.$message.error(res.msg);
});
},
//重置
reset() {
this.parameter = {
currentPage: 1,
pageSize: 10,
params: {},
};
},
// table height
heightHandle() {
let bodyHeight = document.body.clientHeight;
let frameHeight = this.obtainElement(".frame").clientHeight;
let operationHeight = this.obtainElement(".operation").clientHeight;
let paginationHeight = this.obtainElement(".el-pagination").clientHeight;
this.tableHeight =
bodyHeight - frameHeight - operationHeight - paginationHeight - 145;
},
obtainElement(className) {
return document.documentElement.querySelector(className);
},
},
};
</script>
<style lang="scss" scoped>
.order {
.frame {
margin: 20px;
padding: 20px;
// width: 100%;
border-radius: 6px;
border: 1px solid #e3e3e5;
background: #fff;
.el-input,
.el-select {
width: 183px;
height: 40px;
}
.el-input + .el-input,
.el-input + .el-select,
.el-select + .el-select,
.el-select + .el-input {
margin-right: 20px;
margin-bottom: 15px;
}
.mr20 {
margin-right: 20px;
}
.buttons {
text-align: right;
}
}
.table {
overflow: hidden;
margin: 0 20px;
padding-bottom: 20px;
background: #fff;
border-radius: 6px;
border: 1px solid #e3e3e5;
> .operation {
box-sizing: content-box;
padding: 15px;
}
.gray {
color: #999;
span {
color: #333;
}
}
.el-table {
margin-bottom: 20px;
border-radius: 10px 10px 0px 0px;
}
.el-link {
margin-right: 10px;
}
}
}
</style>