dialog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <DialogCom :title="title" :visible.sync="open" width="800px" append-to-body @close="cancel">
  3. <div class="question-dialog-body">
  4. <el-descriptions :column="2" class="contentArea">
  5. <el-descriptions-item label="隐患所属机构">{{
  6. data.orgName
  7. }}</el-descriptions-item>
  8. <el-descriptions-item label="来源任务">{{
  9. data.srcTaskName
  10. }}</el-descriptions-item>
  11. <el-descriptions-item label="检查项">{{
  12. data.checkItem
  13. }}</el-descriptions-item>
  14. <el-descriptions-item label="检查内容">
  15. {{ data.checkContent }}
  16. </el-descriptions-item>
  17. <el-descriptions-item label="隐患描述">
  18. {{ data.questionDesc }}</el-descriptions-item
  19. >
  20. <el-descriptions-item label="提出人">
  21. {{ data.submitorName }}</el-descriptions-item
  22. >
  23. <el-descriptions-item label="发现日期">
  24. {{ dayjs(data.submitTime).format("YYYY-MM-DD") }}</el-descriptions-item
  25. >
  26. <el-descriptions-item label="整改期限">
  27. {{
  28. dayjs(data.reformDeadline).format("YYYY-MM-DD")
  29. }}</el-descriptions-item
  30. >
  31. <el-descriptions-item label="隐患图片">
  32. <div class="imageList">
  33. <el-image
  34. style="width: 100px"
  35. v-for="url in data.images"
  36. :src="url"
  37. :preview-src-list="data.images"
  38. >
  39. </el-image></div
  40. ></el-descriptions-item>
  41. </el-descriptions>
  42. <el-descriptions :column="2" class="contentArea" v-if="data.confirm">
  43. <el-descriptions-item label="确认结果">{{
  44. data.confirm.executeStatus == 0 ? "确认" : "提出异议"
  45. }}</el-descriptions-item>
  46. <el-descriptions-item label="确认人">{{
  47. data.confirm.executorName
  48. }}</el-descriptions-item>
  49. <el-descriptions-item label="异议内容" :span="2" v-if="data.confirm.executeStatus==1">{{
  50. data.confirm.description
  51. }}</el-descriptions-item>
  52. </el-descriptions>
  53. <el-descriptions :column="2" class="contentArea" v-if="data.confirmDissent">
  54. <el-descriptions-item label="审核结果">{{
  55. data.confirmDissent.executeStatus == 0 ? "同意" : "不同意"
  56. }}</el-descriptions-item>
  57. <el-descriptions-item label="审核人">{{
  58. data.confirmDissent.executorName
  59. }}</el-descriptions-item>
  60. <el-descriptions-item label="描述" :span="2" v-if="data.confirmDissent.executeStatus==1">{{
  61. data.confirmDissent.description
  62. }}</el-descriptions-item>
  63. </el-descriptions>
  64. <el-descriptions :column="2" class="contentArea" v-if="data.reform">
  65. <el-descriptions-item label="整改时间">{{
  66. dayjs(data.reform.executeTime).format("YYYY-MM-DD")
  67. }}</el-descriptions-item>
  68. <el-descriptions-item label="整改状态">{{
  69. data.reform.executeStatus == 0 ? "已整改" : "未整改"
  70. }}</el-descriptions-item>
  71. <el-descriptions-item label="描述" :span="2">{{
  72. data.reform.description
  73. }}</el-descriptions-item>
  74. <el-descriptions-item label="整改图片" :span="2">
  75. <div class="imageList">
  76. <el-image
  77. style="width: 100px; height: 100px"
  78. v-for="url in data.reform.images"
  79. :src="url"
  80. :preview-src-list="data.reform.images"
  81. >
  82. </el-image></div
  83. ></el-descriptions-item>
  84. </el-descriptions>
  85. <el-form
  86. ref="confirmForm"
  87. :model="confirmData"
  88. label-width="100px"
  89. class="form"
  90. v-if="type == 'confirm'"
  91. :rules="confirmRule"
  92. >
  93. <el-form-item label="确认结果" prop="status">
  94. <el-radio-group v-model="confirmData.status">
  95. <el-radio :label="0">确认</el-radio>
  96. <el-radio :label="1">提出异议</el-radio>
  97. </el-radio-group>
  98. </el-form-item>
  99. <el-form-item
  100. label="异议内容"
  101. prop="description"
  102. v-if="confirmData.status == 1"
  103. >
  104. <el-input
  105. v-model="confirmData.description"
  106. maxlength="255"
  107. placeHolder="请输入异议内容"
  108. ></el-input>
  109. </el-form-item>
  110. </el-form>
  111. <el-form
  112. ref="confirmDissentForm"
  113. :model="confirmDissentData"
  114. label-width="100px"
  115. class="form"
  116. v-if="type == 'confirmDissent'"
  117. :rules="confirmDissentRule"
  118. >
  119. <el-form-item label="审核结果" prop="status">
  120. <el-radio-group v-model="confirmDissentData.status">
  121. <el-radio :label="0">同意</el-radio>
  122. <el-radio :label="1">不同意</el-radio>
  123. </el-radio-group>
  124. </el-form-item>
  125. <el-form-item
  126. label="原因"
  127. prop="description"
  128. v-if="confirmDissentData.status == 1"
  129. >
  130. <el-input
  131. v-model="confirmDissentData.description"
  132. placeHolder="请输入原因"
  133. maxlength="255"
  134. ></el-input>
  135. </el-form-item>
  136. </el-form>
  137. <el-form
  138. ref="reformForm"
  139. :model="reformData"
  140. label-width="100px"
  141. class="form"
  142. v-if="type == 'reform'"
  143. :rules="reformRule"
  144. >
  145. <el-form-item label="整改时间" prop="reformDate">
  146. <el-date-picker
  147. v-model="reformData.reformDate"
  148. type="date"
  149. placeholder="选择日期"
  150. :pickerOptions="pickerOptions"
  151. >
  152. </el-date-picker>
  153. </el-form-item>
  154. <el-form-item label="整改描述" prop="description">
  155. <el-input
  156. v-model="reformData.description"
  157. maxlength="255"
  158. placeHolder="请输入整改描述"
  159. ></el-input>
  160. </el-form-item>
  161. <el-form-item label="整改图片" prop="images">
  162. <imgUpload
  163. type="more"
  164. :value="reformData.images"
  165. @input="imageListChanged"
  166. ></imgUpload>
  167. </el-form-item>
  168. </el-form>
  169. </div>
  170. <div slot="footer" class="dialog-footer">
  171. <el-button type="primary" @click="submitForm" v-if="type!='detail'">确 定</el-button>
  172. <el-button @click="cancel">取 消</el-button>
  173. </div>
  174. </DialogCom>
  175. </template>
  176. <script>
  177. import {
  178. getQuestion,
  179. confirm,
  180. confirmDissent,
  181. reform,
  182. } from "@/api/question/list.js";
  183. import dayjs from "dayjs";
  184. import imgUpload from "@/components/ImageUpload/index.vue";
  185. export default {
  186. data() {
  187. return {
  188. // 弹出层标题
  189. title: "",
  190. // 是否显示弹出层
  191. open: false,
  192. // 表单参数
  193. form: {},
  194. // 表单校验
  195. rules: {},
  196. row: null,
  197. type: null,
  198. data: {},
  199. confirmData: {
  200. id: null,
  201. status: 0,
  202. description: null,
  203. },
  204. confirmDissentData: {
  205. id: null,
  206. status: 0,
  207. description: null,
  208. },
  209. reformData: {
  210. id: null,
  211. reformDate: null,
  212. description: null,
  213. images: null,
  214. },
  215. confirmRule: {
  216. description: [
  217. { required: true, message: "请输入异议内容", trigger: "blur" },
  218. ],
  219. },
  220. confirmDissentRule: {
  221. description: [
  222. { required: true, message: "请输入原因", trigger: "blur" },
  223. ],
  224. },
  225. reformRule: {
  226. reformDate: [
  227. { required: true, message: "请选择整改日期", trigger: "blur" },
  228. ],
  229. },
  230. pickerOptions: {
  231. disabledDate(time) {
  232. return time.getTime() > Date.now();
  233. },
  234. },
  235. };
  236. },
  237. components: { imgUpload },
  238. methods: {
  239. dayjs,
  240. // 取消按钮
  241. cancel() {
  242. this.open = false;
  243. this.reset();
  244. },
  245. show(row, type) {
  246. this.row = row;
  247. this.type = type;
  248. this.setTitle(type);
  249. getQuestion(row.id).then((r) => {
  250. this.data = r.data;
  251. this.data.confirmDissent = r.data.flows.find((d) => d.executeStep == 2);
  252. this.data.confirm = r.data.flows.find((d) => d.executeStep == 1);
  253. this.data.reform = r.data.flows.find((d) => d.executeStep == 11);
  254. if(this.data.reform && this.data.reform.images) {
  255. this.data.reform.images=this.data.reform.images.split(",")
  256. }
  257. this.open = true;
  258. });
  259. },
  260. setTitle(type) {
  261. switch (type) {
  262. case "detail":
  263. this.title = "详情";
  264. break;
  265. case "confirm":
  266. this.title = "隐患确认";
  267. break;
  268. case "confirmDissent":
  269. this.title = "异议审批";
  270. break;
  271. case "reform":
  272. this.title = "隐患整改";
  273. break;
  274. }
  275. },
  276. // 表单重置
  277. reset() {
  278. this.confirmData = {
  279. id: null,
  280. status: 0,
  281. description: null,
  282. };
  283. this.confirmDissentData = {
  284. id: null,
  285. status: 0,
  286. description: null,
  287. };
  288. this.reformData = {
  289. id: null,
  290. reformDate: null,
  291. description: null,
  292. images: null,
  293. };
  294. this.resetForm("confirmForm");
  295. this.resetForm("confirmDissentForm");
  296. this.resetForm("reformForm");
  297. },
  298. imageListChanged(value) {
  299. this.reformData.images = value;
  300. },
  301. /** 提交按钮 */
  302. submitForm() {
  303. if (this.type == "confirm") {
  304. this.submitConfirm();
  305. } else if (this.type == "confirmDissent") {
  306. this.submitConfirmDissent();
  307. } else if (this.type === "reform") {
  308. this.submitReform();
  309. }
  310. },
  311. submitConfirm() {
  312. this.$refs["confirmForm"].validate((valid) => {
  313. if (!valid) {
  314. return;
  315. }
  316. let data = { ...this.confirmData, id: this.data.id };
  317. confirm(data).then((r) => {
  318. if (r.data) {
  319. this.$message.info("确认成功");
  320. this.$emit("success");
  321. this.open = false;
  322. }
  323. });
  324. });
  325. },
  326. submitConfirmDissent() {
  327. this.$refs["confirmDissentForm"].validate((valid) => {
  328. if (!valid) {
  329. return;
  330. }
  331. let data = { ...this.confirmDissentData, id: this.data.id };
  332. confirmDissent(data).then((r) => {
  333. if (r.data) {
  334. this.$message.info("异议审批成功");
  335. this.$emit("success");
  336. this.open = false;
  337. }
  338. });
  339. });
  340. },
  341. submitReform() {
  342. this.$refs["reformForm"].validate((valid) => {
  343. if (!valid) {
  344. return;
  345. }
  346. let data = { ...this.reformData, id: this.data.id };
  347. reform(data).then((r) => {
  348. if (r.data) {
  349. this.$message.info("整改成功");
  350. this.$emit("success");
  351. this.open = false;
  352. }
  353. });
  354. });
  355. },
  356. // handleConfirmStatusChange(value) {
  357. // if (value == 1) {
  358. // this.confirmRule["description"].required = true;
  359. // } else {
  360. // this.confirmRule["description"].required = false;
  361. // }
  362. // },
  363. // handleConfirmDissentStatusChange(value) {
  364. // if (value == 1) {
  365. // this.confirmDissentRule["description"].required = true;
  366. // } else {
  367. // this.confirmRule["description"].required = false;
  368. // }
  369. // },
  370. },
  371. };
  372. </script>
  373. <style lang="scss" scoped>
  374. .form {
  375. padding-top: 20px;
  376. }
  377. .imageList div {
  378. margin-left: 5px;
  379. margin-right: 5px;
  380. }
  381. .question-dialog-body{
  382. max-height: 500px;
  383. overflow-y: auto;
  384. padding-right: 20px;
  385. }
  386. .question-dialog-body>div{
  387. border-bottom: 1px solid #606266;
  388. padding-bottom: 20px;
  389. ::v-deep .el-descriptions-item__label {
  390. width: 100px;
  391. text-align: right;
  392. display: inline-block;
  393. }
  394. }
  395. .question-dialog-body>div:not(:first-child){
  396. padding-top: 20px;
  397. }
  398. .question-dialog-body>div:last-child{
  399. border: none;
  400. }
  401. </style>