recity.vue 9.8 KB

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