首次提交
|
|
@ -0,0 +1,8 @@
|
||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ma-web.iml" filepath="$PROJECT_DIR$/.idea/ma-web.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,237 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title></title>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="./scripts/vue.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="./scripts/elementindex.css">
|
||||||
|
<script src="./scripts/elementindex.js"></script>
|
||||||
|
|
||||||
|
<!--//vue element-ui-css element-ui-js
|
||||||
|
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css">
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/element-ui@2.15.5/lib/index.js"></script>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script src="scripts/axiosmin.js"></script>
|
||||||
|
<!--
|
||||||
|
<script>
|
||||||
|
localStorage.setItem("online_user","");
|
||||||
|
localStorage.setItem("uuid","");
|
||||||
|
</script>
|
||||||
|
-->
|
||||||
|
<style>
|
||||||
|
/*.svg-background {
|
||||||
|
background: url(scripts/png/bg.jpg);
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-attachment: fixed;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}*/
|
||||||
|
.svg-background {
|
||||||
|
background: url(scripts/png/3-1.jpg);
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-attachment: fixed;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="svg-background">
|
||||||
|
<div id="app" >
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="loginForm" :model="form" :rules="rules" label-width="138px" class="login-box">
|
||||||
|
<h3 class="login-title" style="font-size: 50px;color: #f8f8f8;">六合维保计划管理软件</h3>
|
||||||
|
<el-form-item label="账号" prop="username">
|
||||||
|
<el-input type="text" placeholder="请输入账号" v-model="form.username" style="width: 262px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" prop="password">
|
||||||
|
<el-input type="password" placeholder="请输入密码" v-model="form.password" style="width: 262px;"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button style="width: 262px;" round type="primary" v-on:click="onSubmit('loginForm')">登录</el-button>
|
||||||
|
<!--<el-button style="width: 124px;" round type="primary" v-on:click="register('loginForm')">注册</el-button>-->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-dialog title="温馨提示"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="30%"
|
||||||
|
:before-close="handleClose"
|
||||||
|
:lock-scroll ="false">
|
||||||
|
<span>请输入账号和密码</span>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new Vue(
|
||||||
|
{
|
||||||
|
el: "#app",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
username: '',
|
||||||
|
password: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
username: [
|
||||||
|
{ required: true, message: '账号不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, message: '密码不可为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
dialogVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSubmit(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
//window.open("main.html","_self","baidu.com");
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
axios.post('/u_ma/login', {
|
||||||
|
username: _this.$data.form.username,
|
||||||
|
password: _this.$data.form.password
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
if (response.status != 200 || response.data.r !=0) {
|
||||||
|
|
||||||
|
if (response.data.r ==1) {
|
||||||
|
_this.$message({
|
||||||
|
message: "用户已登录!",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
_this.$message({
|
||||||
|
message: "登录失败,请检查用户名和密码是否正确!",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
localStorage.setItem("online_user",_this.$data.form.username);
|
||||||
|
localStorage.setItem("uuid",response.data.uuid);
|
||||||
|
localStorage.setItem("level",response.data.roleid);
|
||||||
|
localStorage.setItem("did",response.data.did);
|
||||||
|
localStorage.setItem("loc",response.data.loc);
|
||||||
|
location.href=response.data.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*else {
|
||||||
|
this.dialogVisible = true;
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
register(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
//window.open("main.html","_self","baidu.com");
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
axios.post('/deescloud/registerUser', {
|
||||||
|
username: _this.$data.form.username,
|
||||||
|
password: _this.$data.form.password
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
if (response.status != 200 || response.data.r !=0) {
|
||||||
|
|
||||||
|
if (response.data.r ==1) {
|
||||||
|
_this.$message({
|
||||||
|
message: "用户已注册!",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
_this.$message({
|
||||||
|
message: "注册失败!",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
_this.$message({
|
||||||
|
message: "注册成功!",
|
||||||
|
type: "success",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*else {
|
||||||
|
this.dialogVisible = true;
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
this.$confirm("确认关闭?")
|
||||||
|
.then(_ => {
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(_ => { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.el-form-item__label {
|
||||||
|
color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.login-box {
|
||||||
|
/*border: 1px solid #DCDFE6;*/
|
||||||
|
width: 500px;
|
||||||
|
margin: 180px auto;
|
||||||
|
padding: 35px 35px 15px 35px;
|
||||||
|
border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
/*box-shadow: 0 0 25px #909399;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-title {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 auto 40px auto;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,578 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title></title>
|
||||||
|
<script src="./scripts/vue.min.js"></script>
|
||||||
|
<script src="./scripts/vue-router.js"></script>
|
||||||
|
<!--
|
||||||
|
<script src="https://unpkg.com/vue-router@3.5.2/dist/vue-router.js"></script>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="./scripts/elementindex.css">
|
||||||
|
<script src="./scripts/elementindex.js"></script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
|
||||||
|
-->
|
||||||
|
<script src="scripts/axiosmin.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/checkuser.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/welldata.js"></script>
|
||||||
|
<script src="scripts/user.js"></script>
|
||||||
|
<script src="scripts/based.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/loginout.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/exportfile.js"></script>
|
||||||
|
|
||||||
|
<script src="https://cdn.bootcdn.net/ajax/libs/PapaParse/5.3.2/papaparse.min.js"></script>
|
||||||
|
<!--<script src="https://cdn.bootcss.com/xlsx/0.12.9/xlsx.full.min.js"></script>-->
|
||||||
|
|
||||||
|
<script src="scripts/pf.js"></script>
|
||||||
|
<script src="scripts/ds.js"></script>
|
||||||
|
<script src="scripts/rsm.js"></script>
|
||||||
|
|
||||||
|
<script src="scripts/mr.js"></script>
|
||||||
|
<script src="scripts/tw.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app" class="homeWrap">
|
||||||
|
<!--<el-container style="height: 100%; border: 1px solid #eee">-->
|
||||||
|
<!--<el-header style="text-align: right; font-size: 14px">-->
|
||||||
|
<!--<el-header style="height: 100%;">-->
|
||||||
|
<div style="border: 0px solid #eee;margin-bottom: 0px;height: 80px;background-color: #3C8DBC;color: #f8f8f8;display: block;">
|
||||||
|
<div style="float: right;font-size: 14px;line-height: 80px;padding-right: 10px;">
|
||||||
|
|
||||||
|
<el-dropdown @command="handleCommand">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
{{onlineuser}}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown" style="font-size: 12px;">
|
||||||
|
<el-dropdown-item command='exit'>退出</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--
|
||||||
|
<div v-if="did==1" style="float: right;line-height: 80px;margin-right: 5px;">
|
||||||
|
<svg v-if="message_Data.length==0" @click="show_message" style="margin-top: 32px;cursor: pointer;" t="1684119894746" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8545" width="16" height="16"><path d="M512 986.387692a148.361846 148.361846 0 0 1-147.101538-130.520615h-287.901539a39.384615 39.384615 0 0 1-39.384615-39.384615 39.384615 39.384615 0 0 1 39.384615-39.384616h91.136V381.479385A344.300308 344.300308 0 0 1 512 37.572923a344.300308 344.300308 0 0 1 343.906462 343.906462v395.657846h91.136a39.384615 39.384615 0 0 1 39.384615 39.384615 39.384615 39.384615 0 0 1-39.384615 39.384616h-287.940924A148.361846 148.361846 0 0 1 512 986.387692z m-66.953846-130.520615a69.474462 69.474462 0 0 0 66.953846 51.751385 69.474462 69.474462 0 0 0 66.953846-51.751385z m175.852308-78.769231h156.396307V381.479385A265.452308 265.452308 0 0 0 512 116.342154a265.452308 265.452308 0 0 0-265.137231 265.137231v395.657846z" fill="#f8f8f8" p-id="8546"></path></svg>
|
||||||
|
<svg v-if="message_Data.length>0" @click="show_message" style="margin-top: 32px;cursor: pointer;" t="1684119894746" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8545" width="16" height="16"><path d="M512 986.387692a148.361846 148.361846 0 0 1-147.101538-130.520615h-287.901539a39.384615 39.384615 0 0 1-39.384615-39.384615 39.384615 39.384615 0 0 1 39.384615-39.384616h91.136V381.479385A344.300308 344.300308 0 0 1 512 37.572923a344.300308 344.300308 0 0 1 343.906462 343.906462v395.657846h91.136a39.384615 39.384615 0 0 1 39.384615 39.384615 39.384615 39.384615 0 0 1-39.384615 39.384616h-287.940924A148.361846 148.361846 0 0 1 512 986.387692z m-66.953846-130.520615a69.474462 69.474462 0 0 0 66.953846 51.751385 69.474462 69.474462 0 0 0 66.953846-51.751385z m175.852308-78.769231h156.396307V381.479385A265.452308 265.452308 0 0 0 512 116.342154a265.452308 265.452308 0 0 0-265.137231 265.137231v395.657846z" fill="#ff0000" p-id="8546"></path></svg>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
<div style="text-align: center; font-size: 18px;line-height: 80px;float: none;">
|
||||||
|
<span style="font-size: 30px;font-weight: bolder;">六合维保计划管理软件 V1.0</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-drawer
|
||||||
|
title="详情"
|
||||||
|
:visible.sync="show_message_flag"
|
||||||
|
direction="rtl"
|
||||||
|
:before-close="handleClose"
|
||||||
|
size="40%"
|
||||||
|
style="margin-top: 80px;height: 60%;right: 20px;"
|
||||||
|
>
|
||||||
|
<div v-if="message_Data.length>0" >
|
||||||
|
<el-tag style="margin-left: 5px;margin-bottom: 10px;" type="success" effect="dark">
|
||||||
|
转入{{message_Data|show_msg_len}}条生产计划,请及时处理。
|
||||||
|
</el-tag>
|
||||||
|
<el-button size="small " type="primary" @click="mark_read" >标记已读</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="message_Data"
|
||||||
|
style="font-size:14px;margin-left: 5px;"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="task_id"
|
||||||
|
label="计划/项目号"
|
||||||
|
width="150"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="product_id"
|
||||||
|
label="编号"
|
||||||
|
width="100"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="total_num"
|
||||||
|
label="数量"
|
||||||
|
width="60">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="demand_date"
|
||||||
|
label="需求日期"
|
||||||
|
width="80">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="rdm_id"
|
||||||
|
label="RDM"
|
||||||
|
width="60"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button @click="to_redmine(scope.row)" type="text" size="medium">{{scope.row.rdm_id}}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="conveyer"
|
||||||
|
label="交付人"
|
||||||
|
width="60">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<el-menu
|
||||||
|
mode="horizontal"
|
||||||
|
background-color="#304156"
|
||||||
|
text-color="#bfcbd9"
|
||||||
|
active-text-color="#ffd04b"
|
||||||
|
:default-active="$route.path" router style="padding-left: 0px;" :unique-opened=true >
|
||||||
|
<template v-for="item in NavigateItem">
|
||||||
|
<el-submenu v-if="item.items.length" :index="item.index" :key="item.key" >
|
||||||
|
<!--<template slot="title" ><svg style="position:relative; bottom:2px;" class="icon" viewBox="0 0 1024 1024" width="18" height="18"><path :d="item.svg.first" fill="#707070"></path><path :d="item.svg.second" fill="#707070"></path></svg> {{item.title}}</template>-->
|
||||||
|
<template slot="title" ><svg style="position:relative; bottom:2px;" class="icon" viewBox="0 0 1024 1024" width="18" height="18"><path :d="item.svg.first" fill="#f8f8f8"></path><path :d="item.svg.second" fill="#f8f8f8"></path></svg> {{item.title}}</template>
|
||||||
|
<el-menu-item
|
||||||
|
v-for="(it,key) in item.items"
|
||||||
|
:key="key"
|
||||||
|
:index="it.index"
|
||||||
|
style="font-size: 13px;padding-left: 20px;"
|
||||||
|
>{{it.title}}</el-menu-item>
|
||||||
|
</el-submenu>
|
||||||
|
<el-menu-item v-else :index="item.index" :key="item.key">{{ item.title }} </el-menu-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-menu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--</el-header>--->
|
||||||
|
<!--<el-container>-->
|
||||||
|
<!--<el-aside width="15%" style="background-color: rgb(ff, ff, ff)">-->
|
||||||
|
<!--</el-aside>-->
|
||||||
|
<!--<el-main>-->
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<router-view v-if="NavigateItem.length"></router-view>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--</el-main>
|
||||||
|
|
||||||
|
</el-container>
|
||||||
|
</el-container>-->
|
||||||
|
<el-divider></el-divider>
|
||||||
|
<div v-show="if_show" style="background-color: #ffffff;height: 30px;">
|
||||||
|
<div style="text-align: center;padding-top: 10px;font-size: 12px;">
|
||||||
|
<span>版权所有 ©</span>
|
||||||
|
<span style="color: #116699;">北京六合伟业科技股份有限公司</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
history.pushState(null, null, document.URL);
|
||||||
|
window.addEventListener('popstate', function () {
|
||||||
|
console.log(document.URL);
|
||||||
|
history.pushState(null, null, document.URL);
|
||||||
|
});
|
||||||
|
|
||||||
|
setInterval(checkUser,5000);
|
||||||
|
|
||||||
|
Vue.directive('dialogDrag', {
|
||||||
|
bind(el, binding, vnode, oldVnode) {
|
||||||
|
// 获取拖拽内容头部
|
||||||
|
const dialogHeaderEl = el.querySelector('.el-dialog__header')
|
||||||
|
// 获取拖拽内容整体 这个rrc-dialog是我自己封装的组件 如果使用element的组件应写成.el-dialog
|
||||||
|
const dragDom = el.querySelector('.el-dialog') || el.querySelector('.ele-form-dialog')
|
||||||
|
dialogHeaderEl.style.cursor = 'move'
|
||||||
|
|
||||||
|
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
|
||||||
|
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
|
||||||
|
// const sty = window.getComputedStyle(dragDom, null)
|
||||||
|
// 鼠标按下事件
|
||||||
|
dialogHeaderEl.onmousedown = (e) => {
|
||||||
|
// 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
|
||||||
|
const disX = e.clientX - dialogHeaderEl.offsetLeft
|
||||||
|
const disY = e.clientY - dialogHeaderEl.offsetTop
|
||||||
|
console.log('e.clientX', e.clientX)
|
||||||
|
console.log('e.clientY ', e.clientY)
|
||||||
|
console.log('dialogHeaderEl', dialogHeaderEl)
|
||||||
|
console.log('dialogHeaderEl.offsetLeft', dialogHeaderEl.offsetLeft)
|
||||||
|
console.log('dialogHeaderEl.offsetTop', dialogHeaderEl.offsetTop)
|
||||||
|
// 获取到的值带px 正则匹配替换
|
||||||
|
let styL, styT
|
||||||
|
|
||||||
|
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
|
||||||
|
if (sty.left.includes('%')) {
|
||||||
|
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
|
||||||
|
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
|
||||||
|
} else {
|
||||||
|
styL = +sty.left.replace(/\px/g, '')
|
||||||
|
styT = +sty.top.replace(/\px/g, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('styL', styL)
|
||||||
|
console.log('styT', styT)
|
||||||
|
// 鼠标拖拽事件
|
||||||
|
document.onmousemove = function(e) {
|
||||||
|
// 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离)
|
||||||
|
const l = e.clientX - disX // 计算出从左往右边拖动了多少
|
||||||
|
const t = e.clientY - disY // 计算出从上往下拖动了多少
|
||||||
|
|
||||||
|
console.log('l', l)
|
||||||
|
console.log('t', t)
|
||||||
|
let finallyL = l + styL
|
||||||
|
let finallyT = t + styT
|
||||||
|
|
||||||
|
// 边界值判定 注意clientWidth scrollWidth区别 要减去之前的top left值
|
||||||
|
// dragDom.offsetParent表示弹窗阴影部分
|
||||||
|
if (finallyL < 0) {
|
||||||
|
// finallyL = 0
|
||||||
|
finallyL = l + styL
|
||||||
|
console.log('finallyL', finallyL)
|
||||||
|
} else if (finallyL > dragDom.offsetParent.clientWidth - dragDom.clientWidth - dragDom.offsetParent.offsetLeft) {
|
||||||
|
finallyL = dragDom.offsetParent.clientWidth - dragDom.clientWidth - dragDom.offsetParent.offsetLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finallyT < 0) {
|
||||||
|
// finallyT = 0
|
||||||
|
finallyT = t + styT
|
||||||
|
console.log('finallyT', finallyT)
|
||||||
|
} else if (finallyT > dragDom.offsetParent.clientHeight - dragDom.clientHeight - dragDom.offsetParent.offsetLeft) {
|
||||||
|
(
|
||||||
|
finallyT = dragDom.offsetParent.clientHeight - dragDom.clientHeight - dragDom.offsetParent.offsetLeft
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移动当前元素
|
||||||
|
dragDom.style.left = `${finallyL}px`
|
||||||
|
dragDom.style.top = `${finallyT}px`
|
||||||
|
|
||||||
|
// 将此时的位置传出去
|
||||||
|
// binding.value({x:e.pageX,y:e.pageY})
|
||||||
|
}
|
||||||
|
|
||||||
|
document.onmouseup = function(e) {
|
||||||
|
document.onmousemove = null
|
||||||
|
document.onmouseup = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var home = { template: '<div>welcome 首页</div>' }
|
||||||
|
|
||||||
|
var routes = [
|
||||||
|
{ path: '/scb', component: window.Wellcomponent },
|
||||||
|
{ path: '/mr', component: window.mrcomponent },
|
||||||
|
{ path: '/user', component: window.Usercomponent },
|
||||||
|
{ path: '/puser', component: window.pUsercomponent },
|
||||||
|
{ path: '/buser', component: window.bUsercomponent },
|
||||||
|
{ path: '/base_data', component: window.Basecomponent },
|
||||||
|
{ path: '/pf', component: window.pfcomponent },
|
||||||
|
{ path: '/ds', component: window.dscomponent },
|
||||||
|
{ path: '/rsm', component: window.rsmcomponent },
|
||||||
|
{ path: '/tw', component: window.twcomponent },
|
||||||
|
{ path: '*', redirect: '/scb'},
|
||||||
|
]
|
||||||
|
|
||||||
|
var router = new VueRouter({
|
||||||
|
routes: routes
|
||||||
|
})
|
||||||
|
|
||||||
|
new Vue(
|
||||||
|
{
|
||||||
|
el:"#app",
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
ifhidden:false,
|
||||||
|
onlineuser:localStorage.getItem("online_user"),
|
||||||
|
NavigateItem:[],
|
||||||
|
if_show:false,
|
||||||
|
show_message_flag:false,
|
||||||
|
message_Data:[],
|
||||||
|
|
||||||
|
did:localStorage.getItem("did"),
|
||||||
|
level:localStorage.getItem("level"),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
router:router,
|
||||||
|
filters: {
|
||||||
|
show_msg_len(data){
|
||||||
|
return data.length;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
mark_read(){
|
||||||
|
var _this = this;
|
||||||
|
axios.post('/pkpi/message_mark', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
_this.show_message();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
show_message(){
|
||||||
|
var _this = this;
|
||||||
|
axios.post('/pkpi/get_message', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
_this.$data.message_Data = response.data.data;
|
||||||
|
|
||||||
|
_this.$data.show_message_flag=true;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleCommand(command) {
|
||||||
|
if (command === 'exit') {
|
||||||
|
loginout();
|
||||||
|
}else if (command === 'help'){
|
||||||
|
var url = 'help.html';
|
||||||
|
url = encodeURI(url);
|
||||||
|
window.open(url, "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
var _this = this;
|
||||||
|
/*axios.post('/pkpi/get_message', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
_this.$data.message_Data = response.data.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
axios.post('/u_ma/getMenu', {
|
||||||
|
username: localStorage.getItem("online_user"),
|
||||||
|
uuid: localStorage.getItem("uuid")
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
_this.$data.NavigateItem = response.data.data;
|
||||||
|
|
||||||
|
console.log(_this.$data.NavigateItem);
|
||||||
|
_this.$data.if_show = true;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* 设置背景色 */
|
||||||
|
.packageDownLoad-tooltip {
|
||||||
|
background: #8abcd1 !important;
|
||||||
|
}
|
||||||
|
.el-tooltip__popper[x-placement^=right] .popper__arrow{
|
||||||
|
border-right-color: #8abcd1;
|
||||||
|
}
|
||||||
|
.el-tooltip__popper[x-placement^=right] .popper__arrow:after {
|
||||||
|
border-right-color: #8abcd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tooltip__popper[x-placement^=left] .popper__arrow{
|
||||||
|
border-left-color: #8abcd1;
|
||||||
|
}
|
||||||
|
.el-tooltip__popper[x-placement^=left] .popper__arrow:after {
|
||||||
|
border-left-color: #8abcd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__footer {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.el-dropdown-link {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #F8F8F8;
|
||||||
|
}
|
||||||
|
.el-card {
|
||||||
|
text-align: center;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.el-card span{
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.span{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table button{
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-divider--horizontal{
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
height: 0.5px;
|
||||||
|
background-color: #EBEEF5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-divider--vertical{
|
||||||
|
display: inline-block;
|
||||||
|
width: 1px;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
position: relative;
|
||||||
|
border-top: 1px dashed #e8eaec;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table .success-row {
|
||||||
|
background: #D9E1F2;//f0f9eb
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table .warning-row-1 {
|
||||||
|
color: #F9C57A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table .warning-row {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu{
|
||||||
|
font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table{
|
||||||
|
font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.t_hover_button{
|
||||||
|
color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.t_hover_button_1{
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table__body tr:hover>td{
|
||||||
|
background: #134857 !important;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.el-table__body tr:hover > td .t_hover_button {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.el-table th{
|
||||||
|
border-top: 1px solid #D4D4D4;
|
||||||
|
border-right: 1px solid #D4D4D4;
|
||||||
|
}
|
||||||
|
.el-table th:first-child{
|
||||||
|
border-left: 1px solid #D4D4D4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table th:first-child .cell{
|
||||||
|
padding-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table td:first-child .cell{
|
||||||
|
padding-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table td
|
||||||
|
{
|
||||||
|
border-right: 1px solid #D4D4D4;
|
||||||
|
border-top: 1px solid #D4D4D4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table td:first-child{
|
||||||
|
border-left: 1px solid #D4D4D4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.el-table th.is-leaf,{
|
||||||
|
border-width: 0.5px;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.el-table th.gutter{
|
||||||
|
display: table-cell!important;
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table td>.cell{
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
padding-left: 0rem;
|
||||||
|
padding-right: 0rem;
|
||||||
|
|
||||||
|
border-spacing: 0rem;
|
||||||
|
font-weight: normal;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table td {
|
||||||
|
padding-top: 0rem;
|
||||||
|
padding-bottom: 0rem;
|
||||||
|
padding-left: 0rem;
|
||||||
|
padding-right: 0rem;
|
||||||
|
border-spacing: 0rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table th {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
padding-left: 0rem;
|
||||||
|
padding-right: 0rem;
|
||||||
|
border-spacing: 0rem;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table th>.cell {
|
||||||
|
padding: 0px;
|
||||||
|
border-spacing: 0rem;
|
||||||
|
/*color:#4e545d;
|
||||||
|
font-weight: bold;*/
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.homeWrap {
|
||||||
|
/*position: absolute;*/
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-drawer {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,589 @@
|
||||||
|
var Basecomponent = {
|
||||||
|
template:`
|
||||||
|
<div>
|
||||||
|
<div id="" style="display: flex">
|
||||||
|
<el-input v-model="p_id_v" placeholder="产品编码" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-input v-model="p_name_v" placeholder="产品名称" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="get_p()">搜索</el-button>
|
||||||
|
<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="add_p()">新增</el-button>
|
||||||
|
<el-button id ="bt_del" plain type="primary" icon="el-icon-circle-plus-outline" @click="del_p()">删除</el-button>
|
||||||
|
<el-button plain type="primary" icon="el-icon-circle-plus-outline" @click="importCsv()">导入编号及名称</el-button>
|
||||||
|
<el-button style="margin-left: 10px;" id ="bt_export" plain type="primary" icon="el-icon-document" @click="exportSap()">导出</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<div class="span">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:height="tHeight"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!--style="height:23px;padding:0px" -->
|
||||||
|
<el-button @click="update_p(scope.row)" type="text" size="medium" >修改</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<span class="demonstration"></span>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[50,100, 200, 300]"
|
||||||
|
:page-size="pagesize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="recordTotal">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="产品信息"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
width="40%"
|
||||||
|
style="height: 100%;">
|
||||||
|
<el-form ref="form_p" :model="form" label-width="80px" :rules="rules">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="产品编号" prop="p_id">
|
||||||
|
<el-input v-model="form.p_id" :disabled="disabled"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="产品名称" prop="p_name">
|
||||||
|
<el-input v-model="form.p_name" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button id ="bt_ok" plain type="primary" @click="post_p()">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="产品编号和名称导入"
|
||||||
|
:visible.sync="importdialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
:before-close="importDialog_close"
|
||||||
|
width="30%">
|
||||||
|
<div style="display: flex;">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
:on-change="handleChange"
|
||||||
|
:file-list="fileListUpload"
|
||||||
|
:show-file-list="false"
|
||||||
|
accept=".csv"
|
||||||
|
:auto-upload="false">
|
||||||
|
<el-button id ="bt_upload" size="small" plain type="primary">点击上传(csv文件)</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<el-button id ="bt_import" size="small" plain type="primary" @click="importData" style="margin-left: 10px;">确认导入</el-button>
|
||||||
|
<!--<el-button id ="bt_download" size="small" plain type="primary" @click="download_template" style="margin-left: 10px;">下载导入模板文件</el-button>-->
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process1" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="importTableData"
|
||||||
|
style="font-size:13px;margin-top: 10px;width: 100%;"
|
||||||
|
:height="tHeight*0.5"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
stripe border>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data(){
|
||||||
|
// 获取当前屏幕的分辨率
|
||||||
|
let screenW = window.screen.width;
|
||||||
|
let screenH = window.screen.height;
|
||||||
|
console.log("screen width:",screenW);
|
||||||
|
console.log("screen height:",screenH);
|
||||||
|
return {
|
||||||
|
tHeight:screenH*0.8,
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pagesize:50,
|
||||||
|
recordTotal:0,
|
||||||
|
p_id_v:'',
|
||||||
|
p_name_v:'',
|
||||||
|
form: {
|
||||||
|
id:'',
|
||||||
|
p_id: '',
|
||||||
|
p_name:'',
|
||||||
|
},
|
||||||
|
dialogVisible:false,
|
||||||
|
oper_type:0,
|
||||||
|
rules: {
|
||||||
|
p_id: [
|
||||||
|
{ required: true, message: '产品编号不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
p_name: [
|
||||||
|
{ required: true, message: '产品名称不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
multipleSelection: [],
|
||||||
|
importdialogVisible:false,
|
||||||
|
fileListUpload:[],
|
||||||
|
importTableData:[],
|
||||||
|
disabled:true,
|
||||||
|
|
||||||
|
if_show_process:false,
|
||||||
|
percent_len:0,
|
||||||
|
interval:'',
|
||||||
|
if_show_process1:false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: _this.$data.currentPage,
|
||||||
|
count: _this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
input_change(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.get_p();
|
||||||
|
},
|
||||||
|
exportSap(){
|
||||||
|
document.getElementById("bt_export").blur();
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/export_sap', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
var fileid = response.data.fileId;
|
||||||
|
|
||||||
|
var downUrl = '/u_ma/download_file'+"?id="+fileid;
|
||||||
|
downloadUrl("产品编码名称.csv",downUrl);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
importData(){
|
||||||
|
document.getElementById("bt_import").blur();
|
||||||
|
if(this.$data.importTableData.length==0){
|
||||||
|
this.$message({
|
||||||
|
message: "请选择导入文件",
|
||||||
|
type: "warning",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$confirm('是否确认导入?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
var _this = this;
|
||||||
|
_this.$data.percent_len=0;
|
||||||
|
_this.$data.if_show_process1=true;
|
||||||
|
_this.$data.interval= setInterval(()=>{
|
||||||
|
if(_this.$data.percent_len>=99){
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.percent_len<98){
|
||||||
|
_this.$data.percent_len+=2
|
||||||
|
}
|
||||||
|
},20)
|
||||||
|
|
||||||
|
axios.post('/u_ma/import_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
data:this.$data.importTableData,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
let len = _this.$data.importTableData.length;
|
||||||
|
errType = "success"
|
||||||
|
s = "导入"+len+"条产品编号和名称成功!";
|
||||||
|
_this.$data.percent_len=100;
|
||||||
|
_this.$data.if_show_process1=false;
|
||||||
|
} else if(r == 1) {
|
||||||
|
errType = "error"
|
||||||
|
s = "正在导入产品编号和名称,请稍后!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
s = "导入产品编号和名称失败!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(s);
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
|
||||||
|
_this.$data.importdialogVisible=false;
|
||||||
|
//更新页面
|
||||||
|
_this.get_p();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleChange(file, fileList) {
|
||||||
|
document.getElementById("bt_upload").blur();
|
||||||
|
|
||||||
|
this.fileTemp = file.raw
|
||||||
|
console.log("filetype:",this.fileTemp);
|
||||||
|
if (this.fileTemp) {
|
||||||
|
console.log("begin ...")
|
||||||
|
console.log(this.fileTemp.type);
|
||||||
|
if ((this.fileTemp.type == 'text/csv') || (this.fileTemp.type == '.csv') || (this.fileTemp.type == 'application/vnd.ms-excel')) {
|
||||||
|
let _this = this//如果需要点击事件结束之后对DOM进行操作使用)_this.xx=xx进行操作
|
||||||
|
Papa.parse(_this.fileTemp, {
|
||||||
|
encoding:'gb2312',
|
||||||
|
complete (results) {
|
||||||
|
console.log(results)//这个是csv文件的数据
|
||||||
|
let data = []
|
||||||
|
//遍历csv文件中的数据,存放到data中 方法不唯一,可自己更改
|
||||||
|
for (let i = 0; i < results.data.length; ++i) {
|
||||||
|
if(i==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
obj.p_id = results.data[i][0]
|
||||||
|
if(obj.p_id==""|| obj.p_id==undefined){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
obj.p_name = results.data[i][1]
|
||||||
|
data.push(obj)
|
||||||
|
}
|
||||||
|
//data.splice(0, 1)//将数组第一位的表格名称去除
|
||||||
|
let num = 0
|
||||||
|
console.log('data', data)
|
||||||
|
_this.$data.importTableData=data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '附件格式错误,请删除后重新上传!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '请上传附件!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
importCsv(){
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$data.importTableData=[];
|
||||||
|
this.$data.importdialogVisible=true;
|
||||||
|
},
|
||||||
|
importDialog_close(done){
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
console.log("已选择");
|
||||||
|
console.log(val);
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
|
||||||
|
post_p(){
|
||||||
|
this.$refs['form_p'].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$data.dialogVisible = false;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
console.log(_this.$data.form);
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/post_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: _this.$data.form.id,
|
||||||
|
p_id: _this.$data.form.p_id,
|
||||||
|
p_name: _this.$data.form.p_name,
|
||||||
|
oper_type: _this.$data.oper_type,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.oper_type == 1) {
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "新增产品信息成功!";
|
||||||
|
} else if(r == 1) {
|
||||||
|
s = "已存在相同产品信息!";
|
||||||
|
}else{
|
||||||
|
s = "新增产品信息失败!";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (_this.$data.oper_type ==2){
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "修改产品信息成功!";
|
||||||
|
} else{
|
||||||
|
s = "修改产品信息失败!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
//更新页面
|
||||||
|
_this.get_p();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
del_p(){
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
axios.post('/u_ma/del_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
ids: _this.$data.multipleSelection,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
s = "删除产品信息成功!";
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
s = "删除产品信息失败!";
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
_this.get_p();//更新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
add_p(){
|
||||||
|
document.getElementById("bt_add").blur();
|
||||||
|
|
||||||
|
this.$data.disabled=false;
|
||||||
|
this.$data.oper_type = 1;
|
||||||
|
this.$data.form = {
|
||||||
|
id:'',
|
||||||
|
p_id: '',
|
||||||
|
p_name:'',
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['form_p'].clearValidate()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
update_p(info){
|
||||||
|
this.$data.disabled=true;
|
||||||
|
this.$data.oper_type = 2;
|
||||||
|
this.$data.form = {
|
||||||
|
id:info.id,
|
||||||
|
p_id: info.p_id,
|
||||||
|
p_name:info.p_name,
|
||||||
|
};
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['form_p'].clearValidate()
|
||||||
|
});
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
get_p(){
|
||||||
|
document.getElementById("bt_search").blur();
|
||||||
|
|
||||||
|
this.$data.currentPage=1;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.$data.pagesize = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$data.currentPage = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_p', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
# Copyright 2014, Viktor Wahlberg.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Main browser.js Object...
|
||||||
|
|
||||||
|
var browserJS = new Object;
|
||||||
|
|
||||||
|
// browser.js userAgent array for quick and accurate lookup, if userAgent is added...
|
||||||
|
|
||||||
|
browserJS.userAgentStringArray = {
|
||||||
|
/*
|
||||||
|
|
||||||
|
All userAgent strings listed below are incomplete. The object has been
|
||||||
|
constructed this way so that multiple versions of the same browser can
|
||||||
|
be detected using the same string. These dynamic values of the
|
||||||
|
userAgent string are replaced with a underscore followed by a name in
|
||||||
|
all caps and ended with another underscore. Each of these variables
|
||||||
|
are handled in the init function.
|
||||||
|
|
||||||
|
*/
|
||||||
|
"Mozilla/5.0 (_OS_) Gecko/_GECKO_ Firefox/_VERSION_": {
|
||||||
|
"name": "Forefox",
|
||||||
|
"userAgentLayout": "os,gecko,version"
|
||||||
|
},
|
||||||
|
"Mozilla/5.0 (_OS_) AppleWebKit/_WEBKIT_BUILD_ (KHTML, like Gecko) Chrome/_CHROME_VERSION_ Safari/_SAFARI_ OPR/_VERSION_": {
|
||||||
|
"name": "Opera",
|
||||||
|
"userAgentLayout": "os,webkit_build,chrome_version,safari,version"
|
||||||
|
},
|
||||||
|
"Mozilla/5.0 (_OS_) AppleWebKit/_WEBKIT_BUILD_ (KHTML, like Gecko) Chrome/_CHROME_VERSION_ Maxthon/_VERSION_ Safari/_SAFARI_": {
|
||||||
|
"name": "Maxthon",
|
||||||
|
"userAgentLayout": "os,webkit_build,chrome_version,version,safari"
|
||||||
|
},
|
||||||
|
// Google Chrome 0 to CURRENT
|
||||||
|
"Mozilla/5.0 (_OS_) AppleWebKit/_WEBKIT_BUILD_ (KHTML, like Gecko) Chrome/_VERSION_ Safari/_SAFARI_": {
|
||||||
|
"name": "Google Chrome",
|
||||||
|
"userAgentLayout": "os,webkit_build,version,safari"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Premade object containing all variables of the browser object, when checking browserJS.browser structure and creating browserJS.browser failed state...
|
||||||
|
|
||||||
|
browserJS.failedObject = {
|
||||||
|
"name": "Unknown",
|
||||||
|
"logicalName": "unknown",
|
||||||
|
"version": "0",
|
||||||
|
"os": "Unknown",
|
||||||
|
"logicalOs": "unknown"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get object size, used in for loops...
|
||||||
|
|
||||||
|
browserJS.getObjectSize = function (obj) {
|
||||||
|
var size = 0, key;
|
||||||
|
for (key in obj)
|
||||||
|
{
|
||||||
|
if (obj.hasOwnProperty(key)) size++;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Declare current userAgent and create browserJS.browser object...
|
||||||
|
|
||||||
|
browserJS.UA = navigator.userAgent;
|
||||||
|
browserJS.browser = browserJS.failedObject;
|
||||||
|
|
||||||
|
|
||||||
|
// Init function, makes calls for other functions and add values to browserJS.browser Object...
|
||||||
|
|
||||||
|
browserJS.init = function () {
|
||||||
|
// Try to figure out what browser, version, webkit build and os the user is running...
|
||||||
|
|
||||||
|
for(var i = 0;browserJS.userAgentStringArray[Object.getOwnPropertyNames(browserJS.userAgentStringArray)[i]];i++)
|
||||||
|
{
|
||||||
|
// Make a new variable with the value of the test userAgent string...
|
||||||
|
var UAUsed = Object.getOwnPropertyNames(browserJS.userAgentStringArray)[i];
|
||||||
|
// Make a new variable with the value of the real userAgent string...
|
||||||
|
var UAReal = browserJS.UA;
|
||||||
|
var skippedVariablesCount = 0;
|
||||||
|
|
||||||
|
var userAgentSpecificVariableLayout = browserJS.userAgentStringArray[Object.getOwnPropertyNames(browserJS.userAgentStringArray)[i]]["userAgentLayout"].split(",");
|
||||||
|
for(var j = 0;userAgentSpecificVariableLayout[j];j++)
|
||||||
|
{
|
||||||
|
// Check if UAUsed is string...
|
||||||
|
if(typeof UAUsed == "string")
|
||||||
|
{
|
||||||
|
// Split the string on each userAgent variable and use the first part to split the real userAgent...
|
||||||
|
// This will allow us to check the static parts of the userAgent only, so that dynamic variables (such as version numbers) don't matter when checking what browser...
|
||||||
|
UAUsed = UAUsed.split("_" + userAgentSpecificVariableLayout[j].toUpperCase() + "_");
|
||||||
|
if(typeof(UAUsed != "string"))
|
||||||
|
{
|
||||||
|
UAReal = UAReal.split(UAUsed[0]);
|
||||||
|
if(typeof UAReal == "string")
|
||||||
|
{
|
||||||
|
UAReal = browserJS.UA;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skippedVariablesCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// When the UAUsed have been split you cannot use the same method, basically does the same thing as above with a different method...
|
||||||
|
UAUsed = UAUsed[UAUsed.length-1];
|
||||||
|
UAUsed = UAUsed.split("_" + userAgentSpecificVariableLayout[j].toUpperCase() + "_");
|
||||||
|
if(typeof UAUsed != "string" && UAUsed.length == 2)
|
||||||
|
{
|
||||||
|
var UARealSplit = UAReal[j-skippedVariablesCount].split(UAUsed[0]);
|
||||||
|
if(UARealSplit.length == 2)
|
||||||
|
{
|
||||||
|
var push_value1 = UARealSplit[0];
|
||||||
|
var push_value2 = UARealSplit[1];
|
||||||
|
UAReal[j-skippedVariablesCount] = push_value1;
|
||||||
|
UAReal.push(push_value2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UAReal = browserJS.UA;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skippedVariablesCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(UAReal != browserJS.UA)
|
||||||
|
{
|
||||||
|
browserJS.browser = browserJS.userAgentStringArray[Object.getOwnPropertyNames(browserJS.userAgentStringArray)[i]];
|
||||||
|
var userAgentString = browserJS.browser["userAgentLayout"].split(",");
|
||||||
|
var UA = Object.getOwnPropertyNames(browserJS.userAgentStringArray)[i];
|
||||||
|
for(var k = 0;userAgentString[k];k++)
|
||||||
|
{
|
||||||
|
console.log(UAReal)
|
||||||
|
console.log(userAgentString["userAgentLayout"])
|
||||||
|
browserJS.browser[userAgentString[k]] = UAReal[k+1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the browser.js initiation function. This function will run when the script has been loaded, not when the page is loaded. You might want to change this...
|
||||||
|
|
||||||
|
browserJS.init();
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
var refresh_err_cnt = 0
|
||||||
|
function checkUser(){
|
||||||
|
if (localStorage.getItem("online_user") == '') {
|
||||||
|
location.href = "login.html";
|
||||||
|
}else{
|
||||||
|
axios.post('/u_ma/refreshUser', {
|
||||||
|
username: localStorage.getItem("online_user"),
|
||||||
|
uuid: localStorage.getItem("uuid"),
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
if (response.status != 200) {
|
||||||
|
//location.href="login.html";
|
||||||
|
refresh_err_cnt+=1;
|
||||||
|
console.log("refresh_err_cnt:",refresh_err_cnt);
|
||||||
|
if (refresh_err_cnt>3) {
|
||||||
|
localStorage.setItem("refresh_err_cnt",refresh_err_cnt);
|
||||||
|
refresh_err_cnt = 0;
|
||||||
|
location.href="login.html";
|
||||||
|
}
|
||||||
|
}else if (response.status == 200 && response.data.r !=0) {
|
||||||
|
location.href="login.html";
|
||||||
|
}else if (response.status == 200 && response.data.r ==0) {
|
||||||
|
if (refresh_err_cnt > 0) {
|
||||||
|
refresh_err_cnt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
|
||||||
|
refresh_err_cnt+=1;
|
||||||
|
console.log("refresh_err_cnt:",refresh_err_cnt);
|
||||||
|
if (refresh_err_cnt>3) {
|
||||||
|
localStorage.setItem("catch-error",error);
|
||||||
|
refresh_err_cnt = 0;
|
||||||
|
location.href="login.html";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let url = decodeURI(window.location.href);
|
||||||
|
let argsIndex = url .split("?user=");
|
||||||
|
console.log("current html argsIndex:",argsIndex);
|
||||||
|
let arg = argsIndex[1];
|
||||||
|
console.log("current html arg:",arg);
|
||||||
|
|
||||||
|
let argsIndex1 = url .split("uuid=");
|
||||||
|
console.log("current html argsIndex1:",argsIndex1);
|
||||||
|
let arg1= argsIndex1[1];
|
||||||
|
console.log("current html arg1:",arg1);
|
||||||
|
if (arg == undefined ||arg1 == undefined) {
|
||||||
|
console.log("user uuid error!")
|
||||||
|
}else{
|
||||||
|
localStorage.setItem("online_user",arg);
|
||||||
|
localStorage.setItem("uuid",arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkUser();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,512 @@
|
||||||
|
var dscomponent = {
|
||||||
|
template:`
|
||||||
|
<div>
|
||||||
|
<div id="" style="display: flex">
|
||||||
|
<el-input v-model="p_id_v" placeholder="产品编码" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-input v-model="p_name_v" placeholder="产品名称" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="get_ds()">搜索</el-button>
|
||||||
|
<el-button plain type="primary" icon="el-icon-circle-plus-outline" @click="importCsv()">导入</el-button>
|
||||||
|
<el-button id ="bt_del" plain type="primary" icon="el-icon-circle-plus-outline" @click="del_ds()">删除</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<div class="span">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:height="tHeight"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="serial_num"
|
||||||
|
label="序列号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="file"
|
||||||
|
label="原始数据"
|
||||||
|
width="160"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button @click="down_files(scope.row)" type="text" size="small">{{scope.row.file}}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="archive_user"
|
||||||
|
label="归档人"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="archive_time"
|
||||||
|
label="归档日期"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
ref="upload"
|
||||||
|
action="/pkpi/upload_ds_file"
|
||||||
|
:on-change="handleChange_file"
|
||||||
|
:file-list="fileList"
|
||||||
|
:show-file-list="false"
|
||||||
|
:on-success="upload_file_success"
|
||||||
|
:on-error="upload_file_error"
|
||||||
|
:data="upload_param(scope.row)">
|
||||||
|
<el-button slot="trigger" size="medium" type="success" >上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<span class="demonstration"></span>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[50,100, 200, 300]"
|
||||||
|
:page-size="pagesize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="recordTotal">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="基础数据导入"
|
||||||
|
:visible.sync="importdialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
:before-close="importDialog_close"
|
||||||
|
width="30%">
|
||||||
|
<div style="display: flex;">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
:on-change="handleChange"
|
||||||
|
:file-list="fileListUpload"
|
||||||
|
:show-file-list="false"
|
||||||
|
accept=".csv"
|
||||||
|
:auto-upload="false">
|
||||||
|
<el-button id ="bt_upload" size="small" plain type="primary">点击上传(csv文件)</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<el-button id ="bt_import" size="small" plain type="primary" @click="importData" style="margin-left: 10px;">确认导入</el-button>
|
||||||
|
<!--<el-button id ="bt_download" size="small" plain type="primary" @click="download_template" style="margin-left: 10px;">下载导入模板文件</el-button>-->
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process1" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="importTableData"
|
||||||
|
style="font-size:13px;margin-top: 10px;width: 100%;"
|
||||||
|
:height="tHeight*0.5"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
stripe border>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="serial_num"
|
||||||
|
label="序列号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data(){
|
||||||
|
// 获取当前屏幕的分辨率
|
||||||
|
let screenW = window.screen.width;
|
||||||
|
let screenH = window.screen.height;
|
||||||
|
console.log("screen width:",screenW);
|
||||||
|
console.log("screen height:",screenH);
|
||||||
|
return {
|
||||||
|
tHeight:screenH*0.8,
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pagesize:50,
|
||||||
|
recordTotal:0,
|
||||||
|
p_id_v:'',
|
||||||
|
p_name_v:'',
|
||||||
|
|
||||||
|
dialogVisible:false,
|
||||||
|
oper_type:0,
|
||||||
|
multipleSelection: [],
|
||||||
|
importdialogVisible:false,
|
||||||
|
fileListUpload:[],
|
||||||
|
importTableData:[],
|
||||||
|
disabled:true,
|
||||||
|
|
||||||
|
if_show_process:false,
|
||||||
|
percent_len:0,
|
||||||
|
interval:'',
|
||||||
|
if_show_process1:false,
|
||||||
|
|
||||||
|
fileList:[],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/pkpi/get_ds', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: _this.$data.currentPage,
|
||||||
|
count: _this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
down_files(row){
|
||||||
|
var downUrl = '/pkpi/download_ds_file'+"?id="+row.file;
|
||||||
|
downloadUrl(row.file,downUrl);
|
||||||
|
},
|
||||||
|
upload_param(row){
|
||||||
|
console.log("---")
|
||||||
|
return {
|
||||||
|
id:row.id,
|
||||||
|
archive_user:localStorage.getItem("online_user")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
upload_file_error(response, file, fileList){
|
||||||
|
this.$message({
|
||||||
|
message: "上传失败",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
},
|
||||||
|
upload_file_success(response, file, fileList){
|
||||||
|
this.$message({
|
||||||
|
message: "上传成功",
|
||||||
|
type: "success",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
this.get_ds(this.$data.currentPage);
|
||||||
|
},
|
||||||
|
handleChange_file(file, fileList) {
|
||||||
|
console.log(file);
|
||||||
|
this.fileList = fileList.slice(-1);
|
||||||
|
},
|
||||||
|
input_change(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.get_ds();
|
||||||
|
},
|
||||||
|
importData(){
|
||||||
|
document.getElementById("bt_import").blur();
|
||||||
|
if(this.$data.importTableData.length==0){
|
||||||
|
this.$message({
|
||||||
|
message: "请选择导入文件",
|
||||||
|
type: "warning",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$confirm('是否确认导入?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
var _this = this;
|
||||||
|
_this.$data.percent_len=0;
|
||||||
|
_this.$data.if_show_process1=true;
|
||||||
|
_this.$data.interval= setInterval(()=>{
|
||||||
|
if(_this.$data.percent_len>=99){
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.percent_len<98){
|
||||||
|
_this.$data.percent_len+=2
|
||||||
|
}
|
||||||
|
},20)
|
||||||
|
|
||||||
|
axios.post('/pkpi/import_ds_file', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
data:this.$data.importTableData,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
let len = _this.$data.importTableData.length;
|
||||||
|
errType = "success"
|
||||||
|
s = "导入成功("+len+"条)";
|
||||||
|
_this.$data.percent_len=100;
|
||||||
|
_this.$data.if_show_process1=false;
|
||||||
|
} else if(r == 1) {
|
||||||
|
errType = "error"
|
||||||
|
s = "正在导入,请稍后!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
s = "导入失败!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(s);
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
|
||||||
|
_this.$data.importdialogVisible=false;
|
||||||
|
//更新页面
|
||||||
|
_this.get_ds();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleChange(file, fileList) {
|
||||||
|
document.getElementById("bt_upload").blur();
|
||||||
|
|
||||||
|
this.fileTemp = file.raw
|
||||||
|
console.log("filetype:",this.fileTemp);
|
||||||
|
if (this.fileTemp) {
|
||||||
|
console.log("begin ...")
|
||||||
|
console.log(this.fileTemp.type);
|
||||||
|
if ((this.fileTemp.type == 'text/csv') || (this.fileTemp.type == '.csv') || (this.fileTemp.type == 'application/vnd.ms-excel')) {
|
||||||
|
let _this = this//如果需要点击事件结束之后对DOM进行操作使用)_this.xx=xx进行操作
|
||||||
|
Papa.parse(_this.fileTemp, {
|
||||||
|
encoding:'gb2312',
|
||||||
|
complete (results) {
|
||||||
|
console.log(results)//这个是csv文件的数据
|
||||||
|
let data = []
|
||||||
|
//遍历csv文件中的数据,存放到data中 方法不唯一,可自己更改
|
||||||
|
for (let i = 0; i < results.data.length; ++i) {
|
||||||
|
if(i==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
obj.p_id = results.data[i][0]
|
||||||
|
if(obj.p_id==""|| obj.p_id==undefined){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
obj.p_name = results.data[i][1]
|
||||||
|
obj.serial_num = results.data[i][2]
|
||||||
|
data.push(obj)
|
||||||
|
}
|
||||||
|
//data.splice(0, 1)//将数组第一位的表格名称去除
|
||||||
|
console.log('data', data)
|
||||||
|
_this.$data.importTableData=data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '附件格式错误,请删除后重新上传!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '请上传附件!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
importCsv(){
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$data.importTableData=[];
|
||||||
|
this.$data.importdialogVisible=true;
|
||||||
|
},
|
||||||
|
importDialog_close(done){
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
console.log("已选择");
|
||||||
|
console.log(val);
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
|
||||||
|
del_ds(){
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
axios.post('/pkpi/del_ds', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
ids: _this.$data.multipleSelection,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
s = "删除成功!";
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
s = "删除失败!";
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
_this.get_ds();//更新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
get_ds(cur_page){
|
||||||
|
document.getElementById("bt_search").blur();
|
||||||
|
|
||||||
|
if (cur_page==undefined){
|
||||||
|
this.$data.currentPage=1;
|
||||||
|
} else {
|
||||||
|
this.$data.currentPage=cur_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/pkpi/get_ds', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.$data.pagesize = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/pkpi/get_ds', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$data.currentPage = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/pkpi/get_ds', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name: _this.$data.p_name_v,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
|
||||||
|
function exportToExcel(){
|
||||||
|
//要导出的json数据
|
||||||
|
const jsonData = [
|
||||||
|
{
|
||||||
|
name:'路人甲',
|
||||||
|
phone:'123456789',
|
||||||
|
email:'000@123456.com'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'炮灰乙',
|
||||||
|
phone:'123456789',
|
||||||
|
email:'000@123456.com'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'土匪丙',
|
||||||
|
phone:'123456789',
|
||||||
|
email:'000@123456.com'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name:'流氓丁',
|
||||||
|
phone:'123456789',
|
||||||
|
email:'000@123456.com'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
//列标题,逗号隔开,每一个逗号就是隔开一个单元格
|
||||||
|
let str = `姓名,电话,邮箱\n`;
|
||||||
|
//增加\t为了不让表格显示科学计数法或者其他格式
|
||||||
|
for(let i = 0 ; i < jsonData.length ; i++ ){
|
||||||
|
for(let item in jsonData[i]){
|
||||||
|
str+=`${jsonData[i][item] + '\t'},`;
|
||||||
|
}
|
||||||
|
str+='\n';
|
||||||
|
}
|
||||||
|
//encodeURIComponent解决中文乱码
|
||||||
|
let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
|
||||||
|
//通过创建a标签实现
|
||||||
|
let link = document.createElement("a");
|
||||||
|
link.href = uri;
|
||||||
|
//对下载的文件命名
|
||||||
|
link.download = "json数据表.csv";
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadUrl(filename, url) {
|
||||||
|
var element = document.createElement('a');
|
||||||
|
element.setAttribute('href', url);
|
||||||
|
element.setAttribute('download', filename);
|
||||||
|
|
||||||
|
element.style.display = 'none';
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
document.body.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DownloadContent(filename,content) {
|
||||||
|
var eleLink = document.createElement('a');
|
||||||
|
eleLink.download = filename;
|
||||||
|
eleLink.style.display = 'none';
|
||||||
|
// 字符内容转变成blob地址
|
||||||
|
var blob = new Blob([content]);
|
||||||
|
eleLink.href = URL.createObjectURL(blob);
|
||||||
|
// 触发点击
|
||||||
|
document.body.appendChild(eleLink);
|
||||||
|
eleLink.click();
|
||||||
|
// 然后移除
|
||||||
|
document.body.removeChild(eleLink);
|
||||||
|
};
|
||||||
|
|
||||||
|
function fakeClick(obj) {
|
||||||
|
var ev = document.createEvent("MouseEvents");
|
||||||
|
ev.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||||
|
obj.dispatchEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportRaw(name, data) {
|
||||||
|
var urlObject = window.URL || window.webkitURL || window;
|
||||||
|
var export_blob = new Blob([data]);
|
||||||
|
var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
||||||
|
save_link.href = urlObject.createObjectURL(export_blob);
|
||||||
|
save_link.download = name;
|
||||||
|
fakeClick(save_link);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
// 自适应表格列宽
|
||||||
|
function flexColumnWidth(str, tableData, flag = 'max') {
|
||||||
|
// str为该列的字段名(传字符串);tableData为该表格的数据源(传变量);
|
||||||
|
// flag为可选值,可不传该参数,传参时可选'max'或'equal',默认为'max'
|
||||||
|
// flag为'max'则设置列宽适配该列中最长的内容,flag为'equal'则设置列宽适配该列中第一行内容的长度。
|
||||||
|
str = str + ''
|
||||||
|
let columnContent = ''
|
||||||
|
if (!tableData || !tableData.length || tableData.length === 0 || tableData === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!str || !str.length || str.length === 0 || str === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (flag === 'equal') {
|
||||||
|
// 获取该列中第一个不为空的数据(内容)
|
||||||
|
for (let i = 0; i < tableData.length; i++) {
|
||||||
|
if (tableData[i][str].length > 0) {
|
||||||
|
// console.log('该列数据[0]:', tableData[0][str])
|
||||||
|
columnContent = tableData[i][str]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 获取该列中最长的数据(内容)
|
||||||
|
let index = 0
|
||||||
|
for (let i = 0; i < tableData.length; i++) {
|
||||||
|
if (tableData[i][str] === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const now_temp = tableData[i][str] + ''
|
||||||
|
const max_temp = tableData[index][str] + ''
|
||||||
|
if (now_temp.length > max_temp.length) {
|
||||||
|
index = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
columnContent = tableData[index][str]
|
||||||
|
}
|
||||||
|
// console.log('该列数据[i]:', columnContent)
|
||||||
|
// 以下分配的单位长度可根据实际需求进行调整
|
||||||
|
let flexWidth = 0
|
||||||
|
for (const char of columnContent) {
|
||||||
|
if ((char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z')) {
|
||||||
|
// 如果是英文字符,为字符分配8个单位宽度
|
||||||
|
flexWidth += 8
|
||||||
|
} else if (char >= '\u4e00' && char <= '\u9fa5') {
|
||||||
|
// 如果是中文字符,为字符分配15个单位宽度
|
||||||
|
flexWidth += 15
|
||||||
|
} else {
|
||||||
|
// 其他种类字符,为字符分配8个单位宽度
|
||||||
|
flexWidth += 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flexWidth < 80) {
|
||||||
|
// 设置最小宽度
|
||||||
|
flexWidth = 80
|
||||||
|
}
|
||||||
|
// if (flexWidth > 250) {
|
||||||
|
// // 设置最大宽度
|
||||||
|
// flexWidth = 250
|
||||||
|
// }
|
||||||
|
return flexWidth + 'px'
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1635489197628" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2642" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M620.8 704c0-32-12.8-57.6-38.4-83.2L556.8 601.6 556.8 563.2 556.8 473.6 467.2 454.4l0 108.8 0 38.4L441.6 620.8c-25.6 19.2-38.4 51.2-38.4 83.2 0 57.6 51.2 108.8 108.8 108.8S620.8 761.6 620.8 704z" p-id="2643" fill="#bfbfbf"></path><path d="M512 192c38.4 0 64 25.6 64 64l0 307.2 0 25.6 19.2 19.2C627.2 633.6 640 665.6 640 704c0 70.4-57.6 128-128 128s-128-57.6-128-128c0-38.4 12.8-70.4 44.8-96L448 588.8 448 563.2 448 256C448 217.6 473.6 192 512 192M512 128C441.6 128 384 185.6 384 256l0 307.2C345.6 595.2 320 646.4 320 704c0 108.8 83.2 192 192 192s192-83.2 192-192c0-57.6-25.6-108.8-64-140.8L640 256C640 185.6 582.4 128 512 128L512 128z" p-id="2644" fill="#bfbfbf"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
|
|
@ -0,0 +1,71 @@
|
||||||
|
function isUTF8(bytes) {
|
||||||
|
var i = 0;
|
||||||
|
while (i < bytes.length) {
|
||||||
|
if ((// ASCII
|
||||||
|
bytes[i] == 0x09 ||
|
||||||
|
bytes[i] == 0x0A ||
|
||||||
|
bytes[i] == 0x0D ||
|
||||||
|
(0x20 <= bytes[i] && bytes[i] <= 0x7E)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
i += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((// non-overlong 2-byte
|
||||||
|
(0xC2 <= bytes[i] && bytes[i] <= 0xDF) &&
|
||||||
|
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0xBF)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
i += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((// excluding overlongs
|
||||||
|
bytes[i] == 0xE0 &&
|
||||||
|
(0xA0 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF)
|
||||||
|
) ||
|
||||||
|
(// straight 3-byte
|
||||||
|
((0xE1 <= bytes[i] && bytes[i] <= 0xEC) ||
|
||||||
|
bytes[i] == 0xEE ||
|
||||||
|
bytes[i] == 0xEF) &&
|
||||||
|
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF)
|
||||||
|
) ||
|
||||||
|
(// excluding surrogates
|
||||||
|
bytes[i] == 0xED &&
|
||||||
|
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0x9F) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
i += 3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((// planes 1-3
|
||||||
|
bytes[i] == 0xF0 &&
|
||||||
|
(0x90 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
|
||||||
|
) ||
|
||||||
|
(// planes 4-15
|
||||||
|
(0xF1 <= bytes[i] && bytes[i] <= 0xF3) &&
|
||||||
|
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
|
||||||
|
) ||
|
||||||
|
(// plane 16
|
||||||
|
bytes[i] == 0xF4 &&
|
||||||
|
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0x8F) &&
|
||||||
|
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
|
||||||
|
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
i += 4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
function loginout(){
|
||||||
|
axios.post('/u_ma/loginOut', {
|
||||||
|
username: localStorage.getItem("online_user"),
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
if (response.status != 200 || response.data.r !=0) {
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: "用户退出失败!",
|
||||||
|
type: "error",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
location.href="login.html";
|
||||||
|
localStorage.setItem("online_user",'');
|
||||||
|
localStorage.setItem("uuid",'');
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,601 @@
|
||||||
|
var pfcomponent = {
|
||||||
|
template:`
|
||||||
|
<div>
|
||||||
|
<div id="" style="display: flex">
|
||||||
|
<el-input v-model="p_id_v" placeholder="产品编号" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-input v-model="p_name_v" placeholder="产品名称" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-input v-model="plan_name_v" placeholder="工序名称" clearable style="width: 160px;" @change="input_change"></el-input>
|
||||||
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="get_process()">搜索</el-button>
|
||||||
|
<el-button plain type="primary" icon="el-icon-circle-plus-outline" @click="importCsv()">导入</el-button>
|
||||||
|
<el-button id ="bt_export" plain type="primary" icon="el-icon-circle-plus-outline" @click="export_csv()">导出</el-button>
|
||||||
|
<el-button id ="bt_del" plain type="primary" icon="el-icon-circle-plus-outline" @click="del_p()">删除</el-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<div class="span">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:height="tHeight"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="process_name"
|
||||||
|
label="工序"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="process_t"
|
||||||
|
label="工时"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button @click="update_process(scope.row)" type="text" size="medium" >修改</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<span class="demonstration"></span>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[50,100, 200, 300]"
|
||||||
|
:page-size="pagesize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="recordTotal">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="工序信息"
|
||||||
|
:visible.sync="update_visible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
width="40%"
|
||||||
|
style="height: 100%;">
|
||||||
|
<el-form ref="form_p" :model="form" label-width="80px" :rules="rules">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="产品编号" prop="p_id">
|
||||||
|
<el-input v-model="form.p_id" :disabled="disabled"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="产品名称" prop="p_id">
|
||||||
|
<el-input v-model="form.p_name" :disabled="disabled"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="工序" prop="process_name">
|
||||||
|
<el-input v-model="form.process_name" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="工时" prop="process_t">
|
||||||
|
<el-input v-model="form.process_t" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="update_visible = false">取 消</el-button>
|
||||||
|
<el-button id ="bt_ok" plain type="primary" @click="post_process()">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="基础数据导入"
|
||||||
|
:visible.sync="importdialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
:before-close="importDialog_close"
|
||||||
|
width="40%">
|
||||||
|
<div style="display: flex;">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
:on-change="handleChange"
|
||||||
|
:file-list="fileListUpload"
|
||||||
|
:show-file-list="false"
|
||||||
|
accept=".csv"
|
||||||
|
:auto-upload="false">
|
||||||
|
<el-button id ="bt_upload" size="small" plain type="primary">点击上传(csv文件)</el-button>
|
||||||
|
</el-upload>
|
||||||
|
<el-button id ="bt_import" size="small" plain type="primary" @click="importData" style="margin-left: 10px;">确认导入</el-button>
|
||||||
|
<!--<el-button id ="bt_download" size="small" plain type="primary" @click="download_template" style="margin-left: 10px;">下载导入模板文件</el-button>-->
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-progress v-if="if_show_process1" :percentage="percent_len" ></el-progress>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="importTableData"
|
||||||
|
style="font-size:13px;margin-top: 10px;width: 100%;"
|
||||||
|
:height="tHeight*0.5"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
stripe border>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="p_id"
|
||||||
|
label="产品编号"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="p_name"
|
||||||
|
label="产品名称"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="process_name"
|
||||||
|
label="工序"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="process_t"
|
||||||
|
label="工时"
|
||||||
|
width="120"
|
||||||
|
:show-overflow-tooltip="true">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data(){
|
||||||
|
// 获取当前屏幕的分辨率
|
||||||
|
let screenW = window.screen.width;
|
||||||
|
let screenH = window.screen.height;
|
||||||
|
console.log("screen width:",screenW);
|
||||||
|
console.log("screen height:",screenH);
|
||||||
|
return {
|
||||||
|
tHeight:screenH*0.8,
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pagesize:50,
|
||||||
|
recordTotal:0,
|
||||||
|
p_id_v:'',
|
||||||
|
p_name_v:'',
|
||||||
|
plan_name_v:'',
|
||||||
|
dialogVisible:false,
|
||||||
|
multipleSelection: [],
|
||||||
|
importdialogVisible:false,
|
||||||
|
fileListUpload:[],
|
||||||
|
importTableData:[],
|
||||||
|
disabled:true,
|
||||||
|
|
||||||
|
if_show_process:false,
|
||||||
|
percent_len:0,
|
||||||
|
interval:'',
|
||||||
|
if_show_process1:false,
|
||||||
|
|
||||||
|
fileList:[],
|
||||||
|
|
||||||
|
update_visible:false,
|
||||||
|
form: {
|
||||||
|
id:'',
|
||||||
|
p_id: '',
|
||||||
|
p_name:'',
|
||||||
|
process_name:'',
|
||||||
|
process_t:'',
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
p_id: [
|
||||||
|
{ required: true, message: '产品编号不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
process_name: [
|
||||||
|
{ required: true, message: '工序不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
process_t: [
|
||||||
|
{ required: true, message: '工时不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_process', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name:_this.$data.p_name_v,
|
||||||
|
process_name: _this.$data.plan_name_v,
|
||||||
|
index: _this.$data.currentPage,
|
||||||
|
count: _this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
export_csv(){
|
||||||
|
document.getElementById("bt_export").blur();
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/export_base_processes', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name:_this.$data.p_name_v,
|
||||||
|
process_name: _this.$data.plan_name_v,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
var date = new Date();
|
||||||
|
//年 getFullYear():四位数字返回年份
|
||||||
|
var year = date.getFullYear()%2000; //getFullYear()代替getYear()
|
||||||
|
console.log(year.toString());
|
||||||
|
//月 getMonth():0 ~ 11
|
||||||
|
var month = date.getMonth() + 1;
|
||||||
|
if(month<10){
|
||||||
|
month='0'+month
|
||||||
|
}
|
||||||
|
//日 getDate():(1 ~ 31)
|
||||||
|
var day = date.getDate();
|
||||||
|
if(day<10){
|
||||||
|
day='0'+day;
|
||||||
|
}
|
||||||
|
//时 getHours():(0 ~ 23)
|
||||||
|
var hour = date.getHours();
|
||||||
|
if (hour<10){
|
||||||
|
hour='0'+hour;
|
||||||
|
}
|
||||||
|
//分 getMinutes(): (0 ~ 59)
|
||||||
|
var minute = date.getMinutes();
|
||||||
|
if (minute<10){
|
||||||
|
minute='0'+minute;
|
||||||
|
}
|
||||||
|
//秒 getSeconds():(0 ~ 59)
|
||||||
|
var second = date.getSeconds();
|
||||||
|
if (second<10){
|
||||||
|
second='0'+second;
|
||||||
|
}
|
||||||
|
|
||||||
|
var filename=year.toString()+month.toString()+day.toString() +" " + hour.toString()+minute.toString()+second.toString();
|
||||||
|
filename = "工序工时 "+filename+".xlsx"
|
||||||
|
console.log(response.data);
|
||||||
|
var fileid = response.data.fileId;
|
||||||
|
|
||||||
|
var downUrl = '/u_ma/download_file'+"?id="+fileid;
|
||||||
|
downloadUrl(filename,downUrl);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
post_process(){
|
||||||
|
this.$refs['form_p'].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$data.update_visible = false;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
console.log(_this.$data.form);
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/update_process', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
data:{
|
||||||
|
id: _this.$data.form.id,
|
||||||
|
p_id: _this.$data.form.p_id,
|
||||||
|
p_name: _this.$data.form.p_name,
|
||||||
|
process_name: _this.$data.form.process_name,
|
||||||
|
process_t: _this.$data.form.process_t,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "修改成功!";
|
||||||
|
} else{
|
||||||
|
s = "修改失败!";
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
//更新页面
|
||||||
|
_this.get_process();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
update_process(row){
|
||||||
|
this.$data.form = {
|
||||||
|
id:row.id,
|
||||||
|
p_id: row.p_id,
|
||||||
|
p_name:row.p_name,
|
||||||
|
process_name:row.process_name,
|
||||||
|
process_t:row.process_t
|
||||||
|
};
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['form_p'].clearValidate()
|
||||||
|
});
|
||||||
|
this.$data.update_visible = true;
|
||||||
|
},
|
||||||
|
input_change(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.get_process();
|
||||||
|
},
|
||||||
|
importData(){
|
||||||
|
document.getElementById("bt_import").blur();
|
||||||
|
if(this.$data.importTableData.length==0){
|
||||||
|
this.$message({
|
||||||
|
message: "请选择导入文件",
|
||||||
|
type: "warning",
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$confirm('是否确认导入?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
var _this = this;
|
||||||
|
_this.$data.percent_len=0;
|
||||||
|
_this.$data.if_show_process1=true;
|
||||||
|
_this.$data.interval= setInterval(()=>{
|
||||||
|
if(_this.$data.percent_len>=99){
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.percent_len<98){
|
||||||
|
_this.$data.percent_len+=2
|
||||||
|
}
|
||||||
|
},20)
|
||||||
|
|
||||||
|
axios.post('/u_ma/import_process', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
data:this.$data.importTableData,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
let len = _this.$data.importTableData.length;
|
||||||
|
errType = "success"
|
||||||
|
s = "导入成功("+len+"条)";
|
||||||
|
_this.$data.percent_len=100;
|
||||||
|
_this.$data.if_show_process1=false;
|
||||||
|
} else if(r == 1) {
|
||||||
|
errType = "error"
|
||||||
|
s = "正在导入,请稍后!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
s = "导入失败!";
|
||||||
|
clearInterval(_this.$data.interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(s);
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
|
||||||
|
_this.$data.importdialogVisible=false;
|
||||||
|
//更新页面
|
||||||
|
_this.get_process();
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleChange(file, fileList) {
|
||||||
|
document.getElementById("bt_upload").blur();
|
||||||
|
|
||||||
|
this.fileTemp = file.raw
|
||||||
|
console.log("filetype:",this.fileTemp);
|
||||||
|
if (this.fileTemp) {
|
||||||
|
console.log("begin ...")
|
||||||
|
console.log(this.fileTemp.type);
|
||||||
|
if ((this.fileTemp.type == 'text/csv') || (this.fileTemp.type == '.csv') || (this.fileTemp.type == 'application/vnd.ms-excel')) {
|
||||||
|
let _this = this//如果需要点击事件结束之后对DOM进行操作使用)_this.xx=xx进行操作
|
||||||
|
Papa.parse(_this.fileTemp, {
|
||||||
|
encoding:'gb2312',
|
||||||
|
complete (results) {
|
||||||
|
console.log(results)//这个是csv文件的数据
|
||||||
|
let data = []
|
||||||
|
//遍历csv文件中的数据,存放到data中 方法不唯一,可自己更改
|
||||||
|
for (let i = 0; i < results.data.length; ++i) {
|
||||||
|
if(i==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
obj.p_id = results.data[i][0]
|
||||||
|
if(obj.p_id==""|| obj.p_id==undefined){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
obj.p_name = results.data[i][1]
|
||||||
|
obj.process_name = results.data[i][2]
|
||||||
|
obj.process_t = results.data[i][3]
|
||||||
|
data.push(obj)
|
||||||
|
}
|
||||||
|
//data.splice(0, 1)//将数组第一位的表格名称去除
|
||||||
|
console.log('data', data)
|
||||||
|
_this.$data.importTableData=data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '附件格式错误,请删除后重新上传!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '请上传附件!'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
importCsv(){
|
||||||
|
this.$data.fileListUpload=[];
|
||||||
|
this.$data.importTableData=[];
|
||||||
|
this.$data.importdialogVisible=true;
|
||||||
|
},
|
||||||
|
importDialog_close(done){
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
console.log("已选择");
|
||||||
|
console.log(val);
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
|
||||||
|
del_p(){
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
axios.post('/u_ma/del_process', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
ids: _this.$data.multipleSelection,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
s = "删除成功!";
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
s = "删除失败!";
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
_this.get_process();//更新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
get_process(){
|
||||||
|
document.getElementById("bt_search").blur();
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_process', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
p_id: _this.$data.p_id_v,
|
||||||
|
p_name:_this.$data.p_name_v,
|
||||||
|
process_name: _this.$data.plan_name_v,
|
||||||
|
index: _this.$data.currentPage,
|
||||||
|
count: _this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.$data.pagesize = val;
|
||||||
|
|
||||||
|
this.get_process();
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$data.currentPage = val;
|
||||||
|
|
||||||
|
this.get_process();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 779 KiB |
|
After Width: | Height: | Size: 5.0 MiB |
|
After Width: | Height: | Size: 40 KiB |
|
|
@ -0,0 +1,271 @@
|
||||||
|
//组件
|
||||||
|
var rsmcomponent = {
|
||||||
|
template:`
|
||||||
|
<div>
|
||||||
|
<div id="" style="display: inline-block;width: 100%;">
|
||||||
|
|
||||||
|
<div style="float: left; width: 20%;">
|
||||||
|
<el-input v-model="input" placeholder="请输入维修状态" clearable @change="input_change"></el-input>
|
||||||
|
</div>
|
||||||
|
<div style="float: left;">
|
||||||
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="get_rs(input)">搜索</el-button>
|
||||||
|
<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="addRs()">新增</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="span">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:height="tHeight"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="rs"
|
||||||
|
label="维修状态"
|
||||||
|
width="160">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button @click="updateRs(scope.row)" type="text" size="medium" >修改</el-button>
|
||||||
|
<el-button @click="delRs(scope.row)" type="text" size="medium" >删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="用户信息"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
width="30%">
|
||||||
|
<el-form ref="userform" :model="form" label-width="80px" :rules="rules">
|
||||||
|
<el-form-item label="维修状态" prop="rs">
|
||||||
|
<el-input v-model="form.rs"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button id ="bt_ok" plain type="primary" @click="postRs()">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data(){
|
||||||
|
// 获取当前屏幕的分辨率
|
||||||
|
let screenW = window.screen.width;
|
||||||
|
let screenH = window.screen.height;
|
||||||
|
console.log("screen width:",screenW);
|
||||||
|
console.log("screen height:",screenH);
|
||||||
|
return {
|
||||||
|
tHeight:screenH*0.8,
|
||||||
|
tableData: [],
|
||||||
|
input:'',
|
||||||
|
currentPage: 1,
|
||||||
|
pagesize:50,
|
||||||
|
recordTotal:0,
|
||||||
|
form: {
|
||||||
|
id:0,
|
||||||
|
rs: '',
|
||||||
|
},
|
||||||
|
dialogVisible:false,
|
||||||
|
oper_type:0,
|
||||||
|
rules: {
|
||||||
|
rs: [
|
||||||
|
{ required: true, message: '维修状态不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_rs', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
state: '',
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
input_change(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.get_rs(this.$data.input);
|
||||||
|
},
|
||||||
|
|
||||||
|
postRs(){
|
||||||
|
this.$refs['userform'].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$data.dialogVisible = false;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
console.log(_this.$data.form);
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/postRs', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: _this.$data.form.id,
|
||||||
|
rs:_this.$data.form.rs,
|
||||||
|
oper_type: _this.$data.oper_type,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.oper_type == 1) {
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "新增成功!";
|
||||||
|
} else if(r == 1) {
|
||||||
|
s = "已存在相同维修状态!";
|
||||||
|
}else{
|
||||||
|
s = "新增失败!";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (_this.$data.oper_type ==2){
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "修改成功!";
|
||||||
|
} else{
|
||||||
|
s = "修改失败!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
//更新页面
|
||||||
|
_this.get_rs(_this.$data.input);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
delRs(info){
|
||||||
|
this.$data.oper_type = 3;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/postRs', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: info.id,
|
||||||
|
oper_type: _this.$data.oper_type,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
s = "删除成功!";
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
s = "删除失败!";
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
_this.get_rs("");//更新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
addRs(){
|
||||||
|
document.getElementById("bt_add").blur();
|
||||||
|
|
||||||
|
this.$data.oper_type = 1;
|
||||||
|
this.$data.form = {
|
||||||
|
id: 0,
|
||||||
|
rs: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['userform'].clearValidate()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateRs(info){
|
||||||
|
this.$data.oper_type = 2;
|
||||||
|
this.$data.form = {
|
||||||
|
id: info.id,
|
||||||
|
rs: info.rs,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['userform'].clearValidate()
|
||||||
|
});
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
get_rs(_search_name){
|
||||||
|
document.getElementById("bt_search").blur();
|
||||||
|
|
||||||
|
this.$data.currentPage=1;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/get_rs', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
state: _search_name,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,442 @@
|
||||||
|
//组件
|
||||||
|
var Usercomponent = {
|
||||||
|
template:`
|
||||||
|
<div>
|
||||||
|
<div id="" style="display: inline-block;width: 100%;">
|
||||||
|
|
||||||
|
<div style="float: left; width: 20%;">
|
||||||
|
<el-input v-model="input" placeholder="请输入用户" clearable @change="input_change"></el-input>
|
||||||
|
</div>
|
||||||
|
<div style="float: left;">
|
||||||
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="getUser(input)">搜索</el-button>
|
||||||
|
<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="addUser()">新增</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="span">
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:height="tHeight"
|
||||||
|
:cell-style="{background:'#fff'}"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="username"
|
||||||
|
label="用户名"
|
||||||
|
width="100">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="rolename"
|
||||||
|
label="角色"
|
||||||
|
width="120">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="location"
|
||||||
|
label="位置"
|
||||||
|
width="120">
|
||||||
|
</el-table-column>
|
||||||
|
<!--<el-table-column
|
||||||
|
prop="department"
|
||||||
|
label="部门"
|
||||||
|
width="120">
|
||||||
|
</el-table-column>-->
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!--style="height:23px;padding:0px" -->
|
||||||
|
<el-button @click="updateUser(scope.row)" type="text" size="medium" >修改</el-button>
|
||||||
|
<el-button @click="delUser(scope.row)" type="text" size="medium" >删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<span class="demonstration"></span>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page="currentPage"
|
||||||
|
:page-sizes="[50,100, 200, 300]"
|
||||||
|
:page-size="pagesize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="recordTotal">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="用户信息"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:lock-scroll ="false"
|
||||||
|
width="30%">
|
||||||
|
<el-form ref="userform" :model="form" label-width="80px" :rules="rules">
|
||||||
|
<el-form-item label="用户名" prop="username">
|
||||||
|
<el-input v-model="form.username"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" prop="password">
|
||||||
|
<el-input v-model="form.password" show-password></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<!--
|
||||||
|
<el-form-item label="部门" prop="department">
|
||||||
|
<el-select v-model="form.department" placeholder="请选择部门">
|
||||||
|
<el-option-group
|
||||||
|
key="1"
|
||||||
|
label="">
|
||||||
|
<el-option label="生产" value="生产"></el-option>
|
||||||
|
<el-option label="质检" value="质检"></el-option>
|
||||||
|
<el-option label="供应链" value="供应链"></el-option>
|
||||||
|
<el-option label="交付" value="交付"></el-option>
|
||||||
|
<el-option label="研发" value="研发"></el-option>
|
||||||
|
<el-option label="保温瓶" value="保温瓶"></el-option>
|
||||||
|
<el-option label="技术" value="技术"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
-->
|
||||||
|
<el-form-item label="角色" prop="role">
|
||||||
|
<el-select v-model="form.role" placeholder="请选择职位">
|
||||||
|
<el-option-group
|
||||||
|
key="1"
|
||||||
|
label="">
|
||||||
|
<el-option label="普通用户" value="普通用户"></el-option>
|
||||||
|
<el-option label="管理员" value="管理员"></el-option>
|
||||||
|
<el-option label="浏览账号" value="浏览账号"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="位置" prop="role">
|
||||||
|
<el-select v-model="form.location" placeholder="请选择职位">
|
||||||
|
<el-option-group
|
||||||
|
key="1"
|
||||||
|
label="">
|
||||||
|
<el-option label="睿控维保" value="睿控维保"></el-option>
|
||||||
|
<el-option label="现场维保" value="现场维保"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!--<el-form-item label="状态" prop="state" >
|
||||||
|
<el-select v-model="form.state" placeholder="请选择" :disabled="state_dis">
|
||||||
|
<el-option-group
|
||||||
|
key="1"
|
||||||
|
label="">
|
||||||
|
<el-option label="状态1" value="状态1"></el-option>
|
||||||
|
<el-option label="状态2" value="状态2"></el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>-->
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button id ="bt_ok" plain type="primary" @click="postUser()">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data(){
|
||||||
|
// 获取当前屏幕的分辨率
|
||||||
|
let screenW = window.screen.width;
|
||||||
|
let screenH = window.screen.height;
|
||||||
|
console.log("screen width:",screenW);
|
||||||
|
console.log("screen height:",screenH);
|
||||||
|
return {
|
||||||
|
tHeight:screenH*0.8,
|
||||||
|
tableData: [],
|
||||||
|
input:'',
|
||||||
|
currentPage: 1,
|
||||||
|
pagesize:50,
|
||||||
|
recordTotal:0,
|
||||||
|
form: {
|
||||||
|
id:'',
|
||||||
|
username: '',
|
||||||
|
password:'',
|
||||||
|
role: '',
|
||||||
|
department:'',
|
||||||
|
state:'',
|
||||||
|
location:'',
|
||||||
|
},
|
||||||
|
dialogVisible:false,
|
||||||
|
oper_type:0,
|
||||||
|
rules: {
|
||||||
|
username: [
|
||||||
|
{ required: true, message: '用户不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{ required: true, message: '密码不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
role: [
|
||||||
|
{ required: true, message: '用户角色不可为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
state: [
|
||||||
|
{ required: true, message: '用户状态不可为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
state_dis:false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/getUsers', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: '',
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
input_change(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.getUser(this.$data.input);
|
||||||
|
},
|
||||||
|
|
||||||
|
postUser(){
|
||||||
|
this.$refs['userform'].validate((valid) => {
|
||||||
|
if(valid){
|
||||||
|
this.$data.dialogVisible = false;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
console.log(_this.$data.form);
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/postUser', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: _this.$data.form.id,
|
||||||
|
username:_this.$data.form.username,
|
||||||
|
password: _this.$data.form.password,
|
||||||
|
role: _this.$data.form.role,
|
||||||
|
department:_this.$data.form.department,
|
||||||
|
oper_type: _this.$data.oper_type,
|
||||||
|
state:_this.$data.form.state,
|
||||||
|
location:_this.$data.form.location,
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this.$data.oper_type == 1) {
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "新增用户成功!";
|
||||||
|
} else if(r == 1) {
|
||||||
|
s = "已存在相同用户名!";
|
||||||
|
}else{
|
||||||
|
s = "新增用户失败!";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (_this.$data.oper_type ==2){
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
s = "修改用户成功!";
|
||||||
|
} else{
|
||||||
|
s = "修改用户失败!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
//更新页面
|
||||||
|
_this.getUser(_this.$data.input);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
delUser(userinfo){
|
||||||
|
this.$data.oper_type = 3;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/postUser', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: userinfo.userid,
|
||||||
|
username:userinfo.username,
|
||||||
|
password: userinfo.password,
|
||||||
|
role: userinfo.rolename,
|
||||||
|
department:userinfo.user_department,
|
||||||
|
oper_type: _this.$data.oper_type
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
|
||||||
|
let r = response.data.r;
|
||||||
|
let s = ""
|
||||||
|
let errType = ""
|
||||||
|
if (r == 0) {
|
||||||
|
s = "删除用户成功!";
|
||||||
|
errType = "success"
|
||||||
|
} else{
|
||||||
|
s = "删除用户失败!";
|
||||||
|
errType = "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.$message({
|
||||||
|
message: s,
|
||||||
|
type: errType,
|
||||||
|
duration: 1500
|
||||||
|
});
|
||||||
|
|
||||||
|
if (r ==0) {
|
||||||
|
_this.getUser("");//更新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
addUser(){
|
||||||
|
document.getElementById("bt_add").blur();
|
||||||
|
|
||||||
|
this.$data.oper_type = 1;
|
||||||
|
this.$data.form = {
|
||||||
|
id:'',
|
||||||
|
username: '',
|
||||||
|
password:'',
|
||||||
|
role: '',
|
||||||
|
department:'',
|
||||||
|
state:'状态1',
|
||||||
|
location:'睿控维保'
|
||||||
|
};
|
||||||
|
this.$data.state_dis=true;
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['userform'].clearValidate()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateUser(userinfo){
|
||||||
|
this.$data.oper_type = 2;
|
||||||
|
this.$data.form = {
|
||||||
|
id:userinfo.userid,
|
||||||
|
username: userinfo.username,
|
||||||
|
password:userinfo.password,
|
||||||
|
role: userinfo.rolename,
|
||||||
|
department:userinfo.department,
|
||||||
|
state:userinfo.state,
|
||||||
|
location:userinfo.location,
|
||||||
|
};
|
||||||
|
this.$data.state_dis=false;
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['userform'].clearValidate()
|
||||||
|
});
|
||||||
|
this.$data.dialogVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
getUser(_search_name){
|
||||||
|
document.getElementById("bt_search").blur();
|
||||||
|
|
||||||
|
this.$data.currentPage=1;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/getUsers', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: _search_name,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.$data.pagesize = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/getUsers', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: this.$data.input,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$data.currentPage = val;
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
var objs;
|
||||||
|
axios.post('/u_ma/getUsers', {
|
||||||
|
opuser:localStorage.getItem("online_user"),
|
||||||
|
opuser_uuid:localStorage.getItem("uuid"),
|
||||||
|
id: this.$data.input,
|
||||||
|
index: this.$data.currentPage,
|
||||||
|
count: this.$data.pagesize
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
objs = response.data.data;
|
||||||
|
rcnt = response.data.total;
|
||||||
|
_this.$data.tableData = objs;
|
||||||
|
_this.$data.recordTotal = rcnt;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||