¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div class="search"> |
| | | <el-button size="small" type="primary" @click="refreshTableList">å· æ°</el-button> |
| | | <el-button size="small" type="primary" @click="openDia('add')">æ° å¢</el-button> |
| | | </div> |
| | | <div> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | height="calc(100vh - 20em)" @pagination="pagination" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | </div> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="usageTableDia" |
| | | title="设å¤ä¿å
»è®¡å表" width="80%" @close="closeDialog"> |
| | | <div style="display: flex;align-items: center;"> |
| | | <el-button size="small" type="primary" @click="addTableRow" v-if="operationType !== 'check'">æ·»å </el-button> |
| | | <span style="width: 60px;margin-left: 10px">年份ï¼</span> |
| | | <el-date-picker v-model="form.impowerYear" type="year" value-format="yyyy" clearable size="small" format="yyyy" |
| | | placeholder="鿩年" :disabled="operationType === 'check'"> |
| | | </el-date-picker> |
| | | </div> |
| | | <div style="margin: 10px 0"> |
| | | <el-table ref="deviceImpowerDetails" :data="deviceImpowerDetails" id="templateParamTable" row-key="deviceId" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | height="560px" style="width: 100% ;"> |
| | | <el-table-column align="center" header-align="center" label="åºå·" type="index" width="60"></el-table-column> |
| | | <el-table-column label="设å¤åç§°" min-width="170" prop="deviceName"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.deviceName" clearable |
| | | size="small" :disabled="operationType === 'check'"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="设å¤ç¼å·" min-width="140" prop="managementNumber"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.managementNumber" clearable |
| | | size="small" :disabled="operationType === 'check'"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="è§æ ¼åå·" min-width="120" prop="specificationModel"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.specificationModel" clearable |
| | | size="small" :disabled="operationType === 'check'"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ£æµé¡¹ç®" min-width="120" prop="inspectionItem<"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.inspectionItem" clearable size="small" |
| | | :disabled="operationType === 'check'"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="被ææäºº" min-width="160" prop="delegatee"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.delegatedUserArr" |
| | | clearable filterable multiple |
| | | :disabled="operationType === 'check'" |
| | | placeholder="è¯·éæ©" size="small" style="width: 100%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="80" align="center" v-if="operationType !== 'check'"> |
| | | <template slot-scope="scope"> |
| | | <el-button style="color: #f56c6c" type="text" @click="deleteRow(scope.$index)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="closeDialog">å æ¶</el-button> |
| | | <el-button v-if="operationType !== 'check'" :loading="submitFormLoading" type="primary" @click="submitForm">确认</el-button> |
| | | <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary" |
| | | @click="checkStatus(0)">ä¸éè¿</el-button> |
| | | <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary" |
| | | @click="checkStatus(1)">éè¿</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="addEquipDia" title="æ·»å 设å¤" |
| | | width="50%"> |
| | | <div style="display: flex;align-items: center;"> |
| | | <span style="width: 90px;margin-left: 10px">被ææäººï¼</span> |
| | | <el-select v-model="delegatedUser" clearable filterable multiple |
| | | placeholder="è¯·éæ©" size="small" style="width: 100%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.name" :label="item.name" :value="item.name"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" style="width: 100%" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column label="设å¤åç§°" prop="label" width="190"></el-table-column> |
| | | <el-table-column prop="value" label="设å¤ç¼å·" width="130"></el-table-column> |
| | | <el-table-column prop="storagePoint" label="å½å±å®éªå®¤"></el-table-column> |
| | | </el-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="addEquipDia = false">å æ¶</el-button> |
| | | <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">确认</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :visible.sync="notificationDia" title="æäº¤å®¡æ ¸" width="30%" @close="closeNotificationDia"> |
| | | <span style="margin-top: 10px;display: inline-block"> |
| | | è¯·éæ©å®¡æ ¸äººï¼ |
| | | <el-select v-model="auditId" clearable filterable size="small" style="width: 90%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button :loading="notificationLoading" @click="closeNotificationDia">å æ¶</el-button> |
| | | <el-button :loading="notificationLoading" type="primary" @click="notification">æ 交</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import { |
| | | addImpower, |
| | | deleteImpower, deviceScopeSearch, getImpowerDetail, reviewImpowerStatus, |
| | | selectDeviceImpowerByPage, submitReviewImpowerStatus, updateImpower, exportDeviceImpower |
| | | } from "@/api/cnas/resourceDemand/device"; |
| | | import {selectUserCondition} from "@/api/system/user"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: '', |
| | | // import å¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | | components: {limsTable}, |
| | | props: { |
| | | clickNodeVal: { |
| | | type: Object, |
| | | default: () => { |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | // è¿éåæ¾æ°æ® |
| | | return { |
| | | outLoading: false, |
| | | tableData: [], |
| | | tableLoading: false, |
| | | page: { |
| | | total: 0, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | column: [ |
| | | { label: '计å年份', prop: 'impowerYear' }, |
| | | { label: 'ç¼å¶äºº', prop: 'compiler' }, |
| | | { label: 'ç¼å¶æ¶é´', prop: 'datePreparation' }, |
| | | { label: 'ææäºº', prop: 'audit' }, |
| | | { label: 'æææ¥æ', prop: 'auditDate' }, |
| | | { |
| | | dataType: 'tag', |
| | | label: 'ææç¶æ', |
| | | prop: 'status', |
| | | formatData: (params) => { |
| | | if (params === 1) { |
| | | return 'å·²ææ' |
| | | } else if (params == 0) { |
| | | return 'æªææ' |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else if (params === 0) { |
| | | return 'danger' |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | label: 'æä½', |
| | | operation: [ |
| | | { |
| | | name: 'ç¼è¾', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.openDia('edit', row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.status === 1; |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å®¡æ ¸éç¥', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.tellApprove(row.impowerId); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.status === 1; |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å®¡æ ¸', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.openDia('check', row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.status === 1 || this.userId !== row.auditId; |
| | | }, |
| | | }, |
| | | { |
| | | name: '导åº', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.openHandleOut(row); |
| | | } |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.handleDeleteClick(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.status === 1; |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | | responsibleOptions: [], |
| | | operationType: '', |
| | | usageTableDia: false, |
| | | deviceImpowerDetails: [], |
| | | submitFormLoading: false, |
| | | addEquipDia: false, |
| | | equipOptions: [], |
| | | selectionRows: [], |
| | | form: { |
| | | impowerYear: '' |
| | | }, |
| | | delegatedUser: [], |
| | | impowerId: '', |
| | | notificationDia: false, |
| | | auditId: '', |
| | | notificationLoading: false, |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.refreshTableList() |
| | | }, |
| | | // æ¹æ³éå |
| | | methods: { |
| | | // ç¹å»å·æ° |
| | | refreshTableList () { |
| | | this.page.current = 1; |
| | | this.getTableList() |
| | | }, |
| | | // å页忢 |
| | | pagination(page) { |
| | | this.page.size = page.limit |
| | | this.getTableList() |
| | | }, |
| | | getTableList () { |
| | | this.tableLoading = true |
| | | selectDeviceImpowerByPage({ |
| | | ...this.page |
| | | }).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | // æå¼æäº¤æ¹åå¼¹æ¡ |
| | | tellApprove(impowerId) { |
| | | this.getUserList() |
| | | this.notificationDia = true |
| | | this.impowerId = impowerId |
| | | }, |
| | | // æäº¤æ¹åéç¥ |
| | | notification() { |
| | | if (!this.auditId) { |
| | | this.$message.warning('è¯·éæ©å®¡æ ¸äºº') |
| | | return |
| | | } |
| | | this.notificationLoading = true |
| | | submitReviewImpowerStatus({ |
| | | auditId: this.auditId, |
| | | impowerId: this.impowerId, |
| | | }).then(res => { |
| | | this.notificationLoading = false |
| | | if (res.code == 200) { |
| | | this.closeNotificationDia() |
| | | this.refreshTableList() |
| | | } |
| | | }).catch(err => { |
| | | this.notificationLoading = false |
| | | }) |
| | | }, |
| | | // å
³éæäº¤æ¹åå¼¹æ¡ |
| | | closeNotificationDia() { |
| | | this.notificationDia = false |
| | | this.auditId = '' |
| | | }, |
| | | // æå¼æä½å¼¹æ¡ |
| | | openDia (type, row) { |
| | | this.operationType = type |
| | | this.usageTableDia = true |
| | | this.form = { |
| | | impowerYear: '', |
| | | deviceImpowerDetails: [], |
| | | } |
| | | this.deviceImpowerDetails = [] |
| | | if (row) { |
| | | this.impowerId = row.impowerId |
| | | getImpowerDetail({ impowerId: this.impowerId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.form = res.data |
| | | this.deviceImpowerDetails = this.form.deviceImpowerDetails |
| | | this.deviceImpowerDetails.forEach(item => { |
| | | this.$set(item, 'delegatedUserArr', item.delegatedUser.split(',')) |
| | | }) |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | | }) |
| | | } |
| | | this.getEquipOptions() |
| | | this.getUserList() |
| | | }, |
| | | closeDialog () { |
| | | this.usageTableDia = false |
| | | this.getTableList() |
| | | }, |
| | | // æ·»å è®¾å¤ |
| | | addTableRow() { |
| | | this.addEquipDia = true |
| | | this.delegatedUser = this.responsibleOptions.map((item) => item.name); |
| | | this.getEquipOptions() |
| | | }, |
| | | // å é¤è¡¨æ ¼è¡ |
| | | deleteRow(index) { |
| | | this.deviceImpowerDetails.splice(index, 1) |
| | | }, |
| | | // æäº¤æ°å¢åä¿®æ¹ |
| | | submitForm() { |
| | | this.form.deviceImpowerDetails = this.HaveJson(this.deviceImpowerDetails) |
| | | this.form.deviceImpowerDetails.forEach((item) => { |
| | | item.delegatedUser = item.delegatedUserArr.join(',') |
| | | }) |
| | | this.submitFormLoading = true |
| | | if (this.operationType === 'add') { |
| | | addImpower(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('æ°å¢æå') |
| | | this.usageTableDia = false |
| | | this.refreshTableList() |
| | | } |
| | | this.submitFormLoading = false |
| | | }).catch(err => { |
| | | this.submitFormLoading = false |
| | | }) |
| | | } else { |
| | | updateImpower(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('ä¿®æ¹æå') |
| | | this.usageTableDia = false |
| | | this.refreshTableList() |
| | | } |
| | | this.submitFormLoading = false |
| | | }).catch(err => { |
| | | this.submitFormLoading = false |
| | | }) |
| | | } |
| | | }, |
| | | // æäº¤å®¡æ ¸ |
| | | checkStatus(status) { |
| | | const params = { |
| | | status: status, |
| | | impowerId: this.impowerId |
| | | } |
| | | reviewImpowerStatus(params).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('å®¡æ ¸æå') |
| | | this.usageTableDia = false |
| | | this.refreshTableList() |
| | | } |
| | | this.submitFormLoading = false |
| | | }).catch(err => { |
| | | this.submitFormLoading = false |
| | | }) |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | this.selectionRows = selection |
| | | }, |
| | | // èµå¼ä»ªå¨ç¼å· |
| | | changeMachineName() { |
| | | this.deviceMaintenancePlanDetails = [] |
| | | this.selectionRows.map(val => { |
| | | this.deviceImpowerDetails.push({ deviceId: val.id, deviceName: val.label, managementNumber: val.value, specificationModel: val.specificationModel, delegatedUserArr: this.delegatedUser }) |
| | | }) |
| | | this.addEquipDia = false |
| | | }, |
| | | // è·åææè®¾å¤ |
| | | getEquipOptions() { |
| | | this.equipOptions = [] |
| | | deviceScopeSearch({ status: 0 }).then(res => { |
| | | if (res.code === 200 && res.data) { |
| | | this.equipOptions = res.data.map(m => { |
| | | m.value = m.managementNumber |
| | | m.label = m.deviceName |
| | | m.storagePoint = m.storagePoint |
| | | return m |
| | | }) |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | | }) |
| | | }, |
| | | openHandleOut (row) { |
| | | exportDeviceImpower({ impowerId: row.impowerId }).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res], { type: 'application/msword' }); |
| | | this.$download.saveAs(blob, '设å¤ä½¿ç¨ææè¡¨' + '.docx') |
| | | }) |
| | | }, |
| | | handleDeleteClick(row) { |
| | | this.$confirm('æ¤æä½å°æ°¸ä¹
å é¤è¯¥æä»¶, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | deleteImpower({ impowerId: row.impowerId }).then(res => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: 'å 餿å!' |
| | | }); |
| | | this.refreshTableList() |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }); |
| | | }, |
| | | // è·åè´è´£äººä¿¡æ¯æ¥å£ |
| | | getUserList() { |
| | | selectUserCondition({type: 2}).then(res => { |
| | | if (res.code == 200) { |
| | | this.responsibleOptions = res.data |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | watch: { |
| | | // çå¬ç¹å»el-treeçæ°æ®ï¼è¿è¡æ°æ®å·æ° |
| | | clickNodeVal(newVal) { |
| | | if (newVal.value) { |
| | | this.refreshTableList(); |
| | | } |
| | | }, |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userId"]), |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search { |
| | | height: 46px; |
| | | text-align: right; |
| | | margin-top: 10px; |
| | | } |
| | | </style> |