123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- <template>
- <div class="view-table-content">
- <div class="view-dataSpecies-left">
- <MenuTree :currentNodeKey="currentNodeKey" nodeKey="id" :treedata="menuTreeData" @TreeNodeclick="treeNodeClick" v-bind="treeObj"> </MenuTree>
- </div>
- <div class="view-dataSpecies-right">
- <div class="view-dataType-title">
- <div class="view-dataType-title-btn">
- <el-button type="success" @click="openDialog()" :disabled="!(currentNode.type == 1 && currentNode.children.length == 0)">新增</el-button>
- <el-button type="warning" @click="remove(tableCheckItems)" :disabled="tableCheckItems.length == 0">删除</el-button>
- </div>
- <div class="view-dataType-title-search">
- <el-input placeholder="请输入架次号" v-model="keyWordData" class="input1">
- <el-button slot="append" icon="el-icon-search" @click="searchClick" :disabled="!(currentNode.type == 1 && currentNode.children.length == 0)"></el-button>
- </el-input>
- </div>
- </div>
- <div class="view-dataType-table">
- <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="aircraftId">
- <el-select v-model="form.aircraftId" placeholder="请选择编目" @change="changeAircraftId(form.aircraftId)">
- <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.sortieNo" :label="item.sortieNo" :value="item.sortieNo"> </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="模型类型">
- <el-select v-model="form.modelType" placeholder="请选择模型类型" @change="changeModelType(form.modelType)">
- <el-option v-for="item in algoTypeList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- <el-form-item label="模型名称">
- <el-select v-model="form.modelName" placeholder="模型名称">
- <el-option v-for="item in algoNameList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="诊断结果" prop="resultId">
- <el-input v-model="form.resultId" placeholder="请输入诊断结果" />
- </el-form-item>
- <el-form-item label="故障代码" prop="code">
- <el-input v-model="form.code" placeholder="请输入故障代码" />
- </el-form-item>
- <el-form-item label="系统" prop="systemName">
- <el-input v-model="form.systemName" placeholder="请输入系统" />
- </el-form-item>
- <el-form-item label="单位" prop="unitName">
- <el-input v-model="form.unitName" placeholder="请输入单位" />
- </el-form-item>
- <el-form-item label="故障部件" prop="faultPart">
- <el-input v-model="form.faultPart" placeholder="请输入故障部件" />
- </el-form-item>
- <el-form-item label="维修建议" prop="proposal">
- <el-input v-model="form.proposal" placeholder="请输入维修建议" />
- </el-form-item> -->
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClose">取 消</el-button>
- <el-button type="primary" @click="submit">确 定</el-button>
- </span>
- <!-- <div style="height: 200px">维修决策结果及派遣内容</div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClose">派 遣</el-button>
- <el-button type="primary" @click="handleDispatch">确 定</el-button>
- </span> -->
- </el-dialog>
- <el-dialog title="执行进度" :visible.sync="progressVisible" width="800px" :before-close="handleClose">
- <el-progress :text-inside="true" :stroke-width="24" :percentage="percentage" status="success"></el-progress>
- </el-dialog>
- <el-dialog title="结果展示" :visible.sync="resultVisible" width="800px">
- 展示结果
- <span slot="footer" class="dialog-footer">
- <el-button @click="resultVisible = false">取 消</el-button>
- <el-button type="primary" @click="resultVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import { getMaintenanceDecision, addMaintenanceDecision, updateMaintenanceDecision, removeMaintenanceDecision } from '@/api/als/maintenanceDecision'
- import { getAircaftCatalogTree } from '@/api/als/sideTree'
- import { deepClone, debounce } from '@/utils/index'
- import { getAircaftCatalogAll } from '@/api/als/aircraft'
- import { getDataImport } from '@/api/als/dataImport'
- import { getModel } from '@/api/als/model'
- export default {
- name: 'MaintenanceDecision',
- components: {},
- data() {
- // 这里存放数据
- return {
- dialogTitle: '新增',
- dialogVisible: false,
- resultVisible: false,
- progressVisible: false,
- keyWordData: '',
- aircaftModelIdList: [],
- currentNodeKey: '',
- currentNode: {},
- menuTreeData: [],
- treeObj: {
- title: '所属机种',
- activityheight: '275px',
- searchIcon: false,
- configure: {
- children: 'children',
- label: 'label'
- }
- },
- typeTree: {
- children: 'children',
- label: 'label'
- },
- searchValue: '',
- columns: [
- { prop: 'id', label: '编号' },
- {
- prop: 'sortieNo',
- label: '架次号'
- },
- {
- prop: 'aircraftId',
- label: '编目',
- render: (h, params) => {
- const matchedItem = this.aircaftCatalogAll.find((item) => params.row.aircraftId.trim() === item.aircaftCatalogId.trim())
- if (matchedItem) {
- return h('span', matchedItem.aircaftCatalogCode)
- } else {
- return h('span', {}, '')
- }
- }
- },
- {
- prop: 'resultId',
- label: '诊断结果'
- },
- {
- prop: 'code',
- label: '故障代码'
- },
- {
- prop: 'systemName',
- label: '系统'
- },
- {
- prop: 'unitName',
- label: '单位'
- },
- {
- prop: 'faultPart',
- label: '故障部件'
- },
- {
- prop: 'proposal',
- label: '维修建议'
- },
- {
- prop: 'status',
- label: '状态'
- },
- {
- button: true,
- label: '操作',
- width: '240px',
- group: [
- {
- name: '查看',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.checkResult(row)
- }
- },
- // {
- // name: '执行',
- // type: 'text',
- // round: false,
- // plain: false,
- // onClick: (row, index, scope) => {
- // this.executeAglo(row)
- // }
- // },
- {
- name: '删除',
- type: 'text',
- round: false,
- plain: false,
- onClick: (row, index, scope) => {
- this.remove([row])
- }
- }
- ]
- }
- ],
- options: {
- stripe: true, // 斑马纹
- mutiSelect: true, // 多选框
- index: false, // 显示序号, 多选则 mutiSelect
- loading: false, // 表格动画
- initTable: false, // 是否一挂载就加载数据
- border: true,
- height: 'calc(100vh - 300px)'
- },
- tableCheckItems: [],
- tableData: [],
- tableRequset: {
- total: 0,
- pageIndex: 1,
- pageSize: 10,
- searchValue: ''
- },
- form: {
- id: '',
- sortieNo: '',
- aircraftId: '',
- resultId: '',
- code: '',
- systemName: '',
- unitName: '',
- faultPart: '',
- proposal: '',
- status: '',
- tenantId: '',
- version: '',
- delFlag: '',
- createBy: '',
- createTime: '',
- updateBy: '',
- updateTime: ''
- },
- debounceFn: debounce(this.fetch, 500),
- agloForm: {
- sortieNo: '',
- aircraftId: '',
- agloType: '',
- agloName: '',
- paramsList: []
- },
- aircaftCatalogAll: [],
- transferData: [],
- algoTypeList: [{ id: 5, name: '故障诊断' }],
- algoNameList: [],
- percentage: 0,
- sortieNoList: []
- }
- },
- watch: {
- keyWord() {
- this.tableRequset.pageIndex = 1
- this.debounceFn()
- }
- },
- mounted() {
- this.getAircaftCatalogTreeAPI()
- },
- methods: {
- async getAircaftCatalogTreeAPI(params) {
- const { data } = await getAircaftCatalogTree(params)
- this.menuTreeData = data
- const getAircaftCatalogAllParams = {
- keyWord: '',
- aircaftModelIdList: []
- }
- const { data: data2 } = await getAircaftCatalogAll(getAircaftCatalogAllParams)
- this.aircaftCatalogAll = data2
- if (data.length) {
- this.currentNodeKey = data[0].value
- this.currentNode = data[0]
- this.aircaftModelIdList = this.getTreeLeafData(data[0]?.children)
- .map((e) => e.id)
- .toString()
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- // this.getDataImportAPI()
- }
- },
- async removeMaintenanceDecisionAPI(params) {
- try {
- const { code } = await removeMaintenanceDecision(params)
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- await this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- this.handleClose()
- }
- } catch (error) {}
- },
- getTreeLeafData(list) {
- const newArr = []
- function getLeaf(data, arr) {
- data.forEach((e) => {
- if (e.type === 1) {
- arr.push(e)
- }
- if (e.children.length) {
- getLeaf(e.children, arr)
- }
- })
- }
- getLeaf(list, newArr)
- return newArr
- },
- async getMaintenanceDecisionAPI(params) {
- if (this.$refs.table) this.$refs.table.clearSelection()
- const { keyWord } = this
- const { pageSize, pageIndex } = this.tableRequset
- const {
- data: { list, total }
- } = await getMaintenanceDecision({ pageSize, pageNum: pageIndex, ...params })
- this.tableData = list
- this.tableRequset.total = total
- },
- async getDataImportAPI(params) {
- if (this.$refs.table) this.$refs.table.clearSelection()
- const { pageSize, pageIndex } = this.tableRequset
- const {
- data: { list, total }
- } = await getDataImport({ pageSize, pageIndex, aircraftId: params })
- this.tableData = list
- this.tableRequset.total = total
- },
- fetch() {
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- },
- async searchClick() {
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- },
- async addMaintenanceDecisionAPI() {
- try {
- delete this.form.aircaftModelName
- const { code } = await addMaintenanceDecision({ ...this.form })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.dialogVisible = false
- this.progressVisible = true
- const myTimer = setInterval(() => {
- if (this.percentage < 100) {
- this.percentage += 1
- } else {
- this.progressVisible = false
- this.percentage = 0
- clearInterval(myTimer)
- this.$router.push({ name: 'PreResult', params: { agloForm: this.agloForm } })
- this.handleClose()
- // 调用完数据再展示
- this.resultVisible = true
- }
- }, 30)
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- }
- } catch (error) {}
- },
- async updateMaintenanceDecisionAPI() {
- try {
- const { code } = await updateMaintenanceDecision({ ...this.form })
- if (code === 200) {
- this.$message({
- type: 'success',
- message: '操作成功!'
- })
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- }
- } catch (error) {}
- },
- treeNodeClick(data) {
- this.$refs.table.clearSelection()
- this.currentNodeKey = this.form.aircraftId = data.id
- this.currentNode = data
- this.aircaftModelIdList = this.getTreeLeafData(data.children.length ? data.children : [data])
- .map((e) => e.id)
- .toString()
- this.getMaintenanceDecisionAPI({ aircraftId: this.aircaftModelIdList })
- // this.aircaftModelIdList = this.getTreeLeafData(data.children.length ? data.children : [data]).map((e) => e.id)
- // this.getMaintenanceDecisionAPI(this.currentNodeKey)
- // this.getDataImportAPI(this.currentNodeKey)
- },
- openDialog() {
- this.dialogTitle = '新增'
- this.dialogVisible = true
- if (this.form.aircraftId !== '') {
- this.changeAircraftId(this.form.aircraftId)
- }
- },
- handleClose() {
- this.dialogVisible = false
- this.form = {
- id: '',
- sortieNo: '',
- aircraftId: '',
- resultId: '',
- code: '',
- systemName: '',
- unitName: '',
- faultPart: '',
- proposal: '',
- status: '',
- tenantId: '',
- version: '',
- delFlag: '',
- createBy: '',
- createTime: '',
- updateBy: '',
- updateTime: ''
- }
- },
- handUpdate(row) {
- this.dialogTitle = '编辑'
- this.form = deepClone(row)
- this.dialogVisible = true
- },
- checkResult(row) {
- // this.dialogTitle = '维修决策'
- this.form = deepClone(row)
- this.resultVisible = true
- },
- executeAglo(row) {},
- async changeAgloType(type) {
- const {
- data: { list }
- } = await getModel({ type })
- this.algoNameList = list
- },
- async changeAircraftId(aircraftId) {
- const {
- data: { list }
- } = await getDataImport({ aircraftId })
- this.sortieNoList = list
- },
- submit() {
- switch (this.dialogTitle) {
- case '编辑':
- this.updateMaintenanceDecisionAPI()
- this.handleClose()
- break
- case '新增':
- this.addMaintenanceDecisionAPI()
- this.handleClose()
- break
- }
- },
- selection(val) {
- this.tableCheckItems = val
- },
- remove(row) {
- this.$confirm('是否删除该数据', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.removeMaintenanceDecisionAPI(row.map((e) => e.id))
- })
- .catch(() => {})
- },
- handleDispatch() {}
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../index.scss';
- </style>
|