From ad685ebb7a5af63cd00d2da6d2e540dd8049ac93 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 18 四月 2025 16:15:26 +0800
Subject: [PATCH] 提交
---
h5/pages/riskReporting/riskReporting.vue | 290 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 198 insertions(+), 92 deletions(-)
diff --git a/h5/pages/riskReporting/riskReporting.vue b/h5/pages/riskReporting/riskReporting.vue
index da781b3..c413af3 100644
--- a/h5/pages/riskReporting/riskReporting.vue
+++ b/h5/pages/riskReporting/riskReporting.vue
@@ -2,55 +2,52 @@
<view class="she">
<u--form labelPosition="left" :model="model" :rules="rules" ref="uForm">
<u-form-item label="鍛樺伐濮撳悕" labelWidth="120" prop="name" borderBottom required>
- <u--input v-model="model.name" border="none" placeholder="璇疯緭鍏ュ憳宸ュ鍚�"></u--input>
+ <u--input v-model="model.name" border="none" placeholder="璇疯緭鍏ュ憳宸ュ鍚�" disabledColor="#ffffff" disabled></u--input>
</u-form-item>
- <u-form-item label="閮ㄩ棬" labelWidth="120" prop="name" borderBottom @click="show = true" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨閮ㄩ棬" disabledColor="#ffffff"
+ <u-form-item label="閮ㄩ棬" labelWidth="120" prop="companyName" borderBottom required>
+ <u--input v-model="model.companyName" border="none" placeholder="璇烽�夋嫨閮ㄩ棬" disabledColor="#ffffff"
disabled></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
- <u-form-item label="涓婃姤鏃堕棿" labelWidth="120" prop="name" borderBottom @click="show1 = true" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨涓婃姤鏃堕棿" disabledColor="#ffffff"
+ <u-form-item label="涓婃姤鏃堕棿" labelWidth="120" prop="submitDate" borderBottom required>
+ <u--input v-model="model.submitDate" border="none" placeholder="璇烽�夋嫨涓婃姤鏃堕棿" disabledColor="#ffffff"
disabled></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
- <u-form-item label="鍙戠幇鏃堕棿" labelWidth="120" prop="name" borderBottom @click="show1 = true" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨鍙戠幇鏃堕棿" disabledColor="#ffffff"
+ <u-form-item label="鍙戠幇鏃堕棿" labelWidth="120" prop="happenTime" borderBottom @click="openF" required>
+ <u--input v-model="model.happenTime" border="none" placeholder="璇烽�夋嫨鍙戠幇鏃堕棿" disabledColor="#ffffff"
disabled></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
- <u-form-item label="椋庨櫓绫诲瀷" labelWidth="120" prop="name" borderBottom @click="show2 = true" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨椋庨櫓绫诲瀷" disabledColor="#ffffff"
+ <u-form-item label="椋庨櫓绫诲瀷" labelWidth="120" prop="typeName" borderBottom @click="$refs.pengTree1._show()" required>
+ <u--input v-model="model.typeName" border="none" placeholder="璇烽�夋嫨椋庨櫓绫诲瀷" disabledColor="#ffffff"
disabled></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
- <u-form-item label="鍙戠敓鍦扮偣" labelWidth="120" prop="name" borderBottom @click="show2 = true" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨鍙戠敓鍦扮偣" disabledColor="#ffffff"
+ <u-form-item label="鍙戠敓鍦扮偣" labelWidth="120" prop="localtionName" borderBottom @click="$refs.pengTree._show()" required>
+ <u--input v-model="model.localtionName" border="none" placeholder="璇烽�夋嫨鍙戠敓鍦扮偣" disabledColor="#ffffff"
disabled></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
- <u-form-item label="椋庨櫓鎻忚堪" labelWidth="120" prop="name" labelPosition="top" borderBottom required>
- <u--textarea v-model="model.name" placeholder="璇疯緭鍏ラ闄╂弿杩�" style="margin-top: 15rpx;" maxlength="200" count></u--textarea>
+ <u-form-item label="椋庨櫓鎻忚堪" labelWidth="120" prop="riskInfo" labelPosition="top" borderBottom required>
+ <u--textarea v-model="model.riskInfo" placeholder="璇疯緭鍏ラ闄╂弿杩�" style="margin-top: 15rpx;" maxlength="200" count></u--textarea>
</u-form-item>
- <u-form-item label="涓婁紶鍥剧墖" labelWidth="120" prop="fileList" labelPosition="top" borderBottom>
- <u-upload :fileList="model.fileList" @afterRead="afterRead" @delete="deletePic" name="1" multiple
- :maxCount="10" style="margin-top: 15rpx;"></u-upload>
+ <u-form-item label="涓婁紶鍥剧墖" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom>
+ <u-upload
+ :fileList="model.multifileList"
+ @afterRead="afterRead"
+ @delete="deletePic"
+ name="1"
+ style="margin-top: 15rpx;" />
</u-form-item>
- <u-form-item label="閫氱煡浜�" labelWidth="120" prop="name" borderBottom required>
- <u--input v-model="model.name" border="none" placeholder="璇疯緭鍏ラ�氱煡浜�"></u--input>
+ <u-form-item label="閫氱煡浜�" labelWidth="120" prop="notifier" borderBottom required>
+ <u--input v-model="model.notifier" border="none" placeholder="璇疯緭鍏ラ�氱煡浜�" disabledColor="#ffffff" disabled></u--input>
</u-form-item>
</u--form>
<u-button type="primary" text="鎻愪氦" @click="submit" style="margin-top: 60rpx;"></u-button>
- <!-- 閮ㄩ棬 -->
- <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="show = false"
- @change="changeHandler"></u-picker>
<!-- 鏃ユ湡 -->
- <u-datetime-picker :show="show1" v-model="time" mode="datetime" @cancel="show1 = false"
+ <u-datetime-picker :show="show1" v-model="time" mode="datetime" @cancel="closeF"
@confirm="selectTime"></u-datetime-picker>
- <!-- 鍙戠敓鍦扮偣 -->
- <u-picker :show="show2" :columns="address" @cancel="show2 = false" @confirm="selectAddr"></u-picker>
- <!-- 娑夊強浜哄憳 -->
- <u-picker :show="show3" :columns="userList" @cancel="show3 = false" @confirm="selectUser"></u-picker>
<!-- 鎻愪氦鎴愬姛 -->
<u-modal :show="show4" showCancelButton confirmText="鏌ョ湅璇︽儏" cancelText="缁х画涓婃姤" @cancel="next" @confirm="toDesc">
<view class="slot-content">
@@ -59,111 +56,219 @@
<text>鎰熻阿鎮ㄧ殑鍙嶉</text>
</view>
</u-modal>
+ <!-- 鍙戠敓鍦扮偣 -->
+ <peng-tree
+ ref="pengTree"
+ :range="address"
+ idKey="id"
+ :selectParent="false"
+ nameKey="name"
+ :multiple="false"
+ title="閫夋嫨鍦扮偣"
+ @confirm="selectAddress"
+ @cancel="$refs.pengTree._hide()">
+ </peng-tree>
+ <!-- 椋庨櫓绫诲瀷 -->
+ <peng-tree
+ ref="pengTree1"
+ :range="typeList"
+ idKey="id"
+ :selectParent="false"
+ nameKey="name"
+ :multiple="false"
+ title="閫夋嫨浼ゅ绫诲瀷"
+ @confirm="selectType"
+ @cancel="$refs.pengTree1._hide()">
+ </peng-tree>
</view>
</template>
<script>
+ import { mapState } from 'vuex'
+ import pengTree from '@/uni_modules/peng-tree/peng-tree/peng-tree.vue'
export default {
+ components: { pengTree },
+ computed: {
+ ...mapState(['userInfo'])
+ },
data() {
return {
+ id: null,
model: {
name: '',
- value: 0,
- fileList: []
+ submitDate: uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss'),
+ companyName: '',
+ happenTime: '',
+ localtionId: '',
+ localtionName: '',
+ typeId: '',
+ typeName: '',
+ riskInfo: '',
+ notifier: '',
+ multifileList: [],
+ type: 3
},
rules: {
name: [{
type: 'string',
required: true,
- message: '璇峰~鍐欏憳宸ュ鍚�',
+ message: '鍛樺伐濮撳悕涓嶈兘涓虹┖',
trigger: ['blur', 'change']
- }]
+ }],
+ happenTime: [{
+ type: 'string',
+ required: true,
+ message: '鍙戠幇鏃堕棿涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ typeName: [{
+ type: 'string',
+ required: true,
+ message: '椋庨櫓绫诲瀷涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ localtionName: [{
+ type: 'string',
+ required: true,
+ message: '鍙戠敓鍦扮偣涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ riskInfo: [{
+ type: 'string',
+ required: true,
+ message: '椋庨櫓鎻忚堪涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ notifier: [{
+ type: 'string',
+ required: true,
+ message: '閫氱煡浜轰笉鑳戒负绌�',
+ trigger: ['blur', 'change']
+ }],
},
show: false,
show1: false,
show2: false,
show3: false,
- show4: true,
- columns: [
- ['涓浗', '缇庡浗'],
- ['娣卞湷', '鍘﹂棬', '涓婃捣', '鎷夎惃']
- ],
- columnData: [
- ['娣卞湷', '鍘﹂棬', '涓婃捣', '鎷夎惃'],
- ['寰楀窞', '鍗庣洓椤�', '绾界害', '闃挎媺鏂姞']
- ],
- address: [
- ['涓浗', '缇庡浗', '鏃ユ湰']
- ],
- userList: [
- ['渚涘簲鍟�', '鍚屼簨', '鏈汉']
- ],
- time: ''
+ show4: false,
+ time: new Date().getTime(),
+ typeList: [],
+ address: []
};
},
+ onLoad() {
+ this.model.companyName = this.userInfo.companyName
+ this.model.name = this.userInfo.name
+ this.getLocation()
+ this.getType()
+ this.getNotifier()
+ },
methods: {
+ openF() {
+ this.stopScroll()
+ this.show1 = true
+ },
+ closeF() {
+ this.canScroll()
+ this.show1 = false
+ },
+ // 鑾峰彇閫氱煡浜�
+ async getNotifier() {
+ let res = await this.$u.api.managersList({ type: 0 })
+ if (res.code === 200) {
+ this.model.notifier = res.data.map(item => item.memberName).join(',')
+ }
+ },
+ // 閫夋嫨浼ゅ绫诲瀷
+ selectType(e) {
+ this.model.typeId = e[0].id
+ this.model.typeName = e[0].name
+ this.$refs.pengTree._hide()
+ },
+ // 閫夋嫨鍦扮偣
+ selectAddress(e) {
+ this.model.localtionId = e[0].id
+ this.model.localtionName = e[0].name
+ this.$refs.pengTree._hide()
+ },
+ // 璺岀粖婊戜激瀹崇被鍨�
+ async getType() {
+ let res = await this.$u.api.categoryTree({ categoryType: 1 })
+ if (res.code === 200) {
+ this.typeList = res.data
+ }
+ },
+ // 璺岀粖婊戝彂鐢熷湴鐐�
+ async getLocation() {
+ let res = await this.$u.api.categoryTree({ categoryType: 2 })
+ if (res.code === 200) {
+ this.address = res.data
+ }
+ },
next() {
+ this.model.name = ''
+ this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM:ss')
+ this.model.companyName = ''
+ this.model.happenTime = ''
+ this.model.localtionId = ''
+ this.model.localtionName = ''
+ this.model.typeId = ''
+ this.model.typeName = ''
+ this.model.riskInfo = ''
+ this.model.notifier = ''
+ this.model.multifileList = []
+ this.model.type = 3
+ this.canScroll()
this.show4 = false
},
toDesc() {
uni.navigateTo({
- url: '/pages/riskDetails/riskDetails'
+ url: `/pages/riskDetails/riskDetails?id=${this.id}`
})
+ this.canScroll()
this.show4 = false
},
// 鍒犻櫎鍥剧墖
deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1);
+ this.model.multifileList.forEach((item, index) => {
+ if (item.imgaddr === event.file.imgaddr) {
+ this.model.multifileList.splice(index, 1)
+ }
+ })
},
// 鏂板鍥剧墖
async afterRead(event) {
- // 褰撹缃� multiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮�
- let lists = [].concat(event.file);
- let fileListLen = this[`fileList${event.name}`].length;
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: "uploading",
- message: "涓婁紶涓�",
- });
- });
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url);
- let item = this[`fileList${event.name}`][fileListLen];
- this[`fileList${event.name}`].splice(
- fileListLen,
- 1,
- Object.assign(item, {
- status: "success",
- message: "",
- url: result,
- })
- );
- fileListLen++;
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: "http://192.168.2.21:7001/upload", // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧�
- filePath: url,
- name: "file",
- formData: {
- user: "test",
- },
- success: (res) => {
- setTimeout(() => {
- resolve(res.data.data);
- }, 1000);
- },
- });
+ var that = this
+ uni.showLoading({ title: '涓婁紶涓�...', mask: true })
+ uni.uploadFile({
+ url: that.$baseUrl + '/web/public/upload',
+ filePath: event.file.url,
+ name: "file",
+ formData: {
+ folder: "WORKORDER_FILE_PATH"
+ },
+ success: (res) => {
+ uni.hideLoading();
+ let obj = JSON.parse(res.data)
+ if (obj.code === 200) {
+ obj.data.fileurl = obj.data.imgaddr
+ that.model.multifileList.push(obj.data)
+ }
+ }
});
},
+ // 鎻愪氦
submit() {
- this.$refs.uForm.validate().then(res => {
- uni.$u.toast('鏍¢獙閫氳繃')
+ var that = this
+ that.$refs.uForm.validate().then(async () => {
+ let res = await that.$u.api.workOrderCreate(that.model)
+ if (res.code === 200) {
+ that.id = res.data
+ that.stopScroll()
+ that.show4 = true
+ }
}).catch(errors => {
- uni.$u.toast('鏍¢獙澶辫触')
+
})
},
changeHandler(e) {
@@ -187,7 +292,8 @@
this.show = false
},
selectTime(e) {
- console.log('confirm', e)
+ this.model.happenTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
+ this.canScroll()
this.show1 = false
},
selectAddr(e) {
--
Gitblit v1.9.3