dialog.edit.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div class="rule-type">
  3. <DialogCom
  4. :title="id ? '编辑' : '新增'"
  5. :visible.sync="isShow"
  6. width="800px"
  7. >
  8. <div class="page-body">
  9. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  10. <el-row>
  11. <el-col :span="12">
  12. <el-form-item
  13. v-if="this.pId != -1"
  14. label="上级机构"
  15. prop="parentId"
  16. >
  17. <treeselect
  18. v-model="form.parentId"
  19. :options="deptOptions"
  20. :normalizer="normalizer"
  21. placeholder="选择上级机构"
  22. noResultsText="暂无符合条件的数据"
  23. noOptionsText="无数据"
  24. />
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="12">
  28. <el-form-item label="机构名称" prop="name">
  29. <el-input v-model="form.name" placeholder="请输入机构名称" maxlength="5" />
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <el-row>
  34. <el-col :span="12">
  35. <el-form-item label="机构简称" prop="shortName">
  36. <el-input
  37. v-model="form.shortName"
  38. placeholder="请输入机构简称"
  39. maxlength="20"
  40. />
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="12">
  44. <el-form-item label="部门机构电话" prop="managerPhone">
  45. <el-input
  46. v-model="form.managerPhone"
  47. placeholder="请输入联系电话"
  48. maxlength="16"
  49. />
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="12">
  55. <el-form-item label="部门机构地址" prop="address">
  56. <el-input
  57. v-model="form.address"
  58. placeholder="请输入地址"
  59. maxlength="50"
  60. />
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="12">
  64. <el-form-item label="排序号" prop="sort">
  65. <el-input-number
  66. v-model="form.sort"
  67. controls-position="right"
  68. :min="0"
  69. />
  70. </el-form-item>
  71. </el-col>
  72. </el-row>
  73. <el-row>
  74. <el-col :span="12">
  75. <el-form-item label="机构类型" prop="type">
  76. <el-select
  77. prop="type"
  78. label="机构类型"
  79. v-model="form.type"
  80. placeholder="请选择机构类型"
  81. clearable
  82. >
  83. <el-option
  84. v-for="dict in dict.type.sys_org_type"
  85. :key="dict.value"
  86. :label="dict.label"
  87. :value="dict.value"
  88. />
  89. </el-select>
  90. </el-form-item>
  91. </el-col>
  92. </el-row>
  93. <el-row>
  94. <el-col :span="12">
  95. <el-form-item label="是否可用" prop="isLock">
  96. <el-switch
  97. v-model="form.isLock"
  98. :active-value="0"
  99. :inactive-value="1"
  100. >
  101. </el-switch>
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="12">
  105. <el-form-item
  106. label="加钞间出入口远程控制"
  107. prop="cashAddingRoomRemoteControl"
  108. >
  109. <el-switch
  110. v-model="form.cashAddingRoomRemoteControl"
  111. :active-value="1"
  112. :inactive-value="0"
  113. >
  114. </el-switch>
  115. </el-form-item>
  116. </el-col>
  117. </el-row>
  118. <el-row>
  119. <el-col :span="12">
  120. <el-form-item
  121. label="离行式大堂设备"
  122. prop="detachedLobbyEquipment"
  123. >
  124. <el-input-number
  125. v-model="form.detachedLobbyEquipment"
  126. controls-position="right"
  127. :min="0"
  128. />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="12">
  132. <el-form-item
  133. label="离行式穿墙设备"
  134. prop="detachedWallPenetratingEquipment"
  135. >
  136. <el-input-number
  137. v-model="form.detachedWallPenetratingEquipment"
  138. controls-position="right"
  139. :min="0"
  140. />
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. </el-form>
  145. <el-button @click="handleOrgAdd">新增物防建设</el-button>
  146. <el-table
  147. border
  148. size="small"
  149. v-loading="orgloading"
  150. :data="constructionList"
  151. @selection-change="handleOrgSelectionChange"
  152. >
  153. <el-table-column type="selection" width="55" align="center" />
  154. <el-table-column v-if="false" label="序号" align="center" prop="id" />
  155. <el-table-column label="标准" align="center" prop="standard" />
  156. <el-table-column
  157. label="达标日期"
  158. align="center"
  159. prop="dateOfCompliance"
  160. width="180"
  161. >
  162. <template slot-scope="scope">
  163. <span>{{ formatTime(scope.row.dateOfCompliance,"YYYY-MM-DD") }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. v-if="false"
  168. label="机构id"
  169. align="center"
  170. prop="orgId"
  171. />
  172. <el-table-column
  173. label="操作"
  174. align="center"
  175. class-name="small-padding fixed-width"
  176. >
  177. <template slot-scope="scope">
  178. <el-button
  179. size="mini"
  180. type="text"
  181. icon="el-icon-edit-outline"
  182. @click="handleOrgUpdate(scope.row)"
  183. v-hasPermi="['system:construction:edit']"
  184. >查看证书</el-button
  185. >
  186. <el-button
  187. size="mini"
  188. type="text"
  189. icon="el-icon-edit-outline"
  190. @click="handleOrgUpdate(scope.row)"
  191. v-hasPermi="['system:construction:edit']"
  192. >修改</el-button
  193. >
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-delete"
  198. @click="handleOrgDelete(scope.$index)"
  199. v-hasPermi="['system:construction:remove']"
  200. >删除</el-button
  201. >
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. </div>
  206. <div slot="footer" class="dialog-footer">
  207. <el-button @click="onHide">取消</el-button>
  208. <el-button type="primary" @click="onSubmit">确定</el-button>
  209. </div>
  210. </DialogCom>
  211. <DialogCom
  212. :title="orgtitle"
  213. :visible.sync="orgopen"
  214. width="500px"
  215. append-to-body
  216. >
  217. <el-form
  218. ref="orgform"
  219. :model="orgform"
  220. label-width="80px"
  221. :rules="rules2"
  222. >
  223. <el-form-item label="标准" prop="standard">
  224. <el-input v-model="orgform.standard" placeholder="请输入标准" />
  225. </el-form-item>
  226. <el-form-item label="达标日期" prop="dateOfCompliance">
  227. <el-date-picker
  228. clearable
  229. v-model="orgform.dateOfCompliance"
  230. type="date"
  231. value-format="yyyy-MM-dd HH:mm:ss"
  232. placeholder="请选择达标日期"
  233. >
  234. </el-date-picker>
  235. </el-form-item>
  236. <el-form-item label="证书佐证" prop="certificateEvidence">
  237. <el-switch
  238. v-model="orgform.certificateEvidence"
  239. active-text
  240. :active-value="1"
  241. :inactive-value="0"
  242. ></el-switch>
  243. </el-form-item>
  244. <el-form-item
  245. v-if="orgform.certificateEvidence"
  246. label="证书"
  247. prop="certificate"
  248. >
  249. <el-input
  250. v-if="false"
  251. v-model="orgform.certificate"
  252. placeholder="请输入证书"
  253. />
  254. <div class="image-container" style="margin-left: 20px">
  255. <p style="font-size: 12px; color: #999">上传证书</p>
  256. <image-upload :limit="1" :fileSize="2"></image-upload>
  257. </div>
  258. </el-form-item>
  259. <el-form-item v-if="false" label="佐证" prop="evidence">
  260. <el-input v-model="orgform.evidence" placeholder="请输入佐证" />
  261. </el-form-item>
  262. <el-form-item v-if="false" label="机构id" prop="orgId">
  263. <el-input v-model="orgform.orgId" placeholder="请输入机构id" />
  264. </el-form-item>
  265. </el-form>
  266. <div slot="footer" class="dialog-footer">
  267. <el-button type="primary" @click="submitOrgForm">确 定</el-button>
  268. <el-button @click="orgcancel">取 消</el-button>
  269. </div>
  270. </DialogCom>
  271. </div>
  272. </template>
  273. <script>
  274. import Treeselect from "@riophae/vue-treeselect";
  275. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  276. import {
  277. listOrgPhysicalDefenseConstruction,
  278. getOrgPhysicalDefenseConstruction,
  279. addOrgPhysicalDefenseConstruction,
  280. updateOrgPhysicalDefenseConstruction,
  281. delOrgPhysicalDefenseConstruction,
  282. } from "@/api/system/OrgPhysicalDefenseConstruction";
  283. import { deptTreeSelect } from "@/api/system/public";
  284. import {
  285. listExtend,
  286. getExtend,
  287. addExtend,
  288. updateExtend,
  289. delExtend,
  290. getExtendByOrgId,
  291. uploadFile,
  292. addOrUpdate,
  293. } from "@/api/system/extend";
  294. export default {
  295. dicts: ["sys_normal_disable", "sys_org_type"],
  296. data() {
  297. return {
  298. tempRow: null,
  299. // 查询参数
  300. queryParams: {
  301. pageNum: 1,
  302. pageSize: 10,
  303. name: "",
  304. status: undefined,
  305. parentId: undefined,
  306. },
  307. // 机构树选项
  308. deptOptions: [],
  309. pId: 0,
  310. orgid: "",
  311. // 表单参数
  312. orgform: {},
  313. //默认选中节点
  314. defaultKeys: [],
  315. //表单验证
  316. rules2: {
  317. standard: [{ required: true, message: "请输入标准", trigger: "blur" }],
  318. dateOfCompliance: [
  319. { required: true, message: "请输入达标日期", trigger: "blur" },
  320. ],
  321. },
  322. rules: {
  323. parentId: [
  324. { required: true, message: "上级机构不能为空", trigger: "blur" },
  325. ],
  326. sort: [{ required: true, message: "排序号不能为空", trigger: "blur" }],
  327. type: [
  328. { required: true, message: "机构类型不能为空", trigger: "blur" },
  329. ],
  330. isLock: [{ required: true, message: "状态不能为空", trigger: "blur" }],
  331. name: [
  332. { required: true, message: "机构名称不能为空", trigger: "blur" },
  333. ],
  334. // managerPhone: [
  335. // {
  336. // pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  337. // message: "请输入正确的手机号码",
  338. // trigger: "blur",
  339. // },
  340. // ],
  341. },
  342. orgopen: false,
  343. orgtitle: "",
  344. form: {},
  345. constructionList: [],
  346. tableData: [],
  347. id: null,
  348. isShow: false,
  349. orgloading: false,
  350. };
  351. },
  352. watch: {},
  353. computed: {},
  354. created() {
  355. this.getDeptTree();
  356. },
  357. methods: {
  358. getOrgPhysicalDefenseConstructionInfo() {
  359. this.orgloading = true;
  360. let dat = { orgId: this.id, type: 4 };
  361. // console.log(dat,2222222222)
  362. listOrgPhysicalDefenseConstruction(dat).then((data) => {
  363. // console.log("机构信息获取成功");
  364. this.constructionList = data.rows;
  365. this.orgloading = false;
  366. });
  367. },
  368. // 多选框选中数据
  369. handleOrgSelectionChange(selection) {
  370. this.orgids = selection.map((item) => item.id);
  371. this.single = selection.length !== 1;
  372. this.multiple = !selection.length;
  373. },
  374. // 取消按钮
  375. orgcancel() {
  376. this.orgopen = false;
  377. this.orgreset();
  378. this.tempRow = "";
  379. },
  380. /** 提交按钮 */
  381. submitOrgForm() {
  382. this.$refs.orgform.validate((valid) => {
  383. if (valid) {
  384. // 表单验证通过,提交数据或执行其他操作
  385. let dat = {
  386. standard: this.orgform.standard,
  387. dateOfCompliance: this.orgform.dateOfCompliance,
  388. certificateEvidence: this.orgform.certificateEvidence,
  389. certificate: this.orgform.certificate,
  390. evidence: this.orgform.evidence,
  391. };
  392. this.constructionList.splice(this.tempRow, 1);
  393. this.constructionList.push(dat);
  394. this.orgopen = false;
  395. } else {
  396. // 表单验证未通过,显示错误信息
  397. }
  398. });
  399. // this.orgform.orgId = this.orgid;
  400. // this.$refs["orgform"].validate((valid) => {
  401. // if (valid) {
  402. // this.orgform.type = 4;
  403. // if (this.orgform.id != null) {
  404. // updateOrgPhysicalDefenseConstruction(this.orgform).then(
  405. // (response) => {
  406. // this.$modal.msgSuccess("修改成功");
  407. // this.orgopen = false;
  408. // this.getOrgPhysicalDefenseConstructionInfo();
  409. // }
  410. // );
  411. // } else {
  412. // addOrgPhysicalDefenseConstruction(this.orgform).then((response) => {
  413. // this.$modal.msgSuccess("新增成功");
  414. // this.orgopen = false;
  415. // this.getOrgPhysicalDefenseConstructionInfo();
  416. // });
  417. // }
  418. // }
  419. // });
  420. },
  421. /** 删除按钮操作 */
  422. handleOrgDelete(row) {
  423. this.constructionList.splice(row, 1);
  424. // this.$modal
  425. // .confirm('是否确认删除机构物防建设编号为"' + orgids + '"的数据项?')
  426. // .then(function () {
  427. // return delOrgPhysicalDefenseConstruction(orgids);
  428. // })
  429. // .then(() => {
  430. // this.getOrgPhysicalDefenseConstructionInfo();
  431. // this.$modal.msgSuccess("删除成功");
  432. // })
  433. // .catch(() => {});
  434. },
  435. /** 修改按钮操作 */
  436. handleOrgUpdate(row) {
  437. this.orgreset();
  438. this.tempRow = row;
  439. this.orgform = row;
  440. this.orgopen = true;
  441. this.orgtitle = "修改机构物防建设";
  442. // const id = row.id || this.orgids;
  443. // getOrgPhysicalDefenseConstruction(id).then((response) => {
  444. // // console.log(response)
  445. // this.orgform = response.data;
  446. // this.orgopen = true;
  447. // this.orgtitle = "修改机构物防建设";
  448. // });
  449. },
  450. /** 新增按钮操作 */
  451. handleOrgAdd() {
  452. this.orgreset();
  453. this.orgopen = true;
  454. this.orgtitle = "添加机构物防建设";
  455. },
  456. // 表单重置
  457. orgreset() {
  458. this.orgform = {
  459. id: null,
  460. standard: null,
  461. dateOfCompliance: null,
  462. certificateEvidence: null,
  463. certificate: null,
  464. evidence: null,
  465. createTime: null,
  466. updateTime: null,
  467. createBy: null,
  468. updateBy: null,
  469. orgId: null,
  470. };
  471. this.resetForm("orgform");
  472. },
  473. /** 转换机构数据结构 */
  474. normalizer(node) {
  475. if (node.children && !node.children.length) {
  476. delete node.children;
  477. }
  478. return {
  479. id: node.id,
  480. label: node.name,
  481. children: node.children,
  482. };
  483. },
  484. /** 查询机构下拉树结构 */
  485. getDeptTree() {
  486. deptTreeSelect().then((response) => {
  487. this.deptOptions = response.data;
  488. this.defaultKeys.push(response.data[0].id);
  489. this.queryParams.parentId = response.data[0].id;
  490. // this.handleQuery();
  491. });
  492. },
  493. async show(row) {
  494. this.form = {};
  495. this.id = 0;
  496. this.constructionList = [];
  497. if (row != 0) {
  498. // console.log(row,111111111111)
  499. this.orgid = row.orgid;
  500. this.form = row;
  501. // this.form.isLock2=row.isLock;
  502. this.id = row.id;
  503. if (row.id != null) {
  504. getExtendByOrgId(row.id).then((data) => {
  505. console.log(data.data);
  506. if (data.data != null) {
  507. (this.form.orgExtendId = data.data.id),
  508. (this.form.cashAddingRoomRemoteControl =
  509. data.data.cashAddingRoomRemoteControl);
  510. this.form.detachedLobbyEquipment =
  511. data.data.detachedLobbyEquipment;
  512. this.form.detachedWallPenetratingEquipment =
  513. data.data.detachedWallPenetratingEquipment;
  514. }
  515. });
  516. this.getOrgPhysicalDefenseConstructionInfo();
  517. }
  518. }
  519. this.isShow = true;
  520. },
  521. // 事件
  522. onHide() {
  523. this.$emit("success")
  524. this.isShow = false;
  525. },
  526. onSubmit() {
  527. this.$refs.form.validate((valid) => {
  528. if (valid) {
  529. // 表单验证通过,提交数据或执行其他操作
  530. this.form.isLock = this.form.isLock ? 1 : 0;
  531. this.form.cashAddingRoomRemoteControl = this.form
  532. .cashAddingRoomRemoteControl
  533. ? 1
  534. : 0;
  535. this.form.constructionList = this.constructionList;
  536. // console.log(this.form);
  537. addOrUpdate(this.form).then((data) => {
  538. this.$modal.msgSuccess("成功");
  539. this.$emit("success")
  540. this.onHide();
  541. });
  542. } else {
  543. // 表单验证未通过,显示错误信息
  544. }
  545. });
  546. // this.$refs.form.validate(async (isValidate) => {
  547. // // this.$emit("success");
  548. // });
  549. },
  550. // 事件
  551. //apimark//
  552. },
  553. mounted() {},
  554. components: { Treeselect },
  555. };
  556. </script>
  557. <style lang="scss" scoped>
  558. .brand_info {
  559. .el-form {
  560. width: 600px;
  561. padding-top: 40px;
  562. }
  563. }
  564. </style>