张阿敏 2 years ago
parent
commit
39d8e1e7a2

+ 1 - 0
.env.development

@@ -5,6 +5,7 @@ VUE_APP_ENV = 'development'
 
 # base api
 VUE_APP_BASE_API = 'http://localhost:8060'
+# VUE_APP_BASE_API = 'http://api.dev.xueping.com'
 
 VUE_APP_TOKEN_KEY = 'test-d8be869c3765fa62aee8120a4798385a'
 

+ 2 - 1
.env.testing

@@ -6,7 +6,8 @@ ENV = 'testing'
 VUE_APP_ENV = 'testing'
 
 # base api
-VUE_APP_BASE_API = 'https://o-test-sino-mark.meetsocial.cn'
+# VUE_APP_BASE_API = 'https://o-test-sino-mark.meetsocial.cn'
+VUE_APP_BASE_API = 'http://api.dev.xueping.com'
 
 VUE_APP_TOKEN_KEY = 'test-d8be869c3765fa62aee8120a4798385a'
 

BIN
public/template/链接模板.xlsx


+ 17 - 0
src/api/label.js

@@ -0,0 +1,17 @@
+import http from '@/utils/http'
+
+export function add(reqDTO) {
+  return http.post('/label/add', reqDTO)
+}
+
+export function edit(reqDTO) {
+  return http.put('/label/edit', reqDTO)
+}
+
+export function remove(id) {
+  return http.delete(`/label/delete/${id}`)
+}
+
+export function getPage(reqDTO) {
+  return http.post('/label/page', reqDTO)
+}

+ 5 - 0
src/api/system/user.js

@@ -80,3 +80,8 @@ export function getInnerUserInfo(account) {
 export function innerLogin() {
   return http.post('/sys-user/inner-login')
 }
+
+// 内部用户部门列表
+export function getInnerDepartmentsApi() {
+  return http.get('/sys-user/inner/departments')
+}

+ 11 - 0
src/permission/permission-label.js

@@ -0,0 +1,11 @@
+export default {
+}
+
+export const LABEL_PERMS = {
+  add: 'add-label',
+  edit: 'edit-label',
+  delete: 'delete-label'
+}
+
+
+

+ 11 - 2
src/router/index.js

@@ -130,16 +130,25 @@ export const asyncRoutes = [
       permission: 'category-management'
     },
     alwaysShow: true,
-    redirect: '/category',
+    redirect: '/category/index',
     children: [
       {
-        path: '',
+        path: '/index',
         component: () => import('@/views/category/index'),
         name: 'CategoryManagement',
         meta: {
           title: '分类设置',
           permission: 'category-management-page'
         }
+      },
+      {
+        path: '/label',
+        component: () => import('@/views/category/Label'),
+        name: 'LabelManagement',
+        meta: {
+          title: '标签设置',
+          permission: 'label-management'
+        }
       }
     ]
   },

+ 290 - 0
src/views/category/Label.vue

