downgrade.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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="date"
  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. this.addForm.id = parseInt(option.id)
  161. },
  162. onShow() {
  163. this.getDetails()
  164. },
  165. methods: {
  166. async getDetails() {
  167. const [err, res] = await to(projectApi.getDetail({ id: this.addForm.id }))
  168. if (err) return
  169. if (res.code == 200) {
  170. this.projectDetails = res.data
  171. this.addForm = Object.assign(this.addForm, this.projectDetails)
  172. this.addForm.nboType = ''
  173. this.addForm.technicalSupportName = ''
  174. this.addForm.technicalSupportContent = ''
  175. this.addForm.technicalSupportTime = this.parseTime(new Date(), '{y}-{m}-{d}')
  176. this.addForm.remark = ''
  177. }
  178. },
  179. // 时间
  180. async pickSupportDate(e) {
  181. this.showSupportDate = false
  182. const timeFormat = uni.$u.timeFormat
  183. let timeValue = await timeFormat(e.value, 'yyyy-mm-dd hh:MM')
  184. this.addForm.technicalSupportTime = timeValue
  185. },
  186. handleDowngrade() {
  187. this.$refs.addForm
  188. .validate()
  189. .then(async () => {
  190. this.showModal = true
  191. })
  192. .catch((err) => {
  193. this.$refs.uNotify.show({
  194. top: this.height + this.paddingTop + 10,
  195. type: 'warning',
  196. message: err[0].message,
  197. duration: 1000 * 3,
  198. })
  199. })
  200. },
  201. async handleDownApi() {
  202. let params = this.addForm
  203. const [err, res] = await to(projectApi.downgrade(params))
  204. this.showModal = false
  205. if (err) return
  206. if (res && res.code == 200) {
  207. this.$refs.uToast.show({
  208. type: 'success',
  209. message: '提交成功',
  210. complete: () => {
  211. this.goBack()
  212. },
  213. })
  214. }
  215. },
  216. closeUser(user) {
  217. if (user) {
  218. this.addForm.userId = user.id
  219. this.addForm.userName = user.label
  220. }
  221. },
  222. goBack() {
  223. uni.navigateBack({
  224. //关闭当前页面,返回上一页面或多级页面。
  225. delta: 1,
  226. })
  227. },
  228. },
  229. }
  230. </script>
  231. <style>
  232. page {
  233. background: #f2f3f5;
  234. }
  235. </style>
  236. <style lang="scss" scoped>
  237. .home {
  238. padding-top: 188rpx;
  239. .nav {
  240. position: absolute;
  241. left: 0;
  242. top: 0;
  243. width: 100%;
  244. height: 284rpx;
  245. background: #3e7ef8;
  246. .title {
  247. position: relative;
  248. text-align: center;
  249. font-size: 32rpx;
  250. font-weight: bold;
  251. color: #ffffff;
  252. .back {
  253. position: absolute;
  254. top: 0;
  255. bottom: 0;
  256. margin: auto;
  257. left: 70rpx;
  258. display: flex;
  259. }
  260. }
  261. }
  262. .main {
  263. position: absolute;
  264. width: 100%;
  265. height: calc(100vh - 188rpx);
  266. background: #ffffff;
  267. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  268. border-radius: 31rpx 31rpx 0 0;
  269. padding: 0 32rpx;
  270. overflow: auto;
  271. padding-bottom: 64rpx;
  272. .form-label {
  273. font-size: 32rpx;
  274. font-weight: bold;
  275. color: #323232;
  276. padding-bottom: 18rpx;
  277. .label-tag {
  278. width: 15rpx;
  279. height: 15rpx;
  280. background: #ff4d4f;
  281. border-radius: 50%;
  282. margin-right: 10rpx;
  283. }
  284. }
  285. .save {
  286. width: 569rpx;
  287. height: 92rpx;
  288. background: #3e7ef8;
  289. border-radius: 31rpx;
  290. margin: 116rpx auto 0;
  291. font-size: 32rpx;
  292. color: #ffffff;
  293. text-align: center;
  294. line-height: 92rpx;
  295. }
  296. }
  297. }
  298. </style>