|
@@ -178,7 +178,7 @@ import weixinIcon from '@/assets/imgs/weixin.png'
|
|
|
import youxiangIcon from '@/assets/imgs/youxiang.png'
|
|
import youxiangIcon from '@/assets/imgs/youxiang.png'
|
|
|
import DGTMessage from '@/utils/message'
|
|
import DGTMessage from '@/utils/message'
|
|
|
|
|
|
|
|
-import { questAdd } from '@/api/workflowTrade.js'
|
|
|
|
|
|
|
+import { questAdd, getQuestDetail, questEdit } from '@/api/workflowTrade.js'
|
|
|
import { getCategoryListTree } from '@/api/category.js'
|
|
import { getCategoryListTree } from '@/api/category.js'
|
|
|
import { getAgreementType } from '@/api/common.js'
|
|
import { getAgreementType } from '@/api/common.js'
|
|
|
|
|
|
|
@@ -188,13 +188,14 @@ import { useRouter, useRoute } from 'vue-router'
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
console.log(router,route)
|
|
console.log(router,route)
|
|
|
-import { ref, computed, reactive, onMounted, watchEffect } from 'vue'
|
|
|
|
|
|
|
+import { ref, computed, reactive, onMounted, watchEffect,nextTick } from 'vue'
|
|
|
import { useAppStore } from '@/pinia/appStore'
|
|
import { useAppStore } from '@/pinia/appStore'
|
|
|
const appStore = useAppStore()
|
|
const appStore = useAppStore()
|
|
|
// 防止重复提交的加载状态
|
|
// 防止重复提交的加载状态
|
|
|
const isSubmiting = ref(false)
|
|
const isSubmiting = ref(false)
|
|
|
//获取参数
|
|
//获取参数
|
|
|
const query = route.query;
|
|
const query = route.query;
|
|
|
|
|
+const questId = ref(query.id || '')
|
|
|
// 分类列表树
|
|
// 分类列表树
|
|
|
const categoryListTree = ref([]);
|
|
const categoryListTree = ref([]);
|
|
|
// 选择的分类id列表
|
|
// 选择的分类id列表
|
|
@@ -203,6 +204,7 @@ const categoryIdList = ref([])
|
|
|
// 表单实例
|
|
// 表单实例
|
|
|
const ruleFormRef = ref(null)
|
|
const ruleFormRef = ref(null)
|
|
|
const ruleForm = reactive({
|
|
const ruleForm = reactive({
|
|
|
|
|
+ questId: "",
|
|
|
title: '',
|
|
title: '',
|
|
|
categoryId1: '',
|
|
categoryId1: '',
|
|
|
categoryId2: '',
|
|
categoryId2: '',
|
|
@@ -262,6 +264,10 @@ onMounted(() => {
|
|
|
getCategoryListTreeFn();
|
|
getCategoryListTreeFn();
|
|
|
// 查询发布提示和发布规则
|
|
// 查询发布提示和发布规则
|
|
|
getAgreementTypeFn();
|
|
getAgreementTypeFn();
|
|
|
|
|
+ if(questId.value){
|
|
|
|
|
+ getDetail();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 提交表单
|
|
// 提交表单
|
|
@@ -274,10 +280,14 @@ const submitForm = async () => {
|
|
|
DGTMessage.warning(fields[firstKey][0].message)
|
|
DGTMessage.warning(fields[firstKey][0].message)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ let req = questAdd;
|
|
|
|
|
+ if(questId.value){
|
|
|
|
|
+ req = questEdit;
|
|
|
|
|
+ }
|
|
|
// 设置加载状态为true,禁用按钮
|
|
// 设置加载状态为true,禁用按钮
|
|
|
isSubmiting.value = true
|
|
isSubmiting.value = true
|
|
|
// 新增需求工作流
|
|
// 新增需求工作流
|
|
|
- await questAdd(ruleForm).then(res => {
|
|
|
|
|
|
|
+ await req(ruleForm).then(res => {
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
if(res.code === 200){
|
|
if(res.code === 200){
|
|
|
DGTMessage.success(t('workflowTrade.publishSuccess'))
|
|
DGTMessage.success(t('workflowTrade.publishSuccess'))
|
|
@@ -301,6 +311,20 @@ const getCategoryListTreeFn = () => {
|
|
|
categoryListTree.value = res.rows || [];
|
|
categoryListTree.value = res.rows || [];
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|
|
|
|
|
+const getDetail = () => {
|
|
|
|
|
+ getQuestDetail({id:questId.value}).then(res => {
|
|
|
|
|
+ const detail = res.data || {};
|
|
|
|
|
+ for(let key in ruleForm){
|
|
|
|
|
+ ruleForm[key] = detail[key];
|
|
|
|
|
+ }
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ if(ruleForm.categoryId1){
|
|
|
|
|
+ categoryIdList.value = [ruleForm.categoryId1, ruleForm.categoryId2, ruleForm.categoryId3];
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(categoryIdList.value)
|
|
|
|
|
+ })
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
// 发布提示列表
|
|
// 发布提示列表
|
|
|
const release_hint = ref([])
|
|
const release_hint = ref([])
|