diff --git a/src/views/flow/components/ServiceFlowSubList.vue b/src/views/flow/components/ServiceFlowSubList.vue index d162276..fb88493 100644 --- a/src/views/flow/components/ServiceFlowSubList.vue +++ b/src/views/flow/components/ServiceFlowSubList.vue @@ -308,7 +308,7 @@ function getTableAction(record) { label: '下一节点', onClick: handleNode.bind(null, record), }, - { + { label: '启用', onClick: handleIzEnabled.bind(null, record, 'Y'), ifShow: record.izEnabled == 'N' diff --git a/src/views/services/instructiontag/components/InstructionTagForm.vue b/src/views/services/instructiontag/components/InstructionTagForm.vue index 28800b7..64fa1d5 100644 --- a/src/views/services/instructiontag/components/InstructionTagForm.vue +++ b/src/views/services/instructiontag/components/InstructionTagForm.vue @@ -15,7 +15,8 @@ - {{ formData.title }} + @@ -30,7 +31,7 @@ - + (false); +const izEditIcon = ref(false) const formData = reactive>({ id: '', + title: '', instructionName: '', instructionType: '', sort: 99, @@ -77,12 +80,13 @@ const labelCol = ref({ xs: { span: 24 }, sm: { span: 5 } }); const wrapperCol = ref({ xs: { span: 24 }, sm: { span: 16 } }); const confirmLoading = ref(false); //表单验证 -const validatorRules = reactive({ - // instructionName: [{ required: true, message: '请输入分类标签名称!' },], - instructionType: [{ required: true, message: '请选择分类标签类型!' },], - sort: [{ required: true, message: '请输入排序!' }, { pattern: /^\d+$/, message: '请输入正整数!' },], - icon: [{ required: true, message: '请选择图标!' }], - izEnabled: [{ required: true, message: '请选择是否启用!' },], +const validatorRules = computed(() => { + return { + instructionType: izEditIcon.value ? [] : [{ required: true, message: '请选择分类标签类型!' }], + sort: [{ required: true, message: '请输入排序!' }, { pattern: /^\d+$/, message: '请输入正整数!' },], + icon: [{ required: true, message: '请选择图标!' }], + izEnabled: [{ required: true, message: '请选择是否启用!' },], + }; }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); @@ -103,6 +107,7 @@ const disabled = computed(() => { * 新增 */ function add() { + izEditIcon.value = false edit({}); } @@ -110,7 +115,32 @@ function add() { * 编辑 */ function edit(record) { - console.log("🚀 ~ edit ~ record:", record) + izEditIcon.value = false + nextTick(() => { + resetFields(); + const tmpData = {}; + Object.keys(formData).forEach((key) => { + if (record.hasOwnProperty(key)) { + tmpData[key] = record[key] + } + }) + //赋值 + Object.assign(formData, tmpData); + formData.instructionName = record.title; + formData.id = record.key; + if (record.title) { + titleDisabled.value = true; + } else { + titleDisabled.value = false; + } + }); +} + +/** + * 编辑 + */ +function editIcon(record) { + izEditIcon.value = true nextTick(() => { resetFields(); const tmpData = {}; @@ -165,6 +195,12 @@ async function submitForm() { } } } + if (izEditIcon.value) { + model = { + id: model.id, + icon: model.icon + } + } await saveOrUpdate(model, isUpdate.value) .then((res) => { if (res.success) { @@ -191,6 +227,7 @@ defineExpose({ add, edit, submitForm, + editIcon, }); diff --git a/src/views/services/instructiontag/components/InstructionTagModal.vue b/src/views/services/instructiontag/components/InstructionTagModal.vue index 3e43580..3a92d7b 100644 --- a/src/views/services/instructiontag/components/InstructionTagModal.vue +++ b/src/views/services/instructiontag/components/InstructionTagModal.vue @@ -56,6 +56,18 @@ function edit(record) { }); } +/** + * 修改图标 + * @param record + */ +function editIcon(record) { + title.value = disableSubmit.value ? '详情' : '编辑'; + visible.value = true; + nextTick(() => { + registerForm.value.editIcon(record); + }); +} + /** * 确定按钮点击事件 */ @@ -101,6 +113,7 @@ defineExpose({ edit, disableSubmit, usingOrStop, + editIcon, }); diff --git a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue index 2f72537..f2bc170 100644 --- a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue +++ b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue @@ -1110,7 +1110,7 @@ function stopInstruction(data) { } function editInstruction(data) { insRegisterModal.value.disableSubmit = false; - insRegisterModal.value.edit(data); + insRegisterModal.value.editIcon(data); } //新增服务类别 function addCategory(data) {