|
@@ -1,31 +1,16 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
+ <el-tabs v-model="activeTab" @tab-click="handleTabClick">
|
|
|
|
+ <el-tab-pane
|
|
|
|
+ v-for="item in tagModelOptions"
|
|
|
|
+ :key="item.code"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :name="item.code">
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
- <el-form-item label="标签分类" prop="tagModel">
|
|
|
|
- <el-select v-model="queryParams.tagModel">
|
|
|
|
- <el-option v-for="item in tagModelOptions" :label="item.name" :value="item.code" :key="item.code" />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="标签代码" prop="tagCode">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.tagCode"
|
|
|
|
- placeholder="请输入标签代码"
|
|
|
|
- clearable
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="标签名称" prop="tagName">
|
|
|
|
- <el-input
|
|
|
|
- v-model="queryParams.tagName"
|
|
|
|
- placeholder="请输入标签名称"
|
|
|
|
- clearable
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+<!-- <el-form-item>-->
|
|
|
|
+<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
|
|
|
|
+<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
|
|
|
|
+<!-- </el-form-item>-->
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
@@ -76,13 +61,19 @@
|
|
|
|
|
|
<el-table v-loading="loading" :data="tagList" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" :data="tagList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
- <el-table-column label="标签分类" align="center" prop="tagModel" >
|
|
|
|
|
|
+<!-- <el-table-column label="标签分类" align="center" prop="tagModel" >-->
|
|
|
|
+<!-- <template slot-scope="scope">-->
|
|
|
|
+<!-- <span>{{ getTagModelName(scope.row.tagModel)}}</span>-->
|
|
|
|
+<!-- </template>-->
|
|
|
|
+<!-- </el-table-column>-->
|
|
|
|
+ <el-table-column label="标签代码" align="center" prop="tagCode" />
|
|
|
|
+ <el-table-column label="标签名称" align="center" prop="tagName" />
|
|
|
|
+ <el-table-column label="标签颜色" align="center" prop="tagColor" >
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span>{{ getTagModelName(scope.row.tagModel)}}</span>
|
|
|
|
|
|
+ <div v-if="scope.row.tagColor" class="color-display" :style="{ backgroundColor: scope.row.tagColor }"></div>
|
|
|
|
+ <div v-else>暂无颜色</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="标签代码" align="center" prop="tagCode" />
|
|
|
|
- <el-table-column label="标签名称" align="center" prop="tagName" />
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
@@ -91,15 +82,19 @@
|
|
icon="el-icon-edit"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate(scope.row)"
|
|
@click="handleUpdate(scope.row)"
|
|
v-hasPermi="['ems:tag:edit']"
|
|
v-hasPermi="['ems:tag:edit']"
|
|
- >修改</el-button>
|
|
|
|
- <el-button size="mini"
|
|
|
|
- type="text"
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
- class="deleteBtn"
|
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
|
- v-hasPermi="['basecfg:tag:remove']">
|
|
|
|
- 删除</el-button>
|
|
|
|
-
|
|
|
|
|
|
+ v-if="scope.row.modFlag === 1">
|
|
|
|
+ 修改
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ class="deleteBtn"
|
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
|
+ v-hasPermi="['basecfg:tag:remove']"
|
|
|
|
+ v-if="scope.row.modFlag === 1">
|
|
|
|
+ 删除
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -111,21 +106,29 @@
|
|
:limit.sync="queryParams.pageSize"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
/>
|
|
/>
|
|
-
|
|
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ </el-tabs>
|
|
<!-- 添加或修改标签分类对话框 -->
|
|
<!-- 添加或修改标签分类对话框 -->
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
- <el-form-item label="标签分类" prop="tagModel">
|
|
|
|
- <el-select v-model="form.tagModel" >
|
|
|
|
- <el-option v-for="item in tagModelOptions" :label="item.name" :value="item.code" :key="item.code" />
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
<el-form-item label="标签代码" prop="tagCode">
|
|
<el-form-item label="标签代码" prop="tagCode">
|
|
<el-input v-model="form.tagCode" placeholder="请输入标签代码" />
|
|
<el-input v-model="form.tagCode" placeholder="请输入标签代码" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="标签名称" prop="tagName">
|
|
<el-form-item label="标签名称" prop="tagName">
|
|
<el-input v-model="form.tagName" placeholder="请输入标签名称" />
|
|
<el-input v-model="form.tagName" placeholder="请输入标签名称" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="标签颜色" prop="tagColor">
|
|
|
|
+ <el-color-picker
|
|
|
|
+ v-model="form.tagColor"
|
|
|
|
+ show-alpha
|
|
|
|
+ :predefine="predefineColors">
|
|
|
|
+ </el-color-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <!-- 隐藏的mod_flag字段 -->
|
|
|
|
+ <el-form-item label-hidden>
|
|
|
|
+ <el-input v-model="form.modFlag" type="hidden"></el-input>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -164,16 +167,27 @@ export default {
|
|
tagModelOptions: [
|
|
tagModelOptions: [
|
|
{"code": "Area", "name": "区域标签"}
|
|
{"code": "Area", "name": "区域标签"}
|
|
],
|
|
],
|
|
|
|
+ // 当前激活的标签分类
|
|
|
|
+ activeTab: 'Area',
|
|
// 查询参数
|
|
// 查询参数
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
tagModel: null,
|
|
tagModel: null,
|
|
tagCode: null,
|
|
tagCode: null,
|
|
- tagName: null
|
|
|
|
|
|
+ tagName: null,
|
|
|
|
+ modFlag:null,
|
|
|
|
+ tagColor:''
|
|
},
|
|
},
|
|
// 表单参数
|
|
// 表单参数
|
|
- form: {},
|
|
|
|
|
|
+ form: {
|
|
|
|
+ id: null,
|
|
|
|
+ tagModel: null, // 默认值为null,将在打开弹框时设置
|
|
|
|
+ tagCode: null,
|
|
|
|
+ tagName: null,
|
|
|
|
+ modFlag:null,
|
|
|
|
+ tagColor:''
|
|
|
|
+ },
|
|
// 表单校验
|
|
// 表单校验
|
|
rules: {
|
|
rules: {
|
|
tagModel: [
|
|
tagModel: [
|
|
@@ -185,7 +199,23 @@ export default {
|
|
tagName: [
|
|
tagName: [
|
|
{ required: true, message: "标签名称不能为空", trigger: "blur" }
|
|
{ required: true, message: "标签名称不能为空", trigger: "blur" }
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ predefineColors: [
|
|
|
|
+ '#ff4500',
|
|
|
|
+ '#ff8c00',
|
|
|
|
+ '#ffd700',
|
|
|
|
+ '#90ee90',
|
|
|
|
+ '#00ced1',
|
|
|
|
+ '#1e90ff',
|
|
|
|
+ '#c71585',
|
|
|
|
+ 'rgba(255, 69, 0, 0.68)',
|
|
|
|
+ 'rgb(255, 120, 0)',
|
|
|
|
+ 'hsv(51, 100, 98)',
|
|
|
|
+ 'hsva(120, 40, 94, 0.5)',
|
|
|
|
+ 'hsl(181, 100%, 37%)',
|
|
|
|
+ 'hsla(209, 100%, 56%, 0.73)',
|
|
|
|
+ '#c7158577'
|
|
|
|
+ ],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -212,7 +242,9 @@ export default {
|
|
id: null,
|
|
id: null,
|
|
tagModel: null,
|
|
tagModel: null,
|
|
tagCode: null,
|
|
tagCode: null,
|
|
- tagName: null
|
|
|
|
|
|
+ tagName: null,
|
|
|
|
+ modFlag:null,
|
|
|
|
+ tagColor:''
|
|
};
|
|
};
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
},
|
|
},
|
|
@@ -231,12 +263,17 @@ export default {
|
|
this.ids = selection.map(item => item.id)
|
|
this.ids = selection.map(item => item.id)
|
|
this.single = selection.length!==1
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
this.multiple = !selection.length
|
|
|
|
+
|
|
},
|
|
},
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
handleAdd() {
|
|
this.reset();
|
|
this.reset();
|
|
this.open = true;
|
|
this.open = true;
|
|
this.title = "添加标签分类";
|
|
this.title = "添加标签分类";
|
|
|
|
+ // 设置默认的标签分类
|
|
|
|
+ console.log("this.activeTab",this.activeTab)
|
|
|
|
+ this.form.tagModel = this.activeTab;
|
|
|
|
+ this.form.modFlag = 1;
|
|
},
|
|
},
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
@@ -244,6 +281,7 @@ export default {
|
|
const id = row.id || this.ids
|
|
const id = row.id || this.ids
|
|
getTag(id).then(response => {
|
|
getTag(id).then(response => {
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
|
|
+ this.form.tagModel = this.activeTab; // 设置默认的标签分类
|
|
this.open = true;
|
|
this.open = true;
|
|
this.title = "修改标签分类";
|
|
this.title = "修改标签分类";
|
|
});
|
|
});
|
|
@@ -253,12 +291,14 @@ export default {
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
if (this.form.id != null) {
|
|
|
|
+ console.log("this.form",this.form)
|
|
updateTag(this.form).then(response => {
|
|
updateTag(this.form).then(response => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.open = false;
|
|
this.getList();
|
|
this.getList();
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
|
|
+ console.log("this.form",this.form)
|
|
addTag(this.form).then(response => {
|
|
addTag(this.form).then(response => {
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.open = false;
|
|
@@ -289,7 +329,19 @@ export default {
|
|
"Area": "区域标签"
|
|
"Area": "区域标签"
|
|
};
|
|
};
|
|
return modelMap[code] || '未知';
|
|
return modelMap[code] || '未知';
|
|
|
|
+ },
|
|
|
|
+ handleTabClick(tab) {
|
|
|
|
+ this.activeTab = tab.name;
|
|
|
|
+ this.getList();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
+<style lang="css">
|
|
|
|
+.color-display {
|
|
|
|
+ width: 20px;
|
|
|
|
+ height: 20px;
|
|
|
|
+ border-radius: 2px;
|
|
|
|
+ display: inline-block;
|
|
|
|
+}
|
|
|
|
+</style>
|