index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="检查内容" prop="checkContent">
  5. <el-input
  6. v-model="queryParams.checkContent"
  7. placeholder="请输入检查内容"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="检查结果" prop="checkResult">
  14. <el-input
  15. v-model="queryParams.checkResult"
  16. placeholder="请输入检查结果"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. icon="el-icon-plus"
  32. size="mini"
  33. @click="handleAdd"
  34. v-hasPermi="['pssr:hygiene:add']"
  35. v-if="isApprove==0"
  36. >新增</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. icon="el-icon-edit"
  42. size="mini"
  43. :disabled="single"
  44. @click="handleUpdate"
  45. v-hasPermi="['pssr:hygiene:edit']"
  46. v-if="isApprove==0"
  47. >修改</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="success"
  52. icon="el-icon-edit"
  53. size="mini"
  54. :disabled="multiple"
  55. @click="handleBatch"
  56. v-if="isApprove==0"
  57. v-hasPermi="['pssr:hygiene:edit']"
  58. >批量修改
  59. </el-button>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="danger"
  64. icon="el-icon-delete"
  65. size="mini"
  66. :disabled="multiple"
  67. @click="handleDelete"
  68. v-hasPermi="['pssr:hygiene:remove']"
  69. v-if="isApprove==0"
  70. >删除</el-button>
  71. </el-col>
  72. <el-col :span="1.5">
  73. <el-button
  74. type="info"
  75. icon="el-icon-upload2"
  76. size="mini"
  77. @click="handleImport"
  78. v-hasPermi="['pssr:hygiene:edit']"
  79. v-if="isApprove==0"
  80. >导入</el-button>
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. type="warning"
  85. icon="el-icon-download"
  86. size="mini"
  87. @click="handleExport"
  88. v-hasPermi="['pssr:hygiene:export']"
  89. v-if="isApprove==0"
  90. >导出</el-button>
  91. </el-col>
  92. <el-col :span="1.5">
  93. <el-button
  94. type="success"
  95. icon="el-icon-s-promotion"
  96. size="mini"
  97. @click="handleApprove"
  98. v-if="isApprove==0"
  99. v-hasPermi="['pssr:hygiene:edit']"
  100. >发起审批
  101. </el-button>
  102. </el-col>
  103. <el-col :span="1.5">
  104. <el-button
  105. type="primary"
  106. icon="el-icon-check"
  107. size="mini"
  108. v-if="isApprove==4||isApprove==5"
  109. @click="handleConfirmApprove"
  110. v-hasPermi="['pssr:hygiene:edit']"
  111. >确认
  112. </el-button>
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button
  116. type="danger"
  117. icon="el-icon-refresh-left"
  118. size="mini"
  119. v-if="isApprove==2"
  120. :disabled="multiple"
  121. @click="handleTurnDown"
  122. v-hasPermi="['pssr:hygiene:edit']"
  123. >驳回
  124. </el-button>
  125. </el-col>
  126. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  127. </el-row>
  128. <div style="width: 100%;text-align: center;margin-bottom: 15px">
  129. <H2>现场卫生检查表</H2>
  130. <br>
  131. 填写要求:现场卫生符合检查内容要求的,在检查结果中打“✔”,不符合打“×”。<br>
  132. 如果检查不符合,并联系相关责任人按照该条检查内容的要求进行整改。如不能立即整改的,请立即汇报相关负责人并采取临时应对措施。
  133. </div>
  134. <el-table v-loading="loading" :data="hygieneList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  135. <el-table-column type="selection" width="55" align="center" />
  136. <!--<el-table-column label="唯一标识ID" align="center" prop="id" :show-overflow-tooltip="true"/>-->
  137. <!--<el-table-column label="从表id" align="center" prop="subId" :show-overflow-tooltip="true"/>-->
  138. <!--<el-table-column label="审批id" align="center" prop="approveId" :show-overflow-tooltip="true"/>-->
  139. <el-table-column label="审批状态" align="center" prop="approveStatus" width="100">
  140. <template slot-scope="scope">
  141. <el-tag v-if="scope.row.approveStatus==0">未审批</el-tag>
  142. <el-tag v-if="scope.row.approveStatus==1" type="warning">待确认</el-tag>
  143. <el-tag v-if="scope.row.approveStatus==3" type="success">已确认1</el-tag>
  144. <el-tag v-if="scope.row.approveStatus==2" type="success">已确认2</el-tag>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="检查内容" align="center" prop="checkContent" :show-overflow-tooltip="true"/>
  148. <el-table-column label="检查结果" align="center" prop="checkResult" :show-overflow-tooltip="true"/>
  149. <el-table-column label="确认人1" align="center" prop="confirm1" :show-overflow-tooltip="true"
  150. width="150">
  151. <template slot-scope="scope">
  152. <span>{{ userFormat(scope.row.confirm1) }}</span>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="确认人2" align="center" prop="confirm2" :show-overflow-tooltip="true"
  156. width="150">
  157. <template slot-scope="scope">
  158. <span>{{ userFormat(scope.row.confirm2) }}</span>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="确认时间" align="center" prop="confirmationDate" width="100">
  162. <template slot-scope="scope">
  163. <span>{{ parseTime(scope.row.confirmationDate, '{y}-{m}-{d}') }}</span>
  164. </template>
  165. </el-table-column>
  166. <!--<el-table-column label="创建人" align="center" prop="createrCode" :show-overflow-tooltip="true"/>-->
  167. <!--<el-table-column label="创建时间" align="center" prop="createdate" width="100">-->
  168. <!--<template slot-scope="scope">-->
  169. <!--<span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d}') }}</span>-->
  170. <!--</template>-->
  171. <!--</el-table-column>-->
  172. <!--<el-table-column label="修改人" align="center" prop="updaterCode" :show-overflow-tooltip="true"/>-->
  173. <!--<el-table-column label="修改时间" align="center" prop="updatedate" width="100">-->
  174. <!--<template slot-scope="scope">-->
  175. <!--<span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>-->
  176. <!--</template>-->
  177. <!--</el-table-column>-->
  178. <!--<el-table-column label="部门编号" align="center" prop="deptId" :show-overflow-tooltip="true"/>-->
  179. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true"/>
  180. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  181. <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width" v-if="isApprove==0">
  182. <template slot-scope="scope">
  183. <el-button
  184. size="mini"
  185. type="text"
  186. icon="el-icon-edit"
  187. @click="handleUpdate(scope.row)"
  188. v-hasPermi="['pssr:hygiene:edit']"
  189. >修改</el-button>
  190. <el-button
  191. size="mini"
  192. type="text"
  193. icon="el-icon-delete"
  194. @click="handleDelete(scope.row)"
  195. v-hasPermi="['pssr:hygiene:remove']"
  196. >删除</el-button>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. <pagination
  201. v-show="total>0"
  202. :total="total"
  203. :page.sync="queryParams.pageNum"
  204. :limit.sync="queryParams.pageSize"
  205. @pagination="getList"
  206. />
  207. <!-- 添加或修改现场卫生对话框 -->
  208. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
  209. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  210. <!--<el-form-item label="从表id" prop="subId">-->
  211. <!--<el-input v-model="form.subId" placeholder="请输入从表id" />-->
  212. <!--</el-form-item>-->
  213. <!--<el-form-item label="审批id" prop="approveId">-->
  214. <!--<el-input v-model="form.approveId" placeholder="请输入审批id" />-->
  215. <!--</el-form-item>-->
  216. <el-form-item label="检查内容">
  217. <el-input type="textarea" v-model="form.checkContent" :min-height="192"/>
  218. </el-form-item>
  219. <el-form-item label="检查结果" prop="checkResult">
  220. <el-radio-group v-model="form.checkResult">
  221. <el-radio label="✔">✔</el-radio>
  222. <el-radio label="✖">✖</el-radio>
  223. </el-radio-group>
  224. </el-form-item>
  225. <el-form-item label="确认人1" prop="confirm1">
  226. <el-select v-model="form.confirm1" clearable filterable style="width: 100%;"
  227. placeholder="请选择确认人1">
  228. <el-option v-for="user in userOptions"
  229. :label="user.nickName"
  230. :value="user.userId+''"
  231. :key="user.userId"/>
  232. </el-select>
  233. </el-form-item>
  234. <el-form-item label="确认人2" prop="confirm2">
  235. <el-select v-model="form.confirm2" clearable filterable style="width: 100%;"
  236. placeholder="请选择确认人2">
  237. <el-option v-for="user in userOptions"
  238. :label="user.nickName"
  239. :value="user.userId+''"
  240. :key="user.userId"/>
  241. </el-select>
  242. </el-form-item>
  243. <!--<el-form-item label="确认人1" prop="confirm1">-->
  244. <!--<el-input v-model="form.confirm1" placeholder="请输入确认人1" />-->
  245. <!--</el-form-item>-->
  246. <!--<el-form-item label="确认人2" prop="confirm2">-->
  247. <!--<el-input v-model="form.confirm2" placeholder="请输入确认人2" />-->
  248. <!--</el-form-item>-->
  249. <!--<el-form-item label="确认时间" prop="confirmationDate">-->
  250. <!--<el-date-picker clearable size="small" style="width: 200px"-->
  251. <!--v-model="form.confirmationDate"-->
  252. <!--type="date"-->
  253. <!--value-format="yyyy-MM-dd"-->
  254. <!--placeholder="选择确认时间">-->
  255. <!--</el-date-picker>-->
  256. <!--</el-form-item>-->
  257. <!--<el-form-item label="删除状态" prop="delFlag">-->
  258. <!--<el-input v-model="form.delFlag" placeholder="请输入删除状态" />-->
  259. <!--</el-form-item>-->
  260. <!--<el-form-item label="创建人" prop="createrCode">-->
  261. <!--<el-input v-model="form.createrCode" placeholder="请输入创建人" />-->
  262. <!--</el-form-item>-->
  263. <!--<el-form-item label="创建时间" prop="createdate">-->
  264. <!--<el-date-picker clearable size="small" style="width: 200px"-->
  265. <!--v-model="form.createdate"-->
  266. <!--type="date"-->
  267. <!--value-format="yyyy-MM-dd"-->
  268. <!--placeholder="选择创建时间">-->
  269. <!--</el-date-picker>-->
  270. <!--</el-form-item>-->
  271. <!--<el-form-item label="修改人" prop="updaterCode">-->
  272. <!--<el-input v-model="form.updaterCode" placeholder="请输入修改人" />-->
  273. <!--</el-form-item>-->
  274. <!--<el-form-item label="修改时间" prop="updatedate">-->
  275. <!--<el-date-picker clearable size="small" style="width: 200px"-->
  276. <!--v-model="form.updatedate"-->
  277. <!--type="date"-->
  278. <!--value-format="yyyy-MM-dd"-->
  279. <!--placeholder="选择修改时间">-->
  280. <!--</el-date-picker>-->
  281. <!--</el-form-item>-->
  282. <!--<el-form-item label="部门编号" prop="deptId">-->
  283. <!--<el-input v-model="form.deptId" placeholder="请输入部门编号" />-->
  284. <!--</el-form-item>-->
  285. <el-form-item label="备注" prop="remarks">
  286. <el-input v-model="form.remarks" placeholder="请输入备注" />
  287. </el-form-item>
  288. <!--<el-form-item label="归属部门" prop="deptId">-->
  289. <!--<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />-->
  290. <!--</el-form-item>-->
  291. </el-form>
  292. <div slot="footer" class="dialog-footer">
  293. <el-button type="primary" @click="submitForm">确 定</el-button>
  294. <el-button @click="cancel">取 消</el-button>
  295. </div>
  296. </el-dialog>
  297. <!-- 批量修改对话框 -->
  298. <el-dialog :close-on-click-modal="false" title="批量修改" :visible.sync="openBatch" width="500px" append-to-body>
  299. <el-form ref="form" :model="form" label-width="80px">
  300. <el-form-item>
  301. <span>已选择 {{ ids.length }} 条数据</span>
  302. </el-form-item>
  303. <el-form-item label="确认人1" prop="confirm1"
  304. v-if="isApprove==0">
  305. <el-select v-model="form.confirm1" clearable filterable style="width: 100%;"
  306. placeholder="请选择确认人1">
  307. <el-option v-for="user in userOptions"
  308. :label="user.nickName"
  309. :value="user.userId+''"
  310. :key="user.userId"/>
  311. </el-select>
  312. </el-form-item>
  313. <el-form-item label="确认人2" prop="confirm2"
  314. v-if="isApprove==0">
  315. <el-select v-model="form.confirm2" clearable filterable style="width: 100%;"
  316. placeholder="请选择确认人2">
  317. <el-option v-for="user in userOptions"
  318. :label="user.nickName"
  319. :value="user.userId+''"
  320. :key="user.userId"/>
  321. </el-select>
  322. </el-form-item>
  323. <el-form-item label="时间" prop="confirmationDate">
  324. <el-date-picker clearable size="small" style="width: 200px"
  325. v-model="form.confirmationDate"
  326. type="date"
  327. value-format="yyyy-MM-dd"
  328. placeholder="选择时间">
  329. </el-date-picker>
  330. </el-form-item>
  331. <el-form-item label="备注" prop="remarks">
  332. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  333. </el-form-item>
  334. </el-form>
  335. <div slot="footer" class="dialog-footer">
  336. <el-button type="primary" @click="submitFormBatch">确 定</el-button>
  337. <el-button @click="cancelBatch">取 消</el-button>
  338. </div>
  339. </el-dialog>
  340. <!-- 用户导入对话框 -->
  341. <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  342. <el-upload
  343. ref="upload"
  344. :limit="1"
  345. accept=".xlsx, .xls"
  346. :headers="upload.headers"
  347. :action="upload.url"
  348. :disabled="upload.isUploading"
  349. :on-progress="handleFileUploadProgress"
  350. :on-success="handleFileSuccess"
  351. :auto-upload="false"
  352. drag
  353. >
  354. <i class="el-icon-upload"></i>
  355. <div class="el-upload__text">
  356. 将文件拖到此处,或
  357. <em>点击上传</em>
  358. </div>
  359. <div class="el-upload__tip" slot="tip">
  360. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  361. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  362. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  363. <input name="type" :value="upload.type" hidden />
  364. </form>
  365. </div>
  366. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  367. </el-upload>
  368. <div slot="footer" class="dialog-footer">
  369. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  370. <el-button @click="upload.open = false">取 消</el-button>
  371. </div>
  372. </el-dialog>
  373. <!-- 附件对话框 -->
  374. <el-dialog v-dialogDrag :close-on-click-modal="false" :visible.sync="doc.open" append-to-body title="现场照片"
  375. width="1000px">
  376. <el-image v-for="file in doc.fileList" :key="file.id" :src="file.fileUrl" lazy></el-image>
  377. </el-dialog>
  378. <!-- 驳回原因对话框 -->
  379. <el-dialog v-dialogDrag :close-on-click-modal="false" :visible.sync="reason.open" append-to-body title="驳回"
  380. width="1000px">
  381. <el-table :data="items" border>
  382. <el-table-column label="检查内容" align="center" prop="checkContent" :show-overflow-tooltip="true"/>
  383. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true">
  384. <template slot-scope="scope">
  385. <el-input v-model="scope.row.reason" placeholder="请输入驳回原因"/>
  386. </template>
  387. </el-table-column>
  388. </el-table>
  389. <div slot="footer" class="dialog-footer">
  390. <el-button type="primary" @click="submitReasonForm">确 定</el-button>
  391. <el-button @click="reasonCancel">取 消</el-button>
  392. </div>
  393. </el-dialog>
  394. </div>
  395. </template>
  396. <script>
  397. import {
  398. addHygiene,
  399. delHygiene,
  400. exportHygiene,
  401. getHygiene,
  402. handleConfirmHygiene,
  403. handleTurnDownHygiene,
  404. importTemplate,
  405. listHygiene,
  406. updateHygiene,
  407. updateHygieneBatch,
  408. } from "@/api/pssr/hygiene";
  409. import {treeselect} from "@/api/system/dept";
  410. import {getToken} from "@/utils/auth";
  411. import Treeselect from "@riophae/vue-treeselect";
  412. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  413. import {doApprove} from "@/api/pssr/approve";
  414. import {getPssrUser} from "@/api/pssr/aboveall";
  415. import {updateMaterialBatch} from "@/api/pssr/material";
  416. export default {
  417. dicts:['pssr_approve_status'],
  418. name: "Hygiene",
  419. components: { Treeselect },
  420. // components: { Editor },
  421. props: {
  422. subId: {
  423. type: Number,
  424. default: 0
  425. },
  426. isApprove: {
  427. type: Number,
  428. default: 0
  429. },
  430. },
  431. data() {
  432. return {
  433. reason: {
  434. open: false
  435. },
  436. doc: {
  437. file: "",
  438. // 是否显示弹出层(报告附件)
  439. open: false,
  440. fileList: [],
  441. queryParams: {
  442. itemId: null,
  443. subId: this.subId,
  444. forShort: 'xcws'
  445. },
  446. },
  447. userOptions: [],
  448. // 遮罩层
  449. loading: true,
  450. // 选中数组
  451. ids: [],
  452. items: [],
  453. // 非单个禁用
  454. single: true,
  455. // 非多个禁用
  456. multiple: true,
  457. // 显示搜索条件
  458. showSearch: false,
  459. // 总条数
  460. total: 0,
  461. // 现场卫生表格数据
  462. hygieneList: [],
  463. // 弹出层标题
  464. title: "",
  465. // 部门树选项
  466. deptOptions: undefined,
  467. clientHeight:300,
  468. // 是否显示弹出层
  469. open: false,
  470. openBatch: false,
  471. // 用户导入参数
  472. upload: {
  473. //下载模板请求地址
  474. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  475. //下载模板类型
  476. type: 'hygiene',
  477. // 是否显示弹出层(用户导入)
  478. open: false,
  479. // 弹出层标题(用户导入)
  480. title: "",
  481. // 是否禁用上传
  482. isUploading: false,
  483. // 是否更新已经存在的用户数据
  484. updateSupport: 0,
  485. // 设置上传的请求头部
  486. headers: { Authorization: "Bearer " + getToken() },
  487. // 上传的地址
  488. url: process.env.VUE_APP_BASE_API + "/pssr/hygiene/importData?subId=" + this.subId
  489. },
  490. // 查询参数
  491. queryParams: {
  492. pageNum: 1,
  493. pageSize: 20,
  494. subId: this.subId,
  495. approveId: null,
  496. checkContent: null,
  497. checkResult: null,
  498. confirm1: null,
  499. confirm2: null,
  500. confirmationDate: null,
  501. createrCode: null,
  502. createdate: null,
  503. updaterCode: null,
  504. updatedate: null,
  505. deptId: null,
  506. remarks: null
  507. },
  508. // 表单参数
  509. form: {},
  510. // 表单校验
  511. rules: {
  512. confirm1: [{required: true, message: "人员不可为空", trigger: "blur"}],
  513. confirm2: [{required: true, message: "人员不可为空", trigger: "blur"}],
  514. }
  515. };
  516. },
  517. watch: {
  518. // 根据名称筛选部门树
  519. deptName(val) {
  520. this.$refs.tree.filter(val);
  521. }
  522. },
  523. created() {
  524. //设置表格高度对应屏幕高度
  525. this.$nextTick(() => {
  526. this.clientHeight = document.body.clientHeight - 350
  527. })
  528. this.getList();
  529. this.getTreeselect();
  530. getPssrUser({}).then(res => {
  531. this.userOptions = res.data
  532. });
  533. },
  534. methods: {
  535. /** 查询现场卫生列表 */
  536. getList() {
  537. this.loading = true;
  538. listHygiene(this.queryParams).then(response => {
  539. this.hygieneList = response.rows;
  540. this.total = response.total;
  541. this.loading = false;
  542. });
  543. },
  544. /** 查询部门下拉树结构 */
  545. getTreeselect() {
  546. treeselect().then(response => {
  547. this.deptOptions = response.data;
  548. });
  549. },
  550. // 取消按钮
  551. cancel() {
  552. this.open = false;
  553. this.reset();
  554. },
  555. // 表单重置
  556. reset() {
  557. this.form = {
  558. id: null,
  559. subId: this.subId,
  560. approveId: null,
  561. checkContent: null,
  562. checkResult: null,
  563. confirm1: null,
  564. confirm2: null,
  565. confirmationDate: null,
  566. delFlag: null,
  567. createrCode: null,
  568. createdate: null,
  569. updaterCode: null,
  570. updatedate: null,
  571. deptId: null,
  572. remarks: null
  573. };
  574. this.resetForm("form");
  575. },
  576. /** 搜索按钮操作 */
  577. handleQuery() {
  578. this.queryParams.pageNum = 1;
  579. this.getList();
  580. },
  581. /** 重置按钮操作 */
  582. resetQuery() {
  583. this.resetForm("queryForm");
  584. this.handleQuery();
  585. },
  586. // 多选框选中数据
  587. handleSelectionChange(selection) {
  588. this.items=selection;
  589. this.ids = selection.map(item => item.id)
  590. this.single = selection.length!==1
  591. this.multiple = !selection.length
  592. },
  593. /** 新增按钮操作 */
  594. handleAdd() {
  595. this.reset();
  596. this.open = true;
  597. this.title = "添加现场卫生";
  598. },
  599. /** 修改按钮操作 */
  600. handleUpdate(row) {
  601. this.reset();
  602. const id = row.id || this.ids
  603. getHygiene(id).then(response => {
  604. this.form = response.data;
  605. this.open = true;
  606. this.title = "修改现场卫生";
  607. });
  608. },
  609. /** 提交按钮 */
  610. submitForm() {
  611. this.$refs["form"].validate(valid => {
  612. if (valid) {
  613. if (this.form.id != null) {
  614. updateHygiene(this.form).then(response => {
  615. this.msgSuccess("修改成功");
  616. this.open = false;
  617. this.getList();
  618. });
  619. } else {
  620. addHygiene(this.form).then(response => {
  621. this.msgSuccess("新增成功");
  622. this.open = false;
  623. this.getList();
  624. });
  625. }
  626. }
  627. });
  628. },
  629. /** 删除按钮操作 */
  630. handleDelete(row) {
  631. const ids = row.id || this.ids;
  632. this.$confirm('是否确认删除?', "警告", {
  633. confirmButtonText: "确定",
  634. cancelButtonText: "取消",
  635. type: "warning"
  636. }).then(function() {
  637. return delHygiene(ids);
  638. }).then(() => {
  639. this.getList();
  640. this.msgSuccess("删除成功");
  641. })
  642. },
  643. /** 导出按钮操作 */
  644. handleExport() {
  645. const queryParams = this.queryParams;
  646. this.$confirm('是否确认导出所有现场卫生数据项?', "警告", {
  647. confirmButtonText: "确定",
  648. cancelButtonText: "取消",
  649. type: "warning"
  650. }).then(function() {
  651. return exportHygiene(queryParams);
  652. }).then(response => {
  653. this.download(response.msg);
  654. })
  655. },
  656. /** 导入按钮操作 */
  657. handleImport() {
  658. this.upload.title = "用户导入";
  659. this.upload.open = true;
  660. },
  661. /** 下载模板操作 */
  662. importTemplate() {
  663. this.$refs['downloadFileForm'].submit()
  664. },
  665. // 文件上传中处理
  666. handleFileUploadProgress(event, file, fileList) {
  667. this.upload.isUploading = true;
  668. },
  669. // 文件上传成功处理
  670. handleFileSuccess(response, file, fileList) {
  671. this.upload.open = false;
  672. this.upload.isUploading = false;
  673. this.$refs.upload.clearFiles();
  674. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  675. this.getList();
  676. },
  677. // 提交上传文件
  678. submitFileForm() {
  679. this.$refs.upload.submit();
  680. },
  681. /** 确认按钮操作*/
  682. handleApprove() {
  683. doApprove(this.subId).then(res => {
  684. this.msgSuccess("已发起确认流程");
  685. this.getList();
  686. })
  687. },
  688. handleConfirmApprove() {
  689. let data = {
  690. ids: this.ids,
  691. subId: this.subId,
  692. taskType: this.isApprove
  693. }
  694. handleConfirmHygiene(data).then(res => {
  695. this.msgSuccess("确认成功");
  696. this.getList()
  697. this.$emit('refreshHisList');
  698. })
  699. },
  700. handleTurnDown(val) {
  701. this.reason.open=true;
  702. },
  703. userFormat(userId) {
  704. for (let item of this.userOptions) {
  705. if (item.userId == userId) {
  706. return item.nickName
  707. }
  708. }
  709. },
  710. reasonCancel() {
  711. this.reason.open = false;
  712. },
  713. submitReasonForm(){
  714. handleTurnDownHygiene(this.items).then(res => {
  715. this.msgSuccess("驳回成功");
  716. this.reason.open = false;
  717. this.$emit('refreshHisList');
  718. })
  719. },
  720. handleBatch(){
  721. this.reset();
  722. this.openBatch = true
  723. },
  724. // 取消按钮
  725. cancelBatch() {
  726. this.openBatch = false;
  727. this.reset();
  728. },
  729. /** 提交按钮 */
  730. submitFormBatch() {
  731. this.$refs["form"].validate(valid => {
  732. if (valid) {
  733. this.form.ids = this.ids
  734. updateHygieneBatch(this.form).then(response => {
  735. this.msgSuccess("修改成功");
  736. this.open = false;
  737. this.getList();
  738. });
  739. }
  740. });
  741. },
  742. }
  743. };
  744. </script>