feat: 引入eslint

This commit is contained in:
chenjinsong
2021-03-19 18:52:19 +08:00
parent ca31480b84
commit 337ee9a938
159 changed files with 47146 additions and 47387 deletions

View File

@@ -128,177 +128,176 @@
</template>
<script>
export default {
name:"alertLabel",
props:{
id:{},
type:{},
//labelLoading:{},
that:{},
LRTriangle:{}
},
watch:{
// labelLoading: {
// immediate: true,
// handler(n) {
// if(this.type==='asset'){
// this.$get('/asset/info?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.Basic;
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// if(this.type==='project'){
// this.$get('/project/info?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.basic;
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// if(this.type==='module'){
// this.$get('/module?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.list[0];
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// }
// }
id:{
immediate: true,
deep:true,
handler(n){
this.init()
}
},
that:{
immediate: true,
deep:true,
handler(n){
}
},
LRTriangle:{
immediate: true,
deep:true,
handler(n){
}
export default {
name: 'alertLabel',
props: {
id: {},
type: {},
// labelLoading:{},
that: {},
LRTriangle: {}
},
watch: {
// labelLoading: {
// immediate: true,
// handler(n) {
// if(this.type==='asset'){
// this.$get('/asset/info?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.Basic;
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// if(this.type==='project'){
// this.$get('/project/info?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.basic;
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// if(this.type==='module'){
// this.$get('/module?id='+this.id).then((res)=>{
// if(res.msg==='success'){
// this.loading=false;
// this.alertLabelData=res.data.list[0];
// } else{
// this.$message.error(res.msg);
// }
// })
// }
// }
// }
id: {
immediate: true,
deep: true,
handler (n) {
this.init()
}
},
data() {
return {
alertLabelData:null,
loading: true
that: {
immediate: true,
deep: true,
handler (n) {
}
},
components:{
LRTriangle: {
immediate: true,
deep: true,
handler (n) {
},
computed: {
calcPosition() {
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=self.type==='asset'?318:(self.type==='project'?70:70);
if(position.top+elHeight>clientHeight){
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top -elHeight- 20}px`,
}
}else{
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - 20}px`,
}
}
}
},
calcHeight(){
let self=this;
return function(position) {
let clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
let elHeight=self.type==='asset'?318:(self.type==='project'?70:70);
if(position.top+elHeight>clientHeight){
return 'alert-labelUp'
}else{
return 'alert-label'
}
}
}
},
methods:{
init(){
this.loading=true;
if(this.type==='asset'){
this.$get('/asset/info?id='+this.id).then((res)=>{
if(res.msg==='success'){
this.loading=false;
this.alertLabelData=res.data.Basic;
} else{
this.$message.error(res.msg);
}
})
}
if(this.type==='project'){
this.$get('/project?id='+this.id).then((res)=>{
if(res.msg==='success'){
this.loading=false;
this.alertLabelData=res.data.list[0];
} else{
this.$message.error(res.msg);
}
})
}
if(this.type==='module'){
this.$get('/module?id='+this.id).then((res)=>{
if(res.msg==='success'){
this.loading=false;
this.alertLabelData=res.data.list[0];
} else{
this.$message.error(res.msg);
}
})
}
if(this.type==='endpoint'){
this.$get('/endpoint?id='+this.id).then((res)=>{
if(res.msg==='success'){
this.loading=false;
this.alertLabelData=res.data.list[0];
} else{
this.$message.error(res.msg);
}
})
}
},
alertActiveStr(){
return this.$t('overall.active');
},
alertStateStr(num){
if( num == 1){
return this.$t('asset.inStock')
} else {
return this.$t('asset.notInStock')
}
},
},
mounted(){
},
beforeDestroy(){
}
},
data () {
return {
alertLabelData: null,
loading: true
}
},
components: {
},
computed: {
calcPosition () {
const self = this
return function (position) {
const clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
const elHeight = self.type === 'asset' ? 318 : (self.type === 'project' ? 70 : 70)
if (position.top + elHeight > clientHeight) {
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - elHeight - 20}px`
}
} else {
return {
left: `${position.left + position.width + 20}px`,
top: `${position.top - 20}px`
}
}
}
},
calcHeight () {
const self = this
return function (position) {
const clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
const elHeight = self.type === 'asset' ? 318 : (self.type === 'project' ? 70 : 70)
if (position.top + elHeight > clientHeight) {
return 'alert-labelUp'
} else {
return 'alert-label'
}
}
}
},
methods: {
init () {
this.loading = true
if (this.type === 'asset') {
this.$get('/asset/info?id=' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.Basic
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'project') {
this.$get('/project?id=' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'module') {
this.$get('/module?id=' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'endpoint') {
this.$get('/endpoint?id=' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
} else {
this.$message.error(res.msg)
}
})
}
},
alertActiveStr () {
return this.$t('overall.active')
},
alertStateStr (num) {
if (num == 1) {
return this.$t('asset.inStock')
} else {
return this.$t('asset.notInStock')
}
}
},
mounted () {
},
beforeDestroy () {
}
}
</script>