| | |
| | | <script> |
| | | export default { |
| | | name: 'BaseOpera', |
| | | data () { |
| | | return { |
| | | title: '', |
| | |
| | | } |
| | | } |
| | | }, |
| | | // watch: { |
| | | // visible() { |
| | | // console.log(this.visible); |
| | | // } |
| | | // }, |
| | | watch: { |
| | | $route (to, from) { |
| | | this.close() |
| | | } |
| | | }, |
| | | methods: { |
| | | // 配置 |
| | | config (extParams = {}) { |
| | |
| | | if (extParams.api == null) { |
| | | throw new Error('Missing config option \'api\'.') |
| | | } |
| | | this.api = require('@/api' + extParams.api) |
| | | if(extParams.api.indexOf('@/',0) === 0){ |
| | | this.api = require(extParams.api) |
| | | }else { |
| | | this.api = require('@/api' + extParams.api) |
| | | } |
| | | extParams['field.id'] && (this.configData['field.id'] = extParams['field.id']) |
| | | }, |
| | | /** |
| | |
| | | } |
| | | }) |
| | | }, |
| | | close () { |
| | | this.visible = false |
| | | }, |
| | | // 确认新建/修改 |
| | | confirm () { |
| | | if (this.form.id == null || this.form.id === '') { |
| | |
| | | // 确认新建 |
| | | __confirmCreate () { |
| | | this.$refs.form.validate((valid) => { |
| | | // debugger |
| | | if (!valid) { |
| | | return |
| | | } |
| | | // console.log(this.form); |
| | | // debugger |
| | | // 调用新建接口 |
| | | this.isWorking = true |
| | | this.api.create(this.form) |
| | |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | // this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | // this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |