From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 11:46:57 +0800
Subject: [PATCH] 项目初始化

---
 pages/work/notice/edit.vue |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)

diff --git a/pages/work/notice/edit.vue b/pages/work/notice/edit.vue
new file mode 100644
index 0000000..866e611
--- /dev/null
+++ b/pages/work/notice/edit.vue
@@ -0,0 +1,110 @@
+<template>
+  <view class="mobile-item-container">
+    <Navbar :title="noticeId ? '淇敼鍏憡' : '鏂板鍏憡'" bgColor="#fff" :h5Show="false"></Navbar>
+    <u--form ref="noticeForm" :model="notice" :rules="rules" labelPosition="left">
+      <u-form-item label="鏍囬" prop="noticeTitle" borderBottom>
+        <u--textarea v-model="notice.noticeTitle" placeholder="璇疯緭鍏ユ爣棰�" :count="false" :maxlength="30" :autoHeight="true" confirmType="done"></u--textarea>
+      </u-form-item>
+      <u-form-item label="绫诲瀷" prop="noticeType" borderBottom @click="actionShow = true;">
+        <u--input v-model="noticeTypeName" disabled disabledColor="#ffffff" placeholder="璇烽�夋嫨绫诲瀷" border="none"></u--input>
+				<u-icon slot="right" name="arrow-right"></u-icon>
+      </u-form-item>
+      <u-form-item label="鐘舵��" prop="status" borderBottom>
+        <u-radio-group v-model="notice.status">
+          <u-radio shape="circle" label="姝e父" name="0" checked></u-radio>
+          <u-radio shape="circle" label="鍏抽棴" name="1"></u-radio>
+        </u-radio-group>
+      </u-form-item>
+      <u-form-item label="姝f枃" prop="noticeContent">
+        <u--textarea v-model="notice.noticeContent" placeholder="璇疯緭鍏ユ爣棰�" :count="true" :maxlength="600" confirmType="done"></u--textarea>
+      </u-form-item>
+    </u--form>
+    <u-action-sheet :actions="actions" :title="actionTitle" :show="actionShow" @close="actionShow = false" @select="actionSelect"></u-action-sheet>
+    <u-row :gutter="16" style="margin-top: 36px;">
+      <u-col :span="6">
+        <u-button v-if="noticeId" type="error" text="鍒犻櫎" @click="del"></u-button>
+        <u-button v-else icon="arrow-left" text="杩斿洖" plain @click="goBack()"></u-button>
+      </u-col>
+      <u-col :span="6">
+        <u-button type="primary" text="鎻愪氦" @click="submit"></u-button>
+      </u-col>
+    </u-row>
+  </view>
+</template>
+
+<script>
+import * as NoticeApi from '@/api/work/notice'
+import Navbar from '@/components/navbar/Navbar'
+
+export default {
+  components: {
+    Navbar,
+  },
+  data () {
+    return {
+      noticeId: undefined,
+      notice: {
+        noticeTitle: '',
+        status: '0',
+        noticeContent: ''
+      },
+      actionShow: false,
+      actions: [{
+        name: '閫氱煡',
+        value: '1'
+      }, {
+        name: '鍏憡',
+        value: '2'
+      }],
+      actionTitle: '',
+      noticeTypeName: null,
+      rules: {
+        noticeTitle: [ { required: true, message: '璇疯緭鍏ュ叕鍛婃爣棰�', trigger: ['blur', 'change'] } ],
+        noticeType: [ { required: true, message: '璇烽�夋嫨鍏憡绫诲瀷', trigger: ['blur', 'change'] } ],
+        status: [ { required: true, message: '璇烽�夋嫨鍏憡鐘舵��', trigger: ['blur', 'change'] } ],
+        noticeContent: [ { required: true, message: '璇疯緭鍏ュ叕鍛婃鏂�', trigger: ['blur', 'change'] } ],
+      }
+    }
+  },
+  onLoad (params) {
+    this.noticeId = params.id
+    this.loadData()
+  },
+  methods: {
+    loadData () {
+      if (this.noticeId) {
+        const app = this
+        NoticeApi.noticeById(this.noticeId).then(res => {
+          app.notice = res.data
+        })
+      }
+    },
+    del () {
+      NoticeApi.noticeDelete(this.noticeId).then(res => {
+        uni.showToast({ title: '淇濆瓨鎴愬姛锛�' })
+      })
+    },
+    submit () {
+      this.$refs.noticeForm.validate().then(res => {
+        if (this.noticeId) {
+          NoticeApi.noticeModify(this.notice).then(res => {
+            uni.showToast({ title: '鎻愪氦鎴愬姛锛�' })
+          })
+        } else {
+          NoticeApi.noticeAdd(this.notice).then(res => {
+            uni.showToast({ title: '鎻愪氦鎴愬姛锛�' })
+          })
+        }
+      });
+    },
+    actionSelect (item) {
+      this.noticeTypeName = item.name;
+      this.notice.noticeType = item.value;
+      this.$refs.noticeForm.validateField('noticeType');
+    },
+    goBack () {
+      uni.navigateBack({ delta: 1});
+    }
+  }
+}
+</script>
\ No newline at end of file

--
Gitblit v1.9.3