accept.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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" style="width: 98%"></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="danger-image" :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. </uni-forms>
  25. <view class="uni-btn-v">
  26. <!-- <button type="primary" @click="submit">提交</button> -->
  27. <button v-for="(item,index) in flowData.taskIns.actionList" :key="index" type="primary"
  28. @click="submitForm('ruleForm',item.actionId, item.actionCode)">{{ item.actionTitle }} </button>
  29. <button type="default" @click="Cancel()">取消</button>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { upload } from '@/api/index';
  35. import graceChecker from "@/libs/graceChecker.js"
  36. import { getUserList, add, createDangerIns, getDangerInsById, triggerDangerIns } from "@/api/danger.js"
  37. export default {
  38. data() {
  39. return {
  40. riskPointId: '',
  41. groupItem: [],
  42. FilePaths: [],
  43. userList: [{ accountRealName: '' }, { accountRealName: '' }],
  44. index: 0,
  45. indexs: 0,
  46. indexUser: 1,
  47. array: ['自查', '内部反馈', '上级检查', '政府执法'],
  48. rules: {
  49. accountId: {
  50. rules: [{
  51. required: true,
  52. errorMessage: '请选择执行人',
  53. }]
  54. },
  55. validateTrigger: 'submit'
  56. },
  57. danger: {
  58. groupId: undefined,
  59. groupName: '',
  60. dangerId: undefined,
  61. dangerSource: undefined,
  62. dangerCode: '',
  63. dangerTitle: '',
  64. dangerDesc: '',
  65. dangerLevel: undefined,
  66. dangerCatId: undefined,
  67. dangerCatTitle: '',
  68. riskPointId: undefined,
  69. riskPointTitle: '',
  70. submitGroupId: undefined,
  71. submitGroupName: '',
  72. submitPositionId: undefined,
  73. submitPositionName: '',
  74. submitAccountId: undefined,
  75. submitAccountName: '',
  76. submitTime: '',
  77. dangerDeadLine: '',
  78. reviewGroupId: undefined,
  79. reviewGroupName: '',
  80. reviewPositionId: undefined,
  81. reviewPositionName: '',
  82. reviewAccountId: undefined,
  83. reviewAccountName: '',
  84. reviewTime: '',
  85. rectifyGroupId: undefined,
  86. rectifyGroupName: '',
  87. rectifyPositionId: undefined,
  88. rectifyPositionName: '',
  89. rectifyAccountId: undefined,
  90. rectifyAccountName: '',
  91. dangerReason: '',
  92. recifyCat: 1,
  93. rectifyMeasure: '',
  94. rectifyRemark: '',
  95. rectifyTime: '',
  96. acceptGroupId: undefined,
  97. acceptGroupName: '',
  98. acceptPositionId: undefined,
  99. acceptPositionName: '',
  100. acceptAccountId: undefined,
  101. acceptAccountName: '',
  102. acceptTime: '',
  103. wfDefId: 1,
  104. wfInsId: undefined,
  105. wfInsTitle: '',
  106. wfInsStatus: undefined,
  107. taskDefId: undefined,
  108. taskInsId: undefined,
  109. taskInsTitle: '',
  110. taskInsGroupId: undefined,
  111. taskInsGroupName: '',
  112. taskInsPositionId: undefined,
  113. taskInsPositionName: '',
  114. taskInsAccountId: undefined,
  115. taskInsAccountName: '',
  116. taskInsStatus: undefined,
  117. attachList: [],
  118. taskCode: '',
  119. formCode: '',
  120. fileUrl: ''
  121. },
  122. formData: {
  123. dangerId: undefined,
  124. wfDefId: undefined,
  125. wfInsId: undefined,
  126. taskDefId: undefined,
  127. taskInsId: undefined,
  128. taskCode: '',
  129. actionId: undefined,
  130. actionCode: '',
  131. actionRemark: '',
  132. groupIdTo: undefined,
  133. positionIdTo: undefined,
  134. accountIdTo: undefined,
  135. attachList: []
  136. },
  137. flowData: {
  138. wfDefId: 1,
  139. wfInsId: undefined,
  140. wfInsTitle: '',
  141. status: undefined,
  142. taskIns: {
  143. actionList: [],
  144. taskInsId: undefined,
  145. taskInsTitle: '',
  146. taskDefId: undefined,
  147. taskCode: ''
  148. },
  149. taskInsRecordList: []
  150. },
  151. computed: {},
  152. }
  153. },
  154. onLoad(options) {
  155. //调用页面请求数据接口
  156. this.dangerId = options.dangerId;
  157. console.log("dangerId", options.dangerId)
  158. this.getUserList();
  159. this.getDangerIns(options.dangerId)
  160. },
  161. filters:{
  162. previewImage(val){
  163. let imgsrc=val.split("$");
  164. return imgsrc[0];
  165. }
  166. },
  167. methods: {
  168. bindPickerChangeUser: function(e3) {
  169. this.indexUser = e3.target.value
  170. console.log("执行人", this.indexUser)
  171. this.formData.accountId = this.userList[this.indexUser].accountId
  172. this.formData.accountIdTo = this.userList[this.indexUser].accountId
  173. this.formData.groupIdTo = this.userList[this.indexUser].groupId
  174. this.formData.positionIdTo = this.userList[this.indexUser].positionId
  175. },
  176. //获取详细流程信息
  177. getDangerIns(dangerId) {
  178. getDangerInsById(dangerId).then((resp) => {
  179. const { code, data, msg } = resp
  180. if (code === 0) {
  181. const { danger, flow } = data
  182. this.danger = danger
  183. this.flowData = flow
  184. this.formData.dangerId = danger.dangerId
  185. this.formData.attachList = danger.attachList
  186. this.formData.wfDefId = flow.wfDefId
  187. this.formData.wfInsId = flow.wfInsId
  188. this.formData.taskDefId = flow.taskIns.taskDefId
  189. this.formData.taskInsId = flow.taskIns.taskInsId
  190. this.formData.taskCode = flow.taskIns.taskCode
  191. } else {
  192. this.$message.error(msg)
  193. }
  194. }).catch((error) => {
  195. console.log(error)
  196. })
  197. },
  198. previewImage(url) {
  199. // 预览图片
  200. let urls = []
  201. urls.push(url)
  202. uni.previewImage({
  203. urls: urls,
  204. });
  205. },
  206. // 提交
  207. submitForm(form, actionId, actionCode) {
  208. this.formData.actionId = actionId
  209. this.formData.actionCode = actionCode
  210. triggerDangerIns(this.formData).then((resp) => {
  211. const { code, msg } = resp
  212. if (code === 0) {
  213. uni.showToast({
  214. title: '验收成功',
  215. icon: 'success',
  216. success: function() {},
  217. complete() {
  218. uni.switchTab({
  219. url: '/views/danger/index'
  220. })
  221. }
  222. })
  223. } else {
  224. uni.showToast({
  225. title: '评审失败',
  226. icon: 'error'
  227. })
  228. }
  229. }).catch((error) => {
  230. console.log(error)
  231. })
  232. },
  233. Cancel() {
  234. //取消
  235. uni.navigateBack();
  236. },
  237. //用户列表
  238. getUserList() {
  239. getUserList().then((resp) => {
  240. const { code, data } = resp
  241. if (code === 0) {
  242. this.userList = data
  243. this.formData.accountIdTo = this.userList[1].accountId
  244. this.formData.groupIdTo = this.userList[1].groupId
  245. this.formData.positionIdTo = this.userList[1].positionId
  246. }
  247. }).catch((error) => {
  248. console.log(error)
  249. })
  250. },
  251. //上传入口
  252. uploadBt() {
  253. uni.chooseImage({
  254. success: (chooseImageRes) => {
  255. const tempFilePaths = chooseImageRes.tempFilePaths;
  256. this.uploadSubmit(tempFilePaths[0])
  257. }
  258. });
  259. },
  260. uploadSubmit(filePath) {
  261. upload({ filePath }).then((res) => {
  262. let result=JSON.parse(res);
  263. if(result.code===0){
  264. let attachList=[];
  265. let path=result.data.path;
  266. let thumbnailsFileUrl=path.split('$')[0];
  267. let fileUrl=path.split('$')[1];
  268. let uploadImgInfo={
  269. thumbnailsFileUrl,
  270. fileUrl,
  271. fileSize:result.data.size,
  272. fileExt:result.data.ext,
  273. fileTitle:result.data.oriFileName,
  274. opCode:0
  275. };
  276. attachList.push(uploadImgInfo);
  277. this.$set(this.formData,'attachList',attachList)
  278. }else{
  279. uni.showToast({
  280. title: result.msg||"上传失败"
  281. })
  282. }
  283. }).catch((msg) => {
  284. uni.showToast({
  285. title: "上传失败"
  286. })
  287. })
  288. },
  289. }
  290. }
  291. </script>
  292. <style lang="scss" scoped>
  293. .form {
  294. padding: 30rpx 10px 100upx;
  295. background-color: #fff;
  296. .textarea{
  297. width: 500upx;
  298. border: 1px solid #eaeaea;
  299. padding: 20upx;
  300. }
  301. .danger-image{
  302. display: block;
  303. max-width: 520upx;
  304. height: 300upx;
  305. background-color:#ccc ;
  306. }
  307. .tip {
  308. padding: 8upx 0 16upx 59upx;
  309. font-size: 24upx;
  310. color: #3584FF;
  311. }
  312. .tip-notice{
  313. display: inline-block;
  314. padding: 10upx;
  315. background-color: #3584FF;
  316. color: #fff;
  317. line-height: 1;
  318. margin-bottom: 10upx;
  319. }
  320. }
  321. </style>