| | |
| | | // console.log(item, '修改名称')
|
| | | this.$set(item, "isEdit", false);
|
| | | },
|
| | | updateTemplates() {
|
| | | getAllTemplate().then(rsp => {
|
| | | if (rsp && rsp.success) {
|
| | | this.sceneTemplates = rsp.data;
|
| | | this.sceneTemplates.forEach(element => {
|
| | | element.icon = [
|
| | | "iconrenlianjiance",
|
| | | "icongetijingzhi",
|
| | | "iconchouyan-copy",
|
| | | "iconrenshukouzhao"
|
| | | ];
|
| | | });
|
| | | }
|
| | | });
|
| | | },
|
| | | |
| | | cleanTemplateForm() {
|
| | | this.appSceneForm.name = "";
|
| | | this.appSceneForm.desc = "";
|
| | |
| | | this.$refs.ruleEditor.cleanRule();
|
| | | },
|
| | | handleTabClick() {
|
| | | if (this.activeName == "appScenarios") {
|
| | | this.updateTemplates();
|
| | | }
|
| | | |
| | | },
|
| | | handleCreateScene() {
|
| | | this.sceneDialogVisible = true;
|
| | |
| | | this.sceneDialogVisible = true;
|
| | | this.dialogTitle = '编辑场景模板';
|
| | | },
|
| | | handleDelScene(item) {
|
| | | this.$confirm('此操作将删除该应用场景模板, 是否继续?', '提示', {
|
| | | confirmButtonText: '确定',
|
| | | cancelButtonText: '取消',
|
| | | type: 'warning'
|
| | | }).then(() => {
|
| | | deleteTemplate(item.id).then(res => {
|
| | | if (res && res.success) {
|
| | | this.updateTemplates();
|
| | | this.$message({
|
| | | type: 'success',
|
| | | message: '删除成功!'
|
| | | });
|
| | | }
|
| | | })
|
| | |
|
| | | }).catch(() => {
|
| | | console.log('取消删除');
|
| | | });
|
| | | },
|
| | | handleSaveTemplate() {
|
| | | let editorResp = this.$refs.ruleEditor.submitRule();
|
| | | this.appSceneForm.rules = JSON.stringify(editorResp.rules);
|
| | | this.appSceneForm.txt = editorResp.text;
|
| | |
|
| | | saveTemplate(this.appSceneForm).then(rsp => {
|
| | | if (rsp && rsp.success) {
|
| | | this.$notify({
|
| | | type: "success",
|
| | | message: "模板创建成功"
|
| | | });
|
| | | this.updateTemplates();
|
| | | this.sceneDialogVisible = false;
|
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | |
| | | }
|
| | | };
|
| | | </script>
|