1、全局加载名称调整为MDC智慧车间
2、消息确认页面调整设备异常反馈功能
| | |
| | | <div id="loader"></div> |
| | | <div class="loader-section section-left"></div> |
| | | <div class="loader-section section-right"></div> |
| | | <div class="load_title">æ£å¨å è½½ç»è®¡åæ,请èå¿çå¾
|
| | | <div class="load_title">æ£å¨å è½½MDCæºæ
§è½¦é´,请èå¿çå¾
|
| | | |
| | | </div> |
| | | </div> |
| | |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | |
| | | <a-col :span="6"> |
| | | <a-col :span="4"> |
| | | <a-form-item label="设å¤ç¼å·"> |
| | | <a-input placeholder="请è¾å
¥è®¾å¤ç¼å·" v-model="queryParam.equipmentId"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="6"> |
| | | <a-col :span="4"> |
| | | <a-form-item label="æ¶æ¯ç¶æ"> |
| | | <a-select v-model='queryParam.msgStatus' placeholder="è¯·éæ©æ¶æ¯ç¶æ"> |
| | | <a-select-option v-for="item in msgStatusOptionList" :key="item.value" :value="item.value"> |
| | | {{item.title}} |
| | | </a-select-option> |
| | | <j-dict-select-tag dictCode="mdcMsgStatus" v-model='queryParam.msgStatus' placeholder="è¯·éæ©æ¶æ¯ç¶æ"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="4"> |
| | | <a-form-item label="å¼å¸¸ç±»å"> |
| | | <j-dict-select-tag dictCode="mdcMsgType" v-model='queryParam.msgType' placeholder="è¯·éæ©å¼å¸¸ç±»å"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="4"> |
| | | <a-form-item label="æ¶æ¯æ¥æº"> |
| | | <a-select v-model="queryParam.msgSource" placeholder="è¯·éæ©æ¶æ¯æ¥æº"> |
| | | <a-select-option key="æå¨ä¸æ¥">æå¨ä¸æ¥</a-select-option> |
| | | <a-select-option key="ç³»ç»çæ">ç³»ç»çæ</a-select-option> |
| | | </a-select> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="8"> |
| | | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
| | | <a-col :span="6"> |
| | | <a-space> |
| | | <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> |
| | | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">éç½®</a-button> |
| | | </span> |
| | | <a-button type="primary" @click="searchReset" icon="reload">éç½®</a-button> |
| | | </a-space> |
| | | </a-col> |
| | | |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | |
| | | <!-- æä½æé®åºå· --> |
| | | <div class="table-operator"> |
| | | <a-button @click="handleAdd" type="primary" icon="plus">æ°å¢</a-button> |
| | | </div> |
| | | |
| | | <a-table |
| | |
| | | :loading="loading" |
| | | @change="handleTableChange"> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a @click="showModal(record,0)">æ¥ç</a> |
| | | <a @click="showModal(record,1)">æ¥ç</a> |
| | | <a-divider type="vertical" v-if="record.hasProcess||record.hasConfirm"></a-divider> |
| | | <a @click="showModal(record,1)" v-if="record.hasProcess">䏿¥</a> |
| | | <a-divider type="vertical" v-if="record.hasConfirm&&record.hasProcess"></a-divider> |
| | | <a @click="showModal(record,2)" v-if="record.hasConfirm">确认</a> |
| | | <a @click="showModal(record,2)" v-if="record.hasProcess">䏿¥</a> |
| | | <a @click="showModal(record,3)" v-if="record.hasConfirm">确认</a> |
| | | <!--<a @click="showModal(record,0)">æ¥ç</a>--> |
| | | <!--<a-divider type="vertical"></a-divider>--> |
| | | <!--<a @click="showModal(record,1)">䏿¥</a>--> |
| | |
| | | <!--<a @click="showModal(record,2)">确认</a>--> |
| | | </span> |
| | | </a-table> |
| | | <mdc-message-approval-modal ref="modalRef" :title="modalTitle" :visible="modalVisible" :buttonId="buttonId" |
| | | <mdc-message-approval-modal ref="modalForm" :title="modalTitle" :visible="modalVisible" :buttonId="buttonId" |
| | | :disableSubmit="disableSubmit" |
| | | @closeModal="modalVisible = false" @formHasSubmitted="loadData"/> |
| | | </a-card> |
| | | </template> |
| | |
| | | queryParam: {}, |
| | | columns: [ |
| | | { |
| | | title: 'æ¶æ¯æ¥æº', |
| | | align: 'center', |
| | | dataIndex: 'msgSource', |
| | | width: 150 |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | align: 'center', |
| | | dataIndex: 'equipmentId' |
| | | dataIndex: 'equipmentId', |
| | | width: 150 |
| | | }, |
| | | { |
| | | title: 'å¼å¸¸ç±»å', |
| | | align: 'center', |
| | | dataIndex: 'msgType', |
| | | width: 150 |
| | | }, |
| | | { |
| | | title: 'æ é¢', |
| | | align: 'center', |
| | | dataIndex: 'titile' |
| | | }, { |
| | | }, |
| | | { |
| | | title: 'å
容', |
| | | align: 'center', |
| | | dataIndex: 'msgContent', |
| | | width: 450 |
| | | }, { |
| | | dataIndex: 'msgContent' |
| | | }, |
| | | { |
| | | title: 'åå ', |
| | | align: 'center', |
| | | dataIndex: 'reportContent', |
| | | width: 450 |
| | | }, { |
| | | title: 'å¤ç人', |
| | | dataIndex: 'reportContent' |
| | | }, |
| | | { |
| | | title: 'åé¦äºº', |
| | | align: 'center', |
| | | dataIndex: 'senderNames' |
| | | }, { |
| | | dataIndex: 'senderNames', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: '确认人', |
| | | align: 'center', |
| | | dataIndex: 'approverNames' |
| | | }, { |
| | | dataIndex: 'approverNames', |
| | | width: 120 |
| | | }, |
| | | { |
| | | title: 'ç¶æ', |
| | | align: 'center', |
| | | dataIndex: 'msgStatus', |
| | | customRender: function(text) { |
| | | if (text == '0') { |
| | | return 'å¾
å¤ç' |
| | | } else if (text == '1') { |
| | | return 'å¾
确认' |
| | | } else if (text == '2') { |
| | | return '已确认' |
| | | } else { |
| | | return 'å·²æç»' |
| | | } |
| | | } |
| | | }, { |
| | | dataIndex: 'msgStatus_dictText', |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | scopedSlots: { customRender: 'action' } |
| | | }], |
| | | } |
| | | ], |
| | | url: { |
| | | list: '/mdc/mdcMessageApproval/list' |
| | | }, |
| | |
| | | msgStatusOptionList: [], |
| | | modalTitle: '', |
| | | modalVisible: false, |
| | | disableSubmit: false, |
| | | buttonId: null |
| | | } |
| | | }, |
| | | created() { |
| | | this.initDictData('mdcMsgStatus') |
| | | }, |
| | | methods: { |
| | | /** |
| | | * è°ç¨æ¥å£è·åæ°æ®åå
¸é
ç½®msgStatus |
| | | * @param dictCode æ°æ®åå
¸ç¼å· |
| | | */ |
| | | initDictData(dictCode) { |
| | | //æ ¹æ®åå
¸Code, åå§ååå
¸æ°ç» |
| | | ajaxGetDictItems(dictCode, null).then((res) => { |
| | | if (res.success) { |
| | | console.log('res================', res) |
| | | this.msgStatusOptionList = res.result |
| | | } |
| | | }) |
| | | handleAdd() { |
| | | this.modalTitle = 'æ°å¢' |
| | | this.buttonId = null |
| | | this.disableSubmit = false |
| | | this.$refs.modalForm.formParams = {} |
| | | this.modalVisible = true |
| | | }, |
| | | |
| | | /** |
| | |
| | | */ |
| | | showModal(record, buttonId) { |
| | | this.buttonId = buttonId |
| | | this.disableSubmit = true |
| | | switch (buttonId) { |
| | | case 0: |
| | | case 1: |
| | | this.modalTitle = 'æ¶æ¯å
容' |
| | | break |
| | | case 1: |
| | | case 2: |
| | | this.modalTitle = '䏿¥åå ' |
| | | break |
| | | case 2: |
| | | case 3: |
| | | this.modalTitle = 'ç¡®è®¤æ¶æ¯' |
| | | break |
| | | default: |
| | | this.modalTitle = 'æ¶æ¯å
容' |
| | | } |
| | | this.$refs.modalRef.formParams = Object.assign({}, record) |
| | | this.$refs.modalForm.formParams = Object.assign({}, record) |
| | | this.modalVisible = true |
| | | } |
| | | } |
| | |
| | | @cancel="closeModal" |
| | | :visible="visible" |
| | | :footer="null"> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form-model ref="form" :form="form" :model="formParams" :rules="validatorRules"> |
| | | <a-form-model-item label="设å¤ç¼å·" :labelCol="{span: 4}" :wrapperCol="{span: 8}"> |
| | | <a-input v-model="formParams.equipmentId" disabled></a-input> |
| | | <a-spin :spinning="spinning"> |
| | | <a-form-model ref="form" :form="form" :model="formParams" :rules="validatorRules" :labelCol="{span: 4}" |
| | | :wrapperCol="{span: 20}"> |
| | | <a-form-model-item label="设å¤ç¼å·" :labelCol="{span: 4}" :wrapperCol="{span: 10}" prop="equipmentId"> |
| | | <a-input-search :readOnly="true" :disabled="disableSubmit" v-model="formParams.equipmentId" |
| | | @search="deviceSearch" enter-button |
| | | placeholder="è¯·éæ©è®¾å¤"/> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="æ é¢" :labelCol="{span: 4}" :wrapperCol="{span: 20}"> |
| | | <a-input v-model="formParams.titile" disabled></a-input> |
| | | <a-form-model-item label="å¼å¸¸ç±»å" :labelCol="{span: 4}" :wrapperCol="{span: 10}" |
| | | :prop="!buttonId?'msgType':''"> |
| | | <j-dict-select-tag dictCode="mdcMsgType" v-model='formParams.msgType' placeholder="è¯·éæ©å¼å¸¸ç±»å" |
| | | :disabled="disableSubmit&&buttonId!==2"/> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="å
容" :labelCol="{span: 4}" :wrapperCol="{span: 20}"> |
| | | <a-input v-model="formParams.msgContent" disabled></a-input> |
| | | <a-form-model-item label="æ é¢"> |
| | | <a-input placeholder="请è¾å
¥æ é¢" v-model="formParams.titile" :disabled="disableSubmit"/> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="å
容"> |
| | | <a-input placeholder="请è¾å
¥å
容" v-model="formParams.msgContent" :disabled="disableSubmit"/> |
| | | </a-form-model-item> |
| | | |
| | | <a-form-model-item label="åå " :labelCol="{span: 4}" :wrapperCol="{span: 20}" prop="reportContent" |
| | | v-if="buttonId===1"> |
| | | <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="åå " :labelCol="{span: 4}" :wrapperCol="{span: 20}" v-else> |
| | | <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea> |
| | | <a-form-model-item label="åå " prop="reportContent" v-if="buttonId"> |
| | | <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==2"/> |
| | | </a-form-model-item> |
| | | |
| | | <a-form-model-item label="确认" :labelCol="{span: 4}" :wrapperCol="{span: 12}" prop="isConfirm" |
| | | v-if="buttonId==2"> |
| | | v-if="buttonId==3"> |
| | | <a-select v-model='formParams.isConfirm' placeholder="è¯·éæ©æ¯å¦ç¡®è®¤"> |
| | | <a-select-option value="2">确认</a-select-option> |
| | | <a-select-option value="3">æç»</a-select-option> |
| | |
| | | </a-form-model> |
| | | </a-spin> |
| | | |
| | | <div class="drawer-bottom-button" v-show="buttonId!==0"> |
| | | <a-popconfirm title="ç¡®å®æ¾å¼æä½ï¼" @confirm="closeModal" okText="ç¡®å®" cancelText="åæ¶"> |
| | | <a-button style="margin-right: .8rem">åæ¶</a-button> |
| | | </a-popconfirm> |
| | | <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">æäº¤</a-button> |
| | | <div class="drawer-bottom-button" v-show="buttonId!==1"> |
| | | <a-space> |
| | | <a-popconfirm title="ç¡®å®æ¾å¼æä½ï¼" @confirm="closeModal" okText="ç¡®å®" cancelText="åæ¶"> |
| | | <a-button>åæ¶</a-button> |
| | | </a-popconfirm> |
| | | <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">æäº¤</a-button> |
| | | </a-space> |
| | | </div> |
| | | |
| | | <SelectDeviceDrawerSingleSelection ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'éæ©è®¾å¤'"/> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { postAction } from '@/api/manage' |
| | | import SelectDeviceDrawerSingleSelection from './SelectDeviceDrawer-SingleSelection' |
| | | |
| | | export default { |
| | | name: 'MdcMessageApprovalModal', |
| | | components: { SelectDeviceDrawerSingleSelection }, |
| | | props: { |
| | | visible: { |
| | | type: Boolean |
| | |
| | | }, |
| | | buttonId: { |
| | | type: Number |
| | | }, |
| | | disableSubmit: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | form: this.$form.createForm(this), |
| | | treeData: [], |
| | | treeDefaultExpandedKeys: [], |
| | | formParams: { |
| | | equipmentId: '', |
| | | titile: '', |
| | |
| | | isConfirm: '' |
| | | }, |
| | | confirmLoading: false, |
| | | spinning: false, |
| | | validatorRules: { |
| | | equipmentId: [ |
| | | { required: true, message: 'è¯·éæ©è®¾å¤', trigger: 'change' } |
| | | ], |
| | | msgType: [ |
| | | { required: true, message: 'è¯·éæ©å¼å¸¸ç±»å' } |
| | | ], |
| | | reportContent: [ |
| | | { required: true, message: '请è¾å
¥ä¸æ¥åå ' } |
| | | ], |
| | |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/mdc/mdcMessageApproval/add', |
| | | reportUrl: '/mdc/mdcMessageApproval/reportReason', |
| | | confirmUrl: '/mdc/mdcMessageApproval/handleConfirm' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | closeModal() { |
| | | this.$refs.form.clearValidate() |
| | | this.$emit('closeModal') |
| | | deviceSearch() { |
| | | this.$refs.selectDeviceDrawer.visible = true |
| | | this.$refs.selectDeviceDrawer.checkedKeys = this.formParams.equipmentId ? [this.formParams.equipmentId] : [] |
| | | this.$refs.selectDeviceDrawer.selectedKeys = this.formParams.equipmentId ? [this.formParams.equipmentId] : [] |
| | | }, |
| | | |
| | | /** |
| | | * 鿩已æè®¾å¤åç¹å»ç¡®å®æ¶è§¦å |
| | | * @param data 已鿩çè®¾å¤ |
| | | */ |
| | | selectOK(data) { |
| | | this.$set(this.formParams, 'equipmentId', data[0]) |
| | | }, |
| | | |
| | | handleSubmit() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | that.confirmLoading = that.spinning = true |
| | | this.formParams.msgStatus = this.formParams.isConfirm |
| | | let obj |
| | | if (this.buttonId === 1) { |
| | | obj = postAction(this.url.reportUrl, this.formParams) |
| | | if (!this.buttonId) { |
| | | obj = postAction(this.url.add, this.formParams) |
| | | } else { |
| | | obj = postAction(this.url.confirmUrl, this.formParams) |
| | | if (this.buttonId === 2) { |
| | | obj = postAction(this.url.reportUrl, this.formParams) |
| | | } else { |
| | | obj = postAction(this.url.confirmUrl, this.formParams) |
| | | } |
| | | } |
| | | |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | | that.$notification.success({ |
| | |
| | | description: res.message |
| | | }) |
| | | that.$emit('formHasSubmitted') |
| | | that.closeModal() |
| | | } else { |
| | | that.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | that.closeModal() |
| | | that.confirmLoading = that.spinning = false |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | closeModal() { |
| | | this.$refs.form.clearValidate() |
| | | this.$emit('closeModal') |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-drawer |
| | | :title="title" |
| | | :visible="visible" |
| | | width="500" |
| | | @ok="handleOk" |
| | | @close="handleCancel" |
| | | > |
| | | |
| | | <a-spin :spinning="loading"> |
| | | <!-- showLine --> |
| | | <a-form> |
| | | <a-form-item> |
| | | <a-input-search @search="handleSearch" style="width:100%;" placeholder="æ£ç´¢ ç±»å«ç¼ç /åç§°" allowClear |
| | | v-model="searchInput" @change="handleSearch"/> |
| | | </a-form-item> |
| | | <a-form-item label="车é´å±çº§ï¼"> |
| | | <a-tree showLine ref="tree" :expandedKeys.sync="expandedKeys" :selectedKeys="selectedKeys" |
| | | :autoExpandParent="autoExpandParent" checkStrictly |
| | | :treeData="treeDataSource" checkable @check="onCheck" @select="onSelect" v-model="checkedKeys" |
| | | @expand="onExpand"> |
| | | <template slot="title" slot-scope="{ title, parentId, entity, key}"> |
| | | <span v-if="title.indexOf(searchValue) > -1">{{ title.substr(0, title.indexOf(searchValue)) }} |
| | | <span class="replaceSearch">{{ searchValue }}</span> |
| | | {{ title.substr(title.indexOf(searchValue) + searchValue.length) }} |
| | | </span> |
| | | <span v-else>{{ title }}</span> |
| | | </template> |
| | | </a-tree> |
| | | </a-form-item> |
| | | </a-form> |
| | | |
| | | </a-spin> |
| | | |
| | | <div class="drawer-bottom-button"> |
| | | <a-dropdown |
| | | style="float: left" |
| | | :trigger="['click']" |
| | | placement="topCenter" |
| | | > |
| | | <a-menu slot="overlay"> |
| | | <a-menu-item key="1" @click="expandedKeys=allTreeKeys">å±å¼ææ</a-menu-item> |
| | | <a-menu-item key="2" @click="expandedKeys=['-1']">åå¹¶ææ</a-menu-item> |
| | | <a-menu-item key="3" @click="queryTreeData">å·æ°</a-menu-item> |
| | | </a-menu> |
| | | <a-button> |
| | | æ æä½ |
| | | <a-icon type="up"/> |
| | | </a-button> |
| | | </a-dropdown> |
| | | <a-popconfirm title="ç¡®å®æ¾å¼ç¼è¾ï¼" @confirm="handleCancel" okText="ç¡®å®" cancelText="åæ¶"> |
| | | <a-button style="margin-right: .8rem">å
³é</a-button> |
| | | </a-popconfirm> |
| | | <a-button @click="handleOk" type="primary">ç¡®å®</a-button> |
| | | </div> |
| | | </a-drawer> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction, postAction, deleteAction } from '@/api/manage' |
| | | import { mapActions } from 'vuex' |
| | | |
| | | export default { |
| | | name: 'SelectDeviceDrawer-SingleSelection', |
| | | props: { |
| | | editDisable: { |
| | | type: Boolean, |
| | | default() { |
| | | return true |
| | | } |
| | | }, |
| | | title: { |
| | | type: String |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | searchInput: '', |
| | | searchValue: '', |
| | | cardLoading: false, |
| | | loading: false, |
| | | treeDataSource: [], |
| | | expandedKeys: [], |
| | | checkedKeys: [], |
| | | selectedKeys: [], |
| | | autoExpandParent: true, |
| | | dataList: [], |
| | | allTreeKeys: [], |
| | | visible: false, |
| | | dataSource: [] |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryTreeData() |
| | | }, |
| | | methods: { |
| | | ...mapActions(['QueryProduction']), |
| | | |
| | | queryTreeData() { |
| | | this.loading = true |
| | | this.cardLoading = true |
| | | this.QueryProduction().then(res => { |
| | | if (res.success) { |
| | | this.dataList = [] |
| | | this.allTreeKeys = [] |
| | | this.getTreeDataSource(res.result) |
| | | this.treeDataSource = res.result |
| | | this.generateList(this.treeDataSource) |
| | | this.expandedKeys = this.allTreeKeys |
| | | } else { |
| | | this.$message.warn(res.message) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | this.cardLoading = false |
| | | }) |
| | | }, |
| | | |
| | | generateList(data) { |
| | | for (let i = 0; i < data.length; i++) { |
| | | const node = data[i] |
| | | const key = node.key |
| | | const title = node.title |
| | | this.dataList.push({ |
| | | key, |
| | | title: title |
| | | }) |
| | | this.allTreeKeys.push(key) |
| | | if (node.children) { |
| | | this.generateList(node.children) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | handleSearch(value) { |
| | | let search = this.searchInput |
| | | let expandedKeys = this.dataList |
| | | .map(item => { |
| | | if (item.title != null) { |
| | | if (item.title.indexOf(search) > -1) { |
| | | return this.getParentKey(item.key, this.treeDataSource) |
| | | } |
| | | return null |
| | | } |
| | | }) |
| | | .filter((item, i, self) => item && self.indexOf(item) === i) |
| | | console.log('expandedKeys', expandedKeys) |
| | | Object.assign(this, { |
| | | expandedKeys, |
| | | searchValue: search, |
| | | autoExpandParent: true |
| | | }) |
| | | }, |
| | | |
| | | getParentKey(key, tree) { |
| | | let parentKey |
| | | for (let i = 0; i < tree.length; i++) { |
| | | const node = tree[i] |
| | | if (node.children) { |
| | | if (node.children.some(item => item.key === key)) { |
| | | parentKey = node.key |
| | | } else if ( |
| | | this.getParentKey(key, node.children)) { |
| | | parentKey = this.getParentKey(key, node.children) |
| | | } |
| | | } |
| | | } |
| | | return parentKey |
| | | }, |
| | | |
| | | getTreeDataSource(data) { |
| | | data.forEach(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | this.getTreeDataSource(item.children) |
| | | } |
| | | item.key = item.equipmentId ? item.equipmentId : item.key |
| | | item.value = item.equipmentId ? item.equipmentId : item.value |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * å¤éæ¡é䏿¶è§¦å |
| | | * @param selectedKeys æ èç¹éä¸å表ï¼checkäºä»¶ç¬¬ä¸ä¸ªåæ°æªç¨å°ï¼æ¤åæ°æ¯ç±selectäºä»¶ä¼ å
¥çï¼ |
| | | * @param event å¤éæ¡äºä»¶å¯¹è±¡ |
| | | */ |
| | | onCheck(selectedKeys, event) { |
| | | let checkedKeys |
| | | if (event) checkedKeys = event.checkedNodes.filter(item => item.data.props.equipmentId).map(item => item.data.props.equipmentId) |
| | | else checkedKeys = selectedKeys |
| | | this.checkedKeys = this.selectedKeys = checkedKeys.slice(-1) |
| | | }, |
| | | |
| | | /** |
| | | * æ èç¹é䏿¶è§¦å |
| | | * @param selectedKeys æ èç¹éä¸å表ï¼ä¼ å
¥checkäºä»¶ç¬¬ä¸ä¸ªåæ°ï¼ |
| | | * @param event æ èç¹éä¸äºä»¶å¯¹è±¡ |
| | | */ |
| | | onSelect(selectedKeys, event) { |
| | | if (event.selectedNodes[0].data.props.equipmentId) this.onCheck(selectedKeys) |
| | | }, |
| | | |
| | | /** |
| | | * æ å±å¼åå¹¶æ¶è§¦å |
| | | * @param expandedKeys |
| | | */ |
| | | onExpand(expandedKeys) { |
| | | this.expandedKeys = expandedKeys |
| | | this.autoExpandParent = false |
| | | }, |
| | | |
| | | handleOk() { |
| | | this.$emit('selectFinished', this.checkedKeys) |
| | | this.handleCancel() |
| | | }, |
| | | |
| | | handleCancel() { |
| | | this.visible = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .replaceSearch { |
| | | color: #40a9ff; |
| | | font-weight: bold; |
| | | background-color: rgb(204, 204, 204); |
| | | } |
| | | |
| | | .drawer-bottom-button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | width: 100%; |
| | | border-top: 1px solid #e8e8e8; |
| | | padding: 10px 16px; |
| | | text-align: right; |
| | | left: 0; |
| | | background: #fff; |
| | | border-radius: 0 0 2px 2px; |
| | | } |
| | | </style> |