| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-04-02 17:48:31 |
| | | * @FilePath: /smart-web/src/views/master/person/main/index.vue |
| | | * @Description: è¿æ¯é»è®¤è®¾ç½®,请设置`customMade`, æå¼koroFileHeaderæ¥çé
ç½® è¿è¡è®¾ç½®: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | | <template> |
| | | <div class="Product-main"> |
| | | <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> |
| | | <el-tab-pane label="产å" name="first"> |
| | | <div class="first-tabs" v-if="activeName == 'first'"> |
| | | <div> |
| | | <el-button type="primary" @click="addData" class="marginR12">æ°å»ºäº§å</el-button> |
| | | <!-- 导å
¥ --> |
| | | <import-table class="marginR12" :exportUrl="exportUrl" :uploadUrl="uploadUrl"></import-table> |
| | | <!-- å¯¼åº --> |
| | | <el-button type="primary" @click="getExport" class="marginR4">导åº</el-button> |
| | | <el-button type="danger" plain @click="delData" class="marginR12">å é¤</el-button> |
| | | </div> |
| | | <el-row class="search-condition"> |
| | | <el-col :span="5"> |
| | | <el-select v-model="searchData.test" :prefix-icon="Search" placeholder="è¯·éæ©" style="width: 100%;padding-right: 20px;"> |
| | | <template #prefix><span style="margin-right: 6px;">产åç±»å</span></template> |
| | | <el-option v-for="item in testList" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | | <el-input v-model="searchData.test" placeholder="请è¾å
¥" style="padding-right: 20px;"> |
| | | <template #prefix><span style="margin-right: 6px;">è§æ ¼åå·</span></template> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | | <el-select v-model="searchData.test" :prefix-icon="Search" placeholder="è¯·éæ©" style="width: 100%;padding-right: 20px;"> |
| | | <template #prefix><span style="margin-right: 6px;">ç¶æ</span></template> |
| | | <el-option v-for="item in testList" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | | <el-input v-model="searchData.test" placeholder="请è¾å
¥"> |
| | | <template #prefix><span style="margin-right: 6px;">ç¼å·/åç§°</span></template> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-icon @click="addDrawer" class="searchi-icon"><Setting /></el-icon> |
| | | </el-col> |
| | | </el-row> |
| | | <el-drawer title="æ¥è¯¢è®¾ç½®" v-model="drawer" :direction="direction" :before-close="handleClose" size="780" class="drawerClass"> |
| | | <div> |
| | | |
| | | </div> |
| | | <div class="drawer-foot"> |
| | | <el-button @click="closeDrawer">å
³é</el-button> |
| | | <el-button type="primary" @click="drawerConfirm" disabled>ä¿å</el-button> |
| | | </div> |
| | | </el-drawer> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="产åç±»å" name="second"> |
| | | <!-- <person-post v-if="activeName == 'second'"></person-post> --> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <!-- <div> |
| | | <div class="Product-table"> |
| | | <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="ProductValue" label="åå
¸åç§°"></el-table-column> |
| | | <el-table-column prop="sort" label="åå
¸æåº"></el-table-column> |
| | | <el-table-column prop="isSealed" label="å°å"> |
| | | <template #default="scope"> |
| | | <div>{{scope.row.isSealed == 0?"å¦":"æ¯"}}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="æä½"> |
| | | <template #default="scope"> |
| | | <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">æ¥ç</el-button> |
| | | <el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">ç¼è¾</el-button> |
| | | <el-button text type="primary" size="small" @click="table_del(scope.row, scope.$index)">å é¤</el-button> |
| | | <el-button text type="primary" size="small" @click="table_allocation(scope.row, scope.$index)">åå
¸é
ç½®</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | style="margin-top: 12px;" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage4" |
| | | :page-sizes="[15, 50, 100]" |
| | | :page-size="15" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total"> |
| | | </el-pagination> |
| | | </div> --> |
| | | </div> |
| | | |
| | | <save-dialog v-if="dialog.save" ref="saveDialog" @success="addProductSuccess" @closed="dialog.save=false"></save-dialog> |
| | | </template> |
| | | <script> |
| | | import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
| | | let icons = [] |
| | | for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
| | | icons.push(key) |
| | | } |
| | | import importTable from '@/layout/components/importTable.vue' |
| | | import saveDialog from './addProduct' |
| | | export default { |
| | | name: "allocation", |
| | | data(){ |
| | | return { |
| | | direction: "rtl", |
| | | drawer: false, |
| | | testList: [], |
| | | uploadUrl: "/api/blade-cps/employee/import-employee", |
| | | exportUrl: "/api/blade-cps/employee/export-template", |
| | | activeName: 'first', |
| | | selection: [], |
| | | total: 0, |
| | | searchData: { |
| | | test: "", |
| | | current: "1", |
| | | size: "15" |
| | | }, |
| | | dialog: { |
| | | save: false |
| | | }, |
| | | tableData: [] |
| | | } |
| | | }, |
| | | created(){ |
| | | |
| | | }, |
| | | mounted(){ |
| | | //this.searchBtn(); |
| | | }, |
| | | components: { |
| | | ...ElementPlusIconsVue,saveDialog,importTable |
| | | }, |
| | | methods: { |
| | | addDrawer() { |
| | | this.drawer = true; |
| | | }, |
| | | closeDrawer() { |
| | | this.drawer = false; |
| | | }, |
| | | drawerConfirm() { |
| | | this.drawer = false; |
| | | }, |
| | | handleClose(done) { |
| | | done(); |
| | | }, |
| | | getExport() { |
| | | this.$HTTP.get(`/api/blade-cps/employee/export-employee?` + this.$TOOL.qsStringify(this.searchData)).then(res => { |
| | | if (res.code == 200) { |
| | | window.open(res.data.link); |
| | | } |
| | | }) |
| | | }, |
| | | delProduct() { |
| | | |
| | | }, |
| | | addProduct() { |
| | | |
| | | }, |
| | | handleClick(tab, event) { |
| | | console.log(tab.props.label, this.activeName); |
| | | }, |
| | | addProductSuccess(addProductForm) { |
| | | this.searchClearBtn(); |
| | | }, |
| | | searchClearBtn() { |
| | | this.searchData = { |
| | | code: "", |
| | | ProductValue: "", |
| | | current: "1", |
| | | size: "15" |
| | | } |
| | | this.searchBtn(); |
| | | }, |
| | | searchclick() { |
| | | this.searchData.current = "1"; |
| | | this.searchData.size = "15"; |
| | | this.searchBtn(); |
| | | }, |
| | | searchBtn() { |
| | | this.$HTTP.get("/api/blade-system/Product/parent-list",this.searchData).then(res=> { |
| | | if(res.code == 200) { |
| | | this.tableData = res.data.records; |
| | | this.total = res.data.total; |
| | | } |
| | | }) |
| | | }, |
| | | //åå
¸é
ç½® |
| | | table_allocation(row) { |
| | | this.dialog.allocation = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.allocationDialog.open('edit').setData(row); |
| | | }) |
| | | }, |
| | | //å é¤ |
| | | table_del(row) { |
| | | var that = this; |
| | | this.$confirm(`ç¡®å®å°éæ©æ°æ®å é¤?`, '', { |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$HTTP.post("/api/blade-system/Product/remove?ids="+row.id).then(res=> { |
| | | if(res.code == 200) { |
| | | that.$message.success("æä½æå"); |
| | | that.searchBtn(); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | //æ·»å |
| | | addData(){ |
| | | this.dialog.save = true |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open() |
| | | }) |
| | | }, |
| | | table_edit(row){ |
| | | this.dialog.save = true |
| | | this.$HTTP.get("/api/blade-system/Product/detail?id="+row.id).then(res=> { |
| | | if(res.code == 200) { |
| | | this.dialog.save = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open('edit').setData(res.data); |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //æ¥ç |
| | | table_show(row){ |
| | | this.dialog.save = true |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open('show').setData(row) |
| | | }) |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | this.selection = selection; |
| | | }, |
| | | delData() { |
| | | if(this.selection.length == 0) { |
| | | this.$message({ |
| | | message: 'è¯·éæ©è³å°ä¸æ¡æ°æ®', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | var selStr = ""; |
| | | this.selection.map(item=> { |
| | | selStr += item.id + "," |
| | | }) |
| | | selStr = selStr.replace(/,$/, ''); |
| | | var that = this; |
| | | this.$HTTP.post("/api/blade-system/Product/remove?ids="+selStr).then(res=> { |
| | | if(res.code == 200) { |
| | | that.$message.success("æä½æå"); |
| | | that.searchclick(); |
| | | } |
| | | }) |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`æ¯é¡µ ${val} æ¡`); |
| | | this.searchData.current = "1"; |
| | | this.searchData.size = val; |
| | | this.searchBtn(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`å½å页: ${val}`); |
| | | this.searchData.current = val; |
| | | this.searchBtn(); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .Product-main { |
| | | background-color: #fff; |
| | | margin: 8px; |
| | | padding: 8px; |
| | | } |
| | | .Product-btn-bottom { |
| | | padding-left: 8px; |
| | | padding-right: 8px; |
| | | margin-bottom: 8px; |
| | | } |
| | | .multipleTableRef { |
| | | margin-bottom: 8px; |
| | | } |
| | | .search-condition { |
| | | margin-top: 12px; |
| | | } |
| | | .marginR4 { |
| | | margin-right: 4px; |
| | | } |
| | | .marginR12 { |
| | | margin-right: 12px; |
| | | } |
| | | .searchi-icon { |
| | | vertical-align: middle; |
| | | font-size: 18px; |
| | | margin-left: 12px; |
| | | margin-top: 7px; |
| | | } |
| | | </style> |