Parcourir la source

设备相关前端代码同步

shenqilong il y a 1 an
Parent
commit
32ad863fd9

+ 144 - 0
src/business/platform/form/utils/custom/preview.js

@@ -0,0 +1,144 @@
+import dialog from '@/utils/dialog'
+import Pdfh5 from 'pdfh5'
+import 'pdfh5/css/pdfh5.css'
+import { snapshoot, download } from '@/api/platform/file/attachment' // 印章,快照
+import ActionUtils from '@/utils/action'
+import store from '@/store'
+
+export const preview = (tableForm, url) => {
+    let isMobile = false
+    if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
+        isMobile = true
+    }
+    if (!isMobile) {
+        dialog(
+            {
+                data () {
+                    return {
+                        readonly: false,
+                        data: ''
+                    }
+                },
+
+                template: `<div style="height:100%"><iframe src="${url}" id="myiframe" frameborder="0" scrolling="no" height="100%" width="100%"></iframe></div>`
+            },
+            {
+                dialog: {
+                    appendToBody: true,
+                    width: '90%',
+                    top: '3vh',
+                    center: true,
+                    title: '',
+                    showClose: true,
+                    closeOnClickModal: false,
+                    'custom-class': 'ibps-dialog-91 btn-cover'
+                },
+            },
+            (tpl) => {
+                tableForm.dialogTemplate = tpl
+                const { role } = store.getters.userInfo || {}
+                // 系统管理角色、检验科主任、检验科副主任、文件管理员、技术负责人、质量负责人可下载打印
+                const hasRole = role.some(item => ['xtgljs', 'syszr', 'jykfzr', 'wjgly', 'jsfzr', 'zlfzr', 'jyy'].includes(item.alias))
+                if (1 || hasRole) {
+                    return
+                }
+                setTimeout(() => {
+                    const toolbarCover = document.createElement('div')
+                    toolbarCover.classList.add('toolbar-cover')
+                    toolbarCover.addEventListener('click', () => {
+                        confirm('无权操作,请联系管理员开放相关权限!', '提示')
+                    })
+                    document.querySelector('.btn-cover').children[1].appendChild(toolbarCover)
+                }, 1000)
+            }
+        ).catch((_this) => {
+            _this.visible = false
+            tableForm.dialogTemplate = null
+        })
+    } else {
+        dialog(
+            {
+                data () {
+                    return {
+                        readonly: false,
+                        data: '',
+                        pdfh5: null,
+                        name: '',
+                        url: ''
+                    }
+                },
+                mounted () {
+                    this.getFile()
+                },
+                methods: {
+                    getFile () {
+                        const urlList = url.split('rpx=')[1].split('&id_=')
+                        const name = urlList[0].split('/')
+                        this.name = name[name.length - 1]
+                        const params = {
+                            url: tableForm.$getReportFile(urlList[0], `id_=${urlList[1]}`),
+                            name: name[name.length - 1] || '未命名',
+                            type: 'pdf'
+                        }
+                        snapshoot(params).then(res => {
+                            const { data = null } = res
+                            if (!data) {
+                                tableForm.$message.error('获取文件信息失败!')
+                                return
+                            }
+                            this.getDownload(data.id)
+                        })
+                    },
+                    getDownload (id) {
+                        download({ attachmentId: id }).then(res => {
+                            this.render(res.data)
+                            this.url = res.data
+                        })
+                    },
+                    render (url) {
+                        this.$nextTick(() => {
+                            this.pdfh5 = new Pdfh5('#demo', {
+                                // pdfurl: window.location.origin + '/' + url,
+                                data: url
+                                // lazy: true
+                            })
+                            this.pdfh5.on('complete', (status, msg, time) => {
+                                // console.log(status, msg, time)
+                            })
+                        })
+                    },
+                    close () {
+                        tableForm.dialogTemplate = null
+                        this.visible = false
+                    },
+                    downloadFile () {
+                        ActionUtils.exportFile(this.url, `${this.name}.pdf`)
+                    }
+                },
+                template:
+                `<div style="height:100%">
+                    <div id="demo"></div>
+                    <div style="position:absolute;right: 17px;top: 15px;" >
+                        <i class="el-icon-download" style="font-size: 24px;margin-right:15px" @click="downloadFile"></i>
+                        <i class="el-icon-close" style="font-size: 24px;" @click="close"></i>
+                    </div>
+                </div>`
+            },
+            {
+                dialog: {
+                    appendToBody: true,
+                    width: '90%',
+                    top: '1vh',
+                    center: true,
+                    title: '',
+                    'custom-class': 'ibps-dialog-91'
+                }
+            }, (tpl) => {
+                tableForm.dialogTemplate = tpl
+            }
+        ).catch((_this) => {
+            _this.visible = false
+            tableForm.dialogTemplate = null
+        })
+    }
+}

