index.vue
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
<div>
<div class="FormDialog" @click="openDialog">
<el-button type="text" :disabled="disabled" :loading="btnLoading"><slot></slot></el-button>
</div>
<NCCForm v-if="dialogVisible" ref="NCCForm" @refreshDataList="refresh"/>
</div>
</template>
<script>
import NCCForm from '@/views/baseSpecialAction/dynamicModel/list/Form'
import request from "@/utils/request";
export default {
components: { NCCForm },
props: {
row: {
type: Object,
default: {},
},
isDetail: {
type: Boolean,
default: true,
},
disabled: {
type: Boolean,
default: false,
},
},
data() {
return {
dialogVisible: false,
btnLoading: false,
}
},
methods: {
openDialog() {
let row = this.row;
if(this.disabled) return;
this.btnLoading = true;
this.dialogVisible = true;
var Itemid = row.itemId || '';//数据id,没有的话就是新增 ,有的话就是修改
var modelId = row.formId;//关联的表单id
var taskId = row.id; // 当前专项行动id
var isPreview = false;//固定死,值不变
var useFormPermission = false;//固定死,值不变
var formData = [];
request({
url: '/visualdev/OnlineDev/'+modelId+'/Config',
method: "GET",
params:null
}).then(res => {
formData = JSON.parse(res.data.formData);
formData.disabled = this.isDetail || false;
let form = JSON.stringify(formData);
this.$refs.NCCForm.init(form, modelId, Itemid, isPreview, useFormPermission, taskId, this.isDetail)
this.btnLoading = false;
}).catch(() => this.btnLoading = false);
},
refresh() {
this.dialogVisible = false;
},
}
}
</script>