downgrade.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-21 15:10:27
  6. * @Description: file content
  7. * @FilePath: \frontend_mobile\pages\project\downgrade.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>项目降级</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <u-form :model="addForm" :rules="rules" ref="addForm" label-width="0">
  23. <u-form-item prop="nboType" borderBottom customStyle="padding:40rpx 0 30rpx">
  24. <view class="form-label flex_l">
  25. <view class="label-tag"></view>
  26. 项目级别
  27. </view>
  28. <u-radio-group v-model="addForm.nboType" placement="row">
  29. <u-radio
  30. customStyle="margin-right:40rpx"
  31. :disabled="['10', '20'].includes(projectDetails.nboType)"
  32. label="A"
  33. name="10"></u-radio>
  34. <u-radio
  35. customStyle="margin-right:40rpx"
  36. :disabled="projectDetails.nboType === '20'"
  37. label="B"
  38. name="20"></u-radio>
  39. <u-radio customStyle="margin-right:40rpx" label="C" name="30"></u-radio>
  40. <u-radio v-if="projectDetails.nboType === '10'" label="储备" name="50"></u-radio>
  41. </u-radio-group>
  42. </u-form-item>
  43. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx">
  44. <view class="form-label flex_l">
  45. <view class="label-tag"></view>
  46. 技术支持人员
  47. </view>
  48. <u-input
  49. placeholder="输入技术支持人员"
  50. v-model="addForm.technicalSupportName"
  51. border="none"
  52. suffixIconStyle="color:#CDCDCD"
  53. clearable
  54. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  55. </u-form-item>
  56. <u-form-item prop="technicalSupportContent" borderBottom customStyle="padding:40rpx 0 30rpx">
  57. <view class="form-label flex_l">
  58. <view class="label-tag"></view>
  59. 技术支持内容
  60. </view>
  61. <u-input
  62. placeholder="输入技术支持内容"
  63. v-model="addForm.technicalSupportContent"
  64. border="none"
  65. suffixIconStyle="color:#CDCDCD"
  66. clearable
  67. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  68. </u-form-item>
  69. <u-form-item borderBottom customStyle="padding:40rpx 0 30rpx" @click="showSupportDate = true">
  70. <view class="form-label flex_l">
  71. <view class="label-tag"></view>
  72. 技术支持时间
  73. </view>
  74. <u-input
  75. :readonly="true"
  76. placeholder="请选择技术支持时间"
  77. v-model="addForm.technicalSupportTime"
  78. border="none"
  79. suffixIcon="arrow-down"
  80. suffixIconStyle="color:#CDCDCD"
  81. clearable
  82. customStyle="padding: 0 30rpx 0 12rpx"></u-input>
  83. </u-form-item>
  84. <u-form-item prop="remark" customStyle="padding:40rpx 0 30rpx">
  85. <view class="form-label flex_l">
  86. <view class="label-tag"></view>
  87. 备注原因
  88. </view>
  89. <u-textarea
  90. fontSize="26rpx"
  91. v-model="addForm.remark"
  92. placeholder="请输入备注原因"
  93. height="180"
  94. :count="true"
  95. maxlength="300"></u-textarea>
  96. </u-form-item>
  97. </u-form>
  98. <view class="save" @click="handleDowngrade">提交</view>
  99. </view>
  100. <!-- 技术支持时间 -->
  101. <u-datetime-picker
  102. v-if="showSupportDate"
  103. :show="showSupportDate"
  104. mode="datetime"
  105. v-model="addForm.technicalSupportTime"
  106. @cancel="showSupportDate = false"
  107. @confirm="pickSupportDate"></u-datetime-picker>
  108. <u-notify ref="uNotify"></u-notify>
  109. <u-toast ref="uToast"></u-toast>
  110. <u-modal
  111. :show="showModal"
  112. content="确认进行项目降级?"
  113. :showCancelButton="true"
  114. @cancel="this.showModal = false"
  115. @confirm="this.handleDownApi()"></u-modal>
  116. </view>
  117. </template>
  118. <script>
  119. import projectApi from '../../api/project'
  120. import to from 'await-to-js'
  121. export default {
  122. name: 'omsIndex',
  123. data() {
  124. return {
  125. height: '',
  126. paddingTop: '',
  127. showSupportDate: false, //技术支持时间
  128. addForm: {
  129. nboType: '', //项目及别
  130. technicalSupportName: '', //技术支持人员
  131. technicalSupportContent: null, //技术支持内容
  132. technicalSupportTime: '', //技术支持时间
  133. remark: '', //备注
  134. id: 0, //项目id
  135. },
  136. showModal: false,
  137. projectDetails: {},
  138. rules: {
  139. nboType: {
  140. type: 'string',
  141. required: true,
  142. message: '请选择项目级别',
  143. trigger: ['blur'],
  144. },
  145. technicalSupportContent: {
  146. type: 'string',
  147. required: true,
  148. message: '请输入技术支持内容',
  149. trigger: ['blur'],
  150. },
  151. remark: {
  152. type: 'string',
  153. required: true,
  154. message: '请输入备注内容',
  155. trigger: ['blur'],
  156. },
  157. },
  158. }
  159. },
  160. created() {
  161. const navData = uni.getMenuButtonBoundingClientRect()
  162. this.height = navData.height + 'px'
  163. this.paddingTop = navData.top + 'px'
  164. },
  165. onLoad(option) {
  166. console.log(option.id) //打印出上个页面传递的参数。
  167. this.addForm.id = parseInt(option.id)
  168. },
  169. onShow() {
  170. this.getDetails()
  171. },
  172. methods: {
  173. async getDetails() {
  174. const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
  175. if (err) return
  176. if (res.code == 200) {
  177. this.projectDetails = res.data
  178. this.addForm = Object.assign(this.addForm, this.projectDetails)
  179. this.addForm.nboType = ''
  180. this.addForm.technicalSupportName = ''
  181. this.addForm.technicalSupportContent = ''
  182. this.addForm.technicalSupportTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
  183. this.addForm.remark = ''
  184. }
  185. },
  186. // 时间
  187. async pickSupportDate(e) {
  188. this.showSupportDate = false
  189. const timeFormat = uni.$u.timeFormat
  190. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  191. this.addForm.technicalSupportTime = timeValue
  192. console.log(timeValue)
  193. },
  194. handleDowngrade() {
  195. this.$refs.addForm
  196. .validate()
  197. .then(async () => {
  198. this.showModal = true
  199. })
  200. .catch((err) => {
  201. console.log(err)
  202. this.$refs.uNotify.show({
  203. top: this.height + this.paddingTop + 10,
  204. type: 'warning',
  205. message: err[0].message,
  206. duration: 1000 * 3,
  207. })
  208. })
  209. },
  210. async handleDownApi() {
  211. let params = this.addForm
  212. const [err, res] = await to(projectApi.downgrade(params))
  213. this.showModal = false
  214. if (err) return
  215. if (res && res.code == 200) {
  216. this.$refs.uToast.show({
  217. type: 'success',
  218. message: '提交成功',
  219. complete: () => {
  220. this.goBack()
  221. },
  222. })
  223. }
  224. },
  225. closeUser(user) {
  226. if (user) {
  227. console.log(user)
  228. this.addForm.userId = user.id
  229. this.addForm.userName = user.label
  230. }
  231. },
  232. goBack() {
  233. uni.navigateBack({
  234. //关闭当前页面,返回上一页面或多级页面。
  235. delta: 1,
  236. })
  237. },
  238. },
  239. }
  240. </script>
  241. <style>
  242. page {
  243. background: #f2f3f5;
  244. }
  245. </style>
  246. <style lang="scss" scoped>
  247. .home {
  248. padding-top: 188rpx;
  249. .nav {
  250. position: absolute;
  251. left: 0;
  252. top: 0;
  253. width: 100%;
  254. height: 284rpx;
  255. background: #3e7ef8;
  256. .title {
  257. position: relative;
  258. text-align: center;
  259. font-size: 32rpx;
  260. font-weight: bold;
  261. color: #ffffff;
  262. .back {
  263. position: absolute;
  264. top: 0;
  265. bottom: 0;
  266. margin: auto;
  267. left: 70rpx;
  268. display: flex;
  269. }
  270. }
  271. }
  272. .main {
  273. position: absolute;
  274. width: 100%;
  275. height: calc(100vh - 188rpx);
  276. background: #ffffff;
  277. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  278. border-radius: 31rpx 31rpx 0 0;
  279. padding: 0 32rpx;
  280. overflow: auto;
  281. padding-bottom: 64rpx;
  282. .form-label {
  283. font-size: 32rpx;
  284. font-weight: bold;
  285. color: #323232;
  286. padding-bottom: 18rpx;
  287. .label-tag {
  288. width: 15rpx;
  289. height: 15rpx;
  290. background: rgba(62, 126, 248, 0.6);
  291. border-radius: 50%;
  292. margin-right: -4rpx;
  293. }
  294. }
  295. .save {
  296. width: 569rpx;
  297. height: 92rpx;
  298. background: #3e7ef8;
  299. border-radius: 31rpx;
  300. margin: 116rpx auto 0;
  301. font-size: 32rpx;
  302. color: #ffffff;
  303. text-align: center;
  304. line-height: 92rpx;
  305. }
  306. }
  307. }
  308. </style>