吉安感知网项目-前端
罗广辉
2 days ago 1d552a3bad95caae4af15322df28e6240b797693
applications/task-work-order/src/views/orderView/orderDataManage/appInnovation/FormDiaLog.vue
@@ -6,6 +6,7 @@
      @closed="visible = false"
      destroy-on-close
      :close-on-click-modal="false"
      width="800px"
   >
      <div class="detail-container" v-if="dialogReadonly">
         <el-row class="detail-row-view">
@@ -47,7 +48,7 @@
         :model="formData"
         :rules="rules"
         :disabled="dialogReadonly"
         label-width="140px"
         :label-width="pxToRem(112)"
      >
         <el-row>
            <el-col :span="12">
@@ -83,7 +84,7 @@
            <el-col :span="24">
               <el-form-item label="案例描述" prop="caseDesc">
                  <el-input
                     class="gd-input"
                     class="gd-input-text"
                     v-model="formData.caseDesc"
                     type="textarea"
                     :rows="4"
@@ -96,7 +97,8 @@
      </el-form>
      <template #footer>
         <template v-if="!dialogReadonly">
            <el-button color="#F2F3F5" @click="visible = false">取消</el-button>
            <el-button color="#F2F3F5" :loading="submitting"
               :disabled="submitting" @click="preservation">保存</el-button>
            <el-button
               class=""
               color="#4C34FF"
@@ -132,6 +134,7 @@
   gdApplicationInnovationDetailApi,
   gdApplicationInnovationSubmitApi,
} from '@/views/orderView/orderDataManage/appInnovation/appInnovationApi'
import { pxToRem } from '@/utils/rem'
// 初始化表单数据
const initForm = () => ({
@@ -155,22 +158,37 @@
const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' })
const rules = {
   caseName: fieldRules(true),
   belongDomain: fieldRules(true),
   applicationScenarioDesc: fieldRules(true),
   matterName: fieldRules(true),
   resourceName: fieldRules(true),
   resourceCode: fieldRules(true),
   caseDesc: fieldRules(true),
   caseName: fieldRules(true,50),
   belongDomain: fieldRules(true,50),
   applicationScenarioDesc: fieldRules(true,50),
   matterName: fieldRules(true,50),
   resourceName: fieldRules(true,50),
   resourceCode: fieldRules(true,50),
   caseDesc: fieldRules(true,200),
}
// 保存
async function preservation(){
      const isValid = await formRef.value?.validate().catch(() => false)
   if (!isValid) return
   submitting.value = true
   try {
      formData.value.innovationStatus = '3'
      await gdApplicationInnovationSubmitApi(formData.value)
      ElMessage.success('新增成功')
      visible.value = false
      emit('success')
   } finally {
      submitting.value = false
   }
}
// 提交新增/编辑
async function handleSubmit() {
   const isValid = await formRef.value?.validate().catch(() => false)
   if (!isValid) return
   submitting.value = true
   try {
      formData.value.innovationStatus = dialogMode.value === 'add' ? '0' : formData.value.innovationStatus
      formData.value.innovationStatus = '0'
      await gdApplicationInnovationSubmitApi(formData.value)
      ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功')
      visible.value = false