| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-12 11:57:48
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-02-21 15:10:27
- * @Description: file content
- * @FilePath: \frontend_mobile\pages\project\downgrade.vue
- -->
- <template>
- <view class="home">
- <view class="nav">
- <view :style="{ paddingTop }">
- <view class="title" :style="[{ height }, { lineHeight: height }]">
- <view class="back" @click="goBack()">
- <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
- </view>
- <text>项目降级</text>
- </view>
- </view>
- </view>
- <view class="main">
- <u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
- <u-form-item prop="nboType" borderBottom customStyle="padding:40rpx 0 30rpx">
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 项目级别
- </view>
- <u-radio-group v-model="addForm.nboType" placement="row">
- <u-radio
- customStyle="margin-right:40rpx"
- :disabled="['10', '20'].includes(projectDetails.nboType)"
- label="A"
- name="10"></u-radio>
- <u-radio
- customStyle="margin-right:40rpx"
- :disabled="projectDetails.nboType === '20'"
- label="B"
- name="20"></u-radio>
- <u-radio customStyle="margin-right:40rpx" label="C" name="30"></u-radio>
- <!-- <u-radio v-if="projectDetails.nboType === '10'" label="储备" name="50"></u-radio> -->
- </u-radio-group>
- </u-form-item>
- <!-- <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
- <view class="form-label flex_l">技术支持人员</view>
- <u-input
- placeholder="输入技术支持人员"
- v-model="addForm.technicalSupportName"
- border="none"
- suffixIconStyle="color:#CDCDCD"
- clearable
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
- </u-form-item>
- <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 技术支持内容
- </view>
- <u-input
- placeholder="输入技术支持内容"
- v-model="addForm.technicalSupportContent"
- border="none"
- suffixIconStyle="color:#CDCDCD"
- clearable
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
- </u-form-item> -->
- <!-- <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showSupportDate = true">
- <view class="form-label flex_l">技术支持时间</view>
- <u-input
- :readonly="true"
- placeholder="请选择技术支持时间"
- v-model="addForm.technicalSupportTime"
- border="none"
- suffixIcon="arrow-down"
- suffixIconStyle="color:#CDCDCD"
- clearable
- customStyle="padding: 0 30rpx 0 12rpx"></u-input>
- </u-form-item> -->
- <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx">
- <view class="form-label flex_l">
- <view class="label-tag"></view>
- 降级原因
- </view>
- <u-textarea
- fontSize="26rpx"
- v-model="addForm.remark"
- placeholder="请输入降级原因"
- height="180"
- :count="true"
- maxlength="300"></u-textarea>
- </u-form-item>
- </u-form>
- <view class="save" @click="handleDowngrade">提交</view>
- </view>
- <!-- 技术支持时间
- <u-datetime-picker
- v-if="showSupportDate"
- :show="showSupportDate"
- mode="date"
- v-model="addForm.technicalSupportTime"
- @cancel="showSupportDate = false"
- @confirm="pickSupportDate"></u-datetime-picker> -->
- <u-notify ref="uNotify"></u-notify>
- <u-toast ref="uToast"></u-toast>
- <u-modal
- :asyncClose="true"
- :show="showModal"
- content="确认进行项目降级?"
- :showCancelButton="true"
- @cancel="this.showModal = false"
- @confirm="this.handleDownApi()"></u-modal>
- </view>
- </template>
- <script>
- import projectApi from '../../api/project'
- import to from 'await-to-js'
- export default {
- name: 'omsIndex',
- data() {
- return {
- flag: true,
- height: '',
- paddingTop: '',
- // showSupportDate: false, //技术支持时间
- addForm: {
- nboType: '', //项目及别
- // technicalSupportName: '', //技术支持人员
- // technicalSupportContent: null, //技术支持内容
- // technicalSupportTime: '', //技术支持时间
- remark: '', //备注
- id: 0, //项目id
- },
- showModal: false,
- projectDetails: {},
- rules: {
- nboType: {
- type: 'string',
- required: true,
- message: '请选择项目级别',
- trigger: ['blur'],
- },
- // technicalSupportContent: {
- // type: 'string',
- // required: true,
- // message: '请输入技术支持内容',
- // trigger: ['blur'],
- // },
- remark: {
- type: 'string',
- required: true,
- message: '请输入降级原因',
- trigger: ['blur'],
- },
- },
- }
- },
- created() {
- const navData = uni.getMenuButtonBoundingClientRect()
- this.height = navData.height + 'px'
- this.paddingTop = navData.top + 'px'
- },
- onLoad(option) {
- this.addForm.id = parseInt(option.id)
- },
- onShow() {
- this.getDetails()
- },
- methods: {
- async getDetails() {
- const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
- if (err) return
- if (res.code == 200) {
- this.projectDetails = res.data
- this.addForm = Object.assign(this.addForm, this.projectDetails)
- this.addForm.nboType = ''
- this.addForm.technicalSupportName = ''
- this.addForm.technicalSupportContent = ''
- this.addForm.technicalSupportTime = this.parseTime(new Date(), '{y}-{m}-{d}')
- this.addForm.remark = ''
- }
- },
- // 时间
- async pickSupportDate(e) {
- this.showSupportDate = false
- const timeFormat = uni.$u.timeFormat
- let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
- this.addForm.technicalSupportTime = timeValue
- },
- handleDowngrade() {
- this.$refs.addForm
- .validate()
- .then(async () => {
- this.showModal = true
- })
- .catch((err) => {
- this.$refs.uNotify.show({
- top: this.height + this.paddingTop + 10,
- type: 'warning',
- message: err[0].message,
- duration: 1000 * 3,
- })
- })
- },
- async handleDownApi() {
- if (!this.flag) return
- let params = this.addForm
- this.flag = false
- const [err, res] = await to(projectApi.downgrade(params))
- this.flag = true
- this.showModal = false
- if (err) return
- if (res && res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: '提交成功',
- complete: () => {
- this.goBack()
- },
- })
- }
- },
- closeUser(user) {
- if (user) {
- this.addForm.userId = user.id
- this.addForm.userName = user.label
- }
- },
- goBack() {
- uni.navigateBack({
- //关闭当前页面,返回上一页面或多级页面。
- delta: 1,
- })
- },
- },
- }
- </script>
- <style>
- page {
- background: #f2f3f5;
- }
- </style>
- <style lang="scss" scoped>
- .home {
- padding-top: 188rpx;
- .nav {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 284rpx;
- background: #3e7ef8;
- .title {
- position: relative;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- color: #ffffff;
- .back {
- position: absolute;
- top: 0;
- bottom: 0;
- margin: auto;
- left: 70rpx;
- display: flex;
- }
- }
- }
- .main {
- position: absolute;
- width: 100%;
- height: calc(100vh - 188rpx);
- background: #ffffff;
- box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
- border-radius: 31rpx 31rpx 0 0;
- padding: 0 32rpx;
- overflow: auto;
- padding-bottom: 64rpx;
- .form-label {
- font-size: 32rpx;
- font-weight: bold;
- color: #323232;
- padding-bottom: 18rpx;
- .label-tag {
- width: 15rpx;
- height: 15rpx;
- background: #ff4d4f;
- border-radius: 50%;
- margin-right: 10rpx;
- }
- }
- .save {
- width: 569rpx;
- height: 92rpx;
- background: #3e7ef8;
- border-radius: 31rpx;
- margin: 116rpx auto 0;
- font-size: 32rpx;
- color: #ffffff;
- text-align: center;
- line-height: 92rpx;
- }
- }
- }
- </style>
|