综合办公系统
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

instrumentsList.vue 27KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-07-08 14:00:47
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-08-04 10:15:13
  6. -->
  7. <template>
  8. <view class="device-container">
  9. <!-- 顶部搜索栏 -->
  10. <view class="search-section">
  11. <view class="search-bar">
  12. <view class="search-input-wrapper">
  13. <uni-icons type="search" size="16" color="#999"></uni-icons>
  14. <input class="search-input" v-model="queryParams.name" placeholder="搜索设备名称" @confirm="handleQuery"
  15. @input="handleSearchInput" />
  16. <uni-icons v-if="queryParams.name" type="clear" size="16" color="#999" @click="clearSearch"></uni-icons>
  17. </view>
  18. </view>
  19. <!-- 筛选条件 -->
  20. <view class="filter-section" v-if="showFilter">
  21. <view class="filter-row">
  22. <view class="filter-item">
  23. <text class="filter-label">设备状态</text>
  24. <uni-data-select v-model="queryParams.status" :localdata="statusOptions" placeholder="全部状态"
  25. @change="handleQuery" />
  26. </view>
  27. <view class="filter-item">
  28. <text class="filter-label">设备品牌</text>
  29. <uni-easyinput v-model="queryParams.brand" placeholder="品牌筛选" @confirm="handleQuery" @blur="handleQuery"
  30. :inputBorder="false" :styles="{
  31. backgroundColor: '#fff',
  32. borderRadius: '8px',
  33. border: '1px solid #e0e0e0'
  34. }" />
  35. </view>
  36. </view>
  37. <view class="filter-row">
  38. <view class="filter-item">
  39. <text class="filter-label">出厂编号</text>
  40. <uni-easyinput v-model="queryParams.code" placeholder="编号筛选" @confirm="handleQuery" @blur="handleQuery"
  41. :inputBorder="false" :styles="{
  42. backgroundColor: '#fff',
  43. borderRadius: '8px',
  44. border: '1px solid #e0e0e0'
  45. }" />
  46. </view>
  47. <view class="filter-item">
  48. <text class="filter-label">规格型号</text>
  49. <uni-easyinput v-model="queryParams.series" placeholder="型号筛选" @confirm="handleQuery" @blur="handleQuery"
  50. :inputBorder="false" :styles="{
  51. backgroundColor: '#fff',
  52. borderRadius: '8px',
  53. border: '1px solid #e0e0e0'
  54. }" />
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 筛选按钮 -->
  59. <view class="filter-toggle" @click="toggleFilter">
  60. <text>筛选</text>
  61. <uni-icons :type="showFilter ? 'up' : 'down'" size="14" color="#666"></uni-icons>
  62. </view>
  63. </view>
  64. <!-- 设备列表 -->
  65. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="device-list" @scrolltoupper="upper"
  66. @scrolltolower="lower" @scroll="scroll" :refresher-enabled="true" :refresher-triggered="isRefreshing"
  67. @refresherrefresh="onRefresh" :lower-threshold="50" :upper-threshold="50">
  68. <view class="content-wrapper">
  69. <template v-if="deviceList.length > 0">
  70. <view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="handleViewDetail(item)">
  71. <view class="device-header">
  72. <view class="device-info">
  73. <text class="device-name">{{ item.name }}</text>
  74. <text class="device-brand">{{ item.brand }}</text>
  75. </view>
  76. <view class="device-status">
  77. <uni-tag :text="statusTypeText(item.status)" :type="statusTypeStyle(item.status)" size="small" />
  78. </view>
  79. </view>
  80. <view class="device-content">
  81. <view class="info-row">
  82. <text class="info-label">设备编号:</text>
  83. <text class="info-value">{{ item.deviceNumber || '暂无' }}</text>
  84. </view>
  85. <view class="info-row">
  86. <text class="info-label">规格型号:</text>
  87. <text class="info-value">{{ item.series || '暂无' }}</text>
  88. </view>
  89. <view class="info-row">
  90. <text class="info-label">出厂编号:</text>
  91. <text class="info-value">{{ item.code || '暂无' }}</text>
  92. </view>
  93. <view class="info-row">
  94. <text class="info-label">购置时间:</text>
  95. <text class="info-value">{{ formatDate(item.acquisitionTime) }}</text>
  96. </view>
  97. <view class="info-row">
  98. <text class="info-label">购买价格:</text>
  99. <text class="info-value price">¥{{ item.cost || '0' }}</text>
  100. </view>
  101. <view class="info-row">
  102. <text class="info-label">单日成本:</text>
  103. <text class="info-value cost">¥{{ item.dayCost || '0' }}</text>
  104. </view>
  105. </view>
  106. <view class="device-actions">
  107. <button class="action-btn view" @click.stop="handleViewDetail(item)">
  108. <uni-icons type="eye" size="14" color="#007AFF"></uni-icons>
  109. <text>查看</text>
  110. </button>
  111. <button class="action-btn edit" @click.stop="handleUpdate(item)" v-if="hasPermission('oa:device:edit')">
  112. <uni-icons type="compose" size="14" color="#FF9500"></uni-icons>
  113. <text>编辑</text>
  114. </button>
  115. <button class="action-btn delete" @click.stop="handleDelete(item)"
  116. v-if="hasPermission('oa:device:remove')">
  117. <uni-icons type="trash" size="14" color="#FF3B30"></uni-icons>
  118. <text>删除</text>
  119. </button>
  120. </view>
  121. </view>
  122. <!-- 加载更多 -->
  123. <view class="loading-more" v-if="hasMore">
  124. <text class="loading-text">加载中...</text>
  125. </view>
  126. <view class="no-more" v-else>
  127. <text class="no-more-text">没有更多数据了</text>
  128. </view>
  129. </template>
  130. <!-- 空状态 -->
  131. <view v-else class="empty-state">
  132. <image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image>
  133. <text class="empty-text">暂无设备数据</text>
  134. <text class="empty-subtext">点击下方按钮添加设备</text>
  135. </view>
  136. </view>
  137. </scroll-view>
  138. <!-- 悬浮按钮 -->
  139. <view class="fab-button" @click="handleAdd" v-if="hasPermission('oa:device:add')">
  140. <uni-icons type="plusempty" size="24" color="#fff"></uni-icons>
  141. </view>
  142. <!-- 设备详情弹窗 -->
  143. <uni-popup ref="detailPopup" type="center">
  144. <view class="detail-popup">
  145. <view class="popup-header">
  146. <text class="title">设备详情</text>
  147. <uni-icons type="close" size="20" @click="closeDetailPopup"></uni-icons>
  148. </view>
  149. <view class="popup-body">
  150. <view class="detail-item">
  151. <text class="detail-label">设备名称</text>
  152. <text class="detail-value">{{ currentDevice.name }}</text>
  153. </view>
  154. <view class="detail-item">
  155. <text class="detail-label">设备品牌</text>
  156. <text class="detail-value">{{ currentDevice.brand }}</text>
  157. </view>
  158. <view class="detail-item">
  159. <text class="detail-label">设备编号</text>
  160. <text class="detail-value">{{ currentDevice.deviceNumber }}</text>
  161. </view>
  162. <view class="detail-item">
  163. <text class="detail-label">规格型号</text>
  164. <text class="detail-value">{{ currentDevice.series }}</text>
  165. </view>
  166. <view class="detail-item">
  167. <text class="detail-label">出厂编号</text>
  168. <text class="detail-value">{{ currentDevice.code }}</text>
  169. </view>
  170. <view class="detail-item">
  171. <text class="detail-label">设备状态</text>
  172. <text class="detail-value">
  173. <uni-tag :text="statusTypeText(currentDevice.status)" :type="statusTypeStyle(currentDevice.status)"
  174. size="small" />
  175. </text>
  176. </view>
  177. <view class="detail-item">
  178. <text class="detail-label">购置时间</text>
  179. <text class="detail-value">{{ formatDate(currentDevice.acquisitionTime) }}</text>
  180. </view>
  181. <view class="detail-item">
  182. <text class="detail-label">购买价格</text>
  183. <text class="detail-value price">¥{{ currentDevice.cost }}</text>
  184. </view>
  185. <view class="detail-item">
  186. <text class="detail-label">预计使用年限</text>
  187. <text class="detail-value">{{ currentDevice.expectLife }}年</text>
  188. </view>
  189. <view class="detail-item">
  190. <text class="detail-label">单日成本</text>
  191. <text class="detail-value cost">¥{{ currentDevice.dayCost }}</text>
  192. </view>
  193. <view class="detail-item">
  194. <text class="detail-label">存放地点</text>
  195. <text class="detail-value">{{ currentDevice.place || '暂无' }}</text>
  196. </view>
  197. <view class="detail-item">
  198. <text class="detail-label">备注</text>
  199. <text class="detail-value">{{ currentDevice.remark || '暂无' }}</text>
  200. </view>
  201. </view>
  202. <view class="popup-footer">
  203. <button class="popup-btn cancel" @click="closeDetailPopup">关闭</button>
  204. <button class="popup-btn primary" @click="handleViewLogs">查看记录</button>
  205. </view>
  206. </view>
  207. </uni-popup>
  208. <!-- 新增/编辑设备弹窗 -->
  209. <uni-popup ref="formPopup" type="center">
  210. <view class="form-popup">
  211. <view class="popup-header">
  212. <text class="title">{{ isEdit ? '编辑设备' : '新增设备' }}</text>
  213. <uni-icons type="close" size="20" @click="closeFormPopup"></uni-icons>
  214. </view>
  215. <scroll-view scroll-y="true" class="popup-body">
  216. <view class="form-item">
  217. <text class="label">设备品牌 *</text>
  218. <uni-easyinput v-model="form.brand" placeholder="请输入设备品牌" />
  219. </view>
  220. <view class="form-item">
  221. <text class="label">设备名称 *</text>
  222. <uni-easyinput v-model="form.name" placeholder="请输入设备名称" />
  223. </view>
  224. <view class="form-item">
  225. <text class="label">设备类别</text>
  226. <uni-data-select v-model="form.type" :localdata="typeOptions" placeholder="请选择设备类别" />
  227. </view>
  228. <view class="form-item">
  229. <text class="label">规格型号</text>
  230. <uni-easyinput v-model="form.series" placeholder="请输入规格型号" />
  231. </view>
  232. <view class="form-item">
  233. <text class="label">购置时间</text>
  234. <view class="date-picker" @click="openDatePicker">
  235. <text v-if="form.acquisitionTime">{{ form.acquisitionTime }}</text>
  236. <text v-else class="placeholder">请选择购置时间</text>
  237. </view>
  238. </view>
  239. <view class="form-item">
  240. <text class="label">存放地点</text>
  241. <uni-easyinput v-model="form.place" placeholder="请输入存放地点" />
  242. </view>
  243. <view class="form-item">
  244. <text class="label">购买价格(元)</text>
  245. <uni-easyinput v-model="form.cost" type="number" placeholder="请输入购买价格" />
  246. </view>
  247. <view class="form-item">
  248. <text class="label">预计使用年限(年)</text>
  249. <uni-easyinput v-model="form.expectLife" type="number" placeholder="请输入使用年限" />
  250. </view>
  251. <view class="form-item">
  252. <text class="label">出厂编号</text>
  253. <uni-easyinput v-model="form.code" type="textarea" placeholder="请输入出厂编号" :autoHeight="true" />
  254. </view>
  255. <view class="form-item">
  256. <text class="label">单日成本(元)</text>
  257. <uni-easyinput v-model="form.dayCost" type="number" placeholder="请输入单日成本" />
  258. </view>
  259. <view class="form-item">
  260. <text class="label">管理部门</text>
  261. <uni-data-select v-model="form.manageDept" :localdata="deptOptions" placeholder="请选择管理部门" />
  262. </view>
  263. <view class="form-item">
  264. <text class="label">设备状态</text>
  265. <uni-data-select v-model="form.status" :localdata="statusOptions" placeholder="请选择设备状态" />
  266. </view>
  267. <view class="form-item">
  268. <text class="label">设备编号</text>
  269. <uni-easyinput v-model="form.deviceNumber" placeholder="请输入设备编号" />
  270. </view>
  271. <view class="form-item">
  272. <text class="label">备注</text>
  273. <uni-easyinput v-model="form.remark" type="textarea" placeholder="请输入备注信息" :autoHeight="true" />
  274. </view>
  275. </scroll-view>
  276. <view class="popup-footer">
  277. <button class="popup-btn cancel" @click="closeFormPopup">取消</button>
  278. <button class="popup-btn primary" @click="submitForm">确定</button>
  279. </view>
  280. </view>
  281. </uni-popup>
  282. <!-- 日期选择器 -->
  283. <uv-calendar ref="calendar" mode="single" @confirm="confirmDate"></uv-calendar>
  284. </view>
  285. </template>
  286. <script>
  287. import { listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/oa/device/device";
  288. export default {
  289. name: "InstrumentsList",
  290. data() {
  291. return {
  292. // 滚动相关
  293. scrollTop: 0,
  294. isRefreshing: false,
  295. hasMore: true,
  296. // 筛选相关
  297. showFilter: false,
  298. // 列表数据
  299. deviceList: [],
  300. total: 0,
  301. // 查询参数
  302. queryParams: {
  303. pageNum: 1,
  304. pageSize: 20,
  305. name: '',
  306. status: '',
  307. brand: '',
  308. code: '',
  309. series: ''
  310. },
  311. // 表单数据
  312. form: {},
  313. isEdit: false,
  314. // 当前查看的设备
  315. currentDevice: {},
  316. // 选项数据
  317. statusOptions: [
  318. { value: '0', text: '被领用' },
  319. { value: '1', text: '可领用' },
  320. { value: '2', text: '维修中' },
  321. { value: '3', text: '已停用' },
  322. { value: '4', text: '已报废' }
  323. ],
  324. typeOptions: [
  325. { value: '仪器设备', text: '仪器设备' },
  326. { value: '办公设备', text: '办公设备' }
  327. ],
  328. deptOptions: []
  329. };
  330. },
  331. onLoad() {
  332. this.getList();
  333. this.getDeptOptions();
  334. },
  335. methods: {
  336. // 获取设备列表
  337. async getList() {
  338. try {
  339. const response = await listDevice(this.queryParams);
  340. if (this.queryParams.pageNum === 1) {
  341. this.deviceList = response.rows || [];
  342. } else {
  343. this.deviceList = [...this.deviceList, ...(response.rows || [])];
  344. }
  345. this.total = response.total || 0;
  346. this.hasMore = this.deviceList.length < this.total;
  347. } catch (error) {
  348. console.error('获取设备列表失败:', error);
  349. uni.showToast({
  350. title: '获取数据失败',
  351. icon: 'none'
  352. });
  353. }
  354. },
  355. // 获取部门选项
  356. async getDeptOptions() {
  357. try {
  358. // 这里需要根据实际的部门API进行调整
  359. const deptList = this.$store.state.user.deptList || [];
  360. this.deptOptions = deptList.map(dept => ({
  361. value: dept.deptId,
  362. text: dept.deptName
  363. }));
  364. } catch (error) {
  365. console.error('获取部门列表失败:', error);
  366. }
  367. },
  368. // 搜索相关方法
  369. handleSearchInput() {
  370. // 可以在这里添加防抖搜索
  371. },
  372. handleQuery() {
  373. this.queryParams.pageNum = 1;
  374. this.getList();
  375. },
  376. clearSearch() {
  377. this.queryParams.name = '';
  378. this.handleQuery();
  379. },
  380. toggleFilter() {
  381. this.showFilter = !this.showFilter;
  382. },
  383. // 滚动相关方法
  384. upper() {
  385. // 下拉刷新
  386. },
  387. lower() {
  388. if (this.hasMore) {
  389. this.queryParams.pageNum++;
  390. this.getList();
  391. }
  392. },
  393. scroll(e) {
  394. this.scrollTop = e.detail.scrollTop;
  395. },
  396. async onRefresh() {
  397. this.isRefreshing = true;
  398. this.queryParams.pageNum = 1;
  399. await this.getList();
  400. this.isRefreshing = false;
  401. },
  402. // 设备操作方法
  403. handleViewDetail(item) {
  404. this.currentDevice = item;
  405. this.$refs.detailPopup.open();
  406. },
  407. closeDetailPopup() {
  408. this.$refs.detailPopup.close();
  409. },
  410. handleViewLogs() {
  411. this.closeDetailPopup();
  412. },
  413. handleAdd() {
  414. this.isEdit = false;
  415. this.resetForm();
  416. this.$refs.formPopup.open();
  417. },
  418. async handleUpdate(item) {
  419. this.isEdit = true;
  420. try {
  421. const response = await getDevice(item.deviceId);
  422. this.form = response.data || {};
  423. this.$refs.formPopup.open();
  424. } catch (error) {
  425. console.error('获取设备详情失败:', error);
  426. uni.showToast({
  427. title: '获取设备详情失败',
  428. icon: 'none'
  429. });
  430. }
  431. },
  432. closeFormPopup() {
  433. this.$refs.formPopup.close();
  434. },
  435. async handleDelete(item) {
  436. uni.showModal({
  437. title: '确认删除',
  438. content: `是否确认删除设备"${item.name}"?`,
  439. success: async (res) => {
  440. if (res.confirm) {
  441. try {
  442. await delDevice(item.deviceId);
  443. uni.showToast({
  444. title: '删除成功',
  445. icon: 'success'
  446. });
  447. this.getList();
  448. } catch (error) {
  449. console.error('删除设备失败:', error);
  450. uni.showToast({
  451. title: '删除失败',
  452. icon: 'none'
  453. });
  454. }
  455. }
  456. }
  457. });
  458. },
  459. // 表单相关方法
  460. resetForm() {
  461. this.form = {
  462. deviceId: null,
  463. brand: '',
  464. name: '',
  465. type: '仪器设备',
  466. series: '',
  467. acquisitionTime: '',
  468. place: '',
  469. cost: '',
  470. expectLife: '',
  471. code: '',
  472. dayCost: '',
  473. manageDept: '',
  474. status: '1',
  475. deviceNumber: '',
  476. remark: ''
  477. };
  478. },
  479. openDatePicker() {
  480. this.$refs.calendar.open();
  481. },
  482. confirmDate(e) {
  483. this.form.acquisitionTime = e.result;
  484. },
  485. async submitForm() {
  486. // 表单验证
  487. if (!this.form.name) {
  488. uni.showToast({
  489. title: '请输入设备名称',
  490. icon: 'none'
  491. });
  492. return;
  493. }
  494. try {
  495. if (this.isEdit) {
  496. await updateDevice(this.form);
  497. uni.showToast({
  498. title: '修改成功',
  499. icon: 'success'
  500. });
  501. } else {
  502. await addDevice(this.form);
  503. uni.showToast({
  504. title: '新增成功',
  505. icon: 'success'
  506. });
  507. }
  508. this.closeFormPopup();
  509. this.getList();
  510. } catch (error) {
  511. console.error('保存设备失败:', error);
  512. uni.showToast({
  513. title: '保存失败',
  514. icon: 'none'
  515. });
  516. }
  517. },
  518. // 工具方法
  519. formatDate(date) {
  520. if (!date) return '暂无';
  521. return new Date(date).toLocaleDateString();
  522. },
  523. statusTypeText(status) {
  524. const statusMap = {
  525. '0': '被领用',
  526. '1': '可领用',
  527. '2': '维修中',
  528. '3': '已停用',
  529. '4': '已报废'
  530. };
  531. return statusMap[status] || '未知';
  532. },
  533. statusTypeStyle(status) {
  534. const styleMap = {
  535. '0': 'warning',
  536. '1': 'success',
  537. '2': 'primary',
  538. '3': 'error',
  539. '4': 'info'
  540. };
  541. return styleMap[status] || 'default';
  542. },
  543. hasPermission(permission) {
  544. // 这里需要根据实际的权限系统进行调整
  545. return true;
  546. }
  547. }
  548. };
  549. </script>
  550. <style lang="scss" scoped>
  551. .device-container {
  552. height: 100vh;
  553. background-color: #f5f5f5;
  554. display: flex;
  555. flex-direction: column;
  556. }
  557. .search-section {
  558. background: #fff;
  559. padding: 10px 15px;
  560. border-bottom: 1px solid #eee;
  561. }
  562. .search-bar {
  563. margin-bottom: 10px;
  564. }
  565. .search-input-wrapper {
  566. display: flex;
  567. align-items: center;
  568. background: #f8f8f8;
  569. border-radius: 20px;
  570. padding: 8px 15px;
  571. .search-input {
  572. flex: 1;
  573. margin-left: 8px;
  574. font-size: 14px;
  575. }
  576. }
  577. .filter-section {
  578. background: #f8f8f8;
  579. border-radius: 8px;
  580. padding: 10px;
  581. margin-bottom: 10px;
  582. }
  583. .filter-row {
  584. display: flex;
  585. gap: 10px;
  586. margin-bottom: 10px;
  587. &:last-child {
  588. margin-bottom: 0;
  589. }
  590. }
  591. .filter-item {
  592. flex: 1;
  593. .filter-label {
  594. font-size: 13px;
  595. color: #666;
  596. margin-bottom: 8px;
  597. display: block;
  598. font-weight: 500;
  599. }
  600. // uni-easyinput 样式
  601. :deep(.uni-easyinput) {
  602. height: 40px !important;
  603. border-radius: 8px !important;
  604. .uni-easyinput__content {
  605. height: 100% !important;
  606. border-radius: 8px !important;
  607. border: 1px solid #e0e0e0 !important;
  608. background: #fff !important;
  609. transition: all 0.3s ease;
  610. &:focus-within {
  611. border-color: #6366f1 !important;
  612. box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1) !important;
  613. }
  614. }
  615. .uni-easyinput__content-input {
  616. padding: 0 12px !important;
  617. font-size: 14px !important;
  618. color: #333 !important;
  619. &::placeholder {
  620. color: #a0a0a0 !important;
  621. font-size: 13px !important;
  622. }
  623. }
  624. }
  625. }
  626. .filter-toggle {
  627. display: flex;
  628. align-items: center;
  629. justify-content: center;
  630. gap: 5px;
  631. font-size: 14px;
  632. color: #666;
  633. padding: 8px;
  634. }
  635. .device-list {
  636. flex: 1;
  637. }
  638. .content-wrapper {
  639. padding: 15px;
  640. }
  641. .device-card {
  642. background: #fff;
  643. border-radius: 12px;
  644. margin-bottom: 15px;
  645. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  646. overflow: hidden;
  647. }
  648. .device-header {
  649. display: flex;
  650. justify-content: space-between;
  651. align-items: center;
  652. padding: 15px;
  653. border-bottom: 1px solid #f0f0f0;
  654. background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
  655. }
  656. .device-info {
  657. flex: 1;
  658. .device-name {
  659. font-size: 16px;
  660. font-weight: 600;
  661. color: #333;
  662. display: block;
  663. margin-bottom: 4px;
  664. }
  665. .device-brand {
  666. font-size: 12px;
  667. color: #666;
  668. }
  669. }
  670. .device-content {
  671. padding: 15px;
  672. }
  673. .info-row {
  674. display: flex;
  675. margin-bottom: 8px;
  676. &:last-child {
  677. margin-bottom: 0;
  678. }
  679. .info-label {
  680. width: 80px;
  681. font-size: 13px;
  682. color: #666;
  683. flex-shrink: 0;
  684. }
  685. .info-value {
  686. flex: 1;
  687. font-size: 13px;
  688. color: #333;
  689. &.price,
  690. &.cost {
  691. color: #ff6b35;
  692. font-weight: 600;
  693. }
  694. }
  695. }
  696. .device-actions {
  697. display: flex;
  698. border-top: 1px solid #f0f0f0;
  699. .action-btn {
  700. flex: 1;
  701. display: flex;
  702. align-items: center;
  703. justify-content: center;
  704. gap: 4px;
  705. padding: 5px;
  706. background: none;
  707. border: none;
  708. font-size: 13px;
  709. &.view {
  710. color: #007AFF;
  711. }
  712. &.edit {
  713. color: #FF9500;
  714. border-left: 1px solid #f0f0f0;
  715. }
  716. &.delete {
  717. color: #FF3B30;
  718. border-left: 1px solid #f0f0f0;
  719. }
  720. }
  721. }
  722. .loading-more,
  723. .no-more {
  724. text-align: center;
  725. padding: 20px;
  726. .loading-text,
  727. .no-more-text {
  728. font-size: 14px;
  729. color: #999;
  730. }
  731. }
  732. .empty-state {
  733. text-align: center;
  734. padding: 60px 20px;
  735. .empty-image {
  736. width: 120px;
  737. height: 120px;
  738. margin-bottom: 20px;
  739. }
  740. .empty-text {
  741. font-size: 16px;
  742. color: #666;
  743. display: block;
  744. margin-bottom: 8px;
  745. }
  746. .empty-subtext {
  747. font-size: 14px;
  748. color: #999;
  749. }
  750. }
  751. .fab-button {
  752. position: fixed;
  753. right: 20px;
  754. bottom: 30px;
  755. width: 56px;
  756. height: 56px;
  757. background: #6366f1;
  758. border-radius: 50%;
  759. display: flex;
  760. align-items: center;
  761. justify-content: center;
  762. box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  763. z-index: 999;
  764. }
  765. // 弹窗样式
  766. .detail-popup,
  767. .form-popup {
  768. background: #fff;
  769. border-radius: 12px;
  770. width: 90vw;
  771. max-height: 80vh;
  772. display: flex;
  773. flex-direction: column;
  774. }
  775. .popup-header {
  776. display: flex;
  777. justify-content: space-between;
  778. align-items: center;
  779. padding: 20px;
  780. border-bottom: 1px solid #f0f0f0;
  781. .title {
  782. font-size: 18px;
  783. font-weight: 600;
  784. color: #333;
  785. }
  786. }
  787. .popup-body {
  788. flex: 1;
  789. padding: 20px;
  790. max-height: 60vh;
  791. }
  792. .detail-item {
  793. display: flex;
  794. margin-bottom: 15px;
  795. .detail-label {
  796. width: 80px;
  797. font-size: 14px;
  798. color: #666;
  799. flex-shrink: 0;
  800. }
  801. .detail-value {
  802. flex: 1;
  803. font-size: 14px;
  804. color: #333;
  805. &.price,
  806. &.cost {
  807. color: #ff6b35;
  808. font-weight: 600;
  809. }
  810. }
  811. }
  812. .form-item {
  813. margin-bottom: 20px;
  814. .label {
  815. font-size: 14px;
  816. color: #333;
  817. margin-bottom: 8px;
  818. display: block;
  819. }
  820. // uni-easyinput 样式
  821. :deep(.uni-easyinput) {
  822. .uni-easyinput__content {
  823. height: 45px !important;
  824. border: 1px solid #ddd !important;
  825. border-radius: 8px !important;
  826. background: #f8f8f8 !important;
  827. transition: all 0.3s ease;
  828. &:focus-within {
  829. border-color: #667eea !important;
  830. background: #fff !important;
  831. box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1) !important;
  832. }
  833. }
  834. .uni-easyinput__content-input {
  835. padding: 0 12px !important;
  836. font-size: 14px !important;
  837. color: #333 !important;
  838. &::placeholder {
  839. color: #999 !important;
  840. }
  841. }
  842. // textarea 样式
  843. &.uni-easyinput--textarea {
  844. .uni-easyinput__content {
  845. height: auto !important;
  846. min-height: 80px !important;
  847. }
  848. .uni-easyinput__content-textarea {
  849. padding: 12px !important;
  850. font-size: 14px !important;
  851. color: #333 !important;
  852. min-height: 60px !important;
  853. &::placeholder {
  854. color: #999 !important;
  855. }
  856. }
  857. }
  858. }
  859. .date-picker {
  860. padding: 12px;
  861. border: 1px solid #ddd;
  862. border-radius: 8px;
  863. background: #f8f8f8;
  864. font-size: 14px;
  865. .placeholder {
  866. color: #999;
  867. }
  868. }
  869. }
  870. .popup-footer {
  871. display: flex;
  872. gap: 15px;
  873. padding: 10px;
  874. border-top: 1px solid #f0f0f0;
  875. .popup-btn {
  876. flex: 1;
  877. padding: 1px;
  878. border-radius: 8px;
  879. font-size: 16px;
  880. border: none;
  881. &.cancel {
  882. background: #f5f5f5;
  883. color: #666;
  884. }
  885. &.primary {
  886. background: #6366f1;
  887. color: #fff;
  888. }
  889. }
  890. }
  891. </style>