| | |
| | | </div> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="id" label="id" width="130" fixed="left" show-overflow-tooltip> </el-table-column> |
| | | <!-- <el-table-column prop="id" label="id" width="130" fixed="left" show-overflow-tooltip> </el-table-column> --> |
| | | |
| | | <el-table-column prop="title" label="标题" width="300" fixed="left" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column prop="prompt" label="提示词" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column prop="published" label="状态" width="120" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-select |
| | | :modelValue="displayTableData[scope.$index].published" |
| | | @change="(value) => publishStatusChange(value, scope.row.id, scope.$index)" |
| | | > |
| | | <el-option |
| | | v-for="item in Object.keys(supervisorPublishedMap)" |
| | | :key="item" |
| | | :value="item" |
| | | :label="supervisorPublishedMap[item]" |
| | | ></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="创建人" prop="creator" width="100" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column label="创建时间" prop="create_time" width="105" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column label="更新时间" prop="update_time" width="105" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column label="备注" prop="note" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column label="操作" width="150" fixed="right" show-overflow-tooltip> |
| | | <el-table-column label="操作" width="200" fixed="right" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <div class="space-x-2.5 items-center flex"> |
| | | <div class="space-x-3 items-center flex"> |
| | | <el-tooltip effect="dark" content="SQL编辑" placement="top"> |
| | | <i class="ywifont ywicon-sql !text-[14px] text-blue-400 cursor-pointer" @click="editSqlClick(scope.row)"></i> |
| | | </el-tooltip> |
| | |
| | | <i class="ywifont ywicon-ceshi !text-[20px] text-blue-400 cursor-pointer" @click="openChatTest(scope.row)"></i> |
| | | </el-tooltip> |
| | | |
| | | <!-- <el-tooltip effect="dark" content="发布" placement="top"> |
| | | <i class="ywifont ywicon-ceshi !text-[20px] text-blue-400 cursor-pointer" :class="[row]" @click="openChatTest(scope.row)"></i> |
| | | </el-tooltip> --> |
| | | <el-tooltip |
| | | effect="dark" |
| | | :content="scope.row.published === SupervisorPublished.Y ? '取消发布' : '发布'" |
| | | placement="top" |
| | | > |
| | | <i |
| | | class="ywifont !text-[20px] cursor-pointer" |
| | | :class="[ |
| | | scope.row.published === SupervisorPublished.Y ? 'ywicon-quxiaofabu text-red-400' : 'ywicon-fabu text-blue-400', |
| | | ]" |
| | | @click=" |
| | | publishStatusChange( |
| | | scope.row.published === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y, |
| | | scope.row.id, |
| | | scope.$index |
| | | ) |
| | | " |
| | | ></i> |
| | | </el-tooltip> |
| | | <el-tooltip effect="dark" content="编辑" placement="top"> |
| | | <i class="ywifont ywicon-bianji !text-[15px] text-blue-400 cursor-pointer" @click="openOptDlg(scope.row)"></i> |
| | | </el-tooltip> |
| | |
| | | import { gotoRoute } from '/@/utils/route'; |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import { nextTick } from 'vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | //#region ====================== 表格数据,table init ====================== |
| | | const tableLoading = ref(false); |
| | | const tableData = ref([]); |
| | |
| | | }); |
| | | tableData.value = (res.values || []).map((item) => { |
| | | item.create_time = item.create_time?.slice(0, 10); |
| | | item.update_time = item.create_time?.slice(0, 10); |
| | | item.update_time = item.update_time?.slice(0, 10); |
| | | |
| | | return item; |
| | | }); |
| | |
| | | }; |
| | | //#endregion |
| | | //#region ====================== 改变发布状态 ====================== |
| | | const publishStatusChange = async (isPublished: SupervisorPublished, id, index) => { |
| | | const publishStatusChange = async (published: SupervisorPublished, id, index) => { |
| | | const res = await updatePublishStatus({ |
| | | id: id, |
| | | publish: isPublished, |
| | | publish: published, |
| | | }); |
| | | displayTableData.value[index].published = isPublished; |
| | | const origin = published ? SupervisorPublished.N : SupervisorPublished.Y; |
| | | displayTableData.value[index].published = res.publish ?? origin; |
| | | published===SupervisorPublished.Y ? ElMessage.success('发布成功'):ElMessage.info('已取消发布') |
| | | }; |
| | | //#endregion |
| | | |