index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item label="客户类别" prop="fTypeid">
  11. <el-select
  12. style="width: 250px"
  13. v-model="queryParams.fTypeid"
  14. placeholder="请选择客户类别"
  15. clearable
  16. size="small"
  17. >
  18. <el-option
  19. v-for="(dict,index) in fTypeidOptions"
  20. :key="index.dictValue"
  21. :label="dict.dictLabel"
  22. :value="dict.dictValue"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="编号" prop="fNo">
  27. <el-input
  28. v-model="queryParams.fNo"
  29. style="width: 250px"
  30. placeholder="请输入编号"
  31. clearable
  32. size="small"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="名称" prop="fName">
  37. <el-input
  38. v-model="queryParams.fName"
  39. style="width: 250px"
  40. placeholder="请输入名称"
  41. clearable
  42. size="small"
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item label="电话" prop="fTel">
  47. <el-input
  48. v-model="queryParams.fTel"
  49. style="width: 250px"
  50. placeholder="请输入电话"
  51. clearable
  52. size="small"
  53. @keyup.enter.native="handleQuery"
  54. />
  55. </el-form-item>
  56. <el-form-item label="状态" prop="fStatus">
  57. <el-select
  58. v-model="queryParams.fStatus"
  59. placeholder="客户状态"
  60. clearable
  61. size="small"
  62. style="width: 250px"
  63. >
  64. <el-option
  65. v-for="(dict,index) in statusOptions"
  66. :key="index.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button
  74. type="cyan"
  75. icon="el-icon-search"
  76. size="mini"
  77. @click="handleQuery"
  78. >搜索</el-button
  79. >
  80. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  81. >重置</el-button
  82. >
  83. </el-form-item>
  84. </el-form>
  85. <el-row :gutter="10" class="mb8">
  86. <el-col :span="1.5">
  87. <el-button
  88. type="primary"
  89. icon="el-icon-plus"
  90. size="mini"
  91. @click="handleAdd"
  92. v-hasPermi="['basicdata:corps:add']"
  93. >新增</el-button
  94. >
  95. </el-col>
  96. <el-col :span="1.5">
  97. <el-button
  98. type="success"
  99. icon="el-icon-edit"
  100. size="mini"
  101. :disabled="single"
  102. @click="handleUpdate"
  103. v-hasPermi="['basicdata:corps:edit']"
  104. >修改</el-button
  105. >
  106. </el-col>
  107. <el-col :span="1.5">
  108. <el-button
  109. type="danger"
  110. icon="el-icon-delete"
  111. size="mini"
  112. :disabled="multiple"
  113. @click="handleDelete"
  114. v-hasPermi="['basicdata:corps:remove']"
  115. >删除</el-button
  116. >
  117. </el-col>
  118. <el-col :span="1.5">
  119. <el-button
  120. type="warning"
  121. icon="el-icon-download"
  122. size="mini"
  123. @click="handleExport"
  124. v-hasPermi="['basicdata:corps:export']"
  125. >导出</el-button
  126. >
  127. </el-col>
  128. <div class="tabSetting">
  129. <right-toolbar
  130. :showSearch.sync="showSearch"
  131. @queryTable="getList"
  132. ></right-toolbar>
  133. <div style="margin: 0 12px">
  134. <el-tooltip
  135. class="item"
  136. effect="dark"
  137. content="列设置"
  138. placement="top"
  139. >
  140. <el-button
  141. icon="el-icon-setting"
  142. size="mini"
  143. circle
  144. @click="showSetting = !showSetting"
  145. ></el-button>
  146. </el-tooltip>
  147. </div>
  148. </div>
  149. </el-row>
  150. <el-dialog title="自定义列显示" :visible.sync="showSetting" width="700px">
  151. <div>配置排序列数据(拖动调整顺序)</div>
  152. <div style="margin-left: 17px">
  153. <el-checkbox
  154. v-model="allCheck"
  155. label="全选"
  156. @change="allChecked"
  157. ></el-checkbox>
  158. </div>
  159. <div style="padding: 4px; display: flex; justify-content: center">
  160. <draggable
  161. v-model="setRowList"
  162. group="site"
  163. animation="300"
  164. @start="onStart"
  165. @end="onEnd"
  166. handle=".indraggable"
  167. >
  168. <transition-group>
  169. <div
  170. v-for="item in setRowList"
  171. :key="item.surface"
  172. class="listStyle"
  173. >
  174. <div style="width: 500px" class="indraggable">
  175. <div class="progress" :style="{ width: item.width + 'px' }">
  176. <el-checkbox
  177. :label="item.name"
  178. v-model="item.checked"
  179. :true-label="0"
  180. :false-label="1"
  181. >{{ item.name }}
  182. </el-checkbox>
  183. </div>
  184. </div>
  185. <el-input-number
  186. v-model.number="item.width"
  187. controls-position="right"
  188. :min="1"
  189. :max="500"
  190. size="mini"
  191. ></el-input-number>
  192. </div>
  193. </transition-group>
  194. </draggable>
  195. </div>
  196. <span slot="footer" class="dialog-footer">
  197. <el-button @click="showSetting = false">取 消</el-button>
  198. <el-button @click="delRow" type="danger">重 置</el-button>
  199. <el-button type="primary" @click="save()">确 定</el-button>
  200. </span>
  201. </el-dialog>
  202. <el-table
  203. v-loading="loading"
  204. :data="corpsList"
  205. @selection-change="handleSelectionChange"
  206. >
  207. <el-table-column type="selection" width="55" align="center" />
  208. <el-table-column
  209. v-for="(item, index) in getRowList"
  210. :key="index"
  211. :label="item.name"
  212. :width="item.width"
  213. :prop="item.label"
  214. align="center"
  215. :fixed="item.fixed"
  216. :show-overflow-tooltip="true"
  217. sortable
  218. />
  219. <!-- <el-table-column
  220. :show-overflow-tooltip="true"
  221. label="客户类别"
  222. align="center"
  223. prop="fTypename"
  224. />
  225. <el-table-column label="编号" align="center" prop="fNo" />
  226. <el-table-column
  227. :show-overflow-tooltip="true"
  228. label="名称"
  229. align="center"
  230. prop="fName"
  231. width="260px"
  232. />
  233. <el-table-column
  234. :show-overflow-tooltip="true"
  235. label="简称"
  236. align="center"
  237. width="200px"
  238. prop="fCname"
  239. />
  240. <el-table-column
  241. :show-overflow-tooltip="true"
  242. label="英文名称"
  243. align="center"
  244. prop="fEname"
  245. />
  246. <el-table-column
  247. :show-overflow-tooltip="true"
  248. label="电话"
  249. align="center"
  250. prop="fTel"
  251. />
  252. <el-table-column label="录入人" align="center" prop="createBy" />
  253. <el-table-column
  254. label="录入时间"
  255. align="center"
  256. prop="createTime"
  257. width="180"
  258. >
  259. <template slot-scope="scope">
  260. <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
  261. </template>
  262. </el-table-column>
  263. <el-table-column label="修改人" align="center" prop="updateBy" />
  264. <el-table-column
  265. label="修改时间"
  266. align="center"
  267. prop="updateTime"
  268. width="180"
  269. >
  270. <template slot-scope="scope">
  271. <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
  272. </template>
  273. </el-table-column> -->
  274. <el-table-column label="状态" align="center" prop="fStatus">
  275. <template slot-scope="scope">
  276. <el-switch
  277. v-model="scope.row.fStatus"
  278. active-value="0"
  279. inactive-value="1"
  280. v-hasPermi="['basicdata:corps:edit']"
  281. @change="handleStatusChange(scope.row)"
  282. ></el-switch>
  283. </template>
  284. </el-table-column>
  285. <el-table-column
  286. label="备注"
  287. align="center"
  288. prop="remark"
  289. :show-overflow-tooltip="true"
  290. />
  291. <el-table-column
  292. label="操作"
  293. align="center"
  294. class-name="small-padding fixed-width"
  295. width="150"
  296. fixed="right"
  297. >
  298. <template slot-scope="scope">
  299. <el-button
  300. size="mini"
  301. type="text"
  302. icon="el-icon-edit"
  303. @click="handleUpdate(scope.row)"
  304. v-hasPermi="['basicdata:corps:edit']"
  305. >修改</el-button
  306. >
  307. <el-button
  308. size="mini"
  309. type="text"
  310. icon="el-icon-delete"
  311. @click="handleDelete(scope.row)"
  312. v-hasPermi="['basicdata:corps:remove']"
  313. >删除</el-button
  314. >
  315. </template>
  316. </el-table-column>
  317. </el-table>
  318. <pagination
  319. v-show="total > 0"
  320. :total="total"
  321. :page.sync="queryParams.pageNum"
  322. :limit.sync="queryParams.pageSize"
  323. @pagination="getList"
  324. />
  325. <!-- 添加或修改客户详情对话框 -->
  326. <el-dialog
  327. v-dialogDrag
  328. :fullscreen="dialogFull"
  329. :title="title"
  330. :visible.sync="open"
  331. width="80%"
  332. :close-on-click-modal="false"
  333. append-to-body
  334. >
  335. <template slot="title">
  336. <div class="avue-crud__dialog__header">
  337. <span class="el-dialog__title">
  338. <span
  339. style="
  340. display: inline-block;
  341. width: 3px;
  342. height: 20px;
  343. margin-right: 5px;
  344. float: left;
  345. margin-top: 2px;
  346. "
  347. ></span>
  348. 添加客户详情
  349. </span>
  350. <div class="avue-crud__dialog__menu enlarge" @click="full">
  351. <i
  352. style="
  353. cursor: pointer;
  354. display: block;
  355. width: 12px;
  356. height: 12px;
  357. border: 1px solid #909399;
  358. border-top: 3px solid #909399;
  359. margin-top: -3px;
  360. "
  361. ></i>
  362. </div>
  363. </div>
  364. </template>
  365. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  366. <el-row>
  367. <el-col :span="8">
  368. <el-form-item label="客户类别" prop="fTypeid">
  369. <el-select
  370. style="width: 250px"
  371. v-model="form.fTypeid"
  372. :multiple="true"
  373. placeholder="请选择客户类别"
  374. :disabled="disCorps"
  375. >
  376. <el-option
  377. v-for="(dict,index) in fTypeidOptions"
  378. :key="index.dictValue"
  379. :label="dict.dictLabel"
  380. :value="dict.dictValue"
  381. ></el-option>
  382. </el-select>
  383. </el-form-item>
  384. </el-col>
  385. <el-col :span="8">
  386. <el-form-item label="编号" prop="fNo">
  387. <el-input
  388. v-model="form.fNo"
  389. style="width: 250px"
  390. placeholder="请输入编号"
  391. />
  392. </el-form-item>
  393. </el-col>
  394. <el-col :span="8">
  395. <el-form-item label="名称" prop="fName">
  396. <el-input
  397. v-model="form.fName"
  398. style="width: 250px"
  399. placeholder="请输入名称"
  400. />
  401. </el-form-item>
  402. </el-col>
  403. </el-row>
  404. <el-row>
  405. <el-col :span="8">
  406. <el-form-item label="简称" prop="fCname">
  407. <el-input
  408. v-model="form.fCname"
  409. style="width: 250px"
  410. placeholder="请输入简称"
  411. />
  412. </el-form-item>
  413. </el-col>
  414. <el-col :span="8">
  415. <el-form-item label="电话" prop="fTel">
  416. <el-input
  417. v-model="form.fTel"
  418. style="width: 250px"
  419. placeholder="请输入电话"
  420. />
  421. </el-form-item>
  422. </el-col>
  423. <el-col :span="8">
  424. <el-form-item label="*归属部门" prop="deptId">
  425. <treeselect
  426. :multiple="true"
  427. :options="deptOptions"
  428. placeholder="请选择归属部门"
  429. v-model="form.deptId"
  430. style="width: 250px; line-height: 20px"
  431. />
  432. </el-form-item>
  433. <!-- <treeselect-value :value="treevalue" /> -->
  434. </el-col>
  435. </el-row>
  436. <el-row>
  437. <div style="display: flex; justify-content: flex-end">
  438. <el-button style="margin: 10px" @click="showForm = !showForm"
  439. >{{ showForm ? "隐藏" : "更多" }}
  440. </el-button>
  441. </div>
  442. </el-row>
  443. <div v-if="showForm">
  444. <el-row>
  445. <el-col :span="8">
  446. <el-form-item label="英文名称" prop="fEname">
  447. <el-input
  448. v-model="form.fEname"
  449. style="width: 250px"
  450. placeholder="请输入英文名称"
  451. />
  452. </el-form-item>
  453. </el-col>
  454. <el-col :span="8">
  455. <el-form-item label="邮箱" prop="fEmail">
  456. <el-input
  457. v-model="form.fEmail"
  458. style="width: 250px"
  459. placeholder="请输入邮箱"
  460. />
  461. </el-form-item>
  462. </el-col>
  463. <el-col :span="8">
  464. <el-form-item label="联系人" prop="fManage">
  465. <el-input
  466. v-model="form.fManage"
  467. style="width: 250px"
  468. placeholder="请输入联系人"
  469. />
  470. </el-form-item>
  471. </el-col>
  472. </el-row>
  473. <el-row>
  474. <el-col :span="8">
  475. <el-form-item label="传真" prop="fFax">
  476. <el-input
  477. v-model="form.fFax"
  478. style="width: 250px"
  479. placeholder="请输入传真"
  480. />
  481. </el-form-item>
  482. </el-col>
  483. <el-col :span="8">
  484. <el-form-item label="地址" prop="fAddr">
  485. <el-input
  486. v-model="form.fAddr"
  487. style="width: 250px"
  488. placeholder="请输入地址"
  489. />
  490. </el-form-item>
  491. </el-col>
  492. <el-col :span="8">
  493. <el-form-item label="英文地址" prop="fEaddr">
  494. <el-input
  495. v-model="form.fEaddr"
  496. style="width: 250px"
  497. placeholder="请输入英文地址"
  498. />
  499. </el-form-item>
  500. </el-col>
  501. </el-row>
  502. <el-row>
  503. <el-col :span="8">
  504. <el-form-item label="规模" prop="fScale">
  505. <el-input
  506. v-model="form.fScale"
  507. style="width: 250px"
  508. placeholder="请输入规模"
  509. />
  510. </el-form-item>
  511. </el-col>
  512. <el-col :span="8">
  513. <el-form-item label="省" prop="fProvince">
  514. <el-input
  515. v-model="form.fProvince"
  516. style="width: 250px"
  517. placeholder="请输入省"
  518. />
  519. </el-form-item>
  520. </el-col>
  521. <el-col :span="8">
  522. <el-form-item label="市" prop="fCity">
  523. <el-input
  524. v-model="form.fCity"
  525. style="width: 250px"
  526. placeholder="请输入市"
  527. />
  528. </el-form-item>
  529. </el-col>
  530. </el-row>
  531. <el-row>
  532. <el-col :span="8">
  533. <el-form-item label="结算方式" prop="fStltypeid">
  534. <el-select
  535. v-model="form.fStltypeid"
  536. style="width: 250px"
  537. placeholder="请选择结算表票结、月结"
  538. >
  539. <el-option
  540. v-for="(dict,index) in fStltypeidOptions"
  541. :key="index.dictValue"
  542. :label="dict.dictLabel"
  543. :value="parseInt(dict.dictValue)"
  544. ></el-option>
  545. </el-select>
  546. </el-form-item>
  547. </el-col>
  548. <el-col :span="8">
  549. <el-form-item label="结费天数" prop="fStldays">
  550. <el-input
  551. v-model="form.fStldays"
  552. style="width: 250px"
  553. placeholder="请输入结费天数"
  554. />
  555. </el-form-item>
  556. </el-col>
  557. <el-col :span="8">
  558. <el-form-item label="税号" prop="fTax">
  559. <el-input
  560. v-model="form.fTax"
  561. style="width: 250px"
  562. placeholder="请输入税号"
  563. />
  564. </el-form-item>
  565. </el-col>
  566. </el-row>
  567. <el-row>
  568. <el-col :span="8">
  569. <el-form-item label="合同号" prop="fContractno">
  570. <el-input
  571. v-model="form.fContractno"
  572. style="width: 250px"
  573. placeholder="请输入合同号"
  574. />
  575. </el-form-item>
  576. </el-col>
  577. <el-col :span="8">
  578. <el-form-item label="合同起" prop="fContractb">
  579. <el-date-picker
  580. clearable
  581. size="small"
  582. style="width: 250px"
  583. v-model="form.fContractb"
  584. type="date"
  585. value-format="yyyy-MM-dd"
  586. placeholder="选择合同起"
  587. >
  588. </el-date-picker>
  589. </el-form-item>
  590. </el-col>
  591. <el-col :span="8">
  592. <el-form-item label="合同至" prop="fContracte">
  593. <el-date-picker
  594. clearable
  595. size="small"
  596. style="width: 250px"
  597. v-model="form.fContracte"
  598. type="date"
  599. value-format="yyyy-MM-dd"
  600. placeholder="选择合同至"
  601. >
  602. </el-date-picker>
  603. </el-form-item>
  604. </el-col>
  605. </el-row>
  606. <el-row>
  607. <el-col :span="8">
  608. <el-form-item label="开票电话" prop="fInvtel">
  609. <el-input
  610. v-model="form.fInvtel"
  611. style="width: 250px"
  612. placeholder="请输入开票电话"
  613. />
  614. </el-form-item>
  615. </el-col>
  616. <el-col :span="8">
  617. <el-form-item label="开票地址" prop="fInvaddr">
  618. <el-input
  619. v-model="form.fInvaddr"
  620. style="width: 250px"
  621. placeholder="请输入开票地址"
  622. />
  623. </el-form-item>
  624. </el-col>
  625. <el-col :span="8">
  626. <el-form-item label="本位币账号" prop="fBankno" label-width="100">
  627. <el-input
  628. v-model="form.fBankno"
  629. style="width: 250px"
  630. placeholder="请输入本位币账号"
  631. />
  632. </el-form-item>
  633. </el-col>
  634. </el-row>
  635. <el-row>
  636. <el-col :span="8">
  637. <el-form-item
  638. label="本位币银行"
  639. label-width="100"
  640. prop="fBankname"
  641. >
  642. <el-input
  643. v-model="form.fBankname"
  644. style="width: 250px"
  645. placeholder="请输入本位币银行"
  646. />
  647. </el-form-item>
  648. </el-col>
  649. <el-col :span="8">
  650. <el-form-item label="外币账号" prop="fUbankno">
  651. <el-input
  652. v-model="form.fUbankno"
  653. style="width: 250px"
  654. placeholder="请输入外币账号"
  655. />
  656. </el-form-item>
  657. </el-col>
  658. <el-col :span="8">
  659. <el-form-item label="外币银行" prop="fUbankname">
  660. <el-input
  661. v-model="form.fUbankname"
  662. style="width: 250px"
  663. placeholder="请输入外币银行"
  664. />
  665. </el-form-item>
  666. </el-col>
  667. <el-col :span="8">
  668. <el-form-item label="状态">
  669. <!--<el-radio-group v-model="form.fStatus">
  670. <el-radio label="1">请选择字典生成</el-radio>
  671. </el-radio-group>-->
  672. <el-radio-group v-model="form.fStatus">
  673. <el-radio
  674. v-for="(dict,index) in statusOptions"
  675. :key="index.dictValue"
  676. :label="dict.dictValue"
  677. >{{ dict.dictLabel }}</el-radio
  678. >
  679. </el-radio-group>
  680. </el-form-item>
  681. </el-col>
  682. </el-row>
  683. <el-form-item label="备注" prop="remark">
  684. <el-input
  685. v-model="form.remark"
  686. style="width: 400px"
  687. placeholder="请输入备注"
  688. />
  689. </el-form-item>
  690. </div>
  691. </el-form>
  692. <div>
  693. <el-row :gutter="10" class="mb8">
  694. <el-col :span="1.5">
  695. <el-button
  696. type="primary"
  697. icon="el-icon-plus"
  698. size="mini"
  699. @click="addRow(contactList)"
  700. >添加</el-button
  701. >
  702. </el-col>
  703. </el-row>
  704. </div>
  705. <el-table
  706. v-loading="loading"
  707. :data="contactList"
  708. @selection-change="handleSelectionChange"
  709. >
  710. <el-table-column label="编号" align="center" prop="fNo">
  711. <template slot-scope="scope">
  712. <el-input v-model="scope.row.fNo" placeholder="编号" />
  713. </template>
  714. </el-table-column>
  715. <el-table-column label="昵称" align="center" prop="fName">
  716. <template slot-scope="scope">
  717. <el-input v-model="scope.row.fName" placeholder="昵称" />
  718. </template>
  719. </el-table-column>
  720. <el-table-column label="英文名称" align="center" prop="fEname">
  721. <template slot-scope="scope">
  722. <el-input v-model="scope.row.fEname" placeholder="英文名称" />
  723. </template>
  724. </el-table-column>
  725. <el-table-column label="用户名称/密码" align="center" prop="fTel">
  726. <template slot-scope="scope">
  727. <el-input v-model="scope.row.fTel" placeholder="用户名称/密码"/>
  728. </template>
  729. </el-table-column>
  730. <el-table-column label="状态" align="center" prop="fStatus">
  731. <template slot-scope="scope">
  732. <el-select
  733. v-model="scope.row.fStatus"
  734. placeholder="状态"
  735. clearable
  736. size="small"
  737. >
  738. <el-option
  739. v-for="(dict,index) in statusOptions"
  740. :key="index.dictValue"
  741. :label="dict.dictLabel"
  742. :value="dict.dictValue"
  743. />
  744. </el-select>
  745. </template>
  746. </el-table-column>
  747. <el-table-column label="备注" align="center" prop="remark">
  748. <template slot-scope="scope">
  749. <el-input v-model="scope.row.remark" placeholder="备注" />
  750. </template>
  751. </el-table-column>
  752. <el-table-column
  753. label="操作"
  754. align="center"
  755. class-name="small-padding fixed-width"
  756. width="100"
  757. >
  758. <template slot-scope="scope">
  759. <el-button
  760. size="mini"
  761. type="text"
  762. icon="el-icon-delete"
  763. @click.native.prevent="deleteRow(scope.$index, contactList)"
  764. >删除</el-button
  765. >
  766. </template>
  767. </el-table-column>
  768. </el-table>
  769. <up-load
  770. :relevantAttachments="relevantAttachments"
  771. :createBy="username"
  772. ></up-load>
  773. <div slot="footer" class="dialog-footer">
  774. <el-button type="primary" @click="submitForm">确 定</el-button>
  775. <el-button @click="cancel">取 消</el-button>
  776. </div>
  777. </el-dialog>
  778. </div>
  779. </template>
  780. <script>
  781. import {
  782. listCorps,
  783. getCorps,
  784. delCorps,
  785. addCorps,
  786. updateCorps,
  787. changeCorpsStatus,
  788. exportCorps,
  789. } from "@/api/basicdata/corps";
  790. import { queryUserVal } from "@/api/system/user";
  791. import { isArray } from "@/utils/validate";
  792. import { addSet, select, resetModule } from "@/api/system/set";
  793. import Cookies from "js-cookie";
  794. import draggable from "vuedraggable";
  795. import { treeselect } from "@/api/system/dept";
  796. import upLoad from "@/views/Warehousing/components/upLoad";
  797. import Treeselect from "@riophae/vue-treeselect";
  798. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  799. import Vue from "vue";
  800. Vue.directive("dialogDrag", {
  801. bind(el, binding, vnode, oldVnode) {
  802. const dialogHeaderEl = el.querySelector(".el-dialog__header");
  803. const dragDom = el.querySelector(".el-dialog");
  804. const enlarge = el.querySelector(".enlarge");
  805. dialogHeaderEl.style.cursor = "move";
  806. // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
  807. const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
  808. if (enlarge) {
  809. enlarge.onclick = (e) => {
  810. dragDom.style.top = "0px";
  811. dragDom.style.left = "0px";
  812. };
  813. }
  814. dialogHeaderEl.onmousedown = (e) => {
  815. // 鼠标按下,计算当前元素距离可视区的距离
  816. const disX = e.clientX - dialogHeaderEl.offsetLeft;
  817. const disY = e.clientY - dialogHeaderEl.offsetTop;
  818. // 获取到的值带px 正则匹配替换
  819. let styL, styT;
  820. // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
  821. if (sty.left.includes("%")) {
  822. styL =
  823. +document.body.clientWidth * (+sty.left.replace(/\%/g, "") / 100);
  824. styT =
  825. +document.body.clientHeight * (+sty.top.replace(/\%/g, "") / 100);
  826. } else {
  827. styL = +sty.left.replace(/\px/g, "");
  828. styT = +sty.top.replace(/\px/g, "");
  829. }
  830. document.onmousemove = function (e) {
  831. // 通过事件委托,计算移动的距离
  832. const l = e.clientX - disX;
  833. const t = e.clientY - disY;
  834. // 移动当前元素
  835. if (t + styT >= 0) {
  836. dragDom.style.top = `${t + styT}px`;
  837. }
  838. dragDom.style.left = `${l + styL}px`;
  839. // 将此时的位置传出去
  840. // binding.value({x:e.pageX,y:e.pageY})
  841. };
  842. document.onmouseup = function (e) {
  843. document.onmousemove = null;
  844. document.onmouseup = null;
  845. };
  846. };
  847. },
  848. });
  849. export default {
  850. name: "Corps",
  851. components: { draggable, Treeselect, upLoad },
  852. data() {
  853. return {
  854. treevalue: null,
  855. deptOptions: null,
  856. disCorps: false,
  857. //全屏放大
  858. dialogFull: false,
  859. contactList: [],
  860. // 遮罩层
  861. loading: true,
  862. // 选中数组
  863. ids: [],
  864. // 非单个禁用
  865. single: true,
  866. // 非多个禁用
  867. multiple: true,
  868. // 显示搜索条件
  869. showSearch: true,
  870. // 总条数
  871. total: 0,
  872. // 客户详情表格数据
  873. corpsList: [],
  874. // 弹出层标题
  875. title: "",
  876. // 状态数据字典
  877. statusOptions: [],
  878. // 是否显示弹出层
  879. open: false,
  880. // 客户类别字典
  881. fTypeidOptions: [],
  882. // 结算表票结、月结字典
  883. fStltypeidOptions: [],
  884. // 删除状态字典
  885. delFlagOptions: [],
  886. // 查询参数
  887. queryParams: {
  888. pageNum: 1,
  889. pageSize: 10,
  890. fTypeid: null,
  891. fNo: null,
  892. fName: null,
  893. fCname: null,
  894. fEname: null,
  895. fTel: null,
  896. fFax: null,
  897. fEmail: null,
  898. fManage: null,
  899. fAddr: null,
  900. fEaddr: null,
  901. fScale: null,
  902. fProvince: null,
  903. fCity: null,
  904. fStltypeid: null,
  905. fStldays: null,
  906. fContractno: null,
  907. fContractb: null,
  908. fContracte: null,
  909. fTax: null,
  910. fInvtel: null,
  911. fInvaddr: null,
  912. fBankno: null,
  913. fBankname: null,
  914. fUbankno: null,
  915. fUbankname: null,
  916. fStatus: null,
  917. },
  918. // 表单参数
  919. form: {},
  920. // 表单校验
  921. rules: {
  922. fTypeid: [
  923. { required: true, message: "客户类别不能为空", trigger: "blur" },
  924. ],
  925. fNo: [{ required: true, message: "编号不能为空", trigger: "blur" }],
  926. fName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
  927. fCname: [{ required: true, message: "简称不能为空", trigger: "blur" }],
  928. fStatus: [
  929. {
  930. required: true,
  931. message: "状态默认 T ,正常T 停用F 下拉选择不能为空",
  932. trigger: "blur",
  933. },
  934. ],
  935. },
  936. showSetting: false,
  937. drag: false,
  938. setRowList: [],
  939. getRowList: [],
  940. tableDate: [
  941. {
  942. surface: "1",
  943. label: "fTypename",
  944. name: "客户类别",
  945. checked: 0,
  946. width: 100,
  947. },
  948. {
  949. surface: "2",
  950. label: "fNo",
  951. name: "编号",
  952. checked: 0,
  953. width: 100,
  954. },
  955. {
  956. surface: "3",
  957. label: "fName",
  958. name: "名称",
  959. checked: 0,
  960. width: 100,
  961. },
  962. {
  963. surface: "4",
  964. label: "fCname",
  965. name: "简称",
  966. checked: 0,
  967. width: 100,
  968. },
  969. {
  970. surface: "5",
  971. label: "fEname",
  972. name: "英文名称",
  973. checked: 0,
  974. width: 100,
  975. },
  976. {
  977. surface: "6",
  978. label: "fTel",
  979. name: "电话",
  980. checked: 0,
  981. width: 100,
  982. },
  983. {
  984. surface: "7",
  985. label: "createBy",
  986. name: "录入人",
  987. checked: 0,
  988. width: 100,
  989. },
  990. {
  991. surface: "8",
  992. label: "createTime",
  993. name: "录入时间",
  994. checked: 0,
  995. width: 100,
  996. },
  997. {
  998. surface: "9",
  999. label: "updateBy",
  1000. name: "修改人",
  1001. checked: 0,
  1002. width: 100,
  1003. },
  1004. {
  1005. surface: "10",
  1006. label: "updateTime",
  1007. name: "修改时间",
  1008. checked: 0,
  1009. width: 100,
  1010. },
  1011. {
  1012. surface: "11",
  1013. label: "sendTime",
  1014. name: "提交日期",
  1015. checked: 0,
  1016. width: 100,
  1017. },
  1018. ],
  1019. allCheck: false,
  1020. showForm: false,
  1021. relevantAttachments: [],
  1022. username:null,
  1023. };
  1024. },
  1025. created() {
  1026. this.setRowList = this.tableDate;
  1027. this.getRowList = this.tableDate;
  1028. this.getList();
  1029. this.getDicts("data_customer_category").then((response) => {
  1030. this.fTypeidOptions = response.data;
  1031. });
  1032. this.getDicts("data_stltype_type").then((response) => {
  1033. this.fStltypeidOptions = response.data;
  1034. });
  1035. this.getDicts("data_delete_state").then((response) => {
  1036. this.delFlagOptions = response.data;
  1037. });
  1038. this.getDicts("sys_normal_disable").then((response) => {
  1039. this.statusOptions = response.data;
  1040. });
  1041. this.getRow();
  1042. this.getTreeselect();
  1043. this.username = Cookies.get("userName");
  1044. },
  1045. methods: {
  1046. getTreeselect() {
  1047. treeselect().then((response) => {
  1048. this.deptOptions = response.data;
  1049. });
  1050. },
  1051. //列设置全选
  1052. allChecked() {
  1053. if (this.allCheck == true) {
  1054. this.setRowList.map((e) => {
  1055. return (e.checked = 0);
  1056. });
  1057. } else {
  1058. this.setRowList.map((e) => {
  1059. return (e.checked = 1);
  1060. });
  1061. }
  1062. },
  1063. //查询列数据
  1064. getRow() {
  1065. let that = this;
  1066. this.data = {
  1067. tableName: "客户信息",
  1068. userId: Cookies.get("userName"),
  1069. };
  1070. select(this.data).then((res) => {
  1071. if (res.data.length != 0) {
  1072. this.getRowList = res.data.filter((e) => e.checked == 0);
  1073. this.setRowList = res.data;
  1074. this.setRowList = this.setRowList.reduce((res, item) => {
  1075. res.push({
  1076. surface: item.surface,
  1077. label: item.label,
  1078. name: item.name,
  1079. checked: item.checked,
  1080. width: item.width,
  1081. fixed: item.fixed,
  1082. });
  1083. return res;
  1084. }, []);
  1085. }
  1086. });
  1087. },
  1088. //重置列表
  1089. delRow() {
  1090. this.data = {
  1091. tableName: "客户信息",
  1092. userId: Cookies.get("userName"),
  1093. };
  1094. resetModule(this.data).then((res) => {
  1095. if (res.code == 200) {
  1096. this.showSetting = false;
  1097. this.setRowList = this.tableDate;
  1098. this.getRowList = this.tableDate;
  1099. }
  1100. });
  1101. },
  1102. //保存列设置
  1103. save() {
  1104. this.showSetting = false;
  1105. this.data = {
  1106. tableName: "客户信息",
  1107. userId: Cookies.get("userName"),
  1108. sysTableSetList: this.setRowList,
  1109. };
  1110. addSet(this.data).then((res) => {
  1111. if (res.code == 200) {
  1112. this.showSetting = false;
  1113. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  1114. }
  1115. });
  1116. },
  1117. //开始拖拽事件
  1118. onStart() {
  1119. this.drag = true;
  1120. },
  1121. //拖拽结束事件
  1122. onEnd() {
  1123. this.drag = false;
  1124. },
  1125. full() {
  1126. this.dialogFull = !this.dialogFull;
  1127. },
  1128. // 客户类别默认为客户结算方式默认月结
  1129. query() {
  1130. this.$set(this.form, "fStltypeid", 1);
  1131. },
  1132. // 添加行
  1133. addRow(tableData, event) {
  1134. var obj = {};
  1135. tableData.push(obj);
  1136. },
  1137. //删除行
  1138. deleteRow(index, rows) {
  1139. rows.splice(index, 1);
  1140. },
  1141. /** 查询客户详情列表 */
  1142. getList() {
  1143. this.loading = true;
  1144. listCorps(this.queryParams).then((response) => {
  1145. this.corpsList = response.rows;
  1146. this.total = response.total;
  1147. this.loading = false;
  1148. });
  1149. },
  1150. // 客户类别字典翻译
  1151. fTypeidFormat(row, column) {
  1152. return this.selectDictLabel(this.fTypeidOptions, row.fTypeid);
  1153. },
  1154. // 结算表票结、月结字典翻译
  1155. fStltypeidFormat(row, column) {
  1156. return this.selectDictLabel(this.fStltypeidOptions, row.fStltypeid);
  1157. },
  1158. // 删除状态字典翻译
  1159. delFlagFormat(row, column) {
  1160. return this.selectDictLabel(this.delFlagOptions, row.delFlag);
  1161. },
  1162. // 取消按钮
  1163. cancel() {
  1164. this.open = false;
  1165. this.reset();
  1166. },
  1167. // 表单重置
  1168. reset() {
  1169. this.form = {
  1170. fId: null,
  1171. fTypeid: null,
  1172. fNo: null,
  1173. fName: null,
  1174. fCname: null,
  1175. fEname: null,
  1176. fTel: null,
  1177. fFax: null,
  1178. fEmail: null,
  1179. fManage: null,
  1180. fAddr: null,
  1181. fEaddr: null,
  1182. fScale: null,
  1183. fProvince: null,
  1184. fCity: null,
  1185. fStltypeid: null,
  1186. fStldays: null,
  1187. fContractno: null,
  1188. fContractb: null,
  1189. fContracte: null,
  1190. fTax: null,
  1191. fInvtel: null,
  1192. fInvaddr: null,
  1193. fBankno: null,
  1194. fBankname: null,
  1195. fUbankno: null,
  1196. fUbankname: null,
  1197. fStatus: null,
  1198. delFlag: null,
  1199. createBy: null,
  1200. createTime: null,
  1201. updateBy: null,
  1202. updateTime: null,
  1203. remark: null,
  1204. };
  1205. this.contactList = [];
  1206. this.resetForm("form");
  1207. },
  1208. // 状态修改
  1209. handleStatusChange(row) {
  1210. let text = row.fStatus === "0" ? "启用" : "停用";
  1211. this.$confirm('确认要"' + text + '""' + row.fName + '"吗?', "警告", {
  1212. confirmButtonText: "确定",
  1213. cancelButtonText: "取消",
  1214. type: "warning",
  1215. })
  1216. .then(function () {
  1217. return changeCorpsStatus(row.fId, row.fStatus);
  1218. })
  1219. .then(() => {
  1220. this.msgSuccess(text + "成功");
  1221. })
  1222. .catch(function () {
  1223. row.fStatus = row.fStatus === "0" ? "1" : "0";
  1224. });
  1225. },
  1226. /** 搜索按钮操作 */
  1227. handleQuery() {
  1228. this.queryParams.pageNum = 1;
  1229. this.getList();
  1230. },
  1231. /** 重置按钮操作 */
  1232. resetQuery() {
  1233. this.resetForm("queryForm");
  1234. this.contactList = [];
  1235. this.handleQuery();
  1236. },
  1237. // 多选框选中数据
  1238. handleSelectionChange(selection) {
  1239. this.ids = selection.map((item) => item.fId);
  1240. this.single = selection.length !== 1;
  1241. this.multiple = !selection.length;
  1242. },
  1243. /** 新增按钮操作 */
  1244. handleAdd() {
  1245. this.reset();
  1246. this.query();
  1247. this.contactList = [];
  1248. if (Cookies.get("sysType") == 2) {
  1249. this.form.fTypeid = [this.fTypeidOptions[0].dictValue];
  1250. this.disCorps = true;
  1251. }
  1252. this.open = true;
  1253. this.title = "添加客户详情";
  1254. },
  1255. /** 修改按钮操作 */
  1256. handleUpdate(row) {
  1257. this.reset();
  1258. if (Cookies.get("sysType") == 2) {
  1259. this.disCorps = true;
  1260. }
  1261. const fId = row.fId || this.ids;
  1262. getCorps(fId).then((response) => {
  1263. if (response.data.corp.deptId) {
  1264. response.data.corp.deptId = response.data.corp.deptId
  1265. .replace(/\[|]/g, "")
  1266. .replace(/\"/g, "")
  1267. .split(",");
  1268. }
  1269. this.form = response.data["corp"];
  1270. console.log(this.form);
  1271. var contactList1 = response.data["customerContact"];
  1272. this.form.fTypeid = this.form.fTypeid
  1273. .replace(/\[|]/g, "")
  1274. .replace(/\"/g, "")
  1275. .split(",");
  1276. if (contactList1 != null) {
  1277. this.contactList = contactList1;
  1278. } else {
  1279. this.query();
  1280. }
  1281. this.open = true;
  1282. this.title = "修改客户详情";
  1283. });
  1284. },
  1285. /** 提交按钮 */
  1286. submitForm() {
  1287. this.form.fTypename = "";
  1288. this.$refs["form"].validate((valid) => {
  1289. if (valid) {
  1290. if (!this.form.deptId) {
  1291. return this.$message.error("归属部门不能为空");
  1292. }
  1293. if (this.form.fId != null) {
  1294. let formDate = new FormData();
  1295. for (let index in this.fTypeidOptions) {
  1296. for (let item in this.form.fTypeid) {
  1297. if (
  1298. this.fTypeidOptions[index].dictValue ==
  1299. this.form.fTypeid[item]
  1300. ) {
  1301. this.form.fTypename +=
  1302. this.fTypeidOptions[index].dictLabel + ",";
  1303. }
  1304. }
  1305. }
  1306. this.form.fTypename = this.form.fTypename.substring(
  1307. 0,
  1308. this.form.fTypename.length - 1
  1309. );
  1310. if (this.contactList.length == 0 && Cookies.get("sysType") == 2) {
  1311. return this.$message.error("联系人不能为空");
  1312. }
  1313. formDate.append("corps", JSON.stringify(this.form));
  1314. formDate.append(
  1315. "customerContacts",
  1316. JSON.stringify(this.contactList)
  1317. );
  1318. formDate.append(
  1319. "attach",
  1320. JSON.stringify(this.relevantAttachments)
  1321. );
  1322. addCorps(formDate).then((response) => {
  1323. console.log("111");
  1324. this.msgSuccess("修改成功");
  1325. this.open = false;
  1326. this.getList();
  1327. });
  1328. } else {
  1329. let formDate = new FormData();
  1330. for (let index in this.fTypeidOptions) {
  1331. for (let item in this.form.fTypeid) {
  1332. if (
  1333. this.fTypeidOptions[index].dictValue ==
  1334. this.form.fTypeid[item]
  1335. ) {
  1336. this.form.fTypename +=
  1337. this.fTypeidOptions[index].dictLabel + ",";
  1338. }
  1339. }
  1340. }
  1341. this.form.fTypename = this.form.fTypename.substring(
  1342. 0,
  1343. this.form.fTypename.length - 1
  1344. );
  1345. if (this.contactList.length == 0 && Cookies.get("sysType") == 2) {
  1346. return this.$message.error("联系人不能为空");
  1347. }
  1348. formDate.append("corps", JSON.stringify(this.form));
  1349. formDate.append(
  1350. "customerContacts",
  1351. JSON.stringify(this.contactList)
  1352. );
  1353. formDate.append(
  1354. "attach",
  1355. JSON.stringify(this.relevantAttachments)
  1356. );
  1357. addCorps(formDate).then((response) => {
  1358. this.msgSuccess("新增成功");
  1359. this.open = false;
  1360. this.getList();
  1361. });
  1362. }
  1363. }
  1364. });
  1365. },
  1366. /** 删除按钮操作 */
  1367. handleDelete(row) {
  1368. const fIds = row.fId || this.ids;
  1369. this.$confirm(
  1370. '是否确认删除客户详情编号为"' + fIds + '"的数据项?',
  1371. "警告",
  1372. {
  1373. confirmButtonText: "确定",
  1374. cancelButtonText: "取消",
  1375. type: "warning",
  1376. }
  1377. )
  1378. .then(function () {
  1379. return delCorps(fIds);
  1380. })
  1381. .then(() => {
  1382. this.getList();
  1383. this.msgSuccess("删除成功");
  1384. });
  1385. },
  1386. /** 导出按钮操作 */
  1387. handleExport() {
  1388. const queryParams = this.queryParams;
  1389. this.$confirm("是否确认导出所有客户详情数据项?", "警告", {
  1390. confirmButtonText: "确定",
  1391. cancelButtonText: "取消",
  1392. type: "warning",
  1393. })
  1394. .then(function () {
  1395. return exportCorps(queryParams);
  1396. })
  1397. .then((response) => {
  1398. this.download(response.msg);
  1399. });
  1400. },
  1401. },
  1402. };
  1403. </script>
  1404. <style lang="scss">
  1405. .avue-crud__dialog__header {
  1406. display: -webkit-box;
  1407. display: -ms-flexbox;
  1408. display: flex;
  1409. -webkit-box-align: center;
  1410. -ms-flex-align: center;
  1411. align-items: center;
  1412. -webkit-box-pack: justify;
  1413. -ms-flex-pack: justify;
  1414. justify-content: space-between;
  1415. }
  1416. .el-dialog__title {
  1417. color: rgba(0, 0, 0, 0.85);
  1418. font-weight: 500;
  1419. word-wrap: break-word;
  1420. }
  1421. .avue-crud__dialog__menu {
  1422. padding-right: 20px;
  1423. float: left;
  1424. }
  1425. .avue-crud__dialog__menu i {
  1426. color: #909399;
  1427. font-size: 15px;
  1428. }
  1429. .el-icon-full-screen {
  1430. cursor: pointer;
  1431. }
  1432. .el-icon-full-screen:before {
  1433. content: "\e719";
  1434. }
  1435. </style>
  1436. <style lang="scss" scoped>
  1437. .tabSetting {
  1438. display: flex;
  1439. justify-content: flex-end;
  1440. }
  1441. .listStyle {
  1442. display: flex;
  1443. border-top: 1px solid #dcdfe6;
  1444. border-left: 1px solid #dcdfe6;
  1445. border-right: 1px solid #dcdfe6;
  1446. }
  1447. .listStyle:last-child {
  1448. border-bottom: 1px solid #dcdfe6;
  1449. }
  1450. .progress {
  1451. display: flex;
  1452. align-items: center;
  1453. padding: 2px;
  1454. background-color: rgba(0, 0, 0, 0.05);
  1455. height: 100%;
  1456. }
  1457. .el-form-item__content {
  1458. line-height: 20px !important;
  1459. }
  1460. </style>