|
@@ -43,13 +43,16 @@
|
|
|
</template>
|
|
|
</HcCard>
|
|
|
|
|
|
+ <!--批量上报审批-->
|
|
|
+ <HcReportModal title="批量上报审批" url="contractLog/batchTask" :show="showReportModal" :projectId="projectId" :contractId="contractId"
|
|
|
+ :taskName="reportTaskName" :ids="reportIds" @hide="showReportModal = false" @finish="showReportFinish"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import {ref, watch, nextTick} from "vue";
|
|
|
import queryApi from '~api/ledger/query';
|
|
|
-import {getArrValue} from "vue-utils-plus"
|
|
|
+import {getArrValue,getObjValue} from "vue-utils-plus"
|
|
|
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
@@ -173,13 +176,73 @@ const tableSelectionChange = (rows) => {
|
|
|
}
|
|
|
|
|
|
//批量上报
|
|
|
+const showReportModal = ref(false)
|
|
|
+const reportIds = ref('')
|
|
|
+const reportTaskName = ref('')
|
|
|
const reportModalClick = () => {
|
|
|
-
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ //判断是否满足条件
|
|
|
+ const result = rows.every(({status})=> {
|
|
|
+ return status !== 1 && status !== 2
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ if (result) {
|
|
|
+ const row = getObjValue(rows[0])
|
|
|
+ reportIds.value = rowsToId(rows)
|
|
|
+ reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
|
|
|
+ showReportModal.value = true
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
|
|
|
+ }
|
|
|
+}
|
|
|
+//上报完成
|
|
|
+const showReportFinish = () => {
|
|
|
+ showReportModal.value = false
|
|
|
+ getTableData()
|
|
|
}
|
|
|
|
|
|
//批量废除
|
|
|
const batchAbolishClick = () => {
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ //判断是否满足条件
|
|
|
+ const result = rows.every(({status})=> {
|
|
|
+ return status !== 0 && status !== 3
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ if (result) {
|
|
|
+ //拼接ID
|
|
|
+ const ids = rowsToId(rows)
|
|
|
+ window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确定废除',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ callback: (action) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ batchAbolishSave(ids)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('未上报的文件不能废除')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//废除勾选的已上报文件
|
|
|
+const batchAbolishSave = async (ids) => {
|
|
|
+ const { error, code } = await queryApi.batchAbolish({ids: ids})
|
|
|
+ //处理数据
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('批量废除成功')
|
|
|
+ tableCheckedKeys.value = []
|
|
|
+ getTableData()
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+//拼接ID
|
|
|
+const rowsToId = (rows) => {
|
|
|
+ return rows.map((obj) => {
|
|
|
+ return obj.id;
|
|
|
+ }).join(",")
|
|
|
}
|
|
|
</script>
|
|
|
|