148 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			148 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <section class="Setting">
 | |
|     <ai-list>
 | |
|       <template slot="title">
 | |
|         <ai-title title="工单特征库" isShowBack isShowBottomBorder @onBackClick="cancel"></ai-title>
 | |
|       </template>
 | |
|       <template #content>
 | |
|         <ai-search-bar>
 | |
|           <template #left>
 | |
|             <el-button size="small" type="primary" icon="iconfont iconAdd" @click="edit()">添加</el-button>
 | |
|           </template>
 | |
|           <template #right>
 | |
|             <el-input size="small" placeholder="特征词搜索" v-model="search.keywords" clearable
 | |
|                       @clear="search.current = 1, search.keywords = '', getTableData()"
 | |
|                       suffix-icon="iconfont iconSearch"
 | |
|                       v-throttle="() => {(search.current = 1), getTableData();}"/>
 | |
|           </template>
 | |
|         </ai-search-bar>
 | |
|         <ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
 | |
|                   @getList="getTableData()" :col-configs="colConfigs" :dict="dict">
 | |
|           <el-table-column slot="options" label="操作" width="200" align="center">
 | |
|             <template slot-scope="{ row }">
 | |
|               <el-button type="text" @click="changeStatus(row, '停用')" v-if="row.status == 1">停用</el-button>
 | |
|               <el-button type="text" @click="changeStatus(row, '启用')" v-else>启用</el-button>
 | |
|               <el-button type="text" @click="edit(row)">编辑</el-button>
 | |
|               <el-button type="text" @click="del(row)">删除</el-button>
 | |
|             </template>
 | |
|           </el-table-column>
 | |
|         </ai-table>
 | |
|       </template>
 | |
|     </ai-list>
 | |
|   </section>
 | |
| 
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| import {mapState} from "vuex";
 | |
| 
 | |
| export default {
 | |
|   name: "Setting",
 | |
|   label: '工单特征库',
 | |
|   props: {
 | |
|     instance: Function,
 | |
|     dict: Object,
 | |
|     permissions: Function,
 | |
|     menuName: String
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       search: {
 | |
|         keywords: '',
 | |
|         current: 1,
 | |
|         size: 10,
 | |
|       },
 | |
|       total: 0,
 | |
|       tableData: [],
 | |
|       current: 1,
 | |
|     }
 | |
|   },
 | |
|   created() {
 | |
|     this.dict.load(['processDefStatus', 'xbotReportEventType']).then(() => {
 | |
|       this.getTableData()
 | |
|     })
 | |
|   },
 | |
|   computed: {
 | |
|     ...mapState(['user']),
 | |
|     colConfigs() {
 | |
|       return [
 | |
|         {prop: "keywords", label: '特征词', align: "left"},
 | |
|         {prop: "eventType", label: '事件类型', width: 200, align: 'center', dict: 'xbotReportEventType'},
 | |
|         {prop: "createTime", label: '创建时间', width: 200, align: 'center'},
 | |
|         {prop: "createUserName", label: '创建人', width: 200, align: 'center'},
 | |
|         {prop: "status", label: '状态', width: 200, dict: 'processDefStatus', align: 'center'},
 | |
|         {slot: "options"},
 | |
|       ]
 | |
|     },
 | |
|   },
 | |
|   methods: {
 | |
|     getTableData() {
 | |
|       this.instance.post(`/app/appsessionarchivefeaturelibrary/list`, null, {
 | |
|         params: {
 | |
|           ...this.search
 | |
|         }
 | |
|       }).then(res => {
 | |
|         if (res?.data) {
 | |
|           this.tableData = res.data.records
 | |
|           this.total = res.data.total
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     del(row) {
 | |
|       this.$confirm('确定删除该数据?').then(() => {
 | |
|         this.instance.post(`/app/appsessionarchivefeaturelibrary/delete?ids=${row.id}`).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.$message.success('删除成功!')
 | |
|             this.getTableData()
 | |
|           }
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     changeStatus(row, text) {
 | |
|       this.$confirm(`确定${text}该特征词?`).then(() => {
 | |
|         this.instance.post(`/app/appsessionarchivefeaturelibrary/enable?id=${row.id}`).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.$message.success('操作成功!')
 | |
|             this.getTableData()
 | |
|           }
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     edit(row = {}) {
 | |
|       const {id} = row
 | |
|       this.$router.push({hash: "#sd", query: {id}})
 | |
|     },
 | |
|     cancel() {
 | |
|       this.$router.push({})
 | |
|     }
 | |
|   },
 | |
| }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| .Setting {
 | |
|   height: 100%;
 | |
| 
 | |
|   .time-select {
 | |
|     padding: 0 16px;
 | |
|     height: 32px;
 | |
|     line-height: 32px;
 | |
|     border: 1px solid #d0d4dc;
 | |
|     border-radius: 4px;
 | |
|     display: flex;
 | |
|     justify-content: space-between;
 | |
|     cursor: pointer;
 | |
| 
 | |
|     .el-icon-arrow-down {
 | |
|       line-height: 32px;
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   :deep .is-error {
 | |
|     .time-select {
 | |
|       border: 1px solid #f46 !important;
 | |
|     }
 | |
|   }
 | |
| }
 | |
| </style>
 |