| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 | 
							- <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 && currentNode.type == 0">新增</el-button>
 
-           <el-button type="warning" @click="remove(tableCheckItems)" :disabled="tableCheckItems.length == 0">删除</el-button>
 
-           <el-button type="primary">导入模板</el-button>
 
-           <el-button type="primary">导出模板</el-button>
 
-         </div>
 
-         <div class="view-dataType-title-search">
 
-           <el-input placeholder="请输入关键字" v-model="keyWord" class="input1">
 
-             <el-button slot="append" icon="el-icon-search" @click="searchClick"></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="diagnosisId">
 
-             <el-input v-model="form.diagnosisId" placeholder="请输入故障诊断编号" />
 
-           </el-form-item>
 
-           <el-form-item label="架次号" prop="sortieNo">
 
-             <el-input v-model="form.sortieNo" placeholder="请输入架次号" />
 
-           </el-form-item>
 
-           <el-form-item label="机号" prop="aircraftId">
 
-             <el-input v-model="form.aircraftId" 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>
 
-       </el-dialog>
 
-     </div>
 
-   </div>
 
- </template>
 
- <script>
 
- import { getFaultDiagnosisResult, getAircaftTypeAndModelTree, addFaultDiagnosisResult, updateFaultDiagnosisResult, removeFaultDiagnosisResult } from '@/api/als/faultDiagnosisResult'
 
- import { deepClone, debounce } from '@/utils/index'
 
