downgrade.vue 9.1 KB

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