|
@@ -38,15 +38,15 @@
|
|
</template>
|
|
</template>
|
|
<template #action>
|
|
<template #action>
|
|
<el-button v-if="formInfo.id" type="info" @click="cancelClick">取消</el-button>
|
|
<el-button v-if="formInfo.id" type="info" @click="cancelClick">取消</el-button>
|
|
- <el-button v-if="!formInfo.id" color="#20C98B" type="primary" class="text-white" @click="saveClick">创建工作要点</el-button>
|
|
|
|
- <el-button v-else type="warning" @click="saveClick">保存</el-button>
|
|
|
|
|
|
+ <el-button v-if="!formInfo.id" :loading="saveLoading" color="#20C98B" type="primary" class="text-white" @click="saveClick">创建工作要点</el-button>
|
|
|
|
+ <el-button v-else :loading="saveLoading" type="warning" @click="saveClick">保存</el-button>
|
|
</template>
|
|
</template>
|
|
</hc-card>
|
|
</hc-card>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { onMounted, ref, watch } from 'vue'
|
|
import { onMounted, ref, watch } from 'vue'
|
|
-import { deepClone, formValidate, getArrValue, getRandom } from 'js-fast-way'
|
|
|
|
|
|
+import { deepClone, formValidate, getArrValue } from 'js-fast-way'
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
import mainApi from '~api/project/gist'
|
|
import mainApi from '~api/project/gist'
|
|
|
|
|
|
@@ -129,7 +129,7 @@ const gistFormRules = {
|
|
//新增工作重点
|
|
//新增工作重点
|
|
const addGistList = () => {
|
|
const addGistList = () => {
|
|
const list = getArrValue(workFocusEntityList.value)
|
|
const list = getArrValue(workFocusEntityList.value)
|
|
- list.push({ id: getRandom() })
|
|
|
|
|
|
+ list.push({})
|
|
}
|
|
}
|
|
|
|
|
|
//删除工作重点
|
|
//删除工作重点
|
|
@@ -149,6 +149,7 @@ const cancelClick = () => {
|
|
}
|
|
}
|
|
|
|
|
|
//创建 保存
|
|
//创建 保存
|
|
|
|
+const saveLoading = ref(false)
|
|
const saveClick = async () => {
|
|
const saveClick = async () => {
|
|
//验证基础表单
|
|
//验证基础表单
|
|
const isForm = await formValidate(baseFormRef.value)
|
|
const isForm = await formValidate(baseFormRef.value)
|
|
@@ -160,9 +161,29 @@ const saveClick = async () => {
|
|
if (!form) isGistForm = false
|
|
if (!form) isGistForm = false
|
|
}
|
|
}
|
|
if (!isForm || !isGistForm) return
|
|
if (!isForm || !isGistForm) return
|
|
|
|
+ saveLoading.value = true
|
|
//处理表单数据
|
|
//处理表单数据
|
|
const form = baseForm.value, gist = workFocusEntityList.value
|
|
const form = baseForm.value, gist = workFocusEntityList.value
|
|
- console.log(form, gist)
|
|
|
|
|
|
+ let newWorkForm = []
|
|
|
|
+ for (let i = 0; i < gist.length; i++) {
|
|
|
|
+ newWorkForm.push({
|
|
|
|
+ ...form,
|
|
|
|
+ ...gist[i],
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ //发起请求
|
|
|
|
+ const { error, code, msg } = await mainApi.submit({
|
|
|
|
+ workFocusEntityList: newWorkForm,
|
|
|
|
+ })
|
|
|
|
+ //判断状态
|
|
|
|
+ saveLoading.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window?.$message?.success(msg)
|
|
|
|
+ baseForm.value = {}
|
|
|
|
+ workFocusEntityList.value = [{}]
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '操作失败')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|