|
|
@@ -76,61 +76,109 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<template v-if="signRecords.level1.length">
|
|
|
- <h3 v-if="currentDepartmentKey === 'A'"> 副院长签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'B'"> 负责人签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'C'"> 负责人签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'D'"> 科室负责人签署 </h3>
|
|
|
- <div class="table table-level1" v-for="item in signRecords.level1" :key="item.id">
|
|
|
- <div class="label">签名:</div>
|
|
|
- <div class="value">
|
|
|
- <el-form-item prop="signer">
|
|
|
- <UploadFiles
|
|
|
- :disabled="!item.signFlag"
|
|
|
- label="上传文件"
|
|
|
- ref="uploadFilesRef"
|
|
|
- :fileList="item.attachment"
|
|
|
- @upload-success="(fileList) => handleUploadSignsUploadSuccess(item, fileList)"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'A'"> 副院长签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'B'"> 负责人签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'C'"> 负责人签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'D'"> 科室负责人签署 </h4>
|
|
|
+ <div class="detail-ct">
|
|
|
+ <div class="row" v-for="item in signRecords.level1" :key="item.id">
|
|
|
+ <div class="col">
|
|
|
+ <div class="label">签名:</div>
|
|
|
+ <div class="value value-s1">
|
|
|
+ <el-form-item>
|
|
|
+ <UploadFiles
|
|
|
+ :disabled="!item.signFlag"
|
|
|
+ label="上传文件"
|
|
|
+ :fileList="item.attachment"
|
|
|
+ @upload-success="(fileList) => handleUploadSignsUploadSuccess(item, fileList)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <div class="file-list">
|
|
|
+ <div class="file-item" v-for="file in item.attachment" :key="file.fileId">
|
|
|
+ <span class="file-item--name">{{ file.fileName }}</span>
|
|
|
+ <div class="file-item--footer">
|
|
|
+ <el-button link type="primary" @click="previewOnline(file.fileUrl, file.fileType)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button link type="primary" @click.stop="downloadFile(file.fileUrl, file.fileName)"
|
|
|
+ >下载</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-if="signRecords.level2.length">
|
|
|
- <h3 v-if="currentDepartmentKey === 'A'"> 党委书记签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'B'"> 党委书记签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'C'"> 党委书记签署</h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'D'"> 部门负责人签署 </h3>
|
|
|
- <div class="table table-level2" v-for="item in signRecords.level2" :key="item.id">
|
|
|
- <div class="label">签名:</div>
|
|
|
- <div class="value">
|
|
|
- <el-form-item prop="signer">
|
|
|
- <UploadFiles
|
|
|
- :disabled="!item.signFlag"
|
|
|
- label="上传文件"
|
|
|
- ref="uploadFilesRef"
|
|
|
- :fileList="item.attachment"
|
|
|
- @upload-success="handleUploadSignsUploadSuccess"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'A'"> 党委书记签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'B'"> 党委书记签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'C'"> 党委书记签署</h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'D'"> 部门负责人签署 </h4>
|
|
|
+ <div class="detail-ct">
|
|
|
+ <div class="row" v-for="item in signRecords.level2" :key="item.id">
|
|
|
+ <div class="col">
|
|
|
+ <div class="label">签名:</div>
|
|
|
+ <div class="value value-s1">
|
|
|
+ <el-form-item>
|
|
|
+ <UploadFiles
|
|
|
+ :disabled="!item.signFlag"
|
|
|
+ label="上传文件"
|
|
|
+ :fileList="item.attachment"
|
|
|
+ @upload-success="(fileList) => handleUploadSignsUploadSuccess(item, fileList)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <div class="file-list">
|
|
|
+ <div class="file-item" v-for="file in item.attachment" :key="file.fileId">
|
|
|
+ <span class="file-item--name">{{ file.fileName }}</span>
|
|
|
+ <div class="file-item--footer">
|
|
|
+ <el-button link type="primary" @click="previewOnline(file.fileUrl, file.fileType)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button link type="primary" @click.stop="downloadFile(file.fileUrl, file.fileName)"
|
|
|
+ >下载</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-if="signRecords.level3.length">
|
|
|
- <h3 v-if="currentDepartmentKey === 'A'"> 院长签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'B'"> 院长签署 </h3>
|
|
|
- <h3 v-if="currentDepartmentKey === 'C'"> 所长签署 </h3>
|
|
|
- <div class="table table-level3" v-for="item in signRecords.level3" :key="item.id">
|
|
|
- <div class="label">签名:</div>
|
|
|
- <div class="value">
|
|
|
- <el-form-item prop="signer">
|
|
|
- <UploadFiles
|
|
|
- :disabled="item.signFlag"
|
|
|
- label="上传文件"
|
|
|
- ref="uploadFilesRef"
|
|
|
- :fileList="item.attachment"
|
|
|
- @upload-success="handleUploadSignsUploadSuccess"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'A'"> 院长签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'B'"> 院长签署 </h4>
|
|
|
+ <h4 v-if="currentDepartmentKey === 'C'"> 所长签署 </h4>
|
|
|
+ <div class="detail-ct">
|
|
|
+ <div class="row" v-for="item in signRecords.level3" :key="item.id">
|
|
|
+ <div class="col">
|
|
|
+ <div class="label">签名:</div>
|
|
|
+ <div class="value value-s1">
|
|
|
+ <el-form-item>
|
|
|
+ <UploadFiles
|
|
|
+ :disabled="!item.signFlag"
|
|
|
+ label="上传文件"
|
|
|
+ :fileList="item.attachment"
|
|
|
+ @upload-success="(fileList) => handleUploadSignsUploadSuccess(item, fileList)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <div class="file-list">
|
|
|
+ <div class="file-item" v-for="file in item.attachment" :key="file.fileId">
|
|
|
+ <span class="file-item--name">{{ file.fileName }}</span>
|
|
|
+ <div class="file-item--footer">
|
|
|
+ <el-button link type="primary" @click="previewOnline(file.fileUrl, file.fileType)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button link type="primary" @click.stop="downloadFile(file.fileUrl, file.fileName)"
|
|
|
+ >下载</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -142,6 +190,19 @@
|
|
|
</footer>
|
|
|
</div>
|
|
|
<PreviewOnline ref="previewOnlineRef" />
|
|
|
+ <el-dialog v-model="dialogVisible" title="Tips" width="500">
|
|
|
+ <el-form-item :label="currentLabel">
|
|
|
+ <el-select v-model="signerId" placeholder="请选择" size="large" style="width: 100%" filterable>
|
|
|
+ <el-option v-for="item in userOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="handleDialogCancel">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handleDialogConfirm"> 确认 </el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, ref, computed, reactive } from 'vue';
|
|
|
@@ -153,16 +214,20 @@
|
|
|
import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
|
|
|
import {
|
|
|
safetyResponsibilityDeptQueryDetail,
|
|
|
- safetyResponsibilityDeptSignOrFeedback,
|
|
|
+ // safetyResponsibilityDeptSignOrFeedback,
|
|
|
+ safetyResponsibilityDeptBatchSign,
|
|
|
+ queryAvailableUserList,
|
|
|
} from '@/api/production-safety/responsibility-implementation';
|
|
|
|
|
|
import { unformatAttachment, formatAttachmentList } from '@/components/UploadFiles/utils';
|
|
|
import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
|
|
|
+ import { sign } from 'crypto';
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const formRef = ref<any>(null);
|
|
|
const submiting = ref(false);
|
|
|
+ const dialogVisible = ref(false);
|
|
|
|
|
|
const formData = reactive<any>({
|
|
|
departmentName: '',
|
|
|
@@ -173,7 +238,7 @@
|
|
|
signsUpload: [],
|
|
|
responsibilityName: '',
|
|
|
statusName: '',
|
|
|
- signedQuantity: 0,
|
|
|
+ signedQuantity: '',
|
|
|
userGroupName: '',
|
|
|
planStartTime: null,
|
|
|
planEndTime: null,
|
|
|
@@ -212,10 +277,12 @@
|
|
|
case '常驻供应商':
|
|
|
return 'E';
|
|
|
default:
|
|
|
- return 'default';
|
|
|
+ return '';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ const userOptions = ref<any[]>([]);
|
|
|
+
|
|
|
const showAlertBar = computed(() => {
|
|
|
if (!formData.rejection) {
|
|
|
return false;
|
|
|
@@ -224,7 +291,8 @@
|
|
|
});
|
|
|
const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
|
|
|
const isSignsUpload = computed(() => route.query.status === '2');
|
|
|
-
|
|
|
+ const signerId = ref('');
|
|
|
+ const currentLabel = ref('');
|
|
|
const previewOnline = (url: string | undefined, type) => {
|
|
|
if (url) {
|
|
|
previewOnlineRef.value?.open(url, type);
|
|
|
@@ -232,41 +300,101 @@
|
|
|
};
|
|
|
const handleUploadSignsUploadSuccess = (item, fileList) => {
|
|
|
item.attachment = fileList;
|
|
|
- console.log('@@@', signRecords.value.level1);
|
|
|
+ formData.signRecords = [...signRecords.value.level1, ...signRecords.value.level2, ...signRecords.value.level3];
|
|
|
};
|
|
|
|
|
|
const handleSubmit = () => {
|
|
|
- let signsUpload: any[] = [];
|
|
|
- let feedback: any[] = [];
|
|
|
-
|
|
|
formRef.value?.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- submiting.value = true;
|
|
|
- if (isSignsUpload.value) {
|
|
|
- signsUpload = await formatAttachmentList(formData.signsUpload);
|
|
|
- } else {
|
|
|
- feedback = await formatAttachmentList(formData.feedback);
|
|
|
+ const fullAttachment = formData.signRecords.every((item) => item.attachment && item.attachment.length > 0);
|
|
|
+ const filterList = formData.signRecords.filter((item) => item.signFlag && item.signStatus === 0);
|
|
|
+ const firstItem = filterList?.[0];
|
|
|
+ const lastItem = filterList?.[filterList.length - 1];
|
|
|
+
|
|
|
+ const isEmptyAttachment = !firstItem?.attachment || firstItem?.attachment?.length === 0;
|
|
|
+ const currentLevel = lastItem?.signLevel;
|
|
|
+ const currentOrder = lastItem?.order;
|
|
|
+ const nextLevel = Math.min(currentLevel + 1, 3);
|
|
|
+ const nextOrder = currentOrder + 1;
|
|
|
+
|
|
|
+ //需要弹框选择用户的部门类型
|
|
|
+ const specialDeptKey = /C|D/.test(currentDepartmentKey.value);
|
|
|
+
|
|
|
+ if (specialDeptKey) {
|
|
|
+ if (!fullAttachment) {
|
|
|
+ ElMessage.warning('请上传签署材料');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (currentDepartmentKey.value === 'C') {
|
|
|
+ if (currentLevel < 3) {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ }
|
|
|
+ currentLabel.value = currentLevel === 1 ? '党委书记' : '所长';
|
|
|
+ } else if (currentDepartmentKey.value === 'D') {
|
|
|
+ if (currentLevel < 2) {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ }
|
|
|
+ currentLabel.value = '部门负责人';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 非C和D的部门类型
|
|
|
+ else {
|
|
|
+ if (isEmptyAttachment) {
|
|
|
+ ElMessage.warning('请上传签署材料');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- const params = {
|
|
|
- id: route.query.id,
|
|
|
- updateType: isSignsUpload.value ? 0 : 1,
|
|
|
- signsUpload: isSignsUpload.value ? JSON.stringify(signsUpload) : undefined,
|
|
|
- feedback: !isSignsUpload.value ? JSON.stringify(feedback) : undefined,
|
|
|
- };
|
|
|
- safetyResponsibilityDeptSignOrFeedback(params)
|
|
|
- .then(() => {
|
|
|
- ElMessage.success('责任书签署成功');
|
|
|
- router.push({
|
|
|
- name: 'responsibilityAgreeManageDept',
|
|
|
+ // 通过后就走批量签署逻辑
|
|
|
+ submiting.value = true;
|
|
|
+
|
|
|
+ try {
|
|
|
+ const attachment = await formatAttachmentList(firstItem.attachment);
|
|
|
+ const params = {
|
|
|
+ ids: [route.query.id],
|
|
|
+ attachment: JSON.stringify(attachment),
|
|
|
+ };
|
|
|
+ if (specialDeptKey) {
|
|
|
+ Object.assign(params, {
|
|
|
+ signStatus: 0,
|
|
|
+ signLevel: nextLevel,
|
|
|
+ contractId: route.query.id,
|
|
|
+ signerId: signerId.value,
|
|
|
+ signOrder: nextOrder,
|
|
|
});
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- submiting.value = false;
|
|
|
- });
|
|
|
+ }
|
|
|
+ console.log('params:', params);
|
|
|
+ return;
|
|
|
+ safetyResponsibilityDeptBatchSign(params)
|
|
|
+ .then((res) => {
|
|
|
+ router.push({
|
|
|
+ name: 'responsibilityAgreeManageDept',
|
|
|
+ });
|
|
|
+ ElMessage.success('责任书签署成功');
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ submiting.value = false;
|
|
|
+ });
|
|
|
+ } catch (e: Error | any) {
|
|
|
+ ElMessage.error(e.message);
|
|
|
+ submiting.value = false;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const handleDialogConfirm = () => {
|
|
|
+ if (signerId.value) {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ } else {
|
|
|
+ ElMessage.warning('请选择签署人');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleDialogCancel = () => {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ signerId.value = '';
|
|
|
+ };
|
|
|
+
|
|
|
const handleQueryDetail = () => {
|
|
|
safetyResponsibilityDeptQueryDetail({
|
|
|
id: route.query.id,
|
|
|
@@ -275,22 +403,35 @@
|
|
|
if (name in res) {
|
|
|
Object.assign(formData, {
|
|
|
[name]: res[name],
|
|
|
-
|
|
|
attachment: unformatAttachment(res.attachment),
|
|
|
signsUpload: unformatAttachment(res.signsUpload),
|
|
|
feedback: unformatAttachment(res.feedback),
|
|
|
- signRecords: res.signRecords.map((item) => ({
|
|
|
+ signRecords: res.signRecords?.map((item) => ({
|
|
|
...item,
|
|
|
attachment: unformatAttachment(item.attachment),
|
|
|
})),
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- console.log('@formData:', formData);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- onMounted(() => {
|
|
|
+ const getUserData = (realname = '') => {
|
|
|
+ queryAvailableUserList({
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 300,
|
|
|
+ queryParam: { realname },
|
|
|
+ }).then((res: any) => {
|
|
|
+ userOptions.value = (res.records || [])?.map((u: any) => ({
|
|
|
+ value: u.id,
|
|
|
+ label: u.realname,
|
|
|
+ }));
|
|
|
+ console.log('userData:', userOptions.value);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ onMounted(async () => {
|
|
|
+ await getUserData('');
|
|
|
handleQueryDetail();
|
|
|
});
|
|
|
</script>
|