From 98a2b24c89e81a5aacdcbd6b739fef422adf17dd Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期五, 29 三月 2024 09:57:55 +0800 Subject: [PATCH] 代码更新 --- src/views/userManage/templateManage.vue | 439 ++++++++++++++++++------------------------------------ 1 files changed, 147 insertions(+), 292 deletions(-) diff --git a/src/views/userManage/templateManage.vue b/src/views/userManage/templateManage.vue index 1db8df8..a9971b7 100644 --- a/src/views/userManage/templateManage.vue +++ b/src/views/userManage/templateManage.vue @@ -1,33 +1,18 @@ <template> <div class="authorityManagement_box"> <My-bread :list="[ - `${$t('dataManage.dataManage')}`, - `${$t('dataManage.templateManage')}`, - ]"></My-bread> + `${$t('dataManage.dataManage')}`, + `${$t('dataManage.templateManage')}`, + ]"></My-bread> <el-divider /> - <div - class="searchComp subpage_Div" - ref="container" - > - <el-form - ref="ruleForm" - :model="ruleForm" - :inline="true" - > + <div class="searchComp subpage_Div" ref="container"> + <el-form ref="ruleForm" :model="ruleForm" :inline="true"> <div class="flex_box"> <div style="margin-right: auto"> <el-form-item :label="$t('userManage.authorityM.name')"> - <el-input - style="width:200px" - size="small" - v-model="ruleForm.name" - :placeholder="$t('userManage.authorityM.nameHolder')" - > - <i - slot="suffix" - class="el-icon-search" - @click="setRefreshTable" - ></i> + <el-input style="width:200px" size="small" v-model="ruleForm.name" + :placeholder="$t('userManage.authorityM.nameHolder')"> + <i slot="suffix" class="el-icon-search" @click="setRefreshTable"></i> </el-input> </el-form-item> </div> @@ -42,30 +27,17 @@ <!-- >{{ $t('common.iquery') }}</el-button>--> <!-- </el-form-item>--> <el-form-item> - <el-button - v-if="btnStatus.insert" - @click="setTableInsert" - icon="el-icon-edit" - type="success" - size="small" - >{{ $t('common.append') }}</el-button> + <el-button v-if="btnStatus.insert" @click="setTableInsert" icon="el-icon-edit" type="success" + size="small">{{ $t('common.append') }}</el-button> </el-form-item> <el-form-item> - <el-button - v-if="btnStatus.delete" - icon="el-icon-delete" - @click="delTableData" - type="danger" - size="small" - >{{ $t('common.delete') }}</el-button> + <el-button v-if="btnStatus.delete" icon="el-icon-delete" @click="delTableData" type="danger" + size="small">{{ + $t('common.delete') }}</el-button> </el-form-item> <el-form-item> - <el-button - icon="el-icon-refresh" - @click="restRefreshTable" - type="info" - size="small" - >{{ $t('common.empty') }}</el-button> + <el-button icon="el-icon-refresh" @click="restRefreshTable" type="info" size="small">{{ $t('common.empty') + }}</el-button> </el-form-item> </div> </div> @@ -73,49 +45,20 @@ </el-form> </div> <div class="dividing-line"></div> - <div - class="table_box" - :style="styleVar" - > - <el-table - :data="tableData" - style="width: 100%" - border - @selection-change="handleSelectionChange" - height="calc(100% - 45px)" - > - <el-table-column - type="selection" - width="55" - /> - <el-table-column - align="center" - type="index" - :label="$t('dataManage.styleObj.index')" - width="70px" - /> - <el-table-column - align="center" - prop="name" - :label="$t('dataManage.styleObj.name')" - /> - <el-table-column - align="center" - prop="type" - :label="$t('common.fileType')" - > + <div class="table_box" :style="styleVar"> + <el-table :data="tableData" style="width: 100%" border @selection-change="handleSelectionChange" + height="calc(100% - 45px)"> + <el-table-column type="selection" width="55" /> + <el-table-column align="center" type="index" :label="$t('dataManage.styleObj.index')" width="70px" /> + <el-table-column align="center" prop="name" :label="$t('dataManage.styleObj.name')" /> + <el-table-column align="center" prop="type" :label="$t('common.fileType')"> <template slot-scope="scope"> <span v-if="scope.row.type == 1">World妯℃澘 </span> <span v-else-if="scope.row.type == 2">Excel妯℃澘</span> <span v-else-if="scope.row.type == 3">Zip妯℃澘</span> </template> </el-table-column> - <el-table-column - align="center" - prop="code" - :label="$t('common.templateType')" - :formatter="codeData" - /> + <el-table-column align="center" prop="code" :label="$t('common.templateType')" :formatter="codeData" /> <!-- <el-table-column align="center" prop="fname" @@ -126,119 +69,55 @@ prop="bak" :label="$t('common.bak')" /> --> - <el-table-column - align="center" - prop="createName" - :label="$t('dataManage.vmobj.createonuser')" - /> - <el-table-column - align="center" - prop="createTime" - :label="$t('dataManage.vmobj.createontime')" - :formatter="formatData" - /> - <el-table-column - min-width="100" - :label="$t('dataManage.dictionaryManageObj.operation')" - > + <el-table-column align="center" prop="createName" :label="$t('dataManage.vmobj.createonuser')" /> + <el-table-column align="center" prop="createTime" :label="$t('dataManage.vmobj.createontime')" + :formatter="formatData" /> + <el-table-column min-width="100" :label="$t('dataManage.dictionaryManageObj.operation')"> + <template slot-scope="scope"> - <el-button - v-if="btnStatus.select" - @click="showDetail(scope.$index, scope.row)" - type="primary" - plain - size="small" - >{{ $t('dataManage.dictionaryManageObj.lookOver') }}</el-button> - <el-button - v-if="btnStatus.update" - @click="handleEdit(scope.$index, scope.row)" - type="warning" - plain - size="small" - >{{ $t('dataManage.dictionaryManageObj.revamp') }}</el-button> - <el-button - v-if="btnStatus.download" - plain - @click="handleDownload(scope.$index, scope.row)" - type="info" - size="small" - >{{ $t('common.download') }}</el-button> + <el-button v-if="btnStatus.select" @click="showDetail(scope.$index, scope.row)" type="primary" plain + size="small">{{ $t('dataManage.dictionaryManageObj.lookOver') }}</el-button> + <el-button v-if="btnStatus.update" @click="handleEdit(scope.$index, scope.row)" type="warning" plain + size="small">{{ $t('dataManage.dictionaryManageObj.revamp') }}</el-button> + <el-button v-if="btnStatus.download" plain @click="handleDownload(scope.$index, scope.row)" type="info" + size="small">{{ $t('common.download') }}</el-button> </template> </el-table-column> </el-table> <div style="margin-top:10px"> - <el-pagination - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - :current-page="listData.pageIndex" - :page-sizes="[10, 20, 50, 100]" - :page-size="listData.pageSize" - layout="total, sizes, prev, pager, next, jumper" - :total="listData.count" - > + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" + :current-page="listData.pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="listData.pageSize" + layout="total, sizes, prev, pager, next, jumper" :total="listData.count"> </el-pagination> </div> </div> <!-- 鏂板 --> - <el-dialog - :title=" - behavior == '鏂板' - ? `${$t('common.append')}` - : `${$t('common.update')}` - " - :visible.sync="dialogVisible" - :before-close="handleClose" - > + <el-dialog :title="behavior == '鏂板' + ? `${$t('common.append')}` + : `${$t('common.update')}` + " :visible.sync="dialogVisible" :before-close="handleClose"> <div style="height: 500px; overflow: auto"> - <el-form - ref="form" - :model="editForm" - label-width="100px" - label-position="top" - > + <el-form ref="form" :model="editForm" label-width="100px" label-position="top"> <el-form-item :label="$t('dataManage.styleObj.name')"> - <el-input - style="width:85%" - v-model=" editForm.name" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo')+$t('dataManage.styleObj.name')" - ></el-input> + <el-input style="width:85%" v-model="editForm.name" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo') + $t('dataManage.styleObj.name')"></el-input> </el-form-item> <el-form-item :label="$t('common.templateType')"> <!-- <el-input style="width:100%" v-model=" editForm.code" ></el-input> --> - <el-select - :popper-append-to-body="false" - style="width:85%" - @change="selFileCodeChange" + <el-select :popper-append-to-body="false" style="width:85%" @change="selFileCodeChange" v-model="editForm.code" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree')+$t('dataManage.common.templateType')" - - > - <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value" - > + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree') + $t('dataManage.common.templateType')"> + <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item :label="$t('common.fileType')"> - <el-select - :popper-append-to-body="false" - v-model="editForm.type" - @change="selFileTypeChange" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree')+$t('common.fileType')" - style="width:85%" - > - <el-option - v-for="item in typeOption" - :key="item.value" - :label="item.label" - :value="item.value" - > + <el-select :popper-append-to-body="false" v-model="editForm.type" @change="selFileTypeChange" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree') + $t('common.fileType')" style="width:85%"> + <el-option v-for="item in typeOption" :key="item.value" :label="item.label" :value="item.value"> </el-option> <!-- <el-option label="World妯℃澘" @@ -258,95 +137,38 @@ <el-form-item :label="$t('common.filePath')"> <div class="BoxFlex"> <div class="BoxFlexinput"> - <el-input - v-model="editForm.fname" - disabled - autocomplete="off" - style="width:100%" - ></el-input> + <el-input v-model="editForm.fname" disabled autocomplete="off" style="width:100%"></el-input> </div> <div class="BoxFlexbutton"> - <input - name="file1" - type="file" - id="editFile" - multiple="multiple" - :accept="selectFileType" - style="display: none" - @change="geteditFile(1)" - - /> - <el-button - style="margin-left: 6px;" - type="primary" - size="small" - :underline="false" - @click="geteditFile(0)" - >閫夋嫨</el-button> - <el-button - type="primary" - size="small" - :underline="false" - @click="geteditFile(2)" - >涓婁紶</el-button> + <input name="file1" type="file" id="editFile" multiple="multiple" :accept="selectFileType" + style="display: none" @change="geteditFile(1)" /> + <el-button style="margin-left: 6px;" type="primary" size="small" :underline="false" + @click="geteditFile(0)">閫夋嫨</el-button> + <el-button type="primary" size="small" :underline="false" @click="geteditFile(2)">涓婁紶</el-button> </div> </div> </el-form-item> <el-form-item :label="$t('common.bak')"> - <el-input - style="width:85%" - v-model="editForm.bak" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo')+$t('common.bak')" - ></el-input> + <el-input style="width:85%" v-model="editForm.bak" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo') + $t('common.bak')"></el-input> </el-form-item> </el-form> </div> - <div - v-if="behavior =='鏂板'" - slot="footer" - class="dialog-footer" - > - <el-button - size="small" - @click="closeInsertData" - >鍙� 娑�</el-button> - <el-button - type="primary" - size="small" - @click="addInsertData" - >纭� 瀹�</el-button> + <div v-if="behavior == '鏂板'" slot="footer" class="dialog-footer"> + <el-button size="small" @click="closeInsertData">鍙� 娑�</el-button> + <el-button type="primary" size="small" @click="addInsertData">纭� 瀹�</el-button> </div> - <div - v-if="behavior !='鏂板'" - slot="footer" - class="dialog-footer" - > - <el-button - size="small" - @click="closeEditData" - >鍙� 娑�</el-button> - <el-button - type="primary" - size="small" - @click="addEditData" - >纭� 瀹�</el-button> + <div v-if="behavior != '鏂板'" slot="footer" class="dialog-footer"> + <el-button size="small" @click="closeEditData">鍙� 娑�</el-button> + <el-button type="primary" size="small" @click="addEditData">纭� 瀹�</el-button> </div> </el-dialog> - <div - class="infoBox_box" - v-show="showinfoBox" - > + <div class="infoBox_box" v-show="showinfoBox"> <div class="infoBox subpage_Div box_div"> - <div - slot="header" - class="clearfix" - > + <div slot="header" class="clearfix"> <span>{{ $t('dataManage.styleObj.deInformation') }}</span> - <div - style="float: right; cursor: pointer" - @click="closeDetial" - > + <div style="float: right; cursor: pointer" @click="closeDetial"> <i class="el-icon-close"></i> </div> </div> @@ -403,11 +225,7 @@ </div> </div> - <iframe - id="downFrame" - src="" - style="display: none; border: 0; padding: 0; height: 0; width: 0" - ></iframe> + <iframe id="downFrame" src="" style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe> </div> </template> @@ -420,38 +238,14 @@ report_deletes, report_update, } from "../../api/api.js"; +import dataStatistics from '../../components/js/dataStatistics.js' import { getToken } from "@/utils/auth"; export default { name: "templateManage", components: { MyBread }, data() { return { - options: [ - { - value: "countSizes", - label: "鏁版嵁閲忕粺璁�", - }, - { - value: "countServices", - label: "鏈嶅姟璋冪敤閲忕粺璁�", - }, - { - value: "countOperates", - label: "鐢ㄦ埛娴侀噺缁熻", - }, - { - value: "dataTable", - label: "涓婁紶鏁版嵁琛ㄦ牸妯℃澘", - }, - { - value: "uploadDir", - label: "涓婁紶鐩綍缁撴瀯妯℃澘", - }, - { - value: "dirFolder", - label: "鐩綍缁撴瀯鏂囦欢澶规ā鏉�", - }, - ], + options: [], itemdetail: {}, showinfoBox: false, behavior: "鏂板", @@ -490,6 +284,7 @@ height: "calc(100% - 109px)", }, typeOption: [], + rowGuid: null, }; }, created() { @@ -501,6 +296,12 @@ window.removeEventListener("resize", this.onResize); }, mounted() { + + var obj = dataStatistics.statistics.filter(res => { + if (res.isMenu != false) + return res; + }) + this.options = obj window.addEventListener("resize", this.onResize); this.calHeight(); }, @@ -538,19 +339,19 @@ .catch((_) => { }); }, codeData(row, column) { - let data = row[column.property]; - if (data == null) { - return data; + + var code = row.code; + let val = this.options.filter(res => { + if (res.value == code) { + return res + } + }) + if (val.length > 0) { + return val[0].label + } else { + return code } - var val; - if (row.code.indexOf("countSizes") != -1) { - val = "鏁版嵁閲忕粺璁�"; - } else if (row.code.indexOf("countServices") != -1) { - val = "鏈嶅姟璋冪敤閲忕粺璁�"; - } else if (row.code.indexOf("countOperates") != -1) { - val = "鐢ㄦ埛娴侀噺缁熻"; - } - return val; + }, //鏌ョ湅 showDetail(index, row) { @@ -568,7 +369,10 @@ return res } }) - this.itemdetail.code = val[0].label; + if (val.length > 0 && val[0].label) { + this.itemdetail.code = val[0].label; + } + // if (row.code.indexOf("countSizes") != -1) { // this.itemdetail.code = "鏁版嵁閲忕粺璁�"; // } else if (row.code.indexOf("countServices") != -1) { @@ -602,6 +406,8 @@ }, //淇敼鎻愪氦 async addEditData() { + this.editForm.guid = this.rowGuid; + debugger const data = await report_update(this.editForm); if (data.code != 200) { return this.$message.error("淇敼澶辫触"); @@ -630,7 +436,7 @@ break; } } - + console.log(name) if (name.indexOf('缁熻') > -1) { this.typeOption = [{ label: "World妯℃澘", @@ -662,11 +468,38 @@ handleEdit(index, row) { this.behavior = "淇敼"; this.editForm = row; + + if (row.name.indexOf('缁熻') > -1) { + this.typeOption = [{ + label: "World妯℃澘", + value: "1" + }, { + label: "Excel妯℃澘", + value: "2" + }] + + } else { + this.typeOption = [{ + label: "World妯℃澘", + value: "1" + }, { + label: "Excel妯℃澘", + value: "2" + }, { + label: "Zip妯℃澘", + value: "3" + }] + } if (parseInt(row.type) == 1) { this.selectFileType = ".docx"; } else if (parseInt(row.type) == 2) { this.selectFileType = ".xlsx"; } + this.rowGuid = row.guid; + + + + this.dialogVisible = true; }, //鍒犻櫎 @@ -729,6 +562,7 @@ }, //鏂板涓�鏉℃暟鎹� async addInsertData() { + this.editForm.guid = this.rowGuid; const data = await report_insert(this.editForm); if (data.code != 200) { return this.$message.error("鏂板澶辫触"); @@ -755,10 +589,24 @@ }, //鏂囦欢涓婁紶 async geteditFile(res) { + + if (parseInt(this.editForm.type) == 1) { + this.selectFileType = ".docx"; + } else if (parseInt(this.editForm.type) == 2) { + this.selectFileType = ".xlsx"; + } + this.$nextTick(() => { + this.setEditFile(res) + }) + + }, + async setEditFile(res) { if (res == 0) { if (this.editForm.type == "") { return this.$message("璇烽�夋嫨涓婁紶鏂囦欢绫诲瀷"); } + + $("#editFile").click(); } else if (res == 1) { @@ -775,6 +623,7 @@ var val_data = await report_upload(formData); if (val_data.code == 200) { this.editForm.guid = val_data.result; + this.rowGuid = val_data.result; this.$message({ message: "涓婁紶鎴愬姛锛�", type: "success", @@ -817,7 +666,7 @@ }, editFormStart() { - this.editForm.code = "countSizes"; + this.editForm.code = "dataTable"; var name; for (var i in this.options) { if (this.options[i].value == this.editForm.code) { @@ -889,6 +738,7 @@ }, }; </script> + <style lang="less" scoped> //@import url(); 寮曞叆鍏叡css绫� .authorityManagement_box { @@ -911,10 +761,12 @@ .el-form-item { margin: 5px; } + .el-input { width: 467px; } } + .leftTree { position: absolute; z-index: 10; @@ -928,17 +780,21 @@ height: 550px; overflow: auto; } + .btnBox { width: 160px; margin: 10px auto 0; } } + .bottom { width: 100%; height: 85%; + .rightTable { height: 100%; width: 100%; + .table_box { width: 100%; height: 80%; @@ -949,4 +805,3 @@ } } </style> - -- Gitblit v1.9.3