From 8833392e76da93f2de7b7c7950e75751cb63e085 Mon Sep 17 00:00:00 2001
From: Goldennfish <1981343953@qq.com>
Date: 星期五, 21 七月 2023 10:10:33 +0800
Subject: [PATCH] 标准库第三次提交查询,新增,编辑规格,停用状态功能
---
src/permission.js | 110 ++++++------
src/views/rawMaterials/reportForInspection/index.vue | 4
src/views/home/index.vue | 2
src/views/standardLibrary/index.vue | 322 ++++++++++++++++++++++++++++++++++-
src/api/standardLibrary.js | 33 +++
src/views/standardLibrary/SpecificationDetails.vue | 4
src/views/login/index.vue | 2
src/layout/components/Navbar.vue | 2
src/views/personal/myBusiness/index.vue | 2
src/views/personal/myInformation/index.vue | 10
10 files changed, 404 insertions(+), 87 deletions(-)
diff --git a/src/api/standardLibrary.js b/src/api/standardLibrary.js
index 1123199..8e37b48 100644
--- a/src/api/standardLibrary.js
+++ b/src/api/standardLibrary.js
@@ -18,10 +18,11 @@
}
// 娣诲姞绫诲瀷
-export function addStandards() {
+export function addStandards(data) {
return request({
url: '/standards/add',
- method: 'get'
+ method: 'post',
+ data
})
}
@@ -35,10 +36,11 @@
}
// 娣诲姞鍨嬪彿
-export function addSerialNumber() {
+export function addSerialNumber(data) {
return request({
url: '/serial-number/add',
- method: 'get'
+ method: 'post',
+ data
})
}
@@ -52,9 +54,28 @@
}
// 娣诲姞浜у搧瑙勬牸
-export function addSpecifications() {
+export function addSpecifications(data) {
return request({
url: '/specifications/add',
- method: 'get'
+ method: 'post',
+ data
+ })
+}
+
+// 缂栬緫浜у搧瑙勬牸
+export function updateSpecifications(data) {
+ return request({
+ url: '/specifications/update',
+ method: 'put',
+ data
+ })
+}
+
+// 鏇存柊瑙勬牸鐘舵��
+export function updateSpeState(data) {
+ return request({
+ url: '/specifications/update_spe_state',
+ method: 'put',
+ data
})
}
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 060391e..41a57c4 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -12,7 +12,7 @@
</div>
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
- <a class="user-avatar">{{'涓ぉ'.slice(0,1)}}</a>
+ <a class="user-avatar">{{ '涓ぉ'.slice(0,1) }}</a>
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
diff --git a/src/permission.js b/src/permission.js
index 46773cb..fa1ea19 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,64 +1,64 @@
-// import router from './router'
-// import store from './store'
-// import { Message } from 'element-ui'
-// import NProgress from 'nprogress' // progress bar
-// import 'nprogress/nprogress.css' // progress bar style
-// import { getToken } from '@/utils/auth' // get token from cookie
-// import getPageTitle from '@/utils/get-page-title'
+import router from './router'
+import store from './store'
+import { Message } from 'element-ui'
+import NProgress from 'nprogress' // progress bar
+import 'nprogress/nprogress.css' // progress bar style
+import { getToken } from '@/utils/auth' // get token from cookie
+import getPageTitle from '@/utils/get-page-title'
-// NProgress.configure({ showSpinner: false }) // NProgress Configuration
+NProgress.configure({ showSpinner: false }) // NProgress Configuration
-// const whiteList = ['/login'] // no redirect whitelist
+const whiteList = ['/login'] // no redirect whitelist
-// router.beforeEach(async(to, from, next) => {
-// // start progress bar
-// NProgress.start()
+router.beforeEach(async(to, from, next) => {
+ // start progress bar
+ NProgress.start()
-// // set page title
-// document.title = getPageTitle(to.meta.title)
+ // set page title
+ document.title = getPageTitle(to.meta.title)
-// // determine whether the user has logged in
-// const hasToken = getToken()
+ // determine whether the user has logged in
+ const hasToken = getToken()
-// if (hasToken) {
-// if (to.path === '/login') {
-// // if is logged in, redirect to the home page
-// next({ path: '/' })
-// NProgress.done()
-// } else {
-// const hasGetUserInfo = store.getters.name
-// if (hasGetUserInfo) {
-// next()
-// } else {
-// try {
-// // get user info
-// await store.dispatch('user/getInfo')
+ if (hasToken) {
+ if (to.path === '/login') {
+ // if is logged in, redirect to the home page
+ next({ path: '/' })
+ NProgress.done()
+ } else {
+ const hasGetUserInfo = store.getters.name
+ if (hasGetUserInfo) {
+ next()
+ } else {
+ try {
+ // get user info
+ await store.dispatch('user/getInfo')
-// next()
-// } catch (error) {
-// // remove token and go to login page to re-login
-// await store.dispatch('user/resetToken')
-// Message.error(error || 'Has Error')
-// next(`/login?redirect=${to.path}`)
-// NProgress.done()
-// }
-// }
-// }
-// } else {
-// /* has no token*/
+ next()
+ } catch (error) {
+ // remove token and go to login page to re-login
+ await store.dispatch('user/resetToken')
+ Message.error(error || 'Has Error')
+ next(`/login?redirect=${to.path}`)
+ NProgress.done()
+ }
+ }
+ }
+ } else {
+ /* has no token*/
-// if (whiteList.indexOf(to.path) !== -1) {
-// // in the free login whitelist, go directly
-// next()
-// } else {
-// // other pages that do not have permission to access are redirected to the login page.
-// next(`/login?redirect=${to.path}`)
-// NProgress.done()
-// }
-// }
-// })
+ if (whiteList.indexOf(to.path) !== -1) {
+ // in the free login whitelist, go directly
+ next()
+ } else {
+ // other pages that do not have permission to access are redirected to the login page.
+ next(`/login?redirect=${to.path}`)
+ NProgress.done()
+ }
+ }
+})
-// router.afterEach(() => {
-// // finish progress bar
-// NProgress.done()
-// })
+router.afterEach(() => {
+ // finish progress bar
+ NProgress.done()
+})
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index dae4b00..8415e5c 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -20,7 +20,7 @@
</div>
</div>
</div>
- <div class="content-main"></div>
+ <div class="content-main" />
</div>
</template>
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 3b2ce0d..567f922 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -1,7 +1,7 @@
<template>
<div class="login-container">
<el-form ref="loginForm" :model="loginForm" class="login-form" auto-complete="on" label-position="left">
- <!-- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> -->
+ <!-- <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> -->
<!-- form 琛ㄥ崟鏍¢獙 -->
<div class="title-container">
<h3 class="title">鐧� 褰�</h3>
diff --git a/src/views/personal/myBusiness/index.vue b/src/views/personal/myBusiness/index.vue
index 32bcf78..033d8e0 100644
--- a/src/views/personal/myBusiness/index.vue
+++ b/src/views/personal/myBusiness/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="My-main">
- <div class="content-main"></div>
+ <div class="content-main" />
</div>
</template>
diff --git a/src/views/personal/myInformation/index.vue b/src/views/personal/myInformation/index.vue
index 0813686..3fc95ed 100644
--- a/src/views/personal/myInformation/index.vue
+++ b/src/views/personal/myInformation/index.vue
@@ -23,17 +23,17 @@
</div>
</div>
<div class="message">
- <div class="message-item"><span><i class="el-icon-edit" />鐢ㄦ埛鍚嶏細</span>{{infoTable.username}}</div>
+ <div class="message-item"><span><i class="el-icon-edit" />鐢ㄦ埛鍚嶏細</span>{{ infoTable.username }}</div>
<div class="message-item">
<span><i class="el-icon-edit" />濮撳悕锛�</span>
<el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />{{ infoTable.name }}</el-tag>
</div>
<div class="message-item">
<span><i class="el-icon-edit" />鐢佃瘽鍙风爜锛�</span>
- {{infoTable.cellPhone}}</div>
+ {{ infoTable.cellPhone }}</div>
<div class="message-item">
<span><i class="el-icon-edit" />閭锛�</span>
- {{infoTable.email}}</div>
+ {{ infoTable.email }}</div>
<div class="message-item">
<span><i class="el-icon-edit" />绛惧悕锛�</span>
2121212121212121</div>
@@ -153,7 +153,7 @@
</el-table-column>
</el-table> -->
<div class="message">
- <div class="message-item"><span><i class="el-icon-edit" />浼佷笟绠�绉帮細</span>{{businessTable.businessSmallName}}</div>
+ <div class="message-item"><span><i class="el-icon-edit" />浼佷笟绠�绉帮細</span>{{ businessTable.businessSmallName }}</div>
<div class="message-item">
<span><i class="el-icon-edit" />瀹屾暣鍚嶇О锛�</span>{{ businessTable.businessBigName }}
</div>
@@ -162,7 +162,7 @@
<el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />{{ businessTable.businessContact }}</el-tag></div>
<div class="message-item">
<span><i class="el-icon-edit" />鑱旂郴浜虹數璇濓細</span>
- {{businessTable.businessPhone}}</div>
+ {{ businessTable.businessPhone }}</div>
<div class="message-item">
<span><i class="el-icon-edit" />鍔犲叆鐘舵�侊細</span>
2121212121212121</div>
diff --git a/src/views/rawMaterials/reportForInspection/index.vue b/src/views/rawMaterials/reportForInspection/index.vue
index e8c9abe..cdc2cdb 100644
--- a/src/views/rawMaterials/reportForInspection/index.vue
+++ b/src/views/rawMaterials/reportForInspection/index.vue
@@ -109,7 +109,7 @@
</el-table-column>
</el-table>
<!-- 鍒嗛〉鍣� -->
- <div>
+ <div>
<el-pagination
:current-page="currentPage"
:page-sizes="[100, 200, 300, 400]"
@@ -119,7 +119,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
- </div>
+ </div>
</div>
</div>
</div>
diff --git a/src/views/standardLibrary/SpecificationDetails.vue b/src/views/standardLibrary/SpecificationDetails.vue
index 3efd266..82b069b 100644
--- a/src/views/standardLibrary/SpecificationDetails.vue
+++ b/src/views/standardLibrary/SpecificationDetails.vue
@@ -75,7 +75,7 @@
<div class="message-item"><span><i class="el-icon-edit" />鐢ㄦ埛鍚嶏細</span>121212121212</div>
<div class="message-item">
<span><i class="el-icon-edit" />濮撳悕锛�</span>
- <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}"/>{{ 'jack' }}</el-tag>
+ <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />{{ 'jack' }}</el-tag>
</div>
<div class="message-item">
<span><i class="el-icon-edit" />鐢佃瘽鍙风爜锛�</span>
@@ -98,7 +98,7 @@
</div>
<div class="message">
<div class="message-item">
- <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}"/>鍗曚綅锛氭濮�</el-tag>
+ <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />鍗曚綅锛氭濮�</el-tag>
</div>
<div class="message-item">
<span><i class="el-icon-edit" />鎷涙爣浜哄憳瑕佹眰锛氾紲3444</span>
diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue
index 10a4063..ce6dac9 100644
--- a/src/views/standardLibrary/index.vue
+++ b/src/views/standardLibrary/index.vue
@@ -30,14 +30,14 @@
</el-input>
</el-form-item>
<el-form-item>
- <el-button type="primary">鏌ヨ</el-button>
- <el-button type="primary" plain>閲嶇疆</el-button>
+ <el-button type="primary" @click="filteredTableData">鏌ヨ</el-button>
+ <el-button type="primary" plain @click="resetBtn">閲嶇疆</el-button>
<!-- <el-button type="text">楂樼骇鎼滅储<i class="el-icon-arrow-down el-icon--right" /></el-button> -->
</el-form-item>
</el-form>
</div>
<div class="serve-btn">
- <el-button type="primary" icon="el-icon-plus">鏂板浜哄憳</el-button>
+ <el-button type="primary" icon="el-icon-plus" @click="showFormInfo">{{ selectedNodeType }}</el-button>
</div>
</div>
<div class="table-box">
@@ -53,6 +53,7 @@
label="搴忓彿"
min-width="50"
/>
+ <!-- 澶嶇敤 -->
<el-table-column
v-for="(item,index) in tablespecifications"
:key="index"
@@ -89,12 +90,12 @@
placement="top"
width="30"
>
- <div style="text-align: center; margin: 0">
+ <div @click=" getRowID(scope.row)" style="text-align: center; margin: 0">
<div>
- <el-button size="mini" type="text">缂栬緫</el-button>
+ <el-button size="mini" @click="dialogFormVisible4=true" type="text">缂栬緫</el-button>
</div>
<div>
- <el-button size="mini" type="text">鍋滅敤</el-button>
+ <el-button size="mini" @click="dialogFormVisible5 = true" type="text">鍋滅敤</el-button>
</div>
</div>
<el-button slot="reference" type="text"><i class="el-icon-more" /></el-button>
@@ -102,9 +103,147 @@
</template>
</el-table-column>
</template>
-
</el-table>
+ <!-- 寮瑰嚭琛ㄥ崟椤� -->
<div>
+ <!-- 娣诲姞鏍囧噯 -->
+ <el-dialog title="娣诲姞鏍囧噯" :visible.sync="dialogFormVisible1">
+ <el-form ref="standardForm" :model="standardForm" :rules="rulesStandard">
+ <el-form-item label="鏍囧噯鍙�" :label-width="formLabelWidth" prop="standardnumber">
+ <el-input v-model="standardForm.standardnumber" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鏍囧噯鍚嶇О" :label-width="formLabelWidth" prop="standardname">
+ <el-input v-model="standardForm.standardname" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鑻辨枃鍚嶇О" :label-width="formLabelWidth" prop="standardenname">
+ <el-input v-model="standardForm.engname" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鐖剁骇鍒嗙被" :label-width="formLabelWidth">
+ <el-select v-model="standardForm.type" placeholder="璇烽�夋嫨">
+ <el-option label="鍘熸潗鏂�" value="0" />
+ <el-option label="鐢电嚎鐢电紗" value="1" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogFormVisible1 = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+ <!-- 娣诲姞鍨嬪彿 -->
+ <el-dialog title="娣诲姞鍨嬪彿" :visible.sync="dialogFormVisible2">
+ <el-form ref="form" :model="modelForm" :rules="rulesModel">
+ <el-form-item label="鍨嬪彿" :label-width="formLabelWidth" prop="model">
+ <el-input v-model="modelForm.model" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鍨嬪彿鍚嶇О" :label-width="formLabelWidth" prop="modelname">
+ <el-input v-model="modelForm.modelname" autocomplete="off" />
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogFormVisible2 = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitForm()">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+ <!-- 娣诲姞瑙勬牸 -->
+ <el-dialog title="娣诲姞瑙勬牸" :visible.sync="dialogFormVisible3">
+ <el-form ref="form" :model="specificationForm" :rules="rulesspecification">
+ <el-form-item label="瑙勬牸鍚嶇О" :label-width="formLabelWidth" prop="name">
+ <el-input v-model="specificationForm.name" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸缂栧彿" :label-width="formLabelWidth" prop="number">
+ <el-input v-model="specificationForm.number" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="涓婃柟濉啓鐢熶骇鎸囦护鍙�" :label-width="formLabelWidth" prop="instruct">
+ <el-input v-model="specificationForm.instruct" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鐢靛帇绛夌骇" :label-width="formLabelWidth">
+ <el-select v-model="specificationForm.voltageLevel" placeholder="璇烽�夋嫨鐢靛帇绛夌骇">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="涓荤嚎鑺埅闈�" :label-width="formLabelWidth">
+ <el-select v-model="specificationForm.crossSection" placeholder="璇烽�夋嫨涓荤嚎鑺埅闈�">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="涓荤嚎鑺姱鏁�" :label-width="formLabelWidth">
+ <el-select v-model="specificationForm.numberOfCores" placeholder="璇烽�夋嫨涓荤嚎鑺姱鏁�">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogFormVisible3 = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitForm()">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+ <!-- 缂栬緫瑙勬牸 -->
+ <el-dialog title="缂栬緫瑙勬牸" :visible.sync="dialogFormVisible4">
+ <el-form ref="form" :model="editSpeForm" :rules="rulesspecification">
+ <el-form-item label="瑙勬牸鍚嶇О" :label-width="formLabelWidth" prop="name">
+ <el-input v-model="editSpeForm.name" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="瑙勬牸缂栧彿" :label-width="formLabelWidth" prop="number">
+ <el-input v-model="editSpeForm.number" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="涓婃柟濉啓鐢熶骇鎸囦护鍙�" :label-width="formLabelWidth" prop="instruct">
+ <el-input v-model="editSpeForm.instruct" autocomplete="off" />
+ </el-form-item>
+ <el-form-item label="鐢靛帇绛夌骇" :label-width="formLabelWidth">
+ <el-select v-model="editSpeForm.voltageLevel" placeholder="璇烽�夋嫨鐢靛帇绛夌骇">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="涓荤嚎鑺埅闈�" :label-width="formLabelWidth">
+ <el-select v-model="editSpeForm.crossSection" placeholder="璇烽�夋嫨涓荤嚎鑺埅闈�">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="涓荤嚎鑺姱鏁�" :label-width="formLabelWidth">
+ <el-select v-model="editSpeForm.numberOfCores" placeholder="璇烽�夋嫨涓荤嚎鑺姱鏁�">
+ <el-option label="鍒嗙被1" value="test" />
+ <el-option label="鍒嗙被2" value="2" />
+ <el-option label="鍒嗙被3" value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="瑙勬牸鐘舵��" :label-width="formLabelWidth">
+ <el-select v-model="editSpeForm.spe_state" placeholder="璇烽�夋嫨瑙勬牸鐘舵��">
+ <el-option label="鍋滅敤" value="0" />
+ <el-option label="姝e父" value="1" />
+ <el-option label="鑽夌" value="-1" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogFormVisible4 = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="handleEdit">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+ <!-- 鍋滅敤 -->
+ <el-dialog
+ title="鎻愮ず"
+ :visible.sync="dialogFormVisible5"
+ width="30%">
+ <span>纭鍋滅敤鍚楋紵</span>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogFormVisible5 = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="updateSpeState">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+ <div>
+ <!-- 鍒嗛〉鍣� -->
<el-pagination
:current-page="pageParams.pageNo"
:page-sizes="[1, 2, 3, 4]"
@@ -122,10 +261,15 @@
</template>
<script>
-import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage } from '@/api/standardLibrary'
+import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage, addStandards, addSerialNumber, addSpecifications, updateSpecifications, updateSpeState } from '@/api/standardLibrary'
export default {
data() {
return {
+ dialogFormVisible1: false,
+ dialogFormVisible2: false,
+ dialogFormVisible3: false,
+ dialogFormVisible4: false,
+ dialogFormVisible5: false,
visible: false,
filterText: '',
// 鏍囧噯搴揵om鏍�
@@ -170,6 +314,7 @@
}
],
+ oldtableData: [],
// 鍒嗛〉鍙傛暟
pageParams: {
pageNo: 1,
@@ -181,7 +326,75 @@
// 閫変腑鑺傜偣瀵瑰簲鐨勮〃鏍� 0 鏄爣鍑嗚〃 1鏄瀷鍙疯〃 2瑙勬牸琛�
showTableCurrent: 0,
// 閫変腑鐨勮妭鐐规暟鎹�
- selectNode: {}
+ selectNode: {},
+ selectedNodeType: '娣诲姞鏍囧噯',
+ standardForm: [{
+ standardnumber: '',
+ standardname: '',
+ engname: '',
+ type: ''
+ }],
+ modelForm: [{
+ model: '',
+ modelname: ''
+ }],
+ specificationForm: [{
+ name: '', // 浜у搧瑙勬牸鍚嶇О
+ number: '', // 瑙勬牸缂栧彿
+ crossSection: '',
+ numberOfCores: '',
+ instruct: '',
+ voltageLevel: ''
+ }],
+ editSpeForm: [{
+ crossSection: '',
+ instruct: '',
+ name: '', // 瑙勬牸鍚嶇О
+ number: '', // 瑙勬牸缂栧彿
+ numberOfCores: '',
+ serialId: '', // 鍨嬪彿ID
+ spe_state: '',
+ voltageLevel: ''
+ }],
+ formLabelWidth: '120',
+ rulesStandard: {
+ standardnumber: [
+ {
+ required: true, message: '璇疯緭鍏ユ爣鍑嗗彿', trigger: 'blur'
+ }
+ ],
+ standardname: [{
+ required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: 'blur'
+ }],
+ standardenname: [
+ { required: false, message: '璇疯緭鍏ヨ嫳鏂囧悕绉�', trigger: 'blur' }
+ ]
+ },
+ rulesModel: {
+ model: [
+ { required: true, message: '璇疯緭鍏ュ瀷鍙�', trigger: 'blur'
+ }],
+ modelname: [{
+ required: true, message: '璇疯緭鍏ュ瀷鍙峰悕绉�', trigger: 'blur'
+ }],
+ parentclassification: [
+ { required: true, message: '璇疯緭鍏�', trigger: 'blur' }
+ ]
+ },
+ rulesspecification: {
+ number: [
+ { required: true, message: '璇疯緭鍏ヨ鏍肩紪鍙�', trigger: 'blur'
+ }],
+ name: [{
+ required: true, message: '璇疯緭鍏ヨ鏍煎悕绉�', trigger: 'blur'
+ }],
+ instruct: [
+ { required: true, message: '璇疯緭鍏ヤ笂鏂瑰~鍐欑敓浜ф寚浠ゅ彿', trigger: 'blur' }
+ ]
+ },
+ standardId: '', // 鑾峰彇褰撳墠鏍囧噯ID
+ modelId: '', // 鑾峰彇褰撳墠鍨嬪彿ID
+ rowId: '' // 鑾峰彇褰撳墠瑙勬牸鎵�鍦ㄨID
}
},
watch: {
@@ -200,6 +413,7 @@
},
// 鑾峰彇bom鏍戠殑鏍囧噯鏁版嵁
async getStandardTree() {
+ this.selectedNodeType = '娣诲姞鏍囧噯'
const { data: standard } = await getStandardsList()// 鑾峰彇鎵�鏈夋爣鍑�
// console.log(standard)// 鑾峰彇鎵�鏈夋爣鍑�
this.standardTree = standard.map(item => {
@@ -210,27 +424,38 @@
},
// 鐐瑰嚮bom鏍戣妭鐐规柟娉�
async nodeClick(data, node, element) {
- console.log(data)
+ // console.log('data', data)
// console.log('children' in data)
+ // 鏄瓙鑺傜偣
if (!('children' in data)) {
// console.log('鐐瑰嚮瀛愯妭鐐�', data)
+ this.selectedNodeType = '娣诲姞瑙勬牸'
+ this.modelId = data.id
this.selectNode = data
+ // 鑾峰彇鐐瑰嚮瀛愯妭鐐圭殑琛ㄦ牸
await this.getSpecifications(data)
return
}
+ // 涓嶆槸瀛愯妭鐐�
+ this.selectedNodeType = '娣诲姞鍨嬪彿'
+ this.standardId = data.id
this.selectNode = data
await this.getSerialNumber(data)
},
specificationDetails(row) {
// 璺宠浆浜у搧瑙勬牸璇︽儏椤�
- console.log(row)
this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`)
+ },
+ getRowID(row) {
+ // console.log(row.id)
+ this.id = row.id
},
// 鑾峰彇鎵�鏈夋爣鍑唗able
async getAllStandard() {
+ this.selectedNodeType = '娣诲姞鏍囧噯'
// console.log(this.pageParams)
const { data: { row, total }} = await getStandardsListOfPage({ ...this.pageParams })
- console.log('寰楀埌鎵�鏈夋爣鍑�==>', row)
+ // console.log('寰楀埌鎵�鏈夋爣鍑�==>', row)
this.pageParams.total = total
this.tableData = row
this.tablespecifications = [
@@ -270,7 +495,7 @@
// 鑾峰彇鏍囧噯涓嬪搴旂殑鎵�鏈夊瀷鍙�
async getSpecifications(data) {
const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, ...this.pageParams })
- console.log(row)
+ // console.log(row)
this.tableData = row
this.pageParams.total = total
this.tablespecifications = [
@@ -297,6 +522,42 @@
]
this.showTableCurrent = 2
},
+ // 灞曠ず寮瑰嚭妗�
+ showFormInfo() {
+ if (this.selectedNodeType === '娣诲姞鏍囧噯') {
+ this.dialogFormVisible1 = true
+ } else if (this.selectedNodeType === '娣诲姞鍨嬪彿') {
+ this.dialogFormVisible2 = true
+ } else {
+ this.dialogFormVisible3 = true
+ }
+ },
+ async submitForm() {
+ if (this.showTableCurrent === 0) {
+ await addStandards({ engName: this.standardForm.engname,
+ id: this.standardForm.standardnumber,
+ name: this.standardForm.standardname,
+ type: parseInt(this.standardForm.type) })
+ this.dialogFormVisible1 = false
+ } else if (this.showTableCurrent === 1) {
+ await addSerialNumber({ id: this.modelForm.model,
+ name: this.modelForm.modelname,
+ standardsId: this.standardId // 鍏宠仈鏍囧噯ID
+ })
+ this.dialogFormVisible2 = false
+ } else {
+ await addSpecifications({ crossSection: this.specificationForm.crossSection,
+ instruct: this.specificationForm.instruct,
+ name: this.specificationForm.name,
+ number: this.specificationForm.number,
+ numberOfCores: this.specificationForm.numberOfCores,
+ serialId: this.modelId, // 鍏宠仈鍨嬪彿ID
+ voltageLevel: this.specificationForm.voltageLevel
+ })
+ this.dialogFormVisible3 = false
+ }
+ },
+
// 鍒嗛〉鏉′欢鏀瑰彉鏃跺垽鏂渶瑕佸垎椤垫煡璇㈢殑鏂规硶
judgment() {
switch (this.showTableCurrent) {
@@ -320,6 +581,41 @@
console.log(`褰撳墠椤�: ${val}`)
this.pageParams.pageNo = val
this.judgment()
+ },
+ // 鏌ヨ鎸夐挳
+ filteredTableData() {
+ this.oldtableData = this.tableData
+ // 鏍规嵁杈撳叆鐨勫叧閿瓧寰楀埌杩囨护鍚庣殑鏁版嵁锛屽鏋滄湁灏辨妸杩囨护鍚庣殑鏁版嵁灞曠ず鍦ㄩ〉闈笂
+ const filteredtabledata = this.tableData.filter(item => {
+ return item.name.includes(this.searchData.keyword)
+ })
+ // console.log('filteredtabledata', filteredtabledata)
+ this.tableData = filteredtabledata
+ },
+ // 閲嶇疆鎸夐挳
+ resetBtn() {
+ this.searchData.keyword = ''
+ this.tableData = this.oldtableData
+ },
+ // 澶勭悊缂栬緫瑙勬牸
+ async handleEdit() {
+ // console.log(this.id)
+ await updateSpecifications({ crossSection: this.editSpeForm.crossSection,
+ id: this.rowId,
+ instruct: this.editSpeForm.instruct,
+ name: this.editSpeForm.name,
+ number: this.editSpeForm.number,
+ numberOfCores: this.editSpeForm.numberOfCores,
+ serialId: this.modelId, // 鍏宠仈鍨嬪彿ID
+ spe_state: this.editSpeForm.spe_state,
+ voltageLevel: this.editSpeForm.spe_state })
+ this.dialogFormVisible4 = false
+ },
+ // 鍋滅敤
+ async updateSpeState() {
+ await updateSpeState({ id: this.rowId,
+ spe_state: '0' })
+ this.dialogFormVisible5 = false
}
}
}
--
Gitblit v1.9.3