2019-10-17 13:54:41 +08:00
|
|
|
<template>
|
2019-10-31 13:56:42 +08:00
|
|
|
<div>
|
|
|
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
|
|
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
|
|
|
|
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
|
|
|
</span>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
2019-10-17 13:54:41 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-10-31 13:56:42 +08:00
|
|
|
export default {
|
|
|
|
name: 'ScriptOperate',
|
|
|
|
props: {
|
2019-11-01 15:19:15 +08:00
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default() {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
2019-10-31 13:56:42 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogVisible: false,
|
|
|
|
formModel:{
|
|
|
|
scriptName:'',
|
|
|
|
id:''
|
|
|
|
},
|
|
|
|
isShow: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
form() {
|
|
|
|
const form = {
|
|
|
|
labelWidth: '150px',
|
|
|
|
items: [
|
|
|
|
{ prop: 'scriptName', label: this.$t('approval.scriptName'), type: 'text', required: true}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
return form;
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
2019-10-31 13:56:42 +08:00
|
|
|
rules() {
|
|
|
|
const crules = {
|
|
|
|
scriptName: [
|
|
|
|
{ required: true, message: this.$t('approval.inputScriptName'), trigger: 'blur' }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
return crules;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
doShow(row) {
|
|
|
|
this.formModel.scriptName = row.name;
|
|
|
|
this.formModel.id = row.id;
|
|
|
|
this.dialogVisible = true;
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
2019-10-31 13:56:42 +08:00
|
|
|
doCreate() {
|
|
|
|
const self = this;
|
|
|
|
this.$refs.dataform.validateForm(() => {
|
|
|
|
self.$emit('create', Object.assign({}, this.formModel));
|
|
|
|
self.doClose();
|
|
|
|
});
|
2019-10-17 13:54:41 +08:00
|
|
|
},
|
2019-10-31 13:56:42 +08:00
|
|
|
doClose() {
|
|
|
|
this.$refs.dataform.resetForm();
|
|
|
|
this.isShow = false;
|
|
|
|
this.dialogVisible = false;
|
2019-10-17 13:54:41 +08:00
|
|
|
}
|
2019-10-31 13:56:42 +08:00
|
|
|
}
|
|
|
|
};
|
2019-10-17 13:54:41 +08:00
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
/deep/ .el-dialog--center .el-dialog__body{
|
|
|
|
padding: 15px 65px 10px 10px;
|
|
|
|
}
|
|
|
|
</style>
|