companyMsg-add-or-update.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <el-dialog
  3. v-dialogDrag
  4. :fullscreen="dialogFull"
  5. :title="!dataForm.fId ? '车队注册' : '修改'"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"
  8. width="70%"
  9. :before-close="handleClose"
  10. >
  11. <template slot="title">
  12. <div class="avue-crud__dialog__header">
  13. <span class="el-dialog__title">
  14. <span
  15. style="
  16. display: inline-block;
  17. width: 3px;
  18. height: 20px;
  19. margin-right: 5px;
  20. float: left;
  21. margin-top: 2px;
  22. "
  23. ></span>
  24. 车队注册
  25. </span>
  26. <div class="avue-crud__dialog__menu enlarge" @click="full">
  27. <i
  28. style="
  29. cursor: pointer;
  30. display: block;
  31. width: 12px;
  32. height: 12px;
  33. border: 1px solid #909399;
  34. border-top: 3px solid #909399;
  35. margin-top: -3px;
  36. "
  37. ></i>
  38. </div>
  39. </div>
  40. </template>
  41. <el-form
  42. :model="dataForm_s"
  43. :rules="dataRule"
  44. ref="dataForm_s"
  45. @keyup.enter.native="dataFormSubmit()"
  46. label-width="200px"
  47. >
  48. <el-form-item label="公司名称" prop="fName">
  49. <el-input
  50. v-model="dataForm_s.fName"
  51. placeholder="公司名称"
  52. :disabled="doNot"
  53. ></el-input>
  54. </el-form-item>
  55. <el-form-item label="公司地址" prop="fAddr">
  56. <el-input
  57. v-model="dataForm_s.fAddr"
  58. placeholder="公司地址"
  59. :disabled="doNot"
  60. ></el-input>
  61. </el-form-item>
  62. <el-form-item label="公司开户行" prop="fBankname">
  63. <el-input
  64. v-model="dataForm_s.fBankname"
  65. placeholder="公司开户行"
  66. :disabled="doNot"
  67. ></el-input>
  68. </el-form-item>
  69. <el-form-item label="银行账号" prop="fBankno">
  70. <el-input
  71. v-model="dataForm_s.fBankno"
  72. placeholder="银行账号"
  73. :disabled="doNot"
  74. ></el-input>
  75. </el-form-item>
  76. <el-form-item label="登录账号" prop="loginAccount">
  77. <el-input
  78. v-model="dataForm_s.loginAccount"
  79. :disabled="dataForm.fId ? edit : false || doNot"
  80. placeholder="登录账号"
  81. ></el-input>
  82. </el-form-item>
  83. <el-form-item label="信用等级" prop="creditLv">
  84. <el-input
  85. v-model="dataForm_s.creditLv"
  86. placeholder="信用等级"
  87. :disabled="doNot"
  88. ></el-input>
  89. </el-form-item>
  90. <el-form-item label="账期天数(最迟结款天数)" prop="paymentDays">
  91. <el-input
  92. v-model="dataForm_s.paymentDays"
  93. placeholder="账期天数(最迟结款天数)"
  94. :disabled="doNot"
  95. ></el-input>
  96. </el-form-item>
  97. <el-form-item label="联系人" prop="fManage">
  98. <el-input
  99. v-model="dataForm_s.fManage"
  100. placeholder="联系人"
  101. :disabled="doNot"
  102. ></el-input>
  103. </el-form-item>
  104. <el-form-item label="联系电话" prop="fTel">
  105. <el-input
  106. v-model="dataForm_s.fTel"
  107. placeholder="联系电话"
  108. :disabled="doNot"
  109. ></el-input>
  110. </el-form-item>
  111. <el-form-item label="传真" prop="fFax">
  112. <el-input
  113. v-model="dataForm_s.fFax"
  114. placeholder="传真"
  115. :disabled="doNot"
  116. ></el-input>
  117. </el-form-item>
  118. <el-form-item label="Email" prop="fEmail">
  119. <el-input
  120. v-model="dataForm_s.fEmail"
  121. placeholder="fEmail"
  122. :disabled="doNot"
  123. ></el-input>
  124. </el-form-item>
  125. <el-form-item label="总公司" prop="headOffice">
  126. <el-input
  127. v-model="dataForm_s.headOffice"
  128. placeholder="总公司"
  129. :disabled="doNot"
  130. ></el-input>
  131. </el-form-item>
  132. <el-form-item label="注册资本" prop="registerdCapital">
  133. <el-input
  134. v-model="dataForm_s.registerdCapital"
  135. placeholder="注册资本"
  136. :disabled="doNot"
  137. ></el-input>
  138. </el-form-item>
  139. <el-form-item label="法人" prop="legalPerson">
  140. <el-input
  141. v-model="dataForm_s.legalPerson"
  142. placeholder="法人"
  143. :disabled="doNot"
  144. ></el-input>
  145. </el-form-item>
  146. <el-form-item label="所属行业" prop="insdustry">
  147. <el-input
  148. v-model="dataForm_s.insdustry"
  149. placeholder="所属行业"
  150. :disabled="doNot"
  151. ></el-input>
  152. </el-form-item>
  153. <el-form-item label="社会统一信用代码" prop="creditNum">
  154. <el-input
  155. v-model="dataForm_s.creditNum"
  156. placeholder="社会统一信用代码"
  157. :disabled="doNot"
  158. ></el-input>
  159. </el-form-item>
  160. <el-form-item label="纳税人识别号" prop="taxpayerNum">
  161. <el-input
  162. v-model="dataForm_s.taxpayerNum"
  163. placeholder="纳税人识别号"
  164. :disabled="doNot"
  165. ></el-input>
  166. </el-form-item>
  167. <el-form-item label="工商注册号" prop="industryCommerceNum">
  168. <el-input
  169. v-model="dataForm_s.industryCommerceNum"
  170. placeholder="工商注册号"
  171. :disabled="doNot"
  172. ></el-input>
  173. </el-form-item>
  174. <el-form-item label="组织机构代码" prop="organizationNum">
  175. <el-input
  176. v-model="dataForm_s.organizationNum"
  177. placeholder="组织机构代码"
  178. :disabled="doNot"
  179. ></el-input>
  180. </el-form-item>
  181. <el-form-item label="登记机关" prop="registerOrganization">
  182. <el-input
  183. v-model="dataForm_s.registerOrganization"
  184. placeholder="登记机关"
  185. :disabled="doNot"
  186. ></el-input>
  187. </el-form-item>
  188. <el-form-item label="成立日期" prop="dateOfEstablishment">
  189. <!-- <el-input v-model="dataForm.dateOfEstablishment" placeholder="成立日期"></el-input>-->
  190. <el-date-picker
  191. style="width: 100%"
  192. value-format="yyyy-MM-dd HH:mm:ss"
  193. v-model="dataForm_s.dateOfEstablishment"
  194. type="date"
  195. :disabled="doNot"
  196. placeholder="创建时间"
  197. >
  198. </el-date-picker>
  199. </el-form-item>
  200. <el-form-item label="企业类型" prop="companyType">
  201. <el-input
  202. v-model="dataForm_s.companyType"
  203. placeholder="企业类型"
  204. :disabled="doNot"
  205. ></el-input>
  206. </el-form-item>
  207. <el-form-item label="营业期限" prop="businessDeadline">
  208. <el-date-picker
  209. style="width: 100%"
  210. value-format="yyyy-MM-dd"
  211. v-model="dataForm_s.businessDeadline"
  212. type="date"
  213. :disabled="doNot"
  214. placeholder="营业期限"
  215. ></el-date-picker>
  216. </el-form-item>
  217. <el-form-item label="营业区域" prop="businessArea">
  218. <el-input
  219. v-model="dataForm_s.businessArea"
  220. placeholder="营业区域"
  221. :disabled="doNot"
  222. ></el-input>
  223. </el-form-item>
  224. <el-form-item label="审核年检日期" prop="annualDate">
  225. <!-- <el-input v-model="dataForm.annualDate" placeholder="审核年检日期"></el-input>-->
  226. <el-date-picker
  227. style="width: 100%"
  228. value-format="yyyy-MM-dd HH:mm:ss"
  229. v-model="dataForm_s.annualDate"
  230. type="date"
  231. :disabled="doNot"
  232. placeholder="创建时间"
  233. >
  234. </el-date-picker>
  235. </el-form-item>
  236. <el-form-item label="注册地址" prop="registerdAddress">
  237. <el-input
  238. v-model="dataForm_s.registerdAddress"
  239. placeholder="注册地址"
  240. :disabled="doNot"
  241. ></el-input>
  242. </el-form-item>
  243. <el-form-item label="经营范围" prop="manageScope">
  244. <el-input
  245. v-model="dataForm_s.manageScope"
  246. placeholder="经营范围"
  247. :disabled="doNot"
  248. ></el-input>
  249. </el-form-item>
  250. </el-form>
  251. <span slot="footer" class="dialog-footer">
  252. <el-button type="info" @click="handleUpdata" v-if="hide">修改</el-button>
  253. <el-button @click="cancel">取消</el-button>
  254. <el-button type="primary" @click="dataFormSubmit()" :disabled="doNot"
  255. >确定</el-button
  256. >
  257. </span>
  258. </el-dialog>
  259. </template>
  260. <script>
  261. import { preservation, lookOver } from "@/api/fleet/companyMsg";
  262. import Vue from "vue";
  263. Vue.directive("dialogDrag", {
  264. bind(el, binding, vnode, oldVnode) {
  265. const dialogHeaderEl = el.querySelector(".el-dialog__header");
  266. const dragDom = el.querySelector(".el-dialog");
  267. const enlarge = el.querySelector(".enlarge");
  268. dialogHeaderEl.style.cursor = "move";
  269. // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
  270. const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
  271. if (enlarge) {
  272. enlarge.onclick = (e) => {
  273. dragDom.style.top = "0px";
  274. dragDom.style.left = "0px";
  275. };
  276. }
  277. dialogHeaderEl.onmousedown = (e) => {
  278. // 鼠标按下,计算当前元素距离可视区的距离
  279. const disX = e.clientX - dialogHeaderEl.offsetLeft;
  280. const disY = e.clientY - dialogHeaderEl.offsetTop;
  281. // 获取到的值带px 正则匹配替换
  282. let styL, styT;
  283. // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
  284. if (sty.left.includes("%")) {
  285. styL =
  286. +document.body.clientWidth * (+sty.left.replace(/\%/g, "") / 100);
  287. styT =
  288. +document.body.clientHeight * (+sty.top.replace(/\%/g, "") / 100);
  289. } else {
  290. styL = +sty.left.replace(/\px/g, "");
  291. styT = +sty.top.replace(/\px/g, "");
  292. }
  293. document.onmousemove = function (e) {
  294. // 通过事件委托,计算移动的距离
  295. const l = e.clientX - disX;
  296. const t = e.clientY - disY;
  297. // 移动当前元素
  298. if (t + styT >= 0) {
  299. dragDom.style.top = `${t + styT}px`;
  300. }
  301. dragDom.style.left = `${l + styL}px`;
  302. // 将此时的位置传出去
  303. // binding.value({x:e.pageX,y:e.pageY})
  304. };
  305. document.onmouseup = function (e) {
  306. document.onmousemove = null;
  307. document.onmouseup = null;
  308. };
  309. };
  310. },
  311. });
  312. export default {
  313. props: {
  314. dataForm: {
  315. type: Object,
  316. require: false,
  317. },
  318. },
  319. data() {
  320. return {
  321. hide: false,
  322. doNot: true,
  323. dialogFull: false,
  324. dataForm_s: {
  325. annualDate: null,
  326. fBankno: null,
  327. billStatus: null,
  328. businessArea: null,
  329. businessDeadline: null,
  330. carNum: null,
  331. fAddr: null,
  332. fName: null,
  333. companyType: null,
  334. creatTime: null,
  335. createBy: null,
  336. createTime: null,
  337. creditLv: null,
  338. creditNum: null,
  339. dateOfEstablishment: null,
  340. delFlag: null,
  341. fEmail: null,
  342. fFax: null,
  343. headOffice: null,
  344. fId: null,
  345. industryCommerceNum: null,
  346. insdustry: null,
  347. legalPerson: null,
  348. fManage: null,
  349. fTel: null,
  350. loginAccount: null,
  351. manageScope: null,
  352. modificationTime: null,
  353. fBankname: null,
  354. organizationNum: null,
  355. params: null,
  356. paymentDays: null,
  357. registerOrganization: null,
  358. registerdAddress: null,
  359. registerdCapital: null,
  360. remark: null,
  361. searchValue: null,
  362. taxpayerNum: null,
  363. updateBy: null,
  364. updateTime: null,
  365. },
  366. visible: false,
  367. edit: true,
  368. login: this.dataForm.fId,
  369. dataRule: {
  370. fName: [{ required: true, message: "请输入公司名称", trigger: "blur" }],
  371. fAddr: [{ required: true, message: "请输入公司地址", trigger: "blur" }],
  372. loginAccount: [
  373. { required: true, message: "请输入登录账号", trigger: "blur" },
  374. ],
  375. fBankname: [
  376. { required: true, message: "请输入开户行", trigger: "blur" },
  377. ],
  378. fBankno: [
  379. { required: true, message: "请输入银行账号", trigger: "blur" },
  380. ],
  381. paymentDays: [
  382. { required: true, message: "请输入账期天数", trigger: "blur" },
  383. ],
  384. fTel: [
  385. { required: true, message: "请输入联系人电话", trigger: "blur" },
  386. ],
  387. },
  388. };
  389. },
  390. methods: {
  391. full() {
  392. this.dialogFull = !this.dialogFull;
  393. },
  394. handleUpdata() {
  395. this.hide = true;
  396. this.doNot = false;
  397. },
  398. cancel() {
  399. this.$confirm("确认关闭?")
  400. .then((_) => {
  401. this.visible = false;
  402. this.dataForm_s = {};
  403. })
  404. .catch((_) => {});
  405. },
  406. handleClose(done) {
  407. this.$confirm("确认关闭?")
  408. .then((_) => {
  409. done();
  410. this.visible = false;
  411. this.dataForm_s = {};
  412. })
  413. .catch((_) => {});
  414. },
  415. init() {
  416. this.hide = true;
  417. this.visible = true;
  418. if (this.dataForm.fId !== null) {
  419. lookOver(this.dataForm.fId).then((data) => {
  420. this.doNot = true;
  421. this.dataForm_s = data.data;
  422. });
  423. } else {
  424. this.dataForm_s = {
  425. annualDate: null,
  426. fBankno: null,
  427. billStatus: null,
  428. businessArea: null,
  429. businessDeadline: null,
  430. carNum: null,
  431. fAddr: null,
  432. fName: null,
  433. companyType: null,
  434. creatTime: null,
  435. createBy: null,
  436. createTime: null,
  437. creditLv: null,
  438. creditNum: null,
  439. dateOfEstablishment: null,
  440. delFlag: null,
  441. fEmail: null,
  442. fFax: null,
  443. headOffice: null,
  444. id: null,
  445. industryCommerceNum: null,
  446. insdustry: null,
  447. legalPerson: null,
  448. fManage: null,
  449. fTel: null,
  450. loginAccount: null,
  451. manageScope: null,
  452. modificationTime: null,
  453. fBankname: null,
  454. organizationNum: null,
  455. params: null,
  456. paymentDays: null,
  457. registerOrganization: null,
  458. registerdAddress: null,
  459. registerdCapital: null,
  460. remark: null,
  461. searchValue: null,
  462. taxpayerNum: null,
  463. updateBy: null,
  464. updateTime: null,
  465. };
  466. this.hide = false;
  467. this.doNot = false;
  468. }
  469. },
  470. // 表单提交
  471. dataFormSubmit() {
  472. this.$refs["dataForm_s"].validate((valid) => {
  473. if (valid) {
  474. console.log(valid);
  475. preservation(this.dataForm_s).then((data) => {
  476. this.$message.success("操作成功");
  477. this.closeDia();
  478. });
  479. }
  480. });
  481. },
  482. closeDia() {
  483. this.visible = false;
  484. this.$emit("refreshDataList");
  485. Object.assign(this.$data, this.$options.data.call(this));
  486. },
  487. },
  488. handlePreview(file) {},
  489. handleExceed(files, fileList) {
  490. this.$message.warning(
  491. `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
  492. files.length + fileList.length
  493. } 个文件`
  494. );
  495. },
  496. beforeRemove(file, fileList) {
  497. return this.$confirm(`确定移除 ${file.name}?`);
  498. },
  499. };
  500. </script>
  501. <style scoped>
  502. .el-form-item {
  503. width: 49%;
  504. margin-bottom: 20px;
  505. display: inline-block;
  506. }
  507. .el-select {
  508. display: block;
  509. }
  510. .upload-demo {
  511. margin-left: 50px;
  512. }
  513. </style>
  514. <style lang="scss">
  515. .avue-crud__dialog__header {
  516. display: -webkit-box;
  517. display: -ms-flexbox;
  518. display: flex;
  519. -webkit-box-align: center;
  520. -ms-flex-align: center;
  521. align-items: center;
  522. -webkit-box-pack: justify;
  523. -ms-flex-pack: justify;
  524. justify-content: space-between;
  525. }
  526. .el-dialog__title {
  527. color: rgba(0, 0, 0, 0.85);
  528. font-weight: 500;
  529. word-wrap: break-word;
  530. }
  531. .avue-crud__dialog__menu {
  532. padding-right: 20px;
  533. float: left;
  534. }
  535. </style>