index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24">
  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">
  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:book: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. width="160"
  76. prop="type"
  77. >
  78. <template slot-scope="r"
  79. >{{
  80. getLabel(dict.type.safety_book_type, `${r.row.type}`)
  81. }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. label="责任书所属年份"
  86. align="center"
  87. width="120"
  88. prop="year"
  89. />
  90. <el-table-column label="签署人" align="center" prop="userName">
  91. </el-table-column>
  92. <el-table-column label="签署时间" align="center" prop="createTime" />
  93. <el-table-column
  94. label="操作"
  95. width="180"
  96. fixed="right"
  97. align="center"
  98. class-name="small-padding fixed-width"
  99. >
  100. <template slot-scope="scope">
  101. <el-button
  102. size="mini"
  103. type="text"
  104. icon="el-icon-edit-outline"
  105. @click="handleAdd(scope.row.id)"
  106. v-hasPermi="['core:book:add']"
  107. >编辑
  108. </el-button>
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-info"
  113. @click="handleInfo(scope.row)"
  114. v-hasPermi="['core:book:query']"
  115. v-if="false"
  116. >详情
  117. </el-button>
  118. <el-button
  119. size="mini"
  120. type="text"
  121. icon="el-icon-delete"
  122. @click="handleDelete(scope.row)"
  123. v-hasPermi="['core:book:remove']"
  124. >删除
  125. </el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <pagination
  130. v-show="total > 0"
  131. :total="total"
  132. :page.sync="queryParams.pageNum"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="getList"
  135. />
  136. </el-col>
  137. </el-row>
  138. <dialog-edit ref="editDialog" @success="getList()"></dialog-edit>
  139. </div>
  140. </template>
  141. <script>
  142. import {
  143. listSafetyBook,
  144. getSafetyBook,
  145. editOrAdd,
  146. delSafetyBook,
  147. } from "@/api/safetyBook/index";
  148. import { getLabel } from "@/views/commonOption";
  149. import DialogEdit from "./dialog.edit";
  150. import { deptTreeSelect } from "@/api/system/public";
  151. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  152. import OrgTree from "@/components/orgTree/index.vue";
  153. import kOrgTree from "@/components/k-orgTree/index.vue";
  154. import KFileUpload from "@/components/K-FileUpload/index.vue";
  155. import tableList from "@/mixins/tableList";
  156. export default {
  157. dicts: [
  158. "safety_book_type"
  159. ],
  160. name: "safetyBook",
  161. components: { OrgTree, kOrgTree, KFileUpload, DialogEdit },
  162. mixins: [tableList],
  163. data() {
  164. return {
  165. // 遮罩层
  166. loading: true,
  167. // 选中数组
  168. ids: [],
  169. // 非单个禁用
  170. single: true,
  171. // 非多个禁用
  172. multiple: true,
  173. // 显示搜索条件
  174. showSearch: true,
  175. // 总条数
  176. total: 0,
  177. // 安全责任书表格数据
  178. dataList: [],
  179. // 弹出层标题
  180. title: "",
  181. // 是否显示弹出层
  182. open: false,
  183. // 机构树选项
  184. deptOptions: undefined,
  185. // 机构名称
  186. deptName: undefined,
  187. //是否关联下级
  188. checked: false,
  189. timeClearable: true,
  190. defaultProps: {
  191. children: "children",
  192. label: "name",
  193. },
  194. formFileListDefualtValue: [],
  195. // 查询参数
  196. queryParams: {
  197. checkSub: true,
  198. pageNum: 1,
  199. pageSize: 10,
  200. orgId: null,
  201. year: null,
  202. searchOrgId: null,
  203. },
  204. // 表单参数
  205. form: {},
  206. //默认选中节点
  207. defaultKeys: [],
  208. };
  209. },
  210. watch: {
  211. // 根据名称筛选机构树
  212. deptName(val) {
  213. this.$refs.tree.filter(val);
  214. },
  215. },
  216. created() {
  217. this.getDeptTree();
  218. this.getConfigKey("sys.user.initPassword").then((response) => {
  219. this.initPassword = response.msg;
  220. });
  221. this.getList();
  222. },
  223. methods: {
  224. getLabel(options, value) {
  225. return getLabel(options, value);
  226. },
  227. //新增
  228. handleAdd(id) {
  229. this.$refs.editDialog.show(id);
  230. },
  231. /** 查询安全责任书列表 */
  232. getList() {
  233. this.loading = true;
  234. listSafetyBook(this.queryParams).then((response) => {
  235. this.dataList = response.rows;
  236. this.total = response.total;
  237. this.loading = false;
  238. });
  239. },
  240. getDeptTree() {
  241. deptTreeSelect().then((response) => {
  242. this.deptOptions = response.data;
  243. });
  244. },
  245. // 节点单击事件
  246. clickTreeNode(data) {
  247. this.queryParams.orgId = data.id;
  248. this.handleQuery();
  249. },
  250. /** 下穿状态改变*/
  251. changeCheckBox() {
  252. this.getList();
  253. },
  254. getDefaultKey(key) {
  255. this.queryParams.orgId = key;
  256. this.getList();
  257. },
  258. //单选框状态改变
  259. checkChange(state) {
  260. this.queryParams.checkSub = state;
  261. this.handleQuery();
  262. },
  263. // 筛选节点
  264. filterNode(value, data) {
  265. if (!value) return true;
  266. return data.name.indexOf(value) !== -1;
  267. },
  268. // 节点单击事件
  269. handleNodeClick(data) {
  270. this.queryParams.orgId = data.id;
  271. this.handleQuery();
  272. },
  273. /** 搜索按钮操作 */
  274. handleQuery() {
  275. this.queryParams.pageNum = 1;
  276. this.getList();
  277. },
  278. /** 删除按钮操作 */
  279. handleDelete(row) {
  280. const ids = row.id || this.ids;
  281. this.$modal
  282. .confirm("是否确认删除?")
  283. .then(function () {
  284. return delSafetyBook(ids);
  285. })
  286. .then(() => {
  287. this.getList();
  288. this.$modal.msgSuccess("删除成功");
  289. })
  290. .catch(() => {});
  291. },
  292. /** 详情按钮操作 */
  293. handleInfo(row) {
  294. this.reset();
  295. const id = row.id || this.ids;
  296. getSafetyBook(id).then((response) => {
  297. this.form = response.data;
  298. this.open = true;
  299. this.title = "安全责任书详情";
  300. });
  301. },
  302. },
  303. };
  304. </script>
  305. <style>
  306. .ellipsis {
  307. white-space: nowrap;
  308. overflow: hidden;
  309. text-overflow: ellipsis;
  310. }
  311. </style>