From c8b32b8bca79a116cfab70eb8c389907b664c9ca Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 23 四月 2025 10:43:14 +0800
Subject: [PATCH] 提交
---
h5/pages/report_dca/report_dca.vue | 434 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 310 insertions(+), 124 deletions(-)
diff --git a/h5/pages/report_dca/report_dca.vue b/h5/pages/report_dca/report_dca.vue
index ca7a0fb..0c857ff 100644
--- a/h5/pages/report_dca/report_dca.vue
+++ b/h5/pages/report_dca/report_dca.vue
@@ -1,78 +1,155 @@
<template>
<view class="she">
<u--form labelPosition="left" :model="model" :rules="rules" ref="uForm">
- <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 @click="openS" 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="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="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" 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="openG" 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="DCA绫诲瀷" labelWidth="120" prop="name" borderBottom @click="jumpSelectType()" required>
- <u--input v-model="model.name" border="none" placeholder="璇烽�夋嫨DCA绫诲瀷" disabledColor="#ffffff"
+ <u-form-item label="瑙傚療椤�" labelWidth="120" prop="dcaYesNum" borderBottom @click="jumpSelectType()" required>
+ <view style="width: 100%; display: flex; align-items: center; justify-content: space-between;">
+ <view style="font-size: 28rpx; color: rgba(32,110,238,1);">绗﹀悎锛歿{model.dcaYesNum}} 涓嶇鍚堬細{{model.dcaNoNum}}</view>
+ <u-icon name="arrow-right"></u-icon>
+ </view>
+ </u-form-item>
+ <u-form-item label="DCA鍥剧墖" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom>
+ <u-upload
+ :fileList="model.multifileList"
+ @afterRead="afterRead"
+ @delete="deletePic"
+ multiple
+ name="1"
+ style="margin-top: 15rpx;" />
+ </u-form-item>
+ <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-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="DCA鍥剧墖" 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>
- <u-form-item label="閫氱煡浜�" labelWidth="120" prop="name" borderBottom required>
- <u--input v-model="model.name" border="none" placeholder="璇疯緭鍏ラ�氱煡浜�"></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="closeS"
@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-datetime-picker :show="show5" v-model="time1" mode="datetime" @cancel="closeF"
+ @confirm="selectTime1"></u-datetime-picker>
<!-- 纭畾寮圭獥 -->
- <u-modal :show="show4" showCancelButton title="鎻愰啋" @cancel="show4 = false" @confirm="submit">
+ <u-modal :show="show4" showCancelButton title="鎻愰啋" @cancel="closeT" @confirm="report">
<view class="slot-content">
- 鎮ㄦ湰娆″叡鎻愪氦4椤癸紝<text>1椤�</text>绗﹀悎锛�<text>3椤�</text>涓嶇鍚堬紝绯荤粺灏嗕細鏍规嵁涓嶇鍚堥」褰㈡垚瀵瑰簲宸ュ崟銆�
+ 鎮ㄦ湰娆″叡鎻愪氦{{total}}椤癸紝<text>{{model.dcaYesNum}}椤�</text>绗﹀悎锛�<text>{{model.dcaNoNum}}椤�</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>
+ <!-- 涓婚 -->
+ <u-picker
+ :show="show2"
+ :columns="theme"
+ keyName="name"
+ @confirm="selectTheme"
+ @cancel="closeG" />
+ <!-- 鎻愪氦鎴愬姛 -->
+ <u-modal :show="show6" showCancelButton confirmText="鏌ョ湅璇︽儏" cancelText="缁х画涓婃姤" @cancel="next" @confirm="toDesc">
+ <view class="slot-content1">
+ <u-icon name="checkmark-circle-fill" color="#3875C5" size="70"></u-icon>
+ <text>鎻愪氦鎴愬姛</text>
+ <text>鎰熻阿鎮ㄧ殑鍙嶉</text>
</view>
</u-modal>
</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: '',
+ happenTime: '',
+ companyName: '',
+ localtionName: '',
+ localtionId: '',
+ typeId: '',
+ typeName: '',
+ notifier: '',
+ dcaYesNum: 0,
+ dcaNoNum: 0,
+ dcaNoProblemDTOList: [],
+ multifileList: [],
+ type: 1
},
rules: {
- name: [{
+ submitDate: [{
type: 'string',
required: true,
- message: '璇峰~鍐欏憳宸ュ鍚�',
+ message: '涓婃姤鏃堕棿涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ happenTime: [{
+ type: 'string',
+ required: true,
+ message: '鍙戠幇鏃堕棿涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ companyName: [{
+ type: 'string',
+ required: true,
+ message: '閮ㄩ棬/鐝粍涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ localtionName: [{
+ type: 'string',
+ required: true,
+ message: '浣嶇疆涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ typeName: [{
+ type: 'string',
+ required: true,
+ message: '瑙傚療涓婚涓嶈兘涓虹┖',
+ trigger: ['blur', 'change']
+ }],
+ notifier: [{
+ type: 'string',
+ required: true,
+ message: '閫氱煡浜轰笉鑳戒负绌�',
trigger: ['blur', 'change']
}]
},
@@ -80,116 +157,207 @@
show1: false,
show2: false,
show3: false,
- show4: true,
- columns: [
- ['涓浗', '缇庡浗'],
- ['娣卞湷', '鍘﹂棬', '涓婃捣', '鎷夎惃']
- ],
- columnData: [
- ['娣卞湷', '鍘﹂棬', '涓婃捣', '鎷夎惃'],
- ['寰楀窞', '鍗庣洓椤�', '绾界害', '闃挎媺鏂姞']
- ],
- address: [
- ['涓浗', '缇庡浗', '鏃ユ湰']
- ],
- userList: [
- ['渚涘簲鍟�', '鍚屼簨', '鏈汉']
- ],
- time: ''
+ show4: false,
+ show5: false,
+ show6: false,
+ time: new Date().getTime(),
+ time1: new Date().getTime(),
+ address: [],
+ theme: [],
+ total: 0
};
},
+ onLoad() {
+ this.model.companyName = this.userInfo.companyName
+ this.getNotifier()
+ this.getLocation()
+ this.getZhuti()
+ // 鎺ユ敹鏁版嵁
+ uni.$on('update', (data) => {
+ this.total = data.total
+ this.model.dcaYesNum = data.dcaYesNum
+ this.model.dcaNoNum = data.dcaNoNum
+ this.model.dcaNoProblemDTOList = data.dcaNoProblemDTOList
+ })
+ },
methods: {
- jumpSelectType() {
+ openG() {
+ this.stopScroll()
+ this.show2 = true
+ },
+ closeG() {
+ this.canScroll()
+ this.show2 = false
+ },
+ next() {
+ this.model.submitDate = ''
+ this.model.happenTime = ''
+ this.model.companyName = ''
+ this.model.localtionName = ''
+ this.model.localtionId = ''
+ this.model.typeId = ''
+ this.model.typeName = ''
+ this.model.notifier = ''
+ this.model.dcaYesNum = 0
+ this.model.dcaNoNum = 0
+ this.model.dcaNoProblemDTOList = []
+ this.model.multifileList = []
+ this.model.type = 1
+ this.canScroll()
+ this.show6 = false
+ },
+ toDesc() {
+ this.canScroll()
+ this.show6 = false
uni.navigateTo({
- url: '/pages/type_dca/type_dca'
+ url: `/pages/details_dca/details_dca?id=${this.id}`
+ })
+ },
+ // 鎻愪氦涓婃姤
+ async report() {
+ let res = await this.$u.api.workOrderCreate(this.model)
+ if (res.code === 200) {
+ this.show4 = false
+ this.id = res.data
+ this.show6 = true
+ }
+ },
+ // dac浣嶇疆
+ async getLocation() {
+ let res = await this.$u.api.categoryTree({ categoryType: 3 })
+ if (res.code === 200) {
+ this.address = res.data
+ }
+ },
+ // dac涓婚
+ async getZhuti() {
+ let res = await this.$u.api.categoryList({ categoryType: 4, isRoot: 1 })
+ if (res.code === 200) {
+ this.theme = [res.data]
+ }
+ },
+ // 閫夋嫨涓婚
+ selectTheme(e) {
+ this.model.typeId = e.value[0].id
+ this.model.typeName = e.value[0].name
+ this.canScroll()
+ this.show2 = false
+ },
+ // 閫夋嫨浣嶇疆
+ selectAddress(e) {
+ this.model.localtionId = e[0].id
+ this.model.localtionName = e[0].name
+ this.$refs.pengTree._hide()
+ },
+ // 鑾峰彇閫氱煡浜�
+ 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(',')
+ }
+ },
+ jumpSelectType() {
+ if (!this.model.typeId) {
+ uni.showToast({
+ title: '璇峰厛閫夋嫨瑙傚療涓婚',
+ icon: 'none'
+ })
+ return
+ }
+ uni.navigateTo({
+ url: `/pages/type_dca/type_dca?theme=${this.model.typeId}&themeName=${this.model.typeName}`
})
},
// 鍒犻櫎鍥剧墖
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: this.$baseUrl + '/web/public/uploadBatch',
+ files: event.file.map(e => {
+ return { name: 'files', uri: e.url }
+ }),
+ formData: {
+ folder: "WORKORDER_FILE_PATH",
+ },
+ success(res) {
+ uni.hideLoading();
+ let obj = JSON.parse(res.data)
+ if (obj.code === 200) {
+ console.log(obj.data)
+ obj.data.forEach(item => {
+ item.fileurl = item.imgaddr
+ })
+ that.model.multifileList = [...that.model.multifileList, ...obj.data]
+ }
+ }
+ })
+ // uni.uploadFile({
+ // url: this.$baseUrl + '/web/public/upload',
+ // filePath: event.file.url,
+ // name: "file",
+ // formData: {
+ // folder: "WORKORDER_FILE_PATH"
+ // },
+ // success: (res) => {
+ // let obj = JSON.parse(res.data)
+ // if (obj.code === 200) {
+ // obj.data.fileurl = obj.data.imgaddr
+ // this.model.multifileList.push(obj.data)
+ // }
+ // }
+ // });
},
submit() {
this.$refs.uForm.validate().then(res => {
- uni.$u.toast('鏍¢獙閫氳繃')
+ if (this.total === 0) return uni.showToast({
+ title: '璇烽�夋嫨瑙傚療椤�',
+ icon: 'none'
+ })
+ this.show4 = true
}).catch(errors => {
- uni.$u.toast('鏍¢獙澶辫触')
+
})
},
- changeHandler(e) {
- const {
- columnIndex,
- value,
- values, // values涓哄綋鍓嶅彉鍖栧垪鐨勬暟缁勫唴瀹�
- index,
- // 寰俊灏忕▼搴忔棤娉曞皢picker瀹炰緥浼犲嚭鏉ワ紝鍙兘閫氳繃ref鎿嶄綔
- picker = this.$refs.uPicker
- } = e
- // 褰撶涓�鍒楀�煎彂鐢熷彉鍖栨椂锛屽彉鍖栫浜屽垪(鍚庝竴鍒�)瀵瑰簲鐨勯�夐」
- if (columnIndex === 0) {
- // picker涓洪�夋嫨鍣╰his瀹炰緥锛屽彉鍖栫浜屽垪瀵瑰簲鐨勯�夐」
- picker.setColumnValues(1, this.columnData[index])
- }
+ openF() {
+ this.stopScroll()
+ this.show5 = true
},
- // 鍥炶皟鍙傛暟涓哄寘鍚玞olumnIndex銆乿alue銆乿alues
- confirm(e) {
- console.log('confirm', e)
- this.show = false
+ closeF() {
+ this.canScroll()
+ this.show5 = false
},
- selectTime(e) {
- console.log('confirm', e)
+ openS() {
+ this.stopScroll()
+ this.show1 = true
+ },
+ closeS() {
+ this.canScroll()
this.show1 = false
},
- selectAddr(e) {
- console.log('confirm', e)
- this.show2 = false
+ closeT() {
+ this.canScroll()
+ this.show4 = false
},
- selectUser(e) {
- console.log('confirm', e)
- this.show3 = false
+ // 涓婃姤鏃堕棿
+ selectTime(e) {
+ this.model.submitDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
+ this.canScroll()
+ this.show1 = false
+ },
+ // 鍙戠幇鏃堕棿
+ selectTime1(e) {
+ this.model.happenTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
+ this.canScroll()
+ this.show5 = false
}
}
}
@@ -208,5 +376,23 @@
color: #206EEE;
}
}
+ .slot-content1 {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ text {
+ &:nth-child(2) {
+ color: rgba(16,16,16,1);
+ font-size: 28rpx;
+ margin-top: 24rpx;
+ }
+ &:nth-child(3) {
+ color: rgba(190,190,190,1);
+ font-size: 24rpx;
+ margin-top: 34rpx;
+ }
+ }
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3