<template>
|
<section>
|
<!--¹¤¾ßÌõ-->
|
<el-col :span="24"
|
class="toolbar"
|
style="padding-bottom: 0px;">
|
<el-form :inline="true"
|
@submit.native.prevent>
|
<toolbar :buttonList="buttonList"
|
@callFunction="callFunction">
|
</toolbar>
|
<!-- ËÑË÷ -->
|
<SearchForm :commonSearchOptionSet="c_commonSearchOptionSet"
|
:searchValControlStyle="c_searchValControlStyle"
|
:searchFormInputPlaceholder="c_searchFormInputPlaceholder"
|
:searchFormInputAttrs="c_searchFormInputAttrs"
|
:formOptions="h_formOptions"
|
:drawerSize="h_drawerSize"
|
:labelWidth="h_labelWidth"
|
:controlStyle="h_controlStyle"
|
ref="ChildSearchForm"
|
@onSearch="_get$Modulelogo$s" />
|
</el-form>
|
</el-col>
|
|
<!--Áбí-->
|
<el-table :data="$Modulelogo$s"
|
:max-height="tableHeight"
|
highlight-current-row
|
size="small"
|
:height="tableHeight"
|
@current-change="selectCurrentRow"
|
v-loading="listLoading"
|
@selection-change="selsChange"
|
style="width: 99%;">
|
<el-table-column type="index"
|
:index="indexMethod"
|
label="#"
|
align="center"
|
width="50">
|
</el-table-column>
|
$el-table-column$
|
<el-table-column label="²Ù×÷"
|
fixed="right"
|
width="180"
|
v-if="isShowOperatorColumn">
|
<template scope="scope">
|
<el-button size="small"
|
icon="el-icon-edit"
|
type="primary"
|
v-if="isShowOperatorButton('edit')"
|
@click="handleEdit(scope.row)">±à¼</el-button>
|
<el-button type="danger"
|
size="small"
|
icon="el-icon-delete"
|
v-if="isShowOperatorButton('del')"
|
@click="handleDel(scope.row)">ɾ³ý</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!--¹¤¾ßÌõ-->
|
<el-col :span="24"
|
style="margin:10px 10px 10px 0px;"
|
class="toolbar">
|
<el-pagination @size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="page"
|
background
|
:page-sizes="[5,10,50,100, 200, 300, 400]"
|
:page-size="pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total">
|
</el-pagination>
|
</el-col>
|
<!--ÐÂÔö/±à¼½çÃæ-->
|
<el-dialog :title="dialogTitle"
|
:visible.sync="addFormVisible"
|
:close-on-click-modal="false"
|
:before-close="cancelHandle">
|
<el-form :model="addForm"
|
size="small"
|
label-width="120px"
|
ref="addForm">
|
$el-item$
|
</el-form>
|
<div slot="footer"
|
class="dialog-footer">
|
<el-button @click.native="cancelHandle" icon="fa fa-power-off">È¡Ïû</el-button>
|
<el-button type="primary"
|
@click.native="submitDataHandle"
|
:loading="addLoading" icon="fa fa-send">Ìá½»</el-button>
|
</div>
|
</el-dialog>
|
<!--²é¿´½çÃæ-->
|
<el-dialog title="²é¿´"
|
:visible.sync="viewDetailVisible"
|
:before-close="cancelHandle">
|
<el-form :model="viewDetailForm"
|
size="small"
|
disabled="true"
|
label-width="120px"
|
ref="viewDetailForm">
|
$el-item-view$
|
</el-form>
|
<div slot="footer"
|
class="dialog-footer">
|
<el-button @click.native="closeViewHandle" icon="fa fa-power-off">¹Ø±Õ</el-button>
|
</div>
|
</el-dialog>
|
<!-- µ¼³ö×é¼þ -->
|
<ToolbarExport ref="cmToolbarExport"
|
:exportFileName="export_exportFileName"
|
:currentPageData="export_currentPageData"
|
:exportColumnHeader="export_columnHeader" />
|
<!-- µ¼ÈëExcel×é¼þ -->
|
<ToolbarImportExcel ref="tbImportExcel"
|
:importExcelCategroy="emport_excelCategroy"
|
:templeteFileDownName="emport_templeteFileDownName"></ToolbarImportExcel>
|
</section>
|
</template>
|
|
<script>
|
import util from '../../../util/date'
|
import { get$Modulelogo$ListPage, remove$Modulelogo$, edit$Modulelogo$, add$Modulelogo$ } from '../../api/api';
|
import { getButtonList } from "../../promissionRouter";
|
import Toolbar from "../../components/ToolbarButton";
|
import SearchForm from "../../components/SearchForm";
|
import ToolbarExport from "../../components/ToolbarExport";
|
import ToolbarImportExcel from "../../components/ToolbarImportExcel";
|
import { formatDate, setformOptionsNewValue } from '../../../util/tools'
|
import { isShowOperatorButtonCommon, isNeedShowOperatorColumn, isMobile } from '../../../util/common'
|
|
|
export default {
|
components: { Toolbar, SearchForm, ToolbarExport,ToolbarImportExcel },//×¢²á×Ó×é¼þ
|
data () {
|
return {
|
//µ¼ÈëExcelÊý¾ÝÏà¹Ø
|
emport_templeteFileDownName: '$emport_templeteFileDownName$.xlsx',//ÎļþÏÂÔØÃû×Ö
|
emport_excelCategroy: "$emport_excelCategroy$",//ÉÏ´«ÎļþµÄÇëÇó·ÖÀà
|
//µ¼³ö×é¼þÏà¹Ø
|
export_exportFileName: '$ChinaComment$ÐÅÏ¢',//Òªµ¼³öµÄÎļþÃû
|
export_currentPageData: [],//µ±Ç°Ò³ÃæµÄÁбíÊý¾Ý
|
export_columnHeader: {$VueExportColumnHeaderStr$},//µ±Ç°Ò³ÃæÁбíµÄ±íÍ·ºº×ÖºÍÊôÐÔÊý×飬µ¼³öÓÃ
|
|
//ËÑË÷¿òÏà¹Ø
|
c_commonSearchOptionSet: "Ä£ºý",//ͨÓòéѯµÄĬÈÏÅäÖÃ,"Ä£ºý"»ò"¾«×¼"
|
c_searchValControlStyle: {//ÉèÖÃͨÓÃËÑË÷¿òµÄ³¤¶ÈµÈÑùʽ
|
width: '300px',
|
},
|
c_searchFormInputPlaceholder: 'ÇëÊäÈë$SearchFormInputPlaceholderStr$',//Òª¸ø×ÓËÑË÷×é¼þ´«µÝµÄÖµ
|
c_searchFormInputAttrs: [$SearchFormInputPlaceholderNameStr$],//Òª¸ø×ÓËÑË÷×é¼þ´«µÝµÄÊôÐÔÃû
|
h_controlStyle: {//ÉèÖø߼¶ËÑË÷¿Ø¼þµÄ³¤¶ÈµÈÑùʽ
|
width: '350px',
|
},
|
h_labelWidth: "100px",//ÏÔʾLabelµÄ¿í¶È
|
h_drawerSize: "600px",//drawner¿í¶ÈÉèÖÃ
|
h_formOptions: [
|
$FormOptionsStr$
|
],
|
|
isShowOperatorColumn: true,// ÊÇ·ñÏÔʾ¡¾²Ù×÷¡¿ÁÐ,trueÏÔʾ false²»ÏÔʾ
|
tableHeight: window.innerHeight - 180, // ¿ØÖƱí¸ñµÄ¸ß¶È
|
|
isAdd: false, // ÊÇ·ñÊÇÐÂÔö
|
dialogTitle: '',
|
|
//²é¿´ÓйØ
|
viewDetailVisible: false,
|
viewDetailForm: {},
|
|
filters: {
|
name: ''
|
},
|
$Modulelogo$s: [],
|
total: 0,
|
buttonList: [],
|
currentRow: null,
|
page: 1,
|
pageSize: 10,
|
listLoading: false,
|
sels: [],//ÁбíÑ¡ÖÐÁÐ
|
|
addFormVisible: false,//ÐÂÔö½çÃæÊÇ·ñÏÔʾ
|
addLoading: false,
|
//ÐÂÔö»ò±à¼½çÃæÊý¾Ý
|
addForm: {
|
//×¢Ò⣺ÕâÀï²»ÐèҪд³õʼֵ£¬³õʼֵ¶¼Ð´ÔÚ init_addFormÖÐ
|
},
|
init_addForm: {
|
//×¢Ò⣺ÕâÀïд³õʼֵ
|
}
|
}
|
},
|
methods: {
|
//ÊÇ·ñÏÔʾij¸ö²Ù×÷°´Å¥
|
isShowOperatorButton (flag) {
|
return isShowOperatorButtonCommon(this.isShowOperatorColumn, flag, this.buttonList)
|
},
|
// ÉèÖÃË÷Òý
|
indexMethod (index) {
|
return (this.page - 1) * this.pageSize + 1 + index
|
},
|
// ʱ¼ä¸ñʽ»¯
|
formatterDateTime (row, column, cellValue, index) {
|
if (cellValue === null || cellValue === '') {
|
return ''
|
}
|
var NewDtime = new Date(Date.parse(cellValue))
|
return formatDate(NewDtime, 'yyyy-MM-dd hh:mm:ss')
|
},
|
selectCurrentRow (val) {
|
this.currentRow = val;
|
},
|
callFunction (item) {
|
this.filters = {
|
name: item.search
|
};
|
this[item.Func].apply(this, item);
|
},
|
handleCurrentChange (val) {
|
this.page = val;
|
this.get$Modulelogo$s();
|
},
|
handleSizeChange (val) {
|
this.pageSize = val;
|
this.get$Modulelogo$s();
|
},
|
/**
|
* »ñÈ¡ÇëÇó²ÎÊý
|
* flag:±ê¼Ç£¬1´ú±íÆÕͨ·ÖÒ³²éѯ£¬2´ú±í²»·ÖÒ³£¬»ñȡȫ²¿Êý¾Ý
|
*/
|
getPostParam (flag) {
|
let para = Object.assign({}, this.$refs.ChildSearchForm.getFormData());
|
para.page = this.page
|
para.pageSize = this.pageSize
|
if (flag === '2') { // È«²¿µ¼³ö
|
para.page = 1
|
para.pageSize = 10000
|
}
|
return para
|
},
|
//µã»÷°´Å¥¡¾²éѯ¡¿
|
_get$Modulelogo$s () {
|
this.page = 1
|
this.get$Modulelogo$s()
|
},
|
//»ñÈ¡Áбí
|
get$Modulelogo$s (formValue) {
|
//this.total = 0
|
//this.$Modulelogo$s = null
|
let para = this.getPostParam('1');
|
this.listLoading = true;
|
get$Modulelogo$ListPage(para).then((res) => {
|
if (res.data.success) {
|
this.total = res.data.response.dataCount;
|
this.$Modulelogo$s = res.data.response.data;
|
} else {
|
this.$message({
|
message: res.data.msg,
|
type: 'error'
|
});
|
}
|
this.listLoading = false;
|
});
|
},
|
//»ñȡȫ²¿Áбí
|
exportAllData () {
|
let para = this.getPostParam('2');
|
this.listLoading = true;
|
get$Modulelogo$ListPage(para).then((res) => {
|
var allData = res.data.response.data;
|
this.$refs.cmToolbarExport.export2Excel(allData);
|
this.listLoading = false;
|
});
|
},
|
//ɾ³ý
|
handleDel (selRow) {
|
let row = {};
|
if (selRow && selRow != undefined) {
|
this.currentRow = selRow;
|
}
|
row = this.currentRow;
|
if (!row) {
|
this.$message({
|
message: "ÇëÑ¡ÔñҪɾ³ýµÄÒ»ÐÐÊý¾Ý£¡",
|
type: "warning"
|
});
|
return;
|
}
|
this.$confirm('È·ÈÏɾ³ý¸Ã¼Ç¼Âð?', 'Ìáʾ', {
|
type: 'warning'
|
}).then(() => {
|
this.listLoading = true;
|
let para = { id: row.Id };
|
remove$Modulelogo$(para).then((res) => {
|
|
if (util.isEmt.format(res)) {
|
this.listLoading = false;
|
return;
|
}
|
this.listLoading = false;
|
if (res.data.success) {
|
this.$message({
|
message: 'ɾ³ý³É¹¦',
|
type: 'success'
|
});
|
|
} else {
|
this.$message({
|
message: res.data.msg,
|
type: 'error'
|
});
|
}
|
|
this._get$Modulelogo$s();
|
});
|
}).catch(() => {
|
|
});
|
},
|
//ÏÔʾ±à¼½çÃæ
|
handleEdit (selRow) {
|
let row = {};
|
if (selRow && selRow != undefined) {
|
this.currentRow = selRow;
|
}
|
row = this.currentRow;
|
if (!row) {
|
this.$message({
|
message: "ÇëÑ¡ÔñÒª±à¼µÄÒ»ÐÐÊý¾Ý£¡",
|
type: "warning"
|
});
|
|
return;
|
}
|
this.isAdd = false
|
this.dialogTitle = '±à¼'
|
this.addFormVisible = true;
|
this.addForm = Object.assign({}, row);
|
},
|
//ÏÔʾÐÂÔö½çÃæ
|
handleAdd () {
|
this.isAdd = true
|
this.dialogTitle = 'ÐÂÔö'
|
this.addFormVisible = true;
|
this.setInitAddForm()
|
},
|
//È¡ÏûÌá½»Êý¾Ý²Ù×÷
|
cancelHandle (done) {
|
this.setInitAddForm()
|
this.addFormVisible = false
|
|
done() //done ÓÃÓÚ¹Ø±Õ Dialog
|
},
|
// Ìá½»Êý¾Ý
|
submitDataHandle (formName) {
|
this.submitDisabled = true
|
|
this.$refs.addForm.validate((valid) => {
|
if (valid) {
|
this.$confirm('È·ÈÏÌá½»Âð£¿', 'Ìáʾ', {}).then(() => {
|
this.addLoading = true;
|
let para = Object.assign({}, this.addForm);
|
if (this.isAdd) {//ÐÂÔö
|
add$Modulelogo$(para).then((res) => {
|
if (util.isEmt.format(res)) {
|
this.addLoading = false;
|
return;
|
}
|
|
if (res.data.success) {
|
this.addLoading = false;
|
this.$message({
|
message: res.data.msg,
|
type: 'success'
|
});
|
this.$refs['addForm'].resetFields();
|
this.addFormVisible = false;
|
this._get$Modulelogo$s();
|
}
|
else {
|
this.addLoading = false;
|
this.$message({
|
message: res.data.msg,
|
type: 'error'
|
});
|
}
|
|
});
|
} else {//±à¼
|
edit$Modulelogo$(para).then((res) => {
|
if (util.isEmt.format(res)) {
|
this.addLoading = false;
|
return;
|
}
|
if (res.data.success) {
|
this.addLoading = false;
|
//NProgress.done();
|
this.$message({
|
message: res.data.msg,
|
type: 'success'
|
});
|
this.$refs['addForm'].resetFields();
|
this.addFormVisible = false;
|
this._get$Modulelogo$s();
|
}
|
else {
|
this.addLoading = false;
|
this.$message({
|
message: res.data.msg,
|
type: 'error'
|
});
|
}
|
});
|
}
|
});
|
}
|
});
|
},
|
selsChange: function (sels) {
|
this.sels = sels;
|
},
|
//µ¼³ö
|
handleExport () {
|
this.export_currentPageData = this.$Modulelogo$s
|
this.$refs.cmToolbarExport.showPrintPage()
|
},
|
//µ¼Èë
|
handleImport () {
|
this.$refs.tbImportExcel.showPage()
|
},
|
/******************************************[²é¿´½çÃæ]¿ªÊ¼*********************************************************** */
|
//ÏÔʾ²é¿´½çÃæ
|
handleView (selRow) {
|
let row = {};
|
if (selRow && selRow != undefined) {
|
this.currentRow = selRow;
|
}
|
row = this.currentRow;
|
if (!row) {
|
this.$message({
|
message: "ÇëÑ¡ÔñÒª²é¿´µÄÒ»ÐÐÊý¾Ý£¡",
|
type: "warning"
|
});
|
return;
|
}
|
this.viewDetailVisible = true
|
this.viewDetailForm = {
|
};
|
this.viewDetailForm = Object.assign({}, row);
|
},
|
//¹Ø±Õ²é¿´½çÃæ
|
closeViewHandle () {
|
this.viewDetailVisible = false
|
},
|
/******************************************[²é¿´½çÃæ]½áÊø*********************************************************** */
|
//addForm¸³³õʼֵ
|
setInitAddForm () {
|
this.addForm = Object.assign({}, this.init_addForm)
|
}
|
},
|
mounted () {
|
if (isMobile()) {
|
this.h_drawerSize = "99%"//drawner¿í¶ÈÉèÖÃ
|
} else {
|
this.h_drawerSize = "600px"//drawner¿í¶ÈÉèÖÃ
|
}
|
this.setInitAddForm()
|
this._get$Modulelogo$s();
|
|
let routers = window.localStorage.router
|
? JSON.parse(window.localStorage.router)
|
: [];
|
this.buttonList = getButtonList(this.$route.path, routers);
|
let isShow = isNeedShowOperatorColumn(this.buttonList);//¿ØÖÆÊÇ·ñÒªÏÔʾ¡¾²Ù×÷¡¿ÁÐ
|
this.isShowOperatorColumn = isShow;
|
}
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
</style>
|