| | |
| | | v-model="dialogIsShow" |
| | | :headerIcon="dialogHeaderIcon" |
| | | :title="dialogTitle" |
| | | width="720" |
| | | width="470" |
| | | @dlgClosed="closeDialog" |
| | | @submit="submitFormValue" |
| | | > |
| | | <el-form :model="dialogFormValue" ref="dialogFormRef" :rules="dialogFormRules" label-width="78"> |
| | | <el-form :model="dialogFormValue" ref="dialogFormRef" :rules="dialogFormRules" label-width="76"> |
| | | <el-form-item label="标题" prop="title"> |
| | | <el-input v-model="dialogFormValue.title"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="提示词" prop="prompt"> |
| | | <el-input v-model="dialogFormValue.prompt"></el-input> |
| | | <el-input v-model="dialogFormValue.prompt" type="textarea" :rows="3"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="备注" prop="note"> |
| | | <el-input v-model="dialogFormValue.note" type="textarea" :rows="3"></el-input> |
| | | </el-form-item> |
| | | <div class="flex max-h-80"> |
| | | <span class="flex-0 ml-2.5">页面参数</span> |
| | | <div class="ml-3 flex-auto flex-col flex"> |
| | | <EditTable ref="formEditTableRef" class="flex-auto overflow-auto" :data-source="dialogFormValue.args"> |
| | | <EditTableColumn prop="name" label="名称" :rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]"> |
| | | <template #edit="{ row }"> |
| | | <el-input size="small" v-model="row.name" /> |
| | | </template> |
| | | </EditTableColumn> |
| | | <EditTableColumn prop="title" label="提示" :rules="[{ required: true, message: '请输入提示', trigger: 'blur' }]"> |
| | | <template #edit="{ row }"> |
| | | <el-input size="small" v-model="row.title" /> |
| | | </template> |
| | | </EditTableColumn> |
| | | <EditTableColumn label="操作"> |
| | | <template #default="{ actions, $index }"> |
| | | <el-button size="small" @click="actions.startEditable($index)">操作</el-button> |
| | | <el-button size="small" @click="actions.deleteRow($index)">删除</el-button> |
| | | </template> |
| | | <template #edit="{ actions, $index }"> |
| | | <el-button size="small" @click="actions.saveEditable($index)">保存</el-button> |
| | | <el-button size="small" @click="actions.cancelEditable($index)">取消</el-button> |
| | | <el-button size="small" @click="actions.deleteRow($index)">删除</el-button> |
| | | </template> |
| | | </EditTableColumn> |
| | | </EditTable> |
| | | <el-button class="flex-0" @click="formEditTableRef?.editActions.addRow()">新增</el-button> |
| | | </div> |
| | | |
| | | <!-- <el-table class="ml-3 h-80" border row-class-name="cursor-pointer" :data="dialogFormValue.args" highlight-current-row> |
| | | <el-table-column prop="name" label="名称" width="300" fixed="left" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-input v-model="dialogFormValue.args[scope.$index].name"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="title" label="提示" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-input v-model="dialogFormValue.args[scope.$index].title"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> --> |
| | | </div> |
| | | </el-form> |
| | | </ywDialog> |
| | | </template> |
| | |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import EditTable from '/@/components/table/editTable/EditTable.vue'; |
| | | import EditTableColumn from '/@/components/table/editTable/EditTableColumn.vue'; |
| | | import { formatDate } from '/@/utils/formatTime'; |
| | | import { useUserInfo } from '/@/stores/userInfo'; |
| | | import { storeToRefs } from 'pinia'; |
| | | |
| | | const props = defineProps(['item']); |
| | | const props = defineProps(['item', 'groupId']); |
| | | const emit = defineEmits(['update', 'insert']); |
| | | //#region ====================== 增加、修改记录操作, dialog init====================== |
| | | const isEditDialog = ref(false); |
| | |
| | | const openOperateDialog = (row?) => { |
| | | if (row) { |
| | | isEditDialog.value = true; |
| | | const { id, note, prompt, title, args } = row; |
| | | const formArgs = args ? args : []; |
| | | dialogFormValue.value = deepClone({ id, note, prompt, title, args: formArgs }); |
| | | const { id, note, prompt, title } = row; |
| | | dialogFormValue.value = deepClone({ id, note, prompt, title }); |
| | | } else { |
| | | isEditDialog.value = false; |
| | | |
| | | dialogFormValue.value = { title: null, prompt: null, note: null, args: [] }; |
| | | dialogFormValue.value = { group: props.groupId, title: null, prompt: null, note: null }; |
| | | } |
| | | }; |
| | | const closeDialog = () => { |
| | | dialogIsShow.value = false; |
| | | dialogFormRef.value.clearValidate(); |
| | | }; |
| | | const stores = useUserInfo(); |
| | | const { userInfos } = storeToRefs(stores); |
| | | |
| | | const submitFormValue = async () => { |
| | | const valid = await dialogFormRef.value.validate().catch(() => {}); |
| | | if (!valid) return; |
| | | const args = |
| | | !dialogFormValue.value.args || dialogFormValue.value.args.length === 0 ? null : JSON.stringify(dialogFormValue.value.args); |
| | | const sendForm = { ...dialogFormValue.value, args }; |
| | | |
| | | const sendForm = { ...dialogFormValue.value }; |
| | | const updateTime = formatDate(new Date()); |
| | | if (isEditDialog.value) { |
| | | const res = await supervisorAdminApi.updateSupervisor(sendForm); |
| | | emit('update', sendForm); |
| | | emit('update', { ...dialogFormValue.value, update_time: updateTime.slice(0, 10) }); |
| | | |
| | | closeDialog(); |
| | | ElMessage.success('修改页面成功'); |
| | | } else { |
| | | const res = await supervisorAdminApi.addSupervisor(sendForm); |
| | | const newData = { |
| | | const newData = { |
| | | id: res.agent_id, |
| | | ...dialogFormValue.value, |
| | | create_time: updateTime.slice(0, 10), |
| | | update_time: updateTime.slice(0, 10), |
| | | creator: userInfos.value.userName, |
| | | }; |
| | | emit('insert', newData); |
| | | // tableData.value.push(newData); |
| | |
| | | |
| | | //#endregion |
| | | |
| | | //#region ====================== 可编辑表格 ====================== |
| | | const formEditTableRef = useCompRef(EditTable); |
| | | //#endregion |
| | | |
| | | watch( |
| | | () => dialogIsShow.value, |