From dc1879fd0713eed48b2c75af5f29a1085291d276 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 07 五月 2024 14:40:55 +0800
Subject: [PATCH] 1.文件替换

---
 src/views/qualityManager/defectDefine.vue |  356 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 356 insertions(+), 0 deletions(-)

diff --git a/src/views/qualityManager/defectDefine.vue b/src/views/qualityManager/defectDefine.vue
index e69de29..7fd9cf4 100644
--- a/src/views/qualityManager/defectDefine.vue
+++ b/src/views/qualityManager/defectDefine.vue
@@ -0,0 +1,356 @@
+<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=18')"
+        >瀵煎叆
+        </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.defectcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="缂洪櫡鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.defectname" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </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="getDedectSearch">鏌ヨ</el-button>
+            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+          </div>
+        </el-form>
+        <div
+          class="bodyTopFormExpand"
+          style="height:5px"
+        >
+          <!--          <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="tableHeight+'px'"
+          border
+          row-class-name="custom-row"
+          :style="{width: 100+'%',height:tableHeight+'px',}"
+          highlight-current-row
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+          @sort-change="sortChange"
+        >
+          <el-table-column
+            prop="rowNum"
+            width="50"
+            fixed
+            label="搴忓彿"
+          />
+          <el-table-column
+            prop="code"
+            label="缂洪櫡缂栫爜"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="name"
+            label="缂洪櫡鍚嶇О"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="description"
+            label="鎻忚堪"
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              {{ row.description ? row.description : '/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="lm_user"
+            label="鍒涘缓浜哄憳"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="lm_date"
+            label="鍒涘缓鏃堕棿"
+            width="160"
+            sortable="custom"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            width="120"
+            fixed="right"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
+                  <i
+                    v-if="row.leve!==0"
+                    class="el-icon-edit-outline"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="edit('edit',row)"
+                  />
+                </el-tooltip>
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+                  <i
+                    v-if="row.leve!==0"
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme}"
+                    @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,jumper"
+        popper-class="select_bottom"
+        @pagination="getDedectSearch"
+      />
+    </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="defectcode">
+          <el-input v-model="dialogForm.defectcode" :disabled="operation!=='add'" style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="缂洪櫡鍚嶇О" prop="defectname">
+          <el-input v-model="dialogForm.defectname" style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="鎻忚堪">
+          <el-input
+            v-model="dialogForm.defectdescr"
+            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>
+
+  </div>
+</template>
+
+<script>
+import Pagination from '@/components/Pagination'
+import {
+  AddUpdateOrganization, AddUpdatePost,
+  DeleteOrganization, DeletePost, PostData,
+  PrentOrganization,
+  STorgData
+} from '@/api/basicSettings'
+import { validateCode } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { AddUpdateDedect, DedectSearch, DeleteDedect } from '@/api/QualityManagement'
+
+export default {
+  name: 'Zzjg',
+  components: {
+    Pagination
+  },
+  directives: { elDragDialog, waves },
+  data() {
+    return {
+      mainHeight: 0,
+      tableHeight: 0,
+      form: {
+        defectcode: '', // 缁勭粐鏋舵瀯缂栫爜
+        defectname: '', // 缁勭粐鏋舵瀯鍚嶇О
+        defectdescr: '',
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
+      },
+      total: 10,
+      tableData: [],
+      dialogVisible: false,
+      dialogForm: {
+        defectcode: '', // 缁勭粐缂栫爜
+        defectname: '', // 缁勭粐鍚嶇О
+        defectdescr: '', // 鎻忚堪
+        OperType: ''
+      },
+      operation: '',
+      dialogFormRules: {
+        defectcode: [
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
+        ],
+        defectname: [
+          { required: true, message: '璇疯緭鍏ョ己闄峰悕绉�', trigger: ['blur', 'change'] }
+        ]
+      }
+
+    }
+  },
+  created() {
+    this.getDedectSearch()
+  },
+  mounted() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+  },
+  methods: {
+    // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇�
+    async getDedectSearch() {
+      const res = await DedectSearch(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.getDedectSearch()
+    },
+    // 閲嶇疆
+    reset() {
+      this.form.defectcode = ''
+      this.form.defectname = ''
+      this.getDedectSearch()
+    },
+    // 鏂板鎸夐挳
+    add(operation) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Add'
+    },
+    // 淇敼鎸夐挳
+    async edit(operation, row) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Update'
+
+      this.$nextTick(() => {
+        this.dialogForm.defectcode = row.code
+        this.dialogForm.defectname = row.name
+        this.dialogForm.defectdescr = row.description
+      })
+    },
+    // 鍒犻櫎鎸夐挳
+    async del(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        DeleteDedect({ defectcode: row.code }).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
+            this.getDedectSearch()
+          }
+        })
+      }).catch(() => {
+        this.$notify.info('宸插彇娑堝垹闄�')
+      })
+    },
+    // 瀵硅瘽妗嗗叧闂簨浠�
+    handleClose() {
+      this.dialogForm.defectcode = ''
+      this.dialogForm.defectname = ''
+      this.dialogForm.defectdescr = ''
+      this.$refs.dialogForm.clearValidate()
+    },
+    // 瀵硅瘽妗嗗彇娑�
+    dialogVisibleCancel() {
+      this.dialogVisible = false
+    },
+    // 瀵硅瘽妗嗙‘璁�
+    dialogVisibleConfirm() {
+      this.$refs.dialogForm.validate(valid => {
+        if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
+          AddUpdateDedect(this.dialogForm).then(res => {
+            if (res.code === '200') {
+              this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+              this.dialogVisible = false
+              this.$store.state.app.buttonIsDisabled = false
+              this.getDedectSearch()
+            } else {
+              this.$store.state.app.buttonIsDisabled = false
+              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+            }
+          })
+        }
+      })
+    },
+    // 鑾峰彇椤甸潰楂樺害
+    getHeight() {
+      this.$nextTick(() => {
+        this.mainHeight = window.innerHeight - 85
+        this.tableHeight = this.mainHeight - 200
+        this.$refs.tableDataRef.doLayout()
+      })
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3