From 834b60cd68111f2bfda46976e1c92bc9fad6017c Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 20 五月 2024 16:33:32 +0800
Subject: [PATCH] 1
---
src/views/configuration/custom/setField.vue | 4
src/views/configuration/custom/index.vue | 8
src/views/console/basic-data/addProduct.vue | 147 ++++++++++++++++++
src/views/console/basic-data/product.vue | 309 ++++++++++++++++++++++++++++++++++++++
4 files changed, 462 insertions(+), 6 deletions(-)
diff --git a/src/views/configuration/custom/index.vue b/src/views/configuration/custom/index.vue
index 4e85584..5523b1b 100644
--- a/src/views/configuration/custom/index.vue
+++ b/src/views/configuration/custom/index.vue
@@ -16,7 +16,7 @@
<div class="card">
<div class="card-title">璁″垝</div>
<div class="card-desc">
- <span @click="goSetField">瀛楁閰嶇疆</span>
+ <span @click="goSetField(1)">瀛楁閰嶇疆</span>
<span>璁″垝璁剧疆</span>
</div>
</div>
@@ -29,7 +29,7 @@
<div class="card">
<div class="card-title">浜у搧</div>
<div class="card-desc">
- <span>瀛楁閰嶇疆</span>
+ <span @click="goSetField(2)">瀛楁閰嶇疆</span>
<span>鏄剧ず璁剧疆</span>
</div>
</div>
@@ -54,8 +54,8 @@
},
methods: {
- goSetField() {
- this.$router.push({path: '/configuration/custom/setField'});
+ goSetField(type) {
+ this.$router.push({path: '/configuration/custom/setField',query: {type: type}});
}
}
}
diff --git a/src/views/configuration/custom/setField.vue b/src/views/configuration/custom/setField.vue
index 622a21e..2cb3b92 100644
--- a/src/views/configuration/custom/setField.vue
+++ b/src/views/configuration/custom/setField.vue
@@ -8,7 +8,7 @@
-->
<template>
<div class="aposcope-main">
- <div class="title">璁″垝瀛楁</div>
+ <div class="title">{{$route.query.type == 1?"璁″垝":"浜у搧"}}瀛楁</div>
<el-button type="primary" @click="addField" style="margin: 4px 0px 10px;">娣诲姞鑷畾涔夊瓧娈�</el-button>
<div class="field-table">
<el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef">
@@ -65,7 +65,7 @@
},
getTableData() {
- this.$HTTP.get(`/api/blade-system/custom-template-field/list?businessType=1`).then(res=> {
+ this.$HTTP.get(`/api/blade-system/custom-template-field/list?businessType=${this.$route.query.type}`).then(res=> {
if(res.code == 200) {
this.tableData = res.data;
}
diff --git a/src/views/console/basic-data/addProduct.vue b/src/views/console/basic-data/addProduct.vue
new file mode 100644
index 0000000..b684540
--- /dev/null
+++ b/src/views/console/basic-data/addProduct.vue
@@ -0,0 +1,147 @@
+<template>
+ <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
+ <el-form :model="addDictForm" :rules="addDictRules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="瀛楀吀缂栧彿" prop="code">
+ <el-input v-model="addDictForm.code" placeholder="瀛楀吀缂栧彿" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀛楀吀鍚嶇О" prop="dictValue">
+ <el-input v-model="addDictForm.dictValue" placeholder="瀛楀吀鍚嶇О" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀛楀吀鎺掑簭" prop="sort">
+ <el-input v-model="addDictForm.sort" placeholder="瀛楀吀鎺掑簭" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="灏佸瓨">
+ <el-switch v-model="addDictForm.isSealed" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀛楀吀澶囨敞">
+ <el-input v-model="addDictForm.remark" placeholder="瀛楀吀澶囨敞" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <el-button @click="visible=false" >鍙� 娑�</el-button>
+ <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="dictSubmit()">淇� 瀛�</el-button>
+ </template>
+ </el-dialog>
+</template>
+
+<script>
+ export default {
+ emits: ['success', 'closed'],
+ data() {
+ return {
+ value1: true,
+ mode: "add",
+ titleMap: {
+ add: '鏂板',
+ edit: '淇敼',
+ show: '鏌ョ湅'
+ },
+ visible: false,
+ isSaveing: false,
+ //琛ㄥ崟鏁版嵁
+ addDictForm: {
+ code: "",
+ dictValue: "",
+ sort: "",
+ isSealed: false,
+ remark: "",
+ dictKey: "-1",
+ $isSealed: "鍚�"
+ },
+ //楠岃瘉瑙勫垯
+ addDictRules: {
+ code:[{required: true, message: '璇疯緭鍏ュ瓧鍏哥紪鍙�'}],
+ dictValue:[{required: true, message: '璇疯緭鍏ュ瓧鍏稿悕绉�'}],
+ sort:[{required: true, message: '璇疯緭鍏ュ瓧鍏告帓搴�'}]
+ },
+ //鎵�闇�鏁版嵁閫夐」
+ groups: [],
+ groupsProps: {
+ value: "id",
+ multiple: true,
+ checkStrictly: true
+ },
+ depts: [],
+ deptsProps: {
+ value: "id",
+ checkStrictly: true
+ }
+ }
+ },
+ mounted() {
+ // this.getGroup()
+ // this.getDept()
+ },
+ methods: {
+ //鏄剧ず
+ open(mode='add'){
+ this.mode = mode;
+ this.visible = true;
+ return this
+ },
+ //鍔犺浇鏍戞暟鎹�
+ async getGroup(){
+ var res = await this.$API.system.role.list.get();
+ this.groups = res.data.rows;
+ },
+ async getDept(){
+ var res = await this.$API.system.dept.list.get();
+ this.depts = res.data;
+ },
+ //琛ㄥ崟鎻愪氦鏂规硶
+ dictSubmit(){
+ var obj = Object.assign({},this.addDictForm);
+ if(obj.isSealed === true) {
+ obj.$isSealed = "鏄�";
+ obj.isSealed = "1";
+ }else {
+ obj.$isSealed = "鍚�";
+ obj.isSealed = "0";
+ }
+ this.$refs.dialogForm.validate(async (valid) => {
+ if (valid) {
+ this.isSaveing = true;
+ this.$HTTP.post("/api/blade-system/dict/submit",obj).then(res=> {
+ this.isSaveing = false;
+ if(res.code == 200) {
+ this.$emit('success', this.addDictForm, this.mode);
+ this.visible = false;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ }else {
+ this.$alert(res.message, "鎻愮ず", {type: 'error'});
+ }
+ })
+ }else{
+ return false;
+ }
+ })
+ },
+ //琛ㄥ崟娉ㄥ叆鏁版嵁
+ setData(data){
+ console.log(data)
+ //鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
+ if(data.isSealed == "1") {
+ data.isSealed = true;
+ }else {
+ data.isSealed = false;
+ }
+ Object.assign(this.addDictForm, data);
+ }
+ }
+ }
+</script>
+
+<style>
+</style>
diff --git a/src/views/console/basic-data/product.vue b/src/views/console/basic-data/product.vue
new file mode 100644
index 0000000..547b83d
--- /dev/null
+++ b/src/views/console/basic-data/product.vue
@@ -0,0 +1,309 @@
+<!--
+ * @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>
--
Gitblit v1.9.3