Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4130111c69 | |||
| 65c9357712 | |||
| 4c783e3afb | |||
| 0958d708d6 |
@@ -68,7 +68,7 @@ export default {
|
||||
this.$refs.file_ref.currentInfo = initCollection.data[0]
|
||||
|
||||
const folders = await api.collection.getByParent('folder', initCollection.data[0].id)
|
||||
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
|
||||
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
|
||||
file.updateFileList(folders)
|
||||
file.updateFileList(files)
|
||||
|
||||
|
||||
@@ -142,13 +142,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex xl4 lg4 sm4 xs4" style="text-align: end;">
|
||||
<va-button class="" color="primary" v-if="selected.length" @mousedown.stop="showFolderModal" target="_blank" small>
|
||||
<va-button class="" color="primary" @mousedown.stop="showFolderModal" target="_blank" small>
|
||||
MOVE
|
||||
</va-button>
|
||||
<va-button class="" color="success" v-if="selected.length" @mousedown.stop="downloadSelected" target="_blank" small>
|
||||
<va-button class="" color="success" @mousedown.stop="downloadSelected" target="_blank" small>
|
||||
DOWNLOAD
|
||||
</va-button>
|
||||
<va-button class="" color="danger" v-if="selected.length" @mousedown.stop="deleteMultiFilesConfirm" target="_blank" small>
|
||||
<va-button class="" color="danger" @mousedown.stop="deleteMultiFilesConfirm" target="_blank" small>
|
||||
DELETE
|
||||
</va-button>
|
||||
</div>
|
||||
@@ -304,6 +304,7 @@ export default {
|
||||
path: '',
|
||||
name: '',
|
||||
metaID: '',
|
||||
project: null,
|
||||
},
|
||||
|
||||
styleList: {
|
||||
@@ -458,12 +459,13 @@ export default {
|
||||
}
|
||||
},
|
||||
clickRow: async function (rowData) {
|
||||
if (window.getSelection().toString() !== '' && this.clickEvent.shiftKey === false) return true
|
||||
this.clickCounter += 1
|
||||
setTimeout(() => { this.clickCounter = 0 }, 500)
|
||||
if (window.getSelection().toString() !== '' && this.clickEvent.shiftKey === false && this.clickCounter !== 2) return true
|
||||
window.getSelection().removeAllRanges()
|
||||
// click target id
|
||||
const idx = this.fileLists.findIndex(f => f.id === rowData.id)
|
||||
setTimeout(async () => {
|
||||
this.clickCounter += 1
|
||||
let timeOutTimer
|
||||
// single click
|
||||
if (this.clickCounter === 1) {
|
||||
@@ -559,7 +561,7 @@ export default {
|
||||
|
||||
// call getfolder api and update
|
||||
const folders = await api.collection.getByParent('folder', info.id)
|
||||
const files = await api.meta.getAttrByParent('folder', info.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
|
||||
const files = await api.meta.getAttrByParent('folder', info.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
|
||||
file.updateFileList(folders)
|
||||
file.updateFileList(files)
|
||||
|
||||
@@ -579,7 +581,7 @@ export default {
|
||||
this.currentInfo = item
|
||||
// call getfolder api and update
|
||||
const folders = await api.collection.getByParent('folder', item.id)
|
||||
const files = await api.meta.getAttrByParent('folder', item.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
|
||||
const files = await api.meta.getAttrByParent('folder', item.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
|
||||
file.updateFileList(folders)
|
||||
file.updateFileList(files)
|
||||
|
||||
@@ -600,7 +602,7 @@ export default {
|
||||
if (initCollection.data.length === 1) {
|
||||
this.currentInfo = initCollection.data[0]
|
||||
const folders = await api.collection.getByParent('folder', initCollection.data[0].id)
|
||||
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
|
||||
const files = await api.meta.getAttrByParent('folder', initCollection.data[0].id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
|
||||
file.updateFileList(folders)
|
||||
file.updateFileList(files)
|
||||
this.fileLists = file.getFileList()
|
||||
@@ -732,14 +734,17 @@ export default {
|
||||
removeFileFromList: function () {
|
||||
},
|
||||
fillDeleteInfo: function (info) {
|
||||
console.log('info', info)
|
||||
if (info.type === 'folder') {
|
||||
this.deleteInfo.metaID = undefined
|
||||
this.deleteInfo.folderID = info.id
|
||||
this.deleteInfo.name = info.name
|
||||
this.deleteInfo.project = undefined
|
||||
} else {
|
||||
this.deleteInfo.path = info.path
|
||||
this.deleteInfo.name = info.name
|
||||
this.deleteInfo.metaID = info.id
|
||||
this.deleteInfo.project = info.project
|
||||
}
|
||||
},
|
||||
deleteFolder: async function (id) {
|
||||
@@ -750,12 +755,21 @@ export default {
|
||||
await this.deleteFolder(collection.id)
|
||||
}
|
||||
for (const meta of childrenMeta.data) {
|
||||
this.deleteInfo.project = meta.project
|
||||
await this.deleteSingleFileByDeleteInfo(meta.id)
|
||||
}
|
||||
await api.collection.clearDel()
|
||||
},
|
||||
deleteSingleFileByDeleteInfo: async function (metaID) {
|
||||
if (metaID === undefined) metaID = this.deleteInfo.metaID
|
||||
const subjectResponse = await api.subjectData.get({ meta: this.deleteInfo.project })
|
||||
console.log('subject id', this.deleteInfo.project, subjectResponse.data)
|
||||
if (subjectResponse.status === 200) {
|
||||
for (const subject of subjectResponse.data) {
|
||||
await api.subjectData.update(subject.id, { deleted: true })
|
||||
await api.subjectData.clearDel()
|
||||
}
|
||||
}
|
||||
await api.meta.update(metaID, { deleted: true })
|
||||
await api.meta.clearDel()
|
||||
},
|
||||
@@ -840,7 +854,7 @@ export default {
|
||||
|
||||
// call getfolder api and update
|
||||
const folders = await api.collection.getByParent('folder', this.currentInfo.id)
|
||||
const files = await api.meta.getAttrByParent('folder', this.currentInfo.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at')
|
||||
const files = await api.meta.getAttrByParent('folder', this.currentInfo.id, 'id-path-name-parent-description-size-time_duration-uuid-device-channels-parameter_set-created_at-project')
|
||||
file.updateFileList(folders)
|
||||
file.updateFileList(files)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<project-device @showDeviceModal="showDeviceModal" @save="saveProject"></project-device>
|
||||
<project-subject @showSubjectModal="showSubjectModal"></project-subject>
|
||||
<div class="flex d-flex sm12 xs12 md6 xl4 px-0">
|
||||
<add-task @save="saveProject"/>
|
||||
<div>
|
||||
@@ -32,6 +33,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<subject-modal ref="subject_modal_ref" @save="saveSubject" @remove="removeSubject"></subject-modal>
|
||||
<new-device-modal ref="device_modal_ref" @detect="detect" @save="saveProject"></new-device-modal>
|
||||
<cycle-modal ref="cycle_modal_ref" @createCycle="createCycle"></cycle-modal>
|
||||
</div>
|
||||
@@ -42,7 +44,9 @@
|
||||
import AddTask from '@/components/project/view/menu/components/AddTask'
|
||||
// import AddDevice from '@/components/project/view/menu/components/AddDevice'
|
||||
import ProjectDevice from '@/components/project/view/menu/components/ProjectDevice'
|
||||
import ProjectSubject from '@/components/project/view/menu/components/ProjectSubject'
|
||||
import NewDeviceModal from '@/components/project/view/menu/components/NewDeviceModal'
|
||||
import SubjectModal from '@/components/project/view/menu/components/SubjectModal'
|
||||
import CycleModal from '@/components/project/view/menu/components/CycleModal'
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
@@ -56,6 +60,8 @@ export default {
|
||||
ProjectDevice,
|
||||
NewDeviceModal,
|
||||
CycleModal,
|
||||
ProjectSubject,
|
||||
SubjectModal,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('project', [
|
||||
@@ -81,6 +87,10 @@ export default {
|
||||
this.$refs.device_modal_ref.show()
|
||||
this.$refs.device_modal_ref.initSetting(key, device)
|
||||
},
|
||||
showSubjectModal: function (subject) {
|
||||
this.$refs.subject_modal_ref.show()
|
||||
this.$refs.subject_modal_ref.initSetting(subject)
|
||||
},
|
||||
createCycle: function (cycleInfo) {
|
||||
this.createCycleTask({ cycleInfo: cycleInfo })
|
||||
},
|
||||
@@ -101,6 +111,21 @@ export default {
|
||||
}
|
||||
this.$emit('save_project', this.getSelectProject)
|
||||
},
|
||||
saveSubject: function (subject) {
|
||||
if (this.getSelectProject.subject === undefined) this.getSelectProject.subject = []
|
||||
if (this.getSelectProject.subject.findIndex((ele) => ele.id === subject.id) >= 0) return
|
||||
this.getSelectProject.subject.push(subject)
|
||||
this.saveProject()
|
||||
},
|
||||
|
||||
removeSubject: function (subject) {
|
||||
if (this.getSelectProject.subject === undefined) this.getSelectProject.subject = []
|
||||
const subjexIndex = this.getSelectProject.subject.findIndex((ele) => ele.id === subject.id)
|
||||
if (subjexIndex >= 0) {
|
||||
this.getSelectProject.subject.splice(subjexIndex, 1)
|
||||
}
|
||||
this.saveProject()
|
||||
},
|
||||
|
||||
...mapActions('project',
|
||||
[
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div class="flex d-flex sm12 xs12 md12 xl12 pa-0" style="align-items: center; margin-left: 0.6rem; margin-top: -12px;">
|
||||
<!-- header -->
|
||||
<div class="flex sm3 xs3 md3 xl1 px-0 project-device-header-text">
|
||||
<p>Subject</p>
|
||||
</div>
|
||||
<!-- device list -->
|
||||
<div class="flex d-flex">
|
||||
<draggable class="d-flex" :list="subjectList">
|
||||
<!-- devices -->
|
||||
<div class="mr-2" v-for="(subject, index) in subjectList" :key="index">
|
||||
<!-- <button :class="device[1].pairStatus === 1 ? 'pair-button mr-2' : 'not-pair-button mr-2'" @click="showDeviceModal(device[0], device[1])"> -->
|
||||
<button class="pair-button mr-2" @click="showSubjectModal(subject)">
|
||||
<span class="pair-button-text">{{ subject.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- append device -->
|
||||
<div>
|
||||
<button class="add-button" icon="fa fa-plus" @click="showSubjectModal"><span class="add-button-text">+</span></button>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapFields } from 'vuex-map-fields'
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
import types from '@/store/modules/project/types'
|
||||
import draggable from 'vuedraggable'
|
||||
|
||||
export default {
|
||||
name: 'project-subject',
|
||||
components: {
|
||||
draggable,
|
||||
},
|
||||
computed: {
|
||||
subjectList () {
|
||||
return this.getSelectProject.subject
|
||||
},
|
||||
|
||||
...mapGetters('project', [
|
||||
types.project.getSelect,
|
||||
types.project.getDeviceShowName,
|
||||
types.project.getDeviceMaxOrder,
|
||||
]),
|
||||
|
||||
...mapFields('project', [
|
||||
'projectLibrary',
|
||||
'projectSelectIndex',
|
||||
]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showDevice: false,
|
||||
showLibrary: false,
|
||||
notRegisterDevice: [],
|
||||
index: -1,
|
||||
futureIndex: -1,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// clickShowLibrary: async function () {
|
||||
// this.notRegisterDevice = await this.checkNotRegisterDeviceProject({})
|
||||
// if (this.notRegisterDevice.length === 0) {
|
||||
// this.showLibrary = true
|
||||
// return true
|
||||
// }
|
||||
// await this.createDeviceProject({
|
||||
// name: this.notRegisterDevice[0].name,
|
||||
// library: this.notRegisterDevice[0].library,
|
||||
// pair: this.notRegisterDevice[0].macAddress,
|
||||
// pairStatus: 1,
|
||||
// order: this.getDeviceMaxOrderProject,
|
||||
// })
|
||||
// this.$emit('save')
|
||||
// return true
|
||||
// },
|
||||
// clickShowDevice: async function (library) {
|
||||
// this.showLibrary = false
|
||||
// await this.createDeviceProject({
|
||||
// name: library + '-' + String(Object.keys(this.getSelectProject.device).length + 1),
|
||||
// library: library,
|
||||
// pair: null,
|
||||
// pairStatus: 0,
|
||||
// order: this.getDeviceMaxOrderProject,
|
||||
// })
|
||||
// this.$emit('save')
|
||||
// return false
|
||||
// },
|
||||
cancelSelectDevice: function () {
|
||||
this.showLibrary = false
|
||||
},
|
||||
showSubjectModal: function (subject) {
|
||||
this.$emit('showSubjectModal', subject)
|
||||
},
|
||||
deleteDevice: function (deviceIndex) {
|
||||
this.deleteDeviceProject({ index: deviceIndex })
|
||||
this.$emit('save')
|
||||
},
|
||||
handleMove (e) {
|
||||
const { index, futureIndex } = e.draggedContext
|
||||
this.index = index
|
||||
this.futureIndex = futureIndex
|
||||
return false // disable sort
|
||||
},
|
||||
handleDragEnd () {
|
||||
const changeList = ['name', 'library', 'pair', 'pairStatus']
|
||||
const deviceListTemp = JSON.parse(JSON.stringify(this.deviceListInOrder))
|
||||
const keyOld = deviceListTemp[this.index][0]
|
||||
const keyNew = deviceListTemp[this.futureIndex][0]
|
||||
const deviceList = this.getSelectProject.device
|
||||
|
||||
for (const key of changeList) {
|
||||
deviceList[keyOld][key] = deviceListTemp[this.futureIndex][1][key]
|
||||
deviceList[keyNew][key] = deviceListTemp[this.index][1][key]
|
||||
}
|
||||
this.$emit('save')
|
||||
},
|
||||
...mapActions('project',
|
||||
[
|
||||
types.project.createDevice,
|
||||
types.project.deleteDevice,
|
||||
types.project.checkNotRegisterDevice,
|
||||
types.project.checkPairDeviceExist,
|
||||
],
|
||||
),
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
watch: {
|
||||
projectSelectIndex: {
|
||||
immediate: true,
|
||||
handler: async function (val) {
|
||||
this.checkPairDeviceExistProject()
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.add-button {
|
||||
width: 38px;
|
||||
height: 36px;
|
||||
background: #e0e0e0;
|
||||
border: 2px dashed #b7b7b7;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.add-button-text {
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pair-button {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
background: #858dd6;
|
||||
border: 0;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.not-pair-button {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
background: #e0e0e0;
|
||||
border: 0;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.pair-button-text {
|
||||
font-family: 'Inter-Regular';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.project-device-header-text {
|
||||
align-items: center;
|
||||
// font-family: 'Inter-Regular';
|
||||
// font-style: normal;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
line-height: 29px;
|
||||
|
||||
/* identical to box height */
|
||||
color: rgb(52, 73, 94);
|
||||
// color: #768b9b;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,202 @@
|
||||
<template>
|
||||
<div>
|
||||
<va-modal
|
||||
class="flex sm12 xl12 md12 xs12"
|
||||
v-model="showModal"
|
||||
size="small"
|
||||
:noOutsideDismiss="true"
|
||||
hide-default-actions
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="d-flex mb-3">
|
||||
<va-icon name="fa fa-bluetooth-b mr-3" color="primary"/>
|
||||
<h5 class="mt-0 mb-0">Choose Subject</h5>
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="modalStep === 1">
|
||||
<va-list fit class="mb-2 pb-0" >
|
||||
<div>
|
||||
<va-icon name="fa fa-plus" @click.native="showCreate"></va-icon>
|
||||
<va-icon class="ml-2" name="fa fa-minus" @click.native="()=> { modalStep = 2 }"></va-icon>
|
||||
</div>
|
||||
<div class="row" v-if="showCreateInput === true">
|
||||
<va-input class="mr-2" label="NAME" v-model="name"></va-input>
|
||||
<va-input label="DESCRIPTION" v-model="description"></va-input>
|
||||
<va-button @click="createSubject">SAVE</va-button>
|
||||
</div>
|
||||
<va-list-label>
|
||||
</va-list-label>
|
||||
<template v-for="(subject, index) in subjectList">
|
||||
<va-item :class="subjectSelect === index ? 'list-focus': ''" :key="'connect-' + index" @click="selectSubject(index)" clickable>
|
||||
<!-- <va-item-section avatar>
|
||||
<va-avatar style="border-radius: 0;">
|
||||
<img src='@/assets/img/elite_img.png' :alt="device.macAddress">
|
||||
</va-avatar>
|
||||
</va-item-section> -->
|
||||
|
||||
<va-item-section>
|
||||
{{ subject.name }}
|
||||
</va-item-section>
|
||||
|
||||
<va-item-section>
|
||||
{{ subject.description }}
|
||||
</va-item-section>
|
||||
</va-item>
|
||||
<!-- <va-list-separator v-if="index < deviceList.length - 1" :key="'separator-' + index" /> -->
|
||||
</template>
|
||||
</va-list>
|
||||
<div class="flex-center sm12 xl12 md12 xs12">
|
||||
<va-button color='danger' @click="removeSubject">Remove</va-button>
|
||||
<va-button @click="hide">Cancel</va-button>
|
||||
<va-button @click="changeSubject">OK</va-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="modalStep === 2">
|
||||
<div class="flex text-center">
|
||||
ConFirm Delete {{ this.subjectList[this.subjectSelect].name }} ?
|
||||
<div class="flex d-flex">
|
||||
<va-button @click="() => { modalStep = 1 }">Cancel</va-button>
|
||||
<va-button @click="deleteSubject">OK</va-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</va-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import { mapFields } from 'vuex-map-fields'
|
||||
import api from '@/data/api/index'
|
||||
import { mapActions, mapGetters } from 'vuex'
|
||||
import types from '@/store/modules/project/types'
|
||||
|
||||
export default {
|
||||
name: 'subject-modal',
|
||||
components: {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('project', [
|
||||
types.project.getSelect,
|
||||
types.project.getDeviceShowName,
|
||||
]),
|
||||
|
||||
// ...mapFields('project', [
|
||||
// 'deviceConnectList',
|
||||
// ]),
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showModal: false,
|
||||
showDisplayDevice: false,
|
||||
key: '',
|
||||
device: {},
|
||||
subjectList: [],
|
||||
subjectSelect: -1,
|
||||
|
||||
name: '',
|
||||
description: '',
|
||||
|
||||
showCreateInput: false,
|
||||
|
||||
modalStep: 1,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showCreate: function () {
|
||||
this.showCreateInput = true
|
||||
},
|
||||
deleteSubject: async function () {
|
||||
const selectSubject = this.subjectList[this.subjectSelect]
|
||||
if (selectSubject) {
|
||||
await api.subject.update(selectSubject.id, { deleted: true })
|
||||
await api.subject.clearDel()
|
||||
this.subjectList.splice(this.subjectSelect, 1)
|
||||
}
|
||||
this.modalStep = 1
|
||||
},
|
||||
show: function () {
|
||||
this.showModal = true
|
||||
},
|
||||
hide: function () {
|
||||
this.showModal = false
|
||||
},
|
||||
createSubject: async function () {
|
||||
const newSubject = await api.subject.create({ name: this.name, description: this.description })
|
||||
if (newSubject.status === 200) {
|
||||
this.subjectList.push(newSubject.data)
|
||||
}
|
||||
this.showCreateInput = false
|
||||
},
|
||||
// detect: function (device) {
|
||||
// if (device) this.$emit('detect', device)
|
||||
// },
|
||||
selectSubject: function (index) {
|
||||
this.subjectSelect = index
|
||||
},
|
||||
changeSubject: function () {
|
||||
let subject = null
|
||||
if (this.subjectList[this.subjectSelect]) {
|
||||
subject = this.subjectList[this.subjectSelect]
|
||||
}
|
||||
this.$emit('save', subject)
|
||||
this.hide()
|
||||
},
|
||||
removeSubject: function () {
|
||||
let subject = null
|
||||
if (this.subjectList[this.subjectSelect]) {
|
||||
subject = this.subjectList[this.subjectSelect]
|
||||
}
|
||||
this.$emit('remove', subject)
|
||||
this.hide()
|
||||
},
|
||||
removeDevice: function () {
|
||||
this.deleteDeviceProject({ deviceKey: this.key })
|
||||
this.$emit('save')
|
||||
this.hide()
|
||||
},
|
||||
getSubjectList: async function (subject) {
|
||||
},
|
||||
initSetting: async function (subject) {
|
||||
this.subjectList.length = 0
|
||||
const subjectResponse = await api.subject.get()
|
||||
if (subjectResponse.status === 200) {
|
||||
this.subjectList.push(...subjectResponse.data)
|
||||
}
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.subjectSelect = -1
|
||||
if (subject) {
|
||||
this.subjectSelect = this.subjectList.findIndex((ele) => ele.id === subject.id)
|
||||
}
|
||||
// this.key = key
|
||||
// this.device = device
|
||||
// this.deviceList = []
|
||||
// this.deviceSelect = 0
|
||||
// this.getDeviceList(device)
|
||||
},
|
||||
...mapActions('project',
|
||||
[
|
||||
types.project.addDevice,
|
||||
types.project.findDevice,
|
||||
types.project.setDevice,
|
||||
types.project.deleteDevice,
|
||||
types.project.checkNotRegisterDevice,
|
||||
types.task.init,
|
||||
types.task.create,
|
||||
types.task.save,
|
||||
types.task.delete,
|
||||
types.task.select,
|
||||
],
|
||||
),
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.list-focus {
|
||||
background: #ebedff;
|
||||
border: 1px solid #dbdcf0;
|
||||
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -121,7 +121,7 @@ export default {
|
||||
|
||||
// directory init
|
||||
const collection = await api.collection.getAll()
|
||||
this.directoryOptions = collection.data.filter(el => el.name !== 'root')
|
||||
this.directoryOptions = collection.data.filter(el => el.name !== 'root').sort((a, b) => { return a.id - b.id })
|
||||
if (Object.keys(this.device.parent).length === 0) {
|
||||
this.directory = this.directoryOptions.find(ele => ele.name === 'admin')
|
||||
this.directorySelect(this.directory)
|
||||
|
||||
@@ -11,6 +11,8 @@ import analysis from './analysis'
|
||||
import sdcard from './sdcard'
|
||||
import connection from './connection'
|
||||
import project from './project'
|
||||
import subject from './subject'
|
||||
import subjectData from './subject_data'
|
||||
|
||||
// axios.defaults.baseURL = 'http://192.168.3.211:3000'
|
||||
axios.defaults.baseURL = 'http://' + location.href.split('/')[2].split(':')[0] + ':3000'
|
||||
@@ -29,6 +31,8 @@ const api = {
|
||||
sdcard,
|
||||
connection,
|
||||
project,
|
||||
subject,
|
||||
subjectData,
|
||||
}
|
||||
|
||||
export default api
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import api from './index'
|
||||
import auth from './auth'
|
||||
|
||||
async function create (attrs) {
|
||||
const _header = auth.getHeader()
|
||||
|
||||
try {
|
||||
return await api.axios.post('/api/subject/create', attrs, { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function update (id, attrs) {
|
||||
const _header = auth.getHeader()
|
||||
try {
|
||||
return await api.axios.post(`/api/subject/update/${id}`, attrs, { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function clearDel () {
|
||||
const _header = auth.getHeader()
|
||||
try {
|
||||
return await api.axios.get('/api/subject/clear_deleted', { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function get (id) {
|
||||
const _header = auth.getHeader()
|
||||
try {
|
||||
return await api.axios.get('/api/subject/get', { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const subject = {
|
||||
create,
|
||||
update,
|
||||
clearDel,
|
||||
get,
|
||||
}
|
||||
|
||||
export default subject
|
||||
@@ -0,0 +1,56 @@
|
||||
import api from './index'
|
||||
import auth from './auth'
|
||||
|
||||
async function create (attrs) {
|
||||
const _header = auth.getHeader()
|
||||
|
||||
try {
|
||||
return await api.axios.post('/api/subject_data/create', attrs, { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function update (id, attrs) {
|
||||
const _header = auth.getHeader()
|
||||
try {
|
||||
return await api.axios.post(`/api/subject_data/update/${id}`, attrs, { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function clearDel () {
|
||||
const _header = auth.getHeader()
|
||||
try {
|
||||
return await api.axios.get('/api/subject_data/clear_deleted', { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function get (attrs) {
|
||||
let query = ''
|
||||
const _header = auth.getHeader()
|
||||
for (const attr in attrs) {
|
||||
query += `${attr}=${attrs[attr]}`
|
||||
}
|
||||
try {
|
||||
return await api.axios.get(`/api/subject_data/get?${query}`, { headers: _header })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const subjectData = {
|
||||
create,
|
||||
update,
|
||||
clearDel,
|
||||
get,
|
||||
}
|
||||
|
||||
export default subjectData
|
||||
@@ -72,48 +72,36 @@ export default {
|
||||
physicalQuantity: 'R',
|
||||
unit: {
|
||||
mohm: 1e-3,
|
||||
mΩ: 1e-3,
|
||||
ohm: 1,
|
||||
Ω: 1,
|
||||
kohm: 1e3,
|
||||
kΩ: 1e3,
|
||||
Mohm: 1e6,
|
||||
MΩ: 1e6,
|
||||
},
|
||||
downloadUnit: 'ohm',
|
||||
defaultUnit: 'Ω',
|
||||
defaultUnit: 'ohm',
|
||||
},
|
||||
5: {
|
||||
name: 'Z_Real',
|
||||
physicalQuantity: 'R',
|
||||
unit: {
|
||||
mohm: 1e-3,
|
||||
mΩ: 1e-3,
|
||||
ohm: 1,
|
||||
Ω: 1,
|
||||
kohm: 1e3,
|
||||
kΩ: 1e3,
|
||||
Mohm: 1e6,
|
||||
MΩ: 1e6,
|
||||
},
|
||||
downloadUnit: 'ohm',
|
||||
defaultUnit: 'Ω',
|
||||
defaultUnit: 'ohm',
|
||||
},
|
||||
6: {
|
||||
name: 'Impedance',
|
||||
physicalQuantity: 'R',
|
||||
unit: {
|
||||
mohm: 1e-3,
|
||||
mΩ: 1e-3,
|
||||
ohm: 1,
|
||||
Ω: 1,
|
||||
kohm: 1e3,
|
||||
kΩ: 1e3,
|
||||
Mohm: 1e6,
|
||||
MΩ: 1e6,
|
||||
},
|
||||
downloadUnit: 'ohm',
|
||||
defaultUnit: 'Ω',
|
||||
defaultUnit: 'ohm',
|
||||
},
|
||||
7: {
|
||||
name: 'Phase',
|
||||
|
||||
@@ -93,20 +93,20 @@ const EliteEIS = {
|
||||
{ value: 1, label: '2' },
|
||||
{ value: 2, label: '3' },
|
||||
{ value: 3, label: '4' },
|
||||
{ value: 4, label: '5' },
|
||||
{ value: 5, label: '6' },
|
||||
{ value: 6, label: '7' },
|
||||
{ value: 7, label: '8' },
|
||||
{ value: 8, label: 'Auto' },
|
||||
// { value: 4, label: '5' },
|
||||
// { value: 5, label: '6' },
|
||||
// { value: 6, label: '7' },
|
||||
// { value: 7, label: '8' },
|
||||
{ value: 4, label: 'Auto' },
|
||||
],
|
||||
range: ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto'],
|
||||
defaultValue: 8,
|
||||
range: ['1', '2', '3', '4', 'Auto'],
|
||||
defaultValue: 4,
|
||||
outputRawData: (val) => {
|
||||
const numArr = ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto']
|
||||
const numArr = ['1', '2', '3', '4', 'Auto']
|
||||
return numArr.indexOf(val.toString())
|
||||
},
|
||||
outputReadabilityData: (idx) => {
|
||||
const numArr = ['1', '2', '3', '4', '5', '6', '7', '8', 'Auto']
|
||||
const numArr = ['1', '2', '3', '4', 'Auto']
|
||||
return numArr[parseInt(idx)]
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ function newProject (name, uuid) {
|
||||
select: false,
|
||||
status: -1,
|
||||
cycle: [],
|
||||
subject: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user