| | |
| | | class="svg-wrap"
|
| | | :class="{willUpGrade:item.isUpgrade}"
|
| | | v-loading="item.unloadLoading||item.upgradeLoading"
|
| | | :element-loading-text="item.unloadLoading?'卸载中':'升级中'"
|
| | | :element-loading-text="item.progressMsg"
|
| | | element-loading-background="rgba(0,0,0,.8)"
|
| | | >
|
| | | <i class="iconfont iconupdate" v-if="item.isUpgrade"></i>
|
| | |
| | | <div
|
| | | class="svg-wrap"
|
| | | v-loading="item.installLoading||item.upgradeLoading"
|
| | | :element-loading-text="item.installLoading?'安装中':'升级中'"
|
| | | :element-loading-text="item.progressMsg"
|
| | | element-loading-background="rgba(0,0,0,.8)"
|
| | | >
|
| | | <div class="mask">
|
| | |
| | | </template>
|
| | | <script>
|
| | |
|
| | | import {
|
| | | findAllSdk,
|
| | | findAll,
|
| | | addTaskSdk,
|
| | | delTaskSdk,
|
| | | deleteTask,
|
| | | updateTaskStatus,
|
| | | updateTaskName,
|
| | | getSdkArgs,
|
| | | saveTaskSdkRule,
|
| | | addTask,
|
| | | getRulesByTaskSdk,
|
| | | deleteTaskSdkRule,
|
| | | findByType,
|
| | | getTagList,
|
| | | downloadSdk,
|
| | | installSdk,
|
| | | getInstallInfo
|
| | | } from "./api";
|
| | | import { findAllSdk, downloadSdk, installSdk, getInstallInfo } from "./api";
|
| | | import { getApps, installApp, removeApp, getUnActivedSdk, actPageAlg, getUnActivedApp, actApp } from "@/api/app";
|
| | |
|
| | | import FileUploader from "@/components/subComponents/FileUpload/index";
|
| | | import TaskManage from "@/Pool/TaskMange";
|
| | | import VideoManageData from "@/Pool/VideoManageData";
|
| | | export default {
|
| | | name: "algorithmManage",
|
| | | props: {},
|
| | |
| | | FileUploader
|
| | | },
|
| | | computed: {
|
| | | notInstalledList () {
|
| | | return this.TaskMange.list1.filter(sdk => {
|
| | | notInstalledList() {
|
| | | return this.sdkList.filter(sdk => {
|
| | | return sdk.installed === false;
|
| | | });
|
| | | },
|
| | | installedList () {
|
| | | return this.TaskMange.list1.filter(sdk => {
|
| | | installedList() {
|
| | | return this.sdkList.filter(sdk => {
|
| | | return sdk.installed === true && !sdk.isUpgrade;
|
| | | });
|
| | | },
|
| | | ungradeList () {
|
| | | ungradeList() {
|
| | | // 升级处理会导致重复的key,需要修改
|
| | | //return [];
|
| | | return this.TaskMange.list1.filter(sdk => {
|
| | | return this.sdkList.filter(sdk => {
|
| | | return sdk.isUpgrade === true;
|
| | | });
|
| | | },
|
| | | isAdmin () {
|
| | | isAdmin() {
|
| | | if (
|
| | | sessionStorage.getItem("userInfo") &&
|
| | | sessionStorage.getItem("userInfo") !== ""
|
| | |
| | | return false;
|
| | | },
|
| | | },
|
| | | data () {
|
| | | data() {
|
| | | return {
|
| | | TaskMange: new TaskManage,
|
| | | VideoManageData: new VideoManageData,
|
| | | sdkList: [],
|
| | | buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
|
| | | activeName: "myAlgorithm",
|
| | | patchUpdateStatus: "",
|
| | | dragging: false,
|
| | | list1: [
|
| | | {
|
| | | sdk_name: "人脸提取"
|
| | | }
|
| | | ],
|
| | | list2: [
|
| | | {
|
| | | id: "001",
|
| | | name: "任务1",
|
| | | child: [
|
| | | {
|
| | | id: "1",
|
| | | sdk_name: "人脸检测",
|
| | | isSelect: false
|
| | | },
|
| | | {
|
| | | id: "2",
|
| | | sdk_name: "人脸对比",
|
| | | isSelect: false
|
| | | }
|
| | | ],
|
| | | isSetting: false,
|
| | | isShowSetAlgo: false
|
| | | }
|
| | | ],
|
| | | argsList: [],
|
| | | baseObject: {
|
| | | id: "",
|
| | | algoId: "",
|
| | | options1: [],
|
| | | options2: [],
|
| | | options3: [],
|
| | | value1: "",
|
| | | value2: "",
|
| | | value3: "",
|
| | | unit: ""
|
| | | },
|
| | | currentAlgoId: "",
|
| | | currentTaskId: "",
|
| | | isSuperUser: false,
|
| | | downloadItem: "",
|
| | | downloading: false,
|
| | | sceneDialogVisible: false,
|
| | | dialogTitle: '',
|
| | | direction: "rtl",
|
| | | actDrawerShow: false,
|
| | | actStep: 0,
|
| | | activeCode: "",
|
| | | sceneTemplates: [],
|
| | | appSceneForm: {
|
| | | id: "",
|
| | | name: "",
|
| | | desc: "",
|
| | | rules: "",
|
| | | txt: ""
|
| | | },
|
| | | sceneSdks: [],
|
| | | sceneRuleList: "",
|
| | | isInstall: false,
|
| | | installDialogVisible: false,
|
| | | installPackage: {},
|
| | |
| | | // installLoading: false,
|
| | | installedApps: [],
|
| | | storeApps: [],
|
| | | installFile: {}
|
| | | }
|
| | | },
|
| | | watch: {
|
| | | list2: {
|
| | | handler (newVal, oldVal) {
|
| | | // window.console.log(newVal, oldVal, '监听list2')
|
| | | if (newVal !== oldVal) {
|
| | | // window.console.log(newVal, '监听list2')
|
| | | newVal.map((i, index) => {
|
| | | i.child.map(j => {
|
| | | this.$set(j, "parentId", i.id);
|
| | | });
|
| | | });
|
| | | }
|
| | | },
|
| | | deep: true
|
| | | installFile: {},
|
| | | freshTimer: null,
|
| | | appUpgreading: false,
|
| | | sdkUpgreading: false
|
| | | }
|
| | | },
|
| | | directives: {
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | mounted () {
|
| | | mounted() {
|
| | | // 获取所有应用
|
| | | this.getAllSdk();
|
| | | this.getAllApps();
|
| | | this.findAllSdk();
|
| | | this.findByType();
|
| | | this.getBaseList();
|
| | | this.findAll();
|
| | |
|
| | | this.getUnActivedList();
|
| | | this.getUnActivedAppList();
|
| | | // this.TaskMange.findAllSdk();
|
| | | // this.TaskMange.findByType();
|
| | | this.VideoManageData.init();
|
| | | },
|
| | | methods: {
|
| | | isShow (authority) {
|
| | | isShow(authority) {
|
| | | return this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
|
| | | },
|
| | | //离线安装
|
| | | offlineInstall () {
|
| | | offlineInstall() {
|
| | | this.installDialogVisible = false;
|
| | | this.isInstall = true;
|
| | | //安装
|
| | | installSdk(this.installFile).then(res => {
|
| | | debugger
|
| | | if (res.success) {
|
| | | this.isInstall = false;
|
| | | this.$message({
|
| | |
| | | message: '安装成功,将跳转至我的算法中查看'
|
| | | });
|
| | | setTimeout(() => {
|
| | | this.findAllSdk();
|
| | | this.getAllSdk();
|
| | | this.getAllApps();
|
| | | window.parent.postMessage({
|
| | | msg: "AppUpdate"
|
| | |
| | | });
|
| | | })
|
| | | },
|
| | | downloadApp (app, action) {
|
| | | downloadApp(app, action) {
|
| | | if (action == 'upgrade') {
|
| | | app.upgradeLoading = true;
|
| | | } else {
|
| | |
| | | if (action == 'upgrade') {
|
| | | app.upgradeLoading = false;
|
| | | _this.$notify({
|
| | | type:'success',
|
| | | message:'升级成功'
|
| | | type: 'success',
|
| | | message: '升级成功'
|
| | | });
|
| | | } else {
|
| | | app.installLoading = false;
|
| | | _this.$notify({
|
| | | type:'success',
|
| | | message:'安装成功'
|
| | | type: 'success',
|
| | | message: '安装成功'
|
| | | });
|
| | | }
|
| | | _this.getAllApps();
|
| | |
| | | app.installLoading = false;
|
| | | }
|
| | | })
|
| | |
|
| | | // 开启自动刷新
|
| | | this.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | },
|
| | | getAllApps () {
|
| | | let _this = this;
|
| | | _this.installedApps = [];
|
| | | _this.storeApps = [];
|
| | | getApps().then(res => {
|
| | | if (res && res.success) {
|
| | | //_this.storeApps = res.data;
|
| | | res.data.forEach(item => {
|
| | | if (item.installed) {
|
| | | let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
|
| | | _this.installedApps.push(obj)
|
| | | } else {
|
| | | let obj = Object.assign({ installLoading: false, upgradeLoading: false }, item)
|
| | | _this.storeApps.push(obj)
|
| | | }
|
| | | });
|
| | | console.log('_this.installedApps', _this.installedApps);
|
| | | console.log('_this.storeApps', _this.storeApps);
|
| | | }
|
| | | })
|
| | | async getAllApps() {
|
| | | let iArry = []
|
| | | let sArry = []
|
| | |
|
| | | let rsp = await getApps();
|
| | | if (rsp && rsp.success) {
|
| | | // 遍历app的过程重置
|
| | | this.appUpgreading = false;
|
| | |
|
| | | rsp.data.forEach(item => {
|
| | | let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
|
| | | if (obj.progressMsg !== "" && obj.progressMsg !== "已安装") {
|
| | | obj.upgradeLoading = true;
|
| | |
|
| | | this.appUpgreading = true;
|
| | | this.startAutoFresh();
|
| | | }
|
| | |
|
| | | item.installed ? iArry.push(obj) : sArry.push(obj)
|
| | | });
|
| | | }
|
| | |
|
| | | this.installedApps = iArry;
|
| | | this.storeApps = sArry;
|
| | | },
|
| | | //卸载应用
|
| | | unLoad (app) {
|
| | | unLoad(app) {
|
| | | app.unloadLoading = true;
|
| | | let _this = this;
|
| | | removeApp({ appId: app.id }).then(res => {
|
| | |
| | | // this.activeCode = '';
|
| | | // this.activedSdkOrApp = this.newActInfo()
|
| | | // },
|
| | | actSdkOrApp (id, type = 'sdk') {
|
| | | actSdkOrApp(id, type = 'sdk') {
|
| | | this.actType = type;
|
| | | this.actId = id;
|
| | | this.actDrawerShow = true;
|
| | |
| | | this.activeCode = '';
|
| | | this.activedSdkOrApp = this.newActInfo()
|
| | | },
|
| | | newActInfo () {
|
| | | newActInfo() {
|
| | | return {
|
| | | activateCode: '',
|
| | | productName: '',
|
| | |
| | | devIds: ''
|
| | | }
|
| | | },
|
| | | getUnActivedList () {
|
| | | getUnActivedList() {
|
| | | getUnActivedSdk().then(res => {
|
| | | if (res.code == 200) {
|
| | | this.unActivedSDKList = res.data;
|
| | |
| | | })
|
| | |
|
| | | },
|
| | | getUnActivedAppList () {
|
| | | getUnActivedAppList() {
|
| | | getUnActivedApp().then(res => {
|
| | | if (res.code == 200) {
|
| | | this.unActivedAppList = res.data;
|
| | | }
|
| | | });
|
| | | },
|
| | |
|
| | | installFormat (percentage) {
|
| | | return percentage === 100 ? '安装成功' : `${percentage}%`;
|
| | | },
|
| | | actived () {
|
| | | actived() {
|
| | | let _this = this;
|
| | | if (this.actType == 'sdk') {
|
| | | //激活算法
|
| | |
| | | _this.activedSdkOrApp = res.data.successMsg;
|
| | | _this.actStep++;
|
| | | _this.getUnActivedList();
|
| | | _this.findAllSdk();
|
| | | _this.getAllSdk();
|
| | | } else {
|
| | | _this.$notify({
|
| | | type: 'error',
|
| | |
| | | });
|
| | | }
|
| | | },
|
| | | getCodeDetail () { },
|
| | | checkMyAlgorith () {
|
| | | getCodeDetail() { },
|
| | | checkMyAlgorith() {
|
| | | this.actDrawerShow = false;
|
| | | this.activeName = "myAlgorithm";
|
| | | },
|
| | | onFileUpload (file) {
|
| | | onFileUpload(file) {
|
| | | //this.patchUpdateStatus = `<span style="color:green">上传成功, 点击升级按钮开始安装</span>`;
|
| | | this.patchFile = { ...file };
|
| | | this.fileAdded = true;
|
| | |
| | | installContent: res.data.sdks[0].installContent
|
| | | }
|
| | | }
|
| | |
|
| | | // this.$confirm('', '算法信息', {
|
| | | // message: `<div class="installInfo">
|
| | | // <div><span>算法名称:</span><span>${file.filename}</span></div>
|
| | | // <div><span>安装版本:</span><span></span></div>
|
| | | // <div><span>更新内容:</span><span></span></div>
|
| | | // <p>确定安装此算法?</p>
|
| | | // </div>`,
|
| | | // confirmButtonText: '安装',
|
| | | // cancelButtonText: '取消',
|
| | | // dangerouslyUseHTMLString: true,
|
| | | // type: ''
|
| | | // }).then(() => {
|
| | | // this.isInstall = true;
|
| | | // //安装
|
| | | // installSdk(file).then(res => {
|
| | | // debugger
|
| | | // if (res.success) {
|
| | | // this.isInstall = false;
|
| | | // //this.$refs['progressBar'].style.width = 100%
|
| | | // //this.installPercentage = 100%
|
| | | // this.$message({
|
| | | // type: 'success',
|
| | | // message: '安装成功,将跳转至我的算法中查看'
|
| | | // });
|
| | | // setTimeout(() => {
|
| | | // this.findAllSdk();
|
| | | // this.activeName = 'myAlgorithm';
|
| | | // }, 3000)
|
| | | // }
|
| | |
|
| | | // }).catch(e => {
|
| | | // console.log(e)
|
| | | // this.isInstall = false;
|
| | | // this.$message({
|
| | | // type: 'error',
|
| | | // message: e.data
|
| | | // });
|
| | | // })
|
| | | // }).catch(() => {
|
| | | // console.log('取消安装');
|
| | |
|
| | | // })
|
| | | }
|
| | | }).catch(e => {
|
| | | this.$message({
|
| | |
| | | message: e.data
|
| | | });
|
| | | })
|
| | | // this.$msgbox({
|
| | | // title: '算法信息',
|
| | | // message: h('div', null, [
|
| | | // h('span', null, '算法名称: '),
|
| | | // h('i', { style: 'color: teal' }, file.filename)
|
| | | // ]),
|
| | | // showCancelButton: true,
|
| | | // confirmButtonText: '确定',
|
| | | // cancelButtonText: '取消',
|
| | | // beforeClose: (action, instance, done) => {
|
| | | // if (action === 'confirm') {
|
| | | // instance.confirmButtonLoading = true;
|
| | | // instance.confirmButtonText = '执行中...';
|
| | | // setTimeout(() => {
|
| | | // done();
|
| | | // setTimeout(() => {
|
| | | // instance.confirmButtonLoading = false;
|
| | | // }, 300);
|
| | | // }, 3000);
|
| | | // } else {
|
| | | // done();
|
| | | // }
|
| | | // }
|
| | | // }).then(action => {
|
| | | // this.$message({
|
| | | // type: 'info',
|
| | | // message: 'action: ' + action
|
| | | // });
|
| | | // });
|
| | |
|
| | |
|
| | |
|
| | | },
|
| | |
|
| | | onFileAdded (f) {
|
| | | ;
|
| | | onFileAdded(f) {
|
| | | this.patchUpdateStatus = "";
|
| | | },
|
| | | // 校验输入的是否是数字
|
| | | valiNum (value) {
|
| | | if (value) {
|
| | | let re = /[^\-?\d.]*$/;
|
| | | if (!re.test(value)) {
|
| | | // this.$toast({
|
| | | // type: "warning",
|
| | | // message: "请输入数字!"
|
| | | // });
|
| | | this.$notify({
|
| | | title: "提示",
|
| | | message: "请输入数字!",
|
| | | type: "warning"
|
| | | });
|
| | | }
|
| | | }
|
| | | },
|
| | | // 左边拖动模块得拖动结束后的触发函数
|
| | | endLeft (env) {
|
| | | this.dragging = false;
|
| | | let taskId = env.to.id;
|
| | | let sdkId = this.TaskMange.list1[env.oldIndex].id;
|
| | | if (!taskId.length || !sdkId.length) {
|
| | | return;
|
| | | }
|
| | | // 获取到该任务所在的元素
|
| | | let task = this.TaskMange.list2.find(i => {
|
| | | return i.id === taskId;
|
| | | });
|
| | | let arr = task.child.filter(i => {
|
| | | return i.id === sdkId;
|
| | | });
|
| | | // window.console.log(task, "拖进来的任务信息", sdkId, arr);
|
| | | if (arr && arr.length >= 2) {
|
| | | // this.$toast({
|
| | | // type: "warning",
|
| | | // message: "该算法已存在!"
|
| | | // });
|
| | | this.$notify({
|
| | | title: "提示",
|
| | | message: "该算法已存在!",
|
| | | type: "warning"
|
| | | });
|
| | | task.child.splice(env.newIndex, 1);
|
| | | return true;
|
| | | }
|
| | | let list = task.child.map((i, index) => {
|
| | | let obj = {};
|
| | | obj.sdkId = i.id;
|
| | | obj.sort = index + 1;
|
| | | return obj;
|
| | | });
|
| | | let json = {
|
| | | taskId: taskId,
|
| | | sdks: list
|
| | | };
|
| | | this.addTaskSdk(json);
|
| | | },
|
| | | // 右边拖动模块开始拖动触发函数
|
| | | startRight (env) {
|
| | | this.$nextTick(() => {
|
| | | this.dragging = true;
|
| | | });
|
| | | // window.window.console.log(env, "right start");
|
| | | },
|
| | | // 右边拖动模块拖动结束触发函数
|
| | | endRight (env) {
|
| | | // window.window.console.log(env, "right end");
|
| | | },
|
| | | clickSet (data) {
|
| | | if (data.isSetting) {
|
| | | data.isSetting = false;
|
| | | } else {
|
| | | data.isSetting = true;
|
| | | }
|
| | | },
|
| | | clickDel (data, Index) {
|
| | | this.$confirm("提示:删除后,此任务在摄像机中的应用失效,是否删除?", {
|
| | | center: true,
|
| | | showConfirmButton: true,
|
| | | showCancelButton: true,
|
| | | confirmButtonClass: "comfirm-class-sure",
|
| | | cancelButtonClass: "comfirm-class-cancle"
|
| | | })
|
| | | .then(() => {
|
| | | this.deleteTask(data);
|
| | | })
|
| | | .catch(err => { });
|
| | | },
|
| | | clickSetAlgo (row, data) {
|
| | | // window.console.log(row, data, "编辑任务中某一个算法");
|
| | | if (row.isShowSetAlgo && data.id === this.TaskMange.currentAlgoId) {
|
| | | row.isShowSetAlgo = false;
|
| | | data.isSelect = false;
|
| | | return false;
|
| | | }
|
| | | if (data.id !== this.TaskMange.currentAlgoId) {
|
| | | let isEdit = false;
|
| | | if (this.argsList && this.argsList.length !== 0) {
|
| | | this.TaskMange.argsList.map((i, index) => {
|
| | | if (i.value2 !== this.argsList[index].value2) {
|
| | | isEdit = true;
|
| | | }
|
| | | if (i.value3 !== this.argsList[index].value3) {
|
| | | isEdit = true;
|
| | | }
|
| | | });
|
| | | }
|
| | | if (isEdit) {
|
| | | this.$notify({
|
| | | title: "提示",
|
| | | message: "请先保存未保存的配置!",
|
| | | type: "warning"
|
| | | });
|
| | | return false;
|
| | | } else {
|
| | | let task = this.TaskMange.list2.find(element => {
|
| | | return element.isShowSetAlgo;
|
| | | });
|
| | | // console.log(task, '是否有已经打开编辑的')
|
| | | if (task !== undefined) {
|
| | | this.$set(task, "isShowSetAlgo", false);
|
| | | task.child.map(i => {
|
| | | this.$set(i, "isSelect", false);
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | | this.TaskMange.currentAlgoId = data.id;
|
| | | this.TaskMange.currentTaskId = row.id;
|
| | | let task = this.TaskMange.list2.find(element => {
|
| | | return element.isShowSetAlgo;
|
| | | });
|
| | | if (task === undefined) {
|
| | | this.getSdkArgs(data).then(() => {
|
| | | this.getRulesByTaskSdk(row.id, data.id);
|
| | | });
|
| | | if (row.isShowSetAlgo) {
|
| | | row.isShowSetAlgo = false;
|
| | | } else {
|
| | | row.isShowSetAlgo = true;
|
| | | data.isSelect = true;
|
| | | }
|
| | | } else {
|
| | | // this.$toast({
|
| | | // type: "warning",
|
| | | // message: "请先保存未保存的配置!"
|
| | | // });
|
| | | // this.$notify({
|
| | | // title: "提示",
|
| | | // message: "请先保存未保存的配置!",
|
| | | // type: "warning"
|
| | | // });
|
| | | }
|
| | | },
|
| | | async getRulesByTaskSdk (taskId, sdkId) {
|
| | | let res = await getRulesByTaskSdk({
|
| | | taskId: taskId,
|
| | | sdkId: sdkId
|
| | | });
|
| | | if (res && res.success) {
|
| | | if (res.data.rules && res.data.rules.length !== 0) {
|
| | | this.TaskMange.argsList = res.data.rules.map((i, index) => {
|
| | | let sdk = res.data.argList.find(j => {
|
| | | return j.alias === i.sdk_arg_alias;
|
| | | });
|
| | | let obj = JSON.parse(JSON.stringify(this.TaskMange.baseObject));
|
| | | obj.value1 = i.sdk_arg_alias ? i.sdk_arg_alias : "";
|
| | | obj.value2 = i.operator ? i.operator : "";
|
| | | obj.value3 = i.sdk_arg_value ? i.sdk_arg_value : "";
|
| | | obj.unit = sdk.unit ? sdk.unit : "";
|
| | | obj.id = i.Id ? i.Id : "";
|
| | | obj.algoId = sdkId;
|
| | | return obj;
|
| | | });
|
| | | } else {
|
| | | this.TaskMange.argsList = res.data.argList.map(i => {
|
| | | let obj = JSON.parse(JSON.stringify(this.TaskMange.baseObject));
|
| | | obj.value1 = i.alias ? i.alias : "";
|
| | | obj.value2 = i.default_operator ? i.default_operator : "";
|
| | | obj.value3 = i.default_value ? i.default_value : "";
|
| | | obj.unit = i.unit ? i.unit : "";
|
| | | obj.id = "";
|
| | | obj.algoId = sdkId;
|
| | | return obj;
|
| | | });
|
| | | }
|
| | | // window.console.log(res, '查找算法规则', this.argsList)
|
| | | this.argsList = JSON.parse(JSON.stringify(this.TaskMange.argsList));
|
| | | }
|
| | | },
|
| | | async findAllSdk () {
|
| | |
|
| | | async getAllSdk() {
|
| | | let res = await findAllSdk();
|
| | | if (res && res.success) {
|
| | | this.TaskMange.list1 = res.data.map((i, index) => {
|
| | | this.sdkList = res.data.map((i, index) => {
|
| | | this.$set(i, "isEdit", false);
|
| | | //mock 未安装/待升级
|
| | | // if (index == 1 || index == 2) {
|
| | | // this.$set(i, "isUpgrade", true);
|
| | | // }
|
| | | // if (index == 3 || index == 4) {
|
| | | // this.$set(i, "installed", false);
|
| | | // }
|
| | | //mock end
|
| | | return i;
|
| | | });
|
| | | }
|
| | | },
|
| | | addTask () {
|
| | | let obj = {
|
| | | id: "",
|
| | | name: "任务" + this.TaskMange.list2.length,
|
| | | child: [],
|
| | | isSetting: false,
|
| | | isShowSetAlgo: false
|
| | | };
|
| | | // window.console.log(this.TaskMange.list2, "addTask");
|
| | | this.TaskMange.list2.push(obj);
|
| | | this.addTaskAsync(obj.name);
|
| | | this.$nextTick(() => {
|
| | | let taskArea = document.getElementById("taskArea");
|
| | | taskArea.scrollTop = taskArea.scrollHeight;
|
| | | });
|
| | | },
|
| | | async findAll () {
|
| | | let res = await findAll();
|
| | | if (res && res.success) {
|
| | | if (res.data && res.data.length !== 0) {
|
| | | let list = res.data.map(i => {
|
| | | let obj = {};
|
| | | obj.id = i.task.taskid;
|
| | | obj.name = i.task.taskname;
|
| | | obj.enable = i.task.enable;
|
| | | obj.is_alarm = i.task.is_alarm;
|
| | | obj.child = [];
|
| | | if (i.sdks && i.sdks.length !== 0) {
|
| | | obj.child = i.sdks.map(j => {
|
| | | let t = {};
|
| | | t.id = j.id;
|
| | | t.ipc_id = j.ipc_id;
|
| | | if (i.sdks.length == 1) {
|
| | | t.sdk_name = i.task.taskname;
|
| | | // console.log("单个sdk算法:",t.sdk_name)
|
| | | } else {
|
| | | t.sdk_name = j.sdk_name;
|
| | | // console.log("多个sdk算法:",t.sdk_name)
|
| | | }
|
| | | t.icon = j.icon;
|
| | | t.enable = j.enable;
|
| | | t.isSelect = false;
|
| | | return t;
|
| | | });
|
| | | }
|
| | | obj.isSetting = false;
|
| | | obj.isShowSetAlgo = false;
|
| | | return obj;
|
| | | });
|
| | | this.TaskMange.list2 = list;
|
| | | }
|
| | | }
|
| | | },
|
| | | clickDelSdk (task, sdk) {
|
| | | this.$confirm(
|
| | | "提示:删除后,此算法在本任务中移除,同时在摄像机中的应用失效,是否删除?",
|
| | | {
|
| | | center: true,
|
| | | showConfirmButton: true,
|
| | | showCancelButton: true,
|
| | | confirmButtonClass: "comfirm-class-sure",
|
| | | cancelButtonClass: "comfirm-class-cancle"
|
| | | }
|
| | | )
|
| | | .then(() => {
|
| | | this.delTaskSdk(task, sdk);
|
| | | })
|
| | | .catch(err => { });
|
| | | },
|
| | | selectChange (event, type, data) {
|
| | | if (type === "options1") {
|
| | | // window.window.console.log(type, data, "选择下拉框");
|
| | | data.options1.map(i => {
|
| | | if (i.value === data.value1) {
|
| | | this.$set(data, "unit", i.unit ? i.unit : "");
|
| | | }
|
| | | });
|
| | | }
|
| | | },
|
| | | // 删除任务算法
|
| | | async delTaskSdk (task, sdk) {
|
| | | let json = {
|
| | | taskId: task.id,
|
| | | sdkId: sdk.id
|
| | | };
|
| | | let res = await delTaskSdk(json);
|
| | | if (res && res.success) {
|
| | | // this.$toast({
|
| | | // type: "success",
|
| | | // message: "删除任务算法成功!"
|
| | | // });
|
| | | this.$notify({
|
| | | title: "成功",
|
| | | message: "删除任务算法成功!",
|
| | | type: "success"
|
| | | });
|
| | | this.findAll();
|
| | | }
|
| | | },
|
| | | // 删除任务
|
| | | async deleteTask (data, index) {
|
| | | // window.console.log(data, "deleteTask");
|
| | | let res = await deleteTask({ taskId: data.id });
|
| | | // this.$toast({
|
| | | // type: res.success ? "success" : "error",
|
| | | // message: res.msg
|
| | | // });
|
| | | this.$notify({
|
| | | title: res.success ? "成功" : "失败",
|
| | | message: res.msg,
|
| | | type: res.success ? "success" : "error"
|
| | | });
|
| | | if (data.id && res.success) {
|
| | | this.findAll();
|
| | | }
|
| | | },
|
| | | // 更新任务状态
|
| | | async updateTaskStatus (data) {
|
| | | // window.console.log(data, '更新任务状态')
|
| | | let json = {
|
| | | taskId: data.id,
|
| | | enable: data.enable
|
| | | };
|
| | | let res = await updateTaskStatus(json);
|
| | | // this.$toast({
|
| | | // type: res.success ? "success" : "error",
|
| | | // message: res.msg
|
| | | // });
|
| | | this.$notify({
|
| | | title: res.success ? "成功" : "失败",
|
| | | message: res.msg,
|
| | | type: res.success ? "success" : "error"
|
| | | });
|
| | | },
|
| | | // 更新任务名称
|
| | | async updateTaskName (data) {
|
| | | let json = {
|
| | | taskId: data.id,
|
| | | taskName: data.name
|
| | | };
|
| | | let res = await updateTaskName(json);
|
| | | // this.$toast({
|
| | | // type: res.success ? "success" : "error",
|
| | | // message: res.msg
|
| | | // });
|
| | | this.$notify({
|
| | | title: res.success ? "成功" : "失败",
|
| | | message: res.msg,
|
| | | type: res.success ? "success" : "error"
|
| | | });
|
| | | if (res && res.success) {
|
| | | this.$set(data, "isSetting", false);
|
| | | }
|
| | | },
|
| | | // 获取底库数据
|
| | | async getBaseList () {
|
| | | // let res = await getTagList();
|
| | | // if (res && res.success) {
|
| | | // let filter = res.data.filter(i => {
|
| | | // return i.status === 0;
|
| | | // });
|
| | | // let list = filter.map(i => {
|
| | | // let obj = {};
|
| | | // obj.id = i.key;
|
| | | // obj.name = i.title;
|
| | | // obj.value = i.value;
|
| | | // return obj;
|
| | | // });
|
| | | // list.unshift({
|
| | | // id: "",
|
| | | // name: "全部底库",
|
| | | // value: ""
|
| | | // })
|
| | |
|
| | | // // this.TaskMange.baseObject.options3 = [...all, ...list];
|
| | | // this.TaskMange.baseObject.options3 = [...list];
|
| | | // }
|
| | |
|
| | | this.TaskMange.baseObject.options3 = [
|
| | | { id: true, name: true, value: true },
|
| | | { id: false, name: false, value: false }
|
| | | ];
|
| | | },
|
| | | // 获取算法参数
|
| | | async getSdkArgs (data) {
|
| | | let res = await getSdkArgs({
|
| | | sdkId: data.id,
|
| | | scope: "TASKRULE"
|
| | | });
|
| | | if (res && res.success) {
|
| | | // window.console.log(res, "查询算法参数");
|
| | | let list = res.data.map(i => {
|
| | | let obj = {};
|
| | | obj.name = i.name;
|
| | | obj.id = i.alias;
|
| | | obj.value = i.alias;
|
| | | obj.unit = i.unit;
|
| | | obj.must = i.must;
|
| | | obj.range = i.range;
|
| | | obj.sort = i.sort;
|
| | | return obj;
|
| | | });
|
| | | this.TaskMange.baseObject.options1 = [...list];
|
| | | }
|
| | | },
|
| | | // 查询字典
|
| | | async findByType () {
|
| | | let res = await findByType();
|
| | | if (res && res.success) {
|
| | | let list = res.data.RULECOMPUTEBETWEEN.map(i => {
|
| | | let obj = {};
|
| | | obj.name = i.name;
|
| | | obj.value = i.value;
|
| | | return obj;
|
| | | });
|
| | | this.TaskMange.baseObject.options2 = [...list];
|
| | | }
|
| | | },
|
| | | // 算法配置,新建
|
| | | add () {
|
| | | this.TaskMange.argsList.push(
|
| | | JSON.parse(JSON.stringify(this.TaskMange.baseObject))
|
| | | );
|
| | | },
|
| | | // 算法配置 删除
|
| | | delRule (index) {
|
| | | this.TaskMange.argsList.splice(index, 1);
|
| | | },
|
| | | // 算法参数保存
|
| | | async save () {
|
| | | let list = this.TaskMange.argsList.map(i => {
|
| | | let obj = {};
|
| | | obj.id = i.id;
|
| | | obj.operator = i.value2;
|
| | | obj.sdk_arg_alias = i.value1;
|
| | | obj.sdk_arg_value = i.value3;
|
| | | return obj;
|
| | | });
|
| | | let json = {
|
| | | rules: list,
|
| | | sdkId: this.TaskMange.currentAlgoId,
|
| | | taskId: this.TaskMange.currentTaskId
|
| | | };
|
| | | let res = await saveTaskSdkRule(json);
|
| | | this.$notify({
|
| | | title: "提示",
|
| | | type: res.success ? "success" : "error",
|
| | | message: res.msg
|
| | | });
|
| | | if (res && res.success) {
|
| | | let task = this.TaskMange.list2.find(i => {
|
| | | return i.id === this.TaskMange.currentTaskId;
|
| | | });
|
| | | if (task) {
|
| | | this.$set(task, "isShowSetAlgo", false);
|
| | | this.TaskMange.argsList = [];
|
| | | task.child.map(i => {
|
| | | this.$set(i, "isSelect", false);
|
| | | });
|
| | | }
|
| | | }
|
| | | },
|
| | | getDefault () {
|
| | | this.deleteTaskSdkRule(
|
| | | this.TaskMange.currentTaskId,
|
| | | this.TaskMange.currentAlgoId
|
| | | ).then(() => {
|
| | | this.getRulesByTaskSdk(
|
| | | this.TaskMange.currentTaskId,
|
| | | this.TaskMange.currentAlgoId
|
| | | );
|
| | | });
|
| | | },
|
| | | async deleteTaskSdkRule (taskId, sdkId) {
|
| | | let json = {
|
| | | taskId: taskId,
|
| | | sdkId: sdkId
|
| | | };
|
| | | let res = await deleteTaskSdkRule(json);
|
| | | // this.$toast({
|
| | | // type: res.success ? "success" : "error",
|
| | | // message: res.msg
|
| | | // });
|
| | | this.$notify({
|
| | | title: res.success ? "成功" : "失败",
|
| | | message: res.msg,
|
| | | type: res.success ? "success" : "error"
|
| | | });
|
| | | if (res && res.success) {
|
| | | // window.console.log(res, "恢复默认值");
|
| | | }
|
| | | },
|
| | | // 给任务添加算法
|
| | | async addTaskSdk (data) {
|
| | | let res = await addTaskSdk(data);
|
| | | if (res && res.success) {
|
| | | // window.console.log(res, 'res')
|
| | | this.findAll();
|
| | | }
|
| | | },
|
| | | // 新添加任务
|
| | | async addTaskAsync (name) {
|
| | | let res = await addTask({ taskname: name });
|
| | | // this.$toast({
|
| | | // type: res.success ? "success" : "error",
|
| | | // message: res.msg
|
| | | // });
|
| | | // window.console.log(res, "addTaskAsync");
|
| | | this.$notify({
|
| | | title: res.success ? "成功" : "失败",
|
| | | message: res.msg,
|
| | | type: res.success ? "success" : "error"
|
| | | });
|
| | | if (res && res.success) {
|
| | | this.findAll();
|
| | | }
|
| | | },
|
| | | cancle (row) {
|
| | | if (row.isShowSetAlgo) {
|
| | | row.isShowSetAlgo = false;
|
| | | }
|
| | | this.TaskMange.argsList = [];
|
| | | this.TaskMange.currentAlgoId = "";
|
| | | row.child.map(i => {
|
| | | this.$set(i, "isSelect", false);
|
| | | });
|
| | | },
|
| | | cancleTask (row) {
|
| | | if (row.isSetting) {
|
| | | row.isSetting = false;
|
| | | }
|
| | | },
|
| | | commandAlgo (command, row, item) {
|
| | | if (command === 1) {
|
| | | // console.log('设置算法')
|
| | | this.clickSetAlgo(row, item);
|
| | | }
|
| | | if (command === 2) {
|
| | | // console.log('删除算法')
|
| | | this.clickDelSdk(row, item);
|
| | | }
|
| | | },
|
| | | commandTask (command, row) {
|
| | | if (command === 1) {
|
| | | //编辑任务
|
| | | this.clickSet(row);
|
| | | }
|
| | | },
|
| | | donwload (item) {
|
| | | donwload(item) {
|
| | | this.downloading = true;
|
| | | this.downloadItem = item.id;
|
| | |
|
| | |
| | | });
|
| | | this.downloading = false;
|
| | | this.downloadItem = "";
|
| | | this.findAllSdk();
|
| | | this.getAllSdk();
|
| | | })
|
| | | .catch(err => {
|
| | | this.$notify({
|
| | |
| | | this.downloadItem = "";
|
| | | });
|
| | | },
|
| | | commandAlgLib (item) {
|
| | | this.$set(item, "isEdit", true);
|
| | | },
|
| | | inputBlur (item) {
|
| | | inputBlur(item) {
|
| | | // console.log(item, '修改名称')
|
| | | this.$set(item, "isEdit", false);
|
| | | },
|
| | |
|
| | | cleanTemplateForm () {
|
| | | this.appSceneForm.name = "";
|
| | | this.appSceneForm.desc = "";
|
| | | this.appSceneForm.rules = "";
|
| | | this.appSceneForm.txt = "";
|
| | |
|
| | | this.$refs.ruleEditor.cleanRule();
|
| | | },
|
| | | handleTabClick () {
|
| | | handleTabClick() {
|
| | |
|
| | | },
|
| | | handleCreateScene () {
|
| | | this.sceneDialogVisible = true;
|
| | | this.dialogTitle = '创建场景模板';
|
| | | startAutoFresh() {
|
| | | if (this.freshTimer) {
|
| | | clearTimeout(this.freshTimer)
|
| | | }
|
| | |
|
| | | this.sceneSdks = this.TaskMange.list1.filter(sdk => {
|
| | | return sdk.installed === true;
|
| | | });
|
| | | this.sceneRuleList = "";
|
| | | if (!this.appUpgreading && !this.sdkUpgreading) {
|
| | | this.freshTimer = -1
|
| | | return
|
| | | }
|
| | |
|
| | | this.$nextTick(() => {
|
| | | this.cleanTemplateForm();
|
| | | });
|
| | | },
|
| | | handleDialogClose () {
|
| | | this.sceneDialogVisible = false;
|
| | | },
|
| | | handleEditScene (item) {
|
| | | this.appSceneForm.name = item.name;
|
| | | this.appSceneForm.desc = item.desc;
|
| | | this.getAllSdk()
|
| | | this.getAllApps()
|
| | |
|
| | | this.sceneSdks = item.sdks;
|
| | | this.sceneRuleList = item.rules;
|
| | | this.sceneDialogVisible = true;
|
| | | this.dialogTitle = '编辑场景模板';
|
| | | },
|
| | |
|
| | |
|
| | | this.freshTimer = setTimeout(this.startAutoFresh, 5 * 1000)
|
| | | }
|
| | | }
|
| | | };
|
| | | </script>
|
| | |
| | | box-sizing: border-box;
|
| | | text-align: left;
|
| | | min-width: 1106px;
|
| | | // background-color: #f2f6fc;
|
| | | .s-video-manage-breadcrumb {
|
| | | height: 5%;
|
| | | box-sizing: border-box;
|
| | | border: 1px solid #e4e7ed;
|
| | | background-color: rgb(255, 255, 255);
|
| | | -webkit-box-shadow: #e4e7ed 0px 0px 9px inset;
|
| | | box-shadow: #e4e7ed 0px 0px 9px inset;
|
| | | border-radius: 5px;
|
| | | }
|
| | |
|
| | | .el-tabs {
|
| | | height: calc(100% - 50px);
|
| | | // margin-top: 5px !important;
|
| | |
| | | height: 100%;
|
| | | }
|
| | | }
|
| | | .el-breadcrumb__inner {
|
| | | font-weight: bold;
|
| | | color: #606266;
|
| | | cursor: pointer;
|
| | | }
|
| | |
|
| | | .el-loading-mask .el-loading-spinner {
|
| | | top: 40px !important;
|
| | | }
|
| | |
| | | .src-title {
|
| | | //color: #bfbfbf;
|
| | | color: #bbcee8;
|
| | | font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC';
|
| | | font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC";
|
| | | font-weight: 650;
|
| | | font-style: normal;
|
| | | height: 36px;
|
| | |
| | | position: absolute;
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | background: url('/images/algo/green.gif');
|
| | | background: url("/images/algo/green.gif");
|
| | | overflow: hidden;
|
| | | transform: translate(-50%, -50%);
|
| | | .inner-bar {
|
| | |
| | | // width: 58% !important;
|
| | | // }
|
| | | // }
|
| | | .edit-rules-box {
|
| | | padding: 0 2px 0 13px;
|
| | | }
|
| | | .common {
|
| | | .rigth-box {
|
| | | width: 90% !important;
|
| | | }
|
| | | }
|
| | | .super,
|
| | | .common {
|
| | |
|
| | | .super {
|
| | | width: 100%;
|
| | | height: 100%;
|
| | | .title {
|
| | |
| | | .el-button + .el-button {
|
| | | margin-left: 0 !important;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | .appScenarios-list {
|
| | | display: flex;
|
| | | flex-wrap: wrap;
|
| | | .wrap-box {
|
| | | width: 16.6%;
|
| | | margin-bottom: 30px;
|
| | | .inner {
|
| | | width: 80%;
|
| | |
|
| | | box-sizing: border-box;
|
| | | position: relative;
|
| | | font-size: 14px;
|
| | | padding: 20px 0 50px;
|
| | | transition: all 1s;
|
| | | background: #ffffff;
|
| | | border: 1px solid #e2e2e2;
|
| | | box-shadow: 0 5px 12px 0 rgba(0, 0, 0, 0.07);
|
| | | border-radius: 4px;
|
| | | margin: auto;
|
| | | &:hover {
|
| | | .mask {
|
| | | display: block;
|
| | | }
|
| | | }
|
| | | .mask {
|
| | | position: absolute;
|
| | | top: 0;
|
| | | left: 0;
|
| | | width: 100%;
|
| | | height: 100%;
|
| | | background: rgba(0, 0, 0, 0.65);
|
| | | backdrop-filter: blur(1px) brightness(100%);
|
| | | text-align: center;
|
| | | z-index: 1;
|
| | | border-radius: 3px;
|
| | | display: none;
|
| | | .el-button + .el-button {
|
| | | margin-left: 0 !important;
|
| | | }
|
| | | .tool {
|
| | | position: absolute;
|
| | | top: 49%;
|
| | | left: 50%;
|
| | | transform: translate(-50%, -50%);
|
| | | i {
|
| | | font-size: 50px;
|
| | | }
|
| | | i:nth-of-type(1) {
|
| | | margin-right: 30px;
|
| | | }
|
| | | i:nth-of-type(2) {
|
| | | color: red;
|
| | | }
|
| | | }
|
| | | }
|
| | | .scenario-icon {
|
| | | display: flex;
|
| | | width: 100%;
|
| | | height: 100%;
|
| | | margin: auto;
|
| | | justify-content: center;
|
| | | align-content: center;
|
| | | align-items: center;
|
| | | .single,
|
| | | .double,
|
| | | .third,
|
| | | .four {
|
| | | width: 80%;
|
| | | padding-top: 80%;
|
| | | position: relative;
|
| | | margin: auto;
|
| | | display: flex;
|
| | | flex-wrap: wrap;
|
| | | justify-content: center;
|
| | | .svg-wrap {
|
| | | width: 50%;
|
| | | position: absolute;
|
| | | height: 0;
|
| | | padding-top: 50%;
|
| | | text-align: center;
|
| | | box-shadow: 0 0 3px 2px rgb(247, 247, 247) inset;
|
| | | svg {
|
| | | position: absolute;
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | transform: translate(-50%, -50%);
|
| | | }
|
| | | .baseImg {
|
| | | position: absolute !important;
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | transform: translate(-50%, -50%);
|
| | | }
|
| | | }
|
| | | }
|
| | | .single {
|
| | | margin: auto;
|
| | | .svg-wrap {
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | transform: translate(-50%, -50%);
|
| | | box-shadow: none;
|
| | | }
|
| | | }
|
| | | .double {
|
| | | .svg-wrap:nth-of-type(1) {
|
| | | top: 50%;
|
| | | transform: translateY(-50%);
|
| | | left: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(2) {
|
| | | top: 50%;
|
| | | transform: translateY(-50%);
|
| | | right: 0;
|
| | | }
|
| | | }
|
| | | .third {
|
| | | .svg-wrap:nth-of-type(1) {
|
| | | top: 0;
|
| | | left: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(2) {
|
| | | top: 0;
|
| | | right: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(3) {
|
| | | top: 50%;
|
| | | left: 50%;
|
| | | transform: translateX(-50%);
|
| | | }
|
| | | }
|
| | | .four {
|
| | | .svg-wrap:nth-of-type(1) {
|
| | | top: 0;
|
| | | left: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(2) {
|
| | | top: 0;
|
| | | right: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(3) {
|
| | | top: 50%;
|
| | | left: 0;
|
| | | }
|
| | | .svg-wrap:nth-of-type(4) {
|
| | | top: 50%;
|
| | | right: 0;
|
| | | }
|
| | | }
|
| | | }
|
| | | .scenario-name {
|
| | | width: 100%;
|
| | | height: 36px;
|
| | | line-height: 36px;
|
| | | text-align: center;
|
| | | position: absolute;
|
| | | bottom: 10px;
|
| | | left: 0;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | .drawer-content {
|
| | | font-family: 'PingFangSC-Regular';
|
| | | font-family: "PingFangSC-Regular";
|
| | | .el-step__title.is-process {
|
| | | border-color: #3d68e1 !important;
|
| | | color: #3d68e1 !important;
|
| | | font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif;
|
| | | font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif;
|
| | | }
|
| | | .el-step__head.is-process {
|
| | | border-color: #3d68e1 !important;
|
| | | color: #3d68e1 !important;
|
| | | font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif;
|
| | | font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif;
|
| | | }
|
| | | .el-input {
|
| | | width: 100%;
|
| | |
| | | .tab-content {
|
| | | padding: 30px 20px;
|
| | | }
|
| | | }
|
| | |
|
| | | .right-box {
|
| | | height: 100%;
|
| | | padding: 10px 10px;
|
| | | box-sizing: border-box;
|
| | | float: left;
|
| | | .task-manage-table {
|
| | | height: calc(100% - 30px);
|
| | | margin-top: 5px;
|
| | | overflow-x: hidden;
|
| | | overflow-y: auto;
|
| | | }
|
| | | // .task-manage-table::-webkit-scrollbar {
|
| | | // width: 0 !important ;
|
| | | // }
|
| | | }
|
| | | .mask {
|
| | | position: absolute;
|
| | |
| | | display: inline-block;
|
| | | width: 100%;
|
| | | }
|
| | | }
|
| | | .task-name {
|
| | | text-align: center;
|
| | | margin-top: 16px;
|
| | | line-height: 28px;
|
| | | font-family: PingFangSC-Regular;
|
| | | font-size: 13px;
|
| | | color: #222222;
|
| | | text-align: center;
|
| | | // background-color: #ecf5ff;
|
| | | }
|
| | | .unit-class {
|
| | | margin-left: 10px;
|