index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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="fNo">
  5. <el-input
  6. v-model="queryParams.fNo"
  7. placeholder="请输入编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="名称" prop="fName">
  14. <el-input
  15. v-model="queryParams.fName"
  16. placeholder="请输入名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="英文名称" prop="fEname">
  23. <el-input
  24. v-model="queryParams.fEname"
  25. placeholder="请输入英文名称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="电话" prop="fTel">
  32. <el-input
  33. v-model="queryParams.fTel"
  34. placeholder="请输入电话"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="状态" prop="fStatus">
  41. <el-select v-model="queryParams.fStatus" placeholder="请选择状态" clearable size="small">
  42. <el-option label="请选择字典生成" value="" />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  47. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  48. </el-form-item>
  49. </el-form>
  50. <el-row :gutter="10" class="mb8">
  51. <el-col :span="1.5">
  52. <el-button
  53. type="primary"
  54. icon="el-icon-plus"
  55. size="mini"
  56. @click="handleAdd"
  57. v-hasPermi="['basicdata:contact:add']"
  58. >新增</el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="success"
  63. icon="el-icon-edit"
  64. size="mini"
  65. :disabled="single"
  66. @click="handleUpdate"
  67. v-hasPermi="['basicdata:contact:edit']"
  68. >修改</el-button>
  69. </el-col>
  70. <el-col :span="1.5">
  71. <el-button
  72. type="danger"
  73. icon="el-icon-delete"
  74. size="mini"
  75. :disabled="multiple"
  76. @click="handleDelete"
  77. v-hasPermi="['basicdata:contact:remove']"
  78. >删除</el-button>
  79. </el-col>
  80. <el-col :span="1.5">
  81. <el-button
  82. type="warning"
  83. icon="el-icon-download"
  84. size="mini"
  85. @click="handleExport"
  86. v-hasPermi="['basicdata:contact:export']"
  87. >导出</el-button>
  88. </el-col>
  89. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  90. </el-row>
  91. <el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange">
  92. <el-table-column type="selection" width="55" align="center" />
  93. <el-table-column label="状态" align="center" prop="tId" />
  94. <el-table-column label="编号" align="center" prop="fNo" />
  95. <el-table-column label="名称" align="center" prop="fName" />
  96. <el-table-column label="英文名称" align="center" prop="fEname" />
  97. <el-table-column label="电话" align="center" prop="fTel" />
  98. <el-table-column label="状态" align="center" prop="fStatus" />
  99. <el-table-column label="备注" align="center" prop="remark" />
  100. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
  101. <template slot-scope="scope">
  102. <el-button
  103. size="mini"
  104. type="text"
  105. icon="el-icon-edit"
  106. @click="handleUpdate(scope.row)"
  107. v-hasPermi="['basicdata:contact:edit']"
  108. >修改</el-button>
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-delete"
  113. @click="handleDelete(scope.row)"
  114. v-hasPermi="['basicdata:contact:remove']"
  115. >删除</el-button>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <pagination
  120. v-show="total>0"
  121. :total="total"
  122. :page.sync="queryParams.pageNum"
  123. :limit.sync="queryParams.pageSize"
  124. @pagination="getList"
  125. />
  126. <!-- 添加或修改客户联系人对话框 -->
  127. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  128. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  129. <el-form-item label="对应corps 的f_id" prop="fPid">
  130. <el-input v-model="form.fPid" placeholder="请输入对应corps 的f_id" />
  131. </el-form-item>
  132. <el-form-item label="编号" prop="fNo">
  133. <el-input v-model="form.fNo" placeholder="请输入编号" />
  134. </el-form-item>
  135. <el-form-item label="名称" prop="fName">
  136. <el-input v-model="form.fName" placeholder="请输入名称" />
  137. </el-form-item>
  138. <el-form-item label="英文名称" prop="fEname">
  139. <el-input v-model="form.fEname" placeholder="请输入英文名称" />
  140. </el-form-item>
  141. <el-form-item label="电话" prop="fTel">
  142. <el-input v-model="form.fTel" placeholder="请输入电话" />
  143. </el-form-item>
  144. <el-form-item label="职务" prop="fDuty">
  145. <el-input v-model="form.fDuty" placeholder="请输入职务" />
  146. </el-form-item>
  147. <el-form-item label="邮箱" prop="fEmail">
  148. <el-input v-model="form.fEmail" placeholder="请输入邮箱" />
  149. </el-form-item>
  150. <el-form-item label="微信" prop="fWx">
  151. <el-input v-model="form.fWx" placeholder="请输入微信" />
  152. </el-form-item>
  153. <el-form-item label="状态">
  154. <el-radio-group v-model="form.fStatus">
  155. <el-radio label="1">请选择字典生成</el-radio>
  156. </el-radio-group>
  157. </el-form-item>
  158. <el-form-item label="删除状态" prop="delFlag">
  159. <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
  160. </el-form-item>
  161. <el-form-item label="备注" prop="remark">
  162. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  163. </el-form-item>
  164. </el-form>
  165. <div slot="footer" class="dialog-footer">
  166. <el-button type="primary" @click="submitForm">确 定</el-button>
  167. <el-button @click="cancel">取 消</el-button>
  168. </div>
  169. </el-dialog>
  170. </div>
  171. </template>
  172. <script>
  173. import { listContact, getContact, delContact, addContact, updateContact, exportContact } from "../../../api/basicdata/contact";
  174. import { addSet, select, resetModule } from "@/api/system/set";
  175. import Cookies from "js-cookie";
  176. import draggable from "vuedraggable";
  177. export default {
  178. name: "Contact",
  179. components: {
  180. },
  181. data() {
  182. return {
  183. // 遮罩层
  184. loading: true,
  185. // 选中数组
  186. ids: [],
  187. // 非单个禁用
  188. single: true,
  189. // 非多个禁用
  190. multiple: true,
  191. // 显示搜索条件
  192. showSearch: true,
  193. // 总条数
  194. total: 0,
  195. // 客户联系人表格数据
  196. contactList: [],
  197. // 弹出层标题
  198. title: "",
  199. // 是否显示弹出层
  200. open: false,
  201. // 查询参数
  202. queryParams: {
  203. pageNum: 1,
  204. pageSize: 10,
  205. fPid: null,
  206. fNo: null,
  207. fName: null,
  208. fEname: null,
  209. fTel: null,
  210. fDuty: null,
  211. fEmail: null,
  212. fWx: null,
  213. fStatus: null,
  214. },
  215. // 表单参数
  216. form: {},
  217. // 表单校验
  218. rules: {
  219. fPid: [
  220. { required: true, message: "对应corps 的f_id不能为空", trigger: "blur" }
  221. ],
  222. fNo: [
  223. { required: true, message: "编号不能为空", trigger: "blur" }
  224. ],
  225. fName: [
  226. { required: true, message: "名称不能为空", trigger: "blur" }
  227. ],
  228. }
  229. };
  230. },
  231. created() {
  232. this.getList();
  233. },
  234. methods: {
  235. /** 查询客户联系人列表 */
  236. getList() {
  237. this.loading = true;
  238. listContact(this.queryParams).then(response => {
  239. this.contactList = response.rows;
  240. this.total = response.total;
  241. this.loading = false;
  242. });
  243. },
  244. // 取消按钮
  245. cancel() {
  246. this.open = false;
  247. this.reset();
  248. },
  249. // 表单重置
  250. reset() {
  251. this.form = {
  252. tId: null,
  253. fPid: null,
  254. fNo: null,
  255. fName: null,
  256. fEname: null,
  257. fTel: null,
  258. fDuty: null,
  259. fEmail: null,
  260. fWx: null,
  261. fStatus: "0",
  262. delFlag: null,
  263. createBy: null,
  264. createTime: null,
  265. updateBy: null,
  266. updateTime: null,
  267. remark: null
  268. };
  269. this.resetForm("form");
  270. },
  271. /** 搜索按钮操作 */
  272. handleQuery() {
  273. this.queryParams.pageNum = 1;
  274. this.getList();
  275. },
  276. /** 重置按钮操作 */
  277. resetQuery() {
  278. this.resetForm("queryForm");
  279. this.handleQuery();
  280. },
  281. // 多选框选中数据
  282. handleSelectionChange(selection) {
  283. this.ids = selection.map(item => item.tId)
  284. this.single = selection.length!==1
  285. this.multiple = !selection.length
  286. },
  287. /** 新增按钮操作 */
  288. handleAdd() {
  289. this.reset();
  290. this.open = true;
  291. this.title = "添加客户联系人";
  292. },
  293. /** 修改按钮操作 */
  294. handleUpdate(row) {
  295. this.reset();
  296. const tId = row.tId || this.ids
  297. getContact(tId).then(response => {
  298. this.form = response.data;
  299. this.open = true;
  300. this.title = "修改客户联系人";
  301. });
  302. },
  303. /** 提交按钮 */
  304. submitForm() {
  305. this.$refs["form"].validate(valid => {
  306. if (valid) {
  307. if (this.form.tId != null) {
  308. updateContact(this.form).then(response => {
  309. this.msgSuccess("修改成功");
  310. this.open = false;
  311. this.getList();
  312. });
  313. } else {
  314. addContact(this.form).then(response => {
  315. this.msgSuccess("新增成功");
  316. this.open = false;
  317. this.getList();
  318. });
  319. }
  320. }
  321. });
  322. },
  323. /** 删除按钮操作 */
  324. handleDelete(row) {
  325. const tIds = row.tId || this.ids;
  326. this.$confirm('是否确认删除客户联系人编号为"' + tIds + '"的数据项?', "警告", {
  327. confirmButtonText: "确定",
  328. cancelButtonText: "取消",
  329. type: "warning"
  330. }).then(function() {
  331. return delContact(tIds);
  332. }).then(() => {
  333. this.getList();
  334. this.msgSuccess("删除成功");
  335. })
  336. },
  337. /** 导出按钮操作 */
  338. handleExport() {
  339. const queryParams = this.queryParams;
  340. this.$confirm('是否确认导出所有客户联系人数据项?', "警告", {
  341. confirmButtonText: "确定",
  342. cancelButtonText: "取消",
  343. type: "warning"
  344. }).then(function() {
  345. return exportContact(queryParams);
  346. }).then(response => {
  347. this.download(response.msg);
  348. })
  349. }
  350. }
  351. };
  352. </script>
  353. <style lang="scss" scoped>
  354. .tabSetting {
  355. display: flex;
  356. justify-content: flex-end;
  357. }
  358. .listStyle {
  359. display: flex;
  360. border-top: 1px solid #dcdfe6;
  361. border-left: 1px solid #dcdfe6;
  362. border-right: 1px solid #dcdfe6;
  363. }
  364. .listStyle:last-child {
  365. border-bottom: 1px solid #dcdfe6;
  366. }
  367. .progress {
  368. display: flex;
  369. align-items: center;
  370. padding: 2px;
  371. background-color: rgba(0, 0, 0, 0.05);
  372. height: 100%;
  373. }
  374. </style>