TaskTemplates.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <div class="page-container">
  3. <el-card>
  4. <div slot="header">
  5. <span>任务模板管理</span>
  6. <div style="float: right">
  7. <el-button
  8. type="primary"
  9. size="small"
  10. icon="el-icon-plus"
  11. @click="handleCreate"
  12. >
  13. 新建模板
  14. </el-button>
  15. <el-button
  16. size="small"
  17. @click="handleRefresh"
  18. :loading="loading"
  19. >
  20. 刷新
  21. </el-button>
  22. </div>
  23. </div>
  24. <!-- 搜索和筛选 -->
  25. <el-form :inline="true" :model="searchForm" style="margin-bottom: 20px">
  26. <el-form-item label="分类">
  27. <el-select v-model="searchForm.category" placeholder="全部分类" clearable @change="handleSearch">
  28. <el-option label="学习" value="学习"></el-option>
  29. <el-option label="家务" value="家务"></el-option>
  30. <el-option label="运动" value="运动"></el-option>
  31. <el-option label="阅读" value="阅读"></el-option>
  32. <el-option label="生活习惯" value="生活习惯"></el-option>
  33. <el-option label="其他" value="其他"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="难度">
  37. <el-select v-model="searchForm.difficulty" placeholder="全部难度" clearable @change="handleSearch">
  38. <el-option label="简单" value="easy"></el-option>
  39. <el-option label="中等" value="medium"></el-option>
  40. <el-option label="困难" value="hard"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="状态">
  44. <el-select v-model="searchForm.isActive" placeholder="全部状态" clearable @change="handleSearch">
  45. <el-option label="启用" :value="1"></el-option>
  46. <el-option label="禁用" :value="0"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" @click="handleSearch">搜索</el-button>
  51. <el-button @click="handleReset">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <!-- 模板列表 -->
  55. <div class="adm-table-wrap">
  56. <el-table
  57. :data="tableData"
  58. border
  59. v-loading="loading"
  60. style="width: 100%"
  61. height="100%"
  62. >
  63. <el-table-column prop="id" label="ID" width="80">
  64. <template slot="header">
  65. <span class="sort-header" @click.stop="onSortClick('id', $event)">ID<span v-if="sortIndex('id') !== null" class="sort-index" :class="sortClass('id') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('id') }}</span>{{ sortIcon('id') }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="title" label="模板名称" min-width="200">
  69. <template slot="header">
  70. <span class="sort-header" @click.stop="onSortClick('title', $event)">模板名称<span v-if="sortIndex('title') !== null" class="sort-index" :class="sortClass('title') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('title') }}</span>{{ sortIcon('title') }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="category" label="分类" width="100">
  74. <template slot-scope="scope">
  75. <el-tag :type="getCategoryType(scope.row.category)" size="small">
  76. {{ scope.row.category }}
  77. </el-tag>
  78. </template>
  79. <template slot="header">
  80. <span class="sort-header" @click.stop="onSortClick('category', $event)">分类<span v-if="sortIndex('category') !== null" class="sort-index" :class="sortClass('category') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('category') }}</span>{{ sortIcon('category') }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="points" label="积分" width="80">
  84. <template slot-scope="scope">
  85. <el-tag type="success">{{ scope.row.points }}</el-tag>
  86. </template>
  87. <template slot="header">
  88. <span class="sort-header" @click.stop="onSortClick('points', $event)">积分<span v-if="sortIndex('points') !== null" class="sort-index" :class="sortClass('points') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('points') }}</span>{{ sortIcon('points') }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="difficulty" label="难度" width="100">
  92. <template slot-scope="scope">
  93. <el-tag :type="getDifficultyType(scope.row.difficulty)" size="small">
  94. {{ getDifficultyText(scope.row.difficulty) }}
  95. </el-tag>
  96. </template>
  97. <template slot="header">
  98. <span class="sort-header" @click.stop="onSortClick('difficulty', $event)">难度<span v-if="sortIndex('difficulty') !== null" class="sort-index" :class="sortClass('difficulty') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('difficulty') }}</span>{{ sortIcon('difficulty') }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="recommendedAge" label="推荐年龄" width="100">
  102. <template slot-scope="scope">
  103. <span v-if="scope.row.recommendedAge">{{ scope.row.recommendedAge }}岁+</span>
  104. <span v-else>-</span>
  105. </template>
  106. <template slot="header">
  107. <span class="sort-header" @click.stop="onSortClick('recommendedAge', $event)">推荐年龄<span v-if="sortIndex('recommendedAge') !== null" class="sort-index" :class="sortClass('recommendedAge') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('recommendedAge') }}</span>{{ sortIcon('recommendedAge') }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column prop="duration" label="时长" width="80">
  111. <template slot-scope="scope">
  112. <span v-if="scope.row.duration">{{ scope.row.duration }}分钟</span>
  113. <span v-else>-</span>
  114. </template>
  115. <template slot="header">
  116. <span class="sort-header" @click.stop="onSortClick('duration', $event)">时长<span v-if="sortIndex('duration') !== null" class="sort-index" :class="sortClass('duration') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('duration') }}</span>{{ sortIcon('duration') }}</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="taskType" label="性质" width="80">
  120. <template slot-scope="scope">
  121. <el-tag v-if="scope.row.taskType === 'recurring'" type="warning" size="small">循环</el-tag>
  122. <el-tag v-else type="info" size="small">一次性</el-tag>
  123. </template>
  124. <template slot="header">
  125. <span class="sort-header" @click.stop="onSortClick('taskType', $event)">性质<span v-if="sortIndex('taskType') !== null" class="sort-index" :class="sortClass('taskType') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('taskType') }}</span>{{ sortIcon('taskType') }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column prop="needReview" label="需审核" width="80">
  129. <template slot-scope="scope">
  130. <el-tag v-if="scope.row.needReview === 1" type="warning" size="small">是</el-tag>
  131. <el-tag v-else type="info" size="small">否</el-tag>
  132. </template>
  133. <template slot="header">
  134. <span class="sort-header" @click.stop="onSortClick('needReview', $event)">需审核<span v-if="sortIndex('needReview') !== null" class="sort-index" :class="sortClass('needReview') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('needReview') }}</span>{{ sortIcon('needReview') }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column prop="isActive" label="状态" width="80">
  138. <template slot-scope="scope">
  139. <el-switch
  140. v-model="scope.row.isActive"
  141. :active-value="1"
  142. :inactive-value="0"
  143. @change="handleStatusChange(scope.row)"
  144. ></el-switch>
  145. </template>
  146. <template slot="header">
  147. <span class="sort-header" @click.stop="onSortClick('isActive', $event)">状态<span v-if="sortIndex('isActive') !== null" class="sort-index" :class="sortClass('isActive') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('isActive') }}</span>{{ sortIcon('isActive') }}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column prop="createdAt" label="创建时间" width="180">
  151. <template slot-scope="scope">
  152. {{ formatDate(scope.row.createdAt) }}
  153. </template>
  154. <template slot="header">
  155. <span class="sort-header" @click.stop="onSortClick('createdAt', $event)">创建时间<span v-if="sortIndex('createdAt') !== null" class="sort-index" :class="sortClass('createdAt') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('createdAt') }}</span>{{ sortIcon('createdAt') }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="操作" width="180" fixed="right">
  159. <template slot-scope="scope">
  160. <el-button
  161. type="text"
  162. size="small"
  163. @click="handleEdit(scope.row)"
  164. >
  165. 编辑
  166. </el-button>
  167. <el-button
  168. type="text"
  169. size="small"
  170. style="color: #F56C6C"
  171. @click="handleDelete(scope.row)"
  172. >
  173. 删除
  174. </el-button>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. </div>
  179. <!-- 分页 -->
  180. <el-pagination
  181. style="margin-top: 20px; text-align: right"
  182. @size-change="handleSizeChange"
  183. @current-change="handleCurrentChange"
  184. :current-page="pagination.current"
  185. :page-sizes="[10, 20, 50, 100]"
  186. :page-size="pagination.size"
  187. :total="pagination.total"
  188. layout="total, sizes, prev, pager, next, jumper"
  189. ></el-pagination>
  190. </el-card>
  191. <!-- 创建/编辑模板弹窗 -->
  192. <el-dialog
  193. :title="dialogTitle"
  194. :visible.sync="editDialogVisible"
  195. width="600px"
  196. @close="handleDialogClose"
  197. >
  198. <el-form :model="editForm" :rules="editRules" ref="editForm" label-width="120px">
  199. <el-form-item label="模板名称" prop="title">
  200. <el-input v-model="editForm.title" placeholder="请输入模板名称"></el-input>
  201. </el-form-item>
  202. <el-form-item label="描述" prop="description">
  203. <el-input
  204. type="textarea"
  205. v-model="editForm.description"
  206. placeholder="请输入任务描述"
  207. :rows="3"
  208. ></el-input>
  209. </el-form-item>
  210. <el-form-item label="分类" prop="category">
  211. <el-select v-model="editForm.category" placeholder="请选择分类">
  212. <el-option label="学习" value="学习"></el-option>
  213. <el-option label="家务" value="家务"></el-option>
  214. <el-option label="运动" value="运动"></el-option>
  215. <el-option label="阅读" value="阅读"></el-option>
  216. <el-option label="生活习惯" value="生活习惯"></el-option>
  217. <el-option label="其他" value="其他"></el-option>
  218. </el-select>
  219. </el-form-item>
  220. <el-form-item label="积分" prop="points">
  221. <el-input-number v-model="editForm.points" :min="1" :max="1000" placeholder="完成奖励积分"></el-input-number>
  222. </el-form-item>
  223. <el-form-item label="难度" prop="difficulty">
  224. <el-select v-model="editForm.difficulty" placeholder="请选择难度">
  225. <el-option label="简单" value="easy"></el-option>
  226. <el-option label="中等" value="medium"></el-option>
  227. <el-option label="困难" value="hard"></el-option>
  228. </el-select>
  229. </el-form-item>
  230. <el-form-item label="推荐年龄" prop="recommendedAge">
  231. <el-input-number v-model="editForm.recommendedAge" :min="0" :max="18" placeholder="推荐年龄"></el-input-number>
  232. <span style="margin-left: 10px; color: #909399">岁及以上</span>
  233. </el-form-item>
  234. <el-form-item label="预计时长" prop="duration">
  235. <el-input-number v-model="editForm.duration" :min="1" :max="480" placeholder="预计时长"></el-input-number>
  236. <span style="margin-left: 10px; color: #909399">分钟</span>
  237. </el-form-item>
  238. <el-form-item label="完成方式" prop="completeTypes">
  239. <el-checkbox-group v-model="editForm.completeTypes">
  240. <el-checkbox label="checkin">打卡</el-checkbox>
  241. <el-checkbox label="text">文本</el-checkbox>
  242. <el-checkbox label="voice">语音</el-checkbox>
  243. <el-checkbox label="image">图片</el-checkbox>
  244. <el-checkbox label="video">视频</el-checkbox>
  245. </el-checkbox-group>
  246. </el-form-item>
  247. <el-form-item label="任务性质" prop="taskType">
  248. <el-radio-group v-model="editForm.taskType">
  249. <el-radio label="onetime">一次性任务</el-radio>
  250. <el-radio label="recurring">循环任务</el-radio>
  251. </el-radio-group>
  252. </el-form-item>
  253. <el-form-item label="频率" prop="frequency" v-if="editForm.taskType === 'recurring'">
  254. <el-select v-model="editForm.frequency" placeholder="请选择频率">
  255. <el-option label="每天" value="daily"></el-option>
  256. <el-option label="每周" value="weekly"></el-option>
  257. <el-option label="每月" value="monthly"></el-option>
  258. </el-select>
  259. </el-form-item>
  260. <el-form-item label="周期次数" prop="maxFrequency" v-if="editForm.taskType === 'recurring'">
  261. <el-input-number v-model="editForm.maxFrequency" :min="1" :max="100" placeholder="周期内最多完成次数"></el-input-number>
  262. <span style="margin-left: 10px; color: #909399; font-size: 12px">
  263. 超过此次数不计积分
  264. </span>
  265. </el-form-item>
  266. <el-form-item label="需要审核" prop="needReview">
  267. <el-switch v-model="editForm.needReview" :active-value="1" :inactive-value="0"></el-switch>
  268. </el-form-item>
  269. <el-form-item label="审核方式" prop="reviewType" v-if="editForm.needReview === 1">
  270. <el-select v-model="editForm.reviewType" placeholder="请选择审核方式">
  271. <el-option label="创建人审核" value="creator"></el-option>
  272. <el-option label="家长审核" value="parent"></el-option>
  273. <el-option label="成长规划师审核" value="teacher"></el-option>
  274. <el-option label="AI自动审核" value="ai"></el-option>
  275. </el-select>
  276. </el-form-item>
  277. <el-form-item label="按分类审核" prop="reviewByCategory" v-if="editForm.needReview === 1 && editForm.reviewType === 'parent'">
  278. <el-switch v-model="editForm.reviewByCategory" :active-value="1" :inactive-value="0"></el-switch>
  279. <span style="margin-left: 10px; color: #909399; font-size: 12px">
  280. 开启后,将按照分类自动分配审核人
  281. </span>
  282. </el-form-item>
  283. </el-form>
  284. <div slot="footer">
  285. <el-button @click="editDialogVisible = false">取消</el-button>
  286. <el-button type="primary" @click="submitEdit" :loading="submitting">确定</el-button>
  287. </div>
  288. </el-dialog>
  289. </div>
  290. </template>
  291. <script>
  292. import SortMixin from '@/mixins/SortMixin'
  293. import { getTaskTemplateList, createTaskTemplate, updateTaskTemplate, deleteTaskTemplate } from '@/api/admin'
  294. export default {
  295. name: 'TaskTemplates',
  296. mixins: [SortMixin],
  297. computed: {
  298. tableHeight() {
  299. return window.innerHeight - 340
  300. }
  301. },
  302. data() {
  303. return {
  304. loading: false,
  305. submitting: false,
  306. tableData: [],
  307. sortableColumns: { id: 'ID', title: '模板名称', category: '分类', points: '积分', difficulty: '难度', recommendedAge: '推荐年龄', duration: '时长', taskType: '性质', needReview: '需审核', isActive: '状态', createdAt: '创建时间' },
  308. searchForm: {
  309. category: '',
  310. difficulty: '',
  311. isActive: null
  312. },
  313. pagination: {
  314. current: 1,
  315. size: 10,
  316. total: 0
  317. },
  318. editDialogVisible: false,
  319. isCreate: false,
  320. editForm: {
  321. id: null,
  322. title: '',
  323. description: '',
  324. category: '',
  325. points: 10,
  326. difficulty: 'medium',
  327. recommendedAge: null,
  328. duration: null,
  329. completeTypes: ['checkin'],
  330. taskType: 'onetime',
  331. frequency: null,
  332. maxFrequency: null,
  333. needReview: 1,
  334. reviewType: 'creator',
  335. reviewByCategory: 0,
  336. isActive: 1
  337. },
  338. editRules: {
  339. title: [
  340. { required: true, message: '请输入模板名称', trigger: 'blur' }
  341. ],
  342. category: [
  343. { required: true, message: '请选择分类', trigger: 'change' }
  344. ],
  345. points: [
  346. { required: true, message: '请输入积分', trigger: 'blur' }
  347. ],
  348. difficulty: [
  349. { required: true, message: '请选择难度', trigger: 'change' }
  350. ]
  351. }
  352. }
  353. },
  354. computed: {
  355. dialogTitle() {
  356. return this.isCreate ? '新建任务模板' : '编辑任务模板'
  357. }
  358. },
  359. mounted() {
  360. this.loadTemplates()
  361. },
  362. methods: {
  363. loadList() {
  364. this.loadTemplates()
  365. },
  366. async loadTemplates() {
  367. this.loading = true
  368. try {
  369. const params = {
  370. page: this.pagination.current,
  371. size: this.pagination.size,
  372. ...this.searchForm
  373. }
  374. if (this.sortState.length > 0) params.sort = this.sortState
  375. const res = await getTaskTemplateList(params)
  376. this.tableData = res.data.records || res.data || []
  377. this.pagination.total = res.data.total || this.tableData.length
  378. } catch (error) {
  379. this.$message.error(error.message || '加载模板列表失败')
  380. } finally {
  381. this.loading = false
  382. }
  383. },
  384. handleSearch() {
  385. this.pagination.current = 1
  386. this.loadTemplates()
  387. },
  388. handleReset() {
  389. this.searchForm = {
  390. category: '',
  391. difficulty: '',
  392. isActive: null
  393. }
  394. this.handleSearch()
  395. },
  396. handleRefresh() {
  397. this.loadTemplates()
  398. },
  399. handleSizeChange(val) {
  400. this.pagination.size = val
  401. this.pagination.current = 1
  402. this.loadTemplates()
  403. },
  404. handleCurrentChange(val) {
  405. this.pagination.current = val
  406. this.loadTemplates()
  407. },
  408. handleCreate() {
  409. this.isCreate = true
  410. this.editForm = {
  411. id: null,
  412. title: '',
  413. description: '',
  414. category: '',
  415. points: 10,
  416. difficulty: 'medium',
  417. recommendedAge: null,
  418. duration: null,
  419. completeTypes: ['checkin'],
  420. taskType: 'onetime',
  421. frequency: null,
  422. maxFrequency: null,
  423. needReview: 1,
  424. reviewType: 'creator',
  425. reviewByCategory: 0,
  426. isActive: 1
  427. }
  428. this.editDialogVisible = true
  429. },
  430. handleEdit(row) {
  431. this.isCreate = false
  432. // 解析 completeTypes(如果是字符串则转为数组)
  433. let completeTypes = row.completeTypes
  434. if (typeof completeTypes === 'string') {
  435. try {
  436. completeTypes = JSON.parse(completeTypes)
  437. } catch (e) {
  438. completeTypes = ['checkin']
  439. }
  440. }
  441. this.editForm = {
  442. id: row.id,
  443. title: row.title,
  444. description: row.description || '',
  445. category: row.category,
  446. points: row.points,
  447. difficulty: row.difficulty,
  448. recommendedAge: row.recommendedAge,
  449. duration: row.duration,
  450. completeTypes: completeTypes || ['checkin'],
  451. taskType: row.taskType || 'onetime',
  452. frequency: row.frequency,
  453. maxFrequency: row.maxFrequency,
  454. needReview: row.needReview,
  455. reviewType: row.reviewType || 'creator',
  456. reviewByCategory: row.reviewByCategory || 0,
  457. isActive: row.isActive
  458. }
  459. this.editDialogVisible = true
  460. },
  461. handleDialogClose() {
  462. this.$refs.editForm.resetFields()
  463. },
  464. async submitEdit() {
  465. this.$refs.editForm.validate(async (valid) => {
  466. if (valid) {
  467. this.submitting = true
  468. try {
  469. // 准备提交数据,确保 completeTypes 为 JSON 字符串
  470. const submitData = {
  471. ...this.editForm,
  472. completeTypes: JSON.stringify(this.editForm.completeTypes)
  473. }
  474. if (this.isCreate) {
  475. await createTaskTemplate(submitData)
  476. this.$message.success('创建成功')
  477. } else {
  478. await updateTaskTemplate(this.editForm.id, submitData)
  479. this.$message.success('更新成功')
  480. }
  481. this.editDialogVisible = false
  482. this.loadTemplates()
  483. } catch (error) {
  484. this.$message.error(error.message || (this.isCreate ? '创建失败' : '更新失败'))
  485. } finally {
  486. this.submitting = false
  487. }
  488. }
  489. })
  490. },
  491. async handleStatusChange(row) {
  492. try {
  493. await updateTaskTemplate(row.id, { isActive: row.isActive })
  494. this.$message.success(row.isActive === 1 ? '已启用' : '已禁用')
  495. } catch (error) {
  496. this.$message.error(error.message || '状态更新失败')
  497. // 恢复原状态
  498. row.isActive = row.isActive === 1 ? 0 : 1
  499. }
  500. },
  501. handleDelete(row) {
  502. this.$confirm(`确定要删除模板 "${row.title}" 吗?`, '提示', {
  503. confirmButtonText: '确定',
  504. cancelButtonText: '取消',
  505. type: 'warning'
  506. }).then(async () => {
  507. try {
  508. await deleteTaskTemplate(row.id)
  509. this.$message.success('删除成功')
  510. this.loadTemplates()
  511. } catch (error) {
  512. this.$message.error(error.message || '删除失败')
  513. }
  514. }).catch(() => {})
  515. },
  516. getCategoryType(category) {
  517. const types = {
  518. '学习': 'primary',
  519. '家务': 'success',
  520. '运动': 'warning',
  521. '阅读': 'info',
  522. '生活习惯': 'danger'
  523. }
  524. return types[category] || ''
  525. },
  526. getDifficultyType(difficulty) {
  527. const types = {
  528. easy: 'success',
  529. medium: 'warning',
  530. hard: 'danger'
  531. }
  532. return types[difficulty] || 'info'
  533. },
  534. getDifficultyText(difficulty) {
  535. const texts = {
  536. easy: '简单',
  537. medium: '中等',
  538. hard: '困难'
  539. }
  540. return texts[difficulty] || difficulty
  541. },
  542. formatDate(dateStr) {
  543. if (!dateStr) return '-'
  544. const date = new Date(dateStr)
  545. return date.toLocaleString('zh-CN')
  546. }
  547. }
  548. }
  549. </script>
  550. <style scoped>
  551. .sort-header {
  552. cursor: pointer;
  553. user-select: none;
  554. font-weight: 500;
  555. font-size: 12px;
  556. white-space: nowrap;
  557. }
  558. .sort-header:hover {
  559. color: #409eff;
  560. }
  561. </style>