Ver código fonte

更换 arrToId、 arrToKey 方法函数

iZaiZaiA 2 anos atrás
pai
commit
50cb407959

+ 0 - 44
src/utils/tools.js

@@ -27,18 +27,6 @@ export const getRowsValue = (arr, key, key2, value) => {
     }
 }
 
-//拼接ID
-export const rowsToId = (rows) => {
-    return rowsToKey(rows, 'id')
-}
-
-//拼接字段
-export const rowsToKey = (rows, key, join = ',') => {
-    return rows.map((obj) => {
-        return obj[key];
-    }).join(join)
-}
-
 //删除提醒
 export const delMessage = (cbk) => {
     window?.$messageBox?.alert('请谨慎考虑后,确认是否需要删除?', '删除提醒', {
@@ -54,38 +42,6 @@ export const delMessage = (cbk) => {
     })
 }
 
-
-//设置复制文本
-export const setCopyText = (text) => {
-    return new Promise((resolve) => {
-        if (window.navigator?.clipboard) {
-            window.navigator.clipboard.writeText(text).then(() => {
-                resolve(true)
-            }).catch(() => {
-                resolve(false)
-            });
-        } else {
-            resolve(false)
-        }
-    })
-}
-
-//取剪切板文本
-export const getCopyText = () => {
-    return new Promise((resolve) => {
-        if (window.navigator?.clipboard) {
-            window.navigator.clipboard.readText().then((text) => {
-                resolve(text)
-            }).catch(() => {
-                resolve(false)
-            });
-        } else {
-            resolve(false)
-        }
-    })
-}
-
-
 //日期格式化
 export const dateFormat = (date, format) => {
     format = format || 'yyyy-MM-dd hh:mm:ss';

+ 2 - 9
src/views/data-fill/division.vue

@@ -361,7 +361,7 @@ import HcTreeData from "./components/division/HcTreeData.vue"
 import HcTreeData1 from "./components/division/HcTreeData1.vue"
 import DivisionTree from "./components/division/DivisionTree.vue"
 import HcTreeNode from "./components/HcTreeNode.vue"
-import {getArrValue, deepClone, formValidate, arrIndex} from "js-fast-way"
+import {getArrValue, deepClone, formValidate, arrIndex, arrToId} from "js-fast-way"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import {getDictionary} from "~api/other"
 import wbsApi from "~api/data-fill/wbs";
@@ -1376,7 +1376,7 @@ const addingFormSave = async () => {
     if (rows.length > 0) {
         addingFormLoading.value = true
         const {primaryKeyId} = treeItemInfo.value
-        const ids = rowsToId(rows, 'primaryKeyId')
+        const ids = arrToId(rows, 'primaryKeyId')
         const arrids = ids.split(',')
         let newStr = [...new Set(arrids)].join(',');
         // console.log(newStr,'ids');
@@ -1405,13 +1405,6 @@ const addingFormClose = () => {
     dialogTableKeys.value = []
 }
 
-//拼接ID
-const rowsToId = (rows, key = 'id') => {
-    return rows.map((obj) => {
-        return obj[key];
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382);
 const onmousedown = () => {

+ 6 - 12
src/views/data-fill/query.vue

@@ -206,7 +206,7 @@ import {useAppStore} from "~src/store";
 import WbsTree from "./components/WbsTree.vue"
 import HcTreeData from "./components/HcTreeData.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
-import {downloadBlob, isString, getObjValue, getArrValue} from "js-fast-way"
+import {downloadBlob, isString, getObjValue, getArrValue, arrToId} from "js-fast-way"
 import queryApi from '~api/data-fill/query';
 import {eVisaTaskCheckApi} from "~api/other"
 
@@ -562,7 +562,7 @@ const reportModalClick = async () => {
         if (taskCheck) {
             //初始ID
             const row = getObjValue(rows[0])
-            reportIds.value = rowsToId(rows)
+            reportIds.value = arrToId(rows)
             //设置任务数据
             let reportDataArr = []
             rows.forEach(item => {
@@ -600,7 +600,7 @@ const showReportFinish = () => {
 const downloadLoading = ref(false)
 const batchDownload = async () => {
     const rows = tableCheckedKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     downloadLoading.value = true
     const {error, disposition, res} = await queryApi.batchDownloadFileToZip({ids: ids})
@@ -619,7 +619,7 @@ const batchDownload = async () => {
 const printLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableCheckedKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     printLoading.value = true
     const {error, code, data} = await queryApi.batchPrint({ids: ids})
@@ -641,7 +641,7 @@ const batchAbolishClick = () => {
     //判断状态
     if (result) {
         //拼接ID
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
             showCancelButton: true,
             confirmButtonText: '确定废除',
@@ -677,7 +677,7 @@ const batchLocal = async () => {
     })
     //判断状态
     if (result) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //请求数据
         localLoading.value = true
         const {error, code, data} = await queryApi.localVerify({
@@ -717,12 +717,6 @@ const batchOnline = async () => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
 
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(505);

+ 4 - 9
src/views/ledger/components/internal.vue

@@ -80,7 +80,7 @@
 import {ref, nextTick, watch} from "vue";
 import internalApi from '~api/ledger/internal';
 import queryApi from '~api/data-fill/query';
-import {downloadBlob, isString, getArrValue} from "js-fast-way"
+import {downloadBlob, isString, getArrValue, arrToId} from "js-fast-way"
 
 //参数
 const props = defineProps({
@@ -250,18 +250,13 @@ const tableInternalSelection = (rows) => {
         return (item ?? '') !== '';
     })
 }
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
+
 //下载
 const downloadLoading = ref(false)
 const batchDownload = async () => {
     const rows = tableInternalKeys.value;
     console.log(rows, 'rows');
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     downloadLoading.value = true
     const {error, disposition, res} = await queryApi.batchDownloadFileToZip({ids: ids})
@@ -280,7 +275,7 @@ const batchDownload = async () => {
 const printLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableInternalKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     printLoading.value = true
     const {error, code, data} = await queryApi.batchPrint({ids: ids})

+ 2 - 11
src/views/ledger/components/table-form.vue

@@ -142,7 +142,7 @@
 
 <script setup>
 import {ref, watch, onMounted, onActivated, onDeactivated, onUnmounted} from "vue";
-import {getObjValue, isString, getArrValue, isNullES, getObjVal} from "js-fast-way"
+import {getObjValue, isString, getArrValue, isNullES, getObjVal, arrToId} from "js-fast-way"
 import DateCalendar from "./dateCalendar/index.vue"
 import HcTableForm from "~com/table-form/index.vue";
 import HTableForm from "~src/plugins/HTableForm"
@@ -632,7 +632,7 @@ const copyTimeLoading = ref(false)
 const copyTimeSaveClick = () => {
     const rows = copyTimeTableKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         copyTheLogBusinessData(ids)
     } else {
         window.$message?.warning('请先勾选记录人')
@@ -660,15 +660,6 @@ const copyTheLogBusinessData = async (ids) => {
     }
 }
 
-
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
-
 //设置表单默认数据
 const setFormDefaultData = (formInfo = {}) => {
     return {

+ 5 - 12
src/views/ledger/components/table-list.vue

@@ -88,7 +88,7 @@
 import {ref, watch, nextTick} from "vue";
 import queryApi from '~api/ledger/query';
 import {eVisaTaskCheckApi} from "~api/other"
-import {getArrValue, getObjValue, isString} from "js-fast-way"
+import {arrToId, getArrValue, getObjValue, isString} from "js-fast-way"
 
 //参数
 const props = defineProps({
@@ -233,7 +233,7 @@ const reportModalClick = async () => {
         if (taskCheck) {
             //初始ID
             const row = getObjValue(rows[0])
-            reportIds.value = rowsToId(rows)
+            reportIds.value = arrToId(rows)
             //设置任务数据
             let reportDataArr = []
             rows.forEach(item => {
@@ -278,7 +278,7 @@ const batchAbolishClick = () => {
     //判断状态
     if (result) {
         //拼接ID
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
             showCancelButton: true,
             confirmButtonText: '确定废除',
@@ -316,7 +316,7 @@ const batchDeleteClick = () => {
     })
     //判断状态
     if (result) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否删除勾选的日志文件?', '删除文件', {
             showCancelButton: true,
             confirmButtonText: '确定删除',
@@ -337,7 +337,7 @@ const previewPrintLoading = ref(false)
 const previewAndPrintClick = async () => {
     previewPrintLoading.value = true
     const rows = tableCheckedKeys.value;
-    const rowsIds = rowsToId(rows)
+    const rowsIds = arrToId(rows)
     const ids = rowsIds.split(',')
     const {error, code, data} = await queryApi.theLogPreviewAndPrint({
         ids: ids
@@ -395,13 +395,6 @@ const theLogRemoveByIds = async (ids) => {
     }
 }
 
-
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
 </script>
 
 <style lang="scss" scoped>

+ 3 - 8
src/views/ledger/components/weather.vue

@@ -73,7 +73,7 @@
 import {ref, nextTick} from "vue";
 import weatherApi from '~api/ledger/weather';
 import queryApi from '~api/data-fill/query';
-import {deepClone, formValidate, getArrValue} from "js-fast-way"
+import {arrToId, deepClone, formValidate, getArrValue} from "js-fast-way"
 
 //参数
 const props = defineProps({
@@ -240,17 +240,12 @@ const tableWeatherSelection = (rows) => {
         return (item ?? '') !== '';
     })
 }
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
+
 //打印
 const printLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableweatherKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     printLoading.value = true
     const {error, code, data} = await queryApi.batchPrint({ids: ids})

+ 3 - 10
src/views/other-file/image-form.vue

@@ -128,7 +128,7 @@ import {useRouter, useRoute} from 'vue-router'
 import WbsTree from "./components/WbsTree.vue"
 import imageApi from '~api/other-file/imageData';
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
-import {formValidate, getObjValue, getRandom, deepClone} from "js-fast-way"
+import {formValidate, getObjValue, getRandom, deepClone, arrToKey} from "js-fast-way"
 import {dateFormat} from '~src/utils/tools'
 import ossApi from "~api/oss";
 
@@ -390,8 +390,8 @@ const verifyFormData = async (log) => {
     //处理文件
     let imageUrl = '', pdfUrl = '';
     if (fileList.length > 0) {
-        imageUrl = rowsToKey(fileList, 'url')
-        pdfUrl = rowsToKey(fileList, 'pdfUrl')
+        imageUrl = arrToKey(fileList, 'url', ',')
+        pdfUrl = arrToKey(fileList, 'pdfUrl', ',')
     }
     //设置数据
     formData.imageUrl = imageUrl
@@ -448,13 +448,6 @@ const updateImageclassifyFile = async (formData, log) => {
     }
 }
 
-//拼接字段
-const rowsToKey = (rows, key) => {
-    return rows.map((obj) => {
-        return obj[key];
-    }).join(",")
-}
-
 //处理data类型的自动展开
 const dataNodeExpandKeys = () => {
     let TimeStr = shootingTimeStr.value || ''

+ 3 - 10
src/views/other-file/image-view.vue

@@ -124,7 +124,7 @@ import WbsTree from "./components/WbsTree.vue"
 import HcTreeData from "./components/HcTreeData.vue"
 import imageApi from '~api/other-file/imageData';
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
-import {downloadBlob, getArrValue, isString} from "js-fast-way"
+import {arrToId, downloadBlob, getArrValue, isString} from "js-fast-way"
 //变量
 const router = useRouter()
 const useRoutes = useRoute()
@@ -401,20 +401,13 @@ const editClick = ({id}) => {
     })
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //下载文件
 const downloadLoading = ref(false)
 const downloadClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         downloadLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         const {error, disposition, res} = await imageApi.batchDownloadFileToZip({ids: ids}, false)
         //判断状态
         if (!error) {
@@ -434,7 +427,7 @@ const delLoading = ref(false)
 const delClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否删除勾选的资料文件?', '删除提醒', {
             showCancelButton: true,
             confirmButtonText: '确定删除',

+ 6 - 13
src/views/other-file/project-scanning.vue

@@ -259,7 +259,7 @@ import HcFileUpload1 from "./components/HcFileUpload1.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import projectScanningApi from "~api/other-file/projectScanning";
 import notableform from '~src/assets/view/notableform.svg';
-import {downloadBlob, getArrValue, deepClone} from "js-fast-way"
+import {downloadBlob, getArrValue, deepClone, arrToId} from "js-fast-way"
 import {eVisaTaskCheckApi} from "~api/other"
 import tasksDataApi from '~api/tasks/data';
 import ossApi from "~api/oss";
@@ -734,7 +734,7 @@ const batchEditSaveApi = async (rows) => {
 const batchDownloadLoading = ref(false)
 const batchDownload = async () => {
     const rows = deepClone(tableCheckedKeys.value)
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     batchDownloadLoading.value = true
     const {error, disposition, res} = await projectScanningApi.batchDownloadFileToZip({ids: ids})
@@ -767,7 +767,7 @@ const reportModalClick = async () => {
             contractId: contractId.value
         })
         if (taskCheck) {
-            reportIds.value = rowsToId(rows)
+            reportIds.value = arrToId(rows)
             //设置任务数据
             let reportDataArr = []
             rows.forEach(item => {
@@ -819,7 +819,7 @@ const certificationModalClick = () => {
     })
     if (result) {
         CertData.value = rows
-        CertIds.value = rowsToId(rows)
+        CertIds.value = arrToId(rows)
         CertPdf.value = rows[0]?.pdfFileUrl || ''
         showCertificationModal.value = true
     } else {
@@ -868,7 +868,7 @@ const batchDel = () => {
         return status === 0
     })
     if (result) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('请谨慎考虑是否要 批量删除文件?', '删除文件', {
             type: 'error',
             showCancelButton: true,
@@ -906,7 +906,7 @@ const batchAbolishClick = () => {
         return status > 0
     })
     if (result) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否废除勾选的已上报文件?', '确认操作', {
             type: 'warning',
             showCancelButton: true,
@@ -936,13 +936,6 @@ const batchAbolishSave = async (ids) => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382)
 const onmousedown = () => {

+ 4 - 11
src/views/other/first-item.vue

@@ -212,7 +212,7 @@ import tasksApi from '~api/tasks/data';
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import queryApi from "~api/data-fill/query";
 import wbsApi from "~api/data-fill/wbs";
-import {getArrValue, getObjValue, isString, deepClone, getObjVal} from "js-fast-way"
+import {getArrValue, getObjValue, isString, deepClone, getObjVal, arrToId} from "js-fast-way"
 //变量
 const router = useRouter()
 const useRoutes = useRoute()
@@ -724,7 +724,7 @@ const toreportModalClick = async (type) => {
                     })
                     reportTaskName.value = isString(data) ? data ?? '' : ''
                 } else {
-                    reportIds.value = rowsToId(rows)
+                    reportIds.value = arrToId(rows)
                     //设置任务数据
                     let reportDataArr = []
                     rows.forEach(item => {
@@ -809,7 +809,7 @@ const showReportFinish = () => {
 const printLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableSelectionKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     printLoading.value = true
     const {error, code, data} = await firstApi.batchPrint({
@@ -834,7 +834,7 @@ const batchAbolishClick = () => {
     //判断状态
     if (result) {
         //拼接ID
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
             showCancelButton: true,
             confirmButtonText: '确定废除',
@@ -860,13 +860,6 @@ const batchAbolishSave = async (ids) => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //处理数据
 const rowsToArr = (rows) => {
     let newArr = [];

+ 4 - 11
src/views/other/first-itemcopy.vue

@@ -217,7 +217,7 @@ import {getReportNumber, eVisaTaskCheckApi} from "~api/other";
 import firstApi from '~api/other/first-item';
 import tasksApi from '~api/tasks/data';
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
-import {getArrValue, getObjValue, isString, deepClone, getObjVal} from "js-fast-way"
+import {getArrValue, getObjValue, isString, deepClone, getObjVal, arrToId} from "js-fast-way"
 import queryApi from "~api/data-fill/query";
 import wbsApi from "~api/data-fill/wbs";
 import ListItem from "./components/ListItem.vue"
@@ -724,7 +724,7 @@ const toreportModalClick = async (type) => {
                     })
                     reportTaskName.value = isString(data) ? data ?? '' : ''
                 } else {
-                    reportIds.value = rowsToId(rows)
+                    reportIds.value = arrToId(rows)
                     //设置任务数据
                     let reportDataArr = []
                     rows.forEach(item => {
@@ -808,7 +808,7 @@ const showReportFinish = () => {
 const printLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableSelectionKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //批量下载
     printLoading.value = true
     const {error, code, data} = await firstApi.batchPrint({
@@ -833,7 +833,7 @@ const batchAbolishClick = () => {
     //判断状态
     if (result) {
         //拼接ID
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
             showCancelButton: true,
             confirmButtonText: '确定废除',
@@ -859,13 +859,6 @@ const batchAbolishSave = async (ids) => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //处理数据
 const rowsToArr = (rows) => {
     let newArr = [];

+ 5 - 12
src/views/tasks/hc-data.vue

@@ -115,7 +115,7 @@ import {useRouter, useRoute} from 'vue-router'
 import TableCard from './components/TableCard.vue';
 import notableform from '~src/assets/view/notableform.svg';
 import {checkFlowUserIsExistPfxFile} from "~api/other"
-import {getArrValue, isString} from "js-fast-way"
+import {arrToKey, getArrValue, isString} from "js-fast-way"
 import tasksApi from '~api/tasks/data';
 import dayjs from "dayjs"
 
@@ -357,10 +357,10 @@ const saveCompleteApprovalTask = async () => {
 const batchCompleteApprovalTask = async () => {
     const rows = checkedRowsRef.value
     SMSAuthLoading.value = true
-    let taskIds = rowsToId(rows, 'taskId')
-    let approvalType = rowsToId(rows, 'approvalType')
-    let formDataId = rowsToId(rows, 'formDataId')
-    let parallelProcessInstanceIds = rowsToId(rows, 'parallelProcessInstanceId')
+    let taskIds = arrToKey(rows, 'taskId', ',')
+    let approvalType = arrToKey(rows, 'approvalType', ',')
+    let formDataId = arrToKey(rows, 'formDataId', ',')
+    let parallelProcessInstanceIds = arrToKey(rows, 'parallelProcessInstanceId', ',')
     const {error, code} = await tasksApi.batchCompleteApprovalTask({
         ...taskReviewForm.value,
         taskIds,
@@ -382,13 +382,6 @@ const batchCompleteApprovalTask = async () => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows, key) => {
-    return rows.map((obj) => {
-        return obj[key];
-    }).join(",")
-}
-
 //设置重签规则
 const showSetSignRulesModal = ref(false)
 const setPactVal = ref(true)

+ 3 - 9
src/views/tasks/message-data.vue

@@ -57,7 +57,7 @@ import {ref, onMounted, watch} from "vue";
 import {useAppStore} from "~src/store";
 import {useRouter, useRoute} from 'vue-router'
 import messageApi from '~api/tasks/message';
-import {getArrValue} from "js-fast-way"
+import {arrToId, getArrValue} from "js-fast-way"
 import website from '~src/config/index'
 
 //变量
@@ -246,7 +246,7 @@ const delClick = () => {
 const delLoading = ref(false)
 const removeData = async (rows) => {
     delLoading.value = true
-    const ids = rowsToId(rows)
+    const ids = arrToId(rows)
     //请求数据
     const {error, code} = await messageApi.removeData({
         ids: ids
@@ -267,7 +267,7 @@ const removeData = async (rows) => {
 const markReadClick = () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         window?.$messageBox?.alert('勾选的消息是否标记为已读?', '确认操作', {
             showCancelButton: true,
             confirmButtonText: '确定标记',
@@ -307,12 +307,6 @@ const setMessageWarningReadApi = async (ids, getTable = true) => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
 </script>
 
 <style lang="scss" scoped>

+ 0 - 7
src/views/tentative/collect/test.vue

@@ -229,13 +229,6 @@ const delModalClick = () => {
     })
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382);
 const onmousedown = () => {

+ 5 - 4
src/views/tentative/detect/outside.vue

@@ -294,8 +294,9 @@ import TestTree from "../material/components/TestTree.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import dataApi from "~api/tentative/detect/third";
 import samplingApi from "~api/tentative/material/sampling"
-import {delMessage, rowsToId} from "~uti/tools";
-import {formValidate, getArrValue} from "js-fast-way"
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
+import {delMessage} from "~uti/tools";
+
 //变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId);
@@ -545,7 +546,7 @@ const copyTableModalClick = () => {
         formModalTitle.value = '复制'
         addEditFormModal.value = true
     } else if (rows.length > 1) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         batchCopyFormApi(ids)
     }
 }
@@ -599,7 +600,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,

+ 2 - 3
src/views/tentative/detect/test-form.vue

@@ -217,9 +217,8 @@ import queryApi from '~api/data-fill/query';
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import TestTree from "../material/components/TestTree.vue"
 import TestTreeMaterial from "../material/components/TestTreeMaterial.vue"
-import {getArrValue, getObjValue, isString} from "js-fast-way"
+import {getArrValue, getObjValue, isString, arrToId} from "js-fast-way"
 import {getDictionary} from "~api/other";
-import {rowsToId} from "~uti/tools";
 import dayjs from "dayjs"
 import {Loading} from "element-plus/es/components/loading/src/service";
 import {eVisaTaskCheckApi} from "~api/other"
@@ -808,7 +807,7 @@ const linksSampleTableSelection = (rows) => {
 //保存关联
 const linksSampleModalSave = async () => {
     const rows = tableSampleCheckedKeys.value
-    listItemBaseData.value.sampleIds = rowsToId(rows) || '';
+    listItemBaseData.value.sampleIds = arrToId(rows) || '';
     window.$message?.success('操作成功')
     isopersampleIds.value = true
     let infodata = await getrecordsamplegetData()

+ 8 - 8
src/views/tentative/detect/test.vue

@@ -217,13 +217,13 @@ import TestTree from "../material/components/TestTree.vue"
 import {getStoreValue, setStoreValue, delStoreValue} from '~src/utils/storage'
 import HcDragUpload from "./components/HcDragUpload.vue"
 import dataApi from "~api/tentative/detect/test";
-import {delMessage, rowsToId} from "~uti/tools";
 import {getDictionary} from "~api/other";
 import {eVisaTaskCheckApi} from "~api/other"
 import wbsApi from "~api/data-fill/wbs"
-import {getArrValue, arrKeyValue, isString} from "js-fast-way"
+import {getArrValue, arrKeyValue, isString, arrToId} from "js-fast-way"
 import {Loading} from "element-plus/es/components/loading/src/service";
 import notableform from '~src/assets/view/notableform.svg';
+import {delMessage} from "~uti/tools";
 
 //变量
 const router = useRouter()
@@ -453,7 +453,7 @@ const tableRowPdf = ({pdfUrl}) => {
 const copyDataClick = () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         copyDataApi(ids)
     } else {
         window.$message?.warning('请先勾选需要复制的记录')
@@ -483,7 +483,7 @@ const delModalClick = () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
         delMessage(() => {
-            const ids = rowsToId(rows)
+            const ids = arrToId(rows)
             removeDataApi(ids)
         })
     } else {
@@ -514,7 +514,7 @@ const printPdfLoading = ref(false)
 const printPdfClick = async () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //请求数据
         printPdfLoading.value = true
         const {error, code, msg, data} = await dataApi.printPdf({
@@ -538,7 +538,7 @@ const quitPdfLoading = ref(false)
 const quitPdfClick = async () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         const res1 = rows.some(item => item.taskStatus === '未上报')
         const res2 = rows.some(item => item.taskStatus === '已废除')
         if (res1) {
@@ -588,7 +588,7 @@ const reportPdfClick = async () => {
             window.$message?.warning('已上报的数据无法再次上报')
         } else {
             reportLoading.value = true
-            const ids = rowsToId(rows)
+            const ids = arrToId(rows)
             reportIds.value = ids
             const taskCheck = await eVisaTaskCheckApi({
                 projectId: projectId.value,
@@ -639,7 +639,7 @@ const printNullPdfLoading = ref(false)
 const printNullPdfClick = async () => {
     const rows = tableCheckedKeys.value;
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //请求数据
         printNullPdfLoading.value = true
         const {error, code, msg, data} = await dataApi.printNullPdf({

+ 4 - 4
src/views/tentative/detect/third.vue

@@ -293,8 +293,8 @@ import TestTree from "../material/components/TestTree.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import dataApi from "~api/tentative/detect/third";
 import samplingApi from "~api/tentative/material/sampling"
-import {formValidate, getArrValue} from "js-fast-way"
-import {delMessage, rowsToId} from "~uti/tools";
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
+import {delMessage} from "~uti/tools";
 
 //变量
 const useAppState = useAppStore()
@@ -546,7 +546,7 @@ const copyTableModalClick = () => {
         formModalTitle.value = '复制'
         addEditFormModal.value = true
     } else if (rows.length > 1) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         batchCopyFormApi(ids)
     }
 }
@@ -600,7 +600,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,

+ 2 - 9
src/views/tentative/device/approach.vue

@@ -508,7 +508,7 @@ const delTableModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await approachApi.removeData({
             contractId: contractId.value,
@@ -529,7 +529,7 @@ const printerClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         printerLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code, data} = await approachApi.exportPdf({
             projectId: projectId.value,
@@ -688,13 +688,6 @@ const downloadImportClick = () => {
     window.open('https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20221109/2be4f32d07f9dd3e43479038b0c4aa2d.xlsx', '_blank')
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(240);
 const onmousedown = () => {

+ 5 - 4
src/views/tentative/device/employ.vue

@@ -171,8 +171,9 @@ import HcSelectTree from "./components/HcSelectTree.vue"
 import {getClassList, deviceClassListInit, queryDeviceList, querySampleList, getSampleInfo} from "~api/tentative";
 import {getContractUserList} from "~api/other";
 import dataApi from "~api/tentative/device/employ";
-import {getRowsValue, rowsToId} from "~uti/tools";
-import {formValidate, getArrValue, getObjValue} from "js-fast-way"
+import {formValidate, getArrValue, getObjValue, arrToId} from "js-fast-way"
+import {getRowsValue} from "~uti/tools";
+
 //初始变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId);
@@ -342,7 +343,7 @@ const delNodeModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             contractId: contractId.value,
@@ -362,7 +363,7 @@ const printerClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         printerLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code, data} = await dataApi.exportPdf({
             projectId: projectId.value,

+ 4 - 4
src/views/tentative/device/overhaul.vue

@@ -142,9 +142,9 @@ import {useAppStore} from "~src/store";
 import HcDragUpload from "./components/HcDragUpload.vue"
 import {getClassList, deviceClassListInit, queryDeviceList, querySampleList} from "~api/tentative";
 import {getContractUserList} from "~api/other";
-import {formValidate, getArrValue} from "js-fast-way"
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
 import dataApi from "~api/tentative/device/overhaul";
-import {getRowsValue, rowsToId} from "~uti/tools";
+import {getRowsValue} from "~uti/tools";
 
 
 //初始变量
@@ -311,7 +311,7 @@ const delNodeModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             contractId: contractId.value,
@@ -331,7 +331,7 @@ const printerClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         printerLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code, data} = await dataApi.exportPdf({
             projectId: projectId.value,

+ 3 - 10
src/views/tentative/laboratory/print.vue

@@ -58,7 +58,7 @@ import WbsTree from "../../data-fill/components/WbsTree.vue"
 import TestTree from "../material/components/TestTree.vue"
 import {getStoreValue, setStoreValue} from '~src/utils/storage'
 import dataApi from "~api/tentative/laboratory/print"
-import {getArrValue, isString} from "js-fast-way"
+import {arrToKey, getArrValue, isString} from "js-fast-way"
 
 //变量
 const useAppState = useAppStore()
@@ -154,13 +154,6 @@ const tableSelection = (rows) => {
 }
 
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.pkeyId;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382);
 const onmousedown = () => {
@@ -181,7 +174,7 @@ const printLoading = ref(false)
 const allprintLoading = ref(false)
 const batchPrint = async () => {
     const rows = tableCheckedKeys.value;
-    const ids = rowsToId(rows)
+    const ids = arrToKey(rows,'pkeyId', ',')
     //批量下载
     printLoading.value = true
     const {error, code, data} = await dataApi.batchPrint({pKeyIds: ids})
@@ -194,7 +187,7 @@ const batchPrint = async () => {
 }
 const batchPrintall = async () => {
     const rows = tableData.value;
-    const ids = rowsToId(rows)
+    const ids = arrToKey(rows,'pkeyId', ',')
     //批量下载
     allprintLoading.value = true
     const {error, code, data} = await dataApi.batchPrint({pKeyIds: ids})

+ 2 - 8
src/views/tentative/laboratory/user.vue

@@ -186,7 +186,7 @@ import {onMounted, ref} from "vue";
 import {useAppStore} from "~src/store";
 import dataApi from "~api/tentative/laboratory/user"
 import FormItemUpload from "./components/FormItemUpload.vue"
-import {getArrValue, arrKeyValue, isIdCard, formValidate} from "js-fast-way"
+import {getArrValue, arrKeyValue, isIdCard, formValidate, arrToId} from "js-fast-way"
 import {getDictionary} from "~api/other";
 
 //初始变量
@@ -418,7 +418,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,
@@ -433,12 +433,6 @@ const tableRemoveData = async () => {
     }
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
 </script>
 
 <style lang="scss" scoped>

+ 3 - 9
src/views/tentative/material/approach.vue

@@ -259,7 +259,7 @@ import HcDragUpload from "./components/HcDragUpload.vue"
 import FormItemUpload from "./components/FormItemUpload.vue"
 import notableform from '~src/assets/view/notableform.svg';
 import approachApi from "~api/tentative/material/approach"
-import {formValidate, getArrValue, arrIndex, deepClone} from "js-fast-way"
+import {formValidate, getArrValue, arrIndex, deepClone, arrToId} from "js-fast-way"
 import {getDictionary} from "~api/other";
 
 //初始变量
@@ -604,7 +604,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await approachApi.removeData({
             projectId: projectId.value,
@@ -625,7 +625,7 @@ const printerClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         printerLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code, data} = await approachApi.exportPdf({
             projectId: projectId.value,
@@ -810,12 +810,6 @@ const downloadImportClick = () => {
     window.open('https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20221109/fea12aaee9d964d2d9f894cc6bf4a2f6.xlsx', '_blank')
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
 </script>
 
 <style lang="scss" scoped>

+ 3 - 11
src/views/tentative/material/sampling.vue

@@ -264,7 +264,7 @@ import HcDragUpload from "./components/HcDragUpload.vue"
 import samplingApi from "~api/tentative/material/sampling"
 import approachApi from "~api/tentative/material/approach";
 import {getContractUserList, getDictionary} from "~api/other";
-import {deepClone, formValidate, getArrValue, arrIndex} from "js-fast-way"
+import {deepClone, formValidate, getArrValue, arrIndex, arrToId} from "js-fast-way"
 
 //变量
 const useAppState = useAppStore()
@@ -600,7 +600,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await samplingApi.removeData({
             projectId: projectId.value,
@@ -621,7 +621,7 @@ const printerClick = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
         printerLoading.value = true
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code, data} = await samplingApi.exportPdf({
             projectId: projectId.value,
@@ -774,14 +774,6 @@ const downloadImportClick = () => {
     window.open('https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20221109/1f1cc15e4e4918d8c793fa6ec0a2ae2a.xlsx', '_blank')
 }
 
-
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(382);
 const onmousedown = () => {

+ 3 - 3
src/views/tentative/parameter/compactness.vue

@@ -55,8 +55,8 @@
 import {onMounted, ref} from "vue";
 import {useAppStore} from "~src/store";
 import dataApi from "~api/tentative/parameter/compactness"
-import {formValidate, getArrValue} from "js-fast-way"
-import {delMessage, rowsToId} from "~uti/tools";
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
+import {delMessage} from "~uti/tools";
 
 //初始变量
 const useAppState = useAppStore()
@@ -211,7 +211,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,

+ 2 - 9
src/views/tentative/parameter/container.vue

@@ -168,7 +168,7 @@
 import {ref, onMounted, watch} from "vue";
 import {useAppStore} from "~src/store";
 import {HcIsButton} from "~src/plugins/IsButtons";
-import {formValidate, getArrValue} from "js-fast-way"
+import {arrToId, formValidate, getArrValue} from "js-fast-way"
 import HcDragUpload from "./components/HcDragUpload.vue"
 import dataApi from "~api/tentative/parameter/container"
 
@@ -595,7 +595,7 @@ const delTableModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         const {containerInitTabName} = menuItem.value
         //删除请求
         const {error, code} = await dataApi.removeData({
@@ -629,13 +629,6 @@ const importModalClose = () => {
     importModal.value = false
 }
 
-//拼接ID
-const rowsToId = (rows) => {
-    return rows.map((obj) => {
-        return obj.id;
-    }).join(",")
-}
-
 //左右拖动,改变树形结构宽度
 const leftWidth = ref(240);
 const onmousedown = () => {

+ 3 - 3
src/views/tentative/parameter/density.vue

@@ -49,8 +49,8 @@
 import {onMounted, ref} from "vue";
 import {useAppStore} from "~src/store";
 import dataApi from "~api/tentative/parameter/density"
-import {formValidate, getArrValue} from "js-fast-way"
-import {delMessage, rowsToId} from "~uti/tools";
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
+import {delMessage} from "~uti/tools";
 
 //初始变量
 const useAppState = useAppStore()
@@ -193,7 +193,7 @@ const delModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         //删除请求
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,

+ 3 - 3
src/views/tentative/parameter/sieve.vue

@@ -116,9 +116,9 @@
 import {ref, onMounted, watch} from "vue";
 import {useAppStore} from "~src/store";
 import {HcIsButton} from "~src/plugins/IsButtons";
-import {formValidate, getArrValue} from "js-fast-way"
+import {formValidate, getArrValue, arrToId} from "js-fast-way"
 import dataApi from "~api/tentative/parameter/sieve"
-import {delMessage, rowsToId} from "~uti/tools";
+import {delMessage} from "~uti/tools";
 
 //初始变量
 const useAppState = useAppStore()
@@ -429,7 +429,7 @@ const delNodeModalClick = () => {
 const tableRemoveData = async () => {
     const rows = tableCheckedKeys.value
     if (rows.length > 0) {
-        const ids = rowsToId(rows)
+        const ids = arrToId(rows)
         const {error, code} = await dataApi.removeData({
             projectId: projectId.value,
             contractId: contractId.value,