|
@@ -35,8 +35,9 @@
|
|
|
</Dialog>
|
|
|
</template>
|
|
|
|
|
|
-<script setup lang="ts">
|
|
|
+<script setup>
|
|
|
import { talentTagApi } from '@/api/menduner/system/talentMap/tag'
|
|
|
+import _ from 'lodash-es'
|
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const message = useMessage() // 消息弹窗
|
|
@@ -63,8 +64,10 @@ const formRules = reactive({
|
|
|
})
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
-const open = async (type: string, data?: any) => {
|
|
|
-
|
|
|
+const valueKeys = ['name', 'category', 'status', 'description']
|
|
|
+const editItemData = ref({})
|
|
|
+const open = async (type, data) => {
|
|
|
+ editItemData.value = {}
|
|
|
dialogVisible.value = true
|
|
|
dialogTitle.value = t('action.' + type)
|
|
|
formType.value = type
|
|
@@ -73,6 +76,7 @@ const open = async (type: string, data?: any) => {
|
|
|
// 修改时,设置数据
|
|
|
if (data && Object.keys(data).length) {
|
|
|
formData.value = data
|
|
|
+ valueKeys.forEach(key => editItemData.value[key] = data[key])
|
|
|
if (data.status === 'disable') formData.value.status = 'inactive'
|
|
|
}
|
|
|
}
|
|
@@ -91,6 +95,11 @@ const submitForm = async () => {
|
|
|
description: formData.value.description,
|
|
|
name: formData.value.name
|
|
|
}
|
|
|
+ // 更新标签时,至少需要提供一个要更新的项
|
|
|
+ if (formType.value === 'update') {
|
|
|
+ const isEqual = _.isEqual(params, editItemData.value)
|
|
|
+ if (isEqual) return message.warning('请修改任意项后再提交!')
|
|
|
+ }
|
|
|
|
|
|
// 提交请求
|
|
|
formLoading.value = true
|