extend.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. <template>
  2. <div class="app-container">
  3. <h3 class="title">编辑管理人员信息</h3>
  4. <div class="info-box">
  5. <el-descriptions>
  6. <el-descriptions-item v-for="v in dataInfo" :label="v.label" :key="v.key">{{ v.value }}</el-descriptions-item>
  7. <el-descriptions-item label="角色">{{ roleName }}</el-descriptions-item>
  8. <el-descriptions-item label="性别">{{ sex }}</el-descriptions-item>
  9. <el-descriptions-item label="状态">{{ status }}</el-descriptions-item>
  10. </el-descriptions>
  11. </div>
  12. <div class="info-box">
  13. <el-form inline :model="formData" :rules="rules" ref="form" label-position="left" label-width="120px">
  14. <el-row>
  15. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  16. <el-form-item label="是否专职" prop="isFullTime">
  17. <el-switch v-model="formData.isFullTime" active-value="1" inactive-value="0"></el-switch>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  21. <el-form-item label="持证上岗通过情况" prop="certificateWork" label-width="180">
  22. <el-switch v-model="formData.certificateWork" active-value="1" inactive-value="0"></el-switch>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  26. <el-form-item label="持证上岗未通过原因" v-if="formData.certificateWork == 0" label-width="180"
  27. prop="certificateFailReason">
  28. <el-select style="width: 190px;" v-model="formData.certificateFailReason" placeholder="请选择持证上岗未通过原因">
  29. <el-option v-for="dict in dict.type.post_no_pass" :key="dict.value" :label="dict.label"
  30. :value="dict.value" />
  31. </el-select>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <el-row>
  36. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  37. <el-form-item label="所属部门" prop="deptId">
  38. <el-select style="width: 217px;" v-model="formData.deptId" placeholder="请选择所属部门">
  39. <el-option v-for="dict in dict.type.department_name" :key="dict.value" :label="dict.label"
  40. :value="dict.value" />
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  45. <el-form-item label="现任职务" prop="duties">
  46. <el-select style="width: 217px;" v-model="formData.duties" placeholder="请选择现任职务">
  47. <el-option v-for="dict in dict.type.current_position" :key="dict.value" :label="dict.label"
  48. :value="dict.value" />
  49. </el-select>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  53. <el-form-item label="最高学历" prop="highestEducation">
  54. <el-select style="width: 217px;" v-model="formData.highestEducation" placeholder="请选择最高学历">
  55. <el-option v-for="dict in dict.type.sys_highest_education" :key="dict.value" :label="dict.label"
  56. :value="dict.value" />
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <el-row>
  62. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  63. <el-form-item label="用工形式" prop="workType">
  64. <el-select style="width: 217px;" v-model="formData.workType" placeholder="请选择用工形式">
  65. <el-option v-for="dict in dict.type.sys_work_type" :key="dict.value" :label="dict.label"
  66. :value="dict.value" />
  67. </el-select>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  71. <el-form-item label="学历取得方式" prop="educationType">
  72. <el-select style="width: 217px;" v-model="formData.educationType" placeholder="请选择学历取得方式">
  73. <el-option v-for="dict in dict.type.sys_education_type" :key="dict.value" :label="dict.label"
  74. :value="dict.value" />
  75. </el-select>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :xs="24" :sm="12" :md="8" :lg="8">
  79. <el-form-item label="初级以上相关专业技术职业资格" label-width="240" prop="professionalQualifications">
  80. <el-input style="width: 240px;" maxlength="50" v-model="formData.professionalQualifications"
  81. placeholder="请输入初级以上相关专业技术职业资格">
  82. </el-input>
  83. </el-form-item>
  84. </el-col>
  85. </el-row>
  86. <el-row>
  87. <!-- <el-col :xs="24" :sm="12" :md="8" :lg="6">
  88. <el-form-item label="持证上岗未通过原因" v-if="formData.certificateWork==0" label-width="180" prop="certificateFailReason">
  89. <el-select style="width: 190px;" v-model="formData.certificateFailReason" placeholder="请选择持证上岗未通过原因">
  90. <el-option v-for="dict in dict.type.post_no_pass" :key="dict.value" :label="dict.label"
  91. :value="dict.value" />
  92. </el-select>
  93. </el-form-item>
  94. </el-col> -->
  95. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  96. <el-form-item label="参加工作时间" prop="workTime">
  97. <el-date-picker style="width: 217px;" v-model="formData.workTime" :picker-options="endDatepickerOptions"
  98. align="right" type="date" placeholder="请选择参加工作时间">
  99. </el-date-picker>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  103. <el-form-item prop="bornTime" label="出生日期">
  104. <el-date-picker v-model="formData.bornTime" @change="startDateChanged"
  105. :picker-options="startDatepickerOptions" align="right" type="date" placeholder="选择出生日期">
  106. </el-date-picker>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  110. <el-form-item prop="entryTime" label="现任职时间">
  111. <el-date-picker v-model="formData.entryTime" :picker-options="endDatepickerOptions" align="right"
  112. type="date" placeholder="选择现任职时间">
  113. </el-date-picker>
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. <el-row>
  118. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  119. <el-form-item label="分管领导姓名" prop="responsibilitiesLeaderName">
  120. <el-input maxlength="50" style="width: 217px;" v-model="formData.responsibilitiesLeaderName"
  121. placeholder="请输入分管领导姓名">
  122. </el-input>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :xs="24" :sm="12" :md="8" :lg="6">
  126. <el-form-item label="分管领导职务" prop="responsibilitiesLeaderDuties">
  127. <el-select style="width: 217px;" v-model="formData.responsibilitiesLeaderDuties" placeholder="请选择分管领导职务">
  128. <el-option v-for="dict in dict.type.sys_duties" :key="dict.value" :label="dict.label"
  129. :value="dict.value" />
  130. </el-select>
  131. </el-form-item>
  132. </el-col>
  133. </el-row>
  134. <el-row>
  135. <el-col :xs="24" :sm="24" :md="24" :lg="24">
  136. <el-form-item label="上传相关证书">
  137. <imgs-upload :limit="5" v-model="formData.qualificationCertificateUrl" :fileSize="2"></imgs-upload>
  138. </el-form-item>
  139. </el-col>
  140. <!--<el-col :xs="24" :sm="12" :md="8" :lg="6">
  141. <el-form-item label="示例图">
  142. <div style="width: 280px;">
  143. <el-image :src="uplp"></el-image>
  144. </div>
  145. </el-form-item>
  146. </el-col>-->
  147. </el-row>
  148. </el-form>
  149. </div>
  150. <div style="margin-top: 30px; margin-left: 42%">
  151. <el-button type="primary" @click="saveExtend" v-hasPermi="['system:information:edit']" size="small">提交</el-button>
  152. <el-button type="primary" @click="nosaveExtend" size="small">取消</el-button>
  153. </div>
  154. </div>
  155. </template>
  156. <script>
  157. import uploadpng from "@/assets/images/upload.png";
  158. import uplpng from "@/assets/images/upl.png";
  159. import { getUser } from "@/api/system/user";
  160. import TreeSelect from '@riophae/vue-treeselect'
  161. import ImgsUpload from "@/components/ImgsUpload";
  162. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  163. import { deptTreeList } from "@/api/system/public";
  164. import { extendUserInformation } from "@/api/system/information";
  165. export default {
  166. props: [],
  167. components: { TreeSelect ,ImgsUpload},
  168. dicts: ['sys_highest_education', "sys_work_type", "sys_duties", "sys_education_type", 'sys_department_type', 'post_no_pass', 'current_position'],
  169. data() {
  170. return {
  171. startDatepickerOptions: {
  172. disabledDate(time) {
  173. const date = new Date();
  174. date.setTime(date.getTime() - 3600 * 1000 * 24);
  175. return time.getTime() >= date;
  176. },
  177. },
  178. endDatepickerOptions: {
  179. disabledDate: this.disabledDate,
  180. },
  181. //基础信息key
  182. infoKeys: [
  183. { label: '用户名称', key: 'username' },
  184. { label: '用户昵称', key: 'name' },
  185. { label: '工号', key: 'jobNumber' },
  186. // {label:'部门',key:'orgName'},
  187. { label: '手机', key: 'phone' },
  188. // {label:'性别',key:'gender'},
  189. // {label:'状态',key:'isLock'},
  190. { label: '机构', key: 'orgName' },
  191. ],
  192. dataInfo: [],
  193. formData: {
  194. deptId: null,
  195. duties: null,
  196. workType: null,
  197. isFullTime: "1",
  198. highestEducation: null,
  199. educationType: null,
  200. certificateWork: "1",
  201. professionalQualifications: null,
  202. certificateFailReason: null,
  203. workTime: null,
  204. entryTime: null,
  205. bornTime: null,
  206. responsibilitiesLeaderName: null,
  207. responsibilitiesLeaderDuties: null,
  208. qualificationCertificateUrl: null,
  209. userId: null,
  210. },
  211. rules: {
  212. deptId: [
  213. { required: true, message: '请选择所属部门', trigger: 'blur' },
  214. ],
  215. duties: [
  216. { required: true, message: '请选择职务', trigger: 'blur' },
  217. ],
  218. workType: [
  219. { required: true, message: '请选择用工形式', trigger: 'blur' },
  220. ],
  221. isFullTime: [
  222. { required: true, message: '请选择是否专职', trigger: 'blur' },
  223. ],
  224. highestEducation: [
  225. { required: true, message: '请选择最高学历', trigger: 'blur' },
  226. ],
  227. educationType: [
  228. { required: true, message: '请选择学历取得形式', trigger: 'blur' },
  229. ],
  230. certificateWork: [
  231. { required: true, message: '请选择是否持证上岗', trigger: 'blur' },
  232. ],
  233. workTime: [
  234. { required: true, message: '请选择参加工作时间', trigger: 'blur' },
  235. ],
  236. entryTime: [
  237. { required: true, message: '请选择入职时间', trigger: 'change' }
  238. ],
  239. bornTime: [
  240. { required: true, message: '请选择出生时间', trigger: 'change' }
  241. ],
  242. responsibilitiesLeaderName: [
  243. { required: true, message: '请输入分管领导名字', trigger: 'change' }
  244. ],
  245. responsibilitiesLeaderDuties: [
  246. { required: true, message: '请选择分管领导职务', trigger: 'change' }
  247. ],
  248. qualificationCertificateUrl: [
  249. { required: true, message: '请选择上传资格证', trigger: 'change' }
  250. ],
  251. professionalQualifications: [
  252. { required: true, message: '请输入初级以上相关专业技术职业资格', trigger: 'change' }
  253. ],
  254. certificateFailReason: [
  255. { required: true, message: '请输入持证上岗未通过原因', trigger: 'change' }
  256. ],
  257. date2: [
  258. { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
  259. ],
  260. type: [
  261. { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
  262. ],
  263. resource: [
  264. { required: true, message: '请选择活动资源', trigger: 'change' }
  265. ],
  266. desc: [
  267. { required: true, message: '请填写活动形式', trigger: 'blur' }
  268. ]
  269. },
  270. // 机构树选项
  271. deptList: undefined,
  272. // 遮罩层
  273. orgloading: true,
  274. // 选中数组
  275. orgids: [],
  276. // 选中数组
  277. Bankids: [],
  278. // 非单个禁用
  279. single: true,
  280. // 非多个禁用
  281. multiple: true,
  282. // 显示搜索条件
  283. showSearch: true,
  284. // 总条数
  285. total: 0,
  286. // 机构物防建设表格数据
  287. constructionList: [],
  288. // 银行物防建设表格数据
  289. BankPhysicalDefenseConstructionList: [],
  290. // 弹出层标题
  291. orgtitle: "",
  292. // 弹出层标题
  293. Banktitle: "",
  294. // 是否显示弹出层
  295. Bankopen: false,
  296. // 表单参数
  297. Bankform: {},
  298. // 是否显示弹出层
  299. orgopen: false,
  300. roleName: null,
  301. sex: null,
  302. status: null,
  303. // 表单参数
  304. orgform: {},
  305. //2个图片信息
  306. uploadp: uploadpng,
  307. uplp: uplpng,
  308. //下拉框生成信息
  309. orgTypes: {
  310. orgTyp1: { label: "营业网点", value: 0 },
  311. orgTyp2: { label: "监控中心", value: 1 },
  312. },
  313. businessLibraryTypes: {
  314. businessLibraryTyp1: { label: "1类业务库", value: 1 },
  315. businessLibraryTyp2: { label: "2类业务库", value: 2 },
  316. businessLibraryTyp3: { label: "3类业务库", value: 3 },
  317. },
  318. platformBrands: {
  319. platformBrand1: { label: "品牌1", value: 0 },
  320. platformBrand2: { label: "品牌2", value: 1 },
  321. },
  322. platformSupplierBrands: {
  323. platformSupplierBrand1: { label: "品牌1", value: 0 },
  324. platformSupplierBrand2: { label: "品牌2", value: 1 },
  325. },
  326. prop: "",
  327. propItem: "",
  328. row: "",
  329. imgs: []
  330. };
  331. },
  332. computed: {
  333. switchModel: {
  334. get() {
  335. return this.switchValue === 1; // 将0转换为false,1转换为true
  336. },
  337. set(value) {
  338. this.switchValue = value ? 1 : 0; // 将false转换为0,true转换为1
  339. },
  340. },
  341. },
  342. created() {
  343. this.getInfo();
  344. this.getDeptTreeList();
  345. },
  346. mounted() {
  347. },
  348. methods: {
  349. getImgUrl(img) {
  350. this.imgs.push(img);
  351. console.log(this.imgs, 'imgs')
  352. },
  353. handleChange(value) {
  354. },
  355. //自定义数据
  356. tenantIdnormalizer(node, instanceId) {
  357. if (node.children && !node.children.length) {
  358. delete node.children
  359. }
  360. return {
  361. id: node.deptId,
  362. label: node.deptName,
  363. children: node.children
  364. }
  365. },
  366. getInfo() {
  367. getUser(this.$route.params.userId).then((data) => {
  368. if (!data.data) return;
  369. let res = data.data;
  370. this.dataInfo = this.infoKeys.map((v, i) => {
  371. v.value = res[v.key];
  372. return v
  373. })
  374. this.roleName = data.roleName;
  375. this.sex = data.sex;
  376. this.status = data.status;
  377. //console.log(data.information.qualificationCertificateUrl, '5555')
  378. //let img = data.information.qualificationCertificateUrl.split(',');
  379. this.formData = data.information;
  380. //this.formData.qualificationCertificateUrl = img.map((v, i) => { return this.imageUrl(v) });
  381. });
  382. },
  383. saveExtend() {
  384. this.formData.userId = this.$route.params.userId;
  385. // let imgs = JSON.parse(JSON.stringify(this.imgs));
  386. // let qualificationCertificateUrl = imgs.toString(',');
  387. this.$refs['form'].validate((valid) => {
  388. if (valid) {
  389. let data = {
  390. ...this.formData,
  391. // qualificationCertificateUrl
  392. }
  393. extendUserInformation(data).then(res => {
  394. this.$message.success('保存成功!')
  395. this.$router.go(-1)
  396. })
  397. }
  398. });
  399. },
  400. getExtendInfo() {
  401. getExtendByOrgId(this.$route.params.id).then((data) => {
  402. console.log(data.data);
  403. if (data.data != null) {
  404. this.orgType = data.data.orgType;
  405. this.weatherAreaCode = data.data.weatherAreaCode;
  406. this.premisesArea = data.data.premisesArea;
  407. this.ownership = data.data.ownership;
  408. this.outsideArea = data.data.outsideArea;
  409. this.askari = data.data.askari;
  410. this.remoteControl = data.data.remoteControl;
  411. this.selfServiceBank = data.data.selfServiceBank;
  412. this.lobbyEquipment = data.data.lobbyEquipment;
  413. this.wallPenetratingEquipment = data.data.wallPenetratingEquipment;
  414. this.extendId = data.data.id;
  415. }
  416. });
  417. },
  418. startDateChanged(time) {
  419. if (this.formData.bornTime > this.formData.entryTime) {
  420. if (null != this.formData.entryTime) {
  421. this.formData.entryTime = this.formData.bornTime;
  422. }
  423. }
  424. },
  425. disabledDate(time) {
  426. //小于开始日期禁止选择
  427. let bornTime = new Date();
  428. bornTime.setTime(bornTime.getTime() - 3600 * 1000 * 24);
  429. if (this.formData.bornTime) {
  430. bornTime = new Date(this.formatTime(this.formData.bornTime, 'YYYY-MM-DD'));
  431. bornTime.setTime(bornTime.getTime() - 3600 * 1000 * 24);
  432. }
  433. const date = new Date();
  434. date.setTime(date.getTime());
  435. return (!(new Date(bornTime).getTime() < time.getTime()) || !(time.getTime() < new Date(date).getTime()))
  436. },
  437. /** 查询机构下拉树结构 */
  438. getDeptTreeList() {
  439. deptTreeList().then(response => {
  440. this.deptList = response.data;
  441. this.defaultKeys = response.data[0];
  442. });
  443. },
  444. getOrgPhysicalDefenseConstructionInfo() {
  445. this.orgloading = true;
  446. let dat = { orgId: this.$route.params.id };
  447. listOrgPhysicalDefenseConstruction(dat).then((data) => {
  448. this.constructionList = data.rows;
  449. this.orgloading = false;
  450. });
  451. },
  452. getBankPhysicalDefenseConstructionInfo() {
  453. this.bankloading = true;
  454. let dat = { orgId: this.$route.params.id };
  455. listBankPhysicalDefenseConstruction(dat).then((data) => {
  456. this.BankPhysicalDefenseConstructionList = data.rows;
  457. this.bankloading = false;
  458. });
  459. },
  460. // 取消按钮
  461. Bankcancel() {
  462. this.Bankopen = false;
  463. this.Bankreset();
  464. },
  465. // 表单重置
  466. Bankreset() {
  467. this.Bankform = {
  468. id: null,
  469. standard: null,
  470. dateOfCompliance: null,
  471. certificateEvidence: null,
  472. certificate: null,
  473. evidence: null,
  474. createTime: null,
  475. updateTime: null,
  476. createBy: null,
  477. updateBy: null,
  478. orgId: null,
  479. };
  480. this.resetForm("Bankform");
  481. },
  482. // 多选框选中数据
  483. handleBankSelectionChange(selection) {
  484. this.Bankids = selection.map((item) => item.id);
  485. this.single = selection.length !== 1;
  486. this.multiple = !selection.length;
  487. },
  488. /** 新增按钮操作 */
  489. handleBankAdd() {
  490. this.Bankreset();
  491. this.Bankopen = true;
  492. this.Banktitle = "添加银行物防建设";
  493. },
  494. /** 修改按钮操作 */
  495. handleBankUpdate(row) {
  496. this.Bankreset();
  497. const id = row.id || this.Bankids;
  498. getBankPhysicalDefenseConstruction(id).then((response) => {
  499. this.Bankform = response.data;
  500. this.Bankopen = true;
  501. this.Banktitle = "修改银行物防建设";
  502. });
  503. },
  504. /** 提交按钮 */
  505. submitBankForm() {
  506. this.Bankform.orgId = this.$route.params.id;
  507. this.$refs["Bankform"].validate((valid) => {
  508. if (valid) {
  509. if (this.Bankform.id != null) {
  510. updateBankPhysicalDefenseConstruction(this.Bankform).then(
  511. (response) => {
  512. this.$modal.msgSuccess("修改成功");
  513. this.Bankopen = false;
  514. this.getBankPhysicalDefenseConstructionInfo();
  515. }
  516. );
  517. } else {
  518. addBankPhysicalDefenseConstruction(this.Bankform).then(
  519. (response) => {
  520. this.$modal.msgSuccess("新增成功");
  521. this.Bankopen = false;
  522. this.getBankPhysicalDefenseConstructionInfo();
  523. }
  524. );
  525. }
  526. }
  527. });
  528. },
  529. /** 删除按钮操作 */
  530. handleBankDelete(row) {
  531. const Bankids = row.id || this.Bankids;
  532. this.$modal
  533. .confirm('是否确认删除银行物防建设编号为"' + Bankids + '"的数据项?')
  534. .then(function () {
  535. return delBankPhysicalDefenseConstruction(Bankids);
  536. })
  537. .then(() => {
  538. this.getBankPhysicalDefenseConstructionInfo();
  539. this.$modal.msgSuccess("删除成功");
  540. })
  541. .catch(() => {
  542. });
  543. },
  544. // 表单重置
  545. orgreset() {
  546. this.orgform = {
  547. id: null,
  548. standard: null,
  549. dateOfCompliance: null,
  550. certificateEvidence: null,
  551. certificate: null,
  552. evidence: null,
  553. createTime: null,
  554. updateTime: null,
  555. createBy: null,
  556. updateBy: null,
  557. orgId: null,
  558. };
  559. this.resetForm("orgform");
  560. },
  561. // 取消按钮
  562. orgcancel() {
  563. this.orgopen = false;
  564. this.orgreset();
  565. },
  566. // 多选框选中数据
  567. handleOrgSelectionChange(selection) {
  568. this.orgids = selection.map((item) => item.id);
  569. this.single = selection.length !== 1;
  570. this.multiple = !selection.length;
  571. },
  572. /** 新增按钮操作 */
  573. handleOrgAdd() {
  574. this.orgreset();
  575. this.orgopen = true;
  576. this.orgtitle = "添加机构物防建设";
  577. },
  578. /** 修改按钮操作 */
  579. handleOrgUpdate(row) {
  580. this.orgreset();
  581. const id = row.id || this.orgids;
  582. getOrgPhysicalDefenseConstruction(id).then((response) => {
  583. this.orgform = response.data;
  584. this.orgopen = true;
  585. this.orgtitle = "修改机构物防建设";
  586. });
  587. },
  588. /** 提交按钮 */
  589. submitOrgForm() {
  590. this.orgform.orgId = this.$route.params.id;
  591. this.$refs["orgform"].validate((valid) => {
  592. if (valid) {
  593. if (this.orgform.id != null) {
  594. updateOrgPhysicalDefenseConstruction(this.orgform).then(
  595. (response) => {
  596. this.$modal.msgSuccess("修改成功");
  597. this.orgopen = false;
  598. this.getOrgPhysicalDefenseConstructionInfo();
  599. }
  600. );
  601. } else {
  602. addOrgPhysicalDefenseConstruction(this.orgform).then((response) => {
  603. this.$modal.msgSuccess("新增成功");
  604. this.orgopen = false;
  605. this.getOrgPhysicalDefenseConstructionInfo();
  606. });
  607. }
  608. }
  609. });
  610. },
  611. /** 删除按钮操作 */
  612. handleOrgDelete(row) {
  613. const orgids = row.id || this.orgids;
  614. this.$modal
  615. .confirm('是否确认删除机构物防建设编号为"' + orgids + '"的数据项?')
  616. .then(function () {
  617. return delOrgPhysicalDefenseConstruction(orgids);
  618. })
  619. .then(() => {
  620. this.getOrgPhysicalDefenseConstructionInfo();
  621. this.$modal.msgSuccess("删除成功");
  622. })
  623. .catch(() => {
  624. });
  625. },
  626. nosaveExtend() {
  627. this.$router.go(-1);
  628. },
  629. triggerFileInput() {
  630. this.$refs.fileInput.click();
  631. },
  632. async handleFileChange(event) {
  633. const file = event.target.files[0];
  634. if (!file) return;
  635. // 创建 FormData 对象并添加文件
  636. const formData = new FormData();
  637. formData.append('file', file);
  638. // // 发送文件到您的文件上传 API
  639. try {
  640. uploadFile(formData).then((res) => {
  641. console.log(res);
  642. // this.orgform.certificateEvidence = res.data;
  643. });
  644. // 处理上传成功的逻辑
  645. console.log('上传成功');
  646. } catch (error) {
  647. // 处理上传失败的逻辑
  648. console.log('上传失败');
  649. }
  650. // try {
  651. // const response = await request.post('http://localhost:9527/dev-api/file/file/upload', formData, {
  652. // headers: {
  653. // 'Content-Type': 'multipart/form-data',
  654. // },
  655. // });
  656. // // 处理上传成功的逻辑
  657. // console.log('上传成功', response);
  658. // } catch (error) {
  659. // // 处理上传失败的逻辑
  660. // console.log('上传失败', error);
  661. // }
  662. // 重置 input 元素,以便下次选择相同文件时仍能触发 change 事件
  663. event.target.value = '';
  664. },
  665. },
  666. fillter: {},
  667. };
  668. </script>
  669. <style scoped lang="scss">
  670. .title {
  671. font-size: 18px;
  672. text-align: left;
  673. background: #008CD6bd;
  674. color: #fff;
  675. height: 36px;
  676. line-height: 36px;
  677. padding-left: 8px;
  678. margin: 0;
  679. }
  680. .info-box {
  681. margin: 30px;
  682. }
  683. .demo-form-inline {}
  684. .dialog-footer {}
  685. .container {}
  686. .image-container {
  687. display: inline-block;
  688. width: 200px;
  689. margin-right: 20px;
  690. /* 设置与下一个div的水平间距 */
  691. }
  692. .zoom-image {
  693. transition: transform 0.3s ease;
  694. }
  695. .zoom-image:hover {
  696. transform: scale(1.02);
  697. }
  698. .border-color-change {
  699. border: 1px solid #ccc;
  700. transition: border-color 0.3s ease;
  701. }
  702. .border-color-change:hover {
  703. border-color: #1ea8e9;
  704. /* 您可以将此颜色更改为所需的颜色 */
  705. }
  706. </style>