+ 9 - 3
src/plugins/ibps/index.js

@@ -15,6 +15,8 @@ import i18n from '@/i18n'
 import store from '@/store'
 // 工具类
 import Utils from '@/utils/util'
+// 全局方法
+import common from '@/utils/common'
 // global filters 全局过滤
 import * as filters from '@/filters'
 // 拼音指令
@@ -36,7 +38,7 @@ import pluginLog from '@/plugins/log'
 import pluginOpen from '@/plugins/open'
 // 平台配置文件
 import setting from '@/setting.js'
-import { BASE_URL, REPORT_PATH } from '@/constant'
+import { BASE_URL, BASE_SEAL_API, REPORT_PATH } from '@/constant'
 import env from '@/env'
 
 export default {
@@ -73,13 +75,16 @@ export default {
         }
         const downloadReport = (src, where, type = 6) => {
             // 目前可用type    6:生成报表的pdf文件【默认】   7:生成报表的word文件   3:生成报表的excel文件
-            return `${BASE_URL}demo/reportServlet?action=${type}&file=${encodeURIComponent(src)}.rpx&print=1&srcType=file&paramString=${encodeURIComponent(where)}`
+            return `${BASE_URL}demo/reportServlet?action=${type}&file=${encodeURIComponent(src)}.rpx&print=1&srcType=file&paramString=${getParams(where)}`
         }
         const timer = setInterval(() => { // 定时循环添加参数
             if (getToken()) {
                 // 报表路径
-                Vue.prototype.$reportPash = `${BASE_URL}demo/reportJsp/showReport.jsp?access_token=${getToken()}&rpx=${REPORT_PATH}/`
+                console.log('报表路径')
+
+                Vue.prototype.$reportPath = `${BASE_URL}demo/reportJsp/showReport.jsp?access_token=${getToken()}&rpx=${REPORT_PATH}/`
                 Vue.prototype.$getReportFile = downloadReport // 通过方法函数,拼接url,并将字符串格式化
+                Vue.prototype.$getSealUri = `${BASE_SEAL_API}no/getSealFile/` // 微签 回显获取文件地址
                 Vue.prototype.$getFileDow = `${BASE_URL}ibps/platform/v3/file/download?attachmentId=` // 文件下载地址
                 clearInterval(timer) // 添加成功后即删除定时任务
             }
@@ -113,6 +118,7 @@ export default {
         Vue.use(pluginOpen)
         // 使用帮助类
         Vue.prototype.$utils = Utils
+        Vue.prototype.$common = common
         // 快速打印 log
         Vue.prototype.$log = Utils.log
     }

+ 2 - 4
src/store/getters.js

@@ -4,7 +4,7 @@ export default {
     name: state => state.ibps.user.info && state.ibps.user.info.employee ? state.ibps.user.info.employee.name : '', // 姓名
     status: state => state.ibps.user.info && state.ibps.user.info.employee ? state.ibps.user.info.employee.status : '', // 用户状态
     org: state => state.ibps.user.info ? state.ibps.user.info.org : {}, // 用户部门信息
-    position: state => state.ibps.user.info ? state.ibps.user.info.org : {}, // 用户部门信息
+    position: state => state.ibps.user.info && state.ibps.user.info.employee ? state.ibps.user.info.employee.positions : '', // 用户部门信息
     isSuper: state => state.ibps.user.info && state.ibps.user.info.user ? state.ibps.user.info.user.isSuper === 'Y' : false, // 是否超级管理员
     account: state => state.ibps.user.info && state.ibps.user.info.user ? state.ibps.user.info.user.account : '', // 用户名
     regOpen: state => state.ibps.user.regOpen, // 注册状态
@@ -40,7 +40,5 @@ export default {
     // 获取所有用户信息
     userList: state => state.ibps.param && state.ibps.param.userList ? state.ibps.param.userList : [],
     // 获取所有部门信息
-    deptList: state => state.ibps.param && state.ibps.param.deptList ? state.ibps.param.deptList : [],
-    // 获取用户最高层级
-    level: state => state.ibps.param && state.ibps.param.level ? state.ibps.param.level : []
+    deptList: state => state.ibps.param && state.ibps.param.deptList ? state.ibps.param.deptList : []
 }

+ 1 - 9
src/store/modules/ibps/modules/param.js

@@ -10,11 +10,7 @@ export default {
         // 所有用户信息
         userList: [],
         // 所有部门信息
-        deptList: [],
-        level: {
-            first: '',
-            second: ''
-        }
+        deptList: []
     },
     mutations: {
         jianCeDuiXiangIdSet (state, jianCeDuiXiang) {
@@ -48,10 +44,6 @@ export default {
         },
         setDeptList ({ commit }, data) {
             commit('deptList', data)
-        },
-        setLevel ({ commit }, data) {
-            console.log(data)
-            commit('level', data)
         }
     }
 }

+ 0 - 10
src/store/modules/ibps/modules/user.js

@@ -87,19 +87,9 @@ export default {
                         let levelID = ''
                         if (info.org && info.org.levelID) {
                             levelID = info.org.levelID
-
-                            level = {
-                                first: info.org.id,
-                                second: info.org.levelID
-                            }
-                            await dispatch('ibps/param/setLevel', level, {
-                                root: true
-                            })
                         }
                         console.log(info)
 
-                        let level = {}
-
                         await dispatch('getDeptList', levelID)
                         // 获取当前子系统
                         await dispatch('ibps/system/loadSystem', null, {

+ 186 - 0
src/utils/common.js

@@ -0,0 +1,186 @@
+// 通用工具类,定义通用函数及常用接口
+import { mapValues } from 'lodash'
+import { encryptByAes, decryptByAes } from '@/utils/encrypt'
+import { preview } from '@/business/platform/form/utils/custom/preview'
+import request from '@/business/platform/form/utils/custom/joinCURD'
+import pinyin4js from 'pinyin4js'
+import { snapshoot } from '@/api/platform/file/attachment'
+import { getNextIdByAlias, reagentConsumablesInventory } from '@/api/platform/system/identity'
+import { save as sendMsg } from '@/api/platform/message/innerMessage'
+import { save as saveNews, manage, internal } from '@/api/platform/system/news'
+import { bpmTaskSave } from '@/api/platform/bpmn/bpmTask'
+import { onlyOfficeToPdf } from '@/api/platform/form/seal'
+import { downloadFile as download } from '@/business/platform/file/utils'
+import { removeFormData } from '@/api/platform/data/dataTemplate'
+import { queryPageList as queryRole } from '@/api/platform/org/employee'
+// 引入工具类
+import Utils from '@/utils/util'
+import ActionUtils from '@/utils/action'
+
+// base64解码
+const decode = str => decodeURIComponent(window.atob(str).split('').map(c => `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`).join(''))
+
+// 下载
+export const downloadByBlob = (o, name) => {
+    if (!(o instanceof Blob)) {
+        return
+    }
+
+    if (window.navigator.msSaveBlob) {
+        window.navigator.msSaveBlob(o, name)
+    } else {
+        const URL = window.URL || window.webkitURL || window
+        const e = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
+        e.href = URL.createObjectURL(o)
+        e.download = name
+
+        if (document.all) {
+            e.click()
+        } else {
+            const ev = document.createEvent('MouseEvents')
+            ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, false, false, false, false, 0, null)
+            e.dispatchEvent(ev)
+        }
+    }
+}
+
+// 获取当前时间
+export const getDateNow = (length = 10, formatType) => {
+    if (formatType === 'string') {
+        return new Date(new Date().getTime() + 28800000).toJSON().slice(0, length).replace(/[-:T]/g, '')
+    }
+    return new Date(new Date().getTime() + 28800000).toJSON().slice(0, length).replace('T', ' ')
+}
+
+// 获取指定值后的日期
+export const getDate = (type, value, date) => {
+    const d = date || getDateNow(19)
+    if (typeof type !== 'string' || !Number.isInteger(value) || typeof d !== 'string') {
+        console.log('参数类型错误')
+        return null
+    }
+    const now = new Date(d)
+    const D = {
+        day: value * 24 * 60 * 60 * 1000,
+        hour: value * 60 * 60 * 1000,
+        minute: value * 60 * 1000,
+        second: value * 1000
+    }
+    const year = now.getFullYear()
+    const month = now.getMonth()
+    const day = now.getDate()
+    const hour = now.getHours()
+    const minute = now.getMinutes()
+    const second = now.getSeconds()
+
+    switch (type) {
+        case 'year': {
+            const isLeapYear = new Date(year + value, 1, 29).getDate() === 29
+            return new Date(year + value, isLeapYear && month === 1 && day === 29 ? 1 : month, isLeapYear && month === 1 && day === 29 ? 29 : day, hour, minute, second)
+        }
+        case 'month': {
+            let newYear = year
+            let newMonth = month + value
+            if (newMonth < 0) {
+                newYear -= Math.ceil(Math.abs(newMonth) / 12)
+                newMonth = 12 - Math.abs(newMonth) % 12
+            } else if (newMonth > 11) {
+                newYear += Math.floor(newMonth / 12)
+                newMonth = newMonth % 12
+            }
+            const isLeapMonth = new Date(newYear, newMonth + 1, 0).getDate() === 29
+            return new Date(newYear, isLeapMonth && month === 1 && day === 29 ? 1 : newMonth, isLeapMonth && month === 1 && day === 29 ? 29 : day, hour, minute, second)
+        }
+        case 'day': case 'hour': case 'minute': case 'second':
+            return new Date(now.getTime() + D[type])
+        default:
+            console.log('无效的日期类型')
+            return null
+    }
+}
+
+// 时间格式化
+export const getFormatDate = (type, length, date = new Date()) => {
+    const now = new Date(new Date(date).getTime())
+    // eslint-disable-next-line
+    if (now == 'Invalid Date') {
+        console.log('非法日期,无法格式化')
+        return date
+    }
+    const year = now.getFullYear()
+    const month = now.getMonth() + 1
+    const day = now.getDate()
+    const hours = now.getHours()
+    const minutes = now.getMinutes()
+    const seconds = now.getSeconds()
+    // 补零
+    const padZero = (num) => {
+        return num.toString().padStart(2, '0')
+    }
+    // 默认返回String类型
+    let result = `${year}-${padZero(month)}-${padZero(day)} ${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`
+    switch (type) {
+        case 'string':
+            result = `${year}-${padZero(month)}-${padZero(day)} ${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`
+            break
+        case 'cn':
+            result = `${year}年${padZero(month)}月${padZero(day)}日 ${padZero(hours)}时${padZero(minutes)}分${padZero(seconds)}秒`
+            break
+        case 'number':
+            result = `${year}${padZero(month)}${padZero(day)}${padZero(hours)}${padZero(minutes)}${padZero(seconds)}`
+            break
+        default:
+            break
+    }
+    return result.slice(0, length || result.length)
+}
+
+/**
+ * 替换对象中的null为空字符串
+ * @param  {Object} obj 目标对象
+ */
+export const replaceNullWithEmpty = obj => {
+    function replaceValue (value) {
+        if (value === null || typeof value === 'undefined') {
+            return ''
+        } else if (typeof value === 'object') {
+            if (Array.isArray(value)) {
+                return value.map(item => replaceValue(item))
+            } else {
+                return mapValues(value, v => replaceValue(v))
+            }
+        } else {
+            return value
+        }
+    }
+    return replaceValue(obj)
+}
+
+export default {
+    preview,
+    request,
+    pinyin4js,
+    snapshoot,
+    getNextIdByAlias,
+    reagentConsumablesInventory,
+    decode,
+    encryptByAes,
+    decryptByAes,
+    downloadByBlob,
+    sendMsg,
+    saveNews,
+    internal,
+    manage,
+    bpmTaskSave,
+    getDate,
+    getDateNow,
+    getFormatDate,
+    onlyOfficeToPdf,
+    generateUUID: Utils.guid,
+    download,
+    removeFormData,
+    replaceNullWithEmpty,
+    queryRole,
+    Utils,
+    ActionUtils
+}

+ 38 - 0
src/utils/encrypt.js

@@ -0,0 +1,38 @@
+import CryptoJS from 'crypto-js'
+const key = CryptoJS.enc.Utf8.parse('dmngJmmO+9GMw+tu')
+const iv = CryptoJS.enc.Utf8.parse('sanXyqhk8+U7LPP4')
+// AES加密
+export const encryptByAes = pwd => {
+    let encrypted = ''
+    if (typeof pwd === 'string') {
+        const srcs = CryptoJS.enc.Utf8.parse(pwd)
+        const options = {
+            iv: iv,
+            mode: CryptoJS.mode.CBC, // 使用CBC模式
+            padding: CryptoJS.pad.Pkcs7 // 使用PKCS7填充
+        }
+        encrypted = CryptoJS.AES.encrypt(srcs, key, options)
+    } else if (typeof pwd === 'object') {
+        const data = JSON.stringify(pwd)
+        const srcs = CryptoJS.enc.Utf8.parse(data)
+        const options = {
+            iv: iv,
+            mode: CryptoJS.mode.CBC, // 使用CBC模式
+            padding: CryptoJS.pad.Pkcs7 // 使用PKCS7填充
+        }
+        encrypted = CryptoJS.AES.encrypt(srcs, key, options)
+    }
+    return encrypted.ciphertext.toString(CryptoJS.enc.Base64)
+}
+
+export const decryptByAes = encryptedText => {
+    const options = {
+        iv: iv,
+        mode: CryptoJS.mode.CBC, // 使用CBC模式
+        padding: CryptoJS.pad.Pkcs7 // 使用PKCS7填充
+    }
+    const encryptedData = CryptoJS.enc.Base64.parse(encryptedText)
+    const decryptedData = CryptoJS.AES.decrypt({ ciphertext: encryptedData }, key, options)
+    const decryptedText = decryptedData.toString(CryptoJS.enc.Utf8)
+    return decryptedText.trim()
+}

+ 1 - 1
src/utils/query.js

@@ -124,7 +124,7 @@ import { Message } from 'element-ui'
  */
 export const getSetting = async (module = '', key = '') => {
     try {
-        const org = store.getters.level.first || ''
+        const org = store.getters.org.id
         const sql = `select setting from t_ipcc where org_ = '${org}' limit 1`
         const { variables: { data = [] } = {}} = await request('sql', sql)
         if (data.length > 0 && data[0]?.setting) {

+ 14 - 15
src/views/component/device/deviceDialog.vue

@@ -57,7 +57,7 @@
                                             </template>
                                             <ibps-user-selector
                                                 v-model="form.bianZhiBuMen"
-                                                type="position"
+                                                type="org"
                                                 readonly-text="text"
                                                 :disabled="false"
                                                 :multiple="false"
@@ -191,7 +191,7 @@
                                             <ibps-custom-dialog
                                                 v-model="form.cunFangWeiZhi"
                                                 size="mini"
-                                                template-key="fjxzkdd"
+                                                template-key="fjwzdhk"
                                                 :disabled="false"
                                                 type="dialog"
                                                 class="custom-dialog"
@@ -240,10 +240,10 @@
                                 <el-row :gutter="20">
                                     <el-col :span="8">
                                         <el-form-item label="供应商:">
-                                            <ibps-custom-dialog
+                                            <!-- <ibps-custom-dialog
                                                 v-model="form.shiFouQiJianH"
                                                 size="mini"
-                                                template-key="gysxxdhk"
+                                                template-key="mjsbxzgysdhk"
                                                 :disabled="false"
                                                 type="dialog"
                                                 class="custom-dialog"
@@ -251,7 +251,8 @@
                                                 icon="el-icon-search"
                                                 style="width:100%"
                                                 @change-link-data="shiFouQiJianHChange"
-                                            />
+                                            /> -->
+                                            <el-input v-model="form.shiFouQiJianH" size="mini" />
                                         </el-form-item>
                                     </el-col>
                                     <el-col :span="8">
@@ -443,7 +444,7 @@
                                                             <ibps-custom-dialog
                                                                 v-model="form.weiHuFangShi"
                                                                 size="mini"
-                                                                template-key="sbbqdhk"
+                                                                template-key="sbfzpz"
                                                                 multiple
                                                                 :disabled="false"
                                                                 type="dialog"
@@ -554,17 +555,18 @@
                                                 <el-row v-if="form.shiFouXiaoZhun==='是'">
                                                     <el-col>
                                                         <el-form-item label="检定/校准单位:">
-                                                            <ibps-custom-dialog
+                                                            <!-- <ibps-custom-dialog
                                                                 v-model="form.shiYongKeShi"
                                                                 size="mini"
-                                                                template-key="gysxxdhk"
+                                                                template-key="mjsbxzgysdhk"
                                                                 :disabled="false"
                                                                 type="dialog"
                                                                 class="custom-dialog"
                                                                 placeholder="请选择"
                                                                 icon="el-icon-search"
                                                                 style="width:100%"
-                                                            />
+                                                            /> -->
+                                                            <el-input v-model="form.shiYongKeShi" size="mini" />
                                                         </el-form-item>
                                                     </el-col>
                                                 </el-row>
@@ -767,7 +769,7 @@ export default {
         }
     },
     data () {
-        const { userId, position, level, deptList } = this.$store.getters
+        const { userId, org, position, deptList } = this.$store.getters
         return {
             tabItems: [
                 { label: '维护项目', name: 'two', ref: 'MaintenanceRef', data: 'maintenanceItemPoList', component: 'Maintenance', isKeepAlive: false },
@@ -797,8 +799,7 @@ export default {
             userId: userId,
             position: position,
             deptList: deptList,
-            level: level.second || level.first,
-            org: level.first || '',
+            orgId: org.id,
             loading: false,
             title: '设备档案卡',
             toolbars: [
@@ -1246,8 +1247,7 @@ export default {
                 this.form.xiaoZhunWuCha = '否'
                 this.form.jieShouZhuangTai = '新设备'
                 this.form.bianZhiRen = this.userId
-                const pos = this.position.split(',')
-                this.form.bianZhiBuMen = pos[pos.length - 1]
+                this.form.bianZhiBuMen = this.orgId
                 this.form.bianZhiShiJian = dayjs().format('YYYY-MM-DD HH:mm')
                 this.form.shiFouGuoShen = '已完成'
                 this.form.sheBeiLeiXing = '检验系统'
@@ -1255,7 +1255,6 @@ export default {
                 this.form.shiFouXiaoZhun = '是'
                 this.form.jianKongYiJu = '否'
                 this.form.shiFouWeiHu = '是'
-                this.form.diDian = this.level
             }
             this.loading = false
         }

+ 37 - 42
src/views/component/device/index.vue

@@ -26,7 +26,7 @@
                     >
                         <ibps-user-selector
                             v-model="row.bianZhiBuMen"
-                            type="position"
+                            type="org"
                             readonly-text="text"
                             :multiple="true"
                             :disabled="true"
@@ -54,7 +54,7 @@
                         <ibps-custom-dialog
                             v-model="row.weiHuFangShi"
                             size="mini"
-                            template-key="sbbqdhk"
+                            template-key="sbfzpz"
                             multiple
                             :disabled="true"
                             type="dialog"
@@ -79,7 +79,7 @@
                         <ibps-custom-dialog
                             v-model="row.cunFangWeiZhi"
                             size="mini"
-                            template-key="fjxzkdd"
+                            template-key="fjwzdhk"
                             multiple
                             :disabled="true"
                             type="dialog"
@@ -154,7 +154,7 @@
                                                     <span class="span">建档部门:</span>
                                                     <ibps-user-selector
                                                         :value="row.bianZhiBuMen"
-                                                        type="position"
+                                                        type="org"
                                                         readonly-text="text"
                                                         :disabled="true"
                                                         :multiple="false"
@@ -229,7 +229,7 @@
                     <template slot="pos">
                         <ibps-user-selector
                             v-model="search.pos"
-                            type="position"
+                            type="org"
                             readonly-text="text"
                             :multiple="true"
                             size="mini"
@@ -297,7 +297,7 @@
                         <ibps-custom-dialog
                             v-model="search.deviceClass"
                             size="mini"
-                            template-key="sbbqdhk"
+                            template-key="sbfzpz"
                             multiple
                             :disabled="false"
                             type="dialog"
@@ -323,7 +323,7 @@
 
         <bpmn-formrender
             :visible="npmDialogFormVisible"
-            def-id="1120718364969271296"
+            def-id="1055162372286578688"
             @close="visible => npmDialogFormVisible = visible"
         />
         <DeviceTag :scan-visible="printVisible" :obj="printObj" :state-list="stateList" @scanOff="scanOff" />
@@ -372,7 +372,9 @@ export default {
     },
     mixins: [FixHeight],
     data () {
-        const { userId, level = {}, position } = this.$store.getters || {}
+        const { userId, position } = this.$store.getters || {}
+        console.log(userId, position)
+
         return {
             filter: [{
                 descVal: '1',
@@ -423,7 +425,6 @@ export default {
             params: {},
             deviceDialogShow: false,
             position: position,
-            level: level.second || level.first,
             userId: userId,
             search: {
                 pos: '',
@@ -653,10 +654,6 @@ export default {
                 relation: 'AND',
                 parameters: []
             }
-            // 增加地点过滤
-            const obj = { relation: 'AND', parameters: [] }
-            obj.parameters.push({ key: 'Q^di_dian_^S', value: this.level, param: this.$utils.guid() })
-            parameters.parameters.push(obj)
 
             // 部门搜索(可多选)
             if (this.search.pos) {
@@ -745,8 +742,8 @@ export default {
         },
         // 查看表单
         goLookForm (row) {
-            const first = this.$store.getters.level.first
-            this.srcUrl = this.$reportPath.replace('show', 'pdf') + '设备/设备档案卡.rpx&id_=' + row.id + '&org_=' + first
+            const orgId = this.$store.getters.org.id
+            this.srcUrl = this.$reportPath.replace('show', 'pdf') + '设备/设备档案卡.rpx&id_=' + row.id
             this.iframeVisible = true
         },
         // 按钮事件处理
@@ -836,6 +833,8 @@ export default {
             this.getDatas()
         },
         goEdit (row) {
+            console.log('aa')
+
             this.params = row
             this.deviceDialogShow = true
         },
@@ -960,9 +959,9 @@ export default {
         },
         async switchExportData (data) {
             const deviceGroupSql = `select id_,wei_hu_gang_wei_ from t_sbwhgwpzb` // 设备分组信息
-            const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb` // 供应商信息
+            // const supplierSql = `select id_,gong_ying_shang_m from t_hggysxx` // 供应商信息
             const { variables: { data: deviceGroupData }} = await this.$common.request('sql', deviceGroupSql)
-            const { variables: { data: gysData }} = await this.$common.request('sql', supplierSql)
+            // const { variables: { data: gysData }} = await this.$common.request('sql', supplierSql)
             const exportData = JSON.parse(JSON.stringify(data))
             for (let i = 0; i < exportData.length; i++) {
                 const item = exportData[i]
@@ -970,7 +969,7 @@ export default {
                 item.guanLiRen = this.switchIdToUserName(item.guanLiRen.split(',')[0])
                 item.biXuDeHuanJin = this.switchIdToUserName(item.biXuDeHuanJin.split(',')[0])
                 item.weiHuFangShi = this.switchDeviceIdToName(item.weiHuFangShi, deviceGroupData)
-                item.shiYongKeShi = this.switchGYSIdToName(item.shiYongKeShi, gysData)
+                // item.shiYongKeShi = this.switchGYSIdToName(item.shiYongKeShi, gysData)
                 if (this.stateList[item.sheBeiZhuangTa]) {
                     item.sheBeiZhuangTa = this.stateList[item.sheBeiZhuangTa]
                 }
@@ -1231,9 +1230,9 @@ export default {
      * 过滤出来excel 的原设备编号存在当前数据库中的数据
      * @param {*} list 导入的数据
      */
-        async filterOriginalDeviceNo (list, currentPosition) {
+        async filterOriginalDeviceNo (list) {
             const uniqueArr = Array.from(new Set(list.map(i => i.yuanSheBeiBian.trim())))
-            const sql = `select id_,yuan_she_bei_bian from t_sbdj where find_in_set(yuan_she_bei_bian,'${uniqueArr.join(',')}')and di_dian_ = '${currentPosition}'`
+            const sql = `select id_,yuan_she_bei_bian from t_sbdj where find_in_set(yuan_she_bei_bian,'${uniqueArr.join(',')}')`
             const res = await this.$common.request('sql', sql)
             const { data = [] } = res.variables || {}
             const originalDeviceNoList = data.map(i => i.yuan_she_bei_bian.trim())
@@ -1252,12 +1251,11 @@ export default {
      * @param {*} currentUser 当前用户ID
      * @param {*} currentPosition 当前地点ID
      */
-        async handleBasicData (list, currentTime, currentApartment, currentUser, currentPosition, deptList) {
+        async handleBasicData (list, currentTime, currentApartment, currentUser, deptList) {
             // 使用map生成一个异步操作的数组
             const promises = list.map(async (element) => {
                 element.bianZhiShiJian = currentTime
                 element.bianZhiRen = currentUser
-                element.diDian = currentPosition
                 element.shiFouGuoShen = '已完成'
                 const o = deptList?.find(i => i.positionName === element.bianZhiBuMen.trim())
                 const { positionId = currentApartment } = o || {}
@@ -1279,11 +1277,11 @@ export default {
      * @param {*} employeeList 现有人员信息
      * @returns
      */
-        handleExcelData (list, positionList, supplierList, employeeList, deviceGroupList) {
+        handleExcelData (list, positionList, employeeList, deviceGroupList) {
             if (list.length < 1) {
                 return
             }
-            this.handleSupplierInfo(list, supplierList)
+            // this.handleSupplierInfo(list, supplierList)
             this.handlePositionInfo(list, positionList)
             this.handlePersonInfo(list, employeeList)
             this.handleDeviceGroupInfo(list, deviceGroupList)
@@ -1392,11 +1390,10 @@ export default {
                     i.sheBeiZhuangTa = keyFound[0]
                 }
             })
-            const currentPosition = this.level
             const { userList = [], deptList = [] } = this.$store.getters || {}
-            const positionSql = `select id_,fang_jian_ming_ha from t_jjqfjb where di_dian_ = ${currentPosition}` // 房间信息
-            const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb where di_dian_ = ${currentPosition}` // 供应商信息
-            const deviceGroupSql = `select id_,suo_shu_bu_men_,wei_hu_gang_wei_ from t_sbwhgwpzb where di_dian_ =  ${currentPosition}` // 设备分组信息
+            const positionSql = `select id_,fang_jian_ming_ha from t_jjqfjb ` // 房间信息
+            // const supplierSql = `select id_,gong_ying_shang_m from t_hggysxx ` // 供应商信息
+            const deviceGroupSql = `select id_,suo_shu_bu_men_,wei_hu_gang_wei_ from t_sbwhgwpzb` // 设备分组信息
             const currentTime = dayjs().format('YYYY-MM-DD HH:mm')
             const currentApartment = this.$store.getters.userInfo.employee.positions
             const currentUser = this.userId
@@ -1405,21 +1402,19 @@ export default {
             if (!partOneInvalidResult) return
 
             importData = this.formatDateFieldsToReal(importData)
-            console.log('%c partOne doCheck is completed! %c the result is %c', 'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;', 'background:#FF5733; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;', 'background:transparent', importData)
             this.loading = true
-            Promise.all([this.$common.request('sql', positionSql), this.$common.request('sql', supplierSql), this.$common.request('sql', deviceGroupSql)]).then(async ([res1, res2, res3]) => {
+            Promise.all([this.$common.request('sql', positionSql), this.$common.request('sql', deviceGroupSql)]).then(async ([res1, res2, res3]) => {
+                console.log('sss')
                 const { data: positionList = [] } = res1.variables || {}
-                const { data: supplierList = [] } = res2.variables || {}
+                // const { data: supplierList = [] } = res2.variables || {}
                 const { data: deviceGroupList = [] } = res3.variables || {}
                 // 根据原设备编号去重,检验原设备编号是否在数据库中存在
-                const originalDeviceNoList = await this.filterOriginalDeviceNo(importData, currentPosition)
-                await this.handleBasicData(importData, currentTime, currentApartment, currentUser, currentPosition, deptList)
-                this.handleExcelData(importData, positionList, supplierList, userList, deviceGroupList)
+                const originalDeviceNoList = await this.filterOriginalDeviceNo(importData)
+                await this.handleBasicData(importData, currentTime, currentApartment, currentUser, deptList)
+                this.handleExcelData(importData, positionList, userList, deviceGroupList)
                 // 分离出 已存在的设备,和新设备
                 const newDeviceList = importData.filter(i => !originalDeviceNoList.includes(i.yuanSheBeiBian.trim()))
                 const existDeviceList = importData.filter(i => originalDeviceNoList.includes(i.yuanSheBeiBian.trim()))
-                console.log('%c new device %c', 'background:#FF5733; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;', 'background:transparent', newDeviceList)
-                console.log('%c already exist device %c', 'background:#43f80c; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;', 'background:transparent', existDeviceList)
                 this.loading = false
                 this.$confirm(`<span style="color:#f56c6c; font-size: 18px; font-weight: 600;">
                                         经系统判定</span><br>1.预期新导入设备的数量为 ${newDeviceList.length} 台!<br>
@@ -1455,11 +1450,12 @@ export default {
                 } else {
                     params = item // 直接使用当前 item
                 }
-                console.log(params)
                 // 将每个 saveEquipmentCard 请求加入到 allRequests 数组中
                 allRequests.push(saveEquipmentCard(params))
             }
             // 等待所有异步请求完成
+            console.log(allRequests, '000')
+
             await Promise.all(allRequests)
             this.loading = false
         },
@@ -1542,11 +1538,10 @@ export default {
                     item.weiHuRiQi = '/'
                 }
             })
-            const currentPosition = this.level
             const { userList = [], deptList = [] } = this.$store.getters || {}
-            const positionSql = `select id_,fang_jian_ming_ha from t_jjqfjb where di_dian_ = ${currentPosition}` // 房间信息
-            const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb where di_dian_ = ${currentPosition}` // 供应商信息
-            const deviceGroupSql = `select id_,suo_shu_bu_men_,wei_hu_gang_wei_ from t_sbwhgwpzb where di_dian_ =  ${currentPosition}` // 设备分组信息
+            const positionSql = `select id_,fang_jian_ming_ha from t_jjqfjb ` // 房间信息
+            // const supplierSql = `select id_,gong_ying_shang_m from t_gysxxb ` // 供应商信息
+            const deviceGroupSql = `select id_,suo_shu_bu_men_,wei_hu_gang_wei_ from t_sbwhgwpzb` // 设备分组信息
             const currentTime = dayjs().format('YYYY-MM-DD HH:mm')
             const currentApartment = this.$store.getters.userInfo.employee.positions
             const currentUser = this.userId
@@ -1557,7 +1552,7 @@ export default {
             // 2、根据原设备编号去重,检验原设备编号是否在数据库中存在,如有不存在的数据,不进行导入,并提示用户
             const uniqueArr = Array.from(new Set(importData.map(i => i.yuanSheBeiBian.trim())))
             /* 3、根据去重的设备编号去查对应的设备ID,然后拼接data数据,赋值设备ID*/
-            const sql = `select id_,yuan_she_bei_bian from t_sbdj where find_in_set(yuan_she_bei_bian,'${uniqueArr.join(',')}')and di_dian_ = ${currentPosition}`
+            const sql = `select id_,yuan_she_bei_bian from t_sbdj where find_in_set(yuan_she_bei_bian,'${uniqueArr.join(',')}')`
             this.$common.request('sql', sql).then(async res => {
                 const deviceNoWithIdlist = res.variables.data
                 console.log(deviceNoWithIdlist, ' <=> ', uniqueArr)

+ 3 - 1
src/views/component/device/maintenanceRecord.vue

@@ -17,7 +17,7 @@
                 <template slot-scope="{row}">
                     <ibps-user-selector
                         :value="row.bianZhiBuMen"
-                        type="position"
+                        type="org"
                         readonly-text="text"
                         :disabled="true"
                         :multiple="true"
@@ -107,6 +107,8 @@ export default {
             this.DialogVisible = true
         },
         async getData () {
+            console.log('aa')
+
             this.loading = true
             const { data: { dataResult, pageResult }} = await queryMaintenanceRecord({
                 requestPage: this.requestPage,

+ 2 - 2
src/views/component/device/repairRecord.vue

@@ -83,8 +83,8 @@ export default {
     methods: {
         // 查看表单
         goLookForm (row) {
-            const first = this.$store.getters.level.first
-            this.srcUrl = this.$reportPath.replace('show', 'pdf') + '设备/设备维修记录表.rpx&id_=' + row.id + '&org_=' + first
+            const orgId = this.$store.getters.org.id
+            this.srcUrl = this.$reportPath.replace('show', 'pdf') + '设备/设备维修记录表.rpx&id_=' + row.id + '&org_=' + orgId
             this.iframeVisible = true
         },
         async getData () {