- export default {
 
-   name: 'FaultDiagnosisResult',
 
-   components: {},
 
-   data() {
 
-     // 这里存放数据
 
-     return {
 
-       dialogTitle: '新增',
 
-       dialogVisible: false,
 
-       keyWord: '',
 
-       aircaftModelIdList: [],
 
-       currentNodeKey: null,
 
-       currentNode: null,
 
-       menuTreeData: [],
 
-       treeObj: {
 
-         title: '所属机种',
 
-         activityheight: '275px',
 
-         searchIcon: false,
 
-         configure: {
 
-           children: 'children',
 
-           label: 'label'
 
-         }
 
-       },
 
-       typeTree: {
 
-         children: 'children',
 
-         label: 'label'
 
-       },
 
-       searchValue: '',
 
-       columns: [
 
-         { prop: 'id', label: '编号' },
 
-         {
 
-           prop: 'diagnosisId',
 
-           label: '故障诊断编号'
 
-         },
 
-         {
 
-           prop: 'sortieNo',
 
-           label: '架次号'
 
-         },
 
-         {
 
-           prop: 'aircraftId',
 
-           label: '机号'
 
-         },
 
-         {
 
-           prop: 'status',
 
-           label: '状态'
 
-         },
 
-         {
 
-           button: true,
 
-           label: '操作',
 
-           width: '240px',
 
-           group: [
 
-             {
 
-               name: '编辑',
 
-               type: 'text',
 
-               round: false,
 
-               plain: false,
 
-               onClick: (row, index, scope) => {
 
-                 _this.handUpdate(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: '',
 
-         diagnosisId: '',
 
-         sortieNo: '',
 
-         aircraftId: '',
 
-         status: '',
 
-         tenantId: '',
 
-         version: '',
 
-         delFlag: '',
 
-         createBy: '',
 
-         createTime: '',
 
-         updateBy: '',
 
-         updateTime: ''
 
-       },
 
-       debounceFn: debounce(this.fetch, 500)
 
-     }
 
-   },
 
-   watch: {
 
-     keyWord() {
 
-       this.tableRequset.pageIndex = 1
 
-       this.debounceFn()
 
-     }
 
-   },
 
-   mounted() {
 
-     this.getAircaftTypeAndModelTreeAPI()
 
-   },
 
-   methods: {
 
-     async getAircaftTypeAndModelTreeAPI(params) {
 
-       const { data } = await getAircaftTypeAndModelTree(params)
 
-       this.menuTreeData = data
 
-       if (data.length) {
 
-         this.currentNodeKey = data[0].value
 
-         this.currentNode = data[0]
 
-         this.aircaftModelIdList = this.getTreeLeafData(data[0]?.children).map((e) => e.id)
 
-         this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-       }
 
-     },
 
-     async removeFaultDiagnosisResultAPI(params) {
 
-       try {
 
-         const { success } = await removeFaultDiagnosisResult(params)
 
-         if (success) {
 
-           this.$message({
 
-             type: 'success',
 
-             message: '操作成功!'
 
-           })
 
-           await this.getFaultDiagnosisResultAPI({ aircaftModelIdList: 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 getFaultDiagnosisResultAPI(params) {
 
-       if (this.$refs.table) this.$refs.table.clearSelection()
 
-       const { keyWord } = this
 
-       const { pageSize, pageIndex } = this.tableRequset
 
-       const {
 
-         data: { list, totalCount }
 
-       } = await getFaultDiagnosisResult({ pageSize, pageIndex, keyWord, ...params })
 
-       this.tableData = list
 
-       this.tableRequset.total = totalCount
 
-     },
 
-     fetch() {
 
-       this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-     },
 
-     searchClick() {
 
-       this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-     },
 
-     async addFaultDiagnosisResultAPI() {
 
-       try {
 
-         delete this.form.aircaftModelName
 
-         const { success } = await addFaultDiagnosisResult({ ...this.form })
 
-         if (success) {
 
-           this.$message({
 
-             type: 'success',
 
-             message: '操作成功!'
 
-           })
 
-           this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-         }
 
-       } catch (error) {}
 
-     },
 
-     async updateFaultDiagnosisResultAPI() {
 
-       try {
 
-         const { success } = await updateFaultDiagnosisResult({ ...this.form })
 
-         if (success) {
 
-           this.$message({
 
-             type: 'success',
 
-             message: '操作成功!'
 
-           })
 
-           this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-         }
 
-       } catch (error) {}
 
-     },
 
-     treeNodeClick(data) {
 
-       this.$refs.table.clearSelection()
 
-       this.currentNodeKey = data.id
 
-       this.currentNode = data
 
-       this.aircaftModelIdList = this.getTreeLeafData(data.children.length ? data.children : [data]).map((e) => e.id)
 
-       this.getFaultDiagnosisResultAPI({ aircaftModelIdList: this.aircaftModelIdList })
 
-     },
 
-     openDialog() {
 
-       this.dialogTitle = '新增'
 
-       this.dialogVisible = true
 
-       this.form.aircaftModelName = this.currentNode.label
 
-       this.form.aircaftModelId = this.currentNode.id
 
-     },
 
-     handleClose() {
 
-       this.dialogVisible = false
 
-       this.form = {
 
-         id: '',
 
-         diagnosisId: '',
 
-         sortieNo: '',
 
-         aircraftId: '',
 
-         status: '',
 
-         tenantId: '',
 
-         version: '',
 
-         delFlag: '',
 
-         createBy: '',
 
-         createTime: '',
 
-         updateBy: '',
 
-         updateTime: ''
 
-       }
 
-     },
 
-     handUpdate(row) {
 
-       this.dialogTitle = '编辑'
 
-       this.form = deepClone(row)
 
-       this.dialogVisible = true
 
-     },
 
-     submit() {
 
-       switch (this.dialogTitle) {
 
-         case '编辑':
 
-           this.updateFaultDiagnosisResultAPI()
 
-           this.handleClose()
 
-           break
 
-         case '新增':
 
-           this.addFaultDiagnosisResultAPI()
 
-           this.handleClose()
 
-           break
 
-       }
 
-     },
 
-     selection(val) {
 
-       this.tableCheckItems = val
 
-     },
 
-     remove(row) {
 
-       this.$confirm('是否删除该数据', '提示', {
 
-         confirmButtonText: '确定',
 
-         cancelButtonText: '取消',
 
-         type: 'warning'
 
-       })
 
-         .then(() => {
 
-           this.removeFaultDiagnosisResultAPI(row.map((e) => e.id))
 
-         })
 
-         .catch(() => {})
 
-     }
 
-   }
 
- }
 
- </script>
 
- <style lang="scss" scoped>
 
- @import '../index.scss';
 
- </style>
 
 
  |