版本记录新增发布状态和是否当前版本字段
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3b745051eb
commit
12449e0ca0
|
@ -10,19 +10,39 @@
|
|||
size="small"
|
||||
>
|
||||
<el-form-item label="发布版本" prop="Version">
|
||||
<el-input
|
||||
v-model="form.Version"
|
||||
/>
|
||||
<el-input v-model="form.Version" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新功能" prop="UpdateContent">
|
||||
<el-input
|
||||
v-model="form.UpdateContent"
|
||||
type="textarea"
|
||||
maxlength="1000"
|
||||
:autosize="{ minRows: 4, maxRows: 5}"
|
||||
:autosize="{ minRows: 4, maxRows: 5 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期" prop="PublishTime">
|
||||
<el-form-item label="发布状态" prop="State">
|
||||
<el-select v-model="form.State" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in $d.PublishStatus"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否当前版本" prop="IsCurrentVersion">
|
||||
<el-select v-model="form.IsCurrentVersion" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in $d.YesOrNo"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期">
|
||||
<el-date-picker
|
||||
v-model="form.PublishTime"
|
||||
type="date"
|
||||
|
@ -32,24 +52,30 @@
|
|||
</el-form>
|
||||
</template>
|
||||
<template slot="dialog-footer">
|
||||
<el-button size="small" type="primary" @click="handleCancle">取消</el-button>
|
||||
<el-button size="small" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button size="small" type="primary" @click="handleCancle"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button size="small" type="primary" @click="handleSave"
|
||||
>保存</el-button
|
||||
>
|
||||
</template>
|
||||
</base-model>
|
||||
</template>
|
||||
<script>
|
||||
import { addOrUpdatePublishLog } from '@/api/admin'
|
||||
import BaseModel from '@/components/BaseModel'
|
||||
import { addOrUpdatePublishLog } from "@/api/admin";
|
||||
import BaseModel from "@/components/BaseModel";
|
||||
const formDataDefault = () => {
|
||||
return {
|
||||
Id: null,
|
||||
Version: null,
|
||||
PublishTime: null,
|
||||
UpdateContent: null
|
||||
}
|
||||
}
|
||||
UpdateContent: null,
|
||||
State: null,
|
||||
IsCurrentVersion: null,
|
||||
};
|
||||
};
|
||||
export default {
|
||||
name: 'LogForm',
|
||||
name: "LogForm",
|
||||
components: { BaseModel },
|
||||
data() {
|
||||
return {
|
||||
|
@ -57,54 +83,73 @@ export default {
|
|||
form: formDataDefault(),
|
||||
rules: {
|
||||
Version: [
|
||||
{ required: true, message: '请注明', trigger: 'blur' },
|
||||
{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }
|
||||
{ required: true, message: "请注明", trigger: "blur" },
|
||||
{ max: 50, message: `${this.$t("common:ruleMessage:maxLength")} 50` },
|
||||
],
|
||||
PublishTime: [
|
||||
{ required: true, message: '请注明', trigger: 'blur' }
|
||||
// PublishTime: [
|
||||
// { required: true, message: '请注明', trigger: 'blur' }
|
||||
// ],
|
||||
IsCurrentVersion: [
|
||||
{ required: true, message: "请选择", trigger: "blur" },
|
||||
],
|
||||
State: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||
UpdateContent: [
|
||||
{ required: true, message: '请注明', trigger: 'blur' },
|
||||
{ max: 1000, message: `${this.$t('common:ruleMessage:maxLength')} 500` }
|
||||
]
|
||||
{ required: true, message: "请注明", trigger: "blur" },
|
||||
{
|
||||
max: 1000,
|
||||
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
|
||||
},
|
||||
model_cfg: { visible: false, showClose: true, width: '500px', title: '', appendToBody: true }
|
||||
}
|
||||
],
|
||||
},
|
||||
mounted() {
|
||||
model_cfg: {
|
||||
visible: false,
|
||||
showClose: true,
|
||||
width: "500px",
|
||||
title: "",
|
||||
appendToBody: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
|
||||
openDialog(title, data) {
|
||||
this.model_cfg.visible = true
|
||||
this.model_cfg.title = title
|
||||
this.model_cfg.visible = true;
|
||||
this.model_cfg.title = title;
|
||||
if (Object.keys(data).length > 0) {
|
||||
for (const k in this.form) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
this.form[k] = data[k]
|
||||
this.form[k] = data[k];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.form = formDataDefault()
|
||||
this.form = formDataDefault();
|
||||
}
|
||||
},
|
||||
handleSave() {
|
||||
this.$refs.LogForm.validate(valid => {
|
||||
if (!valid) return
|
||||
this.loading = true
|
||||
addOrUpdatePublishLog(this.form).then(res => {
|
||||
this.loading = false
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
this.model_cfg.visible = false
|
||||
this.$emit('getList')
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
this.$refs.LogForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
this.loading = true;
|
||||
addOrUpdatePublishLog(this.form)
|
||||
.then((res) => {
|
||||
this.loading = false;
|
||||
this.$message.success(this.$t("common:message:savedSuccessfully"));
|
||||
this.model_cfg.visible = false;
|
||||
this.$emit("getList");
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
handleCancle() {
|
||||
this.model_cfg.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
this.model_cfg.visible = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-select,
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -2,25 +2,11 @@
|
|||
<div class="log">
|
||||
<div ref="leftContainer" class="left">
|
||||
<el-form :inline="true">
|
||||
<el-form-item
|
||||
label="发布版本"
|
||||
prop="Version"
|
||||
>
|
||||
<el-input
|
||||
v-model="searchData.Version"
|
||||
size="small"
|
||||
clearable
|
||||
/>
|
||||
<el-form-item label="发布版本" prop="Version">
|
||||
<el-input v-model="searchData.Version" size="small" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="更新功能"
|
||||
prop="UpdateContent"
|
||||
>
|
||||
<el-input
|
||||
v-model="searchData.UpdateContent"
|
||||
size="small"
|
||||
clearable
|
||||
/>
|
||||
<el-form-item label="更新功能" prop="UpdateContent">
|
||||
<el-input v-model="searchData.UpdateContent" size="small" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
|
@ -43,17 +29,14 @@
|
|||
</el-form>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
v-adaptive="{bottomOffset:45}"
|
||||
v-adaptive="{ bottomOffset: 45 }"
|
||||
height="100"
|
||||
:data="list"
|
||||
class="table"
|
||||
@sort-change="handleSortByColumn"
|
||||
:default-sort="{prop:'PublishTime',order:'descending'}"
|
||||
:default-sort="{ prop: 'PublishTime', order: 'descending' }"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="50"
|
||||
/>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column
|
||||
label="发布版本"
|
||||
prop="Version"
|
||||
|
@ -67,6 +50,26 @@
|
|||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="发布状态"
|
||||
prop="State"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $fd("PublishStatus", scope.row.State) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="是否当前版本"
|
||||
prop="IsCurrentVersion"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ $fd("YesOrNo", scope.row.IsCurrentVersion) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="发布日期"
|
||||
prop="PublishTime"
|
||||
|
@ -75,7 +78,11 @@
|
|||
sortable="custom"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.PublishTime?moment(scope.row.PublishTime).format('YYYY-MM-DD'):'' }}
|
||||
{{
|
||||
scope.row.PublishTime
|
||||
? moment(scope.row.PublishTime).format("YYYY-MM-DD")
|
||||
: ""
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -103,11 +110,10 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination" style="text-align: right;margin-top:5px;">
|
||||
<div class="pagination" style="text-align: right; margin-top: 5px">
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="searchData.PageIndex"
|
||||
|
@ -115,28 +121,25 @@
|
|||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
<log-form
|
||||
ref="LogForm"
|
||||
@getList="getList"
|
||||
/>
|
||||
<log-form ref="LogForm" @getList="getList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getPublishLogList, deletePublishLog } from '@/api/admin'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import LogForm from './components/LogForm.vue'
|
||||
import moment from 'moment'
|
||||
import { getPublishLogList, deletePublishLog } from "@/api/admin";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import LogForm from "./components/LogForm.vue";
|
||||
import moment from "moment";
|
||||
const searchDataDefault = () => {
|
||||
return {
|
||||
Version: null,
|
||||
UpdateContent: null,
|
||||
Asc: false,
|
||||
SortField: 'PublishTime',
|
||||
SortField: "PublishTime",
|
||||
PageIndex: 1,
|
||||
PageSize: 20
|
||||
}
|
||||
}
|
||||
PageSize: 20,
|
||||
};
|
||||
};
|
||||
export default {
|
||||
components: { Pagination, LogForm },
|
||||
data() {
|
||||
|
@ -145,72 +148,78 @@ export default {
|
|||
searchData: searchDataDefault(),
|
||||
list: [],
|
||||
total: 0,
|
||||
loading: false
|
||||
}
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
getPublishLogList(this.searchData).then((res) => {
|
||||
this.loading = false
|
||||
this.list = res.Result.CurrentPageData
|
||||
this.total = res.Result.TotalCount
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
this.loading = true;
|
||||
getPublishLogList(this.searchData)
|
||||
.then((res) => {
|
||||
this.loading = false;
|
||||
this.list = res.Result.CurrentPageData;
|
||||
this.total = res.Result.TotalCount;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['LogForm'].openDialog('新增', {})
|
||||
})
|
||||
this.$refs["LogForm"].openDialog("新增", {});
|
||||
});
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['LogForm'].openDialog('编辑', row)
|
||||
})
|
||||
this.$refs["LogForm"].openDialog("编辑", row);
|
||||
});
|
||||
},
|
||||
// 重置列表查询
|
||||
handleReset() {
|
||||
this.searchData = searchDataDefault()
|
||||
this.getList()
|
||||
this.searchData = searchDataDefault();
|
||||
this.getList();
|
||||
},
|
||||
// 删除
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除?', {
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true
|
||||
})
|
||||
.then(() => {
|
||||
this.loading = true
|
||||
this.$confirm("是否确认删除?", {
|
||||
type: "warning",
|
||||
distinguishCancelAndClose: true,
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
deletePublishLog(row.Id)
|
||||
.then(res => {
|
||||
this.loading = false
|
||||
.then((res) => {
|
||||
this.loading = false;
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
this.$message.success(this.$t('common:message:deletedSuccessfully'))
|
||||
this.getList();
|
||||
this.$message.success(
|
||||
this.$t("common:message:deletedSuccessfully")
|
||||
);
|
||||
}
|
||||
}).catch(() => { this.loading = false })
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
// 排序
|
||||
handleSortByColumn(column) {
|
||||
if (column.order === 'ascending') {
|
||||
this.searchData.Asc = true
|
||||
if (column.order === "ascending") {
|
||||
this.searchData.Asc = true;
|
||||
} else {
|
||||
this.searchData.Asc = false
|
||||
this.searchData.Asc = false;
|
||||
}
|
||||
this.searchData.SortField = column.prop
|
||||
this.searchData.PageIndex = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
this.searchData.SortField = column.prop;
|
||||
this.searchData.PageIndex = 1;
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.log {
|
||||
.log {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
@ -235,5 +244,5 @@ export default {
|
|||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue