|
@@ -1,32 +1,37 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="">
|
3
|
3
|
<div class="filter-container">
|
4
|
|
- <el-button size="small" class="filter-item" style="float:right;" @click="handleCreate" type="primary" icon="el-icon-circle-plus-outline">{{$t('table.add')}}</el-button>
|
|
4
|
+ <el-button size="small" class="filter-item" style="float:right;" @click="handleCreate" type="primary"
|
|
5
|
+ icon="el-icon-circle-plus-outline">{{$t('table.add')}}
|
|
6
|
+ </el-button>
|
5
|
7
|
</div>
|
6
|
|
- <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :key='tableKey' :data="list" v-loading="listLoading" border fit highlight-current-row style="width: 100%;min-height:500px;">
|
|
8
|
+ <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :key='tableKey' :data="list"
|
|
9
|
+ v-loading="listLoading" border fit highlight-current-row style="width: 100%;min-height:500px;">
|
7
|
10
|
<!-- <el-table-column align="center" :label="$t('table.id')" width="65" @click="handleUpdate(scope.row)">
|
8
|
11
|
<template slot-scope="scope">
|
9
|
12
|
<span>{{scope.row.id}}</span>
|
10
|
13
|
</template>
|
11
|
14
|
</el-table-column> -->
|
12
|
|
- <el-table-column align="center" label="标题">
|
|
15
|
+ <el-table-column align="center" label="标题">
|
13
|
16
|
<template slot-scope="scope">
|
14
|
17
|
<!-- <span @click="handleUpdate(scope.row)">{{scope.row.name}}</span> -->
|
15
|
|
- <span >{{scope.row.title}}</span>
|
|
18
|
+ <span>{{scope.row.title}}</span>
|
16
|
19
|
</template>
|
17
|
20
|
</el-table-column>
|
18
|
21
|
<el-table-column align="center" label="内容">
|
19
|
22
|
<template slot-scope="scope">
|
20
|
|
- <span>{{scope.row.content}}</span>
|
|
23
|
+ <span v-html="scope.row.content">{{scope.row.content}}</span>
|
21
|
24
|
</template>
|
22
|
25
|
</el-table-column>
|
23
|
26
|
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
|
24
|
27
|
<template slot-scope="scope">
|
25
|
28
|
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
|
26
|
|
- <el-button icon="el-icon-edit-outline" type="primary" size="small" @click="handleUpdate(scope.row)"></el-button>
|
|
29
|
+ <el-button icon="el-icon-edit-outline" type="primary" size="small"
|
|
30
|
+ @click="handleUpdate(scope.row)"></el-button>
|
27
|
31
|
</el-tooltip>
|
28
|
32
|
<el-tooltip class="item" effect="dark" content="删除" placement="top">
|
29
|
|
- <el-button icon="el-icon-delete" v-if="scope.row.status!='deleted'" size="small" type="danger" @click="handleModifyStatus(scope.row,'deleted')">
|
|
33
|
+ <el-button icon="el-icon-delete" v-if="scope.row.status!='deleted'" size="small" type="danger"
|
|
34
|
+ @click="handleModifyStatus(scope.row,'deleted')">
|
30
|
35
|
</el-button>
|
31
|
36
|
</el-tooltip>
|
32
|
37
|
|
|
@@ -41,15 +46,30 @@
|
41
|
46
|
</div> -->
|
42
|
47
|
|
43
|
48
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
44
|
|
- <el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="70px" >
|
45
|
|
- <el-form-item label="标题" prop="title">
|
|
49
|
+ <el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="70px">
|
|
50
|
+ <el-form-item label="标题" prop="title">
|
46
|
51
|
<el-input v-model="temp.title" maxlength="100" placeholder="请输入标题"></el-input>
|
47
|
52
|
</el-form-item>
|
48
|
|
- <el-form-item label="内容" prop="content">
|
49
|
|
- <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" v-model="temp.content" placeholder="请输入内容"></el-input>
|
|
53
|
+
|
|
54
|
+ <el-form-item label="内容" v-if="type == 'course_disease'">
|
|
55
|
+ <keep-alive>
|
|
56
|
+ <neditor ref="neditor"
|
|
57
|
+ id="neditor"
|
|
58
|
+ style="width: 600px"
|
|
59
|
+ v-bind:r_content="temp.content">
|
|
60
|
+ </neditor>
|
|
61
|
+ </keep-alive>
|
|
62
|
+ </el-form-item>
|
|
63
|
+
|
|
64
|
+ <el-form-item label="内容" prop="content" v-else>
|
|
65
|
+ <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" v-model="temp.content"
|
|
66
|
+ placeholder="请输入内容"></el-input>
|
50
|
67
|
</el-form-item>
|
|
68
|
+
|
|
69
|
+
|
51
|
70
|
<el-form-item :label="$t('data_config.remark')">
|
52
|
|
- <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" placeholder="请输入备注" v-model="temp.remark"></el-input>
|
|
71
|
+ <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4}" placeholder="请输入备注"
|
|
72
|
+ v-model="temp.remark"></el-input>
|
53
|
73
|
</el-form-item>
|
54
|
74
|
</el-form>
|
55
|
75
|
<div slot="footer" class="dialog-footer">
|
|
@@ -60,9 +80,10 @@
|
60
|
80
|
</el-dialog>
|
61
|
81
|
|
62
|
82
|
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
|
63
|
|
- <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :data="pvData" border fit highlight-current-row style="width: 100%">
|
64
|
|
- <el-table-column prop="key" label="Channel"> </el-table-column>
|
65
|
|
- <el-table-column prop="pv" label="Pv"> </el-table-column>
|
|
83
|
+ <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :data="pvData" border fit
|
|
84
|
+ highlight-current-row style="width: 100%">
|
|
85
|
+ <el-table-column prop="key" label="Channel"></el-table-column>
|
|
86
|
+ <el-table-column prop="pv" label="Pv"></el-table-column>
|
66
|
87
|
</el-table>
|
67
|
88
|
<span slot="footer" class="dialog-footer">
|
68
|
89
|
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
|
|
@@ -73,270 +94,284 @@
|
73
|
94
|
</template>
|
74
|
95
|
|
75
|
96
|
<script>
|
76
|
|
-import {createConfig,createChildConfig,updateChildConfig, deleteChildConfig,updateTemplate} from '@/api/data'
|
77
|
|
-import waves from '@/directive/waves' // 水波纹指令
|
78
|
|
-import { parseTime } from '@/utils'
|
79
|
|
-import store from '@/store'
|
80
|
|
-import bus from '@/assets/eventBus'
|
81
|
|
-
|
|
97
|
+ import { createChildConfig, createConfig, deleteChildConfig, updateChildConfig, updateTemplate } from '@/api/data'
|
|
98
|
+ import waves from '@/directive/waves' // 水波纹指令
|
|
99
|
+ import { parseTime } from '@/utils'
|
|
100
|
+ import store from '@/store'
|
|
101
|
+ import bus from '@/assets/eventBus'
|
|
102
|
+ import Neditor from '@/components/Neditor'
|
82
|
103
|
|
83
|
|
-export default {
|
84
|
|
- name: 'complexTable',
|
85
|
|
- directives: {
|
86
|
|
- waves
|
87
|
|
- },
|
88
|
|
- props: {
|
89
|
|
- type: {
|
90
|
|
- type: String,
|
91
|
|
- default: 'patient'
|
92
|
|
- }
|
93
|
|
- },
|
94
|
|
- data() {
|
95
|
|
- return {
|
96
|
|
- currentId: undefined,
|
97
|
|
- tableKey: 0,
|
98
|
|
- // list: null,
|
99
|
|
- total: null,
|
100
|
|
- listLoading: true,
|
101
|
|
- listQuery: {
|
102
|
|
- page: 1,
|
103
|
|
- limit: 20,
|
104
|
|
- importance: undefined,
|
105
|
|
- title: undefined,
|
106
|
|
- type: this.type,
|
107
|
|
- sort: '+id'
|
108
|
|
- },
|
109
|
|
- importanceOptions: [1, 2, 3],
|
110
|
|
- // calendarTypeOptions,
|
111
|
|
- sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
112
|
|
- statusOptions: ['published', 'draft', 'deleted'],
|
113
|
|
- showReviewer: false,
|
114
|
|
- temp: {
|
115
|
|
- id: undefined,
|
116
|
|
- parent_id: 0,
|
117
|
|
- module: this.type,
|
118
|
|
- org_id:0,
|
119
|
|
- title: '',
|
120
|
|
- content: '',
|
121
|
|
- remark: ''
|
122
|
|
- },
|
123
|
|
- dialogFormVisible: false,
|
124
|
|
- dialogStatus: '',
|
125
|
|
- textMap: {
|
126
|
|
- update: '修改',
|
127
|
|
- create: '新增'
|
128
|
|
- },
|
129
|
|
- dialogPvVisible: false,
|
130
|
|
- pvData: [],
|
131
|
|
- rules: {
|
132
|
|
- title: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
133
|
|
- content: [{ required: true, message: '请输入字段名', trigger: 'blur' }]
|
134
|
|
- },
|
135
|
|
- downloadLoading: false
|
136
|
|
- }
|
137
|
|
- },
|
138
|
|
- // watch: {
|
139
|
|
- // 'temp.config_field':function(){
|
140
|
|
- // this.temp.config_field = this.temp.config_field.replace(/[^A-Za-z]/g,'');
|
141
|
|
- // }
|
142
|
|
- // },
|
143
|
|
- computed:{
|
144
|
|
- list: function() {
|
145
|
|
- // const list = store.getters.configlist[this.type]
|
146
|
|
- // this.total = list.length
|
147
|
|
- return store.getters.configlist[this.type]
|
148
|
|
- }
|
149
|
|
- },
|
150
|
|
- filters: {
|
151
|
|
- statusFilter(status) {
|
152
|
|
- const statusMap = {
|
153
|
|
- published: 'success',
|
154
|
|
- draft: 'info',
|
155
|
|
- deleted: 'danger'
|
156
|
|
- }
|
157
|
|
- return statusMap[status]
|
|
104
|
+ export default {
|
|
105
|
+ name: 'complexTable',
|
|
106
|
+ directives: {
|
|
107
|
+ waves
|
158
|
108
|
},
|
159
|
|
- typeFilter(type) {
|
160
|
|
- return calendarTypeKeyValue[type]
|
161
|
|
- }
|
162
|
|
- },
|
163
|
|
- created() {
|
164
|
|
- this.getList()
|
165
|
|
- },
|
166
|
|
- methods: {
|
167
|
|
- fieldChange:function(newValue){
|
168
|
|
- this.temp.config_field = newValue.replace(/[^A-Za-z]/g,'');
|
|
109
|
+ components: {
|
|
110
|
+ Neditor
|
169
|
111
|
},
|
170
|
|
- handleRowChange(currentRow, oldCurrentRow){
|
171
|
|
- if(currentRow != undefined){
|
172
|
|
- this.currentId = currentRow.id
|
173
|
|
- bus.$emit('parentChangeId',currentRow)
|
|
112
|
+ props: {
|
|
113
|
+ type: {
|
|
114
|
+ type: String,
|
|
115
|
+ default: 'patient'
|
174
|
116
|
}
|
175
|
117
|
},
|
176
|
|
- getList() {
|
177
|
|
- this.listLoading = false
|
178
|
|
- // setTimeout(() => {
|
179
|
|
- // this.listLoading = false
|
180
|
|
- // }, 1 * 1000)
|
|
118
|
+ beforeMount(){
|
|
119
|
+
|
|
120
|
+
|
181
|
121
|
},
|
182
|
|
- handleFilter() {
|
183
|
|
- this.listQuery.page = 1
|
184
|
|
- this.getList()
|
|
122
|
+ data() {
|
|
123
|
+ return {
|
|
124
|
+ currentId: undefined,
|
|
125
|
+ tableKey: 0,
|
|
126
|
+ // list: null,
|
|
127
|
+ total: null,
|
|
128
|
+ listLoading: true,
|
|
129
|
+ listQuery: {
|
|
130
|
+ page: 1,
|
|
131
|
+ limit: 20,
|
|
132
|
+ importance: undefined,
|
|
133
|
+ title: undefined,
|
|
134
|
+ type: this.type,
|
|
135
|
+ sort: '+id'
|
|
136
|
+ },
|
|
137
|
+ importanceOptions: [1, 2, 3],
|
|
138
|
+ // calendarTypeOptions,
|
|
139
|
+ sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
|
140
|
+ statusOptions: ['published', 'draft', 'deleted'],
|
|
141
|
+ showReviewer: false,
|
|
142
|
+ temp: {
|
|
143
|
+ id: undefined,
|
|
144
|
+ parent_id: 0,
|
|
145
|
+ module: this.type,
|
|
146
|
+ org_id: 0,
|
|
147
|
+ title: '',
|
|
148
|
+ content: '',
|
|
149
|
+ remark: ''
|
|
150
|
+ },
|
|
151
|
+ dialogFormVisible: false,
|
|
152
|
+ dialogStatus: '',
|
|
153
|
+ textMap: {
|
|
154
|
+ update: '修改',
|
|
155
|
+ create: '新增'
|
|
156
|
+ },
|
|
157
|
+ dialogPvVisible: false,
|
|
158
|
+ pvData: [],
|
|
159
|
+ rules: {
|
|
160
|
+ title: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
161
|
+ content: [{ required: true, message: '请输入字段名', trigger: 'blur' }]
|
|
162
|
+ },
|
|
163
|
+ downloadLoading: false
|
|
164
|
+ }
|
185
|
165
|
},
|
186
|
|
- handleSizeChange(val) {
|
187
|
|
- this.listQuery.limit = val
|
188
|
|
- this.getList()
|
|
166
|
+ // watch: {
|
|
167
|
+ // 'temp.config_field':function(){
|
|
168
|
+ // this.temp.config_field = this.temp.config_field.replace(/[^A-Za-z]/g,'');
|
|
169
|
+ // }
|
|
170
|
+ // },
|
|
171
|
+ computed: {
|
|
172
|
+ list: function() {
|
|
173
|
+ // const list = store.getters.configlist[this.type]
|
|
174
|
+ // this.total = list.length
|
|
175
|
+ return store.getters.configlist[this.type]
|
|
176
|
+ }
|
189
|
177
|
},
|
190
|
|
- handleCurrentChange(val) {
|
191
|
|
- this.listQuery.page = val
|
|
178
|
+ filters: {
|
|
179
|
+ statusFilter(status) {
|
|
180
|
+ const statusMap = {
|
|
181
|
+ published: 'success',
|
|
182
|
+ draft: 'info',
|
|
183
|
+ deleted: 'danger'
|
|
184
|
+ }
|
|
185
|
+ return statusMap[status]
|
|
186
|
+ },
|
|
187
|
+ typeFilter(type) {
|
|
188
|
+ return calendarTypeKeyValue[type]
|
|
189
|
+ }
|
|
190
|
+ },
|
|
191
|
+ created() {
|
192
|
192
|
this.getList()
|
193
|
193
|
},
|
194
|
|
- handleModifyStatus(row, status) {
|
195
|
|
- this.temp = Object.assign({}, row); // copy obj
|
196
|
|
- this.$confirm("此操作将永久删除该配置项, 是否继续?", "提示", {
|
197
|
|
- confirmButtonText: "确 定",
|
198
|
|
- cancelButtonText: "取 消",
|
199
|
|
- type: "warning"
|
200
|
|
- }).then(() => {
|
201
|
|
- const tempData = Object.assign({}, this.temp);
|
|
194
|
+ methods: {
|
|
195
|
+ fieldChange: function(newValue) {
|
|
196
|
+ this.temp.config_field = newValue.replace(/[^A-Za-z]/g, '')
|
|
197
|
+ },
|
|
198
|
+ handleRowChange(currentRow, oldCurrentRow) {
|
|
199
|
+ if (currentRow != undefined) {
|
|
200
|
+ this.currentId = currentRow.id
|
|
201
|
+ bus.$emit('parentChangeId', currentRow)
|
|
202
|
+ }
|
|
203
|
+ },
|
|
204
|
+ getList() {
|
|
205
|
+ this.listLoading = false
|
|
206
|
+ // setTimeout(() => {
|
|
207
|
+ // this.listLoading = false
|
|
208
|
+ // }, 1 * 1000)
|
|
209
|
+ },
|
|
210
|
+ handleFilter() {
|
|
211
|
+ this.listQuery.page = 1
|
|
212
|
+ this.getList()
|
|
213
|
+ },
|
|
214
|
+ handleSizeChange(val) {
|
|
215
|
+ this.listQuery.limit = val
|
|
216
|
+ this.getList()
|
|
217
|
+ },
|
|
218
|
+ handleCurrentChange(val) {
|
|
219
|
+ this.listQuery.page = val
|
|
220
|
+ this.getList()
|
|
221
|
+ },
|
|
222
|
+ handleModifyStatus(row, status) {
|
|
223
|
+ this.temp = Object.assign({}, row) // copy obj
|
|
224
|
+ this.$confirm('此操作将永久删除该配置项, 是否继续?', '提示', {
|
|
225
|
+ confirmButtonText: '确 定',
|
|
226
|
+ cancelButtonText: '取 消',
|
|
227
|
+ type: 'warning'
|
|
228
|
+ }).then(() => {
|
|
229
|
+ const tempData = Object.assign({}, this.temp)
|
202
|
230
|
deleteChildConfig(tempData).then(response => {
|
203
|
231
|
if (!response.data) {
|
204
|
232
|
// 由于mockjs 不支持自定义状态码只能这样hack
|
205
|
|
- reject("error");
|
|
233
|
+ reject('error')
|
206
|
234
|
}
|
207
|
235
|
if (response.data.state === 0) {
|
208
|
|
- this.$message.error(response.data.msg);
|
|
236
|
+ this.$message.error(response.data.msg)
|
209
|
237
|
}
|
210
|
238
|
|
211
|
|
- const result = response.data.data.dataconfig;
|
212
|
|
- store.dispatch("updateParentConfigList", [tempData, "delete"]).then(() => {
|
213
|
|
- next();
|
214
|
|
- });
|
215
|
|
- });
|
|
239
|
+ const result = response.data.data.dataconfig
|
|
240
|
+ store.dispatch('updateParentConfigList', [tempData, 'delete']).then(() => {
|
|
241
|
+ next()
|
|
242
|
+ })
|
|
243
|
+ })
|
216
|
244
|
|
217
|
245
|
this.$message({
|
218
|
|
- type: "success",
|
219
|
|
- message: "删除成功!"
|
220
|
|
- });
|
|
246
|
+ type: 'success',
|
|
247
|
+ message: '删除成功!'
|
|
248
|
+ })
|
221
|
249
|
})
|
222
|
|
- .catch(() => {
|
223
|
|
- this.$message({
|
224
|
|
- type: "info",
|
225
|
|
- message: "已取消删除"
|
226
|
|
- });
|
227
|
|
- });
|
228
|
|
- },
|
229
|
|
- resetTemp() {
|
230
|
|
- this.temp = {
|
231
|
|
- id: undefined,
|
232
|
|
- parent_id: 0,
|
233
|
|
- module: this.type,
|
234
|
|
- org_id:0,
|
235
|
|
- title: '',
|
236
|
|
- content: '',
|
237
|
|
- remark: ''
|
238
|
|
- }
|
239
|
|
- },
|
240
|
|
- handleCreate() {
|
241
|
|
- this.resetTemp()
|
242
|
|
- this.dialogStatus = 'create'
|
243
|
|
- this.dialogFormVisible = true
|
244
|
|
- this.$nextTick(() => {
|
245
|
|
- this.$refs['dataForm'].clearValidate()
|
246
|
|
- })
|
247
|
|
- },
|
248
|
|
- createData() {
|
249
|
|
- this.$refs['dataForm'].validate((valid) => {
|
250
|
|
- if (valid) {
|
251
|
|
- createConfig(this.temp).then(response => {
|
252
|
|
- if (!response.data) { // 由于mockjs 不支持自定义状态码只能这样hack
|
|
250
|
+ .catch(() => {
|
|
251
|
+ this.$message({
|
|
252
|
+ type: 'info',
|
|
253
|
+ message: '已取消删除'
|
|
254
|
+ })
|
|
255
|
+ })
|
|
256
|
+ },
|
|
257
|
+ resetTemp() {
|
|
258
|
+ this.temp = {
|
|
259
|
+ id: undefined,
|
|
260
|
+ parent_id: 0,
|
|
261
|
+ module: this.type,
|
|
262
|
+ org_id: 0,
|
|
263
|
+ title: '',
|
|
264
|
+ content: '',
|
|
265
|
+ remark: ''
|
|
266
|
+ }
|
|
267
|
+ },
|
|
268
|
+ handleCreate() {
|
|
269
|
+ this.resetTemp()
|
|
270
|
+ this.dialogStatus = 'create'
|
|
271
|
+ this.dialogFormVisible = true
|
|
272
|
+ this.$nextTick(() => {
|
|
273
|
+ this.$refs['dataForm'].clearValidate()
|
|
274
|
+ })
|
|
275
|
+ },
|
|
276
|
+ createData() {
|
|
277
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
278
|
+ if(this.type == "course_disease"){
|
|
279
|
+ this.temp.content = this.$refs.neditor.content;
|
|
280
|
+ }
|
|
281
|
+
|
|
282
|
+ if (valid) {
|
|
283
|
+ createConfig(this.temp).then(response => {
|
|
284
|
+ if (!response.data) { // 由于mockjs 不支持自定义状态码只能这样hack
|
253
|
285
|
reject('error')
|
254
|
|
- }
|
255
|
|
- if (response.data.state === 0) {
|
256
|
|
- this.$message.error(response.data.msg);
|
257
|
|
- }
|
258
|
|
- const result = response.data.data.dataconfig
|
259
|
|
- // 更新store
|
260
|
|
- store.dispatch('updateConfigList',result).then(() => {
|
|
286
|
+ }
|
|
287
|
+ if (response.data.state === 0) {
|
|
288
|
+ this.$message.error(response.data.msg)
|
|
289
|
+ }
|
|
290
|
+ const result = response.data.data.dataconfig
|
|
291
|
+ // 更新store
|
|
292
|
+ store.dispatch('updateConfigList', result).then(() => {
|
261
|
293
|
|
262
|
|
- })
|
|
294
|
+ })
|
263
|
295
|
|
264
|
|
- this.dialogFormVisible = false
|
|
296
|
+ this.dialogFormVisible = false
|
265
|
297
|
|
266
|
|
- this.$message.success("创建成功")
|
267
|
|
- })
|
268
|
|
- }
|
269
|
|
- })
|
270
|
|
- },
|
271
|
|
- handleUpdate(row) {
|
272
|
|
- this.temp = Object.assign({}, row); // copy obj
|
273
|
|
- this.dialogStatus = "update";
|
274
|
|
- this.dialogFormVisible = true;
|
275
|
|
- this.$nextTick(() => {
|
276
|
|
- this.$refs["dataForm"].clearValidate();
|
277
|
|
- });
|
278
|
|
- },
|
279
|
|
- updateData() {
|
280
|
|
- this.$refs["dataForm"].validate(valid => {
|
281
|
|
- if (valid) {
|
282
|
|
- const tempData = Object.assign({}, this.temp);
|
283
|
|
- updateTemplate(tempData).then(response => {
|
284
|
|
- if (!response.data) {
|
285
|
|
- // 由于mockjs 不支持自定义状态码只能这样hack
|
286
|
|
- reject("error");
|
287
|
|
- }
|
288
|
|
- if (response.data.state === 0) {
|
289
|
|
- this.$message.error(response.data.msg);
|
|
298
|
+ this.$message.success('创建成功')
|
|
299
|
+ })
|
|
300
|
+ }
|
|
301
|
+ })
|
|
302
|
+ },
|
|
303
|
+ handleUpdate(row) {
|
|
304
|
+ this.temp = Object.assign({}, row) // copy obj
|
|
305
|
+ this.dialogStatus = 'update'
|
|
306
|
+ this.dialogFormVisible = true
|
|
307
|
+ this.$nextTick(() => {
|
|
308
|
+ this.$refs['dataForm'].clearValidate()
|
|
309
|
+ })
|
|
310
|
+ },
|
|
311
|
+ updateData() {
|
|
312
|
+ this.$refs['dataForm'].validate(valid => {
|
|
313
|
+ if (valid) {
|
|
314
|
+ const tempData = Object.assign({}, this.temp)
|
|
315
|
+ if(this.type == "course_disease"){
|
|
316
|
+ tempData.content = this.$refs.neditor.content;
|
290
|
317
|
}
|
|
318
|
+ updateTemplate(tempData).then(response => {
|
|
319
|
+ if (!response.data) {
|
|
320
|
+ // 由于mockjs 不支持自定义状态码只能这样hack
|
|
321
|
+ reject('error')
|
|
322
|
+ }
|
|
323
|
+ if (response.data.state === 0) {
|
|
324
|
+ this.$message.error(response.data.msg)
|
|
325
|
+ }
|
291
|
326
|
|
292
|
|
- const result = response.data.data.dataconfig;
|
293
|
|
- store.dispatch("updateParentConfigList", [result, "update"]).then(() => {
|
294
|
|
- next();
|
295
|
|
- });
|
|
327
|
+ const result = response.data.data.dataconfig
|
|
328
|
+ store.dispatch('updateParentConfigList', [result, 'update']).then(() => {
|
|
329
|
+ next()
|
|
330
|
+ })
|
296
|
331
|
|
297
|
|
- this.dialogFormVisible = false;
|
|
332
|
+ this.dialogFormVisible = false
|
298
|
333
|
|
299
|
|
- this.$message.success("更新成功")
|
300
|
|
- });
|
301
|
|
- }
|
302
|
|
- });
|
303
|
|
- },
|
304
|
|
- handleDelete(row) {
|
|
334
|
+ this.$message.success('更新成功')
|
|
335
|
+ })
|
|
336
|
+ }
|
|
337
|
+ })
|
|
338
|
+ },
|
|
339
|
+ handleDelete(row) {
|
305
|
340
|
|
306
|
|
- this.$message.success("删除成功")
|
|
341
|
+ this.$message.success('删除成功')
|
307
|
342
|
|
308
|
|
- const index = this.list.indexOf(row)
|
309
|
|
- this.list.splice(index, 1)
|
310
|
|
- },
|
311
|
|
- handleFetchPv(pv) {
|
312
|
|
- fetchPv(pv).then(response => {
|
313
|
|
- this.pvData = response.data.pvData
|
314
|
|
- this.dialogPvVisible = true
|
315
|
|
- })
|
316
|
|
- },
|
317
|
|
- handleDownload() {
|
318
|
|
- this.downloadLoading = true
|
319
|
|
- import('@/vendor/Export2Excel').then(excel => {
|
320
|
|
- const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
321
|
|
- const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
322
|
|
- const data = this.formatJson(filterVal, this.list)
|
323
|
|
- excel.export_json_to_excel({
|
324
|
|
- header: tHeader,
|
325
|
|
- data,
|
326
|
|
- filename: 'table-list'
|
|
343
|
+ const index = this.list.indexOf(row)
|
|
344
|
+ this.list.splice(index, 1)
|
|
345
|
+ },
|
|
346
|
+ handleFetchPv(pv) {
|
|
347
|
+ fetchPv(pv).then(response => {
|
|
348
|
+ this.pvData = response.data.pvData
|
|
349
|
+ this.dialogPvVisible = true
|
327
|
350
|
})
|
328
|
|
- this.downloadLoading = false
|
329
|
|
- })
|
330
|
|
- },
|
331
|
|
- formatJson(filterVal, jsonData) {
|
332
|
|
- return jsonData.map(v => filterVal.map(j => {
|
333
|
|
- if (j === 'timestamp') {
|
334
|
|
- return parseTime(v[j])
|
335
|
|
- } else {
|
336
|
|
- return v[j]
|
337
|
|
- }
|
338
|
|
- }))
|
|
351
|
+ },
|
|
352
|
+ handleDownload() {
|
|
353
|
+ this.downloadLoading = true
|
|
354
|
+ import('@/vendor/Export2Excel').then(excel => {
|
|
355
|
+ const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
|
356
|
+ const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
|
357
|
+ const data = this.formatJson(filterVal, this.list)
|
|
358
|
+ excel.export_json_to_excel({
|
|
359
|
+ header: tHeader,
|
|
360
|
+ data,
|
|
361
|
+ filename: 'table-list'
|
|
362
|
+ })
|
|
363
|
+ this.downloadLoading = false
|
|
364
|
+ })
|
|
365
|
+ },
|
|
366
|
+ formatJson(filterVal, jsonData) {
|
|
367
|
+ return jsonData.map(v => filterVal.map(j => {
|
|
368
|
+ if (j === 'timestamp') {
|
|
369
|
+ return parseTime(v[j])
|
|
370
|
+ } else {
|
|
371
|
+ return v[j]
|
|
372
|
+ }
|
|
373
|
+ }))
|
|
374
|
+ }
|
339
|
375
|
}
|
340
|
376
|
}
|
341
|
|
-}
|
342
|
377
|
</script>
|