knowledgeCategory.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div class="agent_page">
  3. <div class="title">类目管理</div>
  4. <div class="content adf">
  5. <div class="left">
  6. <div class="l_top adfacjb">
  7. <span>类目</span>
  8. <span @click="handleAddCategory">+</span>
  9. </div>
  10. <div class="categories">
  11. <div class="c_item" :class="{'active':index===cidx}" v-for="(item, index) in categoryList" :key="index" @click="handleSelecyCategory(item,index)">
  12. {{ item.name }}
  13. <el-popover placement="right" width="177" trigger="click">
  14. <div class="tl_czs">
  15. <div class="tlc_pre" @click.stop="handleEditCategory(item,index)">编辑类目</div>
  16. <div class="tlc_pre" @click.stop="handleDeleteCategory(item,index)">删除类目</div>
  17. </div>
  18. <i slot="reference" class="el-icon-more" style="font-size: 14px;color: #999; transform: rotate(90deg);" @click.stop="handleSetTeam(team,idx)"></i>
  19. </el-popover>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="right">
  24. <div class="r_name adfac" v-if="rightName">
  25. <span class="rn_mc">{{ rightName }}</span>
  26. <span class="rn_tip">共<span class="rn_num">{{ 3 }}</span>个文件</span>
  27. <span class="rn_tip"><span class="rn_num">{{ 0 }}</span>个文件审核中</span>
  28. </div>
  29. <div class="tulr_top adfacjb">
  30. <div class="tulrt_l adfacjb queryInput">
  31. <el-input v-model="queryParams.name" placeholder="请输入文件名称查询"></el-input>
  32. <img src="@/assets/images/agent/query_mini.png">
  33. </div>
  34. <div class="tulrt_r adf">
  35. <div class="tr_btn">批量管理</div>
  36. <div class="tr_btn">导入数据</div>
  37. </div>
  38. </div>
  39. <el-table :data="fileList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无文件" max-height="578px" style="margin-top: 24px;">
  40. <el-table-column label="序号" width="50">
  41. <template #default="scope">
  42. {{ scope.$index + 1 }}
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="文件名称" prop="aaa"></el-table-column>
  46. <el-table-column label="状态" prop="bbb">
  47. <template #default="{ row }"></template>
  48. </el-table-column>
  49. <el-table-column label="数据来源" prop="aaa"></el-table-column>
  50. <el-table-column label="文件格式" prop="aaa"></el-table-column>
  51. <el-table-column label="上传时间" prop="aaa"></el-table-column>
  52. <el-table-column label="操作" width="150">
  53. <template #default="scope">
  54. <el-button link type="text" size="mini" @click="handleDetail(scope.row)">详情</el-button>
  55. <el-button link type="text" size="mini" @click="handleTag(scope.row)">标签</el-button>
  56. <el-button link type="text" size="mini" @click="handleDelete(scope.row)">删除</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <el-row style="display: flex;justify-content: center;">
  61. <el-pagination
  62. @size-change="handleSizeChange"
  63. @current-change="handleCurrentChange"
  64. :current-page="queryParams.page"
  65. :page-sizes="[5, 10, 20, 50]"
  66. :page-size="10"
  67. layout="total, sizes, prev, pager, next, jumper"
  68. :total="total"
  69. v-show="total > 0">
  70. </el-pagination>
  71. </el-row>
  72. </div>
  73. </div>
  74. <el-dialog width="30%" :visible.sync="categoryShow" :title="categoryTitle" @close="categoryShow=false">
  75. <el-form ref="categoryRef" :model="categoryForm" :rules="categoryRules" label-width="90px" style="width: 90%;margin: 0 auto;">
  76. <el-form-item label="类目名称" prop="name">
  77. <el-input v-model="categoryForm.name" placeholder="请输入类目名称" />
  78. </el-form-item>
  79. </el-form>
  80. <div class="demo-drawer__footer" style="display: flex;justify-content: end;margin-top: 100px;">
  81. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
  82. <el-button @click="cancel" style="margin-right: 5%;">取 消</el-button>
  83. </div>
  84. </el-dialog>
  85. </div>
  86. </template>
  87. <script setup name="">
  88. import { ref, getCurrentInstance } from 'vue'
  89. const { proxy } = getCurrentInstance();
  90. const cidx = ref('');
  91. const categoryList = ref([
  92. {id:1,name:'高企的发展路径'},
  93. {id:2,name:'团队管理'},
  94. {id:3,name:'默认类目'}
  95. ]);
  96. const rightName = ref('');
  97. const queryParams = ref({
  98. page:1,
  99. limit:10,
  100. name: ''
  101. })
  102. const fileList = ref([]);
  103. const total = ref(0);
  104. const loading = ref(false);
  105. const categoryShow = ref(false);
  106. const categoryTitle = ref('新增类目');
  107. const categoryForm = ref({
  108. name: ''
  109. });
  110. const categoryRules = ref({
  111. name: [
  112. { required: true, message: '请输入类目名称', trigger: 'blur' }
  113. ]
  114. });
  115. const buttonLoading = ref(false);
  116. const handleEditCategory = (item, index) => {
  117. categoryTitle.value = '编辑类目';
  118. Object.assign(categoryForm.value, item);
  119. cidx.value = index;
  120. categoryShow.value = true;
  121. }
  122. const handleDeleteCategory = (item, index) => {
  123. categoryList.value.splice(index,1);
  124. if (cidx.value === index) {
  125. rightName.value = '';
  126. } else if (cidx.value > index) {
  127. cidx.value--;
  128. }
  129. }
  130. const handleDetail = () => {
  131. proxy.$router.push('/file/detail')
  132. }
  133. const handleTag = () => {
  134. proxy.$router.push('/file/tag')
  135. }
  136. const submitForm = () => {
  137. proxy.$refs.categoryRef.validate((valid) => {
  138. if (valid) {
  139. buttonLoading.value = true;
  140. setTimeout(()=>{
  141. categoryList.value.push({id:categoryList.value.length+1,name:categoryForm.value.name});
  142. buttonLoading.value = false;
  143. categoryShow.value = false;
  144. },1000)
  145. } else {
  146. return false;
  147. }
  148. });
  149. }
  150. const cancel = () => {
  151. proxy.$refs.categoryRef.resetFields();
  152. categoryShow.value = false;
  153. }
  154. const handleAddCategory = () => {
  155. categoryShow.value = true;
  156. }
  157. const handleSelecyCategory = (item, index) => {
  158. cidx.value = index;
  159. rightName.value = item.name;
  160. }
  161. const getList = async () => {
  162. let query = {...queryParams.value};
  163. loading.value = true;
  164. // const res = await listOrder(query);
  165. // userList.value = res.data.list;
  166. // total.value = res.data.total;
  167. loading.value = false;
  168. }
  169. const handleSizeChange = (e)=>{
  170. queryParams.value.limit = e;
  171. getList();
  172. }
  173. const handleCurrentChange = (e)=>{
  174. queryParams.value.page = e;
  175. getList();
  176. }
  177. </script>
  178. <style scoped lang="scss">
  179. ::v-deep .queryInput .el-input__inner{
  180. border: none !important;
  181. height: 30px !important;
  182. line-height: 30px !important;
  183. padding: 0 !important;
  184. width: 200px !important;
  185. }
  186. :v-deep .el-dialog__wrapper{
  187. background: rgba(0,0,0,.3) !important;
  188. }
  189. ::v-deep .el-dialog__title{
  190. font-weight: bold !important;
  191. }
  192. ::v-deep .el-dialog{
  193. margin-top: 15vh !important;
  194. }
  195. ::v-deep .el-drawer__header span{
  196. font-weight: bold;
  197. font-size: 16px;
  198. color: #1D2129;
  199. line-height: 22px;
  200. }
  201. .agent_page{
  202. .title{
  203. width: 100%;
  204. height: 70px;
  205. padding: 30px 20px;
  206. box-sizing: border-box;
  207. border-bottom: 1px solid #ECEEF5;
  208. font-family: PingFang-SC, PingFang-SC;
  209. font-weight: bold;
  210. font-size: 16px;
  211. color: #111111;
  212. line-height: 16px;
  213. }
  214. .content{
  215. width: 100%;
  216. height: calc(100% - 71px);
  217. .left{
  218. width: 286px;
  219. height: 100%;
  220. overflow-y: auto;
  221. border-right: 1px solid #ECEEF5;
  222. padding: 37px 22px;
  223. box-sizing: border-box;
  224. .l_top{
  225. span{
  226. font-family: PingFangSC, PingFang SC;
  227. font-weight: 400;
  228. font-size: 16px;
  229. color: #111111;
  230. line-height: 14px;
  231. &:last-child{
  232. font-size: 20px;
  233. color: #33A7A7;
  234. cursor: pointer;
  235. }
  236. }
  237. }
  238. .categories{
  239. margin-top: 13px;
  240. .c_item{
  241. width: 100%;
  242. height: 36px;
  243. border-radius: 8px;
  244. font-family: PingFangSC, PingFang SC;
  245. font-weight: 400;
  246. font-size: 14px;
  247. color: #111111;
  248. line-height: 36px;
  249. padding-left: 40px;
  250. box-sizing: border-box;
  251. position: relative;
  252. cursor: pointer;
  253. &:hover,&.active{
  254. background: #F0F2F8;
  255. color: #33A7A7;
  256. i{
  257. color: #33A7A7 !important;
  258. }
  259. }
  260. i{
  261. position: absolute;
  262. right: 10px;
  263. top: 12px;
  264. }
  265. }
  266. }
  267. }
  268. .right{
  269. width: calc(100% - 286px);
  270. height: 100%;
  271. padding: 37px 22px;
  272. box-sizing: border-box;
  273. .r_name{
  274. margin-bottom: 20px;
  275. .rn_mc{
  276. font-family: PingFangSC, PingFang SC;
  277. font-weight: 400;
  278. font-size: 16px;
  279. color: #111111;
  280. line-height: 16px;
  281. }
  282. .rn_tip{
  283. font-family: PingFangSC, PingFang SC;
  284. font-weight: 400;
  285. font-size: 14px;
  286. color: #9CA3AF;
  287. line-height: 14px;
  288. margin-left: 8px;
  289. &:last-child{
  290. margin-left: 24px;
  291. }
  292. .rn_num{
  293. color: #1D2129;
  294. margin: 0 2px;
  295. }
  296. }
  297. }
  298. .tulr_top{
  299. .tulrt_l{
  300. width: 278px;
  301. height: 34px;
  302. border-radius: 6px;
  303. border: 1px solid #E2E7F5;
  304. padding: 0 16px;
  305. box-sizing: border-box;
  306. img{
  307. width: 16px;
  308. height: 16px;
  309. cursor: pointer;
  310. }
  311. }
  312. .tulrt_r{
  313. .tr_btn{
  314. width: 92px;
  315. height: 36px;
  316. border-radius: 6px;
  317. border: 1px solid #C1C7D2;
  318. margin-left: 20px;
  319. cursor: pointer;
  320. font-family: PingFangSC, PingFang SC;
  321. font-weight: 400;
  322. font-size: 14px;
  323. color: #111111;
  324. line-height: 36px;
  325. text-align: center;
  326. &:last-child{
  327. background: #33A7A7;
  328. color: #FFFFFF;
  329. }
  330. }
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .tl_czs{
  337. .tlc_pre{
  338. font-family: PingFangSC, PingFang SC;
  339. font-weight: 400;
  340. font-size: 14px;
  341. color: #1D2129;
  342. line-height: 20px;
  343. padding: 12px 0;
  344. border-bottom: 1px solid #ECEEF5;
  345. cursor: pointer;
  346. &:first-child{
  347. padding-top: 0;
  348. }
  349. &:last-child{
  350. border: none;
  351. padding-bottom: 0;
  352. }
  353. &:hover{
  354. color: #33A7A7;
  355. }
  356. }
  357. }
  358. </style>