@@ -0,0 +1,290 @@
+<template>
+  <div id="label-wrap" class="label-wrap">
+    <el-card>
+      <el-input
+        v-model="queryForm.name"
+        clearable
+        size="small"
+        class="label-search-input"
+        placeholder="标签名称"
+      />
+      <el-button size="small" style="margin-left: 10px" type="primary" icon="el-icon-search" :loading="searchBtnLoading"
+                 @click="search">
+        搜索
+      </el-button>
+      <el-button
+        v-if="checkPermission(LABEL_PERMS.add)"
+        type="primary"
+        size="small"
+        @click="addLabel()"
+      >
+        新增
+      </el-button>
+    </el-card>
+    <el-card style="margin-top: 10px;">
+      <el-table
+        v-loading="searchBtnLoading"
+        size="small"
+        :data="labelPage"
+        border
+        fit
+        highlight-current-row
+      >
+        <el-table-column label="序号" align="center" min-width="15">
+          <template slot-scope="scope">
+            {{ scope.$index + 1 }}
+          </template>
+        </el-table-column>
+        <el-table-column label="标签名称" prop="name" align="center" min-width="100"/>
+        <el-table-column label="可选项" prop="labelItemNames" align="center" min-width="100">
+          <template slot-scope="scope">
+            <el-select v-model="scope.row.labelItem" size="small">
+              <el-option
+                v-for="(item,index) in scope.row.labelItemNames"
+                :key="index"
+                :label="item"
+                :value="item"
+              />
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column label="添加时间" prop="createTime" align="center" min-width="100"/>
+        <el-table-column label="添加人" prop="createName" align="center" min-width="100"/>
+        <el-table-column label="操作" align="center" min-width="100">
+          <template slot-scope="scope">
+            <el-button
+              v-if="checkPermission(LABEL_PERMS.edit)"
+              size="small"
+              type="text"
+              @click="showEdit(scope.row)"
+            >
+              编辑
+            </el-button>
+            <el-button
+              v-if="checkPermission(LABEL_PERMS.delete)"
+              size="small"
+              type="text"
+              @click="remove(scope.row.id)"
+            >
+              删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        class="pagination"
+        background
+        :current-page.sync="queryForm.pageNum"
+        layout="total, prev, pager, next"
+        :total="total"
+        @current-change="changePage"
+      />
+    </el-card>
+
+    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="dataAddDlg.addVisible" width="30%">
+      <el-form ref="userForm" :model="label" :rules="rules" label-width="120px" class="demo-ruleForm">
+        <el-form-item label="标签名称" prop="name">
+          <el-input v-model="label.name" maxlength="45"/>
+        </el-form-item>
+        <div style="margin-bottom: 5px;">
+          <span style="color: red">*</span>
+          <span style="color: #409EFF; margin-left: 5px; margin-bottom: 5px; cursor: pointer;"
+                @click="addRow()">添加一行</span>
+        </div>
+        <el-table :data="labelItemNames" border fit highlight-current-row>
+          <el-table-column label="选项名称" align="center" min-width="100">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.name" maxlength="10"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center" min-width="100">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                size="small"
+                @click.native.prevent="deleteRow(scope.$index, labelItemNames)"
+              >
+                移除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dataAddDlg.addVisible = false">取消</el-button>
+        <el-button type="primary" :loading="dataAddDlg.saveBtnLoading" @click="saveLabel">提交</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {LABEL_PERMS} from '@/permission/permission-label'
+import permissionMixin from '../../mixins/permission-mixin'
+import {getPage, remove, add, edit} from '@/api/label'
+
+export default {
+  name: 'UserManagement',
+  components: {},
+  mixins: [permissionMixin],
+  data() {
+    return {
+      LABEL_PERMS,
+      title: null,
+      queryForm: {
+        name: null,
+        pageNum: 1
+      },
+      total: null,
+      searchBtnLoading: false,
+      dataAddDlg: {
+        addVisible: false,
+        saveBtnLoading: false
+      },
+      labelPage: [{
+        name: null,
+        labelItemNames: null,
+        labelItem: null,
+        createTime: null,
+        createName: null
+      }],
+      label: {
+        id: null,
+        name: '',
+        labelItemNames: ['']
+      },
+      labelItemNames: [{
+        name: ''
+      }],
+      rules: {
+        name: [
+          {required: true, message: '请输入标签名称!', trigger: 'blur'}
+        ]
+      }
+    }
+  },
+  computed: {},
+  mounted() {
+    this.search()
+  },
+  methods: {
+    search(pageNum) {
+      if (pageNum && pageNum > 0) {
+        this.queryForm.pageNum = pageNum
+      } else {
+        this.queryForm.pageNum = 1
+      }
+      this.searchBtnLoading = true
+      getPage(this.queryForm).then(res => {
+        console.log(res)
+        this.labelPage = res.result.result
+        this.labelPage.forEach(item => {
+          item.labelItem = item.labelItemNames[0]
+        })
+        this.total = Number(res.result.total)
+        this.searchBtnLoading = false
+      }, () => {
+        this.searchBtnLoading = false
+      })
+    },
+    changePage(page) {
+      this.search(page)
+    },
+    addLabel() {
+      this.title = '添加标签'
+      this.label = {
+        id: null,
+        name: '',
+        labelItemNames: ['']
+      }
+      this.labelItemNames = [{name: ''}]
+      this.dataAddDlg.addVisible = true
+    },
+    addRow() {
+      const obj = {name: ''}
+      if (this.labelItemNames.length < 8) {
+        this.labelItemNames.push(obj)
+      } else {
+        this.$message.error('最多只能添加10个选项!')
+      }
+    },
+    saveLabel() {
+      if (this.label.name === null || this.label.name === '' || this.label.name === undefined) {
+        this.$message.error('请输入标签名称!')
+        return
+      }
+      this.label.labelItemNames = []
+      const reg = /[^\w-\_^\u4E00-\u9FA5]/
+      for (let i = 0; i < this.labelItemNames.length; i++) {
+        if (this.labelItemNames[i].name === null || this.labelItemNames[i].name === '' || this.labelItemNames[i].name === undefined) {
+          this.$message.error('请输入选项名称!')
+          return
+        } else if (reg.test(this.labelItemNames[i].name)) {
+          this.$message.error('可选项只能输入中文,字母,数字,下划线,中划线!')
+          return
+        }
+        this.label.labelItemNames.push(this.labelItemNames[i].name)
+      }
+      this.dataAddDlg.saveBtnLoading = true
+      if (this.label.id !== null) {
+        edit(this.label).then(res => {
+          this.search()
+          this.dataAddDlg.saveBtnLoading = false
+          this.dataAddDlg.addVisible = false
+          this.$message.success('修改成功!')
+        }, () => {
+          this.dataAddDlg.saveBtnLoading = false
+        })
+      } else {
+        add(this.label).then(res => {
+          this.search()
+          this.dataAddDlg.saveBtnLoading = false
+          this.dataAddDlg.addVisible = false
+          this.$message.success('添加成功!')
+        }, () => {
+          this.dataAddDlg.saveBtnLoading = false
+        })
+      }
+    },
+    deleteRow(index, rows, row) {
+      if (this.labelItemNames.length === 1) {
+        this.$message.error('请最少保留一条明细!')
+        return
+      }
+      rows.splice(index, 1)
+    },
+    remove(id) {
+      this.$confirm('确认删除标签?', '提示', {type: 'warning'}).then(() => {
+        remove(id).then(res => {
+          this.search()
+          this.$message.success('移除成功!')
+        }, () => {
+        })
+      }, () => {
+      })
+    },
+    showEdit(row) {
+      this.title = '编辑标签'
+      this.label.id = row.id
+      this.label.name = row.name
+      this.labelItemNames = []
+      row.labelItemNames.forEach(item => {
+        const obj = {name: item}
+        this.labelItemNames.push(obj)
+      })
+      this.dataAddDlg.addVisible = true
+    }
+  }
+}
+</script>
+<style lang="scss" scoped="">
+.label-wrap {
+  .label-search-input {
+    width: 200px;
+    margin-left: 5px;
+  }
+}
+</style>
+<style lang="scss">
+
+</style>

