版本记录新增发布状态和是否当前版本字段
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-06-27 15:16:48 +08:00
parent 3b745051eb
commit 12449e0ca0
2 changed files with 204 additions and 150 deletions

View File

@ -10,19 +10,39 @@
size="small" size="small"
> >
<el-form-item label="发布版本" prop="Version"> <el-form-item label="发布版本" prop="Version">
<el-input <el-input v-model="form.Version" />
v-model="form.Version"
/>
</el-form-item> </el-form-item>
<el-form-item label="更新功能" prop="UpdateContent"> <el-form-item label="更新功能" prop="UpdateContent">
<el-input <el-input
v-model="form.UpdateContent" v-model="form.UpdateContent"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:autosize="{ minRows: 4, maxRows: 5}" :autosize="{ minRows: 4, maxRows: 5 }"
/> />
</el-form-item> </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 <el-date-picker
v-model="form.PublishTime" v-model="form.PublishTime"
type="date" type="date"
@ -32,24 +52,30 @@
</el-form> </el-form>
</template> </template>
<template slot="dialog-footer"> <template slot="dialog-footer">
<el-button size="small" type="primary" @click="handleCancle"></el-button> <el-button size="small" type="primary" @click="handleCancle"
<el-button size="small" type="primary" @click="handleSave"></el-button> >取消</el-button
>
<el-button size="small" type="primary" @click="handleSave"
>保存</el-button
>
</template> </template>
</base-model> </base-model>
</template> </template>
<script> <script>
import { addOrUpdatePublishLog } from '@/api/admin' import { addOrUpdatePublishLog } from "@/api/admin";
import BaseModel from '@/components/BaseModel' import BaseModel from "@/components/BaseModel";
const formDataDefault = () => { const formDataDefault = () => {
return { return {
Id: null, Id: null,
Version: null, Version: null,
PublishTime: null, PublishTime: null,
UpdateContent: null UpdateContent: null,
} State: null,
} IsCurrentVersion: null,
};
};
export default { export default {
name: 'LogForm', name: "LogForm",
components: { BaseModel }, components: { BaseModel },
data() { data() {
return { return {
@ -57,54 +83,73 @@ export default {
form: formDataDefault(), form: formDataDefault(),
rules: { rules: {
Version: [ Version: [
{ required: true, message: '请注明', trigger: 'blur' }, { required: true, message: "请注明", trigger: "blur" },
{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` } { max: 50, message: `${this.$t("common:ruleMessage:maxLength")} 50` },
], ],
PublishTime: [ // PublishTime: [
{ required: true, message: '请注明', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ],
IsCurrentVersion: [
{ required: true, message: "请选择", trigger: "blur" },
], ],
State: [{ required: true, message: "请选择", trigger: "blur" }],
UpdateContent: [ UpdateContent: [
{ required: true, message: '请注明', trigger: 'blur' }, { required: true, message: "请注明", trigger: "blur" },
{ max: 1000, message: `${this.$t('common:ruleMessage:maxLength')} 500` } {
] max: 1000,
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
},
],
}, },
model_cfg: { visible: false, showClose: true, width: '500px', title: '', appendToBody: true } model_cfg: {
} visible: false,
}, showClose: true,
mounted() { width: "500px",
title: "",
appendToBody: true,
},
};
}, },
mounted() {},
methods: { methods: {
openDialog(title, data) { openDialog(title, data) {
this.model_cfg.visible = true this.model_cfg.visible = true;
this.model_cfg.title = title this.model_cfg.title = title;
if (Object.keys(data).length > 0) { if (Object.keys(data).length > 0) {
for (const k in this.form) { for (const k in this.form) {
if (data.hasOwnProperty(k)) { if (data.hasOwnProperty(k)) {
this.form[k] = data[k] this.form[k] = data[k];
} }
} }
} else { } else {
this.form = formDataDefault() this.form = formDataDefault();
} }
}, },
handleSave() { handleSave() {
this.$refs.LogForm.validate(valid => { this.$refs.LogForm.validate((valid) => {
if (!valid) return if (!valid) return;
this.loading = true this.loading = true;
addOrUpdatePublishLog(this.form).then(res => { addOrUpdatePublishLog(this.form)
this.loading = false .then((res) => {
this.$message.success(this.$t('common:message:savedSuccessfully')) this.loading = false;
this.model_cfg.visible = false this.$message.success(this.$t("common:message:savedSuccessfully"));
this.$emit('getList') this.model_cfg.visible = false;
}).catch(() => { this.$emit("getList");
this.loading = false })
}) .catch(() => {
}) this.loading = false;
});
});
}, },
handleCancle() { handleCancle() {
this.model_cfg.visible = false this.model_cfg.visible = false;
} },
} },
} };
</script> </script>
<style lang="scss" scoped>
::v-deep .el-select,
.el-date-editor {
width: 100%;
}
</style>

View File

@ -2,25 +2,11 @@
<div class="log"> <div class="log">
<div ref="leftContainer" class="left"> <div ref="leftContainer" class="left">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item <el-form-item label="发布版本" prop="Version">
label="发布版本" <el-input v-model="searchData.Version" size="small" clearable />
prop="Version"
>
<el-input
v-model="searchData.Version"
size="small"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="更新功能" prop="UpdateContent">
label="更新功能" <el-input v-model="searchData.UpdateContent" size="small" clearable />
prop="UpdateContent"
>
<el-input
v-model="searchData.UpdateContent"
size="small"
clearable
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button
@ -43,17 +29,14 @@
</el-form> </el-form>
<el-table <el-table
v-loading="loading" v-loading="loading"
v-adaptive="{bottomOffset:45}" v-adaptive="{ bottomOffset: 45 }"
height="100" height="100"
:data="list" :data="list"
class="table" class="table"
@sort-change="handleSortByColumn" @sort-change="handleSortByColumn"
:default-sort="{prop:'PublishTime',order:'descending'}" :default-sort="{ prop: 'PublishTime', order: 'descending' }"
> >
<el-table-column <el-table-column type="index" width="50" />
type="index"
width="50"
/>
<el-table-column <el-table-column
label="发布版本" label="发布版本"
prop="Version" prop="Version"
@ -67,6 +50,26 @@
min-width="150" min-width="150"
show-overflow-tooltip 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 <el-table-column
label="发布日期" label="发布日期"
prop="PublishTime" prop="PublishTime"
@ -75,7 +78,11 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
@ -103,11 +110,10 @@
> >
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination" style="text-align: right;margin-top:5px;"> <div class="pagination" style="text-align: right; margin-top: 5px">
<pagination <pagination
:total="total" :total="total"
:page.sync="searchData.PageIndex" :page.sync="searchData.PageIndex"
@ -115,28 +121,25 @@
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<log-form <log-form ref="LogForm" @getList="getList" />
ref="LogForm"
@getList="getList"
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getPublishLogList, deletePublishLog } from '@/api/admin' import { getPublishLogList, deletePublishLog } from "@/api/admin";
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
import LogForm from './components/LogForm.vue' import LogForm from "./components/LogForm.vue";
import moment from 'moment' import moment from "moment";
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
Version: null, Version: null,
UpdateContent: null, UpdateContent: null,
Asc: false, Asc: false,
SortField: 'PublishTime', SortField: "PublishTime",
PageIndex: 1, PageIndex: 1,
PageSize: 20 PageSize: 20,
} };
} };
export default { export default {
components: { Pagination, LogForm }, components: { Pagination, LogForm },
data() { data() {
@ -145,95 +148,101 @@ export default {
searchData: searchDataDefault(), searchData: searchDataDefault(),
list: [], list: [],
total: 0, total: 0,
loading: false loading: false,
} };
}, },
mounted() { mounted() {
this.getList() this.getList();
}, },
methods: { methods: {
getList() { getList() {
this.loading = true this.loading = true;
getPublishLogList(this.searchData).then((res) => { getPublishLogList(this.searchData)
this.loading = false .then((res) => {
this.list = res.Result.CurrentPageData this.loading = false;
this.total = res.Result.TotalCount this.list = res.Result.CurrentPageData;
}).catch(() => { this.total = res.Result.TotalCount;
this.loading = false })
}) .catch(() => {
this.loading = false;
});
}, },
handleAdd() { handleAdd() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['LogForm'].openDialog('新增', {}) this.$refs["LogForm"].openDialog("新增", {});
}) });
}, },
handleEdit(row) { handleEdit(row) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['LogForm'].openDialog('编辑', row) this.$refs["LogForm"].openDialog("编辑", row);
}) });
}, },
// //
handleReset() { handleReset() {
this.searchData = searchDataDefault() this.searchData = searchDataDefault();
this.getList() this.getList();
}, },
// //
handleDelete(row) { handleDelete(row) {
this.$confirm('是否确认删除?', { this.$confirm("是否确认删除?", {
type: 'warning', type: "warning",
distinguishCancelAndClose: true distinguishCancelAndClose: true,
}) }).then(() => {
.then(() => { this.loading = true;
this.loading = true deletePublishLog(row.Id)
deletePublishLog(row.Id) .then((res) => {
.then(res => { this.loading = false;
this.loading = false if (res.IsSuccess) {
if (res.IsSuccess) { this.getList();
this.getList() this.$message.success(
this.$message.success(this.$t('common:message:deletedSuccessfully')) this.$t("common:message:deletedSuccessfully")
} );
}).catch(() => { this.loading = false }) }
}) })
.catch(() => {
this.loading = false;
});
});
}, },
// //
handleSortByColumn(column) { handleSortByColumn(column) {
if (column.order === 'ascending') { if (column.order === "ascending") {
this.searchData.Asc = true this.searchData.Asc = true;
} else { } else {
this.searchData.Asc = false this.searchData.Asc = false;
} }
this.searchData.SortField = column.prop this.searchData.SortField = column.prop;
this.searchData.PageIndex = 1 this.searchData.PageIndex = 1;
this.getList() this.getList();
},
},
};
</script>
<style lang="scss">
.log {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
} }
} }
} }
</script>
<style lang="scss">
.log {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
}
}
}
</style> </style>