|
|
@@ -1,143 +1,325 @@
|
|
|
<template>
|
|
|
- <view>
|
|
|
- <view class="" style="width: 100%;height: 30rpx;background-color: #f7f7f7;">
|
|
|
-
|
|
|
- </view>
|
|
|
- <view class="frombox">
|
|
|
- <u--form labelPosition="left" :model="supervise" :rules="rules" ref="uForm" labelWidth="70">
|
|
|
- <u-form-item label="监督形式" prop="supervisor_type" borderBottom ref="item1">
|
|
|
- <u-radio-group v-model="supervise.supervisor_type" placement="row" @change="groupChange">
|
|
|
- <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
|
|
|
- :label="item.name" :name="item.name" @change="radioChange">
|
|
|
- </u-radio>
|
|
|
- </u-radio-group>
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label="监督部门" prop="supervisor_depa" borderBottom ref="item1">
|
|
|
- <u--input v-model="supervise.supervisor_depa" border="none" placeholder="请输入监督部门"></u--input>
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label="监督情况" prop="supervisor_msg" borderBottom ref="item1">
|
|
|
- <u--textarea v-model="supervise.supervisor_msg" placeholder="请输入监督情况" count :maxlength="200"
|
|
|
- :autoHeight="true" height="100"></u--textarea>
|
|
|
- </u-form-item>
|
|
|
- </u--form>
|
|
|
- <u-button type="primary" text="确定" :loading="loading" shape="circle" @click="uploading" style="margin-top: 30rpx;"></u-button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <view>
|
|
|
+ <view
|
|
|
+ class=""
|
|
|
+ style="width: 100%; height: 30rpx; background-color: #f7f7f7"
|
|
|
+ >
|
|
|
+ </view>
|
|
|
+ <view class="frombox">
|
|
|
+ <u--form
|
|
|
+ labelPosition="left"
|
|
|
+ :model="supervise"
|
|
|
+ :rules="rules"
|
|
|
+ ref="uForm"
|
|
|
+ labelWidth="70"
|
|
|
+ >
|
|
|
+ <u-form-item
|
|
|
+ label="监督形式"
|
|
|
+ prop="supervisor_type"
|
|
|
+ borderBottom
|
|
|
+ ref="item1"
|
|
|
+ >
|
|
|
+ <u-radio-group
|
|
|
+ v-model="supervise.supervisor_type"
|
|
|
+ placement="row"
|
|
|
+ @change="groupChange"
|
|
|
+ >
|
|
|
+ <u-radio
|
|
|
+ :customStyle="{ marginBottom: '8px' }"
|
|
|
+ v-for="(item, index) in radiolist1"
|
|
|
+ :key="index"
|
|
|
+ :label="item.name"
|
|
|
+ :name="item.name"
|
|
|
+ @change="radioChange"
|
|
|
+ >
|
|
|
+ </u-radio>
|
|
|
+ </u-radio-group>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item
|
|
|
+ label="监督部门"
|
|
|
+ prop="supervisor_depa"
|
|
|
+ borderBottom
|
|
|
+ ref="item1"
|
|
|
+ >
|
|
|
+ <u--input
|
|
|
+ v-model="supervise.supervisor_depa"
|
|
|
+ border="none"
|
|
|
+ placeholder="请输入监督部门"
|
|
|
+ ></u--input>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item
|
|
|
+ label="监督情况"
|
|
|
+ prop="supervisor_msg"
|
|
|
+ borderBottom
|
|
|
+ ref="item1"
|
|
|
+ >
|
|
|
+ <u--textarea
|
|
|
+ v-model="supervise.supervisor_msg"
|
|
|
+ placeholder="请输入监督情况"
|
|
|
+ count
|
|
|
+ :maxlength="200"
|
|
|
+ :autoHeight="true"
|
|
|
+ height="100"
|
|
|
+ ></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="图片上传" borderBottom ref="item1">
|
|
|
+ <view class="clock-details__img-container">
|
|
|
+ <view class="clock-details__imgs">
|
|
|
+ <view
|
|
|
+ class="clock-details__img"
|
|
|
+ v-for="(item, index) in urllist"
|
|
|
+ :key="index + item"
|
|
|
+ >
|
|
|
+ <view class="icon" @click="handleRemove(index)">
|
|
|
+ <u-icon name="close" color="#fff"></u-icon>
|
|
|
+ </view>
|
|
|
+ <image
|
|
|
+ :src="baseUrl + item"
|
|
|
+ mode="aspectFit"
|
|
|
+ class="img"
|
|
|
+ ></image>
|
|
|
+ </view>
|
|
|
+ <view
|
|
|
+ class="clock-details__upload"
|
|
|
+ @click="chooseImage"
|
|
|
+ v-if="urllist.length < 3"
|
|
|
+ >
|
|
|
+ <u-icon size="20" name="plus" color="#409eff"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-form-item>
|
|
|
+ </u--form>
|
|
|
+ <u-button
|
|
|
+ type="primary"
|
|
|
+ text="确定"
|
|
|
+ :loading="loading"
|
|
|
+ shape="circle"
|
|
|
+ @click="uploading"
|
|
|
+ style="margin-top: 30rpx"
|
|
|
+ ></u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- radiolist1: [{
|
|
|
- name: '现场监督',
|
|
|
- disabled: false
|
|
|
- },
|
|
|
- {
|
|
|
- name: '远程监督',
|
|
|
- disabled: false
|
|
|
- },
|
|
|
- ],
|
|
|
- supervise: {
|
|
|
- task_id: "", // 必填 任务id
|
|
|
- supervisor_type: "", // 必填 监督类型
|
|
|
- supervisor_depa: "", // 必填 监督部门
|
|
|
- supervisor_msg: "", // 必填 监督内容
|
|
|
- },
|
|
|
- rules: {
|
|
|
- supervisor_type: {
|
|
|
- type: 'string',
|
|
|
- required: true,
|
|
|
- message: '请选择监督形式',
|
|
|
- trigger: ['blur', 'change']
|
|
|
- },
|
|
|
- supervisor_depa: {
|
|
|
- type: 'string',
|
|
|
- required: true,
|
|
|
- message: '请填写监督部门',
|
|
|
- trigger: ['blur', 'change']
|
|
|
- },
|
|
|
- supervisor_msg: {
|
|
|
- type: 'string',
|
|
|
- required: true,
|
|
|
- message: '请填写监督情况',
|
|
|
- trigger: ['blur', 'change']
|
|
|
- },
|
|
|
- },
|
|
|
- loading: false
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad(option) {
|
|
|
- this.supervise.task_id = option.id
|
|
|
- },
|
|
|
- watch: {
|
|
|
- videoData(news, old) {
|
|
|
- console.log('触发了2222222222222222222222')
|
|
|
- console.log(news)
|
|
|
- uni.switchTab({
|
|
|
- url: '../response/index'
|
|
|
- })
|
|
|
- // if (news) {
|
|
|
- // }
|
|
|
- },
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // 视频消息
|
|
|
- videoData() {
|
|
|
- return this.$store.state.video
|
|
|
- },
|
|
|
- },
|
|
|
- methods: {
|
|
|
- groupChange() {
|
|
|
+import { Debounce } from '@/util/anitthro.js'
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ radiolist1: [
|
|
|
+ {
|
|
|
+ name: '现场监督',
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '远程监督',
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ supervise: {
|
|
|
+ task_id: '', // 必填 任务id
|
|
|
+ supervisor_type: '', // 必填 监督类型
|
|
|
+ supervisor_depa: '', // 必填 监督部门
|
|
|
+ supervisor_msg: '', // 必填 监督内容
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ supervisor_type: {
|
|
|
+ type: 'string',
|
|
|
+ required: true,
|
|
|
+ message: '请选择监督形式',
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ },
|
|
|
+ supervisor_depa: {
|
|
|
+ type: 'string',
|
|
|
+ required: true,
|
|
|
+ message: '请填写监督部门',
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ },
|
|
|
+ supervisor_msg: {
|
|
|
+ type: 'string',
|
|
|
+ required: true,
|
|
|
+ message: '请填写监督情况',
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ urllist: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ this.supervise.task_id = option.id
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ videoData(news, old) {
|
|
|
+ console.log('触发了2222222222222222222222')
|
|
|
+ console.log(news)
|
|
|
+ uni.switchTab({
|
|
|
+ url: '../response/index',
|
|
|
+ })
|
|
|
+ // if (news) {
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 视频消息
|
|
|
+ videoData() {
|
|
|
+ return this.$store.state.video
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ chooseImage() {
|
|
|
+ uni.chooseImage({
|
|
|
+ count: 1, //默认9
|
|
|
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
+ sourceType: ['camera', 'album'], //从相册选择
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res)
|
|
|
+ // this.urllist.push(res.tempFilePaths[0])
|
|
|
+ // this.kpsurlL = res.tempFilePaths[0]
|
|
|
|
|
|
- },
|
|
|
- radioChange() {
|
|
|
+ this.onok({ path: res.tempFilePaths[0] })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleRemove(index) {
|
|
|
+ console.log(index, 'handle remove', this.urllist)
|
|
|
+ if (index !== undefined) {
|
|
|
+ // pullAt(this.urllist, index)
|
|
|
+ this.urllist.splice(index, 1)
|
|
|
+ console.log(this.urllist, 'remove finished ')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onok(ev) {
|
|
|
+ this.loading = true
|
|
|
+ Debounce(() => {
|
|
|
+ uni.uploadFile({
|
|
|
+ url:
|
|
|
+ this.baseUrl +
|
|
|
+ '/api/api_gateway?method=monitor_manage.cbd_manage.add_img',
|
|
|
+ filePath: ev.path,
|
|
|
+ name: 'img_file',
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+ console.log(JSON.parse(uploadFileRes.data).data.src)
|
|
|
+ this.urllist.push(JSON.parse(uploadFileRes.data).data.src)
|
|
|
+ console.log(this.urllist, ' upload file')
|
|
|
+ this.kpsurlL = ''
|
|
|
|
|
|
- },
|
|
|
- uploading() {
|
|
|
- console.log(this.supervise)
|
|
|
- this.$refs.uForm.validate().then(res => {
|
|
|
- this.upload()
|
|
|
- }).catch(errors => {
|
|
|
- uni.$u.toast('请将信息填写完成')
|
|
|
- })
|
|
|
- },
|
|
|
- async upload(){
|
|
|
- this.loading = true
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: '/api/api_gateway?method=control_center.task.supervisor_add',
|
|
|
- data: {
|
|
|
- task_id: this.supervise.task_id, // 必填 任务id
|
|
|
- supervisor_type: this.supervise.supervisor_type, // 必填 监督类型
|
|
|
- supervisor_depa: this.supervise.supervisor_depa, // 必填 监督部门
|
|
|
- supervisor_msg: this.supervise.supervisor_msg,
|
|
|
- }
|
|
|
- })
|
|
|
- if(res){
|
|
|
- uni.$u.toast('发布成功')
|
|
|
- uni.switchTab({
|
|
|
- url:"./index"
|
|
|
- })
|
|
|
- }
|
|
|
- this.loading = false
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ complete() {
|
|
|
+ console.log('上传完成 1355566')
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }, 1000)()
|
|
|
+ },
|
|
|
+ groupChange() {},
|
|
|
+ radioChange() {},
|
|
|
+ uploading() {
|
|
|
+ console.log(this.supervise)
|
|
|
+ this.$refs.uForm
|
|
|
+ .validate()
|
|
|
+ .then((res) => {
|
|
|
+ this.upload()
|
|
|
+ })
|
|
|
+ .catch((errors) => {
|
|
|
+ uni.$u.toast('请将信息填写完成')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async upload() {
|
|
|
+ this.loading = true
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=control_center.task.supervisor_add',
|
|
|
+ data: {
|
|
|
+ task_id: this.supervise.task_id, // 必填 任务id
|
|
|
+ supervisor_type: this.supervise.supervisor_type, // 必填 监督类型
|
|
|
+ supervisor_depa: this.supervise.supervisor_depa, // 必填 监督部门
|
|
|
+ supervisor_msg: this.supervise.supervisor_msg,
|
|
|
+ supervisor_imglist: JSON.stringify(this.urllist),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res) {
|
|
|
+ uni.$u.toast('发布成功')
|
|
|
+ uni.switchTab({
|
|
|
+ url: './index',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ },
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
- .frombox {
|
|
|
- width: 90%;
|
|
|
- margin: 0 auto;
|
|
|
+.frombox {
|
|
|
+ width: 90%;
|
|
|
+ margin: 0 auto;
|
|
|
+
|
|
|
+ /deep/.u-radio-group {
|
|
|
+ padding-top: 20rpx;
|
|
|
+
|
|
|
+ .u-radio {
|
|
|
+ margin-right: 30rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.u-form-item__body {
|
|
|
+ padding: 40rpx 0 !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.clock-details {
|
|
|
+ &__upload {
|
|
|
+ width: 144rpx;
|
|
|
+ height: 144rpx;
|
|
|
+ border: 1px dashed #409eff;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ margin-left: 32rpx;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__img-container {
|
|
|
+ border-bottom: 1px solid rgba(151, 151, 151, 0.09);
|
|
|
+ // @include hairline-bottom(rgba(151, 151, 151, 0.09));
|
|
|
+ }
|
|
|
+
|
|
|
+ &__imgs {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: center;
|
|
|
+ padding: 40rpx 0;
|
|
|
+ margin-left: -32rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__img {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ width: 198rpx;
|
|
|
+ height: 198rpx;
|
|
|
+ margin-left: 32rpx;
|
|
|
+ margin-bottom: 30rpx;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
|
|
|
- /deep/.u-radio-group {
|
|
|
- padding-top: 20rpx;
|
|
|
- .u-radio {
|
|
|
- margin-right: 30rpx;
|
|
|
- }
|
|
|
- }
|
|
|
- /deep/.u-form-item__body{
|
|
|
- padding: 40rpx 0 !important;
|
|
|
- }
|
|
|
- }
|
|
|
+ .icon {
|
|
|
+ position: absolute;
|
|
|
+ top: -20rpx;
|
|
|
+ right: -20rpx;
|
|
|
+ z-index: 9;
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ background-color: red;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|