index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div>
  3. <div class="information" v-show="isShow==='home'" key="item">
  4. <div v-show="isShow==='home'" key="item">
  5. <el-descriptions title="企业信息" :column="3" border>
  6. <template slot="extra">
  7. <el-button type="primary" size="small" @click="openEdit">编辑</el-button>
  8. </template>
  9. <el-descriptions-item label="机构名称">{{baseInfo.name?baseInfo.name:'-'}}</el-descriptions-item>
  10. <el-descriptions-item label="机构代码">{{baseInfo.organizationCode?baseInfo.organizationCode:'-'}}</el-descriptions-item>
  11. <el-descriptions-item label="机构负责人">{{baseInfo.contacts?baseInfo.contacts:'-'}}</el-descriptions-item>
  12. <el-descriptions-item label="机构分类名称">{{baseInfo.categoryName?baseInfo.categoryName:'-'}}</el-descriptions-item>
  13. <el-descriptions-item label="财务系统类型">{{baseInfo.financeType&&baseInfo.financeType=='kingdee'?'金蝶K3':'-'}}</el-descriptions-item>
  14. <el-descriptions-item label="金媒集成用户名称">{{baseInfo.k3UserName?baseInfo.k3UserName:'-'}}</el-descriptions-item>
  15. <el-descriptions-item label="金蝶系统登录授权的应用ID" span="3">{{baseInfo.k3AppId?baseInfo.k3AppId:'-'}}</el-descriptions-item>
  16. <el-descriptions-item label="金蝶数据中心ID" span="3">{{baseInfo.k3AcctId?baseInfo.k3AcctId:'-'}}</el-descriptions-item>
  17. <el-descriptions-item label="金蝶系统登录授权的应用秘钥" span="3">{{baseInfo.k3AppSec?baseInfo.k3AppSec:'-'}}</el-descriptions-item>
  18. <el-descriptions-item label="金蝶服务Url地址" span="3">{{baseInfo.k3ServerUrl?baseInfo.k3ServerUrl:'-'}}</el-descriptions-item>
  19. <el-descriptions-item label="联系电话">{{baseInfo.phonenum?baseInfo.phonenum:'-'}}</el-descriptions-item>
  20. <el-descriptions-item label="手机号码">{{baseInfo.telephone?baseInfo.telephone:'-'}}</el-descriptions-item>
  21. <el-descriptions-item label="电子邮箱">{{baseInfo.email?baseInfo.email:'-'}}</el-descriptions-item>
  22. <el-descriptions-item label="邮编">{{baseInfo.postcode?baseInfo.postcode:'-'}}</el-descriptions-item>
  23. <el-descriptions-item label="纳税人识别号">{{baseInfo.taxnum?baseInfo.taxnum:'-'}}</el-descriptions-item>
  24. <el-descriptions-item label="状态">
  25. <el-tag :type="baseInfo.status===0?'primary':'danger'" disable-transitions>
  26. {{baseInfo.status===0?'正常':'禁用'}}
  27. </el-tag>
  28. </el-descriptions-item>
  29. <el-descriptions-item label="联系地址" span="3">{{baseInfo.province?baseInfo.province+baseInfo.province+baseInfo.city+baseInfo.region+baseInfo.street+baseInfo.address:'-'}}</el-descriptions-item>
  30. <el-descriptions-item label="备注" span="3">{{baseInfo.remark?baseInfo.remark:'-'}}</el-descriptions-item>
  31. </el-descriptions>
  32. </div>
  33. </div>
  34. <div class="my-container" v-show="isShow==='add'" key="item2">
  35. <!-- 新增/编辑弹窗 -->
  36. <div class="detil">
  37. <by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
  38. <div class="box-shadow">
  39. <by-form :propConfig="addConfig" ref="addFormId">
  40. <template v-slot:k3ServerUrl="{value}" class="clearfix">
  41. <!-- <i class="el-icon-question" title="私有云必须配置金蝶云星空产品地址,K3Cloud/结尾,若为公有云则必须置空"></i> -->
  42. <!-- <vxe-input v-model="value.k3ServerUrl" style="width:calc(100% - 25px);margin-left: 10px;"></vxe-input> -->
  43. <vxe-input v-model="value.k3ServerUrl" style="width: 27.2%;"></vxe-input>
  44. <div style="display: inline-block;margin-left: 17px;color: #ababab;">
  45. <span style="color: red;margin-right: 5px;">*</span>私有云必须配置金蝶云星空产品地址,K3Cloud/结尾,若为公有云则必须置空
  46. </div>
  47. </template>
  48. <template v-slot:status class="clearfix">
  49. <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
  50. <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
  51. </template>
  52. </by-form>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script lang="ts">
  59. import { Component, Vue } from "vue-property-decorator";
  60. import api from "@/api/currency";
  61. @Component
  62. export default class Information extends Vue {
  63. baseInfo : any = {}
  64. isShow = 'home'
  65. radio : any = 0
  66. popTitle : any = ''
  67. dialogFormVisible : boolean = false
  68. toolConfig = {
  69. tools: {
  70. return: true,
  71. save: true,
  72. }
  73. }
  74. addConfig = {
  75. attr: {
  76. size: 'medium',
  77. rules: {
  78. categoryName: [{
  79. required: true, message: '请选择机构分类', trigger: 'change'
  80. }],
  81. name: [{
  82. required: true, message: '请输入名称', trigger: 'blur'
  83. }],
  84. organizationCode: [{
  85. required: true, message: '请输入机构代码', trigger: 'blur'
  86. }],
  87. contacts: [{
  88. required: true, message: '请输入负责人', trigger: 'blur'
  89. }],
  90. telephone: [{
  91. required: true, message: '请输入手机号码', trigger: 'blur'
  92. }],
  93. // phonenum: [{
  94. // required: true, message: '请输入联系电话', trigger: 'blur'
  95. // }],
  96. financeType: [{
  97. required: true, message: '请输入财务系统类型', trigger: 'change'
  98. }],
  99. province: [{
  100. required: true, message: '请选择地址', trigger: 'change'
  101. }],
  102. address: [{
  103. required: true, message: '请输入详细地址', trigger: 'blur'
  104. }],
  105. }
  106. },
  107. columns: [
  108. [
  109. {
  110. span: 6,
  111. label: '机构分类',
  112. prop: 'categoryName',
  113. component: 'select-tree',
  114. compConfig: {
  115. attr: {
  116. label: 'name',
  117. clearable: true,
  118. retConfig: {
  119. categoryId: 'id',
  120. categoryName: 'name',
  121. },
  122. defaultExpandAll: true
  123. },
  124. request: {
  125. url: '/maindata/maindataOrganizationCategory/treeUseList'
  126. }
  127. }
  128. },
  129. {
  130. span: 6,
  131. label: '名称',
  132. prop: 'name',
  133. component: 'by-input',
  134. },
  135. {
  136. span: 6,
  137. label: '机构代码',
  138. prop: 'organizationCode',
  139. component: 'by-input',
  140. },
  141. {
  142. span: 6,
  143. label: '负责人',
  144. prop: 'contacts',
  145. component: 'by-input',
  146. },
  147. {
  148. span: 6,
  149. label: '手机号码',
  150. prop: 'telephone',
  151. component: 'by-input',
  152. },
  153. {
  154. span: 6,
  155. label: '联系电话',
  156. prop: 'phonenum',
  157. component: 'by-input',
  158. },
  159. {
  160. span: 6,
  161. label: '电子邮箱',
  162. prop: 'email',
  163. component: 'by-input',
  164. },
  165. ],
  166. [
  167. {
  168. span: 6,
  169. labelWidth: '110px',
  170. label: '财务系统类型',
  171. prop: 'financeType',
  172. component: 'by-select',
  173. compConfig: {
  174. attr: {
  175. placeholder: '请选择财务系统类型',
  176. clearable: true,
  177. size: 'small',
  178. data: [
  179. {
  180. value: 'kingdee',
  181. label: '金蝶K3'
  182. },
  183. // {
  184. // value: 'yonbip',
  185. // label: '用友U8'
  186. // },
  187. ]
  188. }
  189. }
  190. },
  191. ],
  192. [
  193. {
  194. span: 18,
  195. label: 'URL地址',
  196. slot: true,
  197. prop: 'k3ServerUrl',
  198. },
  199. ],
  200. [
  201. {
  202. span: 6,
  203. label: '登录授权ID',
  204. slot: true,
  205. prop: 'k3AppId',
  206. component: 'by-input',
  207. },
  208. {
  209. span: 6,
  210. label: '用户名称',
  211. slot: true,
  212. prop: 'k3UserName',
  213. component: 'by-input',
  214. },
  215. {
  216. span: 6,
  217. label: '数据中心ID',
  218. slot: true,
  219. prop: 'k3AcctId',
  220. component: 'by-input',
  221. },
  222. {
  223. span: 6,
  224. label: '应用秘钥',
  225. slot: true,
  226. prop: 'k3AppSec',
  227. component: 'by-input',
  228. },
  229. {
  230. span: 6,
  231. label: '纳税人识别号',
  232. slot: true,
  233. prop: 'txNum',
  234. component: 'by-input',
  235. },
  236. ],
  237. [{
  238. span: 18,
  239. label: '地址',
  240. prop: 'province',
  241. component: 'by-area',
  242. labelWidth: '100px',
  243. compConfig: {
  244. attr: {
  245. province: 'province', //省
  246. provinceCode: 'provinceCode', //省编码
  247. city: 'city', //市
  248. cityCode: 'cityCode', //市编码
  249. county: 'region', //县/区
  250. countyCode: 'regionCode', //县/区编码
  251. town: 'street', //街道
  252. townCode: 'streetCode', //街道编码
  253. }
  254. }
  255. }],
  256. [
  257. {
  258. span: 18,
  259. label: '详细地址',
  260. slot: true,
  261. prop: 'address',
  262. component: 'by-input',
  263. },
  264. ],
  265. // [
  266. // {
  267. // span: 6,
  268. // label: '状态',
  269. // slot: true,
  270. // prop: 'status',
  271. // },
  272. // ]
  273. ]
  274. }
  275. created() {
  276. // 生产厂商
  277. this.getRequest('/maindata/maindataMaterialManufacturer/page');
  278. // 供应商
  279. // this.getRequest('/maindata/maindataMaterialSupplier/page');
  280. // 分销商
  281. // this.getRequest('/maindata/maindataMaterialDistributor/page');
  282. }
  283. getRequest(url : any) {
  284. let loading = this.$loading({ target: '.main-container' });
  285. (this as any).$request({
  286. url: url,
  287. method: 'get'
  288. }).then((res : any) => {
  289. // console.log(res);
  290. if (res.code === 200) {
  291. this.baseInfo = res.data.records[0];
  292. loading.close();
  293. }
  294. }).catch(() => {});
  295. }
  296. openEdit(e : any) {
  297. console.log('打开编辑 ==> ', e);
  298. this.isShow = 'add'; // 展示类型
  299. this.popTitle = '编辑'
  300. let loading = this.$loading({ target: '.main-container' });
  301. api.single({ id: this.baseInfo.id }, 'maindataMaterialManufacturer').then((res : any) => {
  302. if (res.code === 200) {
  303. let data = res.data;
  304. this.radio = data.status;
  305. this.dialogFormVisible = true;
  306. this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
  307. loading.close();
  308. } else loading.close();
  309. }).catch(() => loading.close());
  310. }
  311. // 内页工具栏方法
  312. insideTools(e : any) {
  313. console.log(e);
  314. if (e === 'onReturn') this.isShow = 'home';
  315. if (e === 'onSave') this.confirm();
  316. }
  317. // 保存新增/编辑
  318. confirm() {
  319. (this as any).$refs.addFormId.validate().then(() => {
  320. let query = (this as any).$refs.addFormId.getValue();
  321. query.status = this.radio;
  322. query.accountId = this.$store.getters.userInfo.userId;
  323. // 手机验证
  324. let reg = /^1[3456789]\d{9}$/;
  325. // let reg2 = /^0\d{2,3}-\d{7,8}$/;
  326. if (query.telephone && !reg.test(query.telephone)) return this.$message.warning('请输入正确手机号码');
  327. // if (query.phonenum && !reg2.test(query.phonenum)) return this.$message.warning('请输入正确联系电话');
  328. if(query.phonenum){
  329. if (query.phonenum.length>20 || query.phonenum[0]==' ') {
  330. return this.$message.warning('请输入正确联系电话');
  331. }
  332. }
  333. if (!query.telephone) query.telephone = null;
  334. if (!query.phonenum) query.phonenum = null;
  335. this.dialogFormVisible = false;
  336. console.log(query);
  337. let loading = this.$loading({ target: '.main-container' });
  338. api.updateList(query, 'maindataMaterialManufacturer').then((res : any) => {
  339. loading.close();
  340. if (res.code === 200) {
  341. this.$message.success('编辑成功');
  342. this.getRequest('/maindata/maindataMaterialManufacturer/page');
  343. this.isShow = 'home'; // 展示类型
  344. } else this.$message.error(res.msg);
  345. }).catch(() => loading.close());
  346. }).catch(() => {});
  347. }
  348. }
  349. </script>
  350. <style lang="scss" scoped>
  351. .information {
  352. width: 1200px;
  353. min-width: 1200px;
  354. margin: 100px auto 0;
  355. }
  356. .field-box {
  357. width: 33.3%;
  358. float: left;
  359. margin-bottom: 60px;
  360. }
  361. .left-field {
  362. float: left;
  363. width: 120px;
  364. text-align: right;
  365. line-height: 43px;
  366. color: #333;
  367. // word-wrap: break-word; // 换行
  368. }
  369. .right-field {
  370. float: left;
  371. width: calc(100% - 150px);
  372. color: #333;
  373. height: 42px;
  374. line-height: 42px;
  375. border-bottom: 1px solid #ddd;
  376. }
  377. .my-container {
  378. width: 100%;
  379. box-sizing: border-box;
  380. display: flex;
  381. padding: 16px;
  382. height: 100%;
  383. .bill-left {
  384. position: relative;
  385. border-right: solid #EEE 1px;
  386. padding-right: 16px;
  387. flex-shrink: 0;
  388. .bill-tab {
  389. width: 150px;
  390. height: 100%;
  391. transition: all .5s;
  392. overflow: hidden;
  393. }
  394. .tab-title {
  395. font-size: 16px;
  396. padding-bottom: 16px;
  397. width: 200px;
  398. }
  399. }
  400. .bill-main {
  401. width: calc(100% - 16px);
  402. box-sizing: border-box;
  403. margin-left: 16px;
  404. position: relative;
  405. height: 100%;
  406. overflow-y: hidden;
  407. }
  408. .detil {
  409. width: 100%;
  410. .box-shadow {
  411. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  412. padding: 20px;
  413. border-radius: 4px;
  414. border: 1px solid #e6ebf5;
  415. background-color: #fff;
  416. overflow: hidden;
  417. color: #303133;
  418. -webkit-transition: .3s;
  419. transition: .3s;
  420. margin-top: 20px;
  421. }
  422. }
  423. }
  424. </style>