| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <view class="tl">
|
| | | <V-WorkOrderInfo :orederMessage="info"></V-WorkOrderInfo>
|
| | | <div class="tl_title">
|
| | | <div class="tl_title_left">
|
| | | <div class="tl_title_left_x"></div>
|
| | | <span>çäº§ç¹æ£</span>
|
| | | </div>
|
| | | <div class="tl_title_right" @click="add">
|
| | | <image src="../../static/gongdan_ic_shoudong@2x.png" class="img24" mode=""></image>
|
| | | <!-- <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt="" /> -->
|
| | | <span>å¢å 屿§</span>
|
| | | </div>
|
| | | </div>
|
| | | <u-swipe-action>
|
| | | <u-swipe-action-item v-for="(item, index) in formList" :key="index" :options="options1"
|
| | | @click="dele(index)">
|
| | | <div class="tl_list">
|
| | | <div class="tl_list_item" @click="open(index)">
|
| | | <div class="tl_list_item_label">çäº§å±æ§</div>
|
| | | <div class="tl_list_item_go">
|
| | | <span
|
| | | :style="item.attributeName ? 'color: #000;' : ''">{{ item.attributeName ? item.attributeName : 'è¯·éæ©'}}</span>
|
| | | <van-icon name="arrow" color="#999999" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-if="item.type === ''">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <input type="text" v-model="item.num" placeholder="请è¾å
¥" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 0">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <u-radio-group v-model="item.num" placement="row" @change="radioSelect">
|
| | | <u-radio v-for="(item1, i) in item.data" :key="i" activeColor="#4275FC" :name="item1" :label="item1">
|
| | | </u-radio>
|
| | | </u-radio-group>
|
| | | <!-- <van-radio-group v-model="item.num" direction="horizontal">
|
| | | <van-radio :name="item1" checked-color="#4275FC" v-for="(item1, i) in item.data" :key="i">
|
| | | {{item1}}
|
| | | </van-radio>
|
| | | </van-radio-group> -->
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 1">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <u-checkbox-group v-model="item.num" placement="row">
|
| | | <u-checkbox v-for="(item1, i) in item.data" :key="i" :label="item1" :name="item1">
|
| | | </u-checkbox>
|
| | | </u-checkbox-group>
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 2 || item.type === 3">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <input type="text" v-model="item.num" :placeholder="item.tips" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" @click="openTimer(index)" v-else-if="item.type === 4">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <span :style="item.num ? 'color: #000;' : ''">{{item.num ? item.num : item.tips}}</span>
|
| | | <u-icon name="arrow" color="#999999" />
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | </u-swipe-action-item>
|
| | | </u-swipe-action>
|
| | | <!-- <van-swipe-cell v-for="(item, index) in formList" :key="index">
|
| | | <div class="tl_list">
|
| | | <div class="tl_list_item" @click="open(index)">
|
| | | <div class="tl_list_item_label">çäº§å±æ§</div>
|
| | | <div class="tl_list_item_go">
|
| | | <span
|
| | | :style="item.attributeName ? 'color: #000;' : ''">{{ item.attributeName ? item.attributeName : 'è¯·éæ©'}}</span>
|
| | | <van-icon name="arrow" color="#999999" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-if="item.type === ''">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <input type="text" v-model="item.num" placeholder="请è¾å
¥" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 0">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <u-radio-group v-model="item.num" placement="row">
|
| | | <u-radio v-for="(item1, i) in item.data" :key="i" activeColor="#4275FC" :label="item1">
|
| | | </u-radio>
|
| | | </u-radio-group>
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 1">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <u-checkbox-group v-model="item.num" placement="row">
|
| | | <u-checkbox v-for="(item1, i) in item.data" :key="i" :label="item1" :name="item1">
|
| | | </u-checkbox>
|
| | | </u-checkbox-group>
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 2">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <input type="text" v-model="item.num" :placeholder="item.tips" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" v-else-if="item.type === 3">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <input type="text" v-model="item.num" :placeholder="item.tips" />
|
| | | </div>
|
| | | </div>
|
| | | <div class="tl_list_item" @click="openTimer(index)" v-else-if="item.type === 4">
|
| | | <div class="tl_list_item_label">屿§å¼</div>
|
| | | <div class="tl_list_item_go">
|
| | | <span :style="item.num ? 'color: #000;' : ''">{{item.num ? item.num : item.tips}}</span>
|
| | | <u-icon name="arrow" color="#999999" />
|
| | | </div>
|
| | | </div>
|
| | | </div>
|
| | | <template #right>
|
| | | <van-button square style="height: 100%;" type="danger" text="å é¤" @click="dele(index)" />
|
| | | </template>
|
| | | </van-swipe-cell> -->
|
| | |
|
| | | <div class="tl_zw"></div>
|
| | | <div class="tl_footer">
|
| | | <button class="tl_footer_submit" v-preventReClick @click="submit">æäº¤</button>
|
| | | </div>
|
| | | <u-picker :show="show" :columns="[gzqjData]" title="éæ©çäº§å±æ§" @confirm="gzqjConfirm" @cancel="show=false">
|
| | | </u-picker>
|
| | | </view>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import VWorkOrderInfo from '@/components/workOrderInfo.vue'
|
| | | import {
|
| | | setTimeO
|
| | | } from '@/util/utils.js'
|
| | | import {
|
| | | queryById,
|
| | | getJdList,
|
| | | createDJ
|
| | | } from '@/util/api/WorkOrderAPI'
|
| | | export default {
|
| | | components: {
|
| | | VWorkOrderInfo
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | options1: [{
|
| | | text: 'å é¤'
|
| | | }],
|
| | | show: false,
|
| | | index: '',
|
| | | workOrderId: '',
|
| | | info: {},
|
| | | gzqjData: [],
|
| | | formList: [{
|
| | | id: Date.now(),
|
| | | attribute: '', // 屿§å¼
|
| | | attributeName: '', // 屿§å¼åç§°
|
| | | data: '', // æ°æ®
|
| | | type: '', // ç±»å
|
| | | tips: '', // æç¤ºå
|
| | | num: '' // æ°é
|
| | | }]
|
| | | }
|
| | | },
|
| | | onLoad(obj) {
|
| | | this.workOrderId = obj.id
|
| | | this.queryByIds()
|
| | | this.getJdLists()
|
| | | },
|
| | | methods: {
|
| | | queryByIds() {
|
| | | queryById(this.workOrderId)
|
| | | .then(res => {
|
| | | console.log(res);
|
| | | this.info = res.data
|
| | | })
|
| | | },
|
| | | getJdLists() {
|
| | | getJdList({
|
| | | workOrderID: this.workOrderId
|
| | | })
|
| | | .then(res => {
|
| | | if (res.code === 200 && res.data && res.data.length !== 0) {
|
| | | res.data.forEach(item => {
|
| | | this.gzqjData.push({
|
| | | text: item.name,
|
| | | id: item.id,
|
| | | type: item.type,
|
| | | data: item.remark ? item.remark.split(' ') : '',
|
| | | tips: item.tips
|
| | | })
|
| | | })
|
| | | }
|
| | | })
|
| | | },
|
| | | add() {
|
| | | this.formList.push({
|
| | | id: Date.now(),
|
| | | attribute: '',
|
| | | attributeName: '',
|
| | | num: '',
|
| | | type: '',
|
| | | data: '',
|
| | | tips: ''
|
| | | })
|
| | | },
|
| | | open(index) {
|
| | | this.index = index
|
| | | this.show = true
|
| | | },
|
| | | gzqjConfirm({
|
| | | value
|
| | | }) {
|
| | | console.log(value);
|
| | | let temp = value[0]
|
| | | this.formList[this.index] = {
|
| | | attribute: temp.id,
|
| | | attributeName: temp.text,
|
| | | type: temp.type,
|
| | | data: temp.data,
|
| | | tips: temp.tips,
|
| | | num: '',
|
| | | }
|
| | | if (temp.type === 1) {
|
| | | this.formList[this.index].num = []
|
| | | } else if (temp.type === 0) {
|
| | | this.formList[this.index].num = temp.data[0]
|
| | | } else if (temp.type === 4) {
|
| | | this.formList[this.index].num = setTimeO(new Date(), '-')
|
| | | }
|
| | | // this.formList.forEach((item, index) => {
|
| | | // if (this.index === index) {
|
| | | // item.attribute = value.id
|
| | | // item.attributeName = value.text
|
| | | // item.type = value.type
|
| | | // item.data = value.data
|
| | | // item.tips = value.tips
|
| | | // console.log(value)
|
| | | // item.num = ''
|
| | | // if (item.type === 1) {
|
| | | // item.num = []
|
| | | // } else if (item.type === 0) {
|
| | | // item.num = item.data[0]
|
| | | // }
|
| | | // if (value.type === 4) {
|
| | | // formList.value[indexs.value].num = setTimeO(new Date(), '-')
|
| | | // }
|
| | | // }
|
| | | // })
|
| | | this.show = false
|
| | | },
|
| | | dele(index) {
|
| | | if (this.formList.length === 1) {
|
| | | uni.$u.toast('è³å°ä¿ç䏿¡ç¹æ£ä¿¡æ¯')
|
| | | return
|
| | | }
|
| | | this.formList.splice(index, 1)
|
| | | }, |
| | | radioSelect(v) { |
| | | console.log(v); |
| | | },
|
| | | submit() {
|
| | | let isOpen = true |
| | | let attrList = [] |
| | | |
| | | this.formList.forEach(item => { |
| | | console.log('-------', item);
|
| | | if (item.type === 1) { |
| | | if (item.attribute === '' || item.num.length === 0) {
|
| | | isOpen = false |
| | | return
|
| | | } else { |
| | | attrList.push({ |
| | | val: item.num.join(' '), |
| | | attrId: item.attribute |
| | | }) |
| | | }
|
| | | } else { |
| | | if (item.attribute === '' || item.num === '') {
|
| | | isOpen = false |
| | | return
|
| | | } else { |
| | | attrList.push({ |
| | | val: item.num, |
| | | attrId: item.attribute |
| | | }) |
| | | }
|
| | | }
|
| | | })
|
| | | if (!isOpen) {
|
| | | uni.$u.toast('请å°ä¿¡æ¯å¡«å宿´')
|
| | | return
|
| | | }
|
| | | |
| | | createDJ({
|
| | | attrList: attrList,
|
| | | id: this.workOrderId
|
| | | }).then(res => {
|
| | | if (res.code === 200) { |
| | | uni.$emit('spotAdd') |
| | | uni.$u.toast('å建æå')
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1000)
|
| | | }
|
| | | })
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
|
| | | <style lang="scss" scoped>
|
| | | .tl {
|
| | | width: 100%;
|
| | | height: 100%;
|
| | | position: absolute;
|
| | | background: #F7F7F7;
|
| | |
|
| | | .tl_title {
|
| | | display: flex;
|
| | | align-items: center;
|
| | | justify-content: space-between;
|
| | | padding: 30rpx;
|
| | |
|
| | | .tl_title_left {
|
| | | display: flex;
|
| | | align-items: center;
|
| | |
|
| | | .tl_title_left_x {
|
| | | width: 8rpx;
|
| | | height: 30rpx;
|
| | | background: $nav-color;
|
| | | border-radius: 2rpx;
|
| | | margin-right: 12rpx;
|
| | | }
|
| | |
|
| | | span {
|
| | | font-size: 32rpx;
|
| | | font-weight: 500;
|
| | | color: #222222;
|
| | | }
|
| | | }
|
| | |
|
| | | .tl_title_right {
|
| | | display: flex;
|
| | | align-items: center;
|
| | |
|
| | | img {
|
| | | width: 28rpx;
|
| | | height: 28rpx;
|
| | | margin-right: 12rpx;
|
| | | }
|
| | |
|
| | | span {
|
| | | font-size: 28rpx;
|
| | | font-weight: 400;
|
| | | color: $nav-color;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | .tl_list {
|
| | | display: flex;
|
| | | flex-direction: column;
|
| | | background: white;
|
| | | padding: 0 30rpx;
|
| | | margin-bottom: 20rpx;
|
| | |
|
| | | .tl_list_item {
|
| | | min-height: 98rpx;
|
| | | display: flex;
|
| | | align-items: center;
|
| | | justify-content: space-between;
|
| | | border-bottom: 1rpx solid #E5E5E5;
|
| | |
|
| | | &:last-child {
|
| | | border: none;
|
| | | }
|
| | |
|
| | | .tl_list_item_label {
|
| | | font-size: 30rpx;
|
| | | font-weight: 400;
|
| | | color: #222222;
|
| | | }
|
| | |
|
| | | .tl_list_item_go {
|
| | | display: flex;
|
| | | align-items: center;
|
| | |
|
| | | input {
|
| | | text-align: right;
|
| | | width: 450rpx;
|
| | | height: 60rpx;
|
| | | border-radius: 8rpx;
|
| | | border: 1rpx solid #E5E5E5;
|
| | | padding: 0 30rpx;
|
| | | box-sizing: border-box;
|
| | | font-size: 28rpx;
|
| | | font-weight: 400;
|
| | | color: #333333;
|
| | | }
|
| | |
|
| | | span {
|
| | | font-size: 28rpx;
|
| | | font-weight: 400;
|
| | | color: #999999;
|
| | | margin-right: 10rpx;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | .tl_zw {
|
| | | height: 160rpx;
|
| | | }
|
| | |
|
| | | .tl_footer {
|
| | | width: 100%;
|
| | | position: fixed;
|
| | | bottom: 0;
|
| | | left: 0;
|
| | | padding: 0 30rpx 68rpx 30rpx;
|
| | | box-sizing: border-box;
|
| | |
|
| | | .tl_footer_submit {
|
| | | width: 690rpx;
|
| | | height: 88rpx;
|
| | | border: none;
|
| | | background: #4275FC;
|
| | | box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08);
|
| | | border-radius: 8rpx;
|
| | | font-size: 30rpx;
|
| | | font-weight: 500;
|
| | | color: #FFFFFF;
|
| | | display: flex;
|
| | | align-items: center;
|
| | | justify-content: center;
|
| | | }
|
| | | }
|
| | | }
|
| | | </style> |