From ebe7bf1b9118958f6a93406305f5728bfd5d90c9 Mon Sep 17 00:00:00 2001 From: 小小儁爺 <1694218219@qq.com> Date: 星期一, 03 三月 2025 10:33:24 +0800 Subject: [PATCH] 1. 综合看板修改编码 --- src/views/deviceManager/checkStandard.vue | 2703 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 1,354 insertions(+), 1,349 deletions(-) diff --git a/src/views/deviceManager/checkStandard.vue b/src/views/deviceManager/checkStandard.vue index 2a9c5be..0ecc859 100644 --- a/src/views/deviceManager/checkStandard.vue +++ b/src/views/deviceManager/checkStandard.vue @@ -1,1349 +1,1354 @@ -<template> - <div> - <div class="body" :style="{height:mainHeight+'px'}"> - <div class="bodyTopButtonGroup" style="justify-content: space-between"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> - <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10_1')">瀵煎叆</el-button> - </div> - - <div class="bodyTopFormGroup"> - <el-form - ref="form" - :model="form" - label-width="100px" - inline - style="display: flex;" - > - <div class="elForm"> - <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> - <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> - <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> - </el-form-item> - <el-form-item label="鐐规绠℃帶" style=" display: flex;"> - <el-select v-model="form.checkcontr" style="width: 200px" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - </div> - <div - class="bodySearchReset" - :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" - > - <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> - <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> - </div> - </el-form> - - <div - class="bodyTopFormExpand" - /> - </div> - - <div class="elTableDiv"> - <!-- <TableColumnSettings--> - <!-- :list1="tableColumnSettingsArray"--> - <!-- @tableColumnUpdate="tableColumnUpdate"--> - <!-- />--> - <el-table - ref="tableDataRef" - :key="tableTimeStampKey" - :data="tableData" - :height="tableHeight+'px'" - border - class="tableFixed" - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:tableHeight+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - @sort-change="sortChange" - > - - <el-table-column - v-for="item in tableColumnSettingsArray" - v-if="item.show" - :key="item.id" - :sortable="item.sortable" - :prop="item.prop" - :min-width="item.minWidth" - :label="item.label" - :width="item.width" - show-tooltip-when-overflow - :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" - > - <template slot-scope="{row}"> - <div v-if="!row[item.prop]">/</div> - <div v-else-if="item.prop==='is_checkeqp'"> - <i - v-if="row[item.prop]==='Y'" - :style="{color:$store.state.settings.theme}" - class="el-icon-share" - @click="checkeqpClick(row)" - /> - <i - v-if="row[item.prop]==='N'" - class="el-icon-share" - style="color: rgb(180 ,181, 185)" - @click="checkeqpClick(row)" - /> - </div> - <div v-else-if="item.prop==='iscontr'"> - <div v-if="row[item.prop]==='Y'"> - <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> - 鏄� - </div> - <div v-if="row[item.prop]==='N'"> - <i class="el-icon-info" style="margin-right: 2px" /> - 鍚� - </div> - </div> - <div v-else>{{ row[item.prop] }}</div> - </template> - </el-table-column> - - <el-table-column - label="鎿嶄綔" - fixed="right" - width="120" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> - <i - :style="{color:$store.state.settings.theme}" - class="el-icon-edit-outline" - @click="edit('edit',row)" - /> - </el-tooltip> - <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> - <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> - </el-tooltip> - </div> - </template> - </el-table-column> - </el-table> - </div> - <!--鍒嗛〉--> - <pagination - :total="total" - :page.sync="form.page" - :limit.sync="form.rows" - align="right" - layout="total,prev, pager, next,sizes" - popper-class="select_bottom" - @pagination="getDeviceCheckStandArdSearch" - /> - </div> - - <el-dialog - v-el-drag-dialog - :title="operation==='add'?'鏂板':'缂栬緫'" - :visible.sync="dialogVisible" - width="800px" - :close-on-click-modal="false" - top="8vh" - @closed="handleClose" - > - <!-- @close="handleClose"--> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鐐规鏍囧噯淇℃伅锛� - </div> - <div style="margin: 0 30px;"> - <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> - <el-form-item label="鏍囧噯缂栫爜" prop="code"> - <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> - </el-form-item> - <el-form-item label="鏍囧噯鍚嶇О" prop="name"> - <el-input v-model="dialogForm.name" style="width: 200px" /> - </el-form-item> - <el-form-item required label="鐐规绠℃帶"> - <el-select - v-model="dialogForm.enable" - style="width: 200px" - placeholder="璇烽�夋嫨" - :popper-append-to-body="false" - > - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </el-form-item> - <el-form-item label="鏍囧噯鎻忚堪" prop="description"> - <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> - </el-form-item> - </el-form> - </div> - <div> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈鐐规椤逛俊鎭細 - </div> - <div style="margin-bottom:10px"> - <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> - </div> - <div class="elTableDiv"> - <el-table - ref="tableDataDialogRef" - :data="tableDataDialog" - :height="(tableHeight-300)+'px'" - border - :row-class-name="tableRowClassName" - :style="{width: 100+'%',height:(tableHeight-300)+'px',}" - highlight-current-row - :header-cell-style="this.$headerCellStyle" - :cell-style="this.$cellStyle" - > - <el-table-column - type="index" - width="50" - label="搴忓彿" - /> - <el-table-column - prop="checkitem_code" - label="鐐规閮ㄤ綅缂栫爜" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_code }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.checkitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in checkItemSelectArr" - :key="item.name" - :label="item.code" - :value="item.name" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - prop="checkitem_name" - label="鐐规閮ㄤ綅鍚嶇О" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_name }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.checkitem_code" - placeholder="璇烽�夋嫨" - @change="val=>selectChange(val,row)" - > - <el-option - v-for="item in checkItemSelectArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - - <el-table-column - prop="checkitem_descr" - label="鐐规瑕佹眰" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.checkitem_descr }}</div> - <el-input v-else v-model="row.checkitem_descr" /> - </template> - </el-table-column> - <el-table-column - prop="isscan" - label="閫夋嫨鎵爜" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.isscan" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in checkcontrArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - prop="cycle" - label="鐐规鍛ㄦ湡" - show-tooltip-when-overflow - > - <template slot-scope="{row}"> - <div v-if="row.isVisible===0">{{ row.cycle === 'D' ? '鏃�' : '' }}</div> - <el-select - v-if="row.isVisible===1" - v-model="row.cycle" - placeholder="璇烽�夋嫨" - > - <el-option - v-for="item in cycleArr" - :key="item.code" - :label="item.name" - :value="item.code" - /> - </el-select> - </template> - </el-table-column> - <el-table-column - label="鎿嶄綔" - width="120" - fixed="right" - > - <template slot-scope="{row}"> - <div class="operationClass"> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> - <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> - - <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> - <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> - </div> - </template> - </el-table-column> - </el-table> - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="dialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - <!-- 鍏宠仈璁惧--> - <el-dialog - v-el-drag-dialog - title="鍏宠仈璁惧" - :visible.sync="dialogVisibleEqp" - width="800px" - top="10vh" - :close-on-click-modal="false" - class="dialogVisibleEqp" - @closed="handleCloseEqp" - @close="handleCloseEqp" - > - <!-- @opened="handleOpenedRoles"--> - - <div> - <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 - </div> - <div class="myCheckboxGroup"> - - <div - v-for="item in dialogFormEqp.eqpArr" - :key="item.code" - :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" - class="myCheckbox" - @click="myCheckboxClick(item)" - > - <!-- <input--> - <!-- class="myCheckboxInput"--> - <!-- type="checkbox"--> - <!-- :value="item.code"--> - <!-- :name="item.name"--> - <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> - <!-- @click="myCheckboxInputClick(item)"--> - <!-- >{{ item.name }}--> - <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> - <!-- onClick="event.cancelBubble = true"--> - - <el-checkbox - :key="item.code" - v-model="item.isSelected2" - class="myCheckboxInput" - :value="item.code" - :name="item.name" - :checked="item.isSelected2" - :label="item.name" - @change="myCheckboxInputClick(item)" - /> - <div class="myCheckboxInputLabel">{{ item.name }}</div> - - </div> - </div> - </div> - <el-divider /> - <div> - <div style="margin-bottom:20px"> - <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� - </div> - <el-tree - ref="epqTree" - :data="dialogFormEqp.eqpTree" - show-checkbox - node-key="code" - default-expand-all - style="height: 320px;overflow: auto" - :props="defaultPropsOfEqpTree" - @check="checkBoxClick" - /> - <!-- @check-change="checkChange"--> - - </div> - <span slot="footer" class="dialog-footer"> - <div class="footerButton"> - <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> - <el-button - v-waves - type="primary" - :loading="$store.state.app.buttonIsDisabled" - :disabled="$store.state.app.buttonIsDisabled" - @click="eqpDialogVisibleConfirm" - >纭� 瀹�</el-button> - </div> - </span> - </el-dialog> - - </div> -</template> - -<script> -import Pagination from '@/components/Pagination' -import { - AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned, - DeviceCheckItemSelect, - DeviceCheckStandArdSearch, DeviceCheckStanedAssociationEqp, SaveDeviceCheckStanedAssociationEqp, - ViewDeviceCheckStanedSearch -} from '@/api/DeviceManager' -import $ from 'jquery' -import { validateCode } from '@/utils/global' -import elDragDialog from '@/directive/el-drag-dialog' -import waves from '@/directive/waves' -import TableColumnSettings from '@/components/TableColumnSettings' - -export default { - name: 'CheckStandard', - components: { - Pagination, TableColumnSettings - }, - directives: { elDragDialog, waves }, - data() { - return { - mainHeight: 0, - tableHeight: 0, - form: { - checkstandcode: '', // 鏍囧噯缂栫爜 - checkstandname: '', // 鏍囧噯鍚嶇О - checkcontr: '', // 鐐规绠℃帶 - prop: 'lm_date', // 鎺掑簭瀛楁 - order: 'desc', // 鎺掑簭瀛楁 - page: 1, // 绗嚑椤� - rows: 20 // 姣忛〉澶氬皯鏉� - }, - checkcontrArr: [ - { code: 'Y', name: '鏄�' }, - { code: 'N', name: '鍚�' } - ], - cycleArr: [ - { code: 'D', name: '鏃�' } - ], - total: 10, - tableData: [], - tableColumnSettingsArray: [ - { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず - { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom - { - minWidth: 110, - width: false, - prop: 'code', - label: '鏍囧噯缂栫爜', - id: 3, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 110, - width: false, - prop: 'name', - label: '鏍囧噯鍚嶇О', - id: 4, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: 330, - width: false, - prop: 'description', - label: '鏍囧噯鎻忚堪', - id: 5, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'iscontr', - label: '鐐规绠℃帶', - id: 6, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'is_checkeqp', - label: '鍏宠仈璁惧', - id: 7, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 110, - prop: 'lm_user', - label: '鍒涘缓浜哄憳', - id: 8, - show: true, - fixed: false, - sortable: true - }, - { - minWidth: false, - width: 160, - prop: 'lm_date', - label: '鍒涘缓鏃堕棿', - id: 9, - show: true, - fixed: false, - sortable: true - } - ], - tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key - - dialogVisible: false, - dialogForm: { - code: '', - name: '', - enable: 'Y', - description: '' - }, - operation: '', - dialogFormRules: { - - code: [ - { required: true, validator: validateCode, trigger: ['blur', 'change'] } - ], - name: [ - { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } - ], - enable: [ - { required: true, message: '', trigger: ['blur', 'change'] } - ] - }, - tableDataDialog: [], // 琛ㄦ牸鏁版嵁 - // tableDataDialogSelected: [], // 宸查�塩ode - checkItemSelectArr: [], - checkItemIsCancel: true, - dialogVisibleEqp: false, - - dialogFormEqp: { - name: '', - code: '', - eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� - eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� - eqpTree: [], // 璁惧鏍戝舰鎵�鏈� - eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 - }, - defaultPropsOfEqpTree: { - value: 'code', - label: 'name', - children: 'children' - }, - - title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', - code: '22', - shows: false - - } - }, - watch: { - shows() { - if (!this.shows) { - this.getDeviceCheckStandArdSearch() - } - } - }, - activated() { window.addEventListener('resize', this.getHeight) this.getHeight() }, created() { - this.handleRequest() - }, - mounted() { - window.addEventListener('resize', this.getHeight) - this.getHeight() - }, - methods: { - tableColumnUpdate(val, isCopyTrue) { - if (isCopyTrue) { - this.tableColumnSettingsArray = val - } - this.tableTimeStampKey = new Date().getTime() - - this.$refs.tableDataRef.doLayout() - }, - handleRequest() { - this.getDeviceCheckStandArdSearch().then(res => { - if (res.code === '200') { - this.getDeviceCheckItemSelect() - } - }) - }, - async getDeviceCheckStandArdSearch() { - const res = await DeviceCheckStandArdSearch(this.form) - this.tableData = res.data - this.total = res.count - return { code: res.code } - }, - // 鎺掑簭鏀瑰彉鏃� - sortChange({ column, prop, order }) { - if (order === 'descending') { - order = 'desc' - } else if (order === 'ascending') { - order = 'asc' - } else { - order = 'desc' - } - this.form.order = order - this.form.prop = prop - this.getDeviceCheckStandArdSearch() - }, - // 鏌ヨ - search() { - this.getDeviceCheckStandArdSearch() - }, - // 瀵煎叆鎸夐挳 - upload() { - this.shows = true - this.$refs.importPickerFunc.newDataFunc() - }, - colos() { - this.shows = false - }, - // 閲嶇疆 - reset() { - this.form.checkstandcode = '' - this.form.checkstandname = '' - this.form.checkcontr = '' - this.getDeviceCheckStandArdSearch() - }, - - async getDeviceCheckItemSelect() { - const { data: res } = await DeviceCheckItemSelect() - this.checkItemSelectArr = res - }, - - // 鏂板鎸夐挳 - add(operation) { - this.operation = operation - this.dialogVisible = true - // this.getDeviceCheckItemSelect() - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - }, - // 淇敼鎸夐挳 - edit(operation, row) { - // this.getDeviceCheckItemSelect() - this.operation = operation - this.getViewDeviceCheckStanedSearch(row.code) - this.dialogVisible = true - - this.$nextTick(() => { - this.$refs.tableDataDialogRef.doLayout() - }) - // this.$nextTick(() => { - // this.dialogForm.code = row.code - // this.dialogForm.name = row.name - // this.dialogForm.enable = row.enable - // this.dialogForm.description = row.description - // }) - }, - // 淇敼鍓嶈姹傛帴鍙� - async getViewDeviceCheckStanedSearch(checkstand_code) { - const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code }) - this.tableDataDialog = res.Data - - this.dialogForm.code = res.code - this.dialogForm.name = res.name - this.dialogForm.enable = res.enable - this.dialogForm.description = res.description - - this.tableDataDialog.forEach(item => { - item.isVisible = 0 - item.checkitem_code = item.code - item.checkitem_name = item.name - item.checkitem_descr = item.chkdesc - }) - - this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code)) - }, - // 鍒犻櫎鎸夐挳 - async del(row) { - this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => { - if (res.code === '200') { - this.$notify.success('鍒犻櫎鎴愬姛!') - if (this.form.page > 1 && this.tableData.length === 1) { - this.form.page-- - } - this.getDeviceCheckStandArdSearch() - } - }) - }).catch(() => { - this.$notify.info('宸插彇娑堝垹闄�') - }) - }, - - // 瀵硅瘽妗嗗叧闂簨浠� - handleClose() { - this.dialogForm.code = '' - this.dialogForm.name = '' - this.dialogForm.enable = 'Y' - this.dialogForm.description = '' - this.tableDataDialog = [] - this.getDeviceCheckItemSelect() - this.$refs.dialogForm.clearValidate() - }, - // 瀵硅瘽妗嗗彇娑� - dialogVisibleCancel() { - this.dialogVisible = false - }, - // 瀵硅瘽妗嗙‘璁� - dialogVisibleConfirm() { - if (this.tableDataDialog.length === 0) { - return this.$message.info('璁惧鍏宠仈鐐规椤逛俊鎭笉鑳戒负绌猴紒') - } - - this.$refs.dialogForm.validate(valid => { - if (valid) { - this.$store.state.app.buttonIsDisabled = true - // this.tableDataDialog.forEach((item, index) => { // 鍘绘帀姝e湪缂栬緫涓旀槸绌篶heckitem_code - // if (item.isVisible === 1 && item.checkitem_code === '') { - // this.tableDataDialog.splice(index, 1) - // } - // }) - - this.tableDataDialog.filter(item => item.checkitem_code !== '') - - let Data = [] - // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 - Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { - return selfArr.findIndex(item => item.checkitem_code === currentValue.checkitem_code) === currentIndex - }) - Data.forEach((item, index) => { - item.checkitem_seq = index + 1 - }) - - const data = { - 'code': this.dialogForm.code, - 'name': this.dialogForm.name, - 'enable': this.dialogForm.enable, - 'description': this.dialogForm.description, - 'Data': Data - } - - AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { - if (res.code === '200') { - this.dialogVisible = false - this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') - this.getDeviceCheckStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } else { - this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') - } - }) - } - }) - }, - - selectChange(val, row) { - const res = this.checkItemSelectArr.find(item => { - return item.code === val || item.name === val - }) - row.checkitem_descr = res.description - row.checkitem_code = res.code - row.checkitem_name = res.name - }, - // 鏂板琛� - addRow() { - let flag = false - this.tableDataDialog.forEach(item => { - if (item.isVisible === 1) { - // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') - } - this.tableDataDialog.push({ - checkitem_code: '', - checkitem_name: '', - checkitem_descr: '', - isscan: 'Y', - cycle: 'D', - isVisible: 1 - }) - - this.checkItemIsCancel = false - }, - editRow(row) { - let flag = false - this.tableDataDialog.forEach((item, index) => { - if (item.isVisible === 1) { - flag = true - } - }) - if (flag) { - return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') - } - - this.checkItemIsCancel = false - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code) { - this.tableDataDialog.splice(index, 1, { - checkitem_code: row.checkitem_code, - checkitem_name: row.checkitem_name, - checkitem_descr: row.checkitem_descr, - isscan: row.isscan, - cycle: row.cycle, - isVisible: 1 - }) - } - }) - }, - delRow(row) { - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code) { - this.tableDataDialog.splice(index, 1) - } - }) - }, - saveRow(row) { - if (row.checkitem_code === '' && row.checkitem_name === '') { - return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') - } - row.isVisible = 0 - this.checkItemSelectArr.forEach((item, index) => { - if (item.code === row.checkitem_code) { - this.checkItemSelectArr.splice(index, 1) - } - }) - }, - cancelRow(row) { - // this.checkItemSelectArr.forEach((item, index) => { - // if (item.code === row.checkitem_code) { - if (this.checkItemIsCancel) { - this.checkItemSelectArr.splice(0, 0, { - code: row.checkitem_code, - name: row.checkitem_name, - description: row.checkitem_descr - }) - } - this.JYIsCancel = true - // } - // }) - - this.tableDataDialog.forEach((item, index) => { - if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) { - row.isVisible = 0 - this.tableDataDialog.splice(index, 1) - } - }) - }, - // 鑾峰彇椤甸潰楂樺害 - getHeight() { - this.$nextTick(() => { - this.mainHeight = window.innerHeight - 85 - this.tableHeight = this.mainHeight - 195 - this.$refs.tableDataRef.doLayout() - }) - }, - tableRowClassName({ row, rowIndex }) { - return 'custom-row' - }, - // 鍏宠仈璁惧 - checkeqpClick(row) { - const loading = this.$loading({ - lock: true, - text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', - spinner: 'el-icon-loading', - customClass: 'osloading', - background: 'rgba(0, 0, 0, 0.7)' - }) - this.dialogFormEqp.name = row.name - this.dialogFormEqp.code = row.code - - DeviceCheckStanedAssociationEqp({ checkstand_code: row.code }).then(res => { - if (res.code === '200') { - setTimeout(() => { - loading.close() - this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) - - if (this.dialogFormEqp.eqpAll.length > 0) { - this.dialogFormEqp.eqpAll.forEach((item, index) => { - this.dialogFormEqp.eqpArr.push({ - code: item.code, - name: item.name, - type: item.type, - isSelected1: index === 0, - isSelected2: item.flag === 'Y' - }) - if (item.flag === 'Y') { - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (it.flag === 'Y') { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - } - }) - } - }) - this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] - } - - this.dialogVisibleEqp = true - - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, 1000) - } else { - loading.close() - } - }) - }, - // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� - handleCloseEqp() { - this.$refs.epqTree.setCheckedKeys([]) - this.dialogFormEqp.code = '' - this.dialogFormEqp.name = '' - this.dialogFormEqp.eqpAll = [] - this.dialogFormEqp.eqpArr = [] - this.dialogFormEqp.eqpTree = [] - this.dialogFormEqp.eqpCodeSelectedArr = [] - }, - // 澶х洅瀛愮偣鍑� - myCheckboxClick(val) { - this.dialogFormEqp.eqpArr.forEach((item, index) => { - item.isSelected1 = item.code === val.code - if (item.code === val.code) { - this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' - this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] - } - }) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - }, - // 灏忕洅瀛愮偣鍑� - myCheckboxInputClick(val) { - console.log(val) - val.isSelected2 = !!val.isSelected2 - if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 - console.log('浠庢病閫変腑鍒伴�変腑') - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } else { // 浠庨�変腑鍒版病閫変腑 - console.log('浠庨�変腑鍒版病閫変腑') - const temp = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === val.code) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - this.$nextTick(() => { // 鏍戝舰鍥炴樉 - this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) - }) - } - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) - }, - // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 - checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { - let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� - console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === obj.code) { - checkedFatherCode = item.code - } - if (item.children && item.children.length > 0) { - item.children.forEach((it, ind) => { - if (it.code === obj.code) { - checkedFatherCode = item.code - } - }) - } - }) - console.log(checkedFatherCode, 1) - - // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { - console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - console.log(item.code, 777) - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { - if (item === obj.code) { - this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) - } - }) - checkedKeys.forEach(item => { - this.dialogFormEqp.eqpCodeSelectedArr.push(item) - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] - } - console.log(this.dialogFormEqp.eqpCodeSelectedArr, 666) - // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 - if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { - console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') - const temp = [] - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = false - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - temp.push(it.code) - }) - } - } - }) - this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) - } - - // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� - if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { - console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') - this.dialogFormEqp.eqpArr.forEach((item, index) => { - if (item.code === checkedFatherCode) { - this.dialogFormEqp.eqpArr[index].isSelected2 = true - this.$nextTick(() => { - $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 - }) - } - }) - - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.code === checkedFatherCode) { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) - }) - } - } - }) - } - }, - // 鍙栨秷浜嬩欢 - eqpDialogVisibleCancel() { - this.dialogVisibleEqp = false - }, - // 纭浜嬩欢 - eqpDialogVisibleConfirm() { - // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) - // this.dialogVisibleEqp = false - this.$store.state.app.buttonIsDisabled = true - const data = [] - this.dialogFormEqp.eqpAll.forEach((item, index) => { - if (item.children && item.children.length > 0) { - item.children.forEach(it => { - if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { - data.push({ - name: it.name, - code: it.code - }) - } - }) - } - }) - - SaveDeviceCheckStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { - if (res.code === '200') { - this.dialogVisibleEqp = false - this.$notify.success('鍏宠仈鎴愬姛锛�') - this.getDeviceCheckStandArdSearch() - this.$store.state.app.buttonIsDisabled = false - } - }) - } - } -} -</script> -<!--鍏叡椤甸潰鏍峰紡--> -<style lang="scss" scoped> -$main_color: #42b983; - -.dialogVisibleEqp { - .myCheckboxGroup { - display: flex; - flex-wrap: wrap; - - .myCheckbox { - //border: 1px solid $main_color; - border: 1px solid #eee; - display: flex; - min-width: 100px; - padding: 10px; - margin: 10px 30px 0 0; - border-radius: 5px; - cursor: default; - position: relative; - - .myCheckboxInput { - margin: 1px 5px 0 0; - cursor: pointer; - } - - .myCheckboxInputLabel { - position: absolute; - left: 29px; - padding: 5px; - top: 6px; - color: transparent; - - } - - } - - //.myCheckbox{ - // border: 1px solid $main_color; - //} - - input[type=checkbox] { - cursor: pointer; - position: relative; - width: 14px; - height: 14px; - font-size: 14px; - } - - input[type=checkbox]::after { - position: absolute; - top: 0; - //color: rgb(130, 35, 35); - color: $main_color; - width: 14px; - height: 14px; - display: inline-block; - visibility: visible; - padding-left: 0px; - text-align: center; - content: ' '; - border-radius: 3px - } - - input[type=checkbox]:checked::after { - //content: "鉁�"; - content: "鈭�"; - color: #fff; - font-size: 12px; - font-weight: bold; - background-color: $main_color; - } - } -} - -::v-deep .el-button--text { - font-size: 14px; - cursor: pointer; -} - -.el-icon-share, .el-icon-delete, .el-icon-edit-outline { - color: $main_color; - cursor: pointer; -} - -.el-icon-edit-outline { - margin-right: 15px; -} - -::v-deep .el-button--primary, .el-button--default, .el-button--info { - height: 34px; - display: flex; - align-items: center; - padding: 0 15px; -} - -::v-deep .el-button--primary { - //background-color: $main_color !important; -} - -::v-deep .el-button--default { - background-color: #f8f8fa; - border: none; -} - -::v-deep .el-input__inner { - height: 34px; - line-height: 34px; - //color: #a7a7a7; -} - -//::v-deep .el-dialog__body { -// padding: 20px 100px !important; -//} -::v-deep .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .dialogVisibleRoles .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .importPickerClass .el-dialog__body { - padding: 20px 20px !important; -} - -::v-deep .el-dialog__footer { - display: flex; - justify-content: flex-end; -} - -::v-deep .el-table .caret-wrapper { - transform: scale(0.8); -} - -::v-deep .cell { - display: flex; - align-items: center; - justify-content: space-between; -} - -::v-deep .el-table::before { - height: 0; -} - -::v-deep .el-table__body-wrapper { - background-color: #f8f8fa; -} - -::v-deep .el-table__body .el-table__row.hover-row td { - background-color: #eaecef; -} - -::v-deep .el-form--inline .el-form-item__label { - color: #a7a7a7; -} - -.body ::v-deep .el-divider { - border: 1px solid #eee; - width: 99%; - margin: 10px auto; -} - -.body ::v-deep .el-form-item { - margin-bottom: 0; -} - -.userDialogVisible ::v-deep .el-form-item { - margin-bottom: 0; -} - -::v-deep .el-select__caret { - display: flex; - align-items: center; - justify-content: center; -} - -.tableFixed { - ::v-deep .el-table__fixed-right { - height: 100% !important; - } - - ::v-deep .el-table__fixed { - height: 100% !important; - } -} -</style> -<style> -.osloading { - font-size: 26px !important; -} - -.el-loading-text { - font-size: 26px !important; -} - -.el-table .custom-row { - background: #f8f8fa; -} -</style> +<template> + <div> + <div class="body" :style="{height:mainHeight+'px'}"> + <div class="bodyTopButtonGroup" style="justify-content: space-between"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button> + <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10_1')">瀵煎叆</el-button> + </div> + + <div class="bodyTopFormGroup"> + <el-form + ref="form" + :model="form" + label-width="100px" + inline + style="display: flex;" + > + <div class="elForm"> + <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;"> + <el-input v-model="form.checkstandcode" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;"> + <el-input v-model="form.checkstandname" placeholder="璇疯緭鍏�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鐐规绠℃帶" style=" display: flex;"> + <el-select v-model="form.checkcontr" style="width: 200px" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + </div> + <div + class="bodySearchReset" + :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" + > + <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button> + <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button> + </div> + </el-form> + + <div + class="bodyTopFormExpand" + /> + </div> + + <div class="elTableDiv"> + <!-- <TableColumnSettings--> + <!-- :list1="tableColumnSettingsArray"--> + <!-- @tableColumnUpdate="tableColumnUpdate"--> + <!-- />--> + <el-table + ref="tableDataRef" + :key="tableTimeStampKey" + :data="tableData" + :height="tableHeight+'px'" + border + class="tableFixed" + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:tableHeight+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + @sort-change="sortChange" + > + + <el-table-column + v-for="item in tableColumnSettingsArray" + v-if="item.show" + :key="item.id" + :sortable="item.sortable" + :prop="item.prop" + :min-width="item.minWidth" + :label="item.label" + :width="item.width" + show-tooltip-when-overflow + :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false" + > + <template slot-scope="{row}"> + <div v-if="!row[item.prop]">/</div> + <div v-else-if="item.prop==='is_checkeqp'"> + <i + v-if="row[item.prop]==='Y'" + :style="{color:$store.state.settings.theme}" + class="el-icon-share" + @click="checkeqpClick(row)" + /> + <i + v-if="row[item.prop]==='N'" + class="el-icon-share" + style="color: rgb(180 ,181, 185)" + @click="checkeqpClick(row)" + /> + </div> + <div v-else-if="item.prop==='iscontr'"> + <div v-if="row[item.prop]==='Y'"> + <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" /> + 鏄� + </div> + <div v-if="row[item.prop]==='N'"> + <i class="el-icon-info" style="margin-right: 2px" /> + 鍚� + </div> + </div> + <div v-else>{{ row[item.prop] }}</div> + </template> + </el-table-column> + + <el-table-column + label="鎿嶄綔" + fixed="right" + width="120" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top"> + <i + :style="{color:$store.state.settings.theme}" + class="el-icon-edit-outline" + @click="edit('edit',row)" + /> + </el-tooltip> + <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top"> + <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" /> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </div> + <!--鍒嗛〉--> + <pagination + :total="total" + :page.sync="form.page" + :limit.sync="form.rows" + align="right" + layout="total,prev, pager, next,sizes" + popper-class="select_bottom" + @pagination="getDeviceCheckStandArdSearch" + /> + </div> + + <el-dialog + v-el-drag-dialog + :title="operation==='add'?'鏂板':'缂栬緫'" + :visible.sync="dialogVisible" + width="800px" + :close-on-click-modal="false" + top="8vh" + @closed="handleClose" + > + <!-- @close="handleClose"--> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鐐规鏍囧噯淇℃伅锛� + </div> + <div style="margin: 0 30px;"> + <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> + <el-form-item label="鏍囧噯缂栫爜" prop="code"> + <el-input v-model="dialogForm.code" :disabled="operation!=='add'" style="width: 200px" /> + </el-form-item> + <el-form-item label="鏍囧噯鍚嶇О" prop="name"> + <el-input v-model="dialogForm.name" style="width: 200px" /> + </el-form-item> + <el-form-item required label="鐐规绠℃帶"> + <el-select + v-model="dialogForm.enable" + style="width: 200px" + placeholder="璇烽�夋嫨" + :popper-append-to-body="false" + > + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </el-form-item> + <el-form-item label="鏍囧噯鎻忚堪" prop="description"> + <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> + </el-form-item> + </el-form> + </div> + <div> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" style="margin: -20px 10px 20px 0" />璁惧鍏宠仈鐐规椤逛俊鎭細 + </div> + <div style="margin-bottom:10px"> + <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="addRow">鏂板</el-button> + </div> + <div class="elTableDiv"> + <el-table + ref="tableDataDialogRef" + :data="tableDataDialog" + :height="(tableHeight-300)+'px'" + border + :row-class-name="tableRowClassName" + :style="{width: 100+'%',height:(tableHeight-300)+'px',}" + highlight-current-row + :header-cell-style="this.$headerCellStyle" + :cell-style="this.$cellStyle" + > + <el-table-column + type="index" + width="50" + label="搴忓彿" + /> + <el-table-column + prop="checkitem_code" + label="鐐规閮ㄤ綅缂栫爜" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_code }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.checkitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in checkItemSelectArr" + :key="item.name" + :label="item.code" + :value="item.name" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + prop="checkitem_name" + label="鐐规閮ㄤ綅鍚嶇О" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_name }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.checkitem_code" + placeholder="璇烽�夋嫨" + @change="val=>selectChange(val,row)" + > + <el-option + v-for="item in checkItemSelectArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + + <el-table-column + prop="checkitem_descr" + label="鐐规瑕佹眰" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.checkitem_descr }}</div> + <el-input v-else v-model="row.checkitem_descr" /> + </template> + </el-table-column> + <el-table-column + prop="isscan" + label="閫夋嫨鎵爜" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.isscan === 'Y' ? '鏄�' : '鍚�' }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.isscan" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in checkcontrArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + prop="cycle" + label="鐐规鍛ㄦ湡" + show-tooltip-when-overflow + > + <template slot-scope="{row}"> + <div v-if="row.isVisible===0">{{ row.cycle === 'D' ? '鏃�' : '' }}</div> + <el-select + v-if="row.isVisible===1" + v-model="row.cycle" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="item in cycleArr" + :key="item.code" + :label="item.name" + :value="item.code" + /> + </el-select> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + width="120" + fixed="right" + > + <template slot-scope="{row}"> + <div class="operationClass"> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button> + <el-button v-if="row.isVisible===0" v-waves type="text" @click="delRow(row)">鍒犻櫎</el-button> + + <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">纭</el-button> + <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button> + </div> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="dialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + <!-- 鍏宠仈璁惧--> + <el-dialog + v-el-drag-dialog + title="鍏宠仈璁惧" + :visible.sync="dialogVisibleEqp" + width="800px" + top="10vh" + :close-on-click-modal="false" + class="dialogVisibleEqp" + @closed="handleCloseEqp" + @close="handleCloseEqp" + > + <!-- @opened="handleOpenedRoles"--> + + <div> + <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 鏍囧噯鍚嶇О锛歿{ dialogFormEqp.name }} + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細 + </div> + <div class="myCheckboxGroup"> + + <div + v-for="item in dialogFormEqp.eqpArr" + :key="item.code" + :style="{border:item.isSelected1?'1px solid '+$store.state.settings.theme:'1px solid #eee'}" + class="myCheckbox" + @click="myCheckboxClick(item)" + > + <!-- <input--> + <!-- class="myCheckboxInput"--> + <!-- type="checkbox"--> + <!-- :value="item.code"--> + <!-- :name="item.name"--> + <!-- :style="{color:item.isSelected2?'#42b983':'#fff'}"--> + <!-- @click="myCheckboxInputClick(item)"--> + <!-- >{{ item.name }}--> + <!-- 鐖跺瓙鐐瑰嚮浜嬩欢涓嶅奖鍝�--> + <!-- onClick="event.cancelBubble = true"--> + + <el-checkbox + :key="item.code" + v-model="item.isSelected2" + class="myCheckboxInput" + :value="item.code" + :name="item.name" + :checked="item.isSelected2" + :label="item.name" + @change="myCheckboxInputClick(item)" + /> + <div class="myCheckboxInputLabel">{{ item.name }}</div> + + </div> + </div> + </div> + <el-divider /> + <div> + <div style="margin-bottom:20px"> + <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 璁惧淇℃伅锛� + </div> + <el-tree + ref="epqTree" + :data="dialogFormEqp.eqpTree" + show-checkbox + node-key="code" + default-expand-all + style="height: 320px;overflow: auto" + :props="defaultPropsOfEqpTree" + @check="checkBoxClick" + /> + <!-- @check-change="checkChange"--> + + </div> + <span slot="footer" class="dialog-footer"> + <div class="footerButton"> + <el-button v-waves @click="eqpDialogVisibleCancel">鍙� 娑�</el-button> + <el-button + v-waves + type="primary" + :loading="$store.state.app.buttonIsDisabled" + :disabled="$store.state.app.buttonIsDisabled" + @click="eqpDialogVisibleConfirm" + >纭� 瀹�</el-button> + </div> + </span> + </el-dialog> + + </div> +</template> + +<script> +import Pagination from '@/components/Pagination' +import { + AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned, + DeviceCheckItemSelect, + DeviceCheckStandArdSearch, DeviceCheckStanedAssociationEqp, SaveDeviceCheckStanedAssociationEqp, + ViewDeviceCheckStanedSearch +} from '@/api/DeviceManager' +import $ from 'jquery' +import { validateCode } from '@/utils/global' +import elDragDialog from '@/directive/el-drag-dialog' +import waves from '@/directive/waves' +import TableColumnSettings from '@/components/TableColumnSettings' + +export default { + name: 'CheckStandard', + components: { + Pagination, TableColumnSettings + }, + directives: { elDragDialog, waves }, + data() { + return { + mainHeight: 0, + tableHeight: 0, + form: { + checkstandcode: '', // 鏍囧噯缂栫爜 + checkstandname: '', // 鏍囧噯鍚嶇О + checkcontr: '', // 鐐规绠℃帶 + prop: 'lm_date', // 鎺掑簭瀛楁 + order: 'desc', // 鎺掑簭瀛楁 + page: 1, // 绗嚑椤� + rows: 20 // 姣忛〉澶氬皯鏉� + }, + checkcontrArr: [ + { code: 'Y', name: '鏄�' }, + { code: 'N', name: '鍚�' } + ], + cycleArr: [ + { code: 'D', name: '鏃�' } + ], + total: 10, + tableData: [], + tableColumnSettingsArray: [ + { minWidth: false, width: 55, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒� show: false闅愯棌锛宼rue鏄剧ず + { minWidth: false, width: 55, prop: 'rowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom + { + minWidth: 110, + width: false, + prop: 'code', + label: '鏍囧噯缂栫爜', + id: 3, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 110, + width: false, + prop: 'name', + label: '鏍囧噯鍚嶇О', + id: 4, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: 330, + width: false, + prop: 'description', + label: '鏍囧噯鎻忚堪', + id: 5, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'iscontr', + label: '鐐规绠℃帶', + id: 6, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'is_checkeqp', + label: '鍏宠仈璁惧', + id: 7, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 110, + prop: 'lm_user', + label: '鍒涘缓浜哄憳', + id: 8, + show: true, + fixed: false, + sortable: true + }, + { + minWidth: false, + width: 160, + prop: 'lm_date', + label: '鍒涘缓鏃堕棿', + id: 9, + show: true, + fixed: false, + sortable: true + } + ], + tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key + + dialogVisible: false, + dialogForm: { + code: '', + name: '', + enable: 'Y', + description: '' + }, + operation: '', + dialogFormRules: { + + code: [ + { required: true, validator: validateCode, trigger: ['blur', 'change'] } + ], + name: [ + { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] } + ], + enable: [ + { required: true, message: '', trigger: ['blur', 'change'] } + ] + }, + tableDataDialog: [], // 琛ㄦ牸鏁版嵁 + // tableDataDialogSelected: [], // 宸查�塩ode + checkItemSelectArr: [], + checkItemIsCancel: true, + dialogVisibleEqp: false, + + dialogFormEqp: { + name: '', + code: '', + eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈� + eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈� + eqpTree: [], // 璁惧鏍戝舰鎵�鏈� + eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑 + }, + defaultPropsOfEqpTree: { + value: 'code', + label: 'name', + children: 'children' + }, + + title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅', + code: '22', + shows: false + + } + }, + watch: { + shows() { + if (!this.shows) { + this.getDeviceCheckStandArdSearch() + } + } + }, + activated() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.handleRequest() + }, + created() { + this.handleRequest() + }, + mounted() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + }, + methods: { + tableColumnUpdate(val, isCopyTrue) { + if (isCopyTrue) { + this.tableColumnSettingsArray = val + } + this.tableTimeStampKey = new Date().getTime() + + this.$refs.tableDataRef.doLayout() + }, + handleRequest() { + this.getDeviceCheckStandArdSearch().then(res => { + if (res.code === '200') { + this.getDeviceCheckItemSelect() + } + }) + }, + async getDeviceCheckStandArdSearch() { + const res = await DeviceCheckStandArdSearch(this.form) + this.tableData = res.data + this.total = res.count + return { code: res.code } + }, + // 鎺掑簭鏀瑰彉鏃� + sortChange({ column, prop, order }) { + if (order === 'descending') { + order = 'desc' + } else if (order === 'ascending') { + order = 'asc' + } else { + order = 'desc' + } + this.form.order = order + this.form.prop = prop + this.getDeviceCheckStandArdSearch() + }, + // 鏌ヨ + search() { + this.getDeviceCheckStandArdSearch() + }, + // 瀵煎叆鎸夐挳 + upload() { + this.shows = true + this.$refs.importPickerFunc.newDataFunc() + }, + colos() { + this.shows = false + }, + // 閲嶇疆 + reset() { + this.form.checkstandcode = '' + this.form.checkstandname = '' + this.form.checkcontr = '' + this.getDeviceCheckStandArdSearch() + }, + + async getDeviceCheckItemSelect() { + const { data: res } = await DeviceCheckItemSelect() + this.checkItemSelectArr = res + }, + + // 鏂板鎸夐挳 + add(operation) { + this.operation = operation + this.dialogVisible = true + // this.getDeviceCheckItemSelect() + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + }, + // 淇敼鎸夐挳 + edit(operation, row) { + // this.getDeviceCheckItemSelect() + this.operation = operation + this.getViewDeviceCheckStanedSearch(row.code) + this.dialogVisible = true + + this.$nextTick(() => { + this.$refs.tableDataDialogRef.doLayout() + }) + // this.$nextTick(() => { + // this.dialogForm.code = row.code + // this.dialogForm.name = row.name + // this.dialogForm.enable = row.enable + // this.dialogForm.description = row.description + // }) + }, + // 淇敼鍓嶈姹傛帴鍙� + async getViewDeviceCheckStanedSearch(checkstand_code) { + const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code }) + this.tableDataDialog = res.Data + + this.dialogForm.code = res.code + this.dialogForm.name = res.name + this.dialogForm.enable = res.enable + this.dialogForm.description = res.description + + this.tableDataDialog.forEach(item => { + item.isVisible = 0 + item.checkitem_code = item.code + item.checkitem_name = item.name + item.checkitem_descr = item.chkdesc + }) + + this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code)) + }, + // 鍒犻櫎鎸夐挳 + async del(row) { + this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => { + if (res.code === '200') { + this.$notify.success('鍒犻櫎鎴愬姛!') + if (this.form.page > 1 && this.tableData.length === 1) { + this.form.page-- + } + this.getDeviceCheckStandArdSearch() + } + }) + }).catch(() => { + this.$notify.info('宸插彇娑堝垹闄�') + }) + }, + + // 瀵硅瘽妗嗗叧闂簨浠� + handleClose() { + this.dialogForm.code = '' + this.dialogForm.name = '' + this.dialogForm.enable = 'Y' + this.dialogForm.description = '' + this.tableDataDialog = [] + this.getDeviceCheckItemSelect() + this.$refs.dialogForm.clearValidate() + }, + // 瀵硅瘽妗嗗彇娑� + dialogVisibleCancel() { + this.dialogVisible = false + }, + // 瀵硅瘽妗嗙‘璁� + dialogVisibleConfirm() { + if (this.tableDataDialog.length === 0) { + return this.$message.info('璁惧鍏宠仈鐐规椤逛俊鎭笉鑳戒负绌猴紒') + } + + this.$refs.dialogForm.validate(valid => { + if (valid) { + this.$store.state.app.buttonIsDisabled = true + // this.tableDataDialog.forEach((item, index) => { // 鍘绘帀姝e湪缂栬緫涓旀槸绌篶heckitem_code + // if (item.isVisible === 1 && item.checkitem_code === '') { + // this.tableDataDialog.splice(index, 1) + // } + // }) + + this.tableDataDialog.filter(item => item.checkitem_code !== '') + + let Data = [] + // 鏁扮粍涓璞$浉鍚岀殑鍘婚噸 + Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { + return selfArr.findIndex(item => item.checkitem_code === currentValue.checkitem_code) === currentIndex + }) + Data.forEach((item, index) => { + item.checkitem_seq = index + 1 + }) + + const data = { + 'code': this.dialogForm.code, + 'name': this.dialogForm.name, + 'enable': this.dialogForm.enable, + 'description': this.dialogForm.description, + 'Data': Data + } + + AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => { + if (res.code === '200') { + this.dialogVisible = false + this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�') + this.getDeviceCheckStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } else { + this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�') + } + }) + } + }) + }, + + selectChange(val, row) { + const res = this.checkItemSelectArr.find(item => { + return item.code === val || item.name === val + }) + row.checkitem_descr = res.description + row.checkitem_code = res.code + row.checkitem_name = res.name + }, + // 鏂板琛� + addRow() { + let flag = false + this.tableDataDialog.forEach(item => { + if (item.isVisible === 1) { + // return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堜笂鏉¤褰曪紒') + } + this.tableDataDialog.push({ + checkitem_code: '', + checkitem_name: '', + checkitem_descr: '', + isscan: 'Y', + cycle: 'D', + isVisible: 1 + }) + + this.checkItemIsCancel = false + }, + editRow(row) { + let flag = false + this.tableDataDialog.forEach((item, index) => { + if (item.isVisible === 1) { + flag = true + } + }) + if (flag) { + return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�') + } + + this.checkItemIsCancel = false + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code) { + this.tableDataDialog.splice(index, 1, { + checkitem_code: row.checkitem_code, + checkitem_name: row.checkitem_name, + checkitem_descr: row.checkitem_descr, + isscan: row.isscan, + cycle: row.cycle, + isVisible: 1 + }) + } + }) + }, + delRow(row) { + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code) { + this.tableDataDialog.splice(index, 1) + } + }) + }, + saveRow(row) { + if (row.checkitem_code === '' && row.checkitem_name === '') { + return this.$message.info('鐐规閮ㄤ綅涓嶈兘涓虹┖锛�') + } + row.isVisible = 0 + this.checkItemSelectArr.forEach((item, index) => { + if (item.code === row.checkitem_code) { + this.checkItemSelectArr.splice(index, 1) + } + }) + }, + cancelRow(row) { + // this.checkItemSelectArr.forEach((item, index) => { + // if (item.code === row.checkitem_code) { + if (this.checkItemIsCancel) { + this.checkItemSelectArr.splice(0, 0, { + code: row.checkitem_code, + name: row.checkitem_name, + description: row.checkitem_descr + }) + } + this.JYIsCancel = true + // } + // }) + + this.tableDataDialog.forEach((item, index) => { + if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) { + row.isVisible = 0 + this.tableDataDialog.splice(index, 1) + } + }) + }, + // 鑾峰彇椤甸潰楂樺害 + getHeight() { + this.$nextTick(() => { + this.mainHeight = window.innerHeight - 85 + this.tableHeight = this.mainHeight - 195 + this.$refs.tableDataRef.doLayout() + }) + }, + tableRowClassName({ row, rowIndex }) { + return 'custom-row' + }, + // 鍏宠仈璁惧 + checkeqpClick(row) { + const loading = this.$loading({ + lock: true, + text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...', + spinner: 'el-icon-loading', + customClass: 'osloading', + background: 'rgba(0, 0, 0, 0.7)' + }) + this.dialogFormEqp.name = row.name + this.dialogFormEqp.code = row.code + + DeviceCheckStanedAssociationEqp({ checkstand_code: row.code }).then(res => { + if (res.code === '200') { + setTimeout(() => { + loading.close() + this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0) + + if (this.dialogFormEqp.eqpAll.length > 0) { + this.dialogFormEqp.eqpAll.forEach((item, index) => { + this.dialogFormEqp.eqpArr.push({ + code: item.code, + name: item.name, + type: item.type, + isSelected1: index === 0, + isSelected2: item.flag === 'Y' + }) + if (item.flag === 'Y') { + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (it.flag === 'Y') { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + } + }) + } + }) + this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]] + } + + this.dialogVisibleEqp = true + + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, 1000) + } else { + loading.close() + } + }) + }, + // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂� + handleCloseEqp() { + this.$refs.epqTree.setCheckedKeys([]) + this.dialogFormEqp.code = '' + this.dialogFormEqp.name = '' + this.dialogFormEqp.eqpAll = [] + this.dialogFormEqp.eqpArr = [] + this.dialogFormEqp.eqpTree = [] + this.dialogFormEqp.eqpCodeSelectedArr = [] + }, + // 澶х洅瀛愮偣鍑� + myCheckboxClick(val) { + this.dialogFormEqp.eqpArr.forEach((item, index) => { + item.isSelected1 = item.code === val.code + if (item.code === val.code) { + this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴' + this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]] + } + }) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + }, + // 灏忕洅瀛愮偣鍑� + myCheckboxInputClick(val) { + console.log(val) + val.isSelected2 = !!val.isSelected2 + if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑 + console.log('浠庢病閫変腑鍒伴�変腑') + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } else { // 浠庨�変腑鍒版病閫変腑 + console.log('浠庨�変腑鍒版病閫変腑') + const temp = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === val.code) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + this.$nextTick(() => { // 鏍戝舰鍥炴樉 + this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr) + }) + } + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999) + }, + // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢 + checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) { + let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊� + console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === obj.code) { + checkedFatherCode = item.code + } + if (item.children && item.children.length > 0) { + item.children.forEach((it, ind) => { + if (it.code === obj.code) { + checkedFatherCode = item.code + } + }) + } + }) + console.log(checkedFatherCode, 1) + + // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) { + console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + console.log(item.code, 777) + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => { + if (item === obj.code) { + this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1) + } + }) + checkedKeys.forEach(item => { + this.dialogFormEqp.eqpCodeSelectedArr.push(item) + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)] + } + console.log(this.dialogFormEqp.eqpCodeSelectedArr, 666) + // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂 + if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) { + console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂') + const temp = [] + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = false + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + temp.push(it.code) + }) + } + } + }) + this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x)) + } + + // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆� + if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) { + console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�') + this.dialogFormEqp.eqpArr.forEach((item, index) => { + if (item.code === checkedFatherCode) { + this.dialogFormEqp.eqpArr[index].isSelected2 = true + this.$nextTick(() => { + $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉 + }) + } + }) + + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.code === checkedFatherCode) { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + this.dialogFormEqp.eqpCodeSelectedArr.push(it.code) + }) + } + } + }) + } + }, + // 鍙栨秷浜嬩欢 + eqpDialogVisibleCancel() { + this.dialogVisibleEqp = false + }, + // 纭浜嬩欢 + eqpDialogVisibleConfirm() { + // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888) + // this.dialogVisibleEqp = false + this.$store.state.app.buttonIsDisabled = true + const data = [] + this.dialogFormEqp.eqpAll.forEach((item, index) => { + if (item.children && item.children.length > 0) { + item.children.forEach(it => { + if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) { + data.push({ + name: it.name, + code: it.code + }) + } + }) + } + }) + + SaveDeviceCheckStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => { + if (res.code === '200') { + this.dialogVisibleEqp = false + this.$notify.success('鍏宠仈鎴愬姛锛�') + this.getDeviceCheckStandArdSearch() + this.$store.state.app.buttonIsDisabled = false + } + }) + } + } +} +</script> +<!--鍏叡椤甸潰鏍峰紡--> +<style lang="scss" scoped> +$main_color: #42b983; + +.dialogVisibleEqp { + .myCheckboxGroup { + display: flex; + flex-wrap: wrap; + + .myCheckbox { + //border: 1px solid $main_color; + border: 1px solid #eee; + display: flex; + min-width: 100px; + padding: 10px; + margin: 10px 30px 0 0; + border-radius: 5px; + cursor: default; + position: relative; + + .myCheckboxInput { + margin: 1px 5px 0 0; + cursor: pointer; + } + + .myCheckboxInputLabel { + position: absolute; + left: 29px; + padding: 5px; + top: 6px; + color: transparent; + + } + + } + + //.myCheckbox{ + // border: 1px solid $main_color; + //} + + input[type=checkbox] { + cursor: pointer; + position: relative; + width: 14px; + height: 14px; + font-size: 14px; + } + + input[type=checkbox]::after { + position: absolute; + top: 0; + //color: rgb(130, 35, 35); + color: $main_color; + width: 14px; + height: 14px; + display: inline-block; + visibility: visible; + padding-left: 0px; + text-align: center; + content: ' '; + border-radius: 3px + } + + input[type=checkbox]:checked::after { + //content: "鉁�"; + content: "鈭�"; + color: #fff; + font-size: 12px; + font-weight: bold; + background-color: $main_color; + } + } +} + +::v-deep .el-button--text { + font-size: 14px; + cursor: pointer; +} + +.el-icon-share, .el-icon-delete, .el-icon-edit-outline { + color: $main_color; + cursor: pointer; +} + +.el-icon-edit-outline { + margin-right: 15px; +} + +::v-deep .el-button--primary, .el-button--default, .el-button--info { + height: 34px; + display: flex; + align-items: center; + padding: 0 15px; +} + +::v-deep .el-button--primary { + //background-color: $main_color !important; +} + +::v-deep .el-button--default { + background-color: #f8f8fa; + border: none; +} + +::v-deep .el-input__inner { + height: 34px; + line-height: 34px; + //color: #a7a7a7; +} + +//::v-deep .el-dialog__body { +// padding: 20px 100px !important; +//} +::v-deep .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .dialogVisibleRoles .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .importPickerClass .el-dialog__body { + padding: 20px 20px !important; +} + +::v-deep .el-dialog__footer { + display: flex; + justify-content: flex-end; +} + +::v-deep .el-table .caret-wrapper { + transform: scale(0.8); +} + +::v-deep .cell { + display: flex; + align-items: center; + justify-content: space-between; +} + +::v-deep .el-table::before { + height: 0; +} + +::v-deep .el-table__body-wrapper { + background-color: #f8f8fa; +} + +::v-deep .el-table__body .el-table__row.hover-row td { + background-color: #eaecef; +} + +::v-deep .el-form--inline .el-form-item__label { + color: #a7a7a7; +} + +.body ::v-deep .el-divider { + border: 1px solid #eee; + width: 99%; + margin: 10px auto; +} + +.body ::v-deep .el-form-item { + margin-bottom: 0; +} + +.userDialogVisible ::v-deep .el-form-item { + margin-bottom: 0; +} + +::v-deep .el-select__caret { + display: flex; + align-items: center; + justify-content: center; +} + +.tableFixed { + ::v-deep .el-table__fixed-right { + height: 100% !important; + } + + ::v-deep .el-table__fixed { + height: 100% !important; + } +} +</style> +<style> +.osloading { + font-size: 26px !important; +} + +.el-loading-text { + font-size: 26px !important; +} + +.el-table .custom-row { + background: #f8f8fa; +} +</style> -- Gitblit v1.9.3