|
@@ -0,0 +1,208 @@
|
|
|
|
+<template>
|
|
|
|
+ <a-modal
|
|
|
|
+ centered
|
|
|
|
+ class="userEdit-modal"
|
|
|
|
+ :footer="null"
|
|
|
|
+ :maskClosable="false"
|
|
|
|
+ :title="modalTit"
|
|
|
|
+ v-model="isShow"
|
|
|
|
+ @cancle="isShow=false"
|
|
|
|
+ :width="800">
|
|
|
|
+ <a-form-model
|
|
|
|
+ id="userEdit-form"
|
|
|
|
+ ref="ruleForm"
|
|
|
|
+ :model="form"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ :label-col="formItemLayout.labelCol"
|
|
|
|
+ :wrapper-col="formItemLayout.wrapperCol" >
|
|
|
|
+ <a-form-model-item label="版本类型" prop="versionType">
|
|
|
|
+ <v-select
|
|
|
|
+ v-model="form.versionType"
|
|
|
|
+ ref="versionType"
|
|
|
|
+ id="versionSettingsList-versionType"
|
|
|
|
+ code="VERSION_TYPE"
|
|
|
|
+ placeholder="请选择版本类型"
|
|
|
|
+ allowClear></v-select>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="版本号" prop="version">
|
|
|
|
+ <a-input-number
|
|
|
|
+ id="versionSettingsList-version"
|
|
|
|
+ v-model="form.version"
|
|
|
|
+ :precision="0"
|
|
|
|
+ :min="0"
|
|
|
|
+ :max="999999"
|
|
|
|
+ placeholder="请输入(0~999999)之间的版本号"
|
|
|
|
+ style="width: 100%;"
|
|
|
|
+ allowClear />
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="更新时间" prop="publicDate">
|
|
|
|
+ <a-date-picker
|
|
|
|
+ v-model="form.publicDate"
|
|
|
|
+ type="date"
|
|
|
|
+ show-time
|
|
|
|
+ :disabled-date="disabledDate"
|
|
|
|
+ :defaultValue="null"
|
|
|
|
+ placeholder="请选择更新时间"
|
|
|
|
+ style="width: 100%;"
|
|
|
|
+ />
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="强制升级" prop="forceUpgrade">
|
|
|
|
+ <a-radio-group v-model="form.forceUpgrade">
|
|
|
|
+ <a-radio :value="1">是</a-radio>
|
|
|
|
+ <a-radio :value="0">否</a-radio>
|
|
|
|
+ </a-radio-group>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item :label="form.versionType=='IOS'?'更新地址':'下载地址'" prop="downloadUrl">
|
|
|
|
+ <a-textarea id="versionSettingsList-downloadUrl" :maxLength="200" v-model="form.downloadUrl" placeholder="请输入(最多200个字符)'" allowClear />
|
|
|
|
+ <div v-if="form.versionType=='IOS'">示例:itms-apps://itunes.apple.com/cn/app/id<span style="color: red;">xxxxxxxx</span>?mt=8</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="升级内容" prop="upgradeContent">
|
|
|
|
+ <a-textarea id="versionSettingsList-upgradeContent" :maxLength="500" v-model="form.upgradeContent" :placeholder="'请输入升级内容(最多500个字符)'" allowClear />
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item label="附件" prop="attachment" v-if="form.versionType!='IOS'">
|
|
|
|
+ <Upload
|
|
|
|
+ id="versionSettingsList-attachment"
|
|
|
|
+ ref="attachment"
|
|
|
|
+ :maxNums="1"
|
|
|
|
+ :fileSize="100"
|
|
|
|
+ fileType="application/vnd.android.package-archive"
|
|
|
|
+ :action="attachAction"
|
|
|
|
+ :uploadParams="uploadParams"
|
|
|
|
+ @change="changeImport"
|
|
|
|
+ upText="附件上传"></Upload>
|
|
|
|
+ <div style="line-height: 16px;padding-top: 10px;color: #999;">(上传apk格式文件)</div>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
|
|
|
|
+ <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">保存</a-button>
|
|
|
|
+ <a-button :style="{ marginLeft: '8px' }" @click="isShow=false">取消</a-button>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-form-model>
|
|
|
|
+ </a-modal>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { VSelect, Upload } from '@/components'
|
|
|
|
+import moment from 'moment'
|
|
|
|
+import { sysVersionSave, sysVersionDetail } from '@/api/sysVersion'
|
|
|
|
+export default {
|
|
|
|
+ components: { VSelect, Upload },
|
|
|
|
+ props: {
|
|
|
|
+ openModal: { // 弹框显示状态
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: false
|
|
|
|
+ },
|
|
|
|
+ itemId: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ isShow: this.openModal, // 是否打开弹框
|
|
|
|
+ formItemLayout: {
|
|
|
|
+ labelCol: { span: 6 },
|
|
|
|
+ wrapperCol: { span: 16 }
|
|
|
|
+ },
|
|
|
|
+ form: {
|
|
|
|
+ versionType: undefined, // 版本类型
|
|
|
|
+ version: null,
|
|
|
|
+ publicDate: null,
|
|
|
|
+ forceUpgrade: 0,
|
|
|
|
+ downloadUrl: '',
|
|
|
|
+ upgradeContent: '',
|
|
|
|
+ attachment: ''
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ versionType: [ { required: true, message: '请选择版本类型', trigger: 'change' } ],
|
|
|
|
+ version: [ { required: true, message: '请输入版本号', trigger: 'blur' } ],
|
|
|
|
+ publicDate: [ { required: true, message: '请选择更新时间', trigger: 'change' } ],
|
|
|
|
+ forceUpgrade: [ { required: true, message: '请选择是否强制升级', trigger: 'change' } ],
|
|
|
|
+ downloadUrl: [ { required: true, message: '请输入', trigger: 'blur' } ],
|
|
|
|
+ upgradeContent: [ { required: true, message: '请输入升级内容', trigger: 'blur' } ],
|
|
|
|
+ attachment: [ { required: true, message: '请上传app安装文件', trigger: 'change' } ]
|
|
|
|
+ },
|
|
|
|
+ attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
|
|
|
|
+ uploadParams: {
|
|
|
|
+ savePathType: 'local'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ modalTit () {
|
|
|
|
+ return (this.itemId ? '编辑' : '新增') + '版本设置'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 保存
|
|
|
|
+ handleSubmit () {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ const params = JSON.parse(JSON.stringify(_this.form))
|
|
|
|
+ params.id = _this.itemId || null
|
|
|
|
+ params.publicDate = moment(_this.form.publicDate).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
+ params.applyName = 'IT后台'
|
|
|
|
+ params.applyCode = 'jgqp'
|
|
|
|
+ sysVersionSave(params).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$emit('confirm', _this.form)
|
|
|
|
+ _this.isShow = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ console.log('error submit!!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 获取详情
|
|
|
|
+ getDetail () {
|
|
|
|
+ sysVersionDetail({ 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
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 上传文件 change
|
|
|
|
+ changeImport (file) {
|
|
|
|
+ if (file) {
|
|
|
|
+ this.form.attachment = file
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 不可选日期
|
|
|
|
+ disabledDate (current) {
|
|
|
|
+ return current && current < moment().subtract(1, 'day')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ // 父页面传过来的弹框状态
|
|
|
|
+ openModal (newValue, oldValue) {
|
|
|
|
+ this.isShow = newValue
|
|
|
|
+ },
|
|
|
|
+ // 重定义的弹框状态
|
|
|
|
+ isShow (newValue, oldValue) {
|
|
|
|
+ if (!newValue) {
|
|
|
|
+ this.$emit('close')
|
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ itemId (newValue, oldValue) {
|
|
|
|
+ if (this.isShow && newValue) { // 编辑
|
|
|
|
+ this.getDetail()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style>
|
|
|
|
+</style>
|