From 24f914a80d01fa8e5c6cfcba14ae59a6c0a117a8 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 25 八月 2025 09:39:22 +0800
Subject: [PATCH] 修改

---
 Web/src/views/Customer/fBS_CusExtend/component/fBS_Customer/editDialog.vue |  262 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 262 insertions(+), 0 deletions(-)

diff --git a/Web/src/views/Customer/fBS_CusExtend/component/fBS_Customer/editDialog.vue b/Web/src/views/Customer/fBS_CusExtend/component/fBS_Customer/editDialog.vue
new file mode 100644
index 0000000..3113875
--- /dev/null
+++ b/Web/src/views/Customer/fBS_CusExtend/component/fBS_Customer/editDialog.vue
@@ -0,0 +1,262 @@
+锘�<script lang="ts" name="fBS_Customer" setup>
+import { ref, reactive, onMounted } from "vue";
+import type { FormRules } from "element-plus";
+import { formatDate } from '/@/utils/formatTime';
+import { useFBS_CustomerApi } from '/@/api/Customer/fBS_Customer';
+import { useFBS_CusExtendApi } from '/@/api/Customer/fBS_CusExtend';
+import { auth } from '/@/utils/authFunction';
+import { ElMessageBox, ElMessage } from "element-plus";
+import { downloadStreamFile } from "/@/utils/download";
+import editDialog from '/@/views/Customer/fBS_CusExtend/component/fBS_Customer/component/editDialog.vue'
+import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
+import ModifyRecord from '/@/components/table/modifyRecord.vue';
+import ImportData from "/@/components/table/importData.vue";
+
+const fBS_CusExtendApi = useFBS_CusExtendApi();
+
+const fBS_CustomerApi = useFBS_CustomerApi();
+const printDialogRef = ref();
+const editDialogRef = ref();
+const importDataRef = ref();
+const state = reactive({
+	title: '',
+	loading: false,
+	showDialog: false,
+	ruleForm: {} as any,
+	stores: {},
+	dropdownData: {} as any,
+	exportLoading: false,
+	tableLoading: false,
+	showAdvanceQueryUI: false,
+	selectData: [] as any[],
+	tableQueryParams: {} as any,
+	tableParams: {
+		page: 1,
+		pageSize: 20,
+		total: 0,
+		field: 'createTime', // 榛樿鐨勬帓搴忓瓧娈�
+		order: 'descending', // 鎺掑簭鏂瑰悜
+		descStr: 'descending', // 闄嶅簭鎺掑簭鐨勫叧閿瓧绗�
+	},
+	tableData: [],
+	listRow:{}
+});
+
+// 椤甸潰鍔犺浇鏃�
+onMounted(async () => {
+});
+
+/**
+ * 鏍规嵁id瀵规暟缁勫厓绱犺繘琛屾搷浣滐細瀛樺湪鍒欐浛鎹紝涓嶅瓨鍦ㄥ垯娣诲姞锛屾寚瀹氬垹闄ゅ垯绉婚櫎
+ * @param {Array} array - 瑕佹搷浣滅殑鍘熸暟缁�
+ * @param {Object} item - 瑕佹搷浣滅殑鍏冪礌锛屽繀椤诲寘鍚玦d灞炴��
+ * @param {boolean} [deleteFlag=false] - 鏄惁鎵ц鍒犻櫎鎿嶄綔
+ * @returns {Array} 澶勭悊鍚庣殑鏁扮粍
+ */
+function operateByid(array, item, deleteFlag = false) {
+    // 妫�鏌ュ厓绱犳槸鍚﹀寘鍚玦d
+    // if (!item || !('id' in item)) {
+    //     console.warn('鍏冪礌蹇呴』鍖呭惈id灞炴��');
+    //     return [...array];
+    // }
+    
+    // 鍒涘缓鍘熸暟缁勭殑鍓湰锛岄伩鍏嶇洿鎺ヤ慨鏀瑰師鏁扮粍
+    const newArray = [...array];
+    // 鏌ユ壘鏁扮粍涓槸鍚﹀瓨鍦ㄧ浉鍚宨d鐨勫厓绱�
+    const index = newArray.findIndex(i => i.id === item.id);
+    
+    if (deleteFlag) {
+        // 濡傛灉闇�瑕佸垹闄や笖鍏冪礌瀛樺湪锛屽垯浠庢暟缁勪腑绉婚櫎
+        if (index !== -1) {
+            newArray.splice(index, 1);
+        }
+    } else {
+        if (index !== -1) {
+            // 瀛樺湪鍒欐浛鎹�
+            newArray[index] = item;
+        } else {
+            // 涓嶅瓨鍦ㄥ垯娣诲姞
+            newArray.push(item);
+        }
+    }
+    
+    return newArray;
+}
+// 鏌ヨ鎿嶄綔
+const handleQuery = async (params: any = {}, deleteFlag:false) => {
+  state.tableLoading = true;
+  state.tableData = operateByid(state.tableData,params,deleteFlag)
+  console.log(params);
+  
+  state.tableLoading = false;
+};
+
+// 鍒楁帓搴�
+const sortChange = async (column: any) => {
+  state.tableParams.field = column.prop;
+  state.tableParams.order = column.order;
+  await handleQuery();
+};
+
+// 鍒犻櫎
+const delFBS_Customer = (row: any) => {
+	console.log(row,'rowrow');
+	
+  ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(async () => {
+    await fBS_CusExtendApi.delCustormerUser(row.id);
+    handleQuery(row,true);
+    ElMessage.success("鍒犻櫎鎴愬姛");
+  }).catch(() => {});
+};
+
+// 鎵归噺鍒犻櫎
+const batchDelFBS_Customer = () => {
+  ElMessageBox.confirm(`纭畾瑕佸垹闄�${state.selectData.length}鏉¤褰曞悧?`, "鎻愮ず", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(async () => {
+    await fBS_CustomerApi.batchDelete(state.selectData.map(u => ({ id: u.id }) )).then(res => {
+      ElMessage.success(`鎴愬姛鎵归噺鍒犻櫎${res.data.result}鏉¤褰昤);
+      handleQuery();
+    });
+  }).catch(() => {});
+};
+
+// // 璁剧疆鐘舵��
+// const changeFBS_CustomerStatus = async (row: any) => {
+//   await fBS_CusExtendApi.setStatus({ id: row.id, status: row.status }).then(() => ElMessage.success('鐘舵�佽缃垚鍔�'));
+// };
+
+// 瀵煎嚭鏁版嵁
+const exportFBS_CustomerCommand = async (command: string) => {
+  try {
+    state.exportLoading = true;
+    if (command === 'select') {
+      const params = Object.assign({}, state.tableQueryParams, state.tableParams, { selectKeyList: state.selectData.map(u => u.id) });
+      await fBS_CustomerApi.exportData(params).then(res => downloadStreamFile(res));
+    } else if (command === 'current') {
+      const params = Object.assign({}, state.tableQueryParams, state.tableParams);
+      await fBS_CustomerApi.exportData(params).then(res => downloadStreamFile(res));
+    } else if (command === 'all') {
+      const params = Object.assign({}, state.tableQueryParams, state.tableParams, { page: 1, pageSize: 99999999 });
+      await fBS_CustomerApi.exportData(params).then(res => downloadStreamFile(res));
+    }
+  } finally {
+    state.exportLoading = false;
+  }
+}
+
+handleQuery();
+//鐖剁骇浼犻�掓潵鐨勫嚱鏁帮紝鐢ㄤ簬鍥炶皟
+const emit = defineEmits(["reloadTable"]);
+const ruleFormRef = ref();
+
+
+
+
+// 椤甸潰鍔犺浇鏃�
+onMounted(async () => {
+});
+
+// 鎵撳紑寮圭獥
+const openDialog = async (row: any, title: string) => {
+	state.title = title;
+	let res = JSON.parse(JSON.stringify(row))
+	state.tableData = res.custormerUsers
+	state.listRow = row
+	// state.ruleForm = row.id ? await fBS_CustomerApi.detail(row.id).then(res => res.data.result) : JSON.parse(JSON.stringify(row));
+	state.showDialog = true;
+};
+
+// 鍏抽棴寮圭獥
+const closeDialog = () => {
+	emit("reloadTable");
+	state.showDialog = false;
+};
+
+// 鎻愪氦
+const submit = async () => {
+	closeDialog();
+};
+
+//灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠�
+defineExpose({ openDialog });
+</script>
+<template>
+	<div class="fBS_Customer-container">
+		<el-dialog v-model="state.showDialog" :width="1200" draggable @close="closeDialog" :close-on-click-modal="false">
+			<template #header>
+				<div style="color: #fff">
+					<span>{{ state.title }}</span>
+				</div>
+			</template>
+			<div class="flex-end">
+				<el-button @click="editDialogRef.openDialog(null, '鏂板鐢ㄦ埛',state.listRow)" v-auth="'fBS_Customer:add'" type="primary" v-reclick="1000">鏂板缓</el-button>
+			</div>
+			<el-card class="full-table" shadow="hover" style="margin-top: 5px">
+				<el-table :data="state.tableData" @selection-change="(val: any[]) => { state.selectData = val; }"
+					style="width: 100%" v-loading="state.tableLoading" tooltip-effect="light" row-key="id"
+					@sort-change="sortChange" border>
+					<el-table-column type="selection" width="40" align="center"
+						v-if="false" />
+					<!-- <el-table-column type="index" label="搴忓彿" width="55" align="center" /> -->
+					<el-table-column prop='name' label='濮撳悕' sortable='custom' show-overflow-tooltip />
+					<el-table-column prop='isManager' label='瑙掕壊' sortable='custom' show-overflow-tooltip >
+					<template #default="scope">
+						<el-switch 
+						disabled="disabled"
+						v-model="scope.row.isManager" 
+						:active-value='true'
+            			:inactive-value='false'
+            			active-text="绠$悊鍛�"
+            			inactive-text="鍛樺伐" 
+						size="small"
+						inline-prompt
+						/>
+					</template>
+						</el-table-column>
+					<el-table-column prop='phoneNumber' label='鎵嬫満鍙风爜' show-overflow-tooltip />
+					<el-table-column prop='isEn' label='鏄惁鍚敤' v-auth="'fBS_Customer:setStatus'" show-overflow-tooltip>
+						<template #default="scope">
+							<el-tag :type="scope.row.isEn?'primary':'error'">{{ scope.row.isEn?'鏄�':'鍚�' }}</el-tag>
+						</template>
+					</el-table-column>
+					<el-table-column prop='remark' label='澶囨敞' show-overflow-tooltip />
+					<el-table-column label="鎿嶄綔" width="70" align="center" fixed="right" show-overflow-tooltip
+						v-if="auth('fBS_Customer:update') || auth('fBS_Customer:delete')">
+						<template #default="scope">
+							<el-button icon="ele-Edit" size="small" text type="primary"
+								@click="editDialogRef.openDialog(scope.row, '缂栬緫鐢ㄦ埛淇℃伅')" v-auth="'fBS_Customer:update'">
+							</el-button>
+							<el-button icon="ele-Delete" size="small" text type="primary"
+								@click="delFBS_Customer(scope.row)" v-auth="'fBS_Customer:delete'"> </el-button>
+						</template>
+					</el-table-column>
+				</el-table>
+				
+				<ImportData ref="importDataRef" :import="fBS_CustomerApi.importData"
+					:download="fBS_CustomerApi.downloadTemplate" v-auth="'fBS_Customer:import'"
+					@refresh="handleQuery" />
+				<printDialog ref="printDialogRef" :title="'鎵撳嵃瀹㈡埛琛�'" @reloadTable="handleQuery" />
+				<editDialog ref="editDialogRef" @reloadTable="handleQuery" />
+			</el-card>
+			<template #footer>
+				<span class="dialog-footer">
+					<el-button @click="submit">鍙� 娑�</el-button>
+					<el-button @click="submit" type="primary" v-reclick="1000">纭� 瀹�</el-button>
+				</span>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+<style lang="scss" scoped>
+:deep(.el-select),
+:deep(.el-input-number) {
+	width: 100%;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1