detail.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="addEnterprise" >
  3. <div class="addEnterpriseTit">
  4. <div>尊敬的<span style="color:#1D18BC "> {{ qyName }} </span>企业用户,你好!</div>
  5. <div class="line"></div>
  6. <div>为了更好地为企业提供相关服务,请协助完成相关数据的填报,感谢配合!</div>
  7. </div>
  8. <div class="addEnterpriseBody">
  9. <ul>
  10. <li class="bodyLi">
  11. <div class="bodyLiTit">任务编号:</div>
  12. <input type="text" readonly v-model="infoFrom.temName" placeholder="">
  13. </li>
  14. <li class="bodyLi">
  15. <div class="bodyLiTit">所属时间:</div>
  16. <input type="text" readonly v-model="infoFrom.temYearTypeCount" placeholder="">
  17. </li>
  18. <li class="bodyLi">
  19. <div class="bodyLiTit">要求完成日期:</div>
  20. <!-- @click="dateShow=true" -->
  21. <input
  22. type="text"
  23. placeholder="请选择"
  24. v-model="infoFrom.requireFinishTime"
  25. readonly
  26. />
  27. </li>
  28. <li class="bodyLi">
  29. <div class="bodyLiTit">上报日期:</div>
  30. <input type="text" v-model="infoFrom.fillTime" placeholder="自动生成" readonly>
  31. </li>
  32. <!-- <li class="bodyLi">-->
  33. <!-- <div class="bodyLiTit">填写说明:</div>-->
  34. <!-- <input type="text" placeholder="" v-model="infoFrom.remark" readonly/>-->
  35. <!-- </li>-->
  36. <li class="bodyLi" :key="item" v-for="(item, index) in optionList">
  37. <div class="bodyLiTit" style="font-size: 3.5vw"><span style="color: red">*</span> {{ item }}:</div>
  38. <input type="text" v-model="contentList[index]" placeholder="请填写" style="width: 30vw">
  39. </li>
  40. </ul>
  41. </div>
  42. <div class="buttonBox">
  43. <button @click="commit('2')">保存</button>
  44. <button @click="commit('0')">提交</button>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { getUserLocalStorageInfo,getByStag,fillControllerEditSave } from "@/js_sdk/http.js";
  50. export default {
  51. name: "detail",
  52. data(){
  53. return{
  54. qyName:getUserLocalStorageInfo().username,
  55. contentList:[],
  56. optionList:[],
  57. infoFrom:{}
  58. }
  59. },
  60. onLoad(item) {
  61. getByStag({id:item.id}).then(res => {
  62. if (res.data) {
  63. this.infoFrom = res.data
  64. this.$set(this.infoFrom, 'fillTime', this.$common.formatDate('yyyy-MM-dd hh:mm:ss', new Date()))
  65. if (res.data.temYear && res.data.temYearType) { this.$set(this.infoFrom, 'temYearTypeCount', res.data.temYear + '年' + (res.data.temYearType == '1' ? '半年累计' : '全年累计')) }
  66. if (res.data.options) { this.optionList = res.data.options.split(',') }
  67. if (res.data.content) {
  68. const newArray = res.data.content.split(',')
  69. this.contentList = newArray.map(item => item === '-' ? '' : item)
  70. }
  71. }
  72. })
  73. },
  74. methods:{
  75. commit(e) {
  76. if (!this.infoFrom.id) {
  77. uni.showToast({
  78. title: '您暂时没有需要提交的信息',
  79. icon: 'none',
  80. mask: true,
  81. duration: 1000
  82. });
  83. return false
  84. }
  85. let flag = false
  86. const optios = []
  87. for (let i = 0; i < this.optionList.length; i++) {
  88. if (!this.contentList[i]) { flag = true }
  89. const item = {
  90. name: this.optionList[i],
  91. value: this.contentList[i]
  92. }
  93. optios.push(item)
  94. }
  95. if (flag) {
  96. uni.showToast({
  97. title: '请先完成必填项的填写!',
  98. icon: 'none',
  99. mask: true,
  100. duration: 1000
  101. });
  102. return false
  103. }
  104. const reqData = {
  105. id: this.infoFrom.id,
  106. userId: getUserLocalStorageInfo.userId,
  107. saveType: e,
  108. optionList: optios
  109. }
  110. const enObj = JSON.stringify(reqData)
  111. fillControllerEditSave(enObj).then(res => {
  112. if (e === '2') {
  113. uni.showToast({
  114. title: '保存成功!',
  115. icon: 'none',
  116. mask: true,
  117. duration: 1000
  118. });
  119. } else {
  120. uni.showToast({
  121. title: '提交成功!',
  122. icon: 'none',
  123. mask: true,
  124. duration: 1000
  125. });
  126. }
  127. })
  128. },
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .addEnterprise{
  134. .addEnterpriseTit{
  135. padding: 4vw 3vw;
  136. background: white;
  137. margin: 3vw;
  138. border-radius: 5px;
  139. color: #333333;
  140. font-size: 3.8vw;
  141. .line{
  142. margin: 2vw 0;
  143. }
  144. }
  145. .addEnterpriseBody{
  146. background: white;
  147. padding: 1vw 3vw 5vw 3vw;
  148. border-radius: 5px;
  149. margin: 0 3vw;
  150. .bodyLi{
  151. display: flex;
  152. align-items: center;
  153. border-bottom: 3px solid #CCCCCC;
  154. padding: 5vw 0;
  155. width: 100%;
  156. font-size: 3.8vw;
  157. .bodyLiTit{
  158. width: 50vw;
  159. white-space: nowrap;
  160. }
  161. }
  162. .lastLi{
  163. border-bottom: none !important;
  164. padding-bottom: 2vw;
  165. }
  166. }
  167. .buttonBox{
  168. display: flex;
  169. margin-top:10vw;
  170. justify-content: space-evenly;
  171. button{
  172. background: #1D18BC;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. width: 40vw;
  177. height: 13vw;
  178. color: #FFFFFF;
  179. border-radius: 10px;
  180. }
  181. }
  182. }
  183. </style>