diff --git a/src/api/index.js b/src/api/index.js index c24602e..4e10d0c 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -40,8 +40,21 @@ export const save = (params) => { data: params }) } - - +//发起设备检查 +export const createDeviceInsp = (params) => { + return request({ + url: `/sis/api/${website.hostAddress}/deviceinspection/create`, + method: 'post', + data: params + }) +} +//获取设备信息详情 +export const getDevice = (id) => { + return request({ + url: `/sis/api/${website.hostAddress}/device/detail/${id}`, + method: 'get' + }) +} //获取设备检查待办详情 export const getDeviceDetail = (id) => { return request({ @@ -158,3 +171,14 @@ export const handoverFaceMatch = (file) => { data: formData }) }; + +// 获取影像平台附件链接 +export const getFileURL = (busiBeginDate,contentId) => { + return request({ + url: `/api/security-desk/upload/fileURL`, + method: 'get', + params: { + busiBeginDate,contentId + }, + }) +} \ No newline at end of file diff --git a/src/api/report.js b/src/api/report.js index fcac1a9..1ced165 100644 --- a/src/api/report.js +++ b/src/api/report.js @@ -24,3 +24,13 @@ export const save = (data) => { data: data }) } +// 获取影像平台附件链接 +export const getFileURL = (busiBeginDate,contentId) => { + return request({ + url: `/sis/api/security-desk/upload/fileURL`, + method: 'get', + params: { + busiBeginDate,contentId + }, + }) + } diff --git a/src/views/device-check.vue b/src/views/device-check.vue index b194d57..b99f2ac 100644 --- a/src/views/device-check.vue +++ b/src/views/device-check.vue @@ -8,9 +8,11 @@ - + - + + +
@@ -21,11 +23,12 @@ - - + +
@@ -61,7 +64,7 @@ export default { unUploadImgUrl: [], }, ], - loading:false, + loading: false, }; }, // activated() { @@ -71,33 +74,49 @@ export default { this.getData(); }, methods: { + // 压缩图片 + beforeRead(file) { + // eslint-disable-next-line no-unused-vars + return new Promise((resolve, reject) => { + upload.compressImg(file, (res) => {resolve(res)}); + }); + }, //获取检查项数据 getData() { - this.loading=true + this.loading = true const id = this.$route.params.dataId; const type = '1'; this.form.id = id; getDeviceItemDetail(id, type).then((res) => { - this.loading=false + this.loading = false this.list = res.data.data; }); }, //提交设备检查 submit() { - this.loading=true + this.loading = true let data = this.form; let syncList = []; - let hasNoFileItem = false; + let hasNoFileItem = false;//必填项有未填 this.list.forEach((element) => { - if (typeof element.unUploadImgUrl == 'undefined' || element.unUploadImgUrl.length < 1) { - this.loading=false; + // if (typeof element.unUploadImgUrl == 'undefined' || element.unUploadImgUrl.length < 1) { + // this.loading=false; + // hasNoFileItem = true; + // return + // } + if (!element.problemLevel || + (element.problemLevel === '2' && (!element.result || !element.unUploadImgUrl || element.unUploadImgUrl.length < 1))) { hasNoFileItem = true; + this.loading=false; return } let fileList = []; - element.unUploadImgUrl.forEach((imgFile) => { - fileList.push(imgFile.file); - }); + if (element.unUploadImgUrl && element.unUploadImgUrl.length > 0) { + element.unUploadImgUrl.forEach((imgFile) => { + fileList.push(imgFile.file); + }); + } + syncList.push(new Promise((resolve, reject) => { //上传设备检查图片 upload.multiUpload(fileList, '18', 'beforePicIds').then(res => { @@ -115,16 +134,13 @@ export default { })) }); if (hasNoFileItem) { - this.$dialog.alert({ message: "请上传所有检查时照片再提交" }); + this.$dialog.alert({ message: "请检查必填内容!" }); return } Promise.all(syncList).then(() => { data.appDeviceDTOList = this.list; - deviceHandin(data).then((res) => { - this.loading=false - if (res.data.code !== 200) { - return this.$dialog.alert({ message: res.data.msg }); - } + deviceHandin(data).then(() => { + this.loading = false this.$dialog.alert({ message: '提交成功' }).then(() => { this.$router.push({ name: 'index' }) }) diff --git a/src/views/device-continued-detail.vue b/src/views/device-continued-detail.vue index 2434ff9..3205520 100644 --- a/src/views/device-continued-detail.vue +++ b/src/views/device-continued-detail.vue @@ -8,9 +8,11 @@ - + - + + +
@@ -23,19 +25,20 @@ - + - + placeholder="结果异常需持续整改,可设定期限>" @click="showCalendarMethod(index)" v-if="item.rectificationStatus === '2'" /> +
@@ -85,6 +88,13 @@ export default { this.getData(); }, methods: { + // 压缩图片 + beforeRead(file) { + // eslint-disable-next-line no-unused-vars + return new Promise((resolve, reject) => { + upload.compressImg(file, (res) => {resolve(res)}); + }); + }, formDate(date) { return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; }, @@ -127,6 +137,10 @@ export default { hasNoFileItem = true; return } + // 整改结果为异常则默认需要持续整改 + if(element.rectificationStatus==='2'){ + element.recordFlag='2' + } let fileList = []; element.unUploadImgUrl.forEach((imgFile) => { fileList.push(imgFile.file); @@ -153,11 +167,8 @@ export default { } Promise.all(syncList).then(() => { data.appDeviceDTOList = this.list; - continuedRectifyHandin(data).then((res) => { + continuedRectifyHandin(data).then(() => { this.loading=false - if (res.data.code !== 200) { - return this.$dialog.alert({ message: res.data.msg }); - } this.$dialog.alert({ message: '提交成功' }).then(() => { this.$router.push({ name: 'index' }) }) diff --git a/src/views/device-continued-rectify.vue b/src/views/device-continued-rectify.vue index 9f56c17..29f4f7a 100644 --- a/src/views/device-continued-rectify.vue +++ b/src/views/device-continued-rectify.vue @@ -25,16 +25,18 @@

业务类型:设备持续整改

设备名称:{{ item.taskName }}

设备编号:{{ item.deviceNum }}

-

+

剩余时间:

-

截止时间:{{ item.deadline }}

+

截止时间:{{ item.deadline }}

+ 该记录审批被驳回

+ + + + + diff --git a/src/views/device-detail.vue b/src/views/device-detail.vue index 2d95123..648ba29 100644 --- a/src/views/device-detail.vue +++ b/src/views/device-detail.vue @@ -3,19 +3,23 @@

- - - - - - - - - + + + + + + + + + +
- 录入整改结果 - 扫描设备二维码录入检查结果 - 录入持续整改结果 + 录入整改结果 + 扫描设备二维码录入检查结果 + + 录入检查结果 + + 录入持续整改结果
@@ -40,11 +44,11 @@ export default { address: "", maintenanceDate: "", state: "", + needScan: '' }, deviceId: "", - pushFlag: false, aimId: "", - type:"",//1-设备整改 2-设备检查 3-设备持续整改 + type: "",//1-设备整改 2-设备检查 3-设备持续整改 }; }, mounted() { @@ -56,44 +60,34 @@ export default { getData() { this.aimId = this.$route.params.dataId; const type = this.$route.params.type; - this.type=type; + this.type = type; //设备整改详情 if (type === "1") { getDeviceRectifyDetail(this.aimId).then((res) => { - if (res.data.code !== 200) { - return this.$dialog.alert({message: res.data.msg}); - } this.form = res.data.data; }); } //设备检查详情 if (type === "2") { getDeviceDetail(this.aimId).then((res) => { - if (res.data.code !== 200) { - return this.$dialog.alert({message: res.data.msg}); - } this.form = res.data.data; + this.needScanStr=this.form.needScan; }); } //设备持续整改详情 if (type === "3") { getDeviceContinuedDetail(this.aimId).then((res) => { - if (res.data.code !== 200) { - return this.$dialog.alert({message: res.data.msg}); - } this.form = res.data.data; }); } }, //页面跳转 startCheck() { - //pc端测试挡板 上线去除 - // this.pushFlag=true; const type = this.$route.params.type; if (type === "1") { return this.$router.push({ name: "device-rectify", params: { dataId: this.aimId } }); } - if (type === "2" && this.pushFlag) { + if (type === "2") { return this.$router.push({ name: "device-check", params: { dataId: this.aimId } }); } if (type === "3") { @@ -105,26 +99,25 @@ export default { window.qing.call("scanQRCode", { "needResult": 1, "success": function (result) { - if(result.data && result.data.qrcode_str){ + if (result.data && result.data.qrcode_str) { let deviceId = result.data.qrcode_str.substring(0, 19); - // eslint-disable-next-line no-undef - aimThisData(deviceId); - }else{ - return this.$dialog.alert({message: "扫描结果无法获取设备信息,请确认二维码是否属于设备二维码!"}); - } + // eslint-disable-next-line no-undef + aimThisData(deviceId); + } else { + return this.$dialog.alert({ message: "扫描结果无法获取设备信息,请确认二维码是否属于设备二维码!" }); + } }, "error": function (res) { - return this.$dialog.alert({message: res.errMsg}); + return this.$dialog.alert({ message: res.errMsg }); } }) }, aimThisData(deviceId) { this.deviceId = deviceId; if (this.form.id === this.deviceId) { - this.pushFlag = true; this.startCheck(); } else { - return this.$dialog.alert({message:"二维码和检测目标设备不匹配,请重新扫码"}); + return this.$dialog.alert({ message: "二维码和检测目标设备不匹配,请重新扫码" }); } } }, diff --git a/src/views/device-list.vue b/src/views/device-list.vue index bb71267..75b03eb 100644 --- a/src/views/device-list.vue +++ b/src/views/device-list.vue @@ -7,43 +7,34 @@
- - - - -
-

业务类型:{{ item.businessType }}

-

设备名称:{{ item.taskName }}

-

设备编号:{{ item.deviceNum }}

-

- 剩余时间: -

-

截止时间:{{ item.deadline }}

-

- - 去处理 - -

-
+ + + + + + + +
+

业务类型:{{ item.businessType }}

+

设备名称:{{ item.taskName }}

+

设备编号:{{ item.deviceNum }}

+

设备地址:{{ item.address }}

+ 检查需扫码 +

+ 剩余时间: + +

+

截止时间:{{ item.deadline }}

+ 该记录审批被驳回 +

+ + 去处理 + +

+
@@ -73,18 +64,44 @@ export default { }, //获取待办数据 getBackLogList() { - this.loading=true + this.loading = true this.dataType = "3"; this.type = "all"; - getBacklog(this.dataType,this.type).then((res) => { - this.loading=false + getBacklog(this.dataType, this.type).then((res) => { + this.loading = false this.list = res.data.data; }); }, //页面跳转 backlogHandler(id) { - return this.$router.push({ name: "device-detail", params: { dataId: id , type: "2"} }); + return this.$router.push({ name: "device-detail", params: { dataId: id, type: "2" } }); }, + // 主动扫码录入设备检查结果 + addCheck() { + let t=this; + window.qing.call("scanQRCode", { + "needResult": 1, + "success": function (result) { + if (result.data && result.data.qrcode_str) { + try { + let deviceId = result.data.qrcode_str.substring(0, 19); + // 根据设备id跳转到对应设备的详情页面 + t.jumpToDeviceDetail(deviceId); + } catch (error) { + return t.$dialog.alert({ message: "通过二维码获取设备信息失败!" }); + } + } else { + return t.$dialog.alert({ message: "扫描结果无法获取设备信息,请确认二维码是否属于设备二维码!" }); + } + }, + "error": function (res) { + return t.$dialog.alert({ message: res.errMsg }); + } + }) + }, + jumpToDeviceDetail(deviceId) { + return this.$router.push({ name: "device-detail-scan", params: { deviceId: deviceId } }); + } }, }; diff --git a/src/views/device-rectify-list.vue b/src/views/device-rectify-list.vue index a3444aa..4bf4d38 100644 --- a/src/views/device-rectify-list.vue +++ b/src/views/device-rectify-list.vue @@ -25,16 +25,18 @@

业务类型:{{ item.businessType }}

设备名称:{{ item.taskName }}

设备编号:{{ item.deviceNum }}

-

+

剩余时间:

-

截止时间:{{ item.deadline }}

+

截止时间:{{ item.deadline }}

+ 该记录审批被驳回

- - + + + placeholder="结果异常需持续整改,可设定期限>" @click="showCalendarMethod(index)" v-if="item.rectificationStatus === '2'" /> @@ -52,7 +54,7 @@ + + diff --git a/src/views/index.vue b/src/views/index.vue index 4afef75..d0ba904 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -2,11 +2,17 @@

- + - - + + + 任务待办 + + - - + 工作交接 + @@ -113,8 +119,9 @@ }; }, mounted() { - this.getBackLogList(); - this.auth() + // 注释 index无需获取待办任务,无需再次调用auth + // this.getBackLogList(); + // this.auth() }, methods: { auth() { @@ -142,7 +149,7 @@ this.dataType = "" this.type = "all" getBacklog(this.dataType, this.type).then((res) => { - if (res.data.data.code === 200) { + if (res.data.code === 200) { this.list = res.data.data; } }); diff --git a/src/views/login-pwd.vue b/src/views/login-pwd.vue index 8fc35f9..ed9be73 100644 --- a/src/views/login-pwd.vue +++ b/src/views/login-pwd.vue @@ -11,15 +11,15 @@ v-model="form.password" name="密码" label="密码"/> - - + label="验证码"/>
提交 @@ -44,7 +44,7 @@ export default { } }, mounted() { - // this.getCaptcha() + this.getCaptcha() }, methods:{ getCaptcha(){ @@ -70,8 +70,7 @@ export default { tenantId: '000000', username: this.form.username, password: md5(this.form.password), - //grant_type: 'captcha', - grant_type: 'password', + grant_type: 'captcha', scope: "all", type: 'account' } diff --git a/src/views/login.vue b/src/views/login.vue index 8e7286a..123dfc5 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -19,52 +19,75 @@ export default { this.getToken(); }, methods: { + clearAllCookie() { + var cookies = document.cookie.split(";"); + var domain = location.hostname; + console.log('location', location) + console.log('domain', domain) + + if (cookies.length > 0) { + for (let i = 0; i < cookies.length; i++) { + let cookie = cookies[i]; + let eqPos = cookie.indexOf('='); + let cname = eqPos > -1 ? cookie.substring(0, eqPos) : cookie; + document.cookie = cname + '=0;expires=Thu, 01 Jan 1970 00:00:00 GMT;Domain=' + domain + ';path=/'; + console.log('cname', cname) + console.log('document.cookie', document.cookie) + } + + } + }, + getToken() { + // 登录前先清除所有session + sessionStorage.clear(); + localStorage.clear() + this.clearAllCookie(); var params = this.$route.query; if (params && params.dev) { - return this.$router.push({ name: 'login' }) + return this.$router.push({ name: 'login' }) } else - request({ - url: '/sis/api/security-auth/oauth/token', - method: 'post', - params: { - ...params, - tenantId: '000000', - grant_type: 'xyun', - scope: 'all', - client_id: 'saber', - client_secret: 'saber_secret' - } - }).then(res => { - this.loading = false; - this.$store.state.user = res.data - this.$store.state.user.token = res.data.access_token; - sessionStorage.setItem('token', res.data.access_token); - sessionStorage.setItem('xYunAccessToken', res.data.detail.xYunAccessToken); - sessionStorage.setItem('user',JSON.stringify(res.data)) - this.$router.push({ name: 'index' }) - }).catch(err => { - err += '。请返回重试'; - this.loading = false; - this.$dialog.alert({ - title: '登录失败', - confirmButtonText: '返回', - message: err - }).then(() => { - window.qing.call('closeWebView'); + request({ + url: '/sis/api/security-auth/oauth/token', + method: 'post', + params: { + ...params, + tenantId: '000000', + grant_type: 'xyun', + scope: 'all', + client_id: 'saber', + client_secret: 'saber_secret' + } + }).then(res => { + console.log('res:', res) + this.loading = false; + this.$store.state.user = res.data + this.$store.state.user.token = res.data.access_token; + sessionStorage.setItem('token', res.data.access_token); + sessionStorage.setItem('xYunAccessToken', res.data.detail.xYunAccessToken); + sessionStorage.setItem('user', JSON.stringify(res.data)) + this.$router.push({ name: 'index' }) + }).catch(err => { + err += '。请返回重试'; + this.loading = false; + this.$dialog.alert({ + title: '登录失败', + confirmButtonText: '返回', + message: err + }).then(() => { + window.qing.call('closeWebView'); + }) }) - }) } } } diff --git a/src/views/report.vue b/src/views/report.vue index 2495772..fec63c0 100644 --- a/src/views/report.vue +++ b/src/views/report.vue @@ -1,37 +1,21 @@ diff --git a/src/views/work-handover-form.vue b/src/views/work-handover-form.vue index c366e4d..b9a4577 100644 --- a/src/views/work-handover-form.vue +++ b/src/views/work-handover-form.vue @@ -53,7 +53,7 @@ export default { }, methods: { async submit() { - console.log(this.$refs['upload'].value) + // console.log(this.$refs['upload'].value) let files = this.$refs['upload'].value if (files.length === 0) { return this.$dialog.alert({ message: '请上传现场照片' })