|
@@ -19,36 +19,76 @@
|
|
|
<LTable ref="table" @selection-change="selection" :defaultFetch="false" :fetch="fetch" :columns="columns" :dataSource="tableData" :options="options" :pagination="tableRequset"></LTable>
|
|
|
</div>
|
|
|
<!-- 添加或修改飞参数据信息对话框 -->
|
|
|
- <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
|
|
|
- <el-form ref="form" :model="form" label-width="80px">
|
|
|
- <!-- <el-form-item label="文件编号" prop="ossId">
|
|
|
- <el-input v-model="form.ossId" placeholder="请输入文件编号" />
|
|
|
- </el-form-item> -->
|
|
|
- <el-form-item label="数据源" prop="source">
|
|
|
- <el-select v-model="form.source" placeholder="请选择数据源" disabled>
|
|
|
- <el-option label="飞参数据" value="1"></el-option>
|
|
|
- <el-option label="MDC数据" value="2"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="机型" prop="aircaftModel">
|
|
|
- <el-select v-model="form.aircaftModel" placeholder="请选择机型" disabled>
|
|
|
- <el-option v-for="item in aircaftModelAll" :key="item.aircaftModelId" :label="item.aircaftModelName" :value="item.aircaftModelId"> </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <!-- 编目 = 机号 -->
|
|
|
- <el-form-item label="编目" prop="aircraftId">
|
|
|
- <el-select v-model="form.aircraftId" placeholder="请选择编目" disabled>
|
|
|
- <el-option v-for="item in aircaftCatalogAll" :key="item.aircaftCatalogId" :label="item.aircaftCatalogCode" :value="item.aircaftCatalogId"> </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="架次号" prop="sortieNo">
|
|
|
- <el-select v-model="form.sortieNo" placeholder="请选择架次号">
|
|
|
- <el-option v-for="item in sortieNoList" :key="item.taskId" :label="item.taskName" :value="item.taskId"> </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="数据导入" prop="ossId">
|
|
|
- <FileUpload v-model="form.ossId" :limit="1" :fileSize="500" :fileType="['xls', 'xlsx']" />
|
|
|
- </el-form-item>
|
|
|
+ <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="1000px" :before-close="handleClose">
|
|
|
+ <el-form ref="form" :inline="true" :rules="rules" :model="form" label-width="80px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="数据源" prop="source">
|
|
|
+ <el-select v-model="form.source" placeholder="请选择数据源" disabled>
|
|
|
+ <el-option label="飞参数据" value="1"></el-option>
|
|
|
+ <el-option label="MDC数据" value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="机型" prop="aircaftModel">
|
|
|
+ <el-select v-model="form.aircaftModel" placeholder="请选择机型" disabled>
|
|
|
+ <el-option v-for="item in aircaftModelAll" :key="item.aircaftModelId" :label="item.aircaftModelName" :value="item.aircaftModelId"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="编目" prop="aircraftId">
|
|
|
+ <el-select v-model="form.aircraftId" placeholder="请选择编目" disabled>
|
|
|
+ <el-option v-for="item in aircaftCatalogAll" :key="item.aircaftCatalogId" :label="item.aircaftCatalogCode" :value="item.aircaftCatalogId"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="飞行时间" prop="flightDate">
|
|
|
+ <el-date-picker v-model="form.flightDate" type="datetime" placement="bottom-start" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择飞行时间" @change="flightDateChange"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="架次号" prop="sortieNo">
|
|
|
+ <el-input disabled v-model="form.sortieNo" placeholder="选择飞行时间自动生成" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="上传飞参数据" label-width="100px" prop="ossId">
|
|
|
+ <FileUpload v-model="form.ossId" :limit="1" :fileSize="500" :fileType="['xls', 'xlsx']" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="警告列表导入" label-width="100px">
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xlsx, .xls"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport + '&sortieNo=' + form.sortieNo"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="false"
|
|
|
+ :file-list="warnFileList"
|
|
|
+ >
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
+ <div class="el-upload__tip text-center" slot="tip">
|
|
|
+ <div class="el-upload__tip" slot="tip"><el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的数据</div>
|
|
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
+ <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -67,7 +107,8 @@ import { getAircaftModelAll, getAircaftCatalogAll, getSortieNo } from '@/api/als
|
|
|
import { getTaskExecondRegister } from '@/api/carrierStandard/carrierListExecutionRegistration'
|
|
|
import { deepClone, debounce } from '@/utils/index'
|
|
|
import FileUpload from '@/views/als/components/FileUpload'
|
|
|
-import { flattenTree } from '../utils/common'
|
|
|
+import { flattenTree, download } from '../utils/common'
|
|
|
+import { getItem } from '@/utils/index'
|
|
|
|
|
|
export default {
|
|
|
name: 'DataImport',
|
|
@@ -92,6 +133,14 @@ export default {
|
|
|
label: 'label'
|
|
|
}
|
|
|
},
|
|
|
+ rules: {
|
|
|
+ source: [{ required: true, message: '数据源不能为空', trigger: 'change' }],
|
|
|
+ aircaftModel: [{ required: true, message: '机型不能为空', trigger: 'change' }],
|
|
|
+ aircraftId: [{ required: true, message: '编目不能为空', trigger: 'change' }],
|
|
|
+ flightDate: [{ required: true, message: '飞行时间不能为空', trigger: 'change' }],
|
|
|
+ sortieNo: [{ required: true, message: '飞架次号不能为空', trigger: 'blur' }],
|
|
|
+ ossId: [{ required: true, message: '飞参数据不能为空', trigger: 'change' }]
|
|
|
+ },
|
|
|
typeTree: {
|
|
|
children: 'children',
|
|
|
label: 'label'
|
|
@@ -112,15 +161,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
prop: 'sortieNo',
|
|
|
- label: '架次号',
|
|
|
- render: (h, params) => {
|
|
|
- const matchedItem = this.allTaskExecond.find((item) => params.row.sortieNo.trim() === item.taskId.trim())
|
|
|
- if (matchedItem) {
|
|
|
- return h('span', matchedItem.taskName)
|
|
|
- } else {
|
|
|
- return h('span', {}, '')
|
|
|
- }
|
|
|
- }
|
|
|
+ label: '架次号'
|
|
|
},
|
|
|
{
|
|
|
prop: 'source',
|
|
@@ -201,7 +242,22 @@ export default {
|
|
|
aircaftModelAll: [],
|
|
|
aircaftCatalogAll: [],
|
|
|
sortieNoList: [],
|
|
|
- allTaskExecond: []
|
|
|
+ allTaskExecond: [],
|
|
|
+ upload: {
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 弹出层标题
|
|
|
+ title: '',
|
|
|
+ // 是否禁用上传
|
|
|
+ isUploading: false,
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
+ updateSupport: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: getItem('token') },
|
|
|
+ // 上传的地址
|
|
|
+ url: '/api/als/warning/importData'
|
|
|
+ },
|
|
|
+ warnFileList: []
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -308,8 +364,8 @@ export default {
|
|
|
message: '操作成功!'
|
|
|
})
|
|
|
this.handleClose()
|
|
|
- this.submitBtnLoading = false
|
|
|
this.getDataImportAPI({ aircraftId: this.aircaftModelIdList })
|
|
|
+ this.submitBtnLoading = false
|
|
|
}
|
|
|
} catch (error) {}
|
|
|
},
|
|
@@ -387,16 +443,21 @@ export default {
|
|
|
},
|
|
|
|
|
|
submit() {
|
|
|
- switch (this.dialogTitle) {
|
|
|
- case '编辑':
|
|
|
- this.submitBtnLoading = true
|
|
|
- this.updateDataImportAPI()
|
|
|
- break
|
|
|
- case '新增':
|
|
|
- this.submitBtnLoading = true
|
|
|
- this.addDataImportAPI()
|
|
|
- break
|
|
|
- }
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ switch (this.dialogTitle) {
|
|
|
+ case '编辑':
|
|
|
+ this.submitBtnLoading = true
|
|
|
+ this.updateDataImportAPI()
|
|
|
+ break
|
|
|
+ case '新增':
|
|
|
+ this.submitBtnLoading = true
|
|
|
+ this.submitFileForm()
|
|
|
+ this.addDataImportAPI()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
selection(val) {
|
|
@@ -413,6 +474,48 @@ export default {
|
|
|
this.removeDataImportAPI(row.map((e) => e.id))
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ flightDateChange() {
|
|
|
+ this.form.sortieNo = this.getTime('JC')
|
|
|
+ // this.form.sortieNo = this.getTime() + '-' + obj?.model
|
|
|
+ },
|
|
|
+ getTime(prefix) {
|
|
|
+ const now = new Date()
|
|
|
+ const year = now.getFullYear()
|
|
|
+ const month = ('0' + (now.getMonth() + 1)).slice(-2)
|
|
|
+ const day = ('0' + now.getDate()).slice(-2)
|
|
|
+ const hours = ('0' + now.getHours()).slice(-2)
|
|
|
+ const minutes = ('0' + now.getMinutes()).slice(-2)
|
|
|
+ const seconds = ('0' + now.getSeconds()).slice(-2)
|
|
|
+
|
|
|
+ const dateString = `${year}${month}${day}${hours}${minutes}${seconds}` // 返回格式化的单号
|
|
|
+
|
|
|
+ return `${prefix}-${dateString}`
|
|
|
+ },
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ handleImport() {
|
|
|
+ this.upload.title = '警告列表导入'
|
|
|
+ this.upload.open = true
|
|
|
+ },
|
|
|
+ /** 下载模板操作 */
|
|
|
+ importTemplate() {
|
|
|
+ download('/warning/importTemplate', {}, `warning_template_${new Date().getTime()}.xlsx`)
|
|
|
+ },
|
|
|
+ // 文件上传中处理
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
+ this.upload.isUploading = true
|
|
|
+ },
|
|
|
+ // 文件上传成功处理
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
+ this.upload.open = false
|
|
|
+ this.upload.isUploading = false
|
|
|
+ this.$refs.upload.clearFiles()
|
|
|
+ // this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
|
|
|
+ },
|
|
|
+ // 提交上传文件
|
|
|
+ submitFileForm() {
|
|
|
+ this.$refs.upload.submit()
|
|
|
}
|
|
|
}
|
|
|
}
|