|
@@ -0,0 +1,541 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud :option="option"
|
|
|
+ :table-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ :page.sync="page"
|
|
|
+ :permission="permissionList"
|
|
|
+ :before-open="beforeOpen"
|
|
|
+ v-model="form"
|
|
|
+ ref="crud"
|
|
|
+ id="out-table"
|
|
|
+ :header-cell-class-name="headerClassName"
|
|
|
+ @row-update="rowUpdate"
|
|
|
+ @row-save="rowSave"
|
|
|
+ @row-del="rowDel"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 325)"
|
|
|
+ @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 325)"
|
|
|
+ @on-load="onLoad">
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button type="success"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ plain
|
|
|
+ @click="addfun">新建
|
|
|
+ </el-button>
|
|
|
+ <el-button type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ @click="handleDelete">删 除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot="corpCnNameForm">
|
|
|
+ <search-query :datalist="corpData"
|
|
|
+ :selectValue="form.corpCnName"
|
|
|
+ :clearable="true"
|
|
|
+ :filterable="true"
|
|
|
+ :remote="true"
|
|
|
+ :buttonIf="false"
|
|
|
+ :forParameter="{ key:'id', label:'cnName', value:'cnName'}"
|
|
|
+ @corpChange="corpChange($event,'corpCnName')"
|
|
|
+ @remoteMethod="corpBcorpsListfun"
|
|
|
+ @corpFocus="corpBcorpsListfun" >
|
|
|
+ </search-query>
|
|
|
+ </template>
|
|
|
+ <template slot="addressForm">
|
|
|
+ <el-button type="success"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ plain
|
|
|
+ @click="ressButton" >发送
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot="userlistForm">
|
|
|
+ <search-query :datalist="userData"
|
|
|
+ :selectValue="form.userlist"
|
|
|
+ :clearable="true"
|
|
|
+ :multiple="true"
|
|
|
+ :collapseTags="false"
|
|
|
+ :buttonIf="false"
|
|
|
+ :forParameter="{ key:'id', label:'roleName', value:'id'}"
|
|
|
+ @corpChange="corpChange($event,'userlist')"
|
|
|
+ @corpFocus="getRoleListfun" >
|
|
|
+ </search-query>
|
|
|
+ </template>
|
|
|
+ <template slot="menu" slot-scope="{row}">
|
|
|
+ <el-button type="text"
|
|
|
+ size="small"
|
|
|
+ @click="editFun(row)">编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text"
|
|
|
+ size="small"
|
|
|
+ @click="rowDel(row)">删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ </basic-container>
|
|
|
+ <el-dialog title="title" :visible.sync="ressVisible" width="70%" top="5vh" append-to-body
|
|
|
+ class="el-dialogDeep" :close-on-click-modal="false" v-dialog-drag>
|
|
|
+ <div>
|
|
|
+ <avue-crud :option="ressOption" :data="tableData"
|
|
|
+ id="out-table"
|
|
|
+ :header-cell-class-name="headerClassName"
|
|
|
+ @row-update="ressRowupdate"
|
|
|
+ @row-save="ressRowsave" ></avue-crud>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="ressVisible = false;form.address = JSON.stringify(tableData)">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="ressVisible = false;form.address = JSON.stringify(tableData)">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {editypesList, editypesDetail, editypesSubmit, editypesRemove} from "@/api/iosBasicData/editypes";
|
|
|
+ import {mapGetters} from "vuex";
|
|
|
+ import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
|
|
|
+ import {getBcorpslistByType} from "@/api/iosBasicData/bcorps";
|
|
|
+ import {getList as getRoleList} from "@/api/system/role"
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: {SearchQuery},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ userlist:[],
|
|
|
+ },
|
|
|
+ query: {},
|
|
|
+ loading: true,
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ selectionList: [],
|
|
|
+ option:{},
|
|
|
+ optionBack: {
|
|
|
+ height:'auto',
|
|
|
+ calcHeight: 30,
|
|
|
+ tip: false,
|
|
|
+ searchShow: true,
|
|
|
+ searchMenuSpan: 6,
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ viewBtn: true,
|
|
|
+ selection: true,
|
|
|
+ dialogClickModal: false,
|
|
|
+ menuWidth:140,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "edi编码",
|
|
|
+ prop: "code",
|
|
|
+ overHidden:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入edi 编码,唯一",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "edi名称",
|
|
|
+ prop: "cnName",
|
|
|
+ overHidden:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入edi 中文名称",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "edi英文",
|
|
|
+ prop: "enName",
|
|
|
+ overHidden:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入edi 英文名称",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "客户名称",
|
|
|
+ prop: "corpCnName",
|
|
|
+ overHidden:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入客户 id",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "客户英文名称",
|
|
|
+ prop: "corpEnName",
|
|
|
+ display:false,
|
|
|
+ overHidden:true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "发送ftp/邮件",
|
|
|
+ prop: "address",
|
|
|
+ overHidden:true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "权限用户",
|
|
|
+ prop: "userlist",
|
|
|
+ overHidden:true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "状态",
|
|
|
+ prop: "status",
|
|
|
+ overHidden:true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建人",
|
|
|
+ prop: "createUserName",
|
|
|
+ overHidden:true,
|
|
|
+ display:false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建部门",
|
|
|
+ prop: "createDeptName",
|
|
|
+ overHidden:true,
|
|
|
+ display:false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建时间",
|
|
|
+ prop: "createTime",
|
|
|
+ overHidden:true,
|
|
|
+ display:false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "修改人",
|
|
|
+ prop: "updateUserName",
|
|
|
+ overHidden:true,
|
|
|
+ display:false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "修改时间",
|
|
|
+ prop: "updateTime",
|
|
|
+ overHidden:true,
|
|
|
+ display:false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remarks",
|
|
|
+ overHidden:true,
|
|
|
+ type: "textarea",
|
|
|
+ minRows: 3,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ data: [],
|
|
|
+ corpData:[], // 客户下拉数据
|
|
|
+ userData:[], // 权限用户数据
|
|
|
+ ressVisible:false, // 弹窗
|
|
|
+ tableData:[], // 弹窗表格
|
|
|
+ // 弹窗表格的配置
|
|
|
+ ressOption:{
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ refreshBtn:false,
|
|
|
+ columnBtn:false,
|
|
|
+ addBtn:false,
|
|
|
+ addRowBtn:true,
|
|
|
+ cellBtn:true,
|
|
|
+ rowKey:'$index',
|
|
|
+ menuWidth:140,
|
|
|
+ column:[{
|
|
|
+ label:'title',
|
|
|
+ prop: 'title',
|
|
|
+ cell: true,
|
|
|
+ },{
|
|
|
+ label:'mode',
|
|
|
+ prop: 'mode',
|
|
|
+ cell: true,
|
|
|
+ type: "select",
|
|
|
+ dicData: [
|
|
|
+ {
|
|
|
+ label:'ftp',
|
|
|
+ value:'ftp'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'email',
|
|
|
+ value:'email'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },{
|
|
|
+ label:'address',
|
|
|
+ prop: 'address',
|
|
|
+ cell: true,
|
|
|
+ },{
|
|
|
+ label:'host',
|
|
|
+ prop: 'host',
|
|
|
+ cell: true,
|
|
|
+ },{
|
|
|
+ label:'userName',
|
|
|
+ prop: 'userName',
|
|
|
+ cell: true,
|
|
|
+ },{
|
|
|
+ label:'password',
|
|
|
+ prop: 'password',
|
|
|
+ cell: true,
|
|
|
+ },{
|
|
|
+ label:'path',
|
|
|
+ prop: 'path',
|
|
|
+ cell: true,
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["permission"]),
|
|
|
+ permissionList() {
|
|
|
+ return {
|
|
|
+ addBtn: this.vaildData(this.permission.editypes_add, false),
|
|
|
+ viewBtn: this.vaildData(this.permission.editypes_view, false),
|
|
|
+ delBtn: this.vaildData(this.permission.editypes_delete, false),
|
|
|
+ editBtn: this.vaildData(this.permission.editypes_edit, false)
|
|
|
+ };
|
|
|
+ },
|
|
|
+ ids() {
|
|
|
+ let ids = [];
|
|
|
+ this.selectionList.forEach(ele => {
|
|
|
+ ids.push(ele.id);
|
|
|
+ });
|
|
|
+ return ids.join(",");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ this.option = await this.getColumnData(this.getColumnName(325), this.optionBack);
|
|
|
+ this.getRoleListfun()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 添加
|
|
|
+ addfun(){
|
|
|
+ this.$refs.crud.rowAdd()
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ editFun(row){
|
|
|
+ this.$refs.crud.rowEdit(row,row.$index)
|
|
|
+ },
|
|
|
+ // 下拉回调
|
|
|
+ corpChange(value,name){
|
|
|
+ if (name == 'corpCnName') {
|
|
|
+ for (let item of this.corpData) {
|
|
|
+ if (item.cnName == value) {
|
|
|
+ this.$set(this.form,'corpId',item.id)
|
|
|
+ this.$set(this.form,'corpCnName',item.cnName)
|
|
|
+ this.$set(this.form,'corpEnName',item.enName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ this.$set(this.form,name,value)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 获取结算单位数据
|
|
|
+ corpBcorpsListfun(cnName){
|
|
|
+ getBcorpslistByType(1,10,{cnName}).then(res=>{
|
|
|
+ this.corpData = res.data.data.records
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取权限用户数据
|
|
|
+ getRoleListfun(){
|
|
|
+ getRoleList(1,50,).then(res=>{
|
|
|
+ this.userData = res.data.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击弹出表格
|
|
|
+ ressButton(){
|
|
|
+ this.tableData = JSON.parse(this.form.address?this.form.address:'[]')
|
|
|
+ this.ressVisible = true
|
|
|
+ },
|
|
|
+ // 弹窗表格的添加保存
|
|
|
+ ressRowsave(row,done,loading){
|
|
|
+ done(row)
|
|
|
+ },
|
|
|
+ // 弹窗表格的修改保存
|
|
|
+ ressRowupdate(row,index,done,loading){
|
|
|
+ done(row)
|
|
|
+ },
|
|
|
+ // 新增
|
|
|
+ rowSave(row, done, loading) {
|
|
|
+ console.log(row,237)
|
|
|
+ row.userlist = JSON.stringify(row.userlist)
|
|
|
+ editypesSubmit(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ window.console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
+ row.userlist = JSON.stringify(row.userlist)
|
|
|
+ editypesSubmit(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowDel(row) {
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return editypesRemove(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleDelete() {
|
|
|
+ if (this.selectionList.length === 0) {
|
|
|
+ this.$message.warning("请选择至少一条数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return editypesRemove(this.ids);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ this.$refs.crud.toggleSelection();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeOpen(done, type) {
|
|
|
+ if (["edit", "view"].includes(type)) {
|
|
|
+ editypesDetail(this.form.id).then(res => {
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.form.userlist = JSON.parse(this.form.userlist)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ searchReset() {
|
|
|
+ this.query = {};
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
+ searchChange(params, done) {
|
|
|
+ this.query = params;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page, params);
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ selectionChange(list) {
|
|
|
+ this.selectionList = list;
|
|
|
+ },
|
|
|
+ selectionClear() {
|
|
|
+ this.selectionList = [];
|
|
|
+ this.$refs.crud.toggleSelection();
|
|
|
+ },
|
|
|
+ currentChange(currentPage){
|
|
|
+ this.page.currentPage = currentPage;
|
|
|
+ },
|
|
|
+ sizeChange(pageSize){
|
|
|
+ this.page.pageSize = pageSize;
|
|
|
+ },
|
|
|
+ refreshChange() {
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
+ },
|
|
|
+ onLoad(page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ editypesList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.data = data.records;
|
|
|
+ this.loading = false;
|
|
|
+ this.selectionClear();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //自定义列保存
|
|
|
+ async saveColumnTwo(ref, option, optionBack, code) {
|
|
|
+ /**
|
|
|
+ * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
|
|
|
+ * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
|
|
|
+ * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
|
|
|
+ */
|
|
|
+ const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //自定义列重置
|
|
|
+ async resetColumnTwo(ref, option, optionBack, code) {
|
|
|
+ this[option] = this[optionBack];
|
|
|
+ const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("重置成功");
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 更改表格颜色
|
|
|
+ headerClassName(tab) {
|
|
|
+ //颜色间隔
|
|
|
+ let back = ""
|
|
|
+ if (tab.columnIndex >= 0 && tab.column.level === 1) {
|
|
|
+ if (tab.columnIndex % 2 === 0) {
|
|
|
+ back = "back-one"
|
|
|
+ } else if (tab.columnIndex % 2 === 1) {
|
|
|
+ back = "back-two"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return back;
|
|
|
+ },
|
|
|
+ // 表头样式
|
|
|
+ tableHeaderCellStyle({row,column,rowIndex, columnIndex}){
|
|
|
+ return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff"
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+::v-deep#out-table .back-one {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+}
|
|
|
+::v-deep#out-table .back-two {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+}
|
|
|
+</style>
|