index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <script>
  2. import DescriptionText from "@/subPages/pages/commitment/commitmentDetail/components/DescriptionText.vue";
  3. import InputComponents from "@/subPages/pages/commitment/commitmentDetail/components/InputComponents.vue";
  4. import DividerComponents from "@/subPages/pages/commitment/commitmentDetail/components/DividerComponents.vue";
  5. import IndicatorComponents from "@/subPages/pages/commitment/commitmentDetail/components/IndicatorComponents.vue";
  6. import {downFileBase64, editVerifyTask} from "@/api/commitment";
  7. import CommitmentConfirmForm from "@/subPages/pages/commitment/components/commitmentConfirmForm/index.vue";
  8. import buriedPoint from "@/utils/dd.buriedPoint";
  9. export default {
  10. components: {CommitmentConfirmForm, IndicatorComponents, DividerComponents, InputComponents, DescriptionText},
  11. data() {
  12. return {
  13. actionSheetShow: false,
  14. currentStep: 0,
  15. batchCheckForm:{
  16. fileList:[]
  17. },
  18. checkResultColumns: [
  19. {
  20. text: '整改',
  21. value: 1
  22. },
  23. {
  24. text: '整改扣分',
  25. value: 2
  26. },
  27. {
  28. text: '符合',
  29. value: 0
  30. }
  31. ]
  32. };
  33. },
  34. onLoad(){
  35. buriedPoint('经营承诺详情','1-2','subPages/pages/commitment/commitmentDetail/index')
  36. },
  37. computed: {
  38. templateJson: {
  39. get() {
  40. return this.$store.state.template.templateJson
  41. },
  42. set(value) {
  43. this.$store.commit('template/setTemplateComponents', value)
  44. }
  45. },
  46. noDownload() {
  47. return this.$route.query.noDownload
  48. },
  49. indicatorList:{
  50. get() {
  51. return this.$store.state.template.indicatorList
  52. },
  53. set(value) {
  54. this.$store.commit('template/setIndicatorList', value)
  55. }
  56. },
  57. /* 批量核查的列表,只有auditResult为3(未核查的)和approvalStatus已拒绝(0)的 */
  58. batchCheckIndicatorList(){
  59. return this.indicatorList.filter(item => item.auditResult === 3 || item.approvalStatus === 0)
  60. }
  61. },
  62. watch:{
  63. '$route.query.uuid':{
  64. handler(val){
  65. if(val) {
  66. this.currentStep = 0
  67. this.$store.dispatch('template/getPromiseDetail', this.$route.query.uuid)
  68. }
  69. },
  70. immediate:true
  71. }
  72. },
  73. methods: {
  74. handleClose() {
  75. this.$router.go(-1)
  76. },
  77. handleDownPdf() {
  78. if(!this.templateJson.attmentId){
  79. this.$toast('暂无承诺书')
  80. }else {
  81. downFileBase64({
  82. uuid:this.templateJson.attmentId
  83. }).then(res => {
  84. if (res.code === 0) {
  85. const a = document.createElement('a')
  86. a.href = res.data
  87. a.download = '承诺书.pdf'
  88. a.click()
  89. }
  90. })
  91. }
  92. },
  93. /* 批量核查显示 */
  94. handleBatchCommitment() {
  95. this.actionSheetShow = true
  96. },
  97. /* 批量核查下一步 */
  98. handleNextStep() {
  99. this.currentStep = 1
  100. },
  101. handlePrevStep() {
  102. this.currentStep = 0
  103. },
  104. onCheckResultSubmit(){
  105. const result = []
  106. this.batchCheckIndicatorList.forEach(item => {
  107. result.push({
  108. "uuid": item.uuid,
  109. "promiseId": item.promiseId,
  110. "indicatorId": item.indicatorId,
  111. "indicatorInput": item.indicatorInput,
  112. "indicatorInputBody": item.indicatorInputBody,
  113. "auditor": uni.getStorageSync("userInfo").realName,
  114. "auditResult": this.checkResultColumns.find(item => item.text === this.batchCheckForm.auditResult)
  115. && this.checkResultColumns.find(item => item.text === this.batchCheckForm.auditResult).value,
  116. "auditRemark": this.batchCheckForm.auditRemark,
  117. "expandStr": this.batchCheckForm.fileList.map(item => item.uuid).join(','),
  118. })
  119. })
  120. editVerifyTask(result).then( async res => {
  121. if (res.code === 0) {
  122. this.$toast('核查成功')
  123. this.actionSheetShow = false
  124. this.batchCheckForm={}
  125. await this.$store.dispatch('template/getPromiseDetail', this.$route.query.uuid)
  126. }else{
  127. this.$toast('核查失败' + res.msg)
  128. }
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <template>
  135. <view class="h5-page">
  136. <view class="page-content">
  137. <view
  138. v-for="(item,index) in templateJson.components" :key="index"
  139. >
  140. <DescriptionText v-if="item.base.moduleName === 'InstructionsText'" :index="index"></DescriptionText>
  141. <InputComponents v-else-if="item.base.moduleName === 'Input'" :index="index"></InputComponents>
  142. <DividerComponents v-else-if="item.base.moduleName === 'divider'" :index="index"></DividerComponents>
  143. </view>
  144. <view class="commit-title" v-if="batchCheckIndicatorList.length > 0" @click="handleBatchCommitment">批量核查</view>
  145. <IndicatorComponents></IndicatorComponents>
  146. </view>
  147. <view class="page-bottom">
  148. <van-button plain type="primary" @click="handleClose">关闭</van-button>
  149. <van-button v-if="!noDownload" type="info" @click="handleDownPdf">下载PDF</van-button>
  150. </view>
  151. <van-action-sheet v-model="actionSheetShow" title="批量核查">
  152. <div class="content">
  153. <view v-show="currentStep === 0" class="first-step">
  154. <van-checkbox
  155. shape="square"
  156. style="margin-top: 20px"
  157. v-for="(item,index) in batchCheckIndicatorList" :key="index" :name="index"
  158. v-model="batchCheckIndicatorList[index].selectValue">
  159. {{ item.indicatorInputBody }}
  160. </van-checkbox>
  161. <van-button round block type="info" style="margin-top: 20px"
  162. @click="handleNextStep">下一步</van-button>
  163. </view>
  164. <view
  165. v-show="currentStep === 1"
  166. class="second-step"
  167. >
  168. <CommitmentConfirmForm
  169. v-model="batchCheckForm">
  170. <template #footer>
  171. <view style="margin: 16px;">
  172. <van-button round block type="info" @click="handlePrevStep">上一步</van-button>
  173. <van-button style="margin-top: 20px" round block type="info" @click="onCheckResultSubmit">核查确认</van-button>
  174. </view>
  175. </template>
  176. </CommitmentConfirmForm>
  177. </view>
  178. </div>
  179. </van-action-sheet>
  180. </view>
  181. </template>
  182. <style lang="scss" scoped>
  183. .h5-page {
  184. padding: 20px;
  185. background-color: #fff;
  186. min-height: calc(100vh - 40px);
  187. overflow-y: auto; /* 确保垂直滚动 */
  188. display: flex;
  189. flex-direction: column;
  190. float: left;
  191. width: calc(100% - 40px);
  192. }
  193. .page-content {
  194. flex: 1;
  195. }
  196. .page-bottom {
  197. height: 48px;
  198. }
  199. .page-content-bottom {
  200. text-align: left;
  201. margin-top: 50px;
  202. background: #F6F6F6;
  203. border-radius: 4px;
  204. padding: 10px;
  205. view {
  206. margin-bottom: 10px;
  207. }
  208. }
  209. .page-bottom {
  210. display: flex;
  211. width: 100%;
  212. }
  213. /* 默认情况下,每个按钮平分空间 */
  214. .page-bottom .van-button {
  215. flex: 1;
  216. margin-right: 10px;
  217. }
  218. /* 取消最后一个按钮的右侧间距 */
  219. .page-bottom .van-button:last-child {
  220. margin-right: 0;
  221. }
  222. /* 当只有两个按钮时的样式 */
  223. .page-bottom .van-button:first-child:nth-last-child(2) {
  224. flex: 1; /* 第一个按钮占 1/3 */
  225. }
  226. .page-bottom .van-button:nth-child(2):last-child {
  227. flex: 3; /* 第二个按钮占 2/3 */
  228. }
  229. /* 自定义滚动条的宽度和颜色 */
  230. .h5-page::-webkit-scrollbar {
  231. width: 1px; /* 滚动条宽度 */
  232. }
  233. .h5-page::-webkit-scrollbar-track {
  234. background: transparent; /* 滚动条轨道颜色 */
  235. }
  236. .h5-page::-webkit-scrollbar-thumb {
  237. background: #faf4f4; /* 滚动条颜色 */
  238. }
  239. .commit-title {
  240. color: #4476E9;
  241. text-align: end;
  242. }
  243. .content {
  244. padding: 16px 16px 160px;
  245. }
  246. </style>