+ 16 - 2
src/views/resource/addResource.vue

@@ -46,7 +46,7 @@
           <div style="color: black"><strong>上传格式说明:</strong></div>
           <br/>
           <div>上传格式为json 格式</div>
-          <div>{"data":{"txtsource":"文本内容","hint":"这是一段注释或参考文本内容"}}}</div>
+          <div>{"data":{"txtsource":"文本内容","hint":"这是一段注释或参考文本内容"}}</div>
           <div style="color: black"><strong>例如:</strong></div>
           <br/>
           <div>{"data":{"txtsource":"NBA篮球赛场馆广告","hint":"参考标注 篮球"}}</div>
@@ -74,6 +74,14 @@
           <div>{"data":{"movsource":"oss://****.oss-cn-hangzhou.aliyuncs.com/iTAG/pic/1.mp4","hint":"参考标注 篮球"}}</div>
           <div>{"data":{"movsource":"oss://****.oss-cn-hangzhou.aliyuncs.com/iTAG/pic/10.avi","hint":"参考标注 篮球"}}</div>
         </div>
+        <div style="margin-left: 200px" v-if="resourceBaseInfo.type === 3">
+          <div style="color: black"><strong>上传格式说明:</strong></div>
+          <br/>
+          <div>文件格式为xls或者xlsx</div>
+          <div>
+            <el-button type="text" @click="downloadTemplate">点击下载模板</el-button>
+          </div>
+        </div>
       </div>
     </el-card>
     <el-dialog :close-on-click-modal="false" title="预览结果" :visible.sync="showVisible" width="800px"
