index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24" v-if="false">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. wholeTree
  12. ></org-tree>
  13. </el-col>
  14. <!--用户数据-->
  15. <el-col :span="20" :xs="24">
  16. <el-form
  17. :model="queryParams"
  18. ref="queryForm"
  19. size="small"
  20. :inline="true"
  21. v-show="showSearch"
  22. label-width="68px"
  23. >
  24. <el-form-item label="所属年份" prop="year" v-if="false">
  25. <el-date-picker
  26. v-model="queryParams.year"
  27. :clearable="timeClearable"
  28. type="year"
  29. placeholder="选择时间"
  30. value-format="yyyy"
  31. @change="handleQuery"
  32. >
  33. </el-date-picker>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd(null)"
  43. v-hasPermi="['core:aqbwbndjh:add']"
  44. >新增
  45. </el-button>
  46. </el-col>
  47. <right-toolbar
  48. :showSearch.sync="showSearch"
  49. @queryTable="getList"
  50. ></right-toolbar>
  51. </el-row>
  52. <!-- 表格数据 -->
  53. <el-table
  54. border
  55. height="600"
  56. size="small"
  57. v-loading="loading"
  58. :data="dataList"
  59. >
  60. <el-table-column
  61. label="序号"
  62. type="index"
  63. align="center"
  64. width="60"
  65. />
  66. <el-table-column
  67. label="机构名称"
  68. align="left"
  69. width="200"
  70. prop="orgName"
  71. />
  72. <el-table-column
  73. label="记录人"
  74. align="left"
  75. prop="userName"
  76. >
  77. </el-table-column>
  78. <el-table-column
  79. label="记录时间"
  80. align="center"
  81. width="160"
  82. prop="date"
  83. />
  84. <el-table-column
  85. label="操作"
  86. fixed="right"
  87. align="center"
  88. class-name="small-padding fixed-width"
  89. >
  90. <template slot-scope="scope">
  91. <el-button
  92. size="mini"
  93. type="text"
  94. icon="el-icon-edit-outline"
  95. @click="showImages(scope.row.images)"
  96. v-hasPermi="['core:hsggbsdj:query']"
  97. >查看照片
  98. </el-button>
  99. <el-button
  100. size="mini"
  101. type="text"
  102. icon="el-icon-edit-outline"
  103. @click="handleAdd(scope.row.id)"
  104. v-hasPermi="['core:aqbwbndjh:edit']"
  105. >编辑
  106. </el-button>
  107. <!-- <el-button
  108. size="mini"
  109. type="text"
  110. icon="el-icon-info"
  111. @click="handleInfo(scope.row)"
  112. v-hasPermi="['core:aqbwbndjh:query']"
  113. >详情
  114. </el-button> -->
  115. <el-button
  116. size="mini"
  117. type="text"
  118. icon="el-icon-delete"
  119. @click="handleDelete(scope.row)"
  120. v-hasPermi="['core:aqbwbndjh:remove']"
  121. >删除
  122. </el-button>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <pagination
  127. v-show="total > 0"
  128. :total="total"
  129. :page.sync="queryParams.pageNum"
  130. :limit.sync="queryParams.pageSize"
  131. @pagination="getList"
  132. />
  133. </el-col>
  134. </el-row>
  135. <dialog-edit ref="editDialog" @success="getList()"></dialog-edit>
  136. <el-image-viewer
  137. v-if="imageViewer"
  138. :on-close="closeImgViewer"
  139. :url-list="srcList"
  140. />
  141. </div>
  142. </template>
  143. <script>
  144. import {
  145. listaqbwbndjh,
  146. getaqbwbndjh,
  147. Add,
  148. edit,
  149. delaqbwbndjh,
  150. } from "@/api/safetyBook/aqbwbndjh";
  151. import { getLabel } from "@/views/commonOption";
  152. import DialogEdit from "./dialog.edit";
  153. import { deptTreeSelect } from "@/api/system/public";
  154. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  155. import OrgTree from "@/components/orgTree/index.vue";
  156. import kOrgTree from "@/components/k-orgTree/index.vue";
  157. import KFileUpload from "@/components/K-FileUpload/index.vue";
  158. import tableList from "@/mixins/tableList";
  159. export default {
  160. name: "aqbwbndjh",
  161. components: { OrgTree, kOrgTree, KFileUpload, DialogEdit, "el-image-viewer": () =>
  162. import("element-ui/packages/image/src/image-viewer"), },
  163. mixins: [tableList],
  164. data() {
  165. return {
  166. // 遮罩层
  167. loading: true,
  168. // 选中数组
  169. ids: [],
  170. // 非单个禁用
  171. single: true,
  172. // 非多个禁用
  173. multiple: true,
  174. // 显示搜索条件
  175. showSearch: true,
  176. // 总条数
  177. total: 0,
  178. // 安全责任书表格数据
  179. dataList: [],
  180. // 弹出层标题
  181. title: "",
  182. // 是否显示弹出层
  183. open: false,
  184. // 机构树选项
  185. deptOptions: undefined,
  186. // 机构名称
  187. deptName: undefined,
  188. //是否关联下级
  189. checked: false,
  190. timeClearable: true,
  191. defaultProps: {
  192. children: "children",
  193. label: "name",
  194. },
  195. formFileListDefualtValue: [],
  196. // 查询参数
  197. queryParams: {
  198. checkSub: true,
  199. pageNum: 1,
  200. pageSize: 10,
  201. orgId: null,
  202. year: null,
  203. searchOrgId: null,
  204. },
  205. // 表单参数
  206. form: {},
  207. imageViewer: false,
  208. srcList: [],
  209. //默认选中节点
  210. defaultKeys: [],
  211. };
  212. },
  213. watch: {
  214. // 根据名称筛选机构树
  215. deptName(val) {
  216. this.$refs.tree.filter(val);
  217. },
  218. },
  219. created() {
  220. this.getDeptTree();
  221. this.getConfigKey("sys.user.initPassword").then((response) => {
  222. this.initPassword = response.msg;
  223. });
  224. this.getList();
  225. },
  226. methods: {
  227. showImages(file) {
  228. let array = file.split(",");
  229. this.srcList = array;
  230. this.imageViewer = true;
  231. },
  232. closeImgViewer() {
  233. this.imageViewer = false;
  234. this.srcList = [];
  235. },
  236. getLabel(options, value) {
  237. return getLabel(options, value);
  238. },
  239. //新增
  240. handleAdd(id) {
  241. this.$refs.editDialog.show(id);
  242. },
  243. /** 查询安全责任书列表 */
  244. getList() {
  245. this.loading = true;
  246. listaqbwbndjh(this.queryParams).then((response) => {
  247. this.dataList = response.rows;
  248. this.total = response.total;
  249. this.loading = false;
  250. });
  251. },
  252. getDeptTree() {
  253. deptTreeSelect().then((response) => {
  254. this.deptOptions = response.data;
  255. });
  256. },
  257. // 节点单击事件
  258. clickTreeNode(data) {
  259. this.queryParams.orgId = data.id;
  260. this.handleQuery();
  261. },
  262. /** 下穿状态改变*/
  263. changeCheckBox() {
  264. this.getList();
  265. },
  266. getDefaultKey(key) {
  267. this.queryParams.orgId = key;
  268. this.getList();
  269. },
  270. //单选框状态改变
  271. checkChange(state) {
  272. this.queryParams.checkSub = state;
  273. this.handleQuery();
  274. },
  275. // 筛选节点
  276. filterNode(value, data) {
  277. if (!value) return true;
  278. return data.name.indexOf(value) !== -1;
  279. },
  280. // 节点单击事件
  281. handleNodeClick(data) {
  282. this.queryParams.orgId = data.id;
  283. this.handleQuery();
  284. },
  285. /** 搜索按钮操作 */
  286. handleQuery() {
  287. this.queryParams.pageNum = 1;
  288. this.getList();
  289. },
  290. /** 删除按钮操作 */
  291. handleDelete(row) {
  292. const ids = row.id || this.ids;
  293. this.$modal
  294. .confirm("是否确认删除?")
  295. .then(function () {
  296. return delaqbwbndjh(ids);
  297. })
  298. .then(() => {
  299. this.getList();
  300. this.$modal.msgSuccess("删除成功");
  301. })
  302. .catch(() => {});
  303. },
  304. /** 详情按钮操作 */
  305. handleInfo(row) {
  306. this.reset();
  307. const id = row.id || this.ids;
  308. getaqbwbndjh(id).then((response) => {
  309. this.form = response.data;
  310. this.open = true;
  311. this.title = "安全责任书详情";
  312. });
  313. },
  314. },
  315. };
  316. </script>
  317. <style>
  318. .ellipsis {
  319. white-space: nowrap;
  320. overflow: hidden;
  321. text-overflow: ellipsis;
  322. }
  323. </style>