88 lines
2.7 KiB
Vue
88 lines
2.7 KiB
Vue
<template>
|
|
<a-modal :title="title" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleOk"
|
|
@cancel="handleCancel">
|
|
<a-spin :spinning="confirmLoading">
|
|
<a-form-model ref="ruleForm" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
<a-row :gutter="16">
|
|
<a-col class="gutter-row" :span="12" v-for="itemNode in nodes">
|
|
<a-form-model-item :label="itemNode.dataIndex" prop="name">
|
|
<a-input v-model="form[itemNode.dataIndex]"
|
|
:disabled="itemNode.dataIndex == '序号' ? true : false" />
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-row>
|
|
|
|
</a-form-model>
|
|
</a-spin>
|
|
</a-modal>
|
|
</template>
|
|
|
|
<script>
|
|
import { updateDmTableBySeqNo } from '@/api/dataManage'
|
|
|
|
export default {
|
|
name: "editdataseach",
|
|
data() {
|
|
return {
|
|
title: "编辑",
|
|
visible: false,
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 10 },
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 14 },
|
|
},
|
|
confirmLoading: false,
|
|
form: null,
|
|
nodes: [],
|
|
submitForm: {
|
|
schemaMass: null,
|
|
tableName: null,
|
|
fieldValues: null
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
},
|
|
methods: {
|
|
initForm(schemaMass, tableName, columns, record) {
|
|
this.visible = true;
|
|
this.nodes = columns
|
|
this.submitForm.schemaMass = schemaMass
|
|
this.submitForm.tableName = tableName
|
|
this.form = record
|
|
},
|
|
close() {
|
|
this.visible = false;
|
|
},
|
|
handleOk() {
|
|
const that = this;
|
|
// 触发表单验证
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
that.confirmLoading = true;
|
|
that.submitForm.fieldValues = that.form
|
|
updateDmTableBySeqNo(that.submitForm).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.message);
|
|
that.$emit('ok');
|
|
} else {
|
|
that.$message.warning(res.message);
|
|
}
|
|
}).finally(() => {
|
|
that.confirmLoading = false;
|
|
that.close();
|
|
})
|
|
}
|
|
});
|
|
},
|
|
handleCancel() {
|
|
this.close()
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped></style> |