@@ -160,8 +168,14 @@ export default {
       }, err => {
         this.uploadLoading = false
       })
+    },
+    downloadTemplate() {
+      const a = document.createElement('a')
+      a.href = '/template/链接模板.xlsx'
+      a.download = '链接模板'
+      a.click()
     }
-  },
+  }
 
 }
 </script>

+ 2 - 1
src/views/resource/index.vue

@@ -163,7 +163,8 @@ export default {
       typeList: [
         {value: 0, label: '文本'},
         {value: 1, label: '图片'},
-        {value: 2, label: '视频'}
+        {value: 2, label: '视频'},
+        {value: 3, label: '链接'}
       ],
       searchBtnLoading: false,
       addVisible: false,

+ 19 - 4
src/views/system/user/addInnerUserPage.vue

@@ -23,6 +23,11 @@
             <el-checkbox v-for="role in roleList" :label="role.roleId" :key="role.roleId">{{role.name}}</el-checkbox><br/>
           </el-checkbox-group>
         </el-form-item>
+        <el-form-item label="用户部门:" label-width="120px" prop="status">
+          <el-radio-group v-model="addUserForm.deptId">
+            <el-radio v-for="dept in departments" :key="dept.id" :label="dept.id">{{ dept.name }}</el-radio>
+          </el-radio-group>
+        </el-form-item>
         <el-form-item label="是否作废:" label-width="120px" prop="status">
           <el-radio v-model="addUserForm.status" label="0">正常</el-radio>
           <el-radio v-model="addUserForm.status" label="1">作废</el-radio>
@@ -37,7 +42,7 @@
 </template>
 
 <script>
-import {addInnerUser,getInnerUserInfo} from "@/api/system/user";
+import {addInnerUser, getInnerDepartmentsApi, getInnerUserInfo} from "@/api/system/user";
 
 export default {
   name: "AddInnerUserPage",
@@ -48,17 +53,20 @@ export default {
         account: '',
         userName: '',
         status: '0',
-        roleIds:[]
+        roleIds:[],
+        deptId: 0
       },
       roleList:[
         {roleId:6,name:'标注员(内部)'},
         {roleId:5,name:'资源管理负责人 '},
         {roleId:4,name:'分类管理负责人'},
+        {roleId:8,name:'标签配置负责人'},
         {roleId:3,name:'任务分配负责人'},
         {roleId:2,name:'人员管理负责人'}
       ],
       userDetail: {},
-      addBtnLoading: false
+      addBtnLoading: false,
+      departments: []
     }
   },
   mounted() {
@@ -66,11 +74,13 @@ export default {
   },
   methods: {
     initForm() {
+      this.getInnerDepartments()
       this.addUserForm = {
         account: '',
         userName: '',
         status: '0',
-        roleIds:[]
+        roleIds:[],
+        deptId: '1'
       }
       this.addUserForm.roleIds.push(6)
     },
@@ -115,6 +125,11 @@ export default {
         this.$router.push({name: 'UserManagement', params: {flush: val}})
       })
     },
