|
|
@ -30,18 +30,19 @@ |
|
|
|
class="input" |
|
|
|
class="input" |
|
|
|
v-model="params.categoryId" |
|
|
|
v-model="params.categoryId" |
|
|
|
:options="categoryTreeData" |
|
|
|
:options="categoryTreeData" |
|
|
|
:disabled="disabled" |
|
|
|
:disabled="true" |
|
|
|
:props="{ |
|
|
|
:props="{ |
|
|
|
checkStrictly: true, |
|
|
|
checkStrictly: true, |
|
|
|
value: 'id', |
|
|
|
value: 'id', |
|
|
|
label: 'name', |
|
|
|
label: 'name', |
|
|
|
emitPath: false, |
|
|
|
emitPath: false, |
|
|
|
}" |
|
|
|
}" |
|
|
|
|
|
|
|
@change="onChangeCategoryId" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="group-box"> |
|
|
|
<div class="group-box"> |
|
|
|
<div class="from-row"> |
|
|
|
<!-- <div class="from-row"> |
|
|
|
<div class="label">设备固件:</div> |
|
|
|
<div class="label">设备固件:</div> |
|
|
|
<el-select |
|
|
|
<el-select |
|
|
|
v-model="params.targetFirmwareId" |
|
|
|
v-model="params.targetFirmwareId" |
|
|
@ -58,7 +59,7 @@ |
|
|
|
:value="item.id" |
|
|
|
:value="item.id" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</div> --> |
|
|
|
<!--<div class="from-row"> |
|
|
|
<!--<div class="from-row"> |
|
|
|
<div class="label">测试模板:</div> |
|
|
|
<div class="label">测试模板:</div> |
|
|
|
<FormItemSelect |
|
|
|
<FormItemSelect |
|
|
@ -83,23 +84,22 @@ |
|
|
|
{{ params.currentFirmwareId }} |
|
|
|
{{ params.currentFirmwareId }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="from-row"> |
|
|
|
|
|
|
|
<div class="label">物联网卡:</div> |
|
|
|
|
|
|
|
<el-input class="input" :disabled="action === 'view'" v-model="params.iccid" placeholder="请输入物联网卡号" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="from-row"> |
|
|
|
<div class="from-row"> |
|
|
|
<div class="label">设备成本:</div> |
|
|
|
<div class="label">设备成本:</div> |
|
|
|
<number-input |
|
|
|
<number-input class="input" :disabled="action === 'view'" v-model="params.cost" placeholder="请输入成本" /> |
|
|
|
class="input" |
|
|
|
|
|
|
|
:disabled="disabled" |
|
|
|
|
|
|
|
v-model="params.cost" |
|
|
|
|
|
|
|
placeholder="请输入成本" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="group-box"> |
|
|
|
<div class="group-box"> |
|
|
|
<div class="from-row"> |
|
|
|
<div class="from-row"> |
|
|
|
<div class="label">备注:</div> |
|
|
|
<div class="label">备注:</div> |
|
|
|
<el-input |
|
|
|
<el-input |
|
|
|
:disabled="disabled" |
|
|
|
|
|
|
|
class="input" |
|
|
|
class="input" |
|
|
|
type="textarea" |
|
|
|
type="textarea" |
|
|
|
|
|
|
|
:disabled="action === 'view'" |
|
|
|
v-model="params.description" |
|
|
|
v-model="params.description" |
|
|
|
placeholder="请输入备注" |
|
|
|
placeholder="请输入备注" |
|
|
|
:autosize="{ minRows: 5, maxRows: 4 }" |
|
|
|
:autosize="{ minRows: 5, maxRows: 4 }" |
|
|
@ -107,20 +107,22 @@ |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<EdfsButton |
|
|
|
<div class="btns" style="margin-left: auto; margin-right: 20px; margin-top: auto"> |
|
|
|
inner-text="提交基础信息" |
|
|
|
<EdfsButton |
|
|
|
type="primary" |
|
|
|
inner-text="提交基础信息" |
|
|
|
class="save-button" |
|
|
|
type="primary" |
|
|
|
v-if="isShowSaveButton" |
|
|
|
class="save-button" |
|
|
|
@click="onSave" |
|
|
|
v-if="isShowSaveButton" |
|
|
|
/> |
|
|
|
@click="onSave" |
|
|
|
<EdfsButton |
|
|
|
/> |
|
|
|
inner-text="固件升级" |
|
|
|
<EdfsButton |
|
|
|
type="primary" |
|
|
|
inner-text="固件升级" |
|
|
|
class="save-button" |
|
|
|
type="primary" |
|
|
|
v-if="isShowFirmwareUpgradeButton" |
|
|
|
class="save-button" |
|
|
|
@click="onFirmwareUpgrade" |
|
|
|
v-if="isShowFirmwareUpgradeButton" |
|
|
|
/> |
|
|
|
@click="onFirmwareUpgrade" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -148,6 +150,14 @@ const props = defineProps<{ |
|
|
|
}>() |
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['on-save']) |
|
|
|
const emit = defineEmits(['on-save']) |
|
|
|
|
|
|
|
const updatedField: Array<keyof IDeviceOV> = [ |
|
|
|
|
|
|
|
'iccid', |
|
|
|
|
|
|
|
'description', |
|
|
|
|
|
|
|
'cost', |
|
|
|
|
|
|
|
'serialNo', |
|
|
|
|
|
|
|
'categoryId', |
|
|
|
|
|
|
|
'sn', |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const paramsData: IDeviceOV = { |
|
|
|
const paramsData: IDeviceOV = { |
|
|
|
currentFirmwareId: '', |
|
|
|
currentFirmwareId: '', |
|
|
@ -158,11 +168,13 @@ const paramsData: IDeviceOV = { |
|
|
|
description: '', |
|
|
|
description: '', |
|
|
|
cost: '', |
|
|
|
cost: '', |
|
|
|
targetFirmwareId: '', |
|
|
|
targetFirmwareId: '', |
|
|
|
|
|
|
|
iccid: '', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const isShowSaveButton = computed(() => { |
|
|
|
const isShowSaveButton = computed(() => { |
|
|
|
if (action === 'view') return false |
|
|
|
if (action === 'view') return false |
|
|
|
return props.info?.status === undefined ? true : props.info.status < 2 |
|
|
|
// return props.info?.status === undefined ? true : props.info.status < 2 |
|
|
|
|
|
|
|
return true |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const isShowFirmwareUpgradeButton = computed(() => { |
|
|
|
const isShowFirmwareUpgradeButton = computed(() => { |
|
|
@ -179,7 +191,11 @@ async function onSave() { |
|
|
|
if (!validate()) return |
|
|
|
if (!validate()) return |
|
|
|
|
|
|
|
|
|
|
|
const type = !!params.value.serialNo ? 'update' : 'create' |
|
|
|
const type = !!params.value.serialNo ? 'update' : 'create' |
|
|
|
const options = cloneDeep(params.value) |
|
|
|
let options = cloneDeep(params.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type === 'update' && props.info.status > 2) { |
|
|
|
|
|
|
|
options = Object.fromEntries(updatedField.map(key => [key, options[key]])) |
|
|
|
|
|
|
|
} |
|
|
|
options.templateId = 0 |
|
|
|
options.templateId = 0 |
|
|
|
if (type === 'update') options.id = props.info?.id |
|
|
|
if (type === 'update') options.id = props.info?.id |
|
|
|
const res = await operantDevice(type, options) |
|
|
|
const res = await operantDevice(type, options) |
|
|
@ -201,17 +217,23 @@ watch( |
|
|
|
{ immediate: true } |
|
|
|
{ immediate: true } |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onChangeCategoryId() { |
|
|
|
|
|
|
|
params.value.targetFirmwareId = '' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
watch( |
|
|
|
() => params.value.categoryId, |
|
|
|
() => params.value.targetFirmwareId, |
|
|
|
val => { |
|
|
|
val => { |
|
|
|
params.value.targetFirmwareId = '' |
|
|
|
console.log(val) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
function validate() { |
|
|
|
function validate() { |
|
|
|
if (isEmpty(params.value.targetFirmwareId)) { |
|
|
|
if (!params.value.currentFirmwareId) { |
|
|
|
message.error('请选择固件') |
|
|
|
if (isEmpty(params.value.targetFirmwareId)) { |
|
|
|
return false |
|
|
|
message.error('请选择固件') |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isEmpty(params.value.sn)) { |
|
|
|
if (isEmpty(params.value.sn)) { |
|
|
@ -307,14 +329,16 @@ onMounted(() => { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
width: 100%; |
|
|
|
width: 100%; |
|
|
|
column-gap: 30px; |
|
|
|
column-gap: 30px; |
|
|
|
|
|
|
|
row-gap: 10px; |
|
|
|
flex-wrap: wrap; |
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
|
|
max-width: 1340px; |
|
|
|
.group-box { |
|
|
|
.group-box { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
flex-direction: column; |
|
|
|
row-gap: 10px; |
|
|
|
row-gap: 10px; |
|
|
|
} |
|
|
|
} |
|
|
|
.from-row { |
|
|
|
.from-row { |
|
|
|
width: 320px; |
|
|
|
width: 346px; |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
box-sizing: border-box; |
|
|
|
box-sizing: border-box; |
|
|
|
min-height: 32px; |
|
|
|
min-height: 32px; |
|
|
|