index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  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. />
  116. <el-table-column
  117. :show-overflow-tooltip="true"
  118. label="简称" align="center" prop="fCname" />
  119. <el-table-column
  120. :show-overflow-tooltip="true"
  121. label="英文名称" align="center" prop="fEname" />
  122. <el-table-column
  123. :show-overflow-tooltip="true"
  124. label="电话" align="center" prop="fTel" />
  125. <el-table-column label="录入人" align="center" prop="createBy" />
  126. <el-table-column label="录入时间" align="center" prop="createTime" width="180">
  127. <template slot-scope="scope">
  128. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="修改人" align="center" prop="updateBy" />
  132. <el-table-column label="修改时间" align="center" prop="updateTime" width="180">
  133. <template slot-scope="scope">
  134. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="状态" align="center" prop="fStatus" >
  138. <template slot-scope="scope">
  139. <el-switch
  140. v-model="scope.row.fStatus"
  141. active-value="0"
  142. inactive-value="1"
  143. @change="handleStatusChange(scope.row)"
  144. ></el-switch>
  145. </template>
  146. </el-table-column>
  147. <el-table-column
  148. label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
  149. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
  150. <template slot-scope="scope">
  151. <el-button
  152. size="mini"
  153. type="text"
  154. icon="el-icon-edit"
  155. @click="handleUpdate(scope.row)"
  156. v-hasPermi="['basicdata:corps:edit']"
  157. >修改</el-button>
  158. <el-button
  159. size="mini"
  160. type="text"
  161. icon="el-icon-delete"
  162. @click="handleDelete(scope.row)"
  163. v-hasPermi="['basicdata:corps:remove']"
  164. >删除</el-button>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. <pagination
  169. v-show="total>0"
  170. :total="total"
  171. :page.sync="queryParams.pageNum"
  172. :limit.sync="queryParams.pageSize"
  173. @pagination="getList"
  174. />
  175. <!-- 添加或修改客户详情对话框 -->
  176. <el-dialog :title="title" :visible.sync="open" close-on-click-modal="false" width="80%" :close-on-click-modal="false" append-to-body>
  177. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  178. <el-row>
  179. <el-col :span="8">
  180. <el-form-item label="客户类别" prop="fTypeid">
  181. <el-select style="width: 250px" v-model="form.fTypeid" :multiple="true" placeholder="请选择客户类别">
  182. <el-option
  183. v-for="dict in fTypeidOptions"
  184. :key="dict.dictValue"
  185. :label="dict.dictLabel"
  186. :value="dict.dictValue"
  187. ></el-option>
  188. </el-select>
  189. </el-form-item>
  190. </el-col>
  191. <el-col :span="8">
  192. <el-form-item label="编号" prop="fNo">
  193. <el-input v-model="form.fNo" style="width: 250px" placeholder="请输入编号" />
  194. </el-form-item>
  195. </el-col>
  196. <el-col :span="8">
  197. <el-form-item label="名称" prop="fName">
  198. <el-input v-model="form.fName" style="width: 250px" placeholder="请输入名称" />
  199. </el-form-item>
  200. </el-col>
  201. </el-row>
  202. <el-row>
  203. <el-col :span="8">
  204. <el-form-item label="简称" prop="fCname">
  205. <el-input v-model="form.fCname" style="width: 250px" placeholder="请输入简称" />
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="8">
  209. <el-form-item label="英文名称" prop="fEname">
  210. <el-input v-model="form.fEname" style="width: 250px" placeholder="请输入英文名称" />
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="8">
  214. <el-form-item label="电话" prop="fTel">
  215. <el-input v-model="form.fTel" style="width: 250px" placeholder="请输入电话" />
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. <el-row>
  220. <el-col :span="8">
  221. <el-form-item label="传真" prop="fFax">
  222. <el-input v-model="form.fFax" style="width: 250px" placeholder="请输入传真" />
  223. </el-form-item>
  224. </el-col>
  225. <el-col :span="8">
  226. <el-form-item label="邮箱" prop="fEmail">
  227. <el-input v-model="form.fEmail" style="width: 250px" placeholder="请输入邮箱" />
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="8">
  231. <el-form-item label="联系人" prop="fManage">
  232. <el-input v-model="form.fManage" style="width: 250px" placeholder="请输入联系人" />
  233. </el-form-item>
  234. </el-col>
  235. </el-row>
  236. <el-row>
  237. <el-col :span="8">
  238. <el-form-item label="地址" prop="fAddr">
  239. <el-input v-model="form.fAddr" style="width: 250px" placeholder="请输入地址" />
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="8">
  243. <el-form-item label="英文地址" prop="fEaddr">
  244. <el-input v-model="form.fEaddr" style="width: 250px" placeholder="请输入英文地址" />
  245. </el-form-item>
  246. </el-col>
  247. <el-col :span="8">
  248. <el-form-item label="规模" prop="fScale">
  249. <el-input v-model="form.fScale" style="width: 250px" placeholder="请输入规模" />
  250. </el-form-item>
  251. </el-col>
  252. </el-row>
  253. <el-row>
  254. <el-col :span="8">
  255. <el-form-item label="省" prop="fProvince">
  256. <el-input v-model="form.fProvince" style="width: 250px" placeholder="请输入省" />
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="8">
  260. <el-form-item label="市" prop="fCity">
  261. <el-input v-model="form.fCity" style="width: 250px" placeholder="请输入市" />
  262. </el-form-item>
  263. </el-col>
  264. <el-col :span="8">
  265. <el-form-item label="结算方式" prop="fStltypeid">
  266. <el-select v-model="form.fStltypeid" style="width: 250px" placeholder="请选择结算表票结、月结">
  267. <el-option
  268. v-for="dict in fStltypeidOptions"
  269. :key="dict.dictValue"
  270. :label="dict.dictLabel"
  271. :value="parseInt(dict.dictValue)"
  272. ></el-option>
  273. </el-select>
  274. </el-form-item>
  275. </el-col>
  276. </el-row>
  277. <el-row>
  278. <el-col :span="8">
  279. <el-form-item label="结费天数" prop="fStldays">
  280. <el-input v-model="form.fStldays" style="width: 250px" placeholder="请输入结费天数" />
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="8">
  284. <el-form-item label="合同号" prop="fContractno">
  285. <el-input v-model="form.fContractno" style="width: 250px" placeholder="请输入合同号" />
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="8">
  289. <el-form-item label="税号" prop="fTax">
  290. <el-input v-model="form.fTax" style="width: 250px" placeholder="请输入税号" />
  291. </el-form-item>
  292. </el-col>
  293. </el-row>
  294. <el-row>
  295. <el-col :span="8">
  296. <el-form-item label="合同起" prop="fContractb">
  297. <el-date-picker clearable size="small" style="width: 250px"
  298. v-model="form.fContractb"
  299. type="date"
  300. value-format="yyyy-MM-dd"
  301. placeholder="选择合同起">
  302. </el-date-picker>
  303. </el-form-item>
  304. </el-col>
  305. <el-col :span="8">
  306. <el-form-item label="合同至" prop="fContracte">
  307. <el-date-picker clearable size="small" style="width: 250px"
  308. v-model="form.fContracte"
  309. type="date"
  310. value-format="yyyy-MM-dd"
  311. placeholder="选择合同至">
  312. </el-date-picker>
  313. </el-form-item>
  314. </el-col>
  315. <el-col :span="8">
  316. <el-form-item label="开票电话" prop="fInvtel">
  317. <el-input v-model="form.fInvtel" style="width: 250px" placeholder="请输入开票电话" />
  318. </el-form-item>
  319. </el-col>
  320. </el-row>
  321. <el-row>
  322. <el-col :span="8">
  323. <el-form-item label="开票地址" prop="fInvaddr">
  324. <el-input v-model="form.fInvaddr" style="width: 250px" placeholder="请输入开票地址" />
  325. </el-form-item>
  326. </el-col>
  327. <el-col :span="8">
  328. <el-form-item label="本位币账号" prop="fBankno">
  329. <el-input v-model="form.fBankno" style="width: 250px" placeholder="请输入本位币账号" />
  330. </el-form-item>
  331. </el-col>
  332. <el-col :span="8">
  333. <el-form-item label="本位币银行" prop="fBankname">
  334. <el-input v-model="form.fBankname" style="width: 250px" placeholder="请输入本位币银行" />
  335. </el-form-item>
  336. </el-col>
  337. </el-row>
  338. <el-row>
  339. <el-col :span="8">
  340. <el-form-item label="外币账号" prop="fUbankno">
  341. <el-input v-model="form.fUbankno" style="width: 250px" placeholder="请输入外币账号" />
  342. </el-form-item>
  343. </el-col>
  344. <el-col :span="8">
  345. <el-form-item label="外币银行" prop="fUbankname">
  346. <el-input v-model="form.fUbankname" style="width: 250px" placeholder="请输入外币银行" />
  347. </el-form-item>
  348. </el-col>
  349. <el-col :span="8">
  350. <el-form-item label="状态">
  351. <!--<el-radio-group v-model="form.fStatus">
  352. <el-radio label="1">请选择字典生成</el-radio>
  353. </el-radio-group>-->
  354. <el-radio-group v-model="form.fStatus">
  355. <el-radio
  356. v-for="dict in statusOptions"
  357. :key="dict.dictValue"
  358. :label="dict.dictValue"
  359. >{{dict.dictLabel}}</el-radio>
  360. </el-radio-group>
  361. </el-form-item>
  362. </el-col>
  363. </el-row>
  364. <el-form-item label="备注" prop="remark">
  365. <el-input v-model="form.remark" style="width: 400px" placeholder="请输入备注" />
  366. </el-form-item>
  367. </el-form>
  368. <div >
  369. <el-row :gutter="10" class="mb8">
  370. <el-col :span="1.5">
  371. <el-button
  372. type="primary"
  373. icon="el-icon-plus"
  374. size="mini"
  375. @click="addRow(contactList)"
  376. >添加</el-button>
  377. </el-col>
  378. </el-row>
  379. </div>
  380. <el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange">
  381. <el-table-column label="编号" align="center" prop="fNo" >
  382. <template slot-scope="scope">
  383. <el-input v-model="scope.row.fNo" placeholder="编号" />
  384. </template>
  385. </el-table-column>
  386. <el-table-column label="名称" align="center" prop="fName" >
  387. <template slot-scope="scope">
  388. <el-input v-model="scope.row.fName" placeholder="名称" />
  389. </template>
  390. </el-table-column>
  391. <el-table-column label="英文名称" align="center" prop="fEname">
  392. <template slot-scope="scope">
  393. <el-input v-model="scope.row.fEname" placeholder="英文名称" />
  394. </template>
  395. </el-table-column>
  396. <el-table-column label="电话" align="center" prop="fTel" >
  397. <template slot-scope="scope">
  398. <el-input v-model="scope.row.fTel" placeholder="电话" />
  399. </template>
  400. </el-table-column>
  401. <el-table-column label="状态" align="center" prop="fStatus" >
  402. <template slot-scope="scope">
  403. <el-select
  404. v-model="scope.row.fStatus"
  405. placeholder="状态"
  406. clearable
  407. size="small"
  408. >
  409. <el-option
  410. v-for="dict in statusOptions"
  411. :key="dict.dictValue"
  412. :label="dict.dictLabel"
  413. :value="dict.dictValue"
  414. />
  415. </el-select>
  416. </template>
  417. </el-table-column>
  418. <el-table-column label="备注" align="center" prop="remark" >
  419. <template slot-scope="scope">
  420. <el-input v-model="scope.row.remark" placeholder="备注" />
  421. </template>
  422. </el-table-column>
  423. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
  424. <template slot-scope="scope">
  425. <el-button
  426. size="mini"
  427. type="text"
  428. icon="el-icon-delete"
  429. @click.native.prevent="deleteRow(scope.$index, contactList)"
  430. >删除</el-button>
  431. </template>
  432. </el-table-column>
  433. </el-table>
  434. <div slot="footer" class="dialog-footer">
  435. <el-button type="primary" @click="submitForm">确 定</el-button>
  436. <el-button @click="cancel">取 消</el-button>
  437. </div>
  438. </el-dialog>
  439. </div>
  440. </template>
  441. <script>
  442. import { listCorps, getCorps, delCorps, addCorps, updateCorps, changeCorpsStatus,exportCorps } from "@/api/basicdata/corps";
  443. import {queryUserVal} from "@/api/system/user";
  444. import { isArray } from '@/utils/validate'
  445. export default {
  446. name: "Corps",
  447. components: {
  448. },
  449. data() {
  450. return {
  451. contactList:[],
  452. // 遮罩层
  453. loading: true,
  454. // 选中数组
  455. ids: [],
  456. // 非单个禁用
  457. single: true,
  458. // 非多个禁用
  459. multiple: true,
  460. // 显示搜索条件
  461. showSearch: true,
  462. // 总条数
  463. total: 0,
  464. // 客户详情表格数据
  465. corpsList: [],
  466. // 弹出层标题
  467. title: "",
  468. // 状态数据字典
  469. statusOptions: [],
  470. // 是否显示弹出层
  471. open: false,
  472. // 客户类别字典
  473. fTypeidOptions: [],
  474. // 结算表票结、月结字典
  475. fStltypeidOptions: [],
  476. // 删除状态字典
  477. delFlagOptions: [],
  478. // 查询参数
  479. queryParams: {
  480. pageNum: 1,
  481. pageSize: 10,
  482. fTypeid: null,
  483. fNo: null,
  484. fName: null,
  485. fCname: null,
  486. fEname: null,
  487. fTel: null,
  488. fFax: null,
  489. fEmail: null,
  490. fManage: null,
  491. fAddr: null,
  492. fEaddr: null,
  493. fScale: null,
  494. fProvince: null,
  495. fCity: null,
  496. fStltypeid: null,
  497. fStldays: null,
  498. fContractno: null,
  499. fContractb: null,
  500. fContracte: null,
  501. fTax: null,
  502. fInvtel: null,
  503. fInvaddr: null,
  504. fBankno: null,
  505. fBankname: null,
  506. fUbankno: null,
  507. fUbankname: null,
  508. fStatus: null,
  509. },
  510. // 表单参数
  511. form: {},
  512. // 表单校验
  513. rules: {
  514. fTypeid: [
  515. { required: true, message: "客户类别不能为空", trigger: "blur" }
  516. ],
  517. fNo: [
  518. { required: true, message: "编号不能为空", trigger: "blur" }
  519. ],
  520. fName: [
  521. { required: true, message: "名称不能为空", trigger: "blur" }
  522. ],
  523. fCname:[
  524. { required: true, message: "简称不能为空", trigger: "blur" }
  525. ],
  526. fStatus: [
  527. { required: true, message: "状态默认 T ,正常T 停用F 下拉选择不能为空", trigger: "blur" }
  528. ],
  529. }
  530. };
  531. },
  532. created() {
  533. this.getList();
  534. this.getDicts("data_customer_category").then(response => {
  535. this.fTypeidOptions = response.data;
  536. });
  537. this.getDicts("data_stltype_type").then(response => {
  538. this.fStltypeidOptions = response.data;
  539. });
  540. this.getDicts("data_delete_state").then(response => {
  541. this.delFlagOptions = response.data;
  542. });
  543. this.getDicts("sys_normal_disable").then(response => {
  544. this.statusOptions = response.data;
  545. });
  546. },
  547. methods: {
  548. // 客户类别默认为客户结算方式默认月结
  549. query() {
  550. this.$set(this.form, "fStltypeid", 1);
  551. },
  552. // 添加行
  553. addRow(tableData,event){
  554. var obj = {}
  555. tableData.push(obj)
  556. },
  557. //删除行
  558. deleteRow(index, rows) {
  559. rows.splice(index, 1);
  560. },
  561. /** 查询客户详情列表 */
  562. getList() {
  563. this.loading = true;
  564. listCorps(this.queryParams).then(response => {
  565. this.corpsList = response.rows;
  566. this.total = response.total;
  567. this.loading = false;
  568. });
  569. },
  570. // 客户类别字典翻译
  571. fTypeidFormat(row, column) {
  572. return this.selectDictLabel(this.fTypeidOptions, row.fTypeid);
  573. },
  574. // 结算表票结、月结字典翻译
  575. fStltypeidFormat(row, column) {
  576. return this.selectDictLabel(this.fStltypeidOptions, row.fStltypeid);
  577. },
  578. // 删除状态字典翻译
  579. delFlagFormat(row, column) {
  580. return this.selectDictLabel(this.delFlagOptions, row.delFlag);
  581. },
  582. // 取消按钮
  583. cancel() {
  584. this.open = false;
  585. this.reset();
  586. },
  587. // 表单重置
  588. reset() {
  589. this.form = {
  590. fId: null,
  591. fTypeid: null,
  592. fNo: null,
  593. fName: null,
  594. fCname: null,
  595. fEname: null,
  596. fTel: null,
  597. fFax: null,
  598. fEmail: null,
  599. fManage: null,
  600. fAddr: null,
  601. fEaddr: null,
  602. fScale: null,
  603. fProvince: null,
  604. fCity: null,
  605. fStltypeid: null,
  606. fStldays: null,
  607. fContractno: null,
  608. fContractb: null,
  609. fContracte: null,
  610. fTax: null,
  611. fInvtel: null,
  612. fInvaddr: null,
  613. fBankno: null,
  614. fBankname: null,
  615. fUbankno: null,
  616. fUbankname: null,
  617. fStatus: null,
  618. delFlag: null,
  619. createBy: null,
  620. createTime: null,
  621. updateBy: null,
  622. updateTime: null,
  623. remark: null
  624. };
  625. this.resetForm("form");
  626. },
  627. // 从表重置
  628. contList() {
  629. this.contactList = []
  630. },
  631. // 状态修改
  632. handleStatusChange(row) {
  633. let text = row.fStatus === "0" ? "启用" : "停用";
  634. this.$confirm('确认要"' + text + '""' + row.fName + '"吗?', "警告", {
  635. confirmButtonText: "确定",
  636. cancelButtonText: "取消",
  637. type: "warning"
  638. }).then(function() {
  639. return changeCorpsStatus(row.fId, row.fStatus);
  640. }).then(() => {
  641. this.msgSuccess(text + "成功");
  642. }).catch(function() {
  643. row.fStatus = row.fStatus === "0" ? "1" : "0";
  644. });
  645. },
  646. /** 搜索按钮操作 */
  647. handleQuery() {
  648. this.queryParams.pageNum = 1;
  649. this.getList();
  650. },
  651. /** 重置按钮操作 */
  652. resetQuery() {
  653. this.resetForm("queryForm");
  654. this.handleQuery();
  655. },
  656. // 多选框选中数据
  657. handleSelectionChange(selection) {
  658. this.ids = selection.map(item => item.fId)
  659. this.single = selection.length!==1
  660. this.multiple = !selection.length
  661. },
  662. /** 新增按钮操作 */
  663. handleAdd() {
  664. this.reset();
  665. this.query();
  666. this.contList();
  667. this.open = true;
  668. this.title = "添加客户详情";
  669. },
  670. /** 修改按钮操作 */
  671. handleUpdate(row) {
  672. this.reset();
  673. const fId = row.fId || this.ids
  674. getCorps(fId).then(response => {
  675. this.form = response.data["corp"];
  676. var contactList1=response.data["customerContact"];
  677. this.form.fTypeid = this.form.fTypeid.replace(/\[|]/g,'').replace(/\"/g, "").split(",")
  678. if(contactList1!=null){
  679. this.contactList=contactList1;
  680. }else {
  681. this.query();
  682. }
  683. this.open = true;
  684. this.title = "修改客户详情";
  685. });
  686. },
  687. /** 提交按钮 */
  688. submitForm() {
  689. this.form.fTypename = ''
  690. this.$refs["form"].validate(valid => {
  691. if (valid) {
  692. if (this.form.fId != null) {
  693. let formDate= new FormData()
  694. for (let index in this.fTypeidOptions){
  695. for (let item in this.form.fTypeid){
  696. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  697. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  698. }
  699. }
  700. }
  701. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  702. formDate.append('corps',JSON.stringify(this.form));
  703. formDate.append('customerContacts',JSON.stringify(this.contactList));
  704. addCorps(formDate).then(response => {
  705. this.msgSuccess("修改成功");
  706. this.open = false;
  707. this.getList();
  708. });
  709. } else {
  710. let formDate= new FormData()
  711. for (let index in this.fTypeidOptions){
  712. for (let item in this.form.fTypeid){
  713. if (this.fTypeidOptions[index].dictValue == this.form.fTypeid[item]){
  714. this.form.fTypename += this.fTypeidOptions[index].dictLabel + ','
  715. }
  716. }
  717. }
  718. this.form.fTypename = this.form.fTypename.substring(0,this.form.fTypename.length-1)
  719. formDate.append('corps',JSON.stringify(this.form));
  720. formDate.append('customerContacts',JSON.stringify(this.contactList));
  721. addCorps(formDate).then(response => {
  722. this.msgSuccess("新增成功");
  723. this.open = false;
  724. this.getList();
  725. });
  726. }
  727. }
  728. });
  729. },
  730. /** 删除按钮操作 */
  731. handleDelete(row) {
  732. const fIds = row.fId || this.ids;
  733. this.$confirm('是否确认删除客户详情编号为"' + fIds + '"的数据项?', "警告", {
  734. confirmButtonText: "确定",
  735. cancelButtonText: "取消",
  736. type: "warning"
  737. }).then(function() {
  738. return delCorps(fIds);
  739. }).then(() => {
  740. this.getList();
  741. this.msgSuccess("删除成功");
  742. })
  743. },
  744. /** 导出按钮操作 */
  745. handleExport() {
  746. const queryParams = this.queryParams;
  747. this.$confirm('是否确认导出所有客户详情数据项?', "警告", {
  748. confirmButtonText: "确定",
  749. cancelButtonText: "取消",
  750. type: "warning"
  751. }).then(function() {
  752. return exportCorps(queryParams);
  753. }).then(response => {
  754. this.download(response.msg);
  755. })
  756. }
  757. }
  758. };
  759. </script>