problemAppealItem.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="problemHandleItem">
  3. <view class="text-black font-weight-bold font-md">
  4. 问题{{indexNo}}
  5. </view>
  6. <u--form labelPosition="left" :model="model" labelWidth="80">
  7. <u-form-item label="问题名称:" :required="!onlyFlag" prop="questionName">
  8. <u--input v-model="model.questionName" :readonly="onlyFlag" :border="onlyFlag ? 'none' : 'surround'"
  9. :placeholder="!onlyFlag ? '请填写问题名称' : ''">
  10. </u--input>
  11. </u-form-item>
  12. <view class="error-tip" v-if="!model.questionName && errorTip">
  13. 请填写问题名称
  14. </view>
  15. <u-form-item label="问题类型:" :required="!onlyFlag" prop="questionTypeName">
  16. <song-data-picker style="width: 100%;" @click.native="songClick" :readonly="onlyFlag" :clearIcon="false"
  17. :localdata="questionTypeColumn" :placeholder="!onlyFlag ? '请选择问题类型' : ''" popup-title="请选择问题类型"
  18. @nodeclick="onnodeclick">
  19. <slot name="data">
  20. <view class="d-flex j-sb a-center border p-1 rounded8" style="border-color: rgb(218, 219, 222, 0.5);">
  21. <view class="text-secondary">
  22. <text v-show="model.questionTypeName">{{model.questionTypeName}}</text>
  23. <text v-show="!model.questionTypeName" style="color: rgb(192, 196, 204);" class="font-md">请选择问题类型</text>
  24. </view>
  25. <u-icon v-if="!onlyFlag" name="arrow-down" color="#303133" size="15">
  26. </u-icon>
  27. </view>
  28. </slot>
  29. </song-data-picker>
  30. </u-form-item>
  31. <view class="error-tip" v-if="!model.questionTypeName && errorTip">
  32. 请选择问题类型
  33. </view>
  34. <block
  35. v-if="model.questionType == 'YG' || model.questionType == 'ZJ' || model.questionType == 'YDI' || model.questionType == 'CF'">
  36. <u-form-item label="缺口数:" :required="!onlyFlag" prop="gaps">
  37. <view class="d-flex a-center" v-if="model.questionType == 'YG'">
  38. <u--input v-model="model.gaps" v-if="!onlyFlag" type="number" :readonly="onlyFlag"
  39. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请输入缺口数' : ''">
  40. </u--input>
  41. <text class="ml-1"><text v-if="onlyFlag" class="pr">{{model.gaps}}</text>人</text>
  42. </view>
  43. <view class="d-flex a-center" v-if="model.questionType == 'ZJ'">
  44. <u--input v-model="model.gaps" v-if="!onlyFlag" type="number" :readonly="onlyFlag"
  45. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请输入缺口数' : ''">
  46. </u--input>
  47. <text class="ml-1"><text v-if="onlyFlag" class="pr">{{model.gaps}}</text>万元</text>
  48. </view>
  49. <view class="d-flex a-center" v-if="model.questionType == 'YDI'">
  50. <u--input v-model="model.gaps" v-if="!onlyFlag" type="number" :readonly="onlyFlag"
  51. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请输入缺口数' : ''">
  52. </u--input>
  53. <text class="ml-1"><text class="pr" v-if="onlyFlag">{{model.gaps}}</text>亩</text>
  54. </view>
  55. <view class="d-flex a-center" v-if="model.questionType == 'CF'">
  56. <u--input v-model="model.gaps" v-if="!onlyFlag" type="number" :readonly="onlyFlag"
  57. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请输入缺口数' : ''">
  58. </u--input>
  59. <text class="ml-1"><text class="pr" v-if="onlyFlag">{{model.gaps}}</text></text>
  60. </view>
  61. </u-form-item>
  62. <view class="error-tip" v-if="!model.gaps && errorTip">
  63. 请输入缺口数
  64. </view>
  65. </block>
  66. <u-form-item label="问题描述:" :required="!onlyFlag" prop="questionDescription" class="questionDesc">
  67. <u--textarea v-model="model.questionDescription" :disabled="onlyFlag" maxlength='-1'
  68. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请填写问题描述' : ''">
  69. </u--textarea>
  70. </u-form-item>
  71. <view class="error-tip" v-if="!model.questionDescription && errorTip">
  72. 请填写问题描述
  73. </view>
  74. <u-form-item label="附件:" prop="files" v-if="model.fileList&&model.fileList.length">
  75. <view class="d-flex flex-wrap">
  76. <view class="w-100 d-flex" v-for="(item,index) in model.fileList" :key="index">
  77. <u--text type="primary" :text="item.name" @tap="downloadFile(index)"></u--text>
  78. </view>
  79. </view>
  80. </u-form-item>
  81. </u--form>
  82. <slot></slot>
  83. </view>
  84. </template>
  85. <script>
  86. import {Global} from "@/common/Global.js";
  87. import {enterpriseVisit} from "@/api/dzf/enterpriseVisit.js";
  88. import {Store} from "@/common/store.js";
  89. import {formatDate} from "@/common/util2.js"
  90. export default {
  91. props: {
  92. model: {
  93. type: Object,
  94. default: () => {}
  95. },
  96. readOnlyFlag: {
  97. type: Boolean,
  98. default: false
  99. },
  100. showErrorTip: {
  101. type: Boolean,
  102. default: false
  103. },
  104. column: {
  105. type: Array,
  106. default: () => []
  107. },
  108. dealProgressDict: {
  109. type: Array,
  110. default: () => []
  111. },
  112. modelIndex: {
  113. type: Number,
  114. default: 0
  115. },
  116. },
  117. data() {
  118. return {
  119. preTimeShow: false,
  120. outCharge: false
  121. }
  122. },
  123. computed: {
  124. onlyFlag() {
  125. return Boolean(this.readOnlyFlag)
  126. },
  127. errorTip() {
  128. return this.showErrorTip
  129. },
  130. questionTypeColumn() {
  131. const column = (this.column || []).map(ele => {
  132. const obj = {}
  133. obj.text = ele.fullName
  134. obj.value = ele.enCode
  135. return obj
  136. })
  137. return column
  138. },
  139. dealProgressColumn() {
  140. const column = (this.dealProgressDict || []).map(ele => {
  141. const obj = {}
  142. obj.text = ele.fullName
  143. obj.value = ele.enCode
  144. return obj
  145. })
  146. return column
  147. },
  148. indexNo() {
  149. return this.modelIndex + 1
  150. }
  151. },
  152. mounted() {
  153. const userInfo = Store.getUser() ? JSON.parse(Store.getUser()) : {}
  154. this.outCharge = userInfo?.roleLevel === '5'
  155. console.log("this.outCharge:", this.outCharge)
  156. console.log("this.readOnlyFlag:", this.readOnlyFlag)
  157. console.log("this.(model.preTime:", this.model)
  158. },
  159. methods: {
  160. downloadFile(index) {
  161. const downloadLink = Global.baseUrl + this.model.fileList[index].url;
  162. window.open(downloadLink, '_blank'); //h5直接进行跳转页面打开就可以了
  163. uni.downloadFile({ //调用uni中的下载方法
  164. url: Global.baseUrl + this.model.fileList[index].url, //后端返回的完整路径
  165. success: (res) => {
  166. console.log(res.tempFilePath, "下载");
  167. if (res.statusCode === 200) {
  168. const tempFilePath = res.tempFilePath;
  169. // 显示文件
  170. uni.openDocument({
  171. filePath: tempFilePath,
  172. success: (res) => {
  173. console.log(res, '打开文件成功');
  174. },
  175. });
  176. }
  177. },
  178. fail: (err) => {
  179. console.log('下载文件失败', err);
  180. }
  181. });
  182. },
  183. clearIcon(e) {
  184. this.$set(this.model, 'preTime', null)
  185. },
  186. // 问题类型选择变化操作
  187. onnodeclick(ele) {
  188. this.$set(this.model, 'questionTypeName', ele.text)
  189. this.$set(this.model, 'questionType', ele.value)
  190. this.model.gaps = ''
  191. },
  192. // 问题类型选择变化操作
  193. ondealprogressclick(ele) {
  194. this.$set(this.model, 'dealProgressName', ele.text)
  195. this.$set(this.model, 'dealProgress', ele.value)
  196. },
  197. choosePreTime() {
  198. if (!(this.model.status == '4' && this.outCharge)) return
  199. this.preTimeShow = true;
  200. uni.hideKeyboard()
  201. },
  202. preTimeConfirm(e) {
  203. this.preTimeShow = false
  204. console.log("preTime:", e.value)
  205. this.$set(this.model, 'preTime', formatDate(e.value, 'yyyy-MM-dd'))
  206. },
  207. // 问题类型--->点击
  208. songClick() {
  209. uni.hideKeyboard()
  210. },
  211. // 问题类型--->点击
  212. dealProgressClick() {
  213. uni.hideKeyboard()
  214. },
  215. // 判断是否有必填项为填写
  216. isRequired() {
  217. const query = uni.createSelectorQuery().in(this);
  218. let dataLength = 0
  219. query.selectAll('.error-tip').boundingClientRect(data => {
  220. dataLength = data.length
  221. if (dataLength) {
  222. uni.$u.toast('请填写完整问题诉求')
  223. }
  224. }).exec();
  225. return dataLength
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .error-tip {
  232. font-size: 12px;
  233. color: #f56c6c;
  234. margin-left: 160rpx;
  235. }
  236. </style>