|
@@ -45,7 +45,7 @@
|
|
|
<script>
|
|
|
import { VSelect } from '@/components'
|
|
|
import storeList from '@/views/common/storeList.vue'
|
|
|
-import { handDeviceSave, handDeviceDetail } from '@/api/handDevice'
|
|
|
+import { handDeviceSave, handDeviceDetail, handDeviceEdit } from '@/api/handDevice'
|
|
|
export default {
|
|
|
components: { VSelect, storeList },
|
|
|
props: {
|
|
@@ -89,13 +89,21 @@ export default {
|
|
|
this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
const params = JSON.parse(JSON.stringify(_this.form))
|
|
|
- handDeviceSave(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- _this.$emit('confirm', _this.form)
|
|
|
- _this.isShow = false
|
|
|
- }
|
|
|
- })
|
|
|
+ if (!_this.itemId) {
|
|
|
+ handDeviceSave(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.isShow = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ handDeviceEdit(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.isShow = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
console.log('error submit!!')
|
|
|
return false
|
|
@@ -106,13 +114,11 @@ export default {
|
|
|
getDetail () {
|
|
|
handDeviceDetail({ id: this.itemId }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.form.versionType = res.data.versionType
|
|
|
- this.form.version = res.data.version
|
|
|
- this.form.publicDate = res.data.publicDate
|
|
|
- this.form.forceUpgrade = res.data.forceUpgrade ? Number(res.data.forceUpgrade) : null
|
|
|
- this.form.downloadUrl = res.data.downloadUrl
|
|
|
- this.form.upgradeContent = res.data.upgradeContent
|
|
|
- this.form.attachment = res.data.attachment
|
|
|
+ debugger
|
|
|
+ this.form.dealerSn = res.data.dealerSn
|
|
|
+ this.form.deviceCode = res.data.deviceCode
|
|
|
+ this.form.deviceName = res.data.deviceName
|
|
|
+ this.form.enabledFlag = res.data.enabledFlag
|
|
|
} else {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
}
|
|
@@ -127,6 +133,9 @@ export default {
|
|
|
enabledFlag: '0'// 启用标记
|
|
|
}
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
+ },
|
|
|
+ pageInit (data) {
|
|
|
+ this.getDetail()
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -140,11 +149,6 @@ export default {
|
|
|
this.$emit('close')
|
|
|
this.reset()
|
|
|
}
|
|
|
- },
|
|
|
- itemId (newValue, oldValue) {
|
|
|
- if (this.isShow && newValue) { // 编辑
|
|
|
- this.getDetail()
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|