From 42d6439f20892ddd204e2b6e2b3bf168fc516d5c Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 05 六月 2024 17:07:54 +0800
Subject: [PATCH] 1

---
 src/views/console/basic-data/gallery.vue         |  215 +++++++++++++++++++++++
 src/views/console/basic-data/supplier-info.vue   |  209 +++++++++++++++++++++++
 src/views/console/basic-data/addSupplierInfo.vue |  114 ++++++++++++
 3 files changed, 538 insertions(+), 0 deletions(-)

diff --git a/src/views/console/basic-data/addSupplierInfo.vue b/src/views/console/basic-data/addSupplierInfo.vue
new file mode 100644
index 0000000..1a724ca
--- /dev/null
+++ b/src/views/console/basic-data/addSupplierInfo.vue
@@ -0,0 +1,114 @@
+<template>
+	<el-dialog :title="titleMap[mode]" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
+		<el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
+			<el-row>
+				<el-col :span="24">
+					<el-form-item label="渚涘簲鍟嗙紪鍙�">
+						<el-input placeholder="淇濆瓨鏃剁郴缁熻嚜鍔ㄧ敓鎴�" disabled clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24">
+					<el-form-item label="渚涘簲鍟嗗悕绉�" prop="name">
+						<el-input v-model="form.name" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24">
+					<el-form-item label="渚涘簲鍟嗗湴鍧�">
+						<el-input v-model="form.address" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24">
+					<el-form-item label="鑱旂郴鏂瑰紡" prop="tel">
+						<el-input v-model="form.tel" 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="submit">淇� 瀛�</el-button>
+		</template>
+	</el-dialog>
+</template>
+
+<script>
+	export default {
+		emits: ['success', 'closed'],
+		data() {
+			var checkTel = (rule, value, callback) => {
+				var reg = /^1[0-9]{10}$/g;
+				if(value != "") {
+					if (!reg.test(value)) {
+						return callback(new Error('璇疯緭鍏�11浣嶆墜鏈哄彿鐮�'));
+					}
+				}
+				callback();
+			};
+			return {
+				mode: "add",
+				titleMap: {
+					add: '鏂板缓渚涘簲鍟�',
+					edit: '缂栬緫渚涘簲鍟�',
+					show: '鏌ョ湅'
+				},
+				visible: false,
+				isSaveing: false,
+				//琛ㄥ崟鏁版嵁
+				form: {
+					name: "",
+					address: "",
+					tel: ""
+				},
+				//楠岃瘉瑙勫垯
+				rules: {
+					name:[{required: true, message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О'}],
+					tel: [{required: true,validator: checkTel, trigger: 'blur'}]
+				},
+			}
+		},
+		mounted() {
+			
+		},
+		methods: {
+			//鏄剧ず
+			open(mode='add'){
+				this.mode = mode;
+				this.visible = true;
+				return this
+			},
+			//琛ㄥ崟鎻愪氦鏂规硶
+			submit(){
+				var obj = Object.assign({},this.form);
+				if(this.mode == 'edit') {
+					obj.isEdit = true;
+				}
+				this.$refs.dialogForm.validate(async (valid) => {
+					if (valid) {
+						this.isSaveing = true;
+						this.$HTTP.post("/api/blade-cps/supplier/save",obj).then(res=> {
+							this.isSaveing = false;
+							if(res.code == 200) {
+								this.$emit('success', this.form, this.mode);
+								this.visible = false;
+								this.$message.success("鎿嶄綔鎴愬姛");
+							}else {
+								this.$alert(res.message, "鎻愮ず", {type: 'error'});
+							}
+						})
+					}else{
+						return false;
+					}
+				})
+			},
+ 			//琛ㄥ崟娉ㄥ叆鏁版嵁
+			setData(data){
+				//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
+				console.log(data,222)
+				Object.assign(this.form, data)
+			}
+		}
+	}
+</script>
+
+<style>
+</style>
diff --git a/src/views/console/basic-data/gallery.vue b/src/views/console/basic-data/gallery.vue
new file mode 100644
index 0000000..f3c504a
--- /dev/null
+++ b/src/views/console/basic-data/gallery.vue
@@ -0,0 +1,215 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-06-05 17:06:58
+ * @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="main">
+		<div class="noData" v-if="latticeList.length == 0">
+			<div style="margin-bottom: 12px;">鏆傛棤鏁版嵁</div>
+			<el-button type="primary" @click="table_create">鏂板缓</el-button>
+		</div>
+		<div v-if="latticeList.length != 0">
+			<!-- 涓�涓牸瀛� -->
+			<el-button type="primary" @click="create_list" style="margin-bottom: 12px;">鏂板缓</el-button>
+			<div v-for="(item,index) in latticeList">
+				<!-- 鏂板鐨勫�� -->
+				<div  v-if="item.status != 1">
+					<el-input v-model="item.name" clearable style="width: 200px;" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
+					<span class="add-sure" @click="addLattice(index)">纭畾</span>
+					<span class="cencel" @click="cencelLattice(index)">鍙栨秷</span>
+				</div>
+				<!-- 鍙嶆樉鐨勫�� -->
+				<div v-if="item.status == 1">
+					<span class="title">{{item.name}}</span>
+					<span class="edit" @click="editData(index)"><el-icon><EditPen /></el-icon>缂栬緫</span>
+					<span class="delData" @click="delData(index)">鍒犻櫎</span>
+				</div>
+				<div class="upload">
+					<div v-for="(item1,index1) in item.ImageUrlList">
+						<img :src="item1.url" alt="" @click="viewUrl(item1)">
+					</div>
+					<el-upload
+						:disabled="!item.id"
+						:action="action"
+						list-type="picture-card"
+						:on-success="(file)=>handleAvatarSuccess(file,index)"
+						:before-upload="(file)=>beforeAvatarUpload(file,index)">
+						<el-icon><Plus /></el-icon>
+					</el-upload>
+					<el-dialog :visible.sync="dialogVisible">
+						<img width="100%" :src="dialogImageUrl" alt="">
+					</el-dialog>
+				</div>
+			</div>
+		</div>
+	</div>
+</template>
+<script>
+	import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+	let icons = []
+	for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+	    icons.push(key)
+	}
+	export default {
+		name: "supplier",
+		data(){
+			return {
+				dialogImageUrl: "",
+				action: "",
+				dialogVisible: false,
+				latticeList: [],
+				ImageUrlList: [],
+			}
+		},
+		created(){
+			
+		},
+		mounted(){
+			this.getTreeList();
+		},
+		components: {
+			...ElementPlusIconsVue
+		},
+		methods: {
+			viewUrl(item1) {
+				this.dialogVisible = true;
+				this.dialogImageUrl = item1.url;
+			},
+			editData(index) {
+				this.latticeList[index].status = 0;
+			},
+			delData(index) {
+				this.$confirm('鍒犻櫎','鎻愮ず', {
+					type: 'warning',
+				}).then(() => {
+					this.$HTTP.delete(`/api/blade-system/gallery/remove`,[this.latticeList[index].id]).then(res=> {
+						if(res.code == 200) {
+							this.getTreeList();
+							this.$message.success("鎿嶄綔鎴愬姛");
+						}else {
+							this.$alert(res.message, "鎻愮ず", {type: 'error'});
+						}
+					})
+				}).catch(() => {
+					//鍙栨秷
+				})
+			},
+			addLattice(index) {
+				var obj = {};
+				if(this.latticeList[index].id) {
+					Object.assign(obj,this.latticeList[index]);
+					obj.status = 1;
+					var method = "put";
+					var url = "/api/blade-system/gallery/update";
+				}else {
+					obj.name = this.latticeList[index].name;
+					var method = "post";
+					var url = "/api/blade-system/gallery/insert";
+				}
+				if (this.latticeList.some(item => item.name == "")) {  
+					this.$message.error("鍥惧簱鍚嶇О涓嶈兘涓虹┖锛�");  
+					return;  
+				}else {
+					this.$HTTP[method](url,obj).then(res=> {
+						if(res.code == 200) {
+							this.getTreeList();
+						}
+					})
+				}
+			},
+			getTreeList() {
+				this.$HTTP.get("/api/blade-system/gallery/tree?itemCount=999").then(res=> {
+					if(res.code == 200) {
+						this.latticeList = res.data;
+					}
+				})
+			},
+			cencelLattice(index) {
+				if(this.latticeList[index].id) {
+					this.latticeList[index].status = 1;
+				}else {
+					this.latticeList.splice(index,1);
+				}
+			},
+			beforeAvatarUpload(file,index) {
+				if(this.latticeList[index].id) {
+					this.action = `/api/blade-system/gallery-item/insert?galleryId=${this.latticeList[index].id}`;
+				}else {
+					return false;
+				}
+			},
+			handleRemove(file, fileList) {
+				console.log(file, fileList);
+			},
+			handlePictureCardPreview(file) {
+				
+			},
+			handleAvatarSuccess(file,index) {
+				this.latticeList[index].ImageUrlList.push({
+					url: file.url
+				})
+			},
+			table_create() {
+				this.latticeList.push({name: "",ImageUrlList: [],status: 0})
+			},
+			create_list() {
+				this.latticeList.unshift({name: "",ImageUrlList: [],status: 0})
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.main {
+		border: 1px solid #dcdfe6;
+		box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
+		margin: 8px;
+		padding: 8px;
+		background-color: #fff;
+		min-height: 100%;
+	}
+	.noData {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		height: 300px;
+		font-size: 16px;
+    	color: #5e6d82;
+	}
+	.add-sure {
+		color: #409eff;
+		margin: 0 10px;
+		cursor: pointer;
+	}
+	.cencel {
+		cursor: pointer;
+    	color: #fa554c;
+	}
+	.delData {
+		cursor: pointer;
+    	color: #fa554c;
+		font-size: 14px;
+		font-weight: 700;
+	}
+	.edit {
+		color: #409eff;
+		font-size: 14px;
+		font-weight: 700;
+		cursor: pointer;
+		margin-right: 12px;
+	}
+	.title {
+		font-size: 16px;
+		font-weight: 700;
+		margin-right: 20px;
+	}
+	.upload {
+		margin-top: 12px;
+		margin-bottom: 12px;
+	}
+</style>
diff --git a/src/views/console/basic-data/supplier-info.vue b/src/views/console/basic-data/supplier-info.vue
new file mode 100644
index 0000000..611afac
--- /dev/null
+++ b/src/views/console/basic-data/supplier-info.vue
@@ -0,0 +1,209 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-06-05 15:15:52
+ * @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="user-main">
+		<div class="user-top">
+			<div class="right-bottom"> 
+				<el-button type="primary" @click="addSupplier">鏂板缓</el-button>
+				<el-button type="danger" plain @click="delSupplier" :disabled="selection.length == 0">鍒犻櫎</el-button>
+			</div>
+			<div>
+				<el-input v-model="searchData.keyword" placeholder="杈撳叆妫�绱㈠唴瀹�" style="width: 180px;margin-right: 8px;" clearable>
+					<template #suffix><el-button type="primary" text @click="searchclick">鎼滅储</el-button></template>
+				</el-input>
+			</div>
+		</div>
+		<div class="user-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="code" label="渚涘簲鍟嗙紪鍙�"></el-table-column>
+				<el-table-column prop="name" label="渚涘簲鍟嗗悕绉�"></el-table-column>
+				<el-table-column prop="address" label="渚涘簲鍟嗗湴鍧�"></el-table-column>
+				<el-table-column prop="tel" label="鑱旂郴鏂瑰紡"></el-table-column>
+				<el-table-column fixed="right" label="鎿嶄綔">
+					<template #default="scope">
+						<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>
+					</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="addUserSuccess" @closed="dialog.save=false"></save-dialog>
+</template>
+<script>
+	import saveDialog from './addSupplierInfo'
+	export default {
+		name: "supplier",
+		data(){
+			return {
+				selection: [],
+				searchData: {
+					keyword: "",
+					current: "1",
+					size: "15"
+				},
+				total: 0,
+				isSaveing: false,
+				dialog: {
+					save: false
+				},
+				leftActive: true,
+				tableData: []
+			}
+		},
+		created(){
+			
+		},
+		mounted(){
+			this.searchSupplier();
+		},
+		components: {
+			saveDialog
+		},
+		methods: {
+			addUserSuccess() {
+				this.searchclick();
+			},
+			table_del(row) {
+				this.$confirm('纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?','鎻愮ず', {
+					type: 'warning',
+				}).then(() => {
+					this.$HTTP.delete(`/api/blade-cps/supplier/remove?supplierIds=${row.id}`).then(res=> {
+						if(res.code == 200) {
+							this.searchclick();
+							this.$message.success("鎿嶄綔鎴愬姛");
+						}else {
+							this.$alert(res.message, "鎻愮ず", {type: 'error'});
+						}
+					})
+				}).catch(() => {
+					//鍙栨秷
+				})
+			},
+			searchclick() {
+				this.searchData.current = "1";
+				this.searchData.size = "15";
+				this.searchSupplier();
+			},
+			searchSupplier() {
+				this.$HTTP.get("/api/blade-cps/supplier/page",this.searchData).then(res=> {
+					if(res.code == 200) {
+						res.data.records.forEach(item=> {
+							if(item.status == "1") {
+								item.status = true;
+							}else {
+								item.status = false;
+							}
+						})
+						this.tableData = res.data.records;
+						this.total = res.data.total;
+					}
+				})
+			},
+			//娣诲姞
+			addSupplier(){
+				this.dialog.save = true
+				this.$nextTick(() => {
+					this.$refs.saveDialog.open()
+				})
+			},
+			table_edit(row){
+				this.dialog.save = true
+				this.$nextTick(() => {
+					this.$refs.saveDialog.open('edit').setData(row)
+				})
+			},
+			//鏌ョ湅
+			table_show(row){
+				this.dialog.save = true
+				this.$nextTick(() => {
+					this.$refs.saveDialog.open('show').setData(row)
+				})
+			},
+			handleSelectionChange(selection) {
+				this.selection = selection;
+			},
+			delSupplier() {
+				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.$confirm('纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎锛�','鎻愮ず', {
+					type: 'warning',
+				}).then(() => {
+					that.$HTTP.delete("/api/blade-cps/supplier/remove?supplierIds="+selStr).then(res=> {
+						if(res.code == 200) {
+							that.$message.success("鎿嶄綔鎴愬姛");
+							that.searchSupplier();
+						}
+					})
+				}).catch(() => {
+					//鍙栨秷
+				})
+			},
+			handleSizeChange(val) {
+				console.log(`姣忛〉 ${val} 鏉);
+				this.searchData.current = "1";
+				this.searchData.size = val;
+				this.searchSupplier();
+			},
+			handleCurrentChange(val) {
+				console.log(`褰撳墠椤�: ${val}`);
+				this.searchData.current = val;
+				this.searchSupplier();
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.user-main {
+		background-color: #f9fafb;
+		border: 1px solid #dcdfe6;
+		box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
+		margin: 8px;
+		padding: 8px;
+		background-color: #fff;
+	}
+	.user-top {
+		width: 100%;
+		display: flex;
+		justify-content: space-between;
+		margin-bottom: 8px;
+	}
+	.user-table {
+		width: 100%;
+		margin-bottom: 8px;
+		
+	}
+	.multipleTableRef {
+		margin-bottom: 8px;
+	}
+</style>

--
Gitblit v1.9.3