|
|
@@ -79,7 +79,7 @@ const form = ref({
|
|
|
"attinfos":[],
|
|
|
"remarks":''
|
|
|
})
|
|
|
-const showDrawer = ()=>{
|
|
|
+const showDrawer = async ()=>{
|
|
|
// 每次打开时重置表单数据
|
|
|
form.value = {
|
|
|
"sat_sharematerial_classid": 0,
|
|
|
@@ -94,6 +94,30 @@ const showDrawer = ()=>{
|
|
|
form.value.isenable = props.data.isenable
|
|
|
form.value.parentid = props.data.sat_sharematerial_classid
|
|
|
}
|
|
|
+
|
|
|
+ // 获取该父分类下的最大 sequence 值,确保新分类排在最后面
|
|
|
+ try {
|
|
|
+ let res = await Api.requested({
|
|
|
+ 'id': 20221102143302,
|
|
|
+ 'content': {
|
|
|
+ "parentid": form.value.parentid
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ // 找到最大的 sequence 值
|
|
|
+ const maxSequence = Math.max(...res.data.map(item => item.sequence || 0))
|
|
|
+ form.value.sequence = maxSequence + 1
|
|
|
+ } else {
|
|
|
+ // 如果没有子分类,sequence 设为 0
|
|
|
+ form.value.sequence = 0
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取分类列表失败:', error)
|
|
|
+ // 出错时默认 sequence 设为 0
|
|
|
+ form.value.sequence = 0
|
|
|
+ }
|
|
|
+
|
|
|
visible.value = true
|
|
|
nextTick(() => {
|
|
|
if(formRef.value) {
|