zhouwx
2025-11-24 7619b42541a7b44c4f859b17f69d087b39aef08c
src/views/work/sealManagement/apply/index.vue
@@ -28,6 +28,7 @@
      </el-form>
    </div>
    <el-radio-group v-model="data.tabName" style="margin-bottom: 30px" @change="changBtn">
      <el-radio-button label="all" v-if="data.userType == 0 || data.userType == 6">全部</el-radio-button>
      <el-radio-button label="apply" >我申请的</el-radio-button>
      <el-radio-button label="approval">待审批的</el-radio-button>
    </el-radio-group>
@@ -39,18 +40,22 @@
      <el-table-column label="用章事由" prop="useSealCause" align="center"  />
      <el-table-column label="申请人" prop="applyUserName" align="center"  />
      <el-table-column label="用章时间" prop="useSealTime" align="center"  />
      <el-table-column label="状态" prop="status" align="center"  >
        <template #default="scope">
          <span>{{scope.row.status == 1 ? '审批中' :scope.row.status == 2 ?'已审批' : ''}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" >
        <template #default="scope">
          <div v-if="data.tabName === 'apply'">
          <div v-if="data.tabName === 'apply' || data.tabName === 'all'">
            <el-button link type="primary"  @click="openDialog('review',scope.row)">查看</el-button>
            <el-button link type="primary"  @click="openDialog('edit',scope.row)" v-hasPermi="['sealApply:list:edit']">编辑</el-button>
            <el-button link type="primary" v-if="scope.row.status == 1" @click="openDialog('edit',scope.row)" v-hasPermi="['sealApply:list:edit']">编辑</el-button>
            <el-button link type="danger"  @click="handleDelete(scope.row)" v-hasPermi="['sealApply:list:del']">删除</el-button>
          </div>
          <div v-else>
          <div v-if="data.tabName === 'approval'">
            <el-button link type="primary"  @click="openDialog('review',scope.row)">查看</el-button>
            <el-button link type="primary"  @click="openApplyDialog(scope.row)" v-hasPermi="['sealApply:list:apply']">审批</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
@@ -72,12 +77,16 @@
        width="500px"
        :before-close="handleClose"
    >
      <el-form :model="data.applyForm" size="default" ref="noticeRef" label-width="110px" >
      <el-form :model="data.applyForm"  :rules="data.rules" size="default" ref="busRef" label-width="110px" >
        <el-form-item label="审批意见:" prop="approveStatus" >
          <el-radio-group v-model="data.applyForm.approveStatus" >
            <el-radio :label="1">同意</el-radio>
            <el-radio :label="2">不同意</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item prop="approveMess" >
          <el-input type="textarea" :rows="3" v-model="data.applyForm.approveMess"></el-input>
        </el-form-item>
      </el-form>
      <template #footer >
@@ -102,6 +111,7 @@
const { proxy } = getCurrentInstance();
const loading = ref(false);
const noticeRef = ref();
const busRef = ref();
const loadingCompany = ref(false)
const choosedData = ref([])
const data = reactive({
@@ -112,16 +122,22 @@
    nextCheck:null,
    applyUserId: null
  },
  tabName:'apply',
  tabName:'',
  companyList: [],
  isAdmin: false,
  userId: null,
  showDialog: false,
  userType: null,
  applyForm: {
    useSealId: null,
    approveUserId: null,
    approveStatus: null
  }
    approveStatus: null,
    approveMess:''
  },
  rules: {
    approveStatus:[{ required: true, message: '请选择审批意见', trigger: 'blur' }],
    approveMess:[{ required: true, message: '请输入意见内容', trigger: 'blur' }],
  },
});
const dataList = ref([]);
const total = ref(0);
@@ -132,6 +148,8 @@
  const userInfo = JSON.parse(Cookies.get('userInfo'))
  console.log("userInfo",userInfo)
  data.isAdmin = userInfo.userType === 0;
  data.userType = userInfo.userType
  data.tabName = userInfo.userType == 0 || userInfo.userType == 6 ?'all':'apply'
  data.userId = userInfo.id
  data.queryParams.applyUserId = userInfo.id
  if(data.isAdmin){
@@ -259,7 +277,8 @@
  data.applyForm = {
    useSealId: val.id,
    approveUserId: data.userId,
    approveStatus: null
    approveStatus: null,
    approveMess:''
  }
  data.showDialog = true
}
@@ -267,22 +286,27 @@
  data.applyForm = {
    useSealId: null,
    approveUserId: null,
    approveStatus: null
    approveStatus: null,
    approveMess:''
  }
  data.showDialog = false
}
const onSubmit = async () => {
  const res = await reviewApply(data.applyForm)
  if(res.code === 200){
    ElMessage({
      type: 'success',
      message: '审批成功'
    });
    await getList();
    data.showDialog = false
  }else{
    ElMessage.warning(res.message)
  const valid = await busRef.value.validate();
  if(valid){
    const res = await reviewApply(data.applyForm)
    if(res.code === 200){
      ElMessage({
        type: 'success',
        message: '审批成功'
      });
      await getList();
      data.showDialog = false
    }else{
      ElMessage.warning(res.message)
    }
  }
}
</script>
<style lang="scss">