+    getInnerDepartments() {
+      getInnerDepartmentsApi().then(res => {
+        this.departments = res.result
+      })
+    }
   }
 }
 </script>

+ 21 - 6
src/views/system/user/editInnerUserPage.vue

@@ -25,6 +25,11 @@
             <br/>
           </el-checkbox-group>
         </el-form-item>
+        <el-form-item label="用户部门:" label-width="120px" prop="status">
+          <el-radio-group v-model="editUserForm.deptId">
+            <el-radio v-for="dept in departments" :key="dept.id" :label="dept.id">{{ dept.name }}</el-radio>
+          </el-radio-group>
+        </el-form-item>
         <el-form-item label="是否作废:" label-width="120px" prop="status">
           <el-radio v-model="editUserForm.status" label="0">正常</el-radio>
           <el-radio v-model="editUserForm.status" label="1">作废</el-radio>
@@ -39,7 +44,7 @@
 </template>
 
 <script>
-import {editInnerUser, getInnerUserInfo, getUserById} from "@/api/system/user";
+import {editInnerUser, getInnerUserInfo, getUserById, getInnerDepartmentsApi} from "@/api/system/user";
 
 export default {
   name: "EditInnerUserPage",
@@ -50,17 +55,20 @@ export default {
         account: '',
         userName: '',
         status: '0',
-        roleIds: []
+        roleIds: [],
+        deptId: 0
       },
       roleList: [
         {roleId: '6', name: '标注员(内部)'},
         {roleId: '5', name: '资源管理负责人 '},
         {roleId: '4', name: '分类管理负责人'},
+        {roleId: '8', name:'标签配置负责人'},
         {roleId: '3', name: '任务分配负责人'},
         {roleId: '2', name: '人员管理负责人'}
       ],
       userDetail: {},
-      addBtnLoading: false
+      addBtnLoading: false,
+      departments: []
     }
   },
   mounted() {
@@ -78,18 +86,20 @@ export default {
         account: '',
         userName: '',
         status: '0',
-        roleIds: []
+        roleIds: [],
+        deptId: 0
       }
+      this.getInnerDepartments()
     },
     fetchUserDetail(userId) {
       getUserById(userId).then(res => {
         this.userDetail = res.result;
-        console.log(res.result)
         this.editUserForm = {
           account: this.userDetail.account,
           userName: this.userDetail.userName,
           status: String(this.userDetail.status),
-          roleIds: res.result.roleIds
+          roleIds: this.userDetail.roleIds,
+          deptId: this.userDetail.deptId
         }
       })
     },
@@ -134,6 +144,11 @@ export default {
         this.$router.push({name: 'UserManagement', params: {flush: val}})
       })
     },
+    getInnerDepartments() {
+      getInnerDepartmentsApi().then(res => {
+        this.departments = res.result
+      })
+    }
   }
 }
 </script>

+ 16 - 0
src/views/system/user/index.vue

@@ -98,6 +98,7 @@
         <el-table-column label="账号" prop="account" align="center" min-width="100"/>
         <el-table-column label="人员名称" prop="userName" align="center" min-width="100"/>
         <el-table-column label="来源渠道" prop="userTypeName" align="center" min-width="100"></el-table-column>
+        <el-table-column label="部门" prop="deptName" align="center" min-width="100"/>
         <el-table-column label="状态" prop="statusName" align="center" min-width="100"/>
         <el-table-column label="注册时间" prop="createTimeStr" align="center" min-width="100"/>
         <el-table-column label="人员角色" prop="userRoleNames" align="center" min-width="100"/>
@@ -204,8 +205,23 @@ export default {
       ]
     }
   },
+  beforeRouteEnter(to, from, next) {
+    if (to.params.flush || to.query.flush) {
+      next(vm => {
+        if (!vm.initial) {
+          vm.search()
+        }
+        vm.initial = false
+      })
+    } else {
+      next(vm => {
+        vm.initial = false
+      })
+    }
+  },
   mounted() {
     this.search()
+    this.initial = true
   },
   methods: {
     search() {