questionHandleItem.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="problemHandleItem">
  3. <!-- <view class="font-md text-dark">问题处理</view>-->
  4. <u--form labelPosition="left" :model="problemHandleData" labelWidth="80">
  5. <u-form-item label="问题处理" prop="dealResult">
  6. <u-radio-group v-model="problemHandleData.dealResult" placement="column" @change="groupChange">
  7. <!-- <u-radio label="退回修改" name="2" :disabled="onlyFlag" class="mb-2" @change="radioChange"></u-radio>-->
  8. <u-radio label="办结" name="3" :disabled="onlyFlag" class="mb-2" @change="radioChange"></u-radio>
  9. <u-radio label="反馈大走访活动办"
  10. v-if="typeName == 'question' && (userInfo.enterpriseAreaFlag || userInfo.enterpriseCadreFlag)" name="4"
  11. :disabled="onlyFlag" @change="radioChange" class="mb-2"></u-radio>
  12. <u-radio label="正在办理"
  13. v-if="typeName == 'question' && (userInfo.enterpriseAreaFlag || userInfo.enterpriseCadreFlag || userInfo.assignedDeptFlag)"
  14. name="10" :disabled="onlyFlag" @change="radioChange" class="mb-2"></u-radio>
  15. <u-radio label="难以化解"
  16. v-if="typeName == 'question' && (userInfo.enterpriseAreaFlag || userInfo.enterpriseCadreFlag) || userInfo.assignedDeptFlag"
  17. name="11" :disabled="onlyFlag" @change="radioChange" class="mb-2"></u-radio>
  18. <u-radio label="持续跟踪"
  19. v-if="typeName == 'question' && (userInfo.enterpriseAreaFlag || userInfo.enterpriseCadreFlag) || userInfo.assignedDeptFlag"
  20. name="12" :disabled="onlyFlag" @change="radioChange" class="mb-2"></u-radio>
  21. <u-radio label="提请会办"
  22. v-if="typeName == 'question' && (userInfo.enterpriseAreaFlag || userInfo.enterpriseCadreFlag) || userInfo.assignedDeptFlag"
  23. name="13" :disabled="onlyFlag" @change="radioChange" class="mb-2"></u-radio>
  24. <u-radio label="交办" v-if="typeName == 'question' && userInfo.ydGxjLeaderFlag" name="5" :disabled="onlyFlag"
  25. @change="radioChange">
  26. </u-radio>
  27. </u-radio-group>
  28. </u-form-item>
  29. <u-form-item label="预计办结时间:" @click="choosePreTime" prop="preTime"
  30. v-if="!onlyFlag || ((problemHandleData.preTime && !outCharge) || outCharge)" labelWidth="120">
  31. <u--input v-model="problemHandleData.preTime" readonly :border="onlyFlag ? 'none' : 'surround'"
  32. :placeholder="'请选择预计办结时间'">
  33. </u--input>
  34. <view class="icon-clear" @click.stop="clearIcon" v-if="!onlyFlag">
  35. <uni-icons type="clear" color="#e1e1e1" size="24"></uni-icons>
  36. </view>
  37. </u-form-item>
  38. <!-- <view class="error-tip" v-if="!problemHandleData.dealResult openAssignPick&& errorTip">
  39. 请选择处理结果
  40. </view> -->
  41. <u-form-item label="交办单位:" prop="assignedDeptName" v-if="problemHandleData.dealResult == '5'"
  42. @click.native="openAssignPick">
  43. <slot>
  44. <view class="d-flex j-sb a-center">
  45. <text v-show="problemHandleData.assignedDeptName"
  46. class="text-secondary">{{problemHandleData.assignedDeptName}}</text>
  47. <text v-show="!problemHandleData.assignedDeptName" class="font-md"
  48. style="color: rgb(192, 196, 204);">请选择交办单位</text>
  49. <u-icon v-if="!onlyFlag" name="arrow-down" color="#303133" size="15">
  50. </u-icon>
  51. </view>
  52. </slot>
  53. </u-form-item>
  54. <u-form-item label="退回单位:" prop="backDept" v-if="problemHandleData.dealResult == '2'&&roleLevel=='4'">
  55. <song-data-picker style="width: 100%;" @click.native="songClick" :readonly="onlyFlag" :clearIcon="false"
  56. :localdata="columns" :placeholder="!onlyFlag ? '请选择退回单位' : ''" popup-title="请选择退回单位"
  57. @nodeclick="onnodeclick2">
  58. <slot name="data">
  59. <view class="d-flex j-sb a-center border p-1 rounded8" style="border-color: rgb(218, 219, 222, 0.5);">
  60. <view class="text-secondary">
  61. <text v-show="problemHandleData.backDeptName">{{problemHandleData.backDeptName}}</text>
  62. <text v-show="!problemHandleData.backDeptName" style="color: rgb(192, 196, 204);"
  63. class="font-md">请选择退回单位</text>
  64. </view>
  65. <u-icon v-if="!onlyFlag" name="arrow-down" color="#303133" size="15">
  66. </u-icon>
  67. </view>
  68. </slot>
  69. </song-data-picker>
  70. </u-form-item>
  71. <u-form-item :label="labelTitle" prop="dealSuggestion">
  72. <u--textarea v-model="problemHandleData.dealSuggestion" :disabled="onlyFlag"
  73. :border="onlyFlag ? 'none' : 'surround'" :placeholder="!onlyFlag ? '请填写处理建议' : ''">
  74. </u--textarea>
  75. </u-form-item>
  76. <u-form-item label="附件:" prop="file" v-if="!qiYeFlag">
  77. <u-upload accept="file" :disabled="onlyFlag" @afterRead="afterRead" name="1" multiple :maxCount="10">
  78. <u-button type="primary" icon="plus" text="上传附件"></u-button>
  79. </u-upload>
  80. </u-form-item>
  81. <u-form-item label=" " prop="">
  82. <view class="d-flex flex-wrap">
  83. <view class="w-100 d-flex" v-for="(item,index) in problemHandleData.fileList" :key="index">
  84. <u--text type="primary" :text="item.name" @tap="downloadFile(index)"></u--text>
  85. <u-icon class="ml-1" name="close-circle" color="#F56C6C" size="16" v-if="!onlyFlag"
  86. @tap="deletePic(index)"></u-icon>
  87. </view>
  88. </view>
  89. </u-form-item>
  90. <!-- <view class="error-tip" v-if="!problemHandleData.dealSuggestion && errorTip">
  91. 请填写处理建议
  92. </view> -->
  93. </u--form>
  94. <m-multiple-picker ref="multiplePicker" :pickerTitle="{text: '交办单位',color:'#101010',fontSize:'32rpx'}"
  95. :cancelBtn="{text: '取消',color:'#666666',fontSize:'32rpx'}"
  96. :confirmBtn="{text: '确定',color:'#2f77f1',fontSize:'32rpx'}" :mapKeys="{ label: 'label', value: 'value' }"
  97. searchPlaceholder="筛选交办单位" :openSearch="true" textAlign="left" :dataList="radarOverlyingList"
  98. :checkedVals="radarOverVals" @mulConfirm="multipleConfirm"></m-multiple-picker>
  99. <u-datetime-picker :show="preTimeShow" :confirmDisabledText=" '请选择预计办结时间'" closeOnClickOverlay mode="date"
  100. @confirm="preTimeConfirm" @cancel="preTimeShow=false" @close="preTimeShow=false" :minDate="1704038400000">
  101. </u-datetime-picker>
  102. </view>
  103. </template>
  104. <script>
  105. import {Global} from "@/common/Global.js";
  106. import {Store} from "@/common/store.js";
  107. import {formatDate} from "@/common/util2.js"
  108. export default {
  109. props: {
  110. problemType: {
  111. type: String,
  112. default: ''
  113. },
  114. roleLevel: {
  115. type: String,
  116. default: ''
  117. },
  118. problemHandleData: {
  119. type: Object,
  120. default: () => {}
  121. },
  122. userInfo: {
  123. type: Object,
  124. default: () => {}
  125. },
  126. readOnlyFlag: {
  127. type: Boolean,
  128. default: false
  129. },
  130. showErrorTip: {
  131. type: Boolean,
  132. default: false
  133. },
  134. column: {
  135. type: Array,
  136. default: () => []
  137. }
  138. },
  139. data() {
  140. return {
  141. preTimeShow: false,
  142. outCharge: false,
  143. radarOverVals: [],
  144. num: 0, //用于区分是否是重复选中,
  145. show: false,
  146. columns: [{
  147. text: "企业",
  148. value: "10"
  149. },
  150. {
  151. text: "挂钩干部",
  152. value: "20"
  153. },
  154. {
  155. text: "属地干部",
  156. value: "30"
  157. },
  158. ],
  159. qiYeFlag: true,
  160. labelTitle: '处理建议 '
  161. }
  162. },
  163. watch: {
  164. 'problemHandleData.assignedDept': {
  165. handler(newVal, oldVal) {
  166. if (!newVal) return
  167. this.column.forEach(ele => {
  168. if (ele.enCode === newVal) {
  169. this.$set(this.problemHandleData, 'assignedDeptName', ele.fullName)
  170. }
  171. })
  172. }
  173. }
  174. },
  175. computed: {
  176. onlyFlag() {
  177. return this.readOnlyFlag
  178. },
  179. errorTip() {
  180. return this.showErrorTip
  181. },
  182. typeName() {
  183. return this.problemType
  184. },
  185. unitColumn() {
  186. const column = (this.column || []).map(ele => {
  187. const obj = {}
  188. obj.text = ele.fullName
  189. obj.value = ele.enCode
  190. return obj
  191. })
  192. return column
  193. },
  194. radarOverlyingList() {
  195. const column = (this.column || []).map(ele => {
  196. const obj = {}
  197. obj.label = ele.fullName
  198. obj.value = ele.enCode
  199. return obj
  200. })
  201. console.log("radarOverlyingList: ", column)
  202. return column
  203. }
  204. },
  205. mounted() {
  206. const userInfo = Store.getUser() ? JSON.parse(Store.getUser()) : {}
  207. this.qiYeFlag = userInfo?.roleLevel === '1'
  208. this.outCharge = userInfo?.roleLevel === '5'
  209. if (userInfo?.roleLevel === '4') {
  210. this.labelTitle = '交办要求'
  211. }
  212. console.log("userInfo?.roleLevel: ", userInfo?.roleLevel)
  213. },
  214. methods: {
  215. clearIcon(e) {
  216. this.$set(this.problemHandleData, 'preTime', null)
  217. },
  218. choosePreTime() {
  219. // if (!(this.problemHandleData.status == '4' && this.outCharge) || this.onlyFlag) return
  220. if (this.onlyFlag) return
  221. this.preTimeShow = true;
  222. uni.hideKeyboard()
  223. },
  224. preTimeConfirm(e) {
  225. this.preTimeShow = false
  226. this.$set(this.problemHandleData, 'preTime', formatDate(e.value, 'yyyy-MM-dd'))
  227. },
  228. songClick() {
  229. uni.hideKeyboard()
  230. },
  231. onnodeclick2(ele) {
  232. this.$set(this.problemHandleData, 'backDeptName', ele.text)
  233. this.$set(this.problemHandleData, 'backDept', ele.value)
  234. },
  235. downloadFile(index) {
  236. const downloadLink = Global.baseUrl + this.problemHandleData.fileList[index].url;
  237. window.open(downloadLink, '_blank'); //h5直接进行跳转页面打开就可以了
  238. uni.downloadFile({ //调用uni中的下载方法
  239. url: Global.baseUrl + this.problemHandleData.fileList[index].url, //后端返回的完整路径
  240. success: (res) => {
  241. console.log(res.tempFilePath, "下载");
  242. if (res.statusCode === 200) {
  243. const tempFilePath = res.tempFilePath;
  244. // 显示文件
  245. uni.openDocument({
  246. filePath: tempFilePath,
  247. success: (res) => {
  248. console.log(res, '打开文件成功');
  249. },
  250. });
  251. }
  252. },
  253. fail: (err) => {
  254. console.log('下载文件失败', err);
  255. }
  256. });
  257. },
  258. deletePic(index) {
  259. this.problemHandleData.fileList.splice(index, 1)
  260. },
  261. async afterRead(event) {
  262. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  263. let lists = [].concat(event.file)
  264. console.log('lists', lists)
  265. let fileListLen = this.problemHandleData.fileList ? this.problemHandleData.fileList.length : 0
  266. lists.map((item) => {
  267. if (!this.problemHandleData.fileList) {
  268. this.problemHandleData.fileList = [{
  269. ...item,
  270. status: 'uploading',
  271. message: '上传中'
  272. }]
  273. } else {
  274. this.problemHandleData.fileList.push({
  275. ...item,
  276. status: 'uploading',
  277. message: '上传中'
  278. })
  279. }
  280. })
  281. for (let i = 0; i < lists.length; i++) {
  282. const result = await this.uploadFilePromise(lists[i].url)
  283. let item = this.problemHandleData.fileList[fileListLen]
  284. this.problemHandleData.fileList.splice(fileListLen, 1, Object.assign(item, {
  285. status: 'success',
  286. message: '',
  287. url: result
  288. }))
  289. fileListLen++
  290. }
  291. console.log('全部上传完了', this.problemHandleData.fileList)
  292. },
  293. uploadFilePromise(url) {
  294. return new Promise((resolve, reject) => {
  295. let a = uni.uploadFile({
  296. url: Global.baseUrl + '/api/file/Uploader/chain', // 仅为示例,非真实的接口地址
  297. filePath: url,
  298. name: 'file',
  299. formData: {
  300. user: 'test'
  301. },
  302. success: (res) => {
  303. console.log('upload', res)
  304. if (res.data) {
  305. let response = JSON.parse(res.data)
  306. if (response.data) {
  307. setTimeout(() => {
  308. resolve(response.data.url)
  309. }, 1000)
  310. }
  311. }
  312. }
  313. });
  314. })
  315. },
  316. // 交办单位检索
  317. mySearchFn(searchList, searchWord) {
  318. return searchList.filter(x => x.text.includes(searchWord));
  319. },
  320. // 交办单位选择变化操作
  321. onnodeclick(ele) {
  322. console.log("ele: ", ele)
  323. this.$set(this.problemHandleData, 'assignedDeptName', ele.text)
  324. this.$set(this.problemHandleData, 'assignedDept', ele.value)
  325. },
  326. openAssignPick() {
  327. this.$refs.multiplePicker.openMulpicker()
  328. },
  329. multipleConfirm(item) {
  330. const selectItems = item.value
  331. const objValues = item.objValue
  332. this.radarOverVals = selectItems
  333. this.$set(this.problemHandleData, 'assignedDept', selectItems.toString())
  334. if (objValues.length > 0) {
  335. const labelName = objValues.map(t => t.label)
  336. this.$set(this.problemHandleData, 'assignedDeptName', labelName.toString())
  337. }
  338. },
  339. // 处理结果点击确认
  340. groupChange(ele) {
  341. if (ele == this.problemHandleData.dealResult && this.num == 0) {
  342. this.num++ // 第一次相等即执行以下代码
  343. } else {
  344. // 第一次后相等即执行以下代码 --> 置空 radioGroupValue 即取消选中的值
  345. this.problemHandleData.dealResult = ''
  346. this.num = 0 // 初始化 num
  347. }
  348. if (this.problemHandleData.dealResult != '5') {
  349. this.problemHandleData.assignedDeptName = ''
  350. this.problemHandleData.assignedDept = ''
  351. this.problemHandleData.dealSuggestion = ''
  352. } else {
  353. this.problemHandleData.assignedDeptName = this.column[0].fullName
  354. this.problemHandleData.assignedDept = this.column[0].enCode
  355. this.radarOverVals = [this.column[0].enCode]
  356. this.problemHandleData.dealSuggestion = '请2日内回应,10内反馈办理结果,如办结请上传加盖公章的书面材料'
  357. }
  358. },
  359. radioChange(v) {
  360. this.problemHandleData.dealResult = v
  361. this.num = 0 // 切换选项后需要初始化 num
  362. },
  363. // 判断是否有必填项为填写
  364. isRequired() {
  365. const query = uni.createSelectorQuery().in(this);
  366. let dataLength = 0
  367. query.selectAll('.error-tip').boundingClientRect(data => {
  368. dataLength = data.length
  369. if (dataLength) {
  370. uni.$u.toast('请完善必填项内容')
  371. }
  372. }).exec();
  373. return dataLength
  374. }
  375. }
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .error-tip {
  380. font-size: 12px;
  381. color: #f56c6c;
  382. margin-left: 160rpx;
  383. }
  384. </style>