Elements-SY

modify

import request from "@/utils/request";
// ET86查询
/**
* @param createTimeStart; 开始时间
* @param createTimeEnd; 结束时间
* @param status; 1-有效 0-无效 不传查全部
*/
export function findAllEtesRules(data) {
return request({
url: "/etes/findAllEtesRules",
method: "post",
data: data,
});
}
// ET86新增
export function add(data) {
return request({
url: "/etes/add",
method: "post",
data: data,
});
}
// ET86详情
export function findEtesRuleById(data) {
return request({
url: "/etes/findEtesRuleById",
method: "post",
data: data,
});
}
// ET86编辑
export function update(data) {
return request({
url: "/etes/update",
method: "post",
data: data,
});
}
// ET86删除
export function deleteEtesRuleById(data) {
return request({
url: "/etes/deleteEtesRuleById",
method: "post",
data: data,
});
}
......@@ -211,14 +211,3 @@ export function checkFlightRoute(data) {
})
}
//更新航线
/**
* @param id *
*/
export function updateRoute(id) {
return request({
url: `/dictionary/updateRoute/${id}`,
method: "post",
data: {},
});
}
......
<template>
<div
class="ylform"
:class="inline == true ? 'the-form' : ''"
:style="{ marginBottom: `${marginBottom}px` }"
>
<el-form
:model="tempQueryForm"
:inline="inline"
:label-position="position"
:label-width="formWidth"
:loading="loading"
ref="ruleForm"
:size="size"
>
<el-row
:gutter="rowGutter"
:type="rowType"
:justify="rowJustify"
:align="rowAlign"
:tag="rowTag"
>
<el-col
v-for="item in tempFormConfig"
:span="item.span"
:offset="item.offset"
:tag="item.tag"
:push="item.push"
:pull="item.pull"
:xs="item.xs"
:sm="item.sm"
:md="item.md"
:lg="item.lg"
:xl="item.xl"
:style="{ width: item.colWidth }"
:key="item.prop"
>
<el-form-item
:label="item.label"
:prop="item.prop"
:rules="item.rules"
:label-width="item.labelWidth"
>
<!-- 输入框 -->
<el-input
v-if="item.type === 'Input'"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:placeholder="
item.placeholder ? item.placeholder : '请输入' + item.label
"
v-on:[item.trigger]="
(e) => {
inputEvent(e, item);
}
"
@keyup.enter.native="toEnterSearch"
clearable
>
</el-input>
<template v-if="view">
<span v-text="tempQueryForm[item.prop]"></span>
</template>
<!-- 数字输入框 -->
<el-input
v-if="item.type === 'inputNumber'"
type="number"
:min="item.min"
:max="item.max"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:placeholder="
item.placeholder ? item.placeholder : '请输入' + item.label
"
v-on:keyup.enter="value = value.replace(/^-?[0-9]\d*$/, '')"
clearable
>
</el-input>
<!-- InputNumber 计数器 -->
<el-input-number
v-if="item.type === 'Number'"
v-model.trim="tempQueryForm[item.prop]"
:min="0"
:max="10"
:size="item.size"
:style="{ width: item.inputWidth }"
label="描述文字"
></el-input-number>
<template v-if="view">
<span v-text="tempQueryForm[item.prop]"></span>
</template>
<!-- 下拉选择 -->
<el-select
v-if="item.type === 'Select'"
:multiple="item.multiple"
:filterable="item.filterable"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:loading="searchLoading"
:placeholder="
item.placeholder ? item.placeholder : '请选择' + item.label
"
clearable
>
<el-option
v-for="op in item.options.data"
:label="op[item.options.label] || op.label"
:value="op[item.options.value] || op.value"
:key="op[item.options.value] || op.value"
>
</el-option>
</el-select>
<!-- 远程搜索 -->
<template v-if="item.type === 'Search'">
<el-autocomplete
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:debounce="1500"
:fetch-suggestions="querySearchAsync"
:placeholder="
item.placeholder ? item.placeholder : '请选择' + item.label
"
@focus="focusKey(item)"
@select="selectSearch"
clearable
></el-autocomplete>
</template>
<!-- 日期 -->
<el-date-picker
v-if="item.type === 'Date'"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:placeholder="item.placeholder ? item.placeholder : '请选择日期'"
:value-format="item.format"
clearable
>
</el-date-picker>
<!-- 时间 -->
<el-time-select
v-if="item.type === 'Time'"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:placeholder="item.placeholder ? item.placeholder : '请选择时间'"
clearable
>
</el-time-select>
<!-- 日期时间 -->
<el-date-picker
v-if="item.type === 'DateTime'"
type="datetime"
v-model.trim="tempQueryForm[item.prop]"
:disabled="item.disable"
:placeholder="item.placeholder ? item.placeholder : '请选择日期'"
clearable
>
</el-date-picker>
<!-- 日期范围 -->
<el-date-picker
v-if="item.type === 'datetimerange'"
type="datetimerange"
v-model.trim="tempQueryForm[item.prop]"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
clearable
>
</el-date-picker>
<!-- 单选框 普通的样式 Radio 的尺寸,仅在 border 为真时有效-->
<template v-if="item.type === 'radio'">
<el-radio
v-model.trim="tempQueryForm[item.prop]"
v-for="op in item.options.data"
:disabled="item.disable"
:border="tempQueryForm[item.border]"
:size="tempQueryForm[item.size]"
:label="op[item.options.label] || op.label"
:value="op[item.options.value] || op.value"
:key="op[item.options.value] || op.value"
></el-radio>
</template>
<!-- 单选框 按钮样式 -->
<el-radio-group
v-if="item.type === 'radioButtom'"
v-model.trim="tempQueryForm[item.prop]"
:size="tempQueryForm[item.size]"
:disabled="item.disable"
>
<el-radio-button
v-for="op in item.options.data"
:label="op[item.options.label] || op.label"
:value="op[item.options.value] || op.value"
:key="op[item.options.value] || op.value"
></el-radio-button>
</el-radio-group>
<!-- 文本框 -->
<el-input
v-if="item.type === 'textarea'"
v-model.trim="tempQueryForm[item.prop]"
type="textarea"
:style="{ width: item.inputWidth }"
:disabled="item.disable"
:rows="item.row"
:autosize="item.autosize"
:placeholder="
item.placeholder ? item.placeholder : '请输入' + item.label
"
clearable
>
</el-input>
<!-- 多选框 -->
<template v-if="item.type === 'Checkbox'">
<el-checkbox
v-model="tempQueryForm[item.prop]"
:disabled="item.disabled"
></el-checkbox>
</template>
</el-form-item>
</el-col>
<!-- 查询按钮 de-->
<span v-show="inline & hiddenFormBtn">
<el-form-item v-show="show">
<el-button
type="primary"
@click="handleSearch('ruleForm')"
:btnLoading="btnLoading"
>
{{ formBtn }}
</el-button>
</el-form-item>
</span>
<span v-show="inline & hiddenFormBtn">
<el-form-item v-show="show">
<el-button @click="resetFields('ruleForm')">重置</el-button>
</el-form-item>
</span>
</el-row>
</el-form>
</div>
</template>
<script>
import request from "@/utils/request";
import { deepClone } from "@/utils";
export default {
props: {
rowGutter: {
type: Number,
default: 24,
},
rowType: {
type: String,
default: "",
},
rowJustify: {
type: String,
default: "",
},
rowAlign: {
type: String,
default: "",
},
rowTag: {
type: String,
default: "div",
},
// 由inline属性决定form表单是普通表单,还是行内表单
inline: {
//排列方式
type: Boolean,
default: true,
},
searchLoading: {
type: Boolean,
default: false,
},
hiddenFormBtn: {
//是否展示搜索按钮
type: Boolean,
default: false,
},
formWidth: {
//form表单宽度
type: String,
default: "auto",
},
position: {
type: String,
default: "",
},
formConfig: {
type: Array,
default: [],
},
queryForm: {
type: Object,
default: () => {},
},
// 用于控制该表单内组件的尺寸 medium / small / mini
size: {
type: String,
default: "small",
},
marginBottom: {
type: Number,
default: 0,
},
view: {
type: Boolean,
default: false,
},
formBtn: {
type: String,
default: "查询",
},
btnLoading: {
type: Boolean,
default: false,
},
loading: {
//加载
type: Boolean,
default: false,
},
isBtnSave: {
type: Boolean,
default: false,
},
},
data() {
return {
show: true,
tempQueryForm: {},
tempFormConfig: [],
fetchResult: [],
timeout: null,
searchMark: {}, // 搜索
};
},
mounted() {},
computed: {},
methods: {
// input事件绑定和注册
inputEvent(e, item) {
this.$emit(item.trigger, this.tempQueryForm);
},
// 回车事件
toEnterSearch() {
this.$emit("keyup", this.tempQueryForm);
},
// selectSearch 聚焦获取当前input绑定的数据
focusKey(item) {
this.searchMark = item;
},
// selectSearch 下拉选中获取当前input绑定的数据
selectSearch(item) {
console.log(item);
},
// 远程搜索查询
querySearchAsync(queryString, cb) {
let result = this.formConfig.filter((item) => {
if (item.hasOwnProperty("http")) {
if (item.prop === this.searchMark.prop) {
return item;
}
}
});
// 在搜索关键词不为空时发送http请求
if (queryString) {
if (queryString.split(" ").length > 0) {
if (result[0].http.method == "post") {
result[0].http.data[result[0].prop] = queryString.split(" ")[0];
} else {
result[0].http.params[result[0].prop] = queryString.split(" ")[0];
}
}
request(result[0].http).then((res) => {
if (res.code == 200) {
if (res.data.list.length) {
res.data.list.map((item) => {
item.value = `${item[result[0].prop]} ${item[result[0].name]}`;
});
this.fetchResult = res.data.list;
var results = queryString.split(" ")[0]
? this.fetchResult.filter(
this.createStateFilter(queryString.split(" ")[0])
)
: this.fetchResult;
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
cb(results);
}, 1500 * Math.random());
}
}
});
}
},
// 远程搜索匹配查询
createStateFilter(queryString) {
return (state) => {
return (
state[this.searchMark.prop]
.toLowerCase()
.indexOf(queryString.toLowerCase()) === 0
);
};
},
// 行内表单搜索事件
handleSearch(formName, cb) {
this.$refs[formName].validate((valid) => {
if (valid) {
cb(valid);
} else {
console.log("error submit!!");
return false;
}
});
this.$emit("handleSearch");
},
// 清空ruleForm表单事件
resetFields(formName = "ruleForm") {
this.$refs[formName].resetFields();
},
},
watch: {
queryForm: {
handler(val) {
this.tempQueryForm = val;
},
deep: true,
immediate: true,
},
formConfig: {
handler(val) {
this.tempFormConfig = deepClone(val);
},
deep: true,
immediate: true,
},
},
};
</script>
<style lang="scss" scoped>
</style>
<template>
<el-input
v-bind="$attrs"
clearable
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange"
class="yl-input"
></el-input>
</template>
<script>
export default {
props: {
rules: {
type: Array,
default: () => [],
},
},
data() {
return {};
},
computed: {},
created() {},
mounted() {},
methods: {
handleInput(event) {
// v-bind="$attrs" v-on="$listeners"
this.$emit("input", event);
},
handleFocus(event) {
this.$emit("focus", event);
},
handleBlur(event) {
this.$emit("blur", event);
},
handleChange(event) {
this.$emit("change", event);
},
},
};
</script>
<style lang='scss'>
</style>
<script>
/**
* 动态渲染 el-table-column
*/
export default {
name: 'column',
props: {
attrs: {
type: Object,
default: () => ({}),
required: true
}
},
render: function(h) {
let attrs = this.attrs;
let scopedSlots = {};
if (attrs.render) {
scopedSlots.default = scope => attrs.render(h, scope);
}
return h('el-table-column', {
attrs,
scopedSlots
});
}
};
</script>
<template>
<div class="table-container">
<el-row
v-if="attrs.btnCofig.isBtn"
style="margin-bottom: 15px"
id="group-btn"
>
<el-col>
<span
v-for="(item, i) in attrs.btnCofig.btnGroup"
:key="item.btnName"
:class="i == 0 ? 'first-span' : 'span'"
>
<el-button
:type="item.type"
:icon="item.icon"
:round="item.round"
:size="item.size"
:loading="item.loading"
@click="handleClick(item, i)"
v-if="item.btnName !== '导入' && item.btnName !== '增加'"
>{{ item.btnName }}</el-button
>
<el-upload
v-else
ref="upload"
:action="item.action"
:fileName="item.fileName"
:http-request="toUpload"
:on-remove="onRemoveUpload"
:limit="item.limit"
:accept="item.accept"
:show-file-list="false"
class="upload"
>
<el-button
:type="item.type"
:icon="item.icon"
:round="item.round"
:size="item.size"
:loading="item.loading"
>{{ item.btnName }}</el-button
>
</el-upload>
</span>
</el-col>
</el-row>
<el-table
:max-height="attrs.maxHeight"
:empty-text="emptyText"
v-bind="attrs"
v-loading="loadingTable"
:data="tableData"
@selection-change="selectionChange"
ref="tableRef"
row-key="id"
:header-cell-class-name="headerCellClassName"
>
<template v-if="columns.length">
<template v-for="item in columns">
<column v-if="!item.hidden" :key="item.id" :attrs="item"></column>
</template>
</template>
<slot name="column" v-else></slot>
</el-table>
<!-- 分页 -->
<div
v-if="pageConfig.isPagination"
id="pagination"
class="pagination-container"
:style="{ textAlign: pageConfig.position || 'right' }"
ref="paginationRef"
>
<el-pagination
background
:hide-on-single-page="false"
:current-page="pageConfig.pageData.page"
:page-sizes="[10, 15, 20, 25, 30, 35, 40]"
:page-size="pageConfig.pageData.size"
layout="total,prev, pager, next, jumper, ->, sizes"
:total="pageConfig.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
</div>
</template>
<script>
import Sortable from "sortablejs";
import { objectMerge, debounce } from "@/utils";
import column from "./column";
export default {
props: {
attrs: {
type: Object,
default: {
border: true,
isDragSort: false,
btnCofig: {
isBtn: true,
btnGroup: [
{
type: "primary", // text、primary、danger
icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
btnName: "搜索",
size: "mini", // medium / small / mini
round: false,
loading: false,
event: "searchBtn",
},
],
},
},
},
emptyText: {
type: String,
default: "暂无数据",
},
loadingTable: {
type: Boolean,
default: false,
},
columns: {
type: Array,
default: () => [],
},
tableData: {
type: Array,
default: () => [],
},
pageConfig: {
type: Object,
default: {
isPagination: true,
},
required: true,
},
},
components: {
column,
},
data() {
return {
dropCol: objectMerge({}, this.columns),
trHeight: 4,
};
},
computed: {
_attrs() {
//默认table 参数
const defaultParams = {};
return Object.assign(defaultParams, this.attrs);
},
isHasAttr() {},
},
created() {
if (this.attrs.isDragSort) {
// 有没有复选框、有没有render
// this.columns
}
},
mounted() {
//阻止火狐拖拽新建新页面
document.body.addEventListener(
"drop",
(event) => {
event.preventDefault();
event.stopPropagation();
},
false
);
if (this.tableData.length) {
this.getTrCurrentHeight();
window.addEventListener("resize", this.getTrCurrentHeight);
// 拖拽行更新排序
// this.rowDrop();
// 拖拽列更新排序
this.columnDrop();
}
},
destroyed() {
if (this.tableData.length) {
window.removeEventListener("resize", this.getTrCurrentHeight);
}
},
methods: {
getTrCurrentHeight: debounce(function () {
this.$nextTick(() => {
const trEl =
this.$refs.tableRef.$refs.bodyWrapper.children[0].children[1]
.children[0].clientHeight;
this.trHeight = trEl;
});
}, 800),
// 给表头列添加className
headerCellClassName({ row, column, rowIndex, columnIndex }) {
if (columnIndex !== 0) {
return "el-table_1_column";
}
},
useTableFunc(FuncName, ...params) {
if (!this.$refs["el-table"]) {
return console.warn("访问不到el-table");
}
if (!FuncName) {
return console.error("请传入tabel方法名字");
}
this.$refs["el-table"][FuncName](params[0]);
},
// table复选框事件
selectionChange(e) {
console.log(e);
this.$emit("selectionEvent", e);
},
// 条数变化
handleSizeChange(e) {
this.$emit("sizeChange", e);
},
// 页码变化
handleCurrentChange(e) {
this.$emit("currentChange", e);
},
// btn点击事件注册
handleClick(item, i) {
this.$emit(item.event, item, i);
},
// 拖拽行更新排序
rowDrop() {
const wrapperTr = document.querySelector(".el-table__header-wrapper tr");
// console.log("wrapperTr:", wrapperTr);
this.sortable = Sortable.create(wrapperTr, {
sort: this.attrs.isDragSort,
animation: 100,
delay: 0,
handle: ".move", // 只有带move类名的元素才能拖动,多选框禁止拖动
onEnd: (evt) => {
// 因为手动加了一个多选框, 不在表头循环数组内, 所以这里减1
let oldIndx = evt.oldIndex - 1;
let newIndx = evt.newIndex - 1;
const oldItem = this.dropCol[oldIndx];
// 真正改变列数据--变化列头,就能实现列拖动 列数据按列头索引取值 {{ scope.row[dropCol[index].prop] }}
this.dropCol.splice(oldIndx, 1); // 删除旧一行 删除为1
this.dropCol.splice(newIndx, 0, oldItem); // 插入新一行 插入为0
},
});
},
// 拖拽列更新排序
columnDrop() {
const tbody = document.querySelector(".el-table__body-wrapper tbody");
const _this = this;
Sortable.create(tbody, {
sort: this.attrs.isDragSort,
animation: 100,
delay: 0,
onEnd({ newIndex, oldIndex }) {
// console.log("onEnd:", newIndex, oldIndex);
const currRow = _this.tableData.splice(oldIndex, 1)[0];
_this.tableData.splice(newIndex, 0, currRow);
},
});
},
// 选择上传
toUpload(options) {
this.$refs.upload.map((item) => {
item.clearFiles(); //上传成功之后清除历史记录
});
this.$emit("upload", options);
},
//移除上传
onRemoveUpload(file, fileList) {
this.$emit("rmfile", { file, fileList });
},
},
watch: {
data() {
this.$nextTick(() => {
this.useTableFunc("doLayout");
});
},
},
};
</script>
<style lang="scss">
.el-table {
th {
padding: 0;
}
td{
padding: 0;
}
}
.first-span,.span{
display: inline-block;
}
.span{
margin-left: 6px;
}
</style>
......@@ -8,7 +8,7 @@
<navbar />
<tags-view v-if="needTagsView" />
</div>
<app-main ref="appMainBlock" />
<app-main />
<right-panel v-if="false">
<settings />
</right-panel>
......
......@@ -45,9 +45,5 @@ export default {
}
}
},
getBlockCurrentHeight() {
let height = this.$refs.appMainBlock.$el.clientHeight;
this.$store.dispatch("app/setAppMainBlockCH", height);
},
},
};
......
......@@ -73,20 +73,6 @@ export const constantRoutes = [
hidden: true,
children: [
{
path: "/edit",
component: (resolve) =>
require(["@/views/et86Config/et86RuleConfig/edit"], resolve),
name: "edit",
meta: { title: "ET86规则", icon: "user", noCache: false },
},
{
path: "/errorInfo",
component: (resolve) =>
require(["@/views/et86Config/errorInfo"], resolve),
name: "errorInfo",
meta: { title: "错误信息提示", icon: "user" },
},
{
path: "/info/:handle/id=:id;routeStatus=:routeStatus;fltNo=:fltNo;route=:route;fltDate=:fltDate;status=:status",
component: (resolve) =>
require(["@/views/allocationConfig/flightAllocConfig/info"], resolve),
......
......@@ -2,7 +2,6 @@ const getters = {
sidebar: (state) => state.app.sidebar,
size: (state) => state.app.size,
device: (state) => state.app.device,
appMainBlockClientHeight: (state) => state.app.appMainBlockClientHeight,
visitedViews: (state) => state.tagsView.visitedViews,
cachedViews: (state) => state.tagsView.cachedViews,
token: (state) => state.user.token,
......
......@@ -10,7 +10,6 @@ const state = {
device: "desktop",
//size: Cookies.get('size') || 'medium'
size: localStorage.getItem("size") || "medium",
appMainBlockClientHeight: null
};
const mutations = {
......@@ -58,9 +57,6 @@ const actions = {
setSize({ commit }, size) {
commit("SET_SIZE", size);
},
setAppMainBlockCH({ commit }, height) {
commit("SET_APPMAINBLOCKCH", height);
},
};
export default {
......
......@@ -134,28 +134,18 @@
</el-row>
<el-row style="margin-bottom:5px">
<el-col :span="12">
<el-form-item prop="route">
<template slot="label">
<div style="display:inline-block">航班路线
<el-tooltip class="item" effect="dark" content="输入航班号后获取航线信息。航班种类为Purple Tail时可以进行多选,切换航班种类后需重新选择航线"
placement="top-start">
<span class="el-icon-warning" style="color:#1890ff;font-size:16px"></span>
</el-tooltip>
</div>
</template>
<el-select ref="routeSelect" class="wid80" v-model="form.route" :disabled="formdisabled.route"
placeholder="请选择航线" no-data-text="未查询到航线" @change="routeChange" :loading="routeLoading"
:multiple='routeMultiple' :key="routeMultiple">
<el-option v-for="item in routeList" :key="item.id" :label="item.route" :value="item.route">
<el-form-item label="航班路线" prop="route">
<el-select class="wid80" v-model="form.route" placeholder="请选择航线">
<el-option v-for="item in routeList" :key="item.id" :label="item.route"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<div class="formTips" v-if="title == '修改航班信息'">注意!:移除航线,相对应日期级别航线维度会同时删除</div>
</el-col>
<el-col :span="12">
<el-form-item label="航班类型" prop="typeId">
<el-select class="wid80" v-model="form.typeId" placeholder="请选择航班类型">
<el-option v-for="item in selectOption.flightTypelist" :key="item.id" :label="item.chineseName"
<el-option v-for="item in selectOption.flightTypelist" :key="item.id" :label="item.chineseName"
:value="item.id">
</el-option>
</el-select>
......@@ -166,7 +156,7 @@
<el-col :span="12">
<el-form-item label="航班状态" prop="statusId">
<el-select class="wid80" :disabled="true" v-model="form.statusId" placeholder="请选择航班状态">
<el-option v-for="item in selectOption.flightStatuslist" :key="item.id" :label="item.chineseName"
<el-option v-for="item in selectOption.flightStatuslist" :key="item.id" :label="item.chineseName"
:value="item.id">
</el-option>
</el-select>
......@@ -319,6 +309,7 @@ export default {
form: {
isNeedRequired: 2
},
routeList: [],
//表单校验
rules: {
fltNo: [
......@@ -353,7 +344,7 @@ export default {
{
required: true,
message: "航班路线不能为空",
trigger: "blur",
trigger: "change",
},
// {
// pattern: /^(([\~A-Z]{3,4})(\-[A-Z]{3,4})+)(;{1,1}(([\~A-Z]{3,4})(\-[A-Z]{3,4})+)){0,}$/,
......@@ -515,7 +506,8 @@ export default {
methods: {
//输入航班号后
blurfltNo() {
this.routeList = []
// this.routeList = []
this.form.accountTotalWeight = 0
this.form.accountAllocatedWeight = 0
if (
......@@ -586,6 +578,10 @@ export default {
this.routeLoading = false
if (res.code === 200) {
this.routeList = res.data.list
if(res.data.list.length == 0){
this.form.route = "";
this.msgError("该航班没有设置航线");
}
} else {
this.msgWarning(res.msg)
}
......@@ -593,6 +589,9 @@ export default {
this.routeLoading = false
console.log(err)
})
}else{
this.form.route = "";
this.routeList = [];
}
},
//航班种类修改
......@@ -608,7 +607,7 @@ export default {
}
}
})
this.$refs.routeSelect.$forceUpdate()
// this.$refs.routeSelect.$forceUpdate()
},
//查询条件数据源
findFltConditionData() {
......@@ -853,12 +852,24 @@ export default {
params: obj
})
},
// 航班状态
flightState(multipleSelection, statusName){
let flightState = multipleSelection.some(item=>item.statusName == statusName);
if(flightState){
this.msgError(`勾选的航班,航班状态为${statusName},不可操作该按钮`);
}else{
flightState = false
}
return flightState
},
/** 删除按钮操作 */
handleDelete(row) {
let fIds = [];
this.ids.forEach(item => {
fIds.push(item.id)
})
});
// 航班状态
if(this.flightState(this.ids, "已删除")) return
this.$confirm("是否确认删除所选数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
......@@ -965,6 +976,8 @@ export default {
},
//批量开启/关闭航班
handleFlightStatus(status) {
// 航班状态
      if(this.flightState(this.ids, "已删除")) return
let handle = status == "flightStatus80" ? "关闭" : "开启";
let data = {
updateIds: [],
......@@ -994,6 +1007,8 @@ export default {
},
//自动推送开关
autoPushBatch(status) {
// 航班状态
      if(this.flightState(this.ids, "已删除")) return
let msg = status == "open" ? "开启" : "关闭";
let data = {
updateIds: [],
......@@ -1031,6 +1046,8 @@ export default {
},
//白名单配舱开关
whiteListSwitchStatus(val) {
// 航班状态
      if(this.flightState(this.ids, "已删除")) return
let obj = {
updateIds: []
}
......@@ -1051,6 +1068,8 @@ export default {
},
//黑名单配舱开关
BlackListSwitchStatus(val) {
// 航班状态
      if(this.flightState(this.ids, "已删除")) return
let obj = {
updateIds: []
}
......@@ -1072,6 +1091,10 @@ export default {
//航线修改
routeChange(val) {
this.$forceUpdate()
if(val.length){
// this.rules.route.required = false
}
console.log(this.form.route)
},
//多选框选中数据
tableSelect(val) {
......
export const formConfig = [
{
label: "重量(KG)",
type: "Input",
name: "minWeight",
prop: "minWeight",
placeholder: "0",
rules: {
required: true,
message: "最大重量不得小于0KG",
trigger: ["change", "blur"],
},
trigger: "blur", // 事件名
},
{
label: "",
type: "Input",
name: "maxWeight",
prop: "maxWeight",
placeholder: "34",
rules: {
required: true,
message: "最大重量不得大于34KG",
trigger: ["change", "blur"],
},
trigger: "blur", // 事件名
},
{
label: "件数",
type: "Input",
name: "minNumOfPieces",
prop: "minNumOfPieces",
placeholder: "0",
rules: {
required: true,
message: "最大重量不得小于0KG",
trigger: ["change", "blur"],
},
trigger: "blur", // 事件名
},
{
label: "",
type: "Input",
name: "maxNumOfPieces",
prop: "maxNumOfPieces",
placeholder: "34",
rules: {
required: true,
message: "最大重量不得大于34KG",
trigger: ["change", "blur"],
},
trigger: "blur", // 事件名
},
];
<template>
<div class="form-header">
<el-row style="padding-bottom: 20px">
<el-col>
<el-divider content-position="left">ET86配舱航班顺位</el-divider>
</el-col>
</el-row>
<!-- ET86配舱航班顺位 -->
<el-row :gutter="24" justify="center">
<el-col :span="18">
<el-row style="margin-bottom: 15px" v-if="getRouter">
<el-col>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="addBtn"
>添加</el-button
>
</el-col>
</el-row>
<yl-table
emptyText="请添加配舱航班"
:attrs="tableAttr"
:loadingTable="tableAttr.loadingTable"
:tableData="tableData"
:pageConfig="{
isPagination: false,
}"
>
<template #column>
<el-table-column
type="index"
label="序号"
width="50"
align="center"
></el-table-column>
<el-table-column
label="航班号"
prop="flightNo"
min-width="100"
align="center"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.flightNo"
clearable
:disabled="scope.row.edit"
@focus="inputFocus(scope)"
@blur="blurSearch"
placeholder="请输入航班号"
size="small"
/>
</template>
</el-table-column>
<el-table-column
label="加减天数"
prop="calculateDay"
width="100"
align="center"
>
<template slot-scope="scope">
<el-input
type="text"
v-model="scope.row.calculateDay"
:disabled="scope.row.edit"
min="-7"
max="7"
v-input-filter
clearable
placeholder=""
size="small"
/>
<!-- <el-input
type="number"
v-model="scope.row.calculateDay"
:disabled="scope.row.edit"
min="-7"
max="7"
v-input-filter
clearable
placeholder=""
size="small"
/> -->
</template>
</el-table-column>
<el-table-column
label="航线"
prop="flightRoute"
min-width="100"
align="center"
>
<template slot-scope="scope">
<el-select
v-model="scope.row.flightRoute"
placeholder="请选择"
size="small"
:disabled="scope.row.edit"
>
<el-option
v-for="item in scope.row.routeList"
:key="item.id"
:label="item.route"
:value="item.route"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
label="爆仓是否继续配舱"
prop="permitOverweight"
min-width="100"
align="center"
>
<template slot-scope="scope">
<el-checkbox
v-model="scope.row.permitOverweight"
:disabled="scope.row.edit"
@change="changeCheck(scope)"
></el-checkbox>
</template>
</el-table-column>
<el-table-column label="操作" min-width="100" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
:disabled="scope.row.edit"
@click="deleBtn(scope.row, scope.$index)"
>删除</el-button
>
</template>
</el-table-column>
</template>
</yl-table>
</el-col>
</el-row>
<!-- ET86配舱航班顺位维度 -->
<el-row style="padding: 20px 0">
<el-col>
<el-divider content-position="left">航线维度设置</el-divider>
</el-col>
</el-row>
<el-card shadow="always" class="box-card">
<el-form
:model="queryForm"
label-position="right"
label-width="120px"
ref="ruleForm"
class="config-form"
>
<el-row class="rowPadding">
<el-col :span="24">
<el-col :span="10">
<el-form-item label="原航班号">
<el-input
type="textarea"
v-model="queryForm.originOfFlightNo"
size="medium"
maxlength="1000"
show-word-limit
:rows="4"
placeholder="原航班号之间用分号分隔,例:LP001;LP002"
@blur="blurEvent"
:disabled="!getRouter"
></el-input>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="">
<el-col :span="4" style="text-align: end; width: 8%">
<span
style="
width: 10%;
margin-right: 10px;
font-size: 14px;
color: #606266;
font-weight: 700;
"
>服务种类</span
>
</el-col>
<el-col :span="4" style="text-align: end; width: 19%">
<el-radio-group
v-model="isServiceCode"
@change="changeIsServiceCode"
:disabled="!getRouter"
style="text-align: left"
>
<el-radio label="1">包含ServiceCode</el-radio>
<el-radio label="2">不包含ServiceCode</el-radio>
</el-radio-group>
</el-col>
<el-col :span="16">
<el-input
type="textarea"
v-model="queryForm.includeServiceType"
size="medium"
maxlength="1000"
show-word-limit
:rows="4"
placeholder="请输入ServiceCode"
@blur="serviceCodeBlur"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
</el-col>
<el-col :span="24">
<el-col :span="10">
<el-form-item label="URSA包含">
<el-input
type="textarea"
v-model="queryForm.includeUrsa"
size="medium"
maxlength="1000"
show-word-limit
:rows="4"
placeholder="URSA之间用分号分隔,例:F2;F3;P_"
:disabled="!getRouter"
></el-input>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="">
<el-col :span="8" style="text-align: end; width: 27%"
><span
class="ursa-label"
style="
margin-right: 10px;
font-size: 14px;
color: #606266;
font-weight: 700;
"
>URSA不包含</span
></el-col
>
<el-col :span="16">
<el-input
type="textarea"
v-model="queryForm.notIncludeUrsa"
size="medium"
maxlength="1000"
show-word-limit
:rows="4"
placeholder="URSA之间用分号分隔,例:F2;F3;P_"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
</el-col>
<el-col :span="10">
<el-form-item label="申报类别">
<el-card shadow="never">
<el-checkbox-group
v-model="checkboxClassType"
@change="changeCheckboxCargoType"
style="display: flex"
v-if="cargoType.length"
:disabled="!getRouter"
>
<el-checkbox
v-for="item in cargoType"
:label="item.chineseName"
:name="item.chineseName"
:key="item.code"
>
<Tooltips :content="item.chineseName" :refName="item.code">
</Tooltips>
</el-checkbox>
</el-checkbox-group>
</el-card>
</el-form-item>
</el-col>
<el-col :span="24">
<el-col :span="2">
<el-form-item label="单品名">
<el-checkbox
v-model="queryForm.multiHs"
:disabled="!getRouter"
></el-checkbox>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" class="custom-label">
<span class="custom-label-title">重量(KG)</span>
<el-col :span="10">
<el-input
v-model.trim="queryForm.minWeight"
placeholder="最小重量"
@blur="inputBlurMinWeight($event)"
:disabled="!getRouter"
></el-input>
<span ref="minWeight" class="el-form-item__error"></span>
</el-col>
<el-col style="text-align: center" :span="1">-</el-col>
<el-col :span="10">
<el-input
v-model.trim="queryForm.maxWeight"
placeholder="最大重量"
@blur="inputBlurMaxWeight($event)"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="件数" class="custom-label-pieces">
<el-col :span="10">
<el-input
v-model.trim="queryForm.minNumOfPieces"
placeholder="最少件数"
@blur="inputBlurMinPieces($event)"
:disabled="!getRouter"
></el-input>
<span ref="minNumOfPieces" class="el-form-item__error"></span>
</el-col>
<el-col style="text-align: center" :span="1">-</el-col>
<el-col :span="10">
<el-input
v-model.trim="queryForm.maxNumOfPieces"
placeholder="最多件数"
@blur="inputBlurMaxPieces($event)"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
</el-col>
<el-col :span="24">
<el-col :span="2">
<el-form-item label="申报价值"></el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="" class="custom-label">
<span class="custom-label-title">人民币</span>
<el-col :span="10">
<el-input
v-model.trim="minCNYCustomVal"
placeholder="最小申报价值"
@blur="inputBlurMin($event, 'minCNYCustomVal')"
:disabled="!getRouter"
></el-input>
<span
ref="minCNYCustomVal"
class="el-form-item__error"
></span>
</el-col>
<el-col style="text-align: center" :span="1">-</el-col>
<el-col :span="10">
<el-input
v-model.trim="maxCNYCustomVal"
placeholder="最大申报价值"
@blur="inputBlurMax($event, 'maxCNYCustomVal')"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="美元" class="custom-label-pieces">
<el-col :span="10">
<el-input
v-model.trim="minSUDCustomVal"
placeholder="最小申报价值"
@blur="inputBlurMin($event, 'minSUDCustomVal')"
:disabled="!getRouter"
></el-input>
<span
ref="minSUDCustomVal"
class="el-form-item__error"
></span>
</el-col>
<el-col style="text-align: center" :span="1">-</el-col>
<el-col :span="10">
<el-input
v-model.trim="maxSUDCustomVal"
placeholder="最大申报价值"
@blur="inputBlurMax($event, 'maxSUDCustomVal')"
:disabled="!getRouter"
></el-input>
</el-col>
</el-form-item>
</el-col>
</el-col>
<el-col :span="24" v-if="getRouter">
<el-form-item label="">
<el-button type="primary" @click="submitForm('ruleForm')">{{
getRouter
}}</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</template>
<script>
import YlForm from "@/components/YlForm";
import YlTable from "@/components/YlTable";
import { formConfig } from "./formConfig";
import { inputBlurValidate } from "@/utils/mixins";
import { tableAttr } from "./tableConfig";
import {
allDictData, // 获取全部字典
queryRouteByFltNo, // 航线查询
} from "@/api/destinationFlight";
import {
add, // ET86新增
findEtesRuleById, // ET86详情
update, // ET86编辑
} from "@/api/et86";
import indexMixins from "./mixins";
export default {
name: "edit",
components: {
YlForm,
YlTable,
},
mixins: [indexMixins, inputBlurValidate],
data() {
return {
formConfig: formConfig, // 表单配置项
queryForm: {
// ET86配舱航班顺位维度
// 表单参数
id: "", // 维度ID
originOfFlightNo: "", // 原航班号
includeServiceType: "", // 服务种类包含
notIncludeServiceType: "", // 服务种类不包含
includeUrsa: "", // URSA包含
notIncludeUrsa: "", // URSA不包含
declarationCategory: "", // 已勾选申报类别的数据
multiHs: false, // 单品名
minWeight: "", // 最小重量
maxWeight: "",
minNumOfPieces: "", // 最小件数
maxNumOfPieces: "",
currencyCd: "", // 币种
minCustomVal: "", // 最小申报值
maxCustomVal: "",
},
tableAttr: tableAttr, // table配置项
tableData: [], // ET86配舱航班顺位
currentIndex: 0, // 记录当前table 列的索引位置
id: 1, // ET86配舱航班顺位ID
isServiceCode: "1", // 服务种类
serviceCode: "", // 服务种类内容
cargoType: [], // 申报类别调用接口获取所有的申报类别
checkboxCargoType: [], // 已勾选申报类别的数据
checkboxClassType: [], // 申报类别
serviceCodeData: [], // 【服务种类】调用接口获取服务种类所有的serviceCode
minCNYCustomVal: "", // 人民币最小申报值
maxCNYCustomVal: "", //
minSUDCustomVal: "", // 美元最小申报值
maxSUDCustomVal: "", //
};
},
computed: {
// 获取路由参数
getRouter() {
if (this.$route.query.name == "add") {
return "保存";
} else if (this.$route.query.name == "edit") {
return "修改";
} else {
return false;
}
},
},
created() {
this.getAllDictData(); // 获取全部字典
if (this.$route.query.name == "view" || this.$route.query.name == "edit") {
this.queryFindEtesRuleById(this.$route.query); // ET86详情
} else {
// 新增时默认一条数据
this.tableData = [
{
id: this.id,
flightNo: "", // 航班号
calculateDay: "", // 航班日期//+1 -1
flightRoute: "", // 航线
routeList: [], // 航线列表
permitOverweight: "N" ? false : true, // 爆仓是否继续配舱 Y-是,N-否
priority: this.id, // 优先等级
ruleId: "", // 维度ID
},
];
}
},
mounted() {},
directives: {
// 处理加减天数
"input-filter": {
bind: function (el, binding) {
el.handler = function (event) {
if (event.data == "E" || event.data == "e") {
// 无理数时
event.target.value = "";
}
if (event.target.value) {
if (Number(event.target.value) < -7) {
event.target.value = "";
this.msgError("加减天数最小不能低于7天");
} else if (Number(event.target.value) > 7) {
event.target.value = "";
this.msgError("加减天数最小不能大于7天");
} else if (/[\.]/.test(Number(event.target.value))) {
// 浮点数时
event.target.value = "";
} else {
}
event.target.dispatchEvent(new Event("input"));
}
};
el.addEventListener("input", el.handler);
},
unbind: function (el) {
el.removeEventListener("input", el.handler);
},
},
},
filters: {},
methods: {
// ET86新增
postAdd(params) {
add(params)
.then((res) => {
const { code, msg } = res;
if (code == 200) {
this.msgSuccess(msg || "创建成功!");
this.$router.push("/et86RuleConfig");
} else {
this.msgError(msg || "创建失败!");
}
})
.catch(() => {});
},
// ET86详情
queryFindEtesRuleById({ id, status, name }) {
findEtesRuleById({ id: id, status: status })
.then((res) => {
const { code, data, msg } = res;
if (code == 200) {
data.list.flightRankDtoList.map((item) => {
if (name == "view") {
item.edit = true;
} else {
item.edit = false;
}
// 爆仓是否继续配舱
if (item.permitOverweight == "N") {
item.permitOverweight = false;
} else {
item.permitOverweight = true;
}
});
data.list.flightRankDtoList.map((item) => {
item.calculateDay = item.calculateDay;
});
// ET86配舱航班顺位
this.tableData = data.list.flightRankDtoList;
Object.keys(data.list.fltRuleDto).map((key) => {
if (key == "multiHs") {
if (data.list.fltRuleDto[key] == "N") {
data.list.fltRuleDto[key] = true;
} else {
data.list.fltRuleDto[key] = false;
}
}
// 将详情获取为null的字段设置为空字符串,目的是为了判断的时候少些为null的判断,保持空数据同一的判断条件;
if (data.list.fltRuleDto[key] == null) {
data.list.fltRuleDto[key] = "";
}
});
if (data.list.fltRuleDto.declarationCategory) {
this.checkboxClassType =
data.list.fltRuleDto.declarationCategory.split(";");
} else {
this.checkboxClassType = [];
}
this.queryForm = data.list.fltRuleDto; // ET86配舱航班顺位维度
} else {
this.msgError(msg || "获取查看失败");
}
})
.catch(() => {});
},
// ET86编辑
postUpdate(parmas) {
update(parmas)
.then((res) => {
const { code, msg } = res;
if (code == 200) {
this.msgSuccess(msg || "修改成功!");
this.$router.push("/et86RuleConfig");
} else {
this.msgError(msg || "修改失败!");
}
})
.catch(() => {});
},
// 获取所有数据字典
getAllDictData() {
allDictData()
.then((res) => {
if (res.code != 200) {
this.msgError(res.msg);
return;
}
this.cargoType = res.data.cargoType; // 申报类别
if (res.data.serviceCode.length) {
this.getObj(res.data);
}
})
.catch(() => {});
},
// 航线查询
getQueryRouteByFltNo(item) {
this.tableAttr.loadingTable = true;
this.tableData[this.currentIndex].flightRoute;
queryRouteByFltNo(item)
.then((res) => {
this.tableAttr.loadingTable = false;
if (res.code == 200) {
const list = res.data.list;
let routeList = [];
if (list.length) {
list.map((item) => {
routeList.push(item);
});
let isEtesRoute = list.filter((item) => item.isEtesRoute == "Y"); // 过滤普通航线
if (isEtesRoute.length == 0) {
this.msgError("该航班下的航线均为普通航线");
}
this.tableData[this.currentIndex].flightRoute = "";
this.tableData[this.currentIndex].routeList = isEtesRoute;
} else {
this.msgError("暂无航线");
this.tableData[this.currentIndex].routeList = [];
this.tableData[this.currentIndex].flightRoute = "";
}
}
})
.catch(() => {});
},
// 航班号input 聚焦事件
inputFocus({ $index }) {
this.currentIndex = $index;
},
// 失焦查询
blurSearch() {
this.tableData[this.currentIndex].flightNo = this.upCase(
this.tableData[this.currentIndex].flightNo
); // 转大写字母
let params = {
fltNo: this.tableData[this.currentIndex].flightNo,
};
let repeat = this.tableData.filter(
(item) =>
item.flightNo == this.tableData[this.currentIndex].flightNo &&
item.calculateDay == this.tableData[this.currentIndex].calculateDay &&
item.flightRoute == this.tableData[this.currentIndex].flightRoute
); // 筛选重复的航班
if (repeat.length > 1) {
this.msgError("航班顺位已重复");
return;
}
if (params.fltNo) {
this.getQueryRouteByFltNo(params);
} else {
this.tableData[this.currentIndex].flightRoute = "";
this.tableData[this.currentIndex].routeList = [];
this.msgError("请输入航班号");
}
},
// 添加ET86配舱航班顺位
addBtn(item) {
this.id++;
this.tableData.unshift({
id: this.id,
flightNo: "", // 航班号
calculateDay: "", // 航班日期//+1 -1
flightRoute: "", // 航线
routeList: [], // 航线列表
permitOverweight: "N" ? false : true, // 爆仓是否继续配舱 Y-是,N-否
priority: this.id, // 优先等级
ruleId: "", // 维度ID
});
},
// 是否爆仓
changeCheck({ $index, row }) {
this.tableData.map((item, i) => {
if ($index !== i) {
item.permitOverweight = false;
}
});
},
// 删除
deleBtn(item, $index) {
this.tableData.splice($index, 1);
},
// 类别
changeCheckboxCargoType(arr) {
let include = this.cargoType.filter((item) =>
arr.some((val) => val == item.chineseName)
); // 查询已被勾选的类别
this.checkboxCargoType = include; //已勾选申报类别的数据
this.queryForm.declarationCategory = arr.join(";");
},
// 失焦事件
blurEvent() {
this.queryForm.originOfFlightNo = this.upCase(
this.queryForm.originOfFlightNo
);
},
// 表单提交
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 爆仓是否继续配舱
const newtTableData = JSON.parse(JSON.stringify(this.tableData));
const tableData = newtTableData;
tableData.filter((item) => {
if (item.permitOverweight == false) {
item.permitOverweight = "N";
} else {
item.permitOverweight = "Y";
}
});
// 校验ET86配舱航班顺位维度
if (
this.minCNYCustomVal.length != "" ||
this.maxCNYCustomVal.length != ""
) {
this.queryForm.currencyCd = "CNY";
this.queryForm.minCustomVal = this.minCNYCustomVal;
this.queryForm.maxCustomVal = this.maxCNYCustomVal;
} else if (
this.minSUDCustomVal.length != "" ||
this.maxSUDCustomVal.length != ""
) {
this.queryForm.currencyCd = "USD";
this.queryForm.minCustomVal = this.minSUDCustomVal;
this.queryForm.maxCustomVal = this.maxSUDCustomVal;
} else {
this.queryForm.currencyCd = "CNY";
}
let fltNo = this.tableData.some((item) => item.flightNo == ""); // 通过遍历判断航班顺位列表有没有填写的航班号
let fltNoRoute = this.tableData.some(
(item) => item.flightRoute == ""
); // 通过遍历判断航班顺位列表有没有填写的航线
if (fltNo) {
this.msgError("航班号不可为空");
return;
}
if (fltNoRoute) {
this.msgError("航线不可为空");
return;
}
if (this.queryForm.originOfFlightNo.length == 0) {
this.msgError("原航班号不可为空");
return;
}
this.queryForm.includeServiceType =
this.isServiceCode == "1" && this.serviceCode.length > 0
? this.serviceCode
: ""; // 包含服务种类
this.queryForm.notIncludeServiceType =
this.isServiceCode == "2" && this.serviceCode.length > 0
? this.serviceCode
: ""; // 不包含服务种类
let parmas = {
flightRankDtoList: tableData, // ET86配舱航班顺位
fltRuleDto: this.queryForm,
};
// 筛选重复的航班
let repeat = tableData.filter(
(item) =>
item.flightNo == tableData[this.currentIndex].flightNo &&
item.calculateDay == tableData[this.currentIndex].calculateDay &&
item.flightRoute == tableData[this.currentIndex].flightRoute
);
if (tableData.length > 100) {
this.msgError("最多添加100条,请删除后再添加");
return;
}
if (repeat.length > 1) {
this.msgError("ET86配舱航班顺位中存在重复设置");
return;
}
parmas.fltRuleDto.multiHs = this.queryForm.multiHs ? "N" : "Y"; // N为单品名,Y为多品名
if (this.validateForm && this.$route.query.name == "add") {
this.postAdd(parmas); // 新增
} else {
if (this.validateForm) {
this.postUpdate(parmas); // 修改
}
}
} else {
console.log("error submit!!");
return false;
}
});
this.$emit("handleSearch");
},
},
};
</script>
<style lang="scss" scoped>
.rowPadding {
padding: 10px 0;
font-size: 12px;
}
::v-deep .custom-label {
.el-form-item__content {
display: flex;
margin-left: 0 !important;
span {
font-size: 14px;
color: #606266;
font-weight: 700;
float: right;
margin-right: 10px;
text-align: end;
}
.custom-label-title {
width: 120px;
}
.el-input__suffix {
right: -15px !important;
}
.el-form-item__error {
color: #ff4949;
font-size: 12px;
line-height: 1;
padding-top: 4px;
position: absolute;
top: 100%;
left: 0;
font-weight: 500;
width: 100% !important;
}
}
}
::v-deep .custom-label-pieces {
.el-form-item__content {
width: 80%;
}
}
</style>
export default {
methods: {
// 获取字典
getObj({ serviceCode }) {
let service_Code = [];
serviceCode.map((item) => {
service_Code.push(item.chineseName);
});
this.serviceCodeData = service_Code;
},
// 处理serviceCode包不包含
serviceCodeCofig() {
let str = this.serviceCode.replace(/;|;/g, ",");
let arr = str.split(",");
if (arr[arr.length - 1] == "") {
arr.splice(arr.length - 1, 1);
}
let noHasCode = this.serviceCodeData.filter(
(v) => !arr.some((val) => val == v)
);
let hasCode = this.serviceCodeData.filter((v) =>
arr.some((val) => val == v)
);
let includeCode = arr.filter((v) => !hasCode.some((val) => val == v));
return {
include: hasCode,
noInclude: includeCode,
};
},
// radio包含不包含serviceCode
changeIsServiceCode(val) {
// 勾选的时候去校验 || 输入的时候去校验
if (val == 1) {
if (this.serviceCodeCofig().noInclude.length) {
let tip = this.serviceCodeCofig().noInclude.toString();
this.msgError(`${tip} 不包含`);
}
} else {
if (this.serviceCodeCofig().include.length) {
let tip = this.serviceCodeCofig().include.toString();
this.msgError(`${tip} 已包含`);
}
}
},
// serviceCode失焦事件
serviceCodeBlur() {
if (this.isServiceCode == "1") {
if (this.serviceCodeCofig().noInclude.length) {
let tip = this.serviceCodeCofig().noInclude.toString();
// this.msgError(`${tip} 不包含`);
}
} else {
if (this.serviceCodeCofig().include.length) {
let tip = this.serviceCodeCofig().include.toString();
// this.msgError(`${tip} 已包含`);
}
}
},
},
};
export const tableAttr = {
border: true,
loadingTable: false,
isDragSort: true, // 拖拽tableData数据一定要加id字段
maxHeight: 300,
btnCofig: {
isBtn: false,
btnGroup: [
{
type: "primary",
icon: "el-icon-plus",
btnName: "添加",
size: "mini",
round: false,
loading: false,
event: "add",
},
],
},
};
export const columnHeader = (deleteRow) => [
{
label: "航班号",
prop: "flightNo",
align: "center",
minWidth: 100,
},
{
label: "航班日期",
prop: "calculateDay",
align: "center",
minWidth: 100,
// sortable: true,
// "sort-method": (a, b) => b.updateTime - a.updateTime,
},
{
label: "航线",
prop: "flightRoute",
align: "center",
minWidth: 100,
},
{
label: "爆仓是否继续配舱",
prop: "permitOverweight",
align: "center",
minWidth: 100,
render: (h, params) => {
const { row } = params;
console.log(345678, row);
// return h("div", `状态-${row.id}`);
},
},
{
label: "操作",
align: "center",
minWidth: 120,
render: (h, params) => {
return h("div", [
h(
"el-button",
{
style: {
color: "#ff4949",
},
props: {
type: "text",
size: "mini",
icon: "el-icon-delete",
},
on: {
click() {
deleteRow(params);
},
},
},
"删除"
),
]);
},
},
];
export const formConfig = [
{
label: "原航班",
type: "Input",
name: "originOfFlightNo",
prop: "originOfFlightNo",
placeholder: "请输入原航班号",
span: 5,
trigger: "blur",
labelWidth: "55px",
},
{
label: "修改时间 从",
type: "Date",
name: "startTime",
prop: "startTime",
placeholder: "请选择开始时间",
// rules: { required: true, message: "请选择开始时间", trigger: "blur" },
format: "yyyy-MM-dd",
colWidth: "23%",
inputWidth: "100%",
},
{
label: "到",
type: "Date",
name: "endTime",
prop: "endTime",
placeholder: "请选择结束时间",
// rules: { required: true, message: "请选择结束时间", trigger: "blur" },
format: "yyyy-MM-dd",
colWidth: "20%",
labelWidth: "20px",
inputWidth: "100%",
},
{
label: "规则状态",
type: "Select",
name: "status",
prop: "status",
placeholder: "请选择状态",
options: {
data: [
{
value: "1",
label: "有效",
},
{
value: "0",
label: "无效",
},
],
label: "有效",
value: "1",
},
colWidth: "18%",
labelWidth: "70px",
inputWidth: "100%",
},
];
export const editFormConfig = [
{
label: "航班号",
type: "Search",
name: "route",
prop: "fltNo",
placeholder: "请输入航班号",
rules: {
required: true,
message: "请输入航班号",
trigger: ["change", "blur"],
},
http: {
url: "/dictionary/queryRouteByFltNo",
method: "post",
data: {
fltNo: "",
},
},
},
{
label: "",
type: "inputNumber",
name: "count",
prop: "count",
placeholder: "+",
min: 0,
max: 7,
with: "50px",
},
{
label: "航线优先级",
type: "Input",
name: "route",
prop: "fltNum",
placeholder: "请选择航线优先级",
trigger: "focus",
},
{
label: "爆仓是否继续配舱",
type: "Checkbox",
name: "checked",
prop: "checked",
disabled: false,
},
];
<template>
<div ref="formHeaderRef" class="form-header container">
<el-row>
<el-col>
<yl-form
ref="ruleForm"
:formConfig="formConfig"
:queryForm="queryForm"
:inline="false"
formWidth="auto"
@blur="blurEvent"
/>
</el-col>
</el-row>
<yl-table
ref="ylTable"
:attrs="tableAttr"
:loadingTable="tableAttr.loadingTable"
:columns="columns"
:tableData="tableData"
:pageConfig="pageConfig"
@sizeChange="handleSizeChange"
@currentChange="handleCurrentChange"
@search="searchBtn"
@add="addBtn"
>
</yl-table>
</div>
</template>
<script>
import YlForm from "@/components/YlForm";
import YlTable from "@/components/YlTable";
import { formConfig } from "./formConfig";
import { tableAttr, columnHeader } from "./tableConfig";
import { restTableHeight, sortList } from "@/utils";
import {
findAllEtesRules, // ET86查询
deleteEtesRuleById, // 删除
} from "@/api/et86";
export default {
components: {
YlForm,
YlTable,
},
data() {
return {
formConfig: formConfig, // 表单配置项
queryForm: {
// 表单参数
status: "有效",
},
pageConfig: {
// 分页配置项
isPagination: true,
total: 0,
pageData: {
page: 1,
size: 10,
},
},
tableAttr: tableAttr, // table配置项
columns: columnHeader(this.viewRow, this.editRow, this.deleteRow), // 表头
tableData: [], // 表格数据
};
},
created() {
// ET86查询
this.$nextTick(() => {
this.searchBtn();
});
},
mounted() {
this.$nextTick(() => {
this.tableAttr.maxHeight =
window.innerHeight - restTableHeight(this.$refs);
});
},
methods: {
// ET86查询
queryFindAllEtesRules() {
const { page, size } = this.pageConfig.pageData;
let params = {
originOfFlightNo: this.queryForm.originOfFlightNo,
updateTimeStart: this.queryForm.startTime
? this.queryForm.startTime
: "",
updateTimeEnd: this.queryForm.endTime ? this.queryForm.endTime : "",
limitStart: (page - 1) * size,
limitSize: size,
status: this.queryForm.status,
};
if (this.queryForm.status == "有效") {
params.status = "1";
}
this.tableAttr.loadingTable = true;
findAllEtesRules(params)
.then((res) => {
this.tableAttr.loadingTable = false;
const { code, data } = res;
if (code == 200) {
const valid = data.list.filter((item) => item.status == "1"); // 有效
const invalid = data.list.filter((item) => item.status == "0"); // 无效
// valid.reverse(); // 有效航班修改时间排序
// invalid.reverse(); //
// const newValid = sortList(valid, "originOfFlightNo"); // 有效原航班按字母排序
// const newInvalid = sortList(invalid, "originOfFlightNo");
// this.tableData = newValid.concat(newInvalid);
this.tableData = valid.concat(invalid);
this.pageConfig.total = data.total;
}
})
.catch(() => {});
},
// 失焦事件
blurEvent({ originOfFlightNo }) {
this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo);
},
// 搜索
searchBtn() {
this.pageConfig.pageData.page = 1;
this.pageConfig.pageData.size = 10;
this.$refs.ruleForm.handleSearch("ruleForm", (val) => {
this.queryFindAllEtesRules();
});
},
//条数变化
handleSizeChange(e) {
this.pageConfig.pageData.size = e;
this.pageConfig.pageData.page = 1;
this.queryFindAllEtesRules();
},
//页码变化
handleCurrentChange(e) {
this.pageConfig.pageData.page = e;
this.queryFindAllEtesRules();
},
// 添加
addBtn(item) {
this.$router.push({
path: "/edit",
query: {
name: "add",
},
});
},
// 重置表单
restForm() {
this.$refs.ruleForm.resetFields("ruleForm");
},
// 查看
viewRow({ row }) {
this.$router.push({
path: "/edit",
query: {
name: "view",
id: row.id,
status: row.status,
},
});
},
// 编辑
editRow({ row }) {
this.$router.push({
path: "/edit",
query: {
name: "edit",
id: row.id,
status: row.status,
},
});
},
// 删除
deleteRow({ row }) {
this.$confirm("是否确认删除? 删除后该规则设置为无效,不可恢复", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
})
.then(() => {
deleteEtesRuleById({ id: row.id }).then((res) => {
const { code, msg } = res;
if (code == 200) {
this.searchBtn();
this.msgSuccess("删除成功!");
} else {
this.msgError(msg || "删除失败");
}
});
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped></style>
const state = {
1: "有效",
0: "无效",
};
export const tableAttr = {
border: true,
loadingTable: false,
isDragSort: false, // 拖拽tableData数据一定要加id字段
maxHeight: 0,
// defaultSort: { prop: "updateTime", order: "descending" },
btnCofig: {
isBtn: true,
btnGroup: [
{
type: "primary", // text、primary、danger
icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
btnName: "搜索",
size: "mini", // medium / small / mini
round: false,
loading: false,
event: "search",
},
{
type: "primary",
icon: "el-icon-plus",
btnName: "添加",
size: "mini",
round: false,
loading: false,
event: "add",
},
],
},
};
export const columnHeader = (viewRow, editRow, deleteRow) => [
{
type: "index",
label: "序号",
prop: "id",
align: "center",
width: "50",
},
{
label: "原航班",
prop: "originOfFlightNo",
align: "center",
minWidth: 80,
},
{
label: "配载航班",
prop: "rankFltNoStr",
align: "center",
minWidth: 120,
},
{
label: "航线",
prop: "rankFltRouteStr",
align: "center",
minWidth: 140,
},
{
label: "状态",
prop: "status",
align: "center",
minWidth: 50,
render: (h, params) => {
const { row } = params;
return h("div", `${state[row.status]}`);
},
},
{
label: "修改时间",
prop: "updateTime",
align: "center",
minWidth: 80,
// sortable: true,
// "sort-method": (a, b) => a.createTime - b.createTime,
},
{
label: "修改人",
prop: "updateUserName",
align: "center",
minWidth: 60,
},
{
label: "操作",
prop: "operate",
align: "center",
minWidth: 90,
fixed: "right",
render: (h, params) => {
let operateData = []
if (params.row.status == "1") {
operateData = [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
on: {
click() {
viewRow(params);
},
},
},
"查看"
),
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-edit",
},
on: {
click() {
editRow(params);
},
},
},
"修改"
),
h(
"el-button",
{
style: {
color: "#ff4949",
},
props: {
type: "text",
size: "mini",
icon: "el-icon-delete",
},
on: {
click() {
deleteRow(params);
},
},
},
"删除"
),
];
}else{
operateData = [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
on: {
click() {
viewRow(params);
},
},
},
"查看"
),
];
}
return h("div", operateData);
},
},
];
......@@ -100,11 +100,6 @@
}}<i class="el-icon-link"></i> </el-link>
</template>
<template slot="optionColumn">
<!-- <el-table-column label="是否为ET86航线" align="center">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.isEtesRoute" @change="checkboxIsEtesRoute(scope)"></el-checkbox>
</template>
</el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" style="color:#ff4949" icon="el-icon-delete"
......@@ -349,22 +344,6 @@ export default {
this.flightDel([val.id])
} else if (this.tableName === '航线') {
this.routeDel({ data: [val], id: [val.id] })
/*
如果该航线是普通航线直接删,如果是ET86航线,那么要查询该航线有没有设置维度,
如果没有直接删,如果已经设置了维度是否考虑将该航线下的维度删掉再进行操作;
*/
if(!val.isEtesRoute){ // 普通航线
this.routeDel({ data: [val], id: [val.id] })
}else{ // ET86航线
this.$confirm("该航线是ET86航线。是否要删除", "注意!", {
closeOnClickModal: false,
confirmButtonText: "确定删除",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.routeDel({ data: [val], id: [val.id] })
}).catch(() => { })
}
} else {
this.dicDel([val.id])
}
......