dialog.vue 12 KB

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