zhouwenxuan
2024-02-01 b91be1b5fcf1f5e571d3126969e6c6bc785719f3
src/views/safetyReview/projectManage/components/signConfirm.vue
@@ -65,7 +65,19 @@
      </el-table-column>
      <el-table-column label="承诺书" prop="socialSecurity" align="center" width="120">
        <template #default="scope">
<!--          <el-button link>承诺书</el-button>-->
          <div class="demo-image__preview" v-if="scope.row.commitPic && scope.row.commitPic.length>0">
            <el-image
                style="width: 100px; height: 100px"
                :src= "scope.row.commitPic[0]"
                :zoom-rate="1.2"
                :max-scale="7"
                :min-scale="0.2"
                :preview-src-list="scope.row.commitPic"
                :initial-index="0"
                fit="cover"
                preview-teleported="true"
            />
          </div>
        </template>
      </el-table-column>
    </el-table>
@@ -81,7 +93,7 @@
</template>
<script setup>
import {defineEmits, onMounted, reactive, ref, toRefs} from "vue";
import {defineEmits, defineProps, onMounted, reactive, ref, toRefs} from "vue";
import {ElMessage} from "element-plus";
import {Search} from '@element-plus/icons-vue'
import {
@@ -96,7 +108,7 @@
import Cookies from "js-cookie"
import {getDetail} from "@/api/projectManage/contractMng";
const emit = defineEmits(["getNextStatus"]);
const props = defineProps(['projectId'])
const state = reactive({
  loading: false,
  queryParams: {
@@ -116,8 +128,8 @@
  if(userInfo.identity === 0){
    isAmin.value = true;
  }
  if(Cookies.get('projectId')){
    getRecognition(Cookies.get('projectId'));
  if(props.projectId){
    getRecognition(props.projectId);
  }
})
const getRecognition = async (val) =>{
@@ -128,6 +140,7 @@
        ...item,
        facePic: item.faceRecord ? [import.meta.env.VITE_APP_BASE_API + '/' + item.faceRecord.facePath ] : [],
        signPic: item.signPath ? [import.meta.env.VITE_APP_BASE_API + '/' + item.signPath] : [],
        commitPic: item.insurancePath ? [import.meta.env.VITE_APP_BASE_API + '/' + item.insurancePath] : [],
        planPerson: {
          playRole: item.planPerson ? item.planPerson.playRole : '',
          jobType: item.planPerson ? item.planPerson.jobType : '',
@@ -143,39 +156,29 @@
const riskOpen = async (type,val) => {
  if((type === 'detail' || type === 'edit') && !Cookies.get('projectId')){
    getRecognition(val);
  }
  // if((type === 'detail' || type === 'edit') && !props.projectId){
  //   getRecognition(val);
  // }
  if(type === 'add' || type === 'clickEdit') {
      if (isAmin.value) {
        ElMessage.warning("当前用户暂无权限");
        return;
      }
      if(type === 'add'){
        const resCheck = await checkAll({projectId: val});
        if (resCheck.code == 200) {
          const res = await addFaceRecognition({projectId: val});
          if (res.code == 200) {
            ElMessage.success('保存成功')
            formRef.value.clearValidate();
            emit('getNextStatus', val);
          } else {
            ElMessage.warning(res.message)
          }
    if (isAmin.value) {
      ElMessage.warning("当前用户暂无权限");
      return;
    }
    if(type === 'add'){
      const resCheck = await checkAll({projectId: val});
      if (resCheck.code == 200) {
        const res = await addFaceRecognition({projectId: val});
        if (res.code == 200) {
          ElMessage.success('保存成功')
          formRef.value.clearValidate();
          emit('getNextStatus', val);
        } else {
          ElMessage.warning(res.message)
        }
      }else if(type === 'clickEdit'){
        // const { ...data} = JSON.parse(JSON.stringify(state.formData))
        // const res = await editRisk(data);
        // if (res.code == 200) {
        //   ElMessage.success('变更成功')
        //   formRef.value.clearValidate();
        //   // emit('getNextStatus', data.project.id);
        // } else {
        //   ElMessage.warning(res.message)
        // }
      } else {
        ElMessage.warning(res.message)
      }
    }
  }
}