downgrade.vue 9.2 KB

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