|
@@ -132,6 +132,7 @@
|
|
|
import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
|
|
|
import { validateDuplicateValue } from '@/utils/util'
|
|
|
import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
|
|
|
+ import { httpAction, getAction } from '@/api/manage'
|
|
|
|
|
|
export default {
|
|
|
name: 'EnergyRateForm',
|
|
@@ -278,7 +279,6 @@
|
|
|
//根据字典Code, 初始化字典数组
|
|
|
ajaxGetDictItems(this.dictCode, null).then((res) => {
|
|
|
if (res.success) {
|
|
|
-// console.log(res.result);
|
|
|
this.typeOptions = res.result;
|
|
|
}
|
|
|
})
|
|
@@ -293,6 +293,14 @@
|
|
|
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
|
|
return Promise.all(values)
|
|
|
},
|
|
|
+ // 修改
|
|
|
+ edit (record) {
|
|
|
+ getAction(this.url.baseEnergyRateDetail.list, {id:record.id}).then((res) => {
|
|
|
+ console.log(77777,res)
|
|
|
+ })
|
|
|
+ // this.model = Object.assign({}, record);
|
|
|
+ // this.visible = true;
|
|
|
+ },
|
|
|
/** 调用完edit()方法之后会自动调用此方法 */
|
|
|
editAfter() {
|
|
|
this.$nextTick(() => {
|
|
@@ -477,32 +485,30 @@
|
|
|
this.model.data = newData
|
|
|
},
|
|
|
submitForm () {
|
|
|
- console.log(1111)
|
|
|
const that = this;
|
|
|
// 触发表单验证
|
|
|
this.$refs.form.validate(valid => {
|
|
|
if (valid) {
|
|
|
- console.log(22222)
|
|
|
- // that.confirmLoading = true;
|
|
|
- // let httpurl = '';
|
|
|
- // let method = '';
|
|
|
- // if(!this.model.id){
|
|
|
- // httpurl+=this.url.add;
|
|
|
- // method = 'post';
|
|
|
- // }else{
|
|
|
- // httpurl+=this.url.edit;
|
|
|
- // method = 'put';
|
|
|
- // }
|
|
|
- // httpAction(httpurl,this.model,method).then((res)=>{
|
|
|
- // if(res.success){
|
|
|
- // that.$message.success(res.message);
|
|
|
- // that.$emit('ok');
|
|
|
- // }else{
|
|
|
- // that.$message.warning(res.message);
|
|
|
- // }
|
|
|
- // }).finally(() => {
|
|
|
- // that.confirmLoading = false;
|
|
|
- // })
|
|
|
+ that.confirmLoading = true;
|
|
|
+ let httpurl = '';
|
|
|
+ let method = '';
|
|
|
+ if(!this.model.id){
|
|
|
+ httpurl+=this.url.add;
|
|
|
+ method = 'post';
|
|
|
+ }else{
|
|
|
+ httpurl+=this.url.edit;
|
|
|
+ method = 'put';
|
|
|
+ }
|
|
|
+ httpAction(httpurl,this.model,method).then((res)=>{
|
|
|
+ if(res.success){
|
|
|
+ that.$message.success(res.message);
|
|
|
+ that.$emit('ok');
|
|
|
+ }else{
|
|
|
+ that.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ that.confirmLoading = false;
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|