review.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view class="form search-image-content zhcx-table">
  3. <uni-forms :modelValue="formData" ref="form" :rules="rules">
  4. <!-- <uni-forms-item label="隐患提交照片">
  5. <view @click="previewImage(danger.fileUrl)">
  6. <image class="danger-image" :src="danger.fileUrl" mode="heightFix"></image>
  7. </view>
  8. </uni-forms-item> -->
  9. <uni-forms-item label="隐患照片">
  10. <p class="tip">支持各类图片,文件不大于10M</p>
  11. <view class="zhcx-upload" @click="uploadBt">
  12. <div class="icon"></div>
  13. <text class="uploadTitle">点击上传</text>
  14. </view>
  15. <view class="attachList" v-if="formData.attachList.length>0">
  16. <image class="dangerimage" :src="formData.attachList[0].thumbnailsFileUrl" mode="widthFix"></image>
  17. </view>
  18. </uni-forms-item>
  19. <p class="tip-notice">当前关卡:评审</p>
  20. <uni-forms-item label="意见/说明" name="actionRemark">
  21. <textarea class="textarea" name="actionRemark" v-model="formData.actionRemark" placeholder-style="color:grey"
  22. placeholder="请输入隐患评审意见/说明/备注" />
  23. </uni-forms-item>
  24. <p class="tip-notice">下一关:处理人员</p>
  25. <uni-forms-item label="执行人">
  26. <picker :range="userList" range-key="accountRealName" @change="bindPickerChangeUser" :value="indexUser">
  27. <view class="uni-input">{{userList[indexUser].accountRealName}}</view>
  28. </picker>
  29. </uni-forms-item>
  30. </uni-forms>
  31. <view class="handle-wrap">
  32. <!-- <button type="primary" @click="submit">提交</button> -->
  33. <button v-for="(item,index) in flowData.taskIns.actionList"
  34. :key="index" type="primary"
  35. @click="submitForm('ruleForm',item.actionId, item.actionCode)">
  36. <text>{{ item.actionTitle }}</text>
  37. </button>
  38. <button type="default" @click="Cancel()">取消</button>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {deepClone} from '@/libs'
  44. import { upload } from '@/api/index';
  45. import graceChecker from "@/libs/graceChecker.js"
  46. import { getUserList, add, createDangerIns, getDangerDetailsById, triggerDangerIns } from "@/api/danger.js"
  47. export default {
  48. data() {
  49. return {
  50. riskPointId: '',
  51. groupItem: [],
  52. FilePaths: [],
  53. userList: [{ accountRealName: '' }, { accountRealName: '' }],
  54. index: 0,
  55. indexs: 0,
  56. indexUser: 1,
  57. array: ['自查', '内部反馈', '上级检查', '政府执法'],
  58. rules: {
  59. accountId: {
  60. rules: [{
  61. required: true,
  62. errorMessage: '请选择执行人',
  63. }]
  64. },
  65. validateTrigger: 'submit'
  66. },
  67. danger: {
  68. groupId: undefined,
  69. groupName: '',
  70. dangerId: undefined,
  71. dangerSource: undefined,
  72. dangerCode: '',
  73. dangerTitle: '',
  74. dangerDesc: '',
  75. dangerLevel: undefined,
  76. dangerCatId: undefined,
  77. dangerCatTitle: '',
  78. riskPointId: undefined,
  79. riskPointTitle: '',
  80. submitGroupId: undefined,
  81. submitGroupName: '',
  82. submitPositionId: undefined,
  83. submitPositionName: '',
  84. submitAccountId: undefined,
  85. submitAccountName: '',
  86. submitTime: '',
  87. dangerDeadLine: '',
  88. reviewGroupId: undefined,
  89. reviewGroupName: '',
  90. reviewPositionId: undefined,
  91. reviewPositionName: '',
  92. reviewAccountId: undefined,
  93. reviewAccountName: '',
  94. reviewTime: '',
  95. rectifyGroupId: undefined,
  96. rectifyGroupName: '',
  97. rectifyPositionId: undefined,
  98. rectifyPositionName: '',
  99. rectifyAccountId: undefined,
  100. rectifyAccountName: '',
  101. dangerReason: '',
  102. recifyCat: 1,
  103. rectifyMeasure: '',
  104. rectifyRemark: '',
  105. rectifyTime: '',
  106. acceptGroupId: undefined,
  107. acceptGroupName: '',
  108. acceptPositionId: undefined,
  109. acceptPositionName: '',
  110. acceptAccountId: undefined,
  111. acceptAccountName: '',
  112. acceptTime: '',
  113. wfDefId: 1,
  114. wfInsId: undefined,
  115. wfInsTitle: '',
  116. wfInsStatus: undefined,
  117. taskDefId: undefined,
  118. taskInsId: undefined,
  119. taskInsTitle: '',
  120. taskInsGroupId: undefined,
  121. taskInsGroupName: '',
  122. taskInsPositionId: undefined,
  123. taskInsPositionName: '',
  124. taskInsAccountId: undefined,
  125. taskInsAccountName: '',
  126. taskInsStatus: undefined,
  127. attachList: [],
  128. taskCode: '',
  129. formCode: '',
  130. fileUrl: ''
  131. },
  132. formData: {
  133. dangerId: undefined,
  134. wfDefId: undefined,
  135. wfInsId: undefined,
  136. taskDefId: undefined,
  137. taskInsId: undefined,
  138. taskCode: '',
  139. actionId: undefined,
  140. actionCode: '',
  141. actionRemark: '',
  142. groupIdTo: undefined,
  143. positionIdTo: undefined,
  144. accountIdTo: undefined,
  145. attachList: []
  146. },
  147. flowData: {
  148. wfDefId: 1,
  149. wfInsId: undefined,
  150. wfInsTitle: '',
  151. status: undefined,
  152. taskIns: {
  153. actionList: [],
  154. taskInsId: undefined,
  155. taskInsTitle: '',
  156. taskDefId: undefined,
  157. taskCode: ''
  158. },
  159. taskInsRecordList: []
  160. },
  161. computed: {},
  162. }
  163. },
  164. onLoad(options) {
  165. //调用页面请求数据接口
  166. this.dangerId = options.dangerId;
  167. console.log("dangerId", options.dangerId)
  168. this.getUserList();
  169. this.getDangerDetailsById(options.dangerId)
  170. },
  171. filters:{
  172. previewImage(val){
  173. let imgsrc=val.split("$");
  174. return imgsrc[0];
  175. }
  176. },
  177. methods: {
  178. bindPickerChangeUser: function(e3) {
  179. this.indexUser = e3.target.value;
  180. this.formData.accountId = this.userList[this.indexUser].accountId
  181. this.formData.accountIdTo = this.userList[this.indexUser].accountId
  182. this.formData.groupIdTo = this.userList[this.indexUser].groupId
  183. this.formData.positionIdTo = this.userList[this.indexUser].positionId
  184. },
  185. //获取详细流程信息
  186. getDangerDetailsById(dangerId) {
  187. getDangerDetailsById(dangerId).then((resp) => {
  188. const { code, data, msg } = resp
  189. if (code === 0) {
  190. const { danger, flow } = data
  191. this.danger = danger
  192. this.flowData = flow
  193. this.formData.dangerId = danger.dangerId
  194. this.formData.attachList = danger.attachList||[]
  195. this.formData.wfDefId = flow.wfDefId
  196. this.formData.wfInsId = flow.wfInsId
  197. this.formData.taskDefId = flow.taskIns.taskDefId
  198. this.formData.taskInsId = flow.taskIns.taskInsId
  199. this.formData.taskCode = flow.taskIns.taskCode
  200. } else {
  201. this.$message.error(msg)
  202. }
  203. }).catch((error) => {
  204. console.log(error)
  205. })
  206. },
  207. previewImage(url) {
  208. // 预览图片
  209. let urls = []
  210. urls.push(url)
  211. uni.previewImage({
  212. urls: urls,
  213. });
  214. },
  215. // 提交
  216. submitForm(form, actionId, actionCode) {
  217. this.formData.actionId = actionId
  218. this.formData.actionCode = actionCode
  219. triggerDangerIns(this.formData).then((resp) => {
  220. const { code, msg } = resp
  221. if (code === 0) {
  222. uni.showToast({
  223. title: '评审成功',
  224. icon: 'success',
  225. success: function() {},
  226. complete() {
  227. uni.switchTab({
  228. url: '/views/danger/index'
  229. })
  230. }
  231. })
  232. } else {
  233. uni.showToast({
  234. title: '评审失败',
  235. icon: 'error'
  236. })
  237. }
  238. }).catch((error) => {
  239. console.log(error)
  240. })
  241. },
  242. Cancel() {
  243. //取消
  244. uni.navigateBack();
  245. },
  246. //用户列表
  247. getUserList() {
  248. getUserList().then((resp) => {
  249. const { code, data } = resp
  250. if (code === 0) {
  251. this.userList = data
  252. this.formData.accountIdTo = this.userList[1].accountId
  253. this.formData.groupIdTo = this.userList[1].groupId
  254. this.formData.positionIdTo = this.userList[1].positionId
  255. }
  256. }).catch((error) => {
  257. console.log(error)
  258. })
  259. },
  260. //上传入口
  261. uploadBt() {
  262. uni.chooseImage({
  263. success: (chooseImageRes) => {
  264. const tempFilePaths = chooseImageRes.tempFilePaths;
  265. this.uploadSubmit(tempFilePaths[0])
  266. }
  267. });
  268. },
  269. uploadSubmit(filePath) {
  270. upload({ filePath }).then((res) => {
  271. let result=JSON.parse(res);
  272. if(result.code===0){
  273. let attachList=[];
  274. let path=result.data.path;
  275. let thumbnailsFileUrl=path.split('$')[0];
  276. let fileUrl=path.split('$')[1];
  277. let uploadImgInfo={
  278. thumbnailsFileUrl,
  279. fileUrl,
  280. fileSize:result.data.size,
  281. fileExt:result.data.ext,
  282. fileTitle:result.data.oriFileName,
  283. opCode:0
  284. };
  285. attachList.push(uploadImgInfo);
  286. this.$set(this.formData,'attachList',attachList)
  287. }else{
  288. uni.showToast({
  289. title: result.msg||"上传失败"
  290. })
  291. }
  292. }).catch((msg) => {
  293. uni.showToast({
  294. title: "上传失败"
  295. })
  296. })
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="scss" scoped>
  302. .form {
  303. padding: 30rpx 10px 100upx;
  304. background-color: #fff;
  305. .textarea{
  306. width: 500upx;
  307. border: 1px solid #eaeaea;
  308. padding: 20upx;
  309. }
  310. .dangerimage{
  311. display: block;
  312. width: 200upx;
  313. height: 200upx;
  314. background-color:#ccc ;
  315. }
  316. .tip {
  317. padding: 8upx 0 16upx 59upx;
  318. font-size: 24upx;
  319. color: #3584FF;
  320. }
  321. .tip-notice{
  322. display: inline-block;
  323. padding: 10upx;
  324. background-color: #3584FF;
  325. color: #fff;
  326. line-height: 1;
  327. margin-bottom: 10upx;
  328. }
  329. .handle-wrap{
  330. width: 750upx;
  331. display: flex;
  332. justify-content: center;
  333. align-items: center;
  334. position: fixed;
  335. left: 0;
  336. bottom: 0;
  337. padding: 10upx 0;
  338. background-color: rgba(255,255,255,0.6);
  339. button{
  340. width: 25%;
  341. border-radius: 0;
  342. border-width:0px;
  343. box-shadow: unset;
  344. padding: 0;
  345. margin: 0;
  346. height: 70upx;
  347. line-height: 70upx;
  348. font-size: 32upx;
  349. letter-spacing: 2px;
  350. // &[type="primary"]{
  351. // }
  352. &:nth-child(1){
  353. background-color: #0081FF;
  354. color: #fff;
  355. }
  356. &:nth-child(2){
  357. background-color: #4CD964;
  358. color: #fff;
  359. }
  360. &:nth-child(3){
  361. background-color: red;
  362. color: #fff;
  363. }
  364. &:nth-child(4){
  365. background-color: orange;
  366. color: #fff;
  367. }
  368. }
  369. }
  370. }
  371. </style>