Browse Source

操作宽度

dev
mk 1 year ago
parent
commit
a0423e467a
  1. 184
      epmet-oper-web/src/views/modules/sys/upgrade-version-history.vue

184
epmet-oper-web/src/views/modules/sys/upgrade-version-history.vue

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
<el-card shadow="never" <el-card shadow="never" class="aui-card--fill">
class="aui-card--fill">
<!-- 按钮 --> <!-- 按钮 -->
<div class="btn-group"> <div class="btn-group">
@ -12,11 +11,9 @@
<!-- 数据列表 --> <!-- 数据列表 -->
<div> <div>
<el-table :data="histories" border style="width: 100%"> <el-table :data="histories" border style="width: 100%">
<el-table-column <el-table-column prop="versionNo" label="版本">
prop="versionNo"
label="版本">
</el-table-column> </el-table-column>
<el-table-column label="操作" :width="250"> <el-table-column label="操作" :width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="small" @click="onEditBtnClick(scope.row.id)">编辑</el-button> <el-button type="primary" size="small" @click="onEditBtnClick(scope.row.id)">编辑</el-button>
</template> </template>
@ -26,13 +23,8 @@
</div> </div>
<!-- 分页条--> <!-- 分页条-->
<el-pagination <el-pagination background layout="prev, pager, next" @current-change="onCurrentPageChanged"
background :current-page="this.pageArgs.pageNo" :page-size="this.pageArgs.pageSize" :total="this.pageArgs.total">
layout="prev, pager, next"
@current-change="onCurrentPageChanged"
:current-page="this.pageArgs.pageNo"
:page-size="this.pageArgs.pageSize"
:total="this.pageArgs.total">
</el-pagination> </el-pagination>
<!-- <Tinymce <!-- <Tinymce
@ -43,11 +35,8 @@
</el-card> </el-card>
<!-- 新增/修改 --> <!-- 新增/修改 -->
<el-dialog :visible.sync="publishVersionUpgradeShow" <el-dialog :visible.sync="publishVersionUpgradeShow" v-if="publishVersionUpgradeShow" :close-on-click-modal="false"
v-if="publishVersionUpgradeShow" :close-on-press-escape="false" :title="this.operation === 'create' ? '发布新版本' : '修改'">
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="this.operation === 'create' ? '发布新版本' : '修改'">
<el-form :model="createOrUpdateForm" ref="createOrUpdateForm"> <el-form :model="createOrUpdateForm" ref="createOrUpdateForm">
<el-form-item prop="versionNo" label="版本"> <el-form-item prop="versionNo" label="版本">
<el-input v-model="createOrUpdateForm.versionNo"> <el-input v-model="createOrUpdateForm.versionNo">
@ -56,23 +45,17 @@
<el-form-item prop="richContent" label="内容"> <el-form-item prop="richContent" label="内容">
<!-- <el-input v-model="createOrUpdateForm.richContent"> --> <!-- <el-input v-model="createOrUpdateForm.richContent"> -->
<!-- <Tinymce v-model="createOrUpdateForm.richContent" :height="300" placeholder="在这里输入文字" /> --> <!-- <Tinymce v-model="createOrUpdateForm.richContent" :height="300" placeholder="在这里输入文字" /> -->
<!-- :customerId="customerId" --> <!-- :customerId="customerId" -->
<div id="J_quillEditor"></div> <div id="J_quillEditor"></div>
<!-- 自定义上传图片功能 (使用element upload组件) --> <!-- 自定义上传图片功能 (使用element upload组件) -->
<el-upload <el-upload :headers="$getElUploadHeaders()" :action="uploadUrl" :show-file-list="false"
:headers="$getElUploadHeaders()" :before-upload="uploadBeforeUploadHandle" :on-success="uploadSuccessHandle" style="display: none">
:action="uploadUrl" <el-button ref="uploadBtn" type="primary" size="small">{{
:show-file-list="false" $t('upload.button')
:before-upload="uploadBeforeUploadHandle" }}</el-button>
:on-success="uploadSuccessHandle" </el-upload>
style="display: none"
>
<el-button ref="uploadBtn" type="primary" size="small">{{
$t('upload.button')
}}</el-button>
</el-upload>
<!-- </el-input> --> <!-- </el-input> -->
</el-form-item> </el-form-item>
<el-button @click="onSubmitBtnClick" type="primary">提交</el-button> <el-button @click="onSubmitBtnClick" type="primary">提交</el-button>
@ -91,13 +74,13 @@ export default {
components: {}, components: {},
activated() { activated () {
this.loadVersionUpgradeHistories(); this.loadVersionUpgradeHistories();
}, },
mounted(){ mounted () {
}, },
data() { data () {
return { return {
quillEditor: null, quillEditor: null,
quillEditorToolbarOptions: [ quillEditorToolbarOptions: [
@ -135,7 +118,7 @@ export default {
methods: { methods: {
// //
uploadBeforeUploadHandle(file) { uploadBeforeUploadHandle (file) {
if ( if (
file.type !== 'image/jpg' && file.type !== 'image/jpg' &&
file.type !== 'image/jpeg' && file.type !== 'image/jpeg' &&
@ -147,7 +130,7 @@ export default {
} }
}, },
// //
uploadSuccessHandle(res, file, fileList) { uploadSuccessHandle (res, file, fileList) {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -158,7 +141,7 @@ export default {
) )
}, },
// //
initQuill() { initQuill () {
console.log(document.getElementById('J_quillEditor')); console.log(document.getElementById('J_quillEditor'));
this.quillEditor = new Quill('#J_quillEditor', { this.quillEditor = new Quill('#J_quillEditor', {
modules: { modules: {
@ -167,9 +150,8 @@ export default {
theme: 'snow' theme: 'snow'
}) })
// (使element upload) // (使element upload)
this.uploadUrl = `${ this.uploadUrl = `${window.SITE_CONFIG['apiURL']
window.SITE_CONFIG['apiURL'] }/oss/file/upload?token=${Cookies.get('token')}`
}/oss/file/upload?token=${Cookies.get('token')}`
this.quillEditor.getModule('toolbar').addHandler('image', () => { this.quillEditor.getModule('toolbar').addHandler('image', () => {
this.$refs.uploadBtn.$el.click() this.$refs.uploadBtn.$el.click()
}) })
@ -181,31 +163,31 @@ export default {
/** /**
* 加载版本更新历史 * 加载版本更新历史
*/ */
loadVersionUpgradeHistories() { loadVersionUpgradeHistories () {
this.$http.get(`/sys/sysVersionUpgrade/page?pageNo=${this.pageArgs.pageNo}&pageSize=${this.pageArgs.pageSize}`) this.$http.get(`/sys/sysVersionUpgrade/page?pageNo=${this.pageArgs.pageNo}&pageSize=${this.pageArgs.pageSize}`)
.then(({data: result, status: httpStatus}) => { .then(({ data: result, status: httpStatus }) => {
if (result.code === 0) { if (result.code === 0) {
this.histories = result.data.list this.histories = result.data.list
this.pageArgs.total = result.data.total this.pageArgs.total = result.data.total
} else { } else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: result.msg message: result.msg
}) })
} }
}) })
}, },
// //
onAddBtnClick() { onAddBtnClick () {
this.publishVersionUpgradeShow = true; this.publishVersionUpgradeShow = true;
this.operation = 'create'; this.operation = 'create';
this.$nextTick(()=>{ this.$nextTick(() => {
this.initQuill() this.initQuill()
}) })
}, },
// //
async onEditBtnClick(id) { async onEditBtnClick (id) {
this.publishVersionUpgradeShow = true; this.publishVersionUpgradeShow = true;
this.operation = 'edit'; this.operation = 'edit';
await this.getDetail(id); await this.getDetail(id);
@ -213,7 +195,7 @@ export default {
}, },
onCancelBtnClick() { onCancelBtnClick () {
this.$refs['createOrUpdateForm'].resetFields(); this.$refs['createOrUpdateForm'].resetFields();
this.publishVersionUpgradeShow = false; this.publishVersionUpgradeShow = false;
this.operation = null; this.operation = null;
@ -223,7 +205,7 @@ export default {
/** /**
* 翻页 * 翻页
*/ */
onCurrentPageChanged(pageNo) { onCurrentPageChanged (pageNo) {
this.pageArgs.pageNo = pageNo this.pageArgs.pageNo = pageNo
this.loadVersionUpgradeHistories() this.loadVersionUpgradeHistories()
}, },
@ -231,63 +213,63 @@ export default {
/** /**
* 提交 * 提交
*/ */
onSubmitBtnClick() { onSubmitBtnClick () {
let url = this.operation === 'create' ? `/sys/sysVersionUpgrade/publish` : '/sys/sysVersionUpgrade/update'; let url = this.operation === 'create' ? `/sys/sysVersionUpgrade/publish` : '/sys/sysVersionUpgrade/update';
this.$http.post(url, this.$data.createOrUpdateForm) this.$http.post(url, this.$data.createOrUpdateForm)
.then(({data: rst, status: httpStatus}) => { .then(({ data: rst, status: httpStatus }) => {
if (httpStatus !== 200) { if (httpStatus !== 200) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请求失败' message: '请求失败'
}) })
} else if (rst.code !== 0) { } else if (rst.code !== 0) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: rst.msg message: rst.msg
}); });
} else { } else {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '提交成功' message: '提交成功'
}); });
this.$refs['createOrUpdateForm'].resetFields(); this.$refs['createOrUpdateForm'].resetFields();
this.publishVersionUpgradeShow = false; this.publishVersionUpgradeShow = false;
this.loadVersionUpgradeHistories(); this.loadVersionUpgradeHistories();
} }
}) })
}, },
/** /**
* 加载详情 * 加载详情
* @param id * @param id
*/ */
getDetail(id) { getDetail (id) {
this.$http.get(`/sys/sysVersionUpgrade/detail/${id}`) this.$http.get(`/sys/sysVersionUpgrade/detail/${id}`)
.then(({status: httpStatus, data: epmetRst}) => { .then(({ status: httpStatus, data: epmetRst }) => {
if (httpStatus !== 200) { if (httpStatus !== 200) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请求失败' message: '请求失败'
}) })
} else if (epmetRst.code != 0) { } else if (epmetRst.code != 0) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: epmetRst.msg message: epmetRst.msg
}) })
} else { } else {
this.createOrUpdateForm = epmetRst.data; this.createOrUpdateForm = epmetRst.data;
this.quillEditor.root.innerHTML = this.createOrUpdateForm.richContent this.quillEditor.root.innerHTML = this.createOrUpdateForm.richContent
} }
}) })
} }
} }
} }
</script> </script>
<style scoped lang="css"> <style scoped lang="css">
::v-deep .ql-toolbar{ ::v-deep .ql-toolbar {
margin-top: 36px; margin-top: 36px;
} }
</style> </style>

Loading…
Cancel
Save