From b46bc2dba51a3885a68e4c58316b41a31ea16bb2 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 14 二月 2023 13:35:03 +0800
Subject: [PATCH] 1.存货档案修改
---
src/views/zzmx/gxdy.vue | 1251 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,248 insertions(+), 3 deletions(-)
diff --git a/src/views/zzmx/gxdy.vue b/src/views/zzmx/gxdy.vue
index af17901..f4d01a2 100644
--- a/src/views/zzmx/gxdy.vue
+++ b/src/views/zzmx/gxdy.vue
@@ -1,11 +1,1256 @@
-<template />
+<template>
+ <div>
+ <div class="body" :style="{height:mainHeight+'px'}">
+
+ <div class="bodyTopButtonGroup">
+ <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+ <!-- <el-button v-waves type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</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.stepcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="宸ュ簭鍚嶇О" style=" display: flex;">
+ <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="鍚敤鐘舵��" style=" display: flex;">
+ <el-select
+ v-model="form.enable"
+ filterable
+ :popper-append-to-body="false"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <el-option
+ v-for="item in enableArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="宸ュ簭绫诲瀷" style=" display: flex;">
+ <el-select
+ v-model="form.steptypecode"
+ filterable
+ :popper-append-to-body="false"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <el-option
+ v-for="item in steptypeArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;">
+ <el-input v-model="form.createuser" style="width: 200px" placeholder="璇疯緭鍏�" />
+ </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"
+ >
+ <svg-icon
+ v-show="mouseHoverType==='mouseout'"
+ style="cursor: pointer"
+ :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
+ @mouseenter="mouseHoverType=$event.type"
+ />
+ <svg-icon
+ v-show="mouseHoverType==='mouseenter'"
+ style="cursor: pointer"
+ :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
+ @click="isExpandForm=!isExpandForm"
+ @mouseout="mouseHoverType=$event.type"
+ />
+ </div>
+ </div>
+
+ <div class="elTableDiv">
+ <el-table
+ ref="tableDataRef"
+ class="tableFixed"
+ :data="tableData"
+ :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
+ border
+ :row-class-name="tableRowClassName"
+ :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ @sort-change="sortChange"
+ >
+ <!-- <el-table-column-->
+ <!-- type="selection"-->
+ <!-- width="50"-->
+ <!-- />-->
+ <el-table-column
+ prop="RowNum"
+ width="50"
+ label="搴忓彿"
+ fixed
+ />
+ <el-table-column
+ prop="stepcode"
+ show-tooltip-when-overflow
+ label="宸ュ簭缂栫爜"
+ min-width="150"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="stepname"
+ min-width="150"
+ show-tooltip-when-overflow
+ label="宸ュ簭鍚嶇О"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="flwtype"
+ min-width="150"
+ show-tooltip-when-overflow
+ label="宸ュ簭绫诲瀷"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.flwtype.indexOf(';')!==-1">鑷埗;澶栧崗</div>
+ <div v-if="row.flwtype==='W'">澶栧崗</div>
+ <div v-if="row.flwtype==='Z'">鑷埗</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="descr"
+ show-tooltip-when-overflow
+ label="宸ュ簭鎻忚堪"
+ min-width="180"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.descr">{{ row.descr }}</div>
+ <div v-else>/</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="enable"
+ label="鍚敤鐘舵��"
+ show-tooltip-when-overflow
+ sortable="custom"
+ width="110"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.enable==='Y'">
+ <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
+ 鏄�
+ </div>
+ <div v-if="row.enable==='N'">
+ <i class="el-icon-info" style="margin-right: 2px" />
+ 鍚�
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="lm_user"
+ label="鍒涘缓浜哄憳"
+ show-tooltip-when-overflow
+ width="110"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="lm_date"
+ label="鍒涘缓鏃堕棿"
+ show-tooltip-when-overflow
+ width="160"
+ sortable="custom"
+ />
+ <el-table-column
+ label="鍏宠仈宸ヤ綔绔�"
+ prop="is_eqp"
+ show-tooltip-when-overflow
+ width="110"
+ >
+ <template slot-scope="{row}">
+ <div class="operationClass">
+ <i v-if="row.is_eqp==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="workClick(row)" />
+ <i
+ v-if="row.is_eqp==='N'"
+ class="el-icon-share"
+ style="color: rgb(180 ,181, 185)"
+ @click="workClick(row)"
+ />
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鍏宠仈缂洪櫡"
+ prop="is_defect"
+ show-tooltip-when-overflow
+ width="110"
+ >
+ <template slot-scope="{row}">
+ <div class="operationClass">
+ <i v-if="row.is_defect==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="defectClick(row)" />
+ <i
+ v-if="row.is_defect==='N'"
+ class="el-icon-share"
+ style="color:rgb(180 ,181, 185);"
+ @click="defectClick(row)"
+ />
+ </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="getStepSearch"
+ />
+ </div>
+
+ <!--鏂板淇敼瀵硅瘽妗�-->
+ <el-dialog
+ v-el-drag-dialog
+ :title="operation==='add'?'鏂板':'缂栬緫'"
+ :visible.sync="dialogVisible"
+ width="800px"
+ :close-on-click-modal="false"
+ top="15vh"
+ @closed="handleClose"
+ @close="handleClose"
+ >
+ <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
+ <el-form-item label="宸ュ簭缂栫爜" prop="stepcode">
+ <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" />
+ </el-form-item>
+ <el-form-item label="宸ュ簭鍚嶇О" prop="stepname">
+ <el-input v-model="dialogForm.stepname" style="width: 200px" />
+ </el-form-item>
+
+ <el-form-item prop="steptypecode" label="宸ュ簭绫诲瀷">
+ <el-radio-group
+ v-model="dialogForm.steptypecode"
+ style="width: 200px"
+ >
+ <el-radio
+ v-for="item in steptypeArr"
+ :key="item.code"
+ :value="item.code"
+ :label="item.name"
+ />
+ </el-radio-group>
+ <!-- <el-select-->
+ <!-- v-model="dialogForm.steptypecode"-->
+ <!-- filterable-->
+ <!-- style="width: 200px"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- :popper-append-to-body="false"-->
+ <!-- >-->
+ <!-- <el-option-->
+ <!-- v-for="item in steptypeArr"-->
+ <!-- :key="item.code"-->
+ <!-- :label="item.name"-->
+ <!-- :value="item.code"-->
+ <!-- />-->
+ <!-- </el-select>-->
+ </el-form-item>
+ <el-form-item prop="enable" label="鍚敤鐘舵��">
+ <el-select
+ v-model="dialogForm.enable"
+ filterable
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ :popper-append-to-body="false"
+ >
+ <el-option
+ v-for="item in enableArr"
+ :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>
+ <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="workDialogVisible"
+ width="50%"
+ :top="isIpad?'5vh': '15vh'"
+ :close-on-click-modal="false"
+ class="workDialogVisible"
+ @closed="workHandleClose"
+ @close="workHandleClose"
+ >
+ <!-- @opened="handleOpenedRoles"-->
+
+ <div>
+ <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 宸ュ簭鍚嶇О锛歿{ workDialogForm.stepname }}
+ </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 workDialogForm.workGatherArr"
+ :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="gather"-->
+ <!-- :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"
+ :label="item.name"
+ :checked="item.isSelected2"
+ @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="workTree"
+ :data="workDialogForm.workTreeArr"
+ show-checkbox
+ node-key="code"
+ style="height: 280px;"
+ default-expand-all
+ :props="workTreeDefaultProps"
+ @check="checkBoxClick"
+ />
+ <!-- @check-change="checkChange"-->
+
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button v-waves @click="workDialogVisibleCancel">鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="workDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+ </el-dialog>
+
+ <!-- 鍏宠仈缂洪櫡瀵硅瘽妗�-->
+ <el-dialog
+ v-el-drag-dialog
+ title="宸ュ簭鍏宠仈缂洪櫡"
+ :visible.sync="defectDialogVisible"
+ width="50%"
+ :top="isIpad?'5vh':'15vh'"
+ :close-on-click-modal="false"
+ class="defectDialogVisible"
+ @closed="defectHandleClose"
+ @close="defectHandleClose"
+ >
+ <!-- @opened="handleOpenedRoles"-->
+
+ <div style="margin-bottom: 20px">
+ <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" /> 宸ュ簭鍚嶇О锛歿{ defectTreeName }}
+ </div>
+
+ <div>
+ <!-- <div style="margin-bottom:20px">-->
+ <!-- <i class="el-icon-s-operation" style="color:#42b983;" /> 宸ヤ綔绔欙細-->
+ <!-- </div>-->
+ <el-tree
+ ref="defectTree"
+ :data="defectTree"
+ show-checkbox
+ node-key="code"
+ style="height: 400px;"
+ default-expand-all
+ :props="workTreeDefaultProps"
+ />
+ <!-- @check="checkBoxClick"-->
+ <!-- @check-change="checkChange"-->
+
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button v-waves @click="defectDialogVisibleCancel">鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="defectDialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+ </el-dialog>
+
+ </div>
+</template>
<script>
+import Pagination from '@/components/Pagination'
+import {
+ AddUpdateStep,
+ DeleteStep, SaveStepAssociationDefect,
+ SaveStepAssociationEqp,
+ StepAssociationDefect,
+ StepAssociationEqp,
+ StepSearch
+} from '@/api/zzmx'
+import $ from 'jquery'
+import { validateCode } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+
export default {
- name: 'Gxdy'
+ name: 'GXDY',
+ components: {
+ Pagination
+ },
+ directives: { elDragDialog, waves },
+ data() {
+ return {
+ mouseHoverType: 'mouseout',
+ isExpandForm: false,
+ isIpad: false,
+ mainHeight: 0,
+ tableHeight: 0,
+ form: {
+ stepcode: '', // 宸ュ簭缂栫爜
+ stepname: '', // 宸ュ簭鍚嶇О
+ enable: '', // 鍚敤鐘舵��
+ steptypecode: [], // 宸ュ簭绫诲瀷缂栫爜
+ createuser: '', // 鍒涘缓浜哄憳
+ prop: 'lm_date', // 鎺掑簭瀛楁
+ order: 'desc', // 鎺掑簭瀛楁
+ page: 1, // 绗嚑椤�
+ rows: 20 // 姣忛〉澶氬皯鏉�
+ },
+ enableArr: [
+ { code: 'Y', name: '鏄�' },
+ { code: 'N', name: '鍚�' }
+ ],
+ steptypeArr: [
+ { code: 'Z', name: '鑷埗' },
+ { code: 'W', name: '澶栧崗' }
+ // { code: 'Z;W', name: '鑷埗锛涘鍗�' }
+ ],
+ total: 10,
+ tableData: [],
+ dialogVisible: false,
+ dialogForm: {
+ 'id': '',
+ 'stepcode': '',
+ 'stepname': '',
+ 'steptypecode': '鑷埗',
+ 'enable': 'Y',
+ 'description': '',
+ 'OperType': ''
+ },
+ operation: '',
+ dialogFormRules: {
+ stepcode: [
+ { required: true, validator: validateCode, trigger: ['blur', 'change'] }
+ ],
+ stepname: [
+ { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] }
+ ],
+ steptypecode: [
+ { required: true, message: '璇烽�夋嫨绫诲瀷', trigger: ['blur', 'change'] }
+ ],
+ enable: [
+ { required: true, message: '璇烽�夋嫨鐘舵��', trigger: ['blur', 'change'] }
+ ]
+ },
+ workDialogVisible: false,
+ workDialogForm: {
+ stepcode: '', // 宸ュ簭缂栫爜
+ stepname: '', // 宸ュ簭鍚嶇О
+ workArr: [], // 宸ヤ綔绔欐墍鏈夋暟缁�
+ workGatherArr: [], // 宸ヤ綔绔欓泦鍚堟暟缁�
+ workCodeSelectedGatherArr: [], // 宸ヤ綔绔欓�変腑闆嗗悎鐨刢ode鏁扮粍
+ workTreeArr: [], // 宸ヤ綔绔欐爲鏁扮粍
+ workTreeSelectedArr: []// 宸ヤ綔绔欐爲閫変腑鐨勬暟缁刢ode闆嗗悎
+ },
+ workTreeDefaultProps: {
+ value: 'code',
+ label: 'name',
+ children: 'children'
+ },
+ defectDialogVisible: false,
+ defectTreeCode: '',
+ defectTreeName: '',
+ defectTree: []
+
+ }
+ },
+ created() {
+ this.getStepSearch()
+ },
+ mounted() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ },
+ methods: {
+ tableRowClassName({ row, rowIndex }) {
+ return 'custom-row'
+ },
+ async getStepSearch() {
+ const res = await StepSearch(this.form)
+ this.tableData = res.data
+ this.total = res.count
+ },
+ // 鎺掑簭鏀瑰彉鏃�
+ 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.getStepSearch()
+ },
+ // 鏌ヨ
+ search() {
+ this.getStepSearch()
+ },
+ upload() {
+
+ },
+ // 閲嶇疆
+ reset() {
+ this.form.stepcode = ''
+ this.form.stepname = ''
+ this.form.enable = ''
+ this.form.steptypecode = ''
+ this.form.createuser = ''
+ this.getStepSearch()
+ },
+
+ // 鏂板鎸夐挳
+ add(operation) {
+ this.operation = operation
+ this.dialogVisible = true
+ },
+ // 淇敼鎸夐挳
+ edit(operation, row) {
+ this.operation = operation
+ this.dialogVisible = true
+
+ this.$nextTick(() => {
+ this.dialogForm.id = row.id
+ this.dialogForm.stepcode = row.stepcode
+ this.dialogForm.stepname = row.stepname
+ this.dialogForm.steptypecode = this.steptypeArr.find(item => item.code === row.flwtype).name
+ this.dialogForm.description = row.descr
+ this.dialogForm.enable = row.enable
+ })
+ },
+ // 鍒犻櫎鎸夐挳
+ async del(row) {
+ this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ DeleteStep({ stepcode: row.stepcode }).then(res => {
+ if (res.code === '200') {
+ this.$message.success('鍒犻櫎鎴愬姛!')
+ if (this.form.page > 1 && this.tableData.length === 1) {
+ this.form.page--
+ }
+ this.getStepSearch()
+ }
+ })
+ }).catch(() => {
+ this.$message.info('宸插彇娑堝垹闄�')
+ })
+ },
+ // 瀵硅瘽妗嗗叧闂簨浠�
+ handleClose() {
+ this.dialogForm.stepcode = ''
+ this.dialogForm.stepname = ''
+ this.dialogForm.steptypecode = '鑷埗'
+ this.dialogForm.enable = 'Y'
+ this.dialogForm.description = ''
+ this.$refs.dialogForm.clearValidate()
+ },
+ // 瀵硅瘽妗嗗彇娑�
+ dialogVisibleCancel() {
+ this.dialogVisible = false
+ },
+ // 瀵硅瘽妗嗙‘璁�
+ dialogVisibleConfirm() {
+ this.$refs.dialogForm.validate(valid => {
+ if (valid) {
+ this.$store.state.app.buttonIsDisabled = true
+ const data = {
+ id: this.dialogForm.id,
+ stepcode: this.dialogForm.stepcode,
+ stepname: this.dialogForm.stepname,
+ steptypecode: this.steptypeArr.find(item => item.name === this.dialogForm.steptypecode).code,
+ enable: this.dialogForm.enable,
+ description: this.dialogForm.description,
+ OperType: this.operation === 'add' ? 'Add' : 'Update'
+ }
+ AddUpdateStep(data).then(res => {
+ if (res.code === '200') {
+ this.dialogVisible = false
+ this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+ this.getStepSearch()
+ this.$store.state.app.buttonIsDisabled = false
+ } else {
+ this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+ }
+ })
+ }
+ })
+ },
+ // 鑾峰彇椤甸潰楂樺害
+ getHeight() {
+ this.$nextTick(() => {
+ // this.mainHeight = window.innerHeight - 250
+ this.mainHeight = window.innerHeight - 85
+ this.tableHeight = this.mainHeight - 255
+ if (window.innerHeight < 769) {
+ this.tableHeight = this.tableHeight - 40
+ }
+ this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
+ this.$refs.tableDataRef.doLayout()
+ })
+ },
+ /* 鍏宠仈宸ヤ綔绔欐ā鍧�*/
+ // 鍏宠仈宸ヤ綔绔欑偣鍑�
+ workClick(row) {
+ const loading = this.$loading({
+ lock: true,
+ text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...',
+ spinner: 'el-icon-loading',
+ customClass: 'osloading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ })
+
+ this.workDialogForm.stepcode = row.stepcode
+ this.workDialogForm.stepname = row.stepname
+ StepAssociationEqp({ stepcode: this.workDialogForm.stepcode }).then(res => {
+ if (res.code === '200') {
+ setTimeout(() => {
+ loading.close()
+ this.workDialogVisible = true
+
+ this.workDialogForm.workArr = res.data.filter(item => item.children.length !== 0)
+
+ let workGatherArr = []
+ if (row.flwtype === 'W') { // 澶栧崗鎯呭喌涓�
+ workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'W')
+ } else if (row.flwtype === 'Z') { // 鑷埗鎯呭喌涓�
+ workGatherArr = this.workDialogForm.workArr.filter(item => item.type === 'E')
+ } else { // 鑷埗锛嬪鍗�
+ workGatherArr = this.workDialogForm.workArr
+ }
+ const nodeKey = []// 闇�瑕佹爲褰㈡暟鏄剧殑鍊�
+ workGatherArr.forEach((item, index) => {
+ this.workDialogForm.workGatherArr.push({
+ isSelected1: index === 0,
+ isSelected2: item.flag === 'Y',
+ code: item.code,
+ name: item.name,
+ type: item.type,
+ flag: item.flag
+ })
+ if (item.flag === 'Y' && item.children && item.children.length > 0) {
+ this.$nextTick(() => {
+ $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ item.children.forEach(it => {
+ if (it.flag === 'Y') {
+ nodeKey.push(it.code)
+ }
+ })
+ }
+ if (index === 0) {
+ if (item.children && item.children.length > 0) {
+ this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(it => it.code === item.code)
+ this.workDialogForm.workTreeArr[0].name = '鍏ㄩ儴'
+ }
+ }
+ // item.flag === 'Y'&&item
+ })
+
+ this.$nextTick(() => {
+ this.$refs.workTree.setCheckedKeys(nodeKey)
+ })
+ this.workDialogForm.workTreeSelectedArr = nodeKey
+ }, 1000)
+ } else {
+ loading.close()
+ }
+ })
+ },
+ // 澶х洅瀛愮偣鍑讳簨浠�
+ myCheckboxClick(val) {
+ console.log(val.code, 3)
+ // 鐐瑰嚮涓嶅悓鐨勭洅瀛愯繘琛岄�変腑鏍峰紡鍒囨崲
+ this.workDialogForm.workGatherArr.find(item => {
+ item.isSelected1 = item.code === val.code
+ })
+ this.workDialogForm.workTreeArr = this.workDialogForm.workArr.filter(item => item.code === val.code)
+ if (this.workDialogForm.workTreeArr[0].children && this.workDialogForm.workTreeArr[0].children.length > 0) {
+ this.workDialogForm.workTreeArr[0].name = '鍏ㄩ儴'
+ } else {
+ this.workDialogForm.workTreeArr = []
+ }
+
+ console.log(this.workDialogForm.workTreeArr, 8)
+ },
+ // 灏忕洅瀛愮偣鍑讳簨浠�
+ myCheckboxInputClick(val) {
+ val.isSelected2 = !!val.isSelected2
+ console.log(val.code, 1)
+ this.workDialogForm.workCodeSelectedGatherArr = [...new Set(this.workDialogForm.workCodeSelectedGatherArr)]
+ // 1.绗竴绉嶆儏鍐� 灏忕洅瀛愪粠娌¢�変腑鍒伴�変腑
+ if (val.isSelected2) {
+ console.log('1.绗竴绉嶆儏鍐� 灏忕洅瀛愪粠娌¢�変腑鍒伴�変腑')
+ this.workDialogForm.workCodeSelectedGatherArr.push(val.code)
+
+ this.workDialogForm.workArr.forEach((item, index) => {
+ if (item.code === val.code) {
+ item.flag = 'Y'
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ it.flag = 'Y'
+ this.workDialogForm.workTreeSelectedArr.push(it.code)
+ })
+ }
+ }
+ })
+ }
+
+ // 2.绗簩绉嶆儏鍐� 灏忕洅瀛愪粠閫変腑鍒版病閫変腑
+ if (!val.isSelected2) {
+ console.log('2.绗簩绉嶆儏鍐� 灏忕洅瀛愪粠閫変腑鍒版病閫変腑')
+ this.workDialogForm.workCodeSelectedGatherArr = this.workDialogForm.workCodeSelectedGatherArr.filter(item => item !== val.code)
+ this.workDialogForm.workArr.forEach((item, index) => {
+ if (item.code === val.code) {
+ item.flag = 'N'
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ it.flag = 'N'
+ this.workDialogForm.workTreeSelectedArr.forEach((i, ind) => {
+ if (i === it.code) {
+ this.workDialogForm.workTreeSelectedArr.splice(ind, 1)
+ }
+ })
+ })
+ }
+ }
+ })
+ }
+ this.workDialogForm.workCodeSelectedGatherArr = [...new Set(this.workDialogForm.workCodeSelectedGatherArr)]
+
+ console.log(this.workDialogForm.workCodeSelectedGatherArr, 2)
+ console.log(this.workDialogForm.workTreeSelectedArr, 23)
+ // this.$refs.workTree.setCheckedKeys(this.workDialogForm.workCodeSelectedGatherArr)
+ this.$refs.workTree.setCheckedKeys(this.workDialogForm.workTreeSelectedArr)
+ },
+ // 鏍戝舰涓� 妗嗛�変腑
+ checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) {
+ console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys })
+
+ let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊�
+ this.workDialogForm.workArr.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
+ }
+ })
+ }
+ })
+
+ // 1.绗竴绉嶆儏鍐� 鍗婂彾涓洪浂 鍏ㄥ彾涓洪浂
+ if (checkedKeys.length === 0 && halfCheckedKeys.length === 0) {
+ console.log('1.绗竴绉嶆儏鍐� 鍗婂彾涓洪浂 鍏ㄥ彾涓洪浂')
+ console.log(obj.code, 10)
+ // this.workDialogForm.workCodeSelectedGatherArr = this.workDialogForm.workCodeSelectedGatherArr.filter(item => item !== obj.code)
+
+ this.workDialogForm.workGatherArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ this.workDialogForm.workGatherArr[index].isSelected2 = false
+
+ // item.isSelected1 = item.code === checkedFatherCode
+ this.workDialogForm.workCodeSelectedGatherArr = this.workDialogForm.workCodeSelectedGatherArr.filter(it => it !== checkedFatherCode)
+ this.$nextTick(() => {
+ // console.log($("input[name='gather']"))
+ $("input[name='gather']").eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+
+ this.workDialogForm.workArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ item.flag = 'N'
+ if (item.children && item.children.length > 0) {
+ item.children.forEach((it) => {
+ it.flag = 'N'
+ this.workDialogForm.workTreeSelectedArr.forEach((i, ind) => {
+ if (i === it.code) {
+ this.workDialogForm.workTreeSelectedArr.splice(ind, 1)
+ }
+ })
+ })
+ }
+ }
+ })
+ console.log(this.workDialogForm.workCodeSelectedGatherArr, 11)
+ console.log(this.workDialogForm.workTreeSelectedArr, 18)
+ }
+
+ // 2.绗簩绉嶆儏鍐� 鍗婂彾涓嶄负闆� 鍏ㄥ彾涓嶄负闆�
+ if (checkedKeys.length !== 0 && halfCheckedKeys.length !== 0) {
+ console.log('2.绗簩绉嶆儏鍐� 鍗婂彾涓嶄负闆� 鍏ㄥ彾涓嶄负闆�')
+ console.log(obj.code, 13)
+ // console.log(this.$refs.workTree, 22)
+
+ this.workDialogForm.workGatherArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ this.workDialogForm.workGatherArr[index].isSelected2 = true
+ // this.workDialogForm.workCodeSelectedGatherArr.push(obj.code)
+ this.$nextTick(() => {
+ $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+
+ this.workDialogForm.workArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ item.flag = 'Y'
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ if (it.code === obj.code) {
+ console.log(it.code, 21)
+ if (it.flag === 'Y' && it.code === obj.code) {
+ it.flag = 'N'
+ this.workDialogForm.workTreeSelectedArr.forEach((i, ind) => {
+ if (i === it.code) {
+ console.log(i, 333)
+ this.workDialogForm.workTreeSelectedArr.splice(ind, 1)
+ }
+ })
+ } else if (it.flag === 'N' && it.code === obj.code) {
+ it.flag = 'Y'
+ console.log(2222)
+ this.workDialogForm.workTreeSelectedArr.push(it.code)
+ }
+ }
+ })
+ }
+
+ console.log(this.workDialogForm.workTreeSelectedArr, 17)
+
+ // this.$nextTick(() => {
+ // $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ // })
+ }
+ })
+ }
+
+ // 3.绗笁绉嶆儏鍐� 鍗婂彾涓洪浂 鍏ㄥ彾涓嶄负闆�
+ if (checkedKeys.length !== 0 && halfCheckedKeys.length === 0) {
+ console.log('3.绗笁绉嶆儏鍐� 鍗婂彾涓洪浂 鍏ㄥ彾涓嶄负闆�')
+ console.log(obj.code, 12)
+ this.workDialogForm.workGatherArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ this.workDialogForm.workGatherArr[index].isSelected2 = true
+ this.workDialogForm.workCodeSelectedGatherArr.push(obj.code)
+ this.$nextTick(() => {
+ $("input[name='gather']").eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+
+ this.workDialogForm.workArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ item.flag = 'Y'
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ it.flag = 'Y'
+ this.workDialogForm.workTreeSelectedArr.push(it.code)
+ })
+ }
+ }
+ })
+ }
+ this.workDialogForm.workTreeSelectedArr = [...new Set(this.workDialogForm.workTreeSelectedArr)]
+
+ this.$refs.workTree.setCheckedKeys(this.workDialogForm.workTreeSelectedArr)
+ console.log(this.workDialogForm.workTreeSelectedArr, 14)
+ console.log(this.workDialogForm.workArr, 15)
+ },
+ // 瀵硅瘽妗嗗叧闂簨浠�
+ workHandleClose() {
+ this.workDialogForm.workArr = []
+ this.workDialogForm.workGatherArr = []
+ this.workDialogForm.workTreeArr = []
+ this.$refs.workTree.setCheckedKeys([])
+ },
+ // 鍙栨秷
+ workDialogVisibleCancel() {
+ this.workDialogVisible = false
+ },
+ // 纭
+ async workDialogVisibleConfirm() {
+ this.workDialogForm.workTreeSelectedArr = [...new Set(this.workDialogForm.workTreeSelectedArr)]
+
+ const data = []
+ this.workDialogForm.workArr.forEach(item => {
+ if (item.flag === 'Y' && item.children && item.children.length > 0) {
+ item.children.forEach(it => { // 淇濆瓨鎺ュ彛鍙紶鏈�瀛愰」 name浼犵殑鏄痶ype
+ if (it.flag === 'Y') {
+ data.push({ code: it.code, name: it.type })
+ }
+ })
+ }
+ })
+ this.$store.state.app.buttonIsDisabled = true
+ const res = await SaveStepAssociationEqp(this.workDialogForm.stepcode, data)
+ if (res.code === '200') {
+ this.workDialogVisible = false
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ await this.getStepSearch()
+ this.$store.state.app.buttonIsDisabled = false
+ }
+ },
+ /* 鍏宠仈缂洪櫡*/
+ // 鍏宠仈缂洪櫡鐐瑰嚮
+ defectClick(row) {
+ const loading = this.$loading({
+ lock: true,
+ text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...',
+ spinner: 'el-icon-loading',
+ customClass: 'osloading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ })
+
+ this.defectTreeCode = row.stepcode
+ this.defectTreeName = row.stepname
+
+ StepAssociationDefect({ stepcode: row.stepcode }).then(res => {
+ if (res.code === '200') {
+ setTimeout(() => {
+ loading.close()
+ this.defectDialogVisible = true
+
+ this.defectTree.push({ code: 'QB', name: '鍏ㄩ儴', children: res.data, flag: 'N' })
+
+ const nokeKey = []
+ this.defectTree[0].children.forEach(item => {
+ if (item.flag === 'Y') {
+ nokeKey.push(item.code)
+ }
+ })
+
+ this.$nextTick(() => {
+ this.$refs.defectTree.setCheckedKeys(nokeKey)
+ })
+ }, 1000)
+ } else {
+ loading.close()
+ }
+ })
+ },
+ // 鍏抽棴
+ defectHandleClose() {
+ this.defectTree = []
+ },
+ // 鍙栨秷
+ defectDialogVisibleCancel() {
+ this.defectDialogVisible = false
+ },
+ // 纭
+ async defectDialogVisibleConfirm() {
+ const nodeKey = this.$refs.defectTree.getCheckedKeys()
+ const data = []
+ this.defectTree[0].children.forEach(item => {
+ if (nodeKey.includes(item.code)) {
+ console.log(item.code)
+ data.push({ code: item.code, name: item.name })
+ }
+ })
+ this.$store.state.app.buttonIsDisabled = true
+ const res = await SaveStepAssociationDefect(this.defectTreeCode, data)
+ if (res.code === '200') {
+ this.defectDialogVisible = false
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ await this.getStepSearch()
+ this.$store.state.app.buttonIsDisabled = false
+ }
+ }
+ }
}
</script>
+<style lang="scss" scoped>
+$main_color: #42b983;
-<style scoped>
+.workDialogVisible {
+ .myCheckboxGroup {
+ display: flex;
+ flex-wrap: wrap;
+ .myCheckbox {
+ 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;
+ }
+
+ }
+
+ input[type=checkbox] {
+ cursor: pointer;
+ position: relative;
+ width: 14px;
+ height: 14px;
+ font-size: 14px;
+ }
+
+ input[type=checkbox]::after {
+ position: absolute;
+ top: 0;
+ color: $main_color;
+ width: 14px;
+ height: 14px;
+ display: inline-block;
+ visibility: visible;
+ padding-left: 0;
+ 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;
+ }
+ }
+}
+
+</style>
+<!--鍏叡椤甸潰鏍峰紡-->
+<style lang="scss" scoped>
+$main_color: #42b983;
+.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 .workDialogVisible .el-dialog__body {
+ padding: 20px 20px !important;
+}
+
+::v-deep .defectDialogVisible .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;
+}
+
+.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