index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="客户类别" prop="fTypeid">
  5. <el-select style="width: 250px" v-model="queryParams.fTypeid" placeholder="请选择客户类别" clearable size="small">
  6. <el-option
  7. v-for="dict in fTypeidOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="编号" prop="fNo">
  15. <el-input
  16. v-model="queryParams.fNo"
  17. style="width: 250px"
  18. placeholder="请输入编号"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="名称" prop="fName">
  25. <el-input
  26. v-model="queryParams.fName"
  27. style="width: 250px"
  28. placeholder="请输入名称"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="电话" prop="fTel">
  35. <el-input
  36. v-model="queryParams.fTel"
  37. style="width: 250px"
  38. placeholder="请输入电话"
  39. clearable
  40. size="small"
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item label="状态" prop="fStatus">
  45. <el-select
  46. v-model="queryParams.fStatus"
  47. placeholder="客户状态"
  48. clearable
  49. size="small"
  50. style="width: 250px"
  51. >
  52. <el-option
  53. v-for="dict in statusOptions"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="dict.dictValue"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item>
  61. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  62. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  63. </el-form-item>
  64. </el-form>
  65. <el-row :gutter="10" class="mb8">
  66. <el-col :span="1.5">
  67. <el-button
  68. type="primary"
  69. icon="el-icon-plus"
  70. size="mini"
  71. @click="handleAdd"
  72. v-hasPermi="['basicdata:corps:add']"
  73. >新增</el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="success"
  78. icon="el-icon-edit"
  79. size="mini"
  80. :disabled="single"
  81. @click="handleUpdate"
  82. v-hasPermi="['basicdata:corps:edit']"
  83. >修改</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="danger"
  88. icon="el-icon-delete"
  89. size="mini"
  90. :disabled="multiple"
  91. @click="handleDelete"
  92. v-hasPermi="['basicdata:corps:remove']"
  93. >删除</el-button>
  94. </el-col>
  95. <el-col :span="1.5">
  96. <el-button
  97. type="warning"
  98. icon="el-icon-download"
  99. size="mini"
  100. @click="handleExport"
  101. v-hasPermi="['basicdata:corps:export']"
  102. >导出</el-button>
  103. </el-col>
  104. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  105. </el-row>
  106. <el-table v-loading="loading" :data="corpsList" @selection-change="handleSelectionChange">
  107. <el-table-column type="selection" width="55" align="center" />
  108. <el-table-column
  109. :show-overflow-tooltip="true"
  110. label="客户类别" align="center" prop="fTypename" />
  111. <el-table-column label="编号" align="center" prop="fNo" />
  112. <el-table-column
  113. :show-overflow-tooltip="true"
  114. label="名称" align="center" prop="fName"
  115. width="260px"
  116. />
  117. <el-table-column
  118. :show-overflow-tooltip="true"
  119. label="简称" align="center" width="200px" prop="fCname" />
  120. <el-table-column
  121. :show-overflow-tooltip="true"
  122. label="英文名称" align="center" prop="fEname" />
  123. <el-table-column
  124. :show-overflow-tooltip="true"
  125. label="电话" align="center" prop="fTel" />
  126. <el-table-column label="录入人" align="center" prop="createBy" />
  127. <el-table-column label="录入时间" align="center" prop="createTime" width="180">
  128. <template slot-scope="scope">
  129. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="修改人" align="center" prop="updateBy" />
  133. <el-table-column label="修改时间" align="center" prop="updateTime" width="180">
  134. <template slot-scope="scope">
  135. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="状态" align="center" prop="fStatus" >
  139. <template slot-scope="scope">
  140. <el-switch
  141. v-model="scope.row.fStatus"
  142. active-value="0"
  143. inactive-value="1"
  144. @change="handleStatusChange(scope.row)"
  145. ></el-switch>
  146. </template>
  147. </el-table-column>
  148. <el-table-column
  149. label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
  150. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
  151. <template slot-scope="scope">
  152. <el-button
  153. size="mini"
  154. type="text"
  155. icon="el-icon-edit"
  156. @click="handleUpdate(scope.row)"
  157. v-hasPermi="['basicdata:corps:edit']"
  158. >修改</el-button>
  159. <el-button
  160. size="mini"
  161. type="text"
  162. icon="el-icon-delete"
  163. @click="handleDelete(scope.row)"
  164. v-hasPermi="['basicdata:corps:remove']"
  165. >删除</el-button>
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. <pagination
  170. v-show="total>0"
  171. :total="total"
  172. :page.sync="queryParams.pageNum"
  173. :limit.sync="queryParams.pageSize"
  174. @pagination="getList"
  175. />
  176. <!-- 添加或修改客户详情对话框 -->
  177. <el-dialog
  178. v-dialogDrag
  179. :fullscreen="dialogFull"
  180. :title="title"
  181. :visible.sync="open"
  182. close-on-click-modal="false"
  183. width="80%"
  184. :close-on-click-modal="false"
  185. append-to-body>
  186. <template slot="title">
  187. <div class="avue-crud__dialog__header">
  188. <span class="el-dialog__title">
  189. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
  190. 添加客户详情
  191. </span>
  192. <div class="avue-crud__dialog__menu enlarge" @click="full">
  193. <i style="cursor: pointer;display: block;width:12px;height:12px;border:1px solid #909399;border-top:3px solid #909399;margin-top: -3px;"></i>
  194. </div>
  195. </div>
  196. </template>
  197. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  198. <el-row>
  199. <el-col :span="8">
  200. <el-form-item label="客户类别" prop="fTypeid">
  201. <el-select style="width: 250px" v-model="form.fTypeid" :multiple="true" placeholder="请选择客户类别">
  202. <el-option
  203. v-for="dict in fTypeidOptions"
  204. :key="dict.dictValue"
  205. :label="dict.dictLabel"
  206. :value="dict.dictValue"
  207. ></el-option>
  208. </el-select>
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="8">
  212. <el-form-item label="编号" prop="fNo">
  213. <el-input v-model="form.fNo" style="width: 250px" placeholder="请输入编号" />
  214. </el-form-item>
  215. </el-col>
  216. <el-col :span="8">
  217. <el-form-item label="名称" prop="fName">
  218. <el-input v-model="form.fName" style="width: 250px" placeholder="请输入名称" />
  219. </el-form-item>
  220. </el-col>
  221. </el-row>
  222. <el-row>
  223. <el-col :span="8">
  224. <el-form-item label="简称" prop="fCname">
  225. <el-input v-model="form.fCname" style="width: 250px" placeholder="请输入简称" />
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="8">
  229. <el-form-item label="英文名称" prop="fEname">
  230. <el-input v-model="form.fEname" style="width: 250px" placeholder="请输入英文名称" />
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="8">
  234. <el-form-item label="电话" prop="fTel">
  235. <el-input v-model="form.fTel" style="width: 250px" placeholder="请输入电话" />
  236. </el-form-item>
  237. </el-col>
  238. </el-row>
  239. <el-row>
  240. <el-col :span="8">
  241. <el-form-item label="传真" prop="fFax">
  242. <el-input v-model="form.fFax" style="width: 250px" placeholder="请输入传真" />
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="8">
  246. <el-form-item label="邮箱" prop="fEmail">
  247. <el-input v-model="form.fEmail" style="width: 250px" placeholder="请输入邮箱" />
  248. </el-form-item>
  249. </el-col>
  250. <el-col :span="8">
  251. <el-form-item label="联系人" prop="fManage">
  252. <el-input v-model="form.fManage" style="width: 250px" placeholder="请输入联系人" />
  253. </el-form-item>
  254. </el-col>
  255. </el-row>
  256. <el-row>
  257. <el-col :span="8">
  258. <el-form-item label="地址" prop="fAddr">
  259. <el-input v-model="form.fAddr" style="width: 250px" placeholder="请输入地址" />
  260. </el-form-item>
  261. </el-col>
  262. <el-col :span="8">
  263. <el-form-item label="英文地址" prop="fEaddr">
  264. <el-input v-model="form.fEaddr" style="width: 250px" placeholder="请输入英文地址" />
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="8">
  268. <el-form-item label="规模" prop="fScale">
  269. <el-input v-model="form.fScale" style="width: 250px" placeholder="请输入规模" />
  270. </el-form-item>
  271. </el-col>
  272. </el-row>
  273. <el-row>
  274. <el-col :span="8">
  275. <el-form-item label="省" prop="fProvince">
  276. <el-input v-model="form.fProvince" style="width: 250px" placeholder="请输入省" />
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="8">
  280. <el-form-item label="市" prop="fCity">
  281. <el-input v-model="form.fCity" style="width: 250px" placeholder="请输入市" />
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="8">
  285. <el-form-item label="结算方式" prop="fStltypeid">
  286. <el-select v-model="form.fStltypeid" style="width: 250px" placeholder="请选择结算表票结、月结">
  287. <el-option
  288. v-for="dict in fStltypeidOptions"
  289. :key="dict.dictValue"
  290. :label="dict.dictLabel"
  291. :value="parseInt(dict.dictValue)"
  292. ></el-option>
  293. </el-select>
  294. </el-form-item>
  295. </el-col>
  296. </el-row>
  297. <el-row>
  298. <el-col :span="8">
  299. <el-form-item label="结费天数" prop="fStldays">
  300. <el-input v-model="form.fStldays" style="width: 250px" placeholder="请输入结费天数" />
  301. </el-form-item>
  302. </el-col>
  303. <el-col :span="8">
  304. <el-form-item label="合同号" prop="fContractno">
  305. <el-input v-model="form.fContractno" style="width: 250px" placeholder="请输入合同号" />
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="8">
  309. <el-form-item label="税号" prop="fTax">
  310. <el-input v-model="form.fTax" style="width: 250px" placeholder="请输入税号" />
  311. </el-form-item>
  312. </el-col>
  313. </el-row>
  314. <el-row>
  315. <el-col :span="8">
  316. <el-form-item label="合同起" prop="fContractb">
  317. <el-date-picker clearable size="small" style="width: 250px"
  318. v-model="form.fContractb"
  319. type="date"
  320. value-format="yyyy-MM-dd"
  321. placeholder="选择合同起">
  322. </el-date-picker>
  323. </el-form-item>
  324. </el-col>
  325. <el-col :span="8">
  326. <el-form-item label="合同至" prop="fContracte">
  327. <el-date-picker clearable size="small" style="width: 250px"
  328. v-model="form.fContracte"
  329. type="date"
  330. value-format="yyyy-MM-dd"
  331. placeholder="选择合同至">
  332. </el-date-picker>
  333. </el-form-item>
  334. </el-col>
  335. <el-col :span="8">
  336. <el-form-item label="开票电话" prop="fInvtel">
  337. <el-input v-model="form.fInvtel" style="width: 250px" placeholder="请输入开票电话" />
  338. </el-form-item>
  339. </el-col>
  340. </el-row>
  341. <el-row>
  342. <el-col :span="8">
  343. <el-form-item label="开票地址" prop="fInvaddr">
  344. <el-input v-model="form.fInvaddr" style="width: 250px" placeholder="请输入开票地址" />
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="8">
  348. <el-form-item label="本位币账号" prop="fBankno" label-width="100">
  349. <el-input v-model="form.fBankno" style="width: 250px" placeholder="请输入本位币账号" />
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="8">
  353. <el-form-item label="本位币银行" label-width="100" prop="fBankname">
  354. <el-input v-model="form.fBankname" style="width: 250px" placeholder="请输入本位币银行" />
  355. </el-form-item>
  356. </el-col>
  357. </el-row>
  358. <el-row>
  359. <el-col :span="8">
  360. <el-form-item label="外币账号" prop="fUbankno">
  361. <el-input v-model="form.fUbankno" style="width: 250px" placeholder="请输入外币账号" />
  362. </el-form-item>
  363. </el-col>
  364. <el-col :span="8">
  365. <el-form-item label="外币银行" prop="fUbankname">
  366. <el-input v-model="form.fUbankname" style="width: 250px" placeholder="请输入外币银行" />
  367. </el-form-item>
  368. </el-col>
  369. <el-col :span="8">
  370. <el-form-item label="状态">
  371. <!--<el-radio-group v-model="form.fStatus">
  372. <el-radio label="1">请选择字典生成</el-radio>
  373. </el-radio-group>-->
  374. <el-radio-group v-model="form.fStatus">
  375. <el-radio
  376. v-for="dict in statusOptions"
  377. :key="dict.dictValue"
  378. :label="dict.dictValue"
  379. >{{dict.dictLabel}}</el-radio>
  380. </el-radio-group>
  381. </el-form-item>
  382. </el-col>
  383. </el-row>
  384. <el-form-item label="备注" prop="remark">
  385. <el-input v-model="form.remark" style="width: 400px" placeholder="请输入备注" />
  386. </el-form-item>
  387. </el-form>
  388. <div >
  389. <el-row :gutter="10" class="mb8">
  390. <el-col :span="1.5">
  391. <el-button
  392. type="primary"
  393. icon="el-icon-plus"
  394. size="mini"
  395. @click="addRow(contactList)"
  396. >添加</el-button>
  397. </el-col>
  398. </el-row>
  399. </div>
  400. <el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange">
  401. <el-table-column label="编号" align="center" prop="fNo" >
  402. <template slot-scope="scope">
  403. <el-input v-model="scope.row.fNo" placeholder="编号" />
  404. </template>
  405. </el-table-column>
  406. <el-table-column label="名称" align="center" prop="fName" >
  407. <template slot-scope="scope">
  408. <el-input v-model="scope.row.fName" placeholder="名称" />
  409. </template>
  410. </el-table-column>
  411. <el-table-column label="英文名称" align="center" prop="fEname">
  412. <template slot-scope="scope">
  413. <el-input v-model="scope.row.fEname" placeholder="英文名称" />
  414. </template>
  415. </el-table-column>
  416. <el-table-column label="电话" align="center" prop="fTel" >
  417. <template slot-scope="scope">
  418. <el-input v-model="scope.row.fTel" placeholder="电话" />
  419. </template>
  420. </el-table-column>
  421. <el-table-column label="状态" align="center" prop="fStatus" >
  422. <template slot-scope="scope">
  423. <el-select
  424. v-model="scope.row.fStatus"
  425. placeholder="状态"
  426. clearable
  427. size="small"
  428. >
  429. <el-option
  430. v-for="dict in statusOptions"
  431. :key="dict.dictValue"
  432. :label="dict.dictLabel"
  433. :value="dict.dictValue"
  434. />
  435. </el-select>
  436. </template>
  437. </el-table-column>
  438. <el-table-column label="备注" align="center" prop="remark" >
  439. <template slot-scope="scope">
  440. <el-input v-model="scope.row.remark" placeholder="备注" />
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
  444. <template slot-scope="scope">
  445. <el-button
  446. size="mini"
  447. type="text"
  448. icon="el-icon-delete"
  449. @click.native.prevent="deleteRow(scope.$index, contactList)"
  450. >删除</el-button>
  451. </template>
  452. </el-table-column>
  453. </el-table>
  454. <div slot="footer" class="dialog-footer">
  455. <el-button type="primary" @click="submitForm">确 定</el-button>
  456. <el-button @click="cancel">取 消</el-button>
  457. </div>
  458. </el-dialog>
  459. </div>
  460. </template>
  461. <script>
  462. import { listCorps, getCorps, delCorps, addCorps, updateCorps, changeCorpsStatus,exportCorps } from "@/api/basicdata/corps";
  463. import {queryUserVal} from "@/api/system/user";
  464. import { isArray } from '@/utils/validate'
  465. import Vue from 'vue'
  466. Vue.directive('dialogDrag', {
  467. bind(el, binding, vnode, oldVnode) {
  468. const dialogHeaderEl = el.querySelector('.el-dialog__header')
  469. const dragDom = el.querySelector('.el-dialog')
  470. const enlarge = el.querySelector('.enlarge')
  471. dialogHeaderEl.style.cursor = 'move'
  472. // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
  473. const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
  474. if(enlarge){
  475. enlarge.onclick = (e) => {
  476. dragDom.style.top = '0px'
  477. dragDom.style.left = '0px'
  478. }
  479. }
  480. dialogHeaderEl.onmousedown = (e) => {
  481. // 鼠标按下,计算当前元素距离可视区的距离
  482. const disX = e.clientX - dialogHeaderEl.offsetLeft
  483. const disY = e.clientY - dialogHeaderEl.offsetTop
  484. // 获取到的值带px 正则匹配替换
  485. let styL, styT
  486. // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
  487. if (sty.left.includes('%')) {
  488. styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
  489. styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
  490. } else {
  491. styL = +sty.left.replace(/\px/g, '')
  492. styT = +sty.top.replace(/\px/g, '')
  493. }
  494. document.onmousemove = function(e) {
  495. // 通过事件委托,计算移动的距离
  496. const l = e.clientX - disX
  497. const t = e.clientY - disY
  498. // 移动当前元素
  499. if ((t + styT) >= 0){
  500. dragDom.style.top = `${t + styT}px`
  501. }
  502. dragDom.style.left = `${l + styL}px`
  503. // 将此时的位置传出去
  504. // binding.value({x:e.pageX,y:e.pageY})
  505. }
  506. document.onmouseup = function(e) {
  507. document.onmousemove = null
  508. document.onmouseup = null
  509. }
  510. }
  511. }
  512. })
  513. export default {
  514. name: "Corps",
  515. components: {
  516. },
  517. data() {
  518. return {
  519. //全屏放大
  520. dialogFull:false,
  521. contactList:[],
  522. // 遮罩层
  523. loading: true,
  524. // 选中数组
  525. ids: [],
  526. // 非单个禁用
  527. single: true,
  528. // 非多个禁用
  529. multiple: true,
  530. // 显示搜索条件
  531. showSearch: true,
  532. // 总条数
  533. total: 0,
  534. // 客户详情表格数据
  535. corpsList: [],
  536. // 弹出层标题
  537. title: "",
  538. // 状态数据字典
  539. statusOptions: [],
  540. // 是否显示弹出层
  541. open: false,
  542. // 客户类别字典
  543. fTypeidOptions: [],
  544. // 结算表票结、月结字典
  545. fStltypeidOptions: [],
  546. // 删除状态字典
  547. delFlagOptions: [],
  548. // 查询参数
  549. queryParams: {
  550. pageNum: 1,
  551. pageSize: 10,
  552. fTypeid: null,
  553. fNo: null,
  554. fName: null,
  555. fCname: null,
  556. fEname: null,
  557. fTel: null,
  558. fFax: null,
  559. fEmail: null,
  560. fManage: null,
  561. fAddr: null,
  562. fEaddr: null,
  563. fScale: null,
  564. fProvince: null,
  565. fCity: null,
  566. fStltypeid: null,
  567. fStldays: null,
  568. fContractno: null,
  569. fContractb: null,
  570. fContracte: null,
  571. fTax: null,
  572. fInvtel: null,
  573. fInvaddr: null,
  574. fBankno: null,
  575. fBankname: null,
  576. fUbankno: null,
  577. fUbankname: null,
  578. fStatus: null,
  579. },
  580. // 表单参数
  581. form: {},
  582. // 表单校验
  583. rules: {
  584. fTypeid: [
  585. { required: true, message: "客户类别不能为空", trigger: "blur" }
  586. ],
  587. fNo: [
  588. { required: true, message: "编号不能为空", trigger: "blur" }
  589. ],
  590. fName: [
  591. { required: true, message: "名称不能为空", trigger: "blur" }
  592. ],
  593. fCname:[
  594. { required: true, message: "简称不能为空", trigger: "blur" }
  595. ],
  596. fStatus: [
  597. { required: true, message: "状态默认 T ,正常T 停用F 下拉选择不能为空", trigger: "blur" }
  598. ],
  599. }
  600. };
  601. },
  602. created() {
  603. this.getList();
  604. this.getDicts("data_customer_category").then(response => {
  605. this.fTypeidOptions = response.data;
  606. });
  607. this.getDicts("data_stltype_type").then(response => {
  608. this.fStltypeidOptions = response.data;
  609. });
  610. this.getDicts("data_delete_state").then(response => {
  611. this.delFlagOptions = response.data;
  612. });
  613. this.getDicts("sys_normal_disable").then(response => {
  614. this.statusOptions = response.data;
  615. });
  616. },
  617. methods: {
  618. full(){
  619. this.dialogFull = !this.dialogFull
  620. },
  621. // 客户类别默认为客户结算方式默认月结
  622. query() {
  623. this.$set(this.form, "fStltypeid", 1);
  624. },
  625. // 添加行
  626. addRow(tableData,event){
  627. var obj = {}
  628. tableData.push(obj)
  629. },
  630. //删除行
  631. deleteRow(index, rows) {
  632. rows.splice(index, 1);
  633. },
  634. /** 查询客户详情列表 */
  635. getList() {
  636. this.loading = true;
  637. listCorps(this.queryParams).then(response => {
  638. this.corpsList = response.rows;
  639. this.total = response.total;
  640. this.loading = false;
  641. });
  642. },
  643. // 客户类别字典翻译
  644. fTypeidFormat(row, column) {
  645. return this.selectDictLabel(this.fTypeidOptions, row.fTypeid);
  646. },
  647. // 结算表票结、月结字典翻译
  648. fStltypeidFormat(row, column) {
  649. return this.selectDictLabel(this.fStltypeidOptions, row.fStltypeid);
  650. },
  651. // 删除状态字典翻译
  652. delFlagFormat(row, column) {
  653. return this.selectDictLabel(this.delFlagOptions, row.delFlag);
  654. },
  655. // 取消按钮
  656. cancel() {
  657. this.open = false;
  658. this.reset();
  659. },
  660. // 表单重置
  661. reset() {
  662. this.form = {
  663. fId: null,
  664. fTypeid: null,
  665. fNo: null,
  666. fName: null,
  667. fCname: null,
  668. fEname: null,
  669. fTel: null,
  670. fFax: null,
  671. fEmail: null,
  672. fManage: null,
  673. fAddr: null,
  674. fEaddr: null,
  675. fScale: null,
  676. fProvince: null,
  677. fCity: null,
  678. fStltypeid: null,
  679. fStldays: null,
  680. fContractno: null,
  681. fContractb: null,
  682. fContracte: null,
  683. fTax: null,
  684. fInvtel: null,
  685. fInvaddr: null,
  686. fBankno: null,
  687. fBankname: null,
  688. fUbankno: null,
  689. fUbankname: null,
  690. fStatus: null,
  691. delFlag: null,
  692. createBy: null,
  693. createTime: null,
  694. updateBy: null,
  695. updateTime: null,
  696. remark: null
  697. };
  698. this.resetForm("form");
  699. },
  700. // 从表重置
  701. contList() {
  702. this.contactList = []
  703. },
  704. // 状态修改
  705. handleStatusChange(row) {
  706. let text = row.fStatus === "0" ? "启用" : "停用";
  707. this.$confirm('确认要"' + text + '""' + row.fName + '"吗?', "警告", {
  708. confirmButtonText: "确定",
  709. cancelButtonText: "取消",
  710. type: "warning"
  711. }).then(function() {
  712. return changeCorpsStatus(row.fId, row.fStatus);
  713. }).then(() => {
  714. this.msgSuccess(text + "成功");
  715. }).catch(function() {
  716. row.fStatus = row.fStatus === "0" ? "1" : "0";
  717. });
  718. },
  719. /** 搜索按钮操作 */
  720. handleQuery() {
  721. this.queryParams.pageNum = 1;
  722. this.getList();
  723. },
  724. /** 重置按钮操作 */
  725. resetQuery() {
  726. this.resetForm("queryForm");
  727. this.handleQuery();
  728. },
  729. // 多选框选中数据
  730. handleSelectionChange(selection) {
  731. this.ids = selection.map(item => item.fId)
  732. this.single = selection.length!==1
  733. this.multiple = !selection.length
  734. },
  735. /** 新增按钮操作 */
  736. handleAdd() {
  737. this.reset();
  738. this.query();
  739. this.contList();
  740. this.open = true;
  741. this.title = "添加客户详情";
  742. },
  743. /** 修改按钮操作 */
  744. handleUpdate(row) {
  745. this.reset();
  746. const fId = row.fId || this.ids
  747. getCorps(fId).then(response => {
  748. this.form = response.data["corp"];
  749. var contactList1=response.data["customerContact"];
  750. this.form.fTypeid = this.form.fTypeid.replace(/\[|]/g,'').replace(/\"/g, "").split(",")
  751. if(contactList1!=null){
  752. this.contactList=contactList1;
  753. }else {
  754. this.query();
  755. }
  756. this.open = true;
  757. this.title = "修改客户详情";
  758. });
  759. },
  760. /** 提交按钮 */
  761. submitForm() {
  762. this.form.fTypename = ''
  763. this.$refs["form"].validate(valid => {
  764. if (valid) {
  765. if (this.form.fId != null) {
  766. let formDate= new FormData()
  767. for (let index in this.fTypeidOptions){
  768. for (let item in this.form.fTypeid){
  769. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  770. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  771. }
  772. }
  773. }
  774. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  775. formDate.append('corps',JSON.stringify(this.form));
  776. formDate.append('customerContacts',JSON.stringify(this.contactList));
  777. addCorps(formDate).then(response => {
  778. this.msgSuccess("修改成功");
  779. this.open = false;
  780. this.getList();
  781. });
  782. } else {
  783. let formDate= new FormData()
  784. for (let index in this.fTypeidOptions){
  785. for (let item in this.form.fTypeid){
  786. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  787. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  788. }
  789. }
  790. }
  791. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  792. formDate.append('corps',JSON.stringify(this.form));
  793. formDate.append('customerContacts',JSON.stringify(this.contactList));
  794. addCorps(formDate).then(response => {
  795. this.msgSuccess("新增成功");
  796. this.open = false;
  797. this.getList();
  798. });
  799. }
  800. }
  801. });
  802. },
  803. /** 删除按钮操作 */
  804. handleDelete(row) {
  805. const fIds = row.fId || this.ids;
  806. this.$confirm('是否确认删除客户详情编号为"' + fIds + '"的数据项?', "警告", {
  807. confirmButtonText: "确定",
  808. cancelButtonText: "取消",
  809. type: "warning"
  810. }).then(function() {
  811. return delCorps(fIds);
  812. }).then(() => {
  813. this.getList();
  814. this.msgSuccess("删除成功");
  815. })
  816. },
  817. /** 导出按钮操作 */
  818. handleExport() {
  819. const queryParams = this.queryParams;
  820. this.$confirm('是否确认导出所有客户详情数据项?', "警告", {
  821. confirmButtonText: "确定",
  822. cancelButtonText: "取消",
  823. type: "warning"
  824. }).then(function() {
  825. return exportCorps(queryParams);
  826. }).then(response => {
  827. this.download(response.msg);
  828. })
  829. }
  830. }
  831. };
  832. </script>
  833. <style lang="scss">
  834. .avue-crud__dialog__header {
  835. display: -webkit-box;
  836. display: -ms-flexbox;
  837. display: flex;
  838. -webkit-box-align: center;
  839. -ms-flex-align: center;
  840. align-items: center;
  841. -webkit-box-pack: justify;
  842. -ms-flex-pack: justify;
  843. justify-content: space-between;
  844. }
  845. .el-dialog__title {
  846. color: rgba(0,0,0,.85);
  847. font-weight: 500;
  848. word-wrap: break-word;
  849. }
  850. .avue-crud__dialog__menu {
  851. padding-right: 20px;
  852. float: left;
  853. }
  854. .avue-crud__dialog__menu i {
  855. color: #909399;
  856. font-size: 15px;
  857. }
  858. .el-icon-full-screen{
  859. cursor: pointer;
  860. }
  861. .el-icon-full-screen:before {
  862. content: "\e719";
  863. }
  864. </style>