Showing
6 changed files
with
636 additions
and
0 deletions
This diff is collapsed. Click to expand it.
| 1 | +import { debounce } from "@/utils"; | ||
| 2 | +export default { | ||
| 3 | + data() { | ||
| 4 | + return { | ||
| 5 | + ursaError: "", // URSA包含校验提示语 | ||
| 6 | + notUrsaError: "", // URSA不包含校验提示语 | ||
| 7 | + validateForm: true, // form表单节流阀 | ||
| 8 | + }; | ||
| 9 | + }, | ||
| 10 | + directives: { | ||
| 11 | + // 处理加减天数 | ||
| 12 | + "input-filter": { | ||
| 13 | + bind: function (el, binding, { context }) { | ||
| 14 | + el.handler = function (event) { | ||
| 15 | + context.calculateDay(event); | ||
| 16 | + }; | ||
| 17 | + el.addEventListener("input", el.handler); | ||
| 18 | + }, | ||
| 19 | + unbind: function (el) { | ||
| 20 | + el.removeEventListener("input", el.handler); | ||
| 21 | + }, | ||
| 22 | + }, | ||
| 23 | + }, | ||
| 24 | + methods: { | ||
| 25 | + // 防抖函数处理加减天数校验 | ||
| 26 | + calculateDay: debounce(function (...args) { | ||
| 27 | + // 判断有没有值 | ||
| 28 | + if (args.length) { | ||
| 29 | + // 判断传过来的是不是一个对象 | ||
| 30 | + const { target } = args[0]; | ||
| 31 | + // 是不是一个数字 | ||
| 32 | + if (isNaN(Number(target.value))) { | ||
| 33 | + this.msgError("请输入有效数字"); | ||
| 34 | + target.value = ""; | ||
| 35 | + } else { | ||
| 36 | + // // 非数字时 | ||
| 37 | + // if (Number(target.value) < -7) { | ||
| 38 | + // this.msgError("加减天数最小不能大于7天"); | ||
| 39 | + // target.value = ""; | ||
| 40 | + // } else if (Number(target.value) > 7) { | ||
| 41 | + // this.msgError("加减天数最大不能大于7天"); | ||
| 42 | + // target.value = ""; | ||
| 43 | + // } | ||
| 44 | + if (/[\.]/.test(Number(target.value))) { | ||
| 45 | + // 浮点数时 | ||
| 46 | + this.msgError("加减天数只能为整数"); | ||
| 47 | + target.value = ""; | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + target.dispatchEvent(new Event("input")); | ||
| 51 | + } | ||
| 52 | + }, 800), | ||
| 53 | + // 获取字典 | ||
| 54 | + getObj({ serviceCode }) { | ||
| 55 | + let service_Code = []; | ||
| 56 | + serviceCode.map((item) => { | ||
| 57 | + service_Code.push(item.chineseName); | ||
| 58 | + }); | ||
| 59 | + this.serviceCodeData = service_Code; | ||
| 60 | + }, | ||
| 61 | + // 处理serviceCode包不包含 | ||
| 62 | + serviceCodeCofig() { | ||
| 63 | + let str = ""; | ||
| 64 | + if (this.isServiceCode == "1") { | ||
| 65 | + str = this.queryForm.includeServiceType.replace(/;|;/g, ","); | ||
| 66 | + } else { | ||
| 67 | + str = this.queryForm.notIncludeServiceType.replace(/;|;/g, ","); | ||
| 68 | + } | ||
| 69 | + let arr = str.split(","); | ||
| 70 | + if (arr[arr.length - 1] == "") { | ||
| 71 | + arr.splice(arr.length - 1, 1); | ||
| 72 | + } | ||
| 73 | + let noHasCode = this.serviceCodeData.filter( | ||
| 74 | + (v) => !arr.some((val) => val == v) | ||
| 75 | + ); | ||
| 76 | + let hasCode = this.serviceCodeData.filter((v) => | ||
| 77 | + arr.some((val) => val == v) | ||
| 78 | + ); | ||
| 79 | + let includeCode = arr.filter((v) => !hasCode.some((val) => val == v)); | ||
| 80 | + return { | ||
| 81 | + include: hasCode, | ||
| 82 | + noInclude: includeCode, | ||
| 83 | + }; | ||
| 84 | + }, | ||
| 85 | + // radio包含不包含serviceCode | ||
| 86 | + changeIsServiceCode(val) { | ||
| 87 | + // 勾选的时候去校验 || 输入的时候去校验 | ||
| 88 | + if (val == 1) { | ||
| 89 | + if (this.serviceCodeCofig().noInclude.length) { | ||
| 90 | + let tip = this.serviceCodeCofig().noInclude.toString(); | ||
| 91 | + // this.msgError(`${tip} 不包含`); | ||
| 92 | + } | ||
| 93 | + } else { | ||
| 94 | + if (this.serviceCodeCofig().include.length) { | ||
| 95 | + let tip = this.serviceCodeCofig().include.toString(); | ||
| 96 | + // this.msgError(`${tip} 已包含`); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + }, | ||
| 100 | + // serviceCode失焦事件 | ||
| 101 | + serviceCodeBlur() { | ||
| 102 | + if (this.isServiceCode == "1") { | ||
| 103 | + if (this.serviceCodeCofig().noInclude.length) { | ||
| 104 | + let tip = this.serviceCodeCofig().noInclude.toString(); | ||
| 105 | + // this.msgError(`${tip} 不包含`); | ||
| 106 | + } | ||
| 107 | + } else { | ||
| 108 | + if (this.serviceCodeCofig().include.length) { | ||
| 109 | + let tip = this.serviceCodeCofig().include.toString(); | ||
| 110 | + // this.msgError(`${tip} 已包含`); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + }, | ||
| 114 | + // Ursa校验 使用JavaScript写一个匹配字母的表达式 | ||
| 115 | + validateUrsa(ursaMark, ursa) { | ||
| 116 | + // 分隔字符串并且转数组&去除数组空字符串 | ||
| 117 | + let ursaList = ursa.split(";").filter((str) => str !== ""); | ||
| 118 | + // 是否有重复的 | ||
| 119 | + let repeat = new Set(ursaList).size !== ursaList.length; | ||
| 120 | + // 校验开头以字母或者数字开头下划线结尾的/^[a-zA-Z0-9]*_$/ 和 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/ | ||
| 121 | + let inUrsa = ursaList.every((item) => | ||
| 122 | + ursaMark ? /^[a-zA-Z0-9]*_$/.test(item) : /^[a-zA-Z0-9]*$/.test(item) | ||
| 123 | + ); | ||
| 124 | + const ursaInfo = { | ||
| 125 | + ursaMark: ursaMark, // Boolean ursa包含/不包含 | ||
| 126 | + ursa: ursaList, // ursa | ||
| 127 | + repeat: repeat, // Boolean 是否有重复的 | ||
| 128 | + inUrsa: inUrsa, // Boolean ursa校验 | ||
| 129 | + }; | ||
| 130 | + // ursa包含 | ||
| 131 | + if (ursaMark && ursaInfo.repeat) { | ||
| 132 | + this.ursaError = "填写的URSA已重复"; | ||
| 133 | + } | ||
| 134 | + if (ursaMark && !ursaInfo.inUrsa) { | ||
| 135 | + this.ursaError = "URSA包含之间用分号分隔,例:P2_;P3_;P_"; | ||
| 136 | + } | ||
| 137 | + if (ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { | ||
| 138 | + this.ursaError = ""; | ||
| 139 | + } | ||
| 140 | + // ursa不包含; | ||
| 141 | + if (!ursaMark && ursaInfo.repeat) { | ||
| 142 | + this.notUrsaError = "填写的URSA已重复"; | ||
| 143 | + } | ||
| 144 | + if (!ursaMark && !ursaInfo.inUrsa) { | ||
| 145 | + this.notUrsaError = "URSA不包含之间用分号分隔,例:P2;P3;P"; | ||
| 146 | + } | ||
| 147 | + if (!ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { | ||
| 148 | + this.notUrsaError = ""; | ||
| 149 | + } | ||
| 150 | + // 两则都为空时则校验通过 | ||
| 151 | + if ( | ||
| 152 | + (this.ursaError && this.notUrsaError) || | ||
| 153 | + this.ursaError || | ||
| 154 | + this.notUrsaError | ||
| 155 | + ) { | ||
| 156 | + this.validateForm = false; | ||
| 157 | + } else { | ||
| 158 | + this.validateForm = true; | ||
| 159 | + } | ||
| 160 | + }, | ||
| 161 | + // 包含 | ||
| 162 | + includeUrsa() { | ||
| 163 | + let { includeUrsa } = this.queryForm; | ||
| 164 | + this.validateUrsa(true, includeUrsa); | ||
| 165 | + }, | ||
| 166 | + // 不包含 | ||
| 167 | + notIncludeUrsa() { | ||
| 168 | + let { notIncludeUrsa } = this.queryForm; | ||
| 169 | + this.validateUrsa(false, notIncludeUrsa); | ||
| 170 | + }, | ||
| 171 | + }, | ||
| 172 | +}; |
| 1 | +export const tableAttr = { | ||
| 2 | + border: true, | ||
| 3 | + loadingTable: false, | ||
| 4 | + isDragSort: true, // 拖拽tableData数据一定要加id字段 | ||
| 5 | + maxHeight: 300, | ||
| 6 | + btnCofig: { | ||
| 7 | + isBtn: false, | ||
| 8 | + btnGroup: [ | ||
| 9 | + { | ||
| 10 | + type: "primary", | ||
| 11 | + icon: "el-icon-plus", | ||
| 12 | + btnName: "添加", | ||
| 13 | + size: "mini", | ||
| 14 | + round: false, | ||
| 15 | + loading: false, | ||
| 16 | + event: "add", | ||
| 17 | + }, | ||
| 18 | + ], | ||
| 19 | + }, | ||
| 20 | +}; |
| 1 | +export const formConfig = [ | ||
| 2 | + { | ||
| 3 | + label: "原航班", | ||
| 4 | + type: "Input", | ||
| 5 | + name: "originOfFlightNo", | ||
| 6 | + prop: "originOfFlightNo", | ||
| 7 | + placeholder: "请输入原航班号", | ||
| 8 | + span: 5, | ||
| 9 | + trigger: "blur", | ||
| 10 | + labelWidth: "55px", | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + label: "修改时间 从", | ||
| 14 | + type: "Date", | ||
| 15 | + name: "startTime", | ||
| 16 | + prop: "startTime", | ||
| 17 | + placeholder: "请选择开始时间", | ||
| 18 | + // rules: { required: true, message: "请选择开始时间", trigger: "blur" }, | ||
| 19 | + format: "yyyy-MM-dd", | ||
| 20 | + colWidth: "23%", | ||
| 21 | + inputWidth: "100%", | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + label: "到", | ||
| 25 | + type: "Date", | ||
| 26 | + name: "endTime", | ||
| 27 | + prop: "endTime", | ||
| 28 | + placeholder: "请选择结束时间", | ||
| 29 | + // rules: { required: true, message: "请选择结束时间", trigger: "blur" }, | ||
| 30 | + format: "yyyy-MM-dd", | ||
| 31 | + colWidth: "20%", | ||
| 32 | + labelWidth: "20px", | ||
| 33 | + inputWidth: "100%", | ||
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + label: "规则状态", | ||
| 37 | + type: "Select", | ||
| 38 | + name: "status", | ||
| 39 | + prop: "status", | ||
| 40 | + placeholder: "请选择状态", | ||
| 41 | + options: { | ||
| 42 | + data: [ | ||
| 43 | + { | ||
| 44 | + value: "1", | ||
| 45 | + label: "有效", | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + value: "0", | ||
| 49 | + label: "无效", | ||
| 50 | + }, | ||
| 51 | + ], | ||
| 52 | + }, | ||
| 53 | + colWidth: "18%", | ||
| 54 | + labelWidth: "70px", | ||
| 55 | + inputWidth: "100%", | ||
| 56 | + }, | ||
| 57 | +]; |
| 1 | +<template> | ||
| 2 | + <div ref="formHeaderRef" class="form-header container"> | ||
| 3 | + <el-row> | ||
| 4 | + <el-col> | ||
| 5 | + <yl-form | ||
| 6 | + ref="ruleForm" | ||
| 7 | + :formConfig="formConfig" | ||
| 8 | + :queryForm="queryForm" | ||
| 9 | + :inline="false" | ||
| 10 | + formWidth="auto" | ||
| 11 | + @blur="blurEvent" | ||
| 12 | + /> | ||
| 13 | + </el-col> | ||
| 14 | + </el-row> | ||
| 15 | + <yl-table | ||
| 16 | + ref="ylTable" | ||
| 17 | + :attrs="tableAttr" | ||
| 18 | + :loadingTable="tableAttr.loadingTable" | ||
| 19 | + :columns="columns" | ||
| 20 | + :tableData="tableData" | ||
| 21 | + :pageConfig="pageConfig" | ||
| 22 | + @sizeChange="handleSizeChange" | ||
| 23 | + @currentChange="handleCurrentChange" | ||
| 24 | + @search="searchBtn" | ||
| 25 | + @add="addBtn" | ||
| 26 | + > | ||
| 27 | + </yl-table> | ||
| 28 | + </div> | ||
| 29 | +</template> | ||
| 30 | +<script> | ||
| 31 | +import YlForm from "@/components/YlForm"; | ||
| 32 | +import YlTable from "@/components/YlTable"; | ||
| 33 | +import { formConfig } from "./formConfig"; | ||
| 34 | +import { tableAttr, columnHeader } from "./tableConfig"; | ||
| 35 | +import { restTableHeight } from "@/utils"; | ||
| 36 | +import { | ||
| 37 | + findAllEtesRules, // ET86查询 | ||
| 38 | + deleteEtesRuleById, // 删除 | ||
| 39 | +} from "@/api/et86"; | ||
| 40 | +import store from "@/store"; | ||
| 41 | +export default { | ||
| 42 | + name: "Et86RuleConfig", | ||
| 43 | + components: { | ||
| 44 | + YlForm, | ||
| 45 | + YlTable, | ||
| 46 | + }, | ||
| 47 | + data() { | ||
| 48 | + return { | ||
| 49 | + formConfig: formConfig, // 表单配置项 | ||
| 50 | + queryForm: { | ||
| 51 | + // 表单参数 | ||
| 52 | + status: "有效", | ||
| 53 | + }, | ||
| 54 | + pageConfig: { | ||
| 55 | + // 分页配置项 | ||
| 56 | + isPagination: true, | ||
| 57 | + total: 0, | ||
| 58 | + pageData: { | ||
| 59 | + page: 1, | ||
| 60 | + size: 10, | ||
| 61 | + }, | ||
| 62 | + }, | ||
| 63 | + tableAttr: tableAttr, // table配置项 | ||
| 64 | + columns: columnHeader( | ||
| 65 | + this.indexAdd, | ||
| 66 | + this.viewRow, | ||
| 67 | + this.editRow, | ||
| 68 | + this.deleteRow | ||
| 69 | + ), // 表头 | ||
| 70 | + tableData: [], // 表格数据 | ||
| 71 | + }; | ||
| 72 | + }, | ||
| 73 | + watch: { | ||
| 74 | + $route(to, from) { | ||
| 75 | + // 如果是从edit页面进入的Et86RuleConfig页面,那么删除Et86RuleConfig页面缓存 | ||
| 76 | + // store.dispatch("tagsView/delCachedView", to); // 删除当前路由组件Et86RuleConfig缓存 | ||
| 77 | + if (to.name == this.$options.name) { | ||
| 78 | + this.searchBtn(); | ||
| 79 | + } | ||
| 80 | + }, | ||
| 81 | + }, | ||
| 82 | + created() { | ||
| 83 | + // ET86查询 | ||
| 84 | + this.$nextTick(() => { | ||
| 85 | + this.searchBtn(); | ||
| 86 | + }); | ||
| 87 | + }, | ||
| 88 | + mounted() { | ||
| 89 | + this.$nextTick(() => { | ||
| 90 | + // window视口的高减去除了Table表格的高;将这个差的结果值作为设置Table的高; | ||
| 91 | + this.tableAttr.maxHeight = | ||
| 92 | + window.innerHeight - restTableHeight(this.$refs); | ||
| 93 | + }); | ||
| 94 | + }, | ||
| 95 | + computed: {}, | ||
| 96 | + methods: { | ||
| 97 | + // ET86查询 | ||
| 98 | + queryFindAllEtesRules() { | ||
| 99 | + const { page, size } = this.pageConfig.pageData; | ||
| 100 | + let params = { | ||
| 101 | + originOfFlightNo: this.queryForm.originOfFlightNo, | ||
| 102 | + updateTimeStart: this.queryForm.startTime | ||
| 103 | + ? this.queryForm.startTime | ||
| 104 | + : "", | ||
| 105 | + updateTimeEnd: this.queryForm.endTime ? this.queryForm.endTime : "", | ||
| 106 | + limitStart: (page - 1) * size, | ||
| 107 | + limitSize: size, | ||
| 108 | + status: this.queryForm.status, | ||
| 109 | + }; | ||
| 110 | + if (this.queryForm.status == "有效") { | ||
| 111 | + params.status = "1"; | ||
| 112 | + } | ||
| 113 | + this.tableAttr.loadingTable = true; | ||
| 114 | + findAllEtesRules(params) | ||
| 115 | + .then((res) => { | ||
| 116 | + this.tableAttr.loadingTable = false; | ||
| 117 | + const { code, data } = res; | ||
| 118 | + if (code == 200) { | ||
| 119 | + const valid = data.list.filter((item) => item.status == "1"); // 有效 | ||
| 120 | + const invalid = data.list.filter((item) => item.status == "0"); // 无效 | ||
| 121 | + this.tableData = valid.concat(invalid); | ||
| 122 | + this.pageConfig.total = data.total; | ||
| 123 | + } | ||
| 124 | + }) | ||
| 125 | + .catch(() => {}); | ||
| 126 | + }, | ||
| 127 | + // 失焦事件 | ||
| 128 | + blurEvent({ originOfFlightNo }) { | ||
| 129 | + this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo); | ||
| 130 | + }, | ||
| 131 | + // 搜索 | ||
| 132 | + searchBtn() { | ||
| 133 | + this.pageConfig.pageData.page = 1; | ||
| 134 | + this.pageConfig.pageData.size = 10; | ||
| 135 | + this.$refs.ruleForm.handleSearch("ruleForm", (val) => { | ||
| 136 | + this.queryFindAllEtesRules(); | ||
| 137 | + }); | ||
| 138 | + }, | ||
| 139 | + // 翻页序号递增 | ||
| 140 | + indexAdd(index) { | ||
| 141 | + const page = this.pageConfig.pageData.page; // 当前页码 | ||
| 142 | + const pagesize = this.pageConfig.pageData.size; // 每页条数 | ||
| 143 | + return index + 1 + (page - 1) * pagesize; | ||
| 144 | + }, | ||
| 145 | + //条数变化 | ||
| 146 | + handleSizeChange(e) { | ||
| 147 | + this.pageConfig.pageData.size = e; | ||
| 148 | + this.pageConfig.pageData.page = 1; | ||
| 149 | + this.queryFindAllEtesRules(); | ||
| 150 | + }, | ||
| 151 | + //页码变化 | ||
| 152 | + handleCurrentChange(e) { | ||
| 153 | + this.pageConfig.pageData.page = e; | ||
| 154 | + this.queryFindAllEtesRules(); | ||
| 155 | + }, | ||
| 156 | + // 添加 | ||
| 157 | + addBtn(item) { | ||
| 158 | + this.$router.push({ | ||
| 159 | + path: "/edit", | ||
| 160 | + query: { | ||
| 161 | + name: "add", | ||
| 162 | + }, | ||
| 163 | + }); | ||
| 164 | + }, | ||
| 165 | + // 重置表单 | ||
| 166 | + restForm() { | ||
| 167 | + this.$refs.ruleForm.resetFields("ruleForm"); | ||
| 168 | + }, | ||
| 169 | + // 查看 | ||
| 170 | + viewRow({ row }) { | ||
| 171 | + this.$router.push({ | ||
| 172 | + path: "/edit", | ||
| 173 | + query: { | ||
| 174 | + name: "view", | ||
| 175 | + id: row.id, | ||
| 176 | + status: row.status, | ||
| 177 | + }, | ||
| 178 | + }); | ||
| 179 | + }, | ||
| 180 | + // 编辑 | ||
| 181 | + editRow({ row }) { | ||
| 182 | + this.$router.push({ | ||
| 183 | + path: "/edit", | ||
| 184 | + query: { | ||
| 185 | + name: "edit", | ||
| 186 | + id: row.id, | ||
| 187 | + status: row.status, | ||
| 188 | + }, | ||
| 189 | + }); | ||
| 190 | + }, | ||
| 191 | + // 删除 | ||
| 192 | + deleteRow({ row }) { | ||
| 193 | + this.$confirm("是否确认删除? 删除后该规则设置为无效,不可恢复", "提示", { | ||
| 194 | + confirmButtonText: "确定", | ||
| 195 | + cancelButtonText: "取消", | ||
| 196 | + type: "warning", | ||
| 197 | + center: true, | ||
| 198 | + }) | ||
| 199 | + .then(() => { | ||
| 200 | + delete row.status; | ||
| 201 | + deleteEtesRuleById(row).then((res) => { | ||
| 202 | + const { code, msg } = res; | ||
| 203 | + if (code == 200) { | ||
| 204 | + this.searchBtn(); | ||
| 205 | + this.msgSuccess("删除成功!"); | ||
| 206 | + } else { | ||
| 207 | + this.msgError(msg || "删除失败"); | ||
| 208 | + } | ||
| 209 | + }); | ||
| 210 | + }) | ||
| 211 | + .catch(() => {}); | ||
| 212 | + }, | ||
| 213 | + }, | ||
| 214 | +}; | ||
| 215 | +</script> | ||
| 216 | +<style lang="scss" scoped></style> |
| 1 | +const state = { | ||
| 2 | + 1: "有效", | ||
| 3 | + 0: "无效", | ||
| 4 | +}; | ||
| 5 | +export const tableAttr = { | ||
| 6 | + border: true, | ||
| 7 | + loadingTable: false, | ||
| 8 | + isDragSort: false, // 拖拽tableData数据一定要加id字段 | ||
| 9 | + maxHeight: 0, | ||
| 10 | + // defaultSort: { prop: "updateTime", order: "descending" }, | ||
| 11 | + btnCofig: { | ||
| 12 | + isBtn: true, | ||
| 13 | + btnGroup: [ | ||
| 14 | + { | ||
| 15 | + type: "primary", // text、primary、danger | ||
| 16 | + icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right | ||
| 17 | + btnName: "搜索", | ||
| 18 | + size: "mini", // medium / small / mini | ||
| 19 | + round: false, | ||
| 20 | + loading: false, | ||
| 21 | + event: "search", | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + type: "primary", | ||
| 25 | + icon: "el-icon-plus", | ||
| 26 | + btnName: "添加", | ||
| 27 | + size: "mini", | ||
| 28 | + round: false, | ||
| 29 | + loading: false, | ||
| 30 | + event: "add", | ||
| 31 | + }, | ||
| 32 | + ], | ||
| 33 | + }, | ||
| 34 | +}; | ||
| 35 | +export const columnHeader = (indexAdd, viewRow, editRow, deleteRow) => [ | ||
| 36 | + { | ||
| 37 | + type: "index", | ||
| 38 | + label: "序号", | ||
| 39 | + prop: "id", | ||
| 40 | + align: "center", | ||
| 41 | + width: "50", | ||
| 42 | + index: indexAdd, | ||
| 43 | + }, | ||
| 44 | + { | ||
| 45 | + label: "原航班", | ||
| 46 | + prop: "originOfFlightNo", | ||
| 47 | + align: "center", | ||
| 48 | + minWidth: 80, | ||
| 49 | + }, | ||
| 50 | + { | ||
| 51 | + label: "配载航班", | ||
| 52 | + prop: "rankFltNoStr", | ||
| 53 | + align: "center", | ||
| 54 | + minWidth: 120, | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + label: "航线", | ||
| 58 | + prop: "rankFltRouteStr", | ||
| 59 | + align: "center", | ||
| 60 | + minWidth: 140, | ||
| 61 | + }, | ||
| 62 | + { | ||
| 63 | + label: "状态", | ||
| 64 | + prop: "status", | ||
| 65 | + align: "center", | ||
| 66 | + minWidth: 50, | ||
| 67 | + render: (h, params) => { | ||
| 68 | + const { row } = params; | ||
| 69 | + return h("div", `${state[row.status]}`); | ||
| 70 | + }, | ||
| 71 | + }, | ||
| 72 | + { | ||
| 73 | + label: "修改时间", | ||
| 74 | + prop: "updateTime", | ||
| 75 | + align: "center", | ||
| 76 | + minWidth: 80, | ||
| 77 | + // sortable: true, | ||
| 78 | + // "sort-method": (a, b) => a.createTime - b.createTime, | ||
| 79 | + }, | ||
| 80 | + { | ||
| 81 | + label: "修改人", | ||
| 82 | + prop: "updateUserName", | ||
| 83 | + align: "center", | ||
| 84 | + minWidth: 60, | ||
| 85 | + }, | ||
| 86 | + { | ||
| 87 | + label: "操作", | ||
| 88 | + prop: "operate", | ||
| 89 | + align: "center", | ||
| 90 | + minWidth: 90, | ||
| 91 | + fixed: "right", | ||
| 92 | + render: (h, params) => { | ||
| 93 | + let operateData = []; | ||
| 94 | + if (params.row.status == "1") { | ||
| 95 | + operateData = [ | ||
| 96 | + h( | ||
| 97 | + "el-button", | ||
| 98 | + { | ||
| 99 | + props: { | ||
| 100 | + type: "text", | ||
| 101 | + size: "mini", | ||
| 102 | + icon: "el-icon-view", | ||
| 103 | + }, | ||
| 104 | + on: { | ||
| 105 | + click() { | ||
| 106 | + viewRow(params); | ||
| 107 | + }, | ||
| 108 | + }, | ||
| 109 | + }, | ||
| 110 | + "查看" | ||
| 111 | + ), | ||
| 112 | + h( | ||
| 113 | + "el-button", | ||
| 114 | + { | ||
| 115 | + props: { | ||
| 116 | + type: "text", | ||
| 117 | + size: "mini", | ||
| 118 | + icon: "el-icon-edit", | ||
| 119 | + }, | ||
| 120 | + on: { | ||
| 121 | + click() { | ||
| 122 | + editRow(params); | ||
| 123 | + }, | ||
| 124 | + }, | ||
| 125 | + }, | ||
| 126 | + "修改" | ||
| 127 | + ), | ||
| 128 | + h( | ||
| 129 | + "el-button", | ||
| 130 | + { | ||
| 131 | + style: { | ||
| 132 | + color: "#ff4949", | ||
| 133 | + }, | ||
| 134 | + props: { | ||
| 135 | + type: "text", | ||
| 136 | + size: "mini", | ||
| 137 | + icon: "el-icon-delete", | ||
| 138 | + }, | ||
| 139 | + on: { | ||
| 140 | + click() { | ||
| 141 | + deleteRow(params); | ||
| 142 | + }, | ||
| 143 | + }, | ||
| 144 | + }, | ||
| 145 | + "删除" | ||
| 146 | + ), | ||
| 147 | + ]; | ||
| 148 | + } else { | ||
| 149 | + operateData = [ | ||
| 150 | + h( | ||
| 151 | + "el-button", | ||
| 152 | + { | ||
| 153 | + props: { | ||
| 154 | + type: "text", | ||
| 155 | + size: "mini", | ||
| 156 | + icon: "el-icon-view", | ||
| 157 | + }, | ||
| 158 | + on: { | ||
| 159 | + click() { | ||
| 160 | + viewRow(params); | ||
| 161 | + }, | ||
| 162 | + }, | ||
| 163 | + }, | ||
| 164 | + "查看" | ||
| 165 | + ), | ||
| 166 | + ]; | ||
| 167 | + } | ||
| 168 | + return h("div", operateData); | ||
| 169 | + }, | ||
| 170 | + }, | ||
| 171 | +]; |
-
Please register or login to post a comment