Commit 0edf3e4b authored by zenglun's avatar zenglun

提交部分代码

parent 88f73eab
<template>
<div class="category-add">
<h2 class="dialog_add-title">添加模板</h2>
<dialog-input
class="dialog_add-form dialog_add-input_name"
v-model.trim="name"
:errorShowing="isErrorShowing"
placeholder="请输入模板名称"
/>
<el-select v-model="value" placeholder="请选择">
<el-option v-for="item in MyCategories" :key="item.value" :label="item.name" :value="item.id"></el-option>
</el-select>
<button class="dialog_add-btn_confirm" @click="checkForm">确定</button>
<button class="dialog_add-btn_cancel" @click="closeDialog">取消</button>
</div>
</template>
<script>
import DialogInput from "@/components/DialogInput.vue";
import { GO_URLS } from "@/config/URLS";
export default {
data() {
return {
name: "",
isErrorShowing: false, // 错误提示
isInActive: false,
MyCategories: [],
value: ""
};
},
components: { DialogInput },
created() {
this.getFolderList();
},
methods: {
async checkForm() {
if (this.isInActive) return;
this.isInActive = true;
this.isErrorShowing = true;
// 追加非空验证
if (this.name === "") {
this.$message("模板名称不可为空");
this.isInActive = false;
return null;
}
if (this.value === "") {
// this.$message("请选择分类");
// this.isInActive = false;
this.value = this.MyCategories[0].id;
// return null;
}
const data = await this.$ajax({
type: "post",
url: GO_URLS.customize,
params: {
detail: "",
folder_id: this.value,
name: this.name,
info: this.name
}
});
if (data) {
this.$emit("successCallback", this.value);
}
this.isInActive = false;
},
closeDialog() {
this.$emit("close");
},
// 获取我的模板列表
async getFolderList() {
const res = await this.$ajax({
type: "post",
url: GO_URLS.folderList,
params: {
page: 1,
page_size: 100,
template_type: 1
}
});
if (res) {
this.MyCategories = res.data.results;
}
}
}
};
</script>
<style lang="less" scoped>
.category-add {
width: 589px;
height: 350px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 20px 0px rgba(61, 118, 249, 0.18);
}
.dialog_add-title {
margin: 0;
color: #000;
font-size: 22px;
line-height: 30px;
padding-left: 44px;
padding-top: 45px;
}
.dialog_add-input_name {
margin-left: 50px;
margin-top: 39px;
margin-bottom: 18px;
}
.dialog_add-btn_confirm {
float: right;
width: 120px;
height: 40px;
color: #fff;
font-size: 14px;
outline: none;
background: #0cc399;
border-radius: 4px;
border: none;
cursor: pointer;
margin-right: 39px;
}
.dialog_add-btn_cancel {
float: right;
margin-right: 18px; /* 28 - 10 */
border: none;
width: 48px; /* 28 + 增大20 */
height: 40px;
outline: none;
background: #fff;
color: #5c6476;
font-size: 14px;
cursor: pointer;
}
.el-select {
width: 500px;
margin-left: 50px;
margin-bottom: 40px;
}
/deep/.el-input__inner {
height: 44px;
padding: 0 26px;
&:focus {
border-color: #0cc399 !important;
outline: 0;
}
}
</style>
\ No newline at end of file
<template>
<div class="category-add">
<h2 class="dialog_add-title">添加分类</h2>
<dialog-input
class="dialog_add-form dialog_add-input_name"
v-model.trim="name"
:errorShowing="isErrorShowing"
placeholder="请输入分类名称"
/>
<button class="dialog_add-btn_confirm" @click="checkForm">确定</button>
<button class="dialog_add-btn_cancel" @click="closeDialog">取消</button>
</div>
</template>
<script>
import DialogInput from "@/components/DialogInput.vue";
import { GO_URLS } from "@/config/URLS";
export default {
data() {
return {
name: "",
isErrorShowing: false, // 错误提示
isInActive: false,
};
},
components: {
DialogInput,
},
created() {
this.name = "";
},
methods: {
// // 关闭弹窗
async closeDialog() {
this.$emit("close", {});
},
// 添加按钮
async checkForm() {
if (this.isInActive) return;
this.isInActive = true;
this.isErrorShowing = true;
// 追加非空验证
if (this.name.length === 0) {
this.$message("分类名称不可为空");
this.isInActive = false;
return null;
}
const data = await this.$ajax({
type: "post",
url: GO_URLS.addFolder,
params: {
name: this.name,
info: this.name,
},
});
if (data) {
this.$emit("successCallback");
}
this.isInActive = false;
},
},
};
</script>
<style scoped>
.category-add {
padding: 34px 50px 0 50px;
height: 221px; /* 325px - 34px */
width: 500px; /* 600px - 100px */
}
.dialog_add-title {
margin: 0;
color: #000;
font-size: 22px;
line-height: 30px;
}
.dialog_add-select_subject {
margin-top: 29px;
}
.dialog_add-input_name {
margin: 20px 0 34px 0;
}
.dialog_add-btn_confirm {
float: right;
width: 120px;
height: 40px;
color: #fff;
font-size: 14px;
outline: none;
background: #0CC399;
border-radius: 4px;
border: none;
cursor: pointer;
}
.dialog_add-btn_cancel {
float: right;
margin-right: 18px; /* 28 - 10 */
border: none;
width: 48px; /* 28 + 增大20 */
height: 40px;
outline: none;
background: #fff;
color: #5c6476;
font-size: 14px;
cursor: pointer;
}
</style>
<template>
<div class="category-add">
<h2 class="dialog_add-title">创建副本</h2>
<dialog-input
class="dialog_add-form dialog_add-input_name"
v-model="name"
:errorShowing="isErrorShowing"
placeholder="请输入新的模板名称"
/>
<el-select v-model="value" placeholder="请选择">
<el-option v-for="item in MyCategories" :key="item.value" :label="item.name" :value="item.id"></el-option>
</el-select>
<button class="dialog_add-btn_confirm" @click="checkForm">确定</button>
<button class="dialog_add-btn_cancel" @click="closeDialog">取消</button>
</div>
</template>
<script>
import { GO_URLS } from "@/config/URLS";
import DialogInput from "@/components/DialogInput.vue";
export default {
components: {
DialogInput
},
props: ["TemplateID"],
data() {
return {
isErrorShowing: false,
isInActive: false,
name: "",
MyCategories: [],
value: "",
detail: ""
};
},
mounted() {
this.getFolderList();
this.gettemplate(this.TemplateID);
},
methods: {
// 获取模板
async gettemplate(id) {
const res = await this.$ajax({
type: "get",
url: GO_URLS.getSystemTemplate,
params: {
id: id
}
});
if (res) {
this.detail = res.data.detail;
}
},
// 获取我的模板列表
async getFolderList() {
const res = await this.$ajax({
type: "post",
url: GO_URLS.folderList,
params: {
page: 1,
page_size: 100,
template_type: 1
}
});
if (res) {
this.MyCategories = res.data.results;
}
},
async checkForm() {
if (this.isInActive) return;
this.isInActive = true;
this.isErrorShowing = true;
// 追加非空验证
if (this.name === "") {
this.$message("模板名称不可为空");
this.isInActive = false;
return null;
}
if (this.value === "") {
this.value = this.MyCategories[0].id;
}
const data = await this.$ajax({
type: "post",
url: GO_URLS.customize,
params: {
detail: this.detail,
folder_id: this.value,
name: this.name,
info: this.name
}
});
if (data) {
this.$emit("successCallback", this.value);
}
this.isInActive = false;
},
closeDialog() {
this.$emit("close");
}
}
};
</script>
<style lang="less" scoped>
.category-add {
padding: 34px 50px 0 50px;
height: 305px; /* 325px - 34px */
width: 500px; /* 600px - 100px */
}
.dialog_add-title {
margin: 0;
color: #000;
font-size: 22px;
line-height: 30px;
}
.dialog_add-select_subject {
margin-top: 29px;
}
.dialog_add-input_name {
margin: 42px 0 34px 0;
}
.dialog_add-btn_confirm {
float: right;
width: 120px;
height: 40px;
color: #fff;
font-size: 14px;
outline: none;
background: #0cc399;
border-radius: 4px;
border: none;
cursor: pointer;
}
.dialog_add-btn_cancel {
float: right;
margin-right: 18px; /* 28 - 10 */
border: none;
width: 48px; /* 28 + 增大20 */
height: 40px;
outline: none;
background: #fff;
color: #5c6476;
font-size: 14px;
cursor: pointer;
}
.el-select {
width: 500px;
margin-bottom: 40px;
}
/deep/.el-input__inner {
height: 44px;
padding: 0 26px;
&:focus {
border-color: #0cc399 !important;
outline: 0;
}
}
</style>
\ No newline at end of file
<template>
<div class="category-add">
<h2 class="dialog_add-title">重命名</h2>
<dialog-input
class="dialog_add-form dialog_add-input_name"
v-model="name"
:errorShowing="isErrorShowing"
placeholder="请输入新的分类名称"
/>
<button class="dialog_add-btn_confirm" @click="checkForm">确定</button>
<button class="dialog_add-btn_cancel" @click="closeDialog">取消</button>
</div>
</template>
<script>
import DialogInput from "@/components/DialogInput.vue";
import { GO_URLS } from "@/config/URLS";
export default {
components: {
DialogInput
},
data() {
return {
isErrorShowing: false,
isInActive: false,
name: ""
};
},
props: ["oldName", "oldID"],
created() {
this.name = this.oldName;
},
methods: {
// 关闭弹窗
async closeDialog() {
this.$emit("close", {});
},
// 确认按钮
async checkForm() {
if (this.isInActive) return;
this.isInActive = true;
this.isErrorShowing = true;
// 追加非空验证
if (this.name.trim().length === 0) {
this.$message.error("分类名称不可为空");
this.isInActive = false;
return null;
}
const res = await this.$ajax({
type: "PUT",
url: GO_URLS.updateFolder,
params: {
name: this.name,
id: this.oldID
}
});
if (res) {
this.$message({
message: "重命名成功",
type: "success"
});
this.closeDialog();
this.$emit("update");
}
this.isInActive = false;
}
}
};
</script>
<style scoped lang="less">
.category-add {
padding: 34px 50px 0 50px;
height: 245px; /* 325px - 34px */
width: 500px; /* 600px - 100px */
}
.dialog_add-title {
margin: 0;
color: #000;
font-size: 22px;
line-height: 30px;
}
.dialog_add-select_subject {
margin-top: 29px;
}
.dialog_add-input_name {
margin: 42px 0 34px 0;
}
.dialog_add-btn_confirm {
float: right;
width: 120px;
height: 40px;
color: #fff;
font-size: 14px;
outline: none;
background: #0cc399;
border-radius: 4px;
border: none;
cursor: pointer;
}
.dialog_add-btn_cancel {
float: right;
margin-right: 18px; /* 28 - 10 */
border: none;
width: 48px; /* 28 + 增大20 */
height: 40px;
outline: none;
background: #fff;
color: #5c6476;
font-size: 14px;
cursor: pointer;
}
</style>
...@@ -7,22 +7,15 @@ ...@@ -7,22 +7,15 @@
'header-label_l1--check': TemplateType === 0, 'header-label_l1--check': TemplateType === 0,
}" }"
@click="SwitchTemplate(1)" @click="SwitchTemplate(1)"
>系统模板</span >系统模板</span>
>
<span <span
:class="{ :class="{
'header-label_l1': true, 'header-label_l1': true,
'header-label_l1--check': TemplateType === 1, 'header-label_l1--check': TemplateType === 1,
}" }"
@click="SwitchTemplate(0)" @click="SwitchTemplate(0)"
>我的模板</span >我的模板</span>
> <search-bar v-if="TemplateType === 1" v-model="key" @search="search" class="header-search"></search-bar>
<search-bar
v-if="TemplateType === 1"
v-model="key"
@search="search"
class="header-search"
></search-bar>
</header> </header>
<div v-if="TemplateType === 0"> <div v-if="TemplateType === 0">
...@@ -32,9 +25,7 @@ ...@@ -32,9 +25,7 @@
v-for="(item, index) in classificationList" v-for="(item, index) in classificationList"
@click="switchClassification(item, index)" @click="switchClassification(item, index)"
:key="index" :key="index"
> >{{ item.folder_name }}</li>
{{ item.folder_name }}
</li>
</ul> </ul>
<div class="default-list"> <div class="default-list">
<div <div
...@@ -69,15 +60,8 @@ ...@@ -69,15 +60,8 @@
@click="onMenuBlur" @click="onMenuBlur"
@mousedown.stop @mousedown.stop
> >
<li class="menu-item menu-item__one" @click="Rename(item)"> <li class="menu-item menu-item__one" @click="Rename(item)">重命名</li>
重命名 <li class="menu-item menu-item__two" @click.stop="deleteTheClassification(item)">删除分类</li>
</li>
<li
class="menu-item menu-item__two"
@click.stop="deleteTheClassification(item)"
>
删除分类
</li>
</ul> </ul>
</li> </li>
<li class="add-the-classification" @click="addClassification"> <li class="add-the-classification" @click="addClassification">
...@@ -97,10 +81,7 @@ ...@@ -97,10 +81,7 @@
:key="index" :key="index"
@click="EnterPersonalTemplate(item)" @click="EnterPersonalTemplate(item)"
> >
<i <i class="iconfont icongengduocaozuo icon_menu" @click.stop="showMenu(index)"></i>
class="iconfont icongengduocaozuo icon_menu"
@click.stop="showMenu(index)"
></i>
<h2 class="title">{{ item.name }}</h2> <h2 class="title">{{ item.name }}</h2>
<ul <ul
class="menu" class="menu"
...@@ -108,37 +89,19 @@ ...@@ -108,37 +89,19 @@
@click="onMenuBlur" @click="onMenuBlur"
@mousedown.stop @mousedown.stop
> >
<li class="menu-item menu-item__one" @click.stop="dle(item, index)"> <li class="menu-item menu-item__one" @click.stop="dle(item, index)">删除</li>
删除 <li class="menu-item menu-item__two" @click.stop="copy(item)">创建副本</li>
</li>
<li class="menu-item menu-item__two" @click.stop="copy(item)">
创建副本
</li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<!-- 添加分类 --> <!-- 添加分类 -->
<common-dialog <common-dialog v-if="ClassificationPopups" @closePopup="ClassificationPopups = false" showMask>
v-if="ClassificationPopups" <category-add @close="ClassificationPopups = false" @successCallback="successCallback"></category-add>
@closePopup="ClassificationPopups = false"
showMask
>
<category-add
@close="ClassificationPopups = false"
@successCallback="successCallback"
></category-add>
</common-dialog> </common-dialog>
<!-- 添加模板 --> <!-- 添加模板 -->
<common-dialog <common-dialog v-if="AddTemplatePopups" @closePopup="AddTemplatePopups = false" showMask>
v-if="AddTemplatePopups" <add-template @close="AddTemplatePopups = false" @successCallback="addSuccess" />
@closePopup="AddTemplatePopups = false"
showMask
>
<add-template
@close="AddTemplatePopups = false"
@successCallback="addSuccess"
/>
</common-dialog> </common-dialog>
<!-- CopyShow --> <!-- CopyShow -->
<common-dialog v-if="CopyShow" @closePopup="CopyShow = false" showMask> <common-dialog v-if="CopyShow" @closePopup="CopyShow = false" showMask>
...@@ -160,12 +123,12 @@ ...@@ -160,12 +123,12 @@
</template> </template>
<script> <script>
import CopyTemplate from "@/components/TemplateManage/CopyTemplate.vue"; import copyTemplate from "../../components/copyTemplate/copyTemplate.vue";
import CommonDialog from "@/components/CommonDialog.vue"; import CommonDialog from "@/components/CommonDialog.vue";
import rename from "@/components/TemplateManage/rename.vue"; import rename from "../../components/rename/rename.vue";
import SearchBar from "@/components/TemplateManage/SearchBar.vue"; import SearchBar from "@/components/TemplateManage/SearchBar.vue";
import CategoryAdd from "@/components/TemplateManage/CategoryAdd.vue"; import categoryAdd from "../../components/categoryAdd/categoryAdd.vue";
import AddTemplate from "@/components/TemplateManage/AddTemplate.vue"; import addTemplate from "../../components/addTemplate/addTemplate.vue";
import { GO_URLS } from "@/config/URLS"; import { GO_URLS } from "@/config/URLS";
export default { export default {
data() { data() {
...@@ -185,16 +148,16 @@ export default { ...@@ -185,16 +148,16 @@ export default {
classIndex: -1, classIndex: -1,
renameShow: false, renameShow: false,
itemName: "", itemName: "",
itemID: -1, itemID: -1
}; };
}, },
components: { components: {
SearchBar, SearchBar,
CategoryAdd, categoryAdd,
CommonDialog, CommonDialog,
AddTemplate, addTemplate,
CopyTemplate, copyTemplate,
rename, rename
}, },
computed: { computed: {
//个人模板or系统模板>选中效果 //个人模板or系统模板>选中效果
...@@ -203,7 +166,7 @@ export default { ...@@ -203,7 +166,7 @@ export default {
}, },
TemplateDate() { TemplateDate() {
return this.$store.getters.get_templateData; return this.$store.getters.get_templateData;
}, }
}, },
created() { created() {
if (this.TemplateType === 0) { if (this.TemplateType === 0) {
...@@ -234,13 +197,13 @@ export default { ...@@ -234,13 +197,13 @@ export default {
url: GO_URLS.deleteFolder, url: GO_URLS.deleteFolder,
type: "DELETE", type: "DELETE",
params: { params: {
id: item.id, id: item.id
}, }
}); });
if (res) { if (res) {
this.$message({ this.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!"
}); });
this.getFolderList(); this.getFolderList();
} }
...@@ -261,14 +224,14 @@ export default { ...@@ -261,14 +224,14 @@ export default {
type: "delete", type: "delete",
url: GO_URLS.deleteCustomize, url: GO_URLS.deleteCustomize,
params: { params: {
id: id, id: id
}, }
}); });
if (res) { if (res) {
this.checkClassification = 0; this.checkClassification = 0;
this.$message({ this.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!"
}); });
this.onMenuBlur(); this.onMenuBlur();
} }
...@@ -278,7 +241,7 @@ export default { ...@@ -278,7 +241,7 @@ export default {
this.$confirm("此操作将永久删除该模板, 是否继续?", "提示", { this.$confirm("此操作将永久删除该模板, 是否继续?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning"
}) })
.then(() => { .then(() => {
this.deleteCustomize(item.id); this.deleteCustomize(item.id);
...@@ -287,7 +250,7 @@ export default { ...@@ -287,7 +250,7 @@ export default {
.catch(() => { .catch(() => {
this.$message({ this.$message({
type: "info", type: "info",
message: "已取消删除", message: "已取消删除"
}); });
}); });
}, },
...@@ -295,14 +258,14 @@ export default { ...@@ -295,14 +258,14 @@ export default {
EnterPersonalTemplate(item) { EnterPersonalTemplate(item) {
this.$router.push({ this.$router.push({
path: "/editTemplate", path: "/editTemplate",
query: { personalTemplate: item.id }, query: { personalTemplate: item.id }
}); });
}, },
// 进入系统模板 // 进入系统模板
EnterSystemTemplate(item) { EnterSystemTemplate(item) {
this.$router.push({ this.$router.push({
path: "/editTemplate", path: "/editTemplate",
query: { systemTemplateId: item.id }, query: { systemTemplateId: item.id }
}); });
}, },
addSuccess(val) { addSuccess(val) {
...@@ -330,8 +293,8 @@ export default { ...@@ -330,8 +293,8 @@ export default {
type: "post", type: "post",
url: GO_URLS.personalList, url: GO_URLS.personalList,
params: { params: {
id: [id], id: [id]
}, }
}); });
if (res) { if (res) {
if (res.data.results[0].detail) { if (res.data.results[0].detail) {
...@@ -370,8 +333,8 @@ export default { ...@@ -370,8 +333,8 @@ export default {
params: { params: {
page: 1, page: 1,
page_size: 100, page_size: 100,
template_type: 1, template_type: 1
}, }
}); });
if (res) { if (res) {
this.MyCategories = res.data.results; this.MyCategories = res.data.results;
...@@ -423,7 +386,7 @@ export default { ...@@ -423,7 +386,7 @@ export default {
async listOfSystem() { async listOfSystem() {
const res = await this.$ajax({ const res = await this.$ajax({
url: GO_URLS.systemList, url: GO_URLS.systemList,
type: "post", type: "post"
}); });
if (res) { if (res) {
this.classificationList = res.data.results; this.classificationList = res.data.results;
...@@ -446,8 +409,8 @@ export default { ...@@ -446,8 +409,8 @@ export default {
url: GO_URLS.searchCustomize, url: GO_URLS.searchCustomize,
type: "post", type: "post",
params: { params: {
key: this.key, key: this.key
}, }
}); });
if (res) { if (res) {
if (res.data.results) { if (res.data.results) {
...@@ -456,8 +419,8 @@ export default { ...@@ -456,8 +419,8 @@ export default {
this.personalClassificationList = []; this.personalClassificationList = [];
} }
} }
}, }
}, }
}; };
</script> </script>
...@@ -478,7 +441,7 @@ header { ...@@ -478,7 +441,7 @@ header {
padding-right: 34px; padding-right: 34px;
} }
.header-label_l1--check { .header-label_l1--check {
color: #0CC399; color: #0cc399;
} }
.header-search { .header-search {
float: right; float: right;
...@@ -502,7 +465,7 @@ header { ...@@ -502,7 +465,7 @@ header {
cursor: pointer; cursor: pointer;
} }
.item-check { .item-check {
background: #0CC399; background: #0cc399;
color: white; color: white;
} }
} }
...@@ -538,7 +501,7 @@ header { ...@@ -538,7 +501,7 @@ header {
} }
.add-the-classification { .add-the-classification {
border-radius: 4px; border-radius: 4px;
color: #0CC399; color: #0cc399;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
cursor: pointer; cursor: pointer;
...@@ -565,7 +528,7 @@ header { ...@@ -565,7 +528,7 @@ header {
border: 1px solid white; border: 1px solid white;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
border: 1px solid #5779f4; border: 1px solid #0cc399;
.icon_menu { .icon_menu {
display: block; display: block;
} }
...@@ -612,7 +575,7 @@ header { ...@@ -612,7 +575,7 @@ header {
margin-top: 31px; margin-top: 31px;
} }
&:hover { &:hover {
border: 1px solid #5779f4; border: 1px solid #0cc399;
} }
} }
.menu { .menu {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment