downgrade.vue 9.1 KB

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