index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  4. <el-row :gutter="10" justify="space-between">
  5. <el-col :span="5">
  6. <el-form-item label="所属客户" prop="customerName">
  7. <el-popover-select-v2 v-model="queryParams.customerName" title="客户" valueKey="name"
  8. referName="CUSTOMER_PARAM_ZT" :dataMapping="{ customer: 'id', customerName: 'name'}"
  9. :source.sync="queryParams" placeholder="请输入所属客户" @keyup.enter.native="handleQuery" />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="5">
  13. <el-form-item label="产线" prop="productionLineName">
  14. <el-popover-tree-select v-model="queryParams.productionLineName" valueKey='name' title="产线"
  15. referName="PRODUCTLINE" :dataMapping="{ customCode: 'id', custom: 'name'}" :source.sync="queryParams"
  16. placeholder="请输入产线" @keyup.enter.native="handleQuery" />
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="5">
  20. <el-form-item label="供应商" prop="rivalName" label-width="120px">
  21. <el-popover-select-v2 v-model="queryParams.rivalName" title="供应商" valueKey="name" referName="MKRIVAL_PARAM"
  22. :dataMapping="{ rival: 'id', rivalName: 'name'}" :source.sync="queryParams" placeholder="请输入供应商"
  23. @keyup.enter.native="handleQuery" />
  24. </el-form-item>
  25. </el-col>
  26. <el-row :gutter="10" class="mb8" style="float: right">
  27. <el-col :span="1.5">
  28. <el-form-item>
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. </el-row>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8" style="float: right">
  37. <el-col :span="1.5">
  38. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button type="primary" plain icon="el-icon-download" size="mini" @click="handleDownload">模板下载</el-button>
  42. </el-col>
  43. <el-col :span="1.5">
  44. <el-upload ref="upload" action="" :http-request="handleUpload">
  45. <el-button size="mini" type="primary">导入</el-button>
  46. </el-upload>
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改
  50. </el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
  54. </el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
  58. </el-col>
  59. </el-row>
  60. <el-table v-loading="loading" :data="gatherList" @selection-change="handleSelectionChange" v-horizontal-scroll>
  61. <el-table-column type="selection" width="55" align="center" />
  62. <el-table-column label="序号" type="index" width="50" align="center" fixed />
  63. <el-table-column label="所属客户" align="center" prop="customerName" width="220" />
  64. <el-table-column label="产线" align="center" prop="productionLineName" width="150" />
  65. <el-table-column label="供应商" align="center" prop="rivalName" width="220" />
  66. <el-table-column label="供应商体量(万)" align="center" prop="rivalBulk" width="130" />
  67. <el-table-column label="品牌" align="center" prop="brand" width="100" />
  68. <el-table-column label="品牌份额(万)" align="center" prop="brandPortion" width="120" />
  69. <el-table-column label="合作期限(起)" align="center" prop="cooperationStart" width="180">
  70. <template slot-scope="scope">
  71. <span>{{ parseTime(scope.row.cooperationStart, '{y}-{m}-{d}') }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="合作期限(止)" align="center" prop="cooperationEnd" width="180">
  75. <template slot-scope="scope">
  76. <span>{{ parseTime(scope.row.cooperationEnd, '{y}-{m}-{d}') }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="科室关键人" align="center" prop="sectionKeyPsnname" width="90" />
  80. <el-table-column label="科室关键人联系电话" align="center" prop="sectionKeyPsnphone" width="120" />
  81. <el-table-column label="院级关键人" align="center" prop="hospitalKeyPsnname" width="90" />
  82. <el-table-column label="院级关键人联系电话" align="center" prop="hospitalKeyPsnphone" width="120" />
  83. <el-table-column label="供应商关键人" align="center" prop="rivalKeyPsnname" width="90" />
  84. <el-table-column label="供应商关键人联系电话" align="center" prop="rivalKeyPsnphone" width="120" />
  85. <el-table-column label="开发思路" align="center" prop="idea" min-width="220" show-overflow-tooltip />
  86. <el-table-column label="机会点/困难点所需资源" align="center" prop="chance" min-width="220" show-overflow-tooltip />
  87. <el-table-column label="备注" align="center" prop="remark" min-width="220" show-overflow-tooltip />
  88. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
  89. <template slot-scope="scope">
  90. <el-button size="mini" type="text" icon="el-icon-search" @click="handleSee(scope.row)">查看</el-button>
  91. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
  92. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  97. @pagination="getList" />
  98. <!-- 添加或修改竞争产品信息收集对话框 -->
  99. <el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
  100. <el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="pageState == 'see'">
  101. <el-row :gutter="20">
  102. <el-col :span="6">
  103. <el-form-item label="所属客户" prop="customerName">
  104. <el-popover-select-v2 v-model="form.customerName" title="客户" valueKey="name" referName="CUSTOMER_PARAM_ZT"
  105. :dataMapping="{ customer: 'id', customerName: 'name'}" :source.sync="form" placeholder="请输入所属客户" />
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="6">
  109. <el-form-item label="产线" prop="productionLineName">
  110. <el-popover-tree-select v-model="form.productionLineName" valueKey='name' title="产线"
  111. referName="PRODUCTLINE" :dataMapping="{ customCode: 'id', custom: 'name'}" :source.sync="form"
  112. placeholder="请输入产线" />
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="6">
  116. <el-form-item label="供应商" prop="rivalName" label-width="100px">
  117. <el-popover-select-v2 v-model="form.rivalName" title="供应商" valueKey="name" referName="MKRIVAL_PARAM"
  118. :dataMapping="{ rival: 'id', rivalName: 'name'}" :source.sync="form" placeholder="请输入供应商" />
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="6">
  122. <el-form-item label="供应商体量(万)" prop="rivalBulk" label-width="130px">
  123. <el-input-number v-model="form.rivalBulk" :precision="2" :step="1"></el-input-number>
  124. </el-form-item>
  125. </el-col>
  126. </el-row>
  127. <el-row :gutter="20">
  128. <el-col :span="6">
  129. <el-form-item label="品牌" prop="brand">
  130. <el-input v-model="form.brand" placeholder="请输入品牌" />
  131. </el-form-item>
  132. </el-col>
  133. <el-col :span="6">
  134. <el-form-item label="品牌份额(万)" prop="brandPortion" label-width="120px">
  135. <el-input-number v-model="form.brandPortion" :precision="2" :step="1"></el-input-number>
  136. </el-form-item>
  137. </el-col>
  138. <el-col :span="6">
  139. <el-form-item label="合作期限" prop="cooperationStart">
  140. <el-date-picker clearable v-model="form.cooperationStart" type="date" value-format="yyyy-MM-dd"
  141. placeholder="请选择合作期限">
  142. </el-date-picker>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="6">
  146. <el-form-item label="合作期限" prop="cooperationEnd">
  147. <el-date-picker clearable v-model="form.cooperationEnd" type="date" value-format="yyyy-MM-dd"
  148. placeholder="请选择合作期限">
  149. </el-date-picker>
  150. </el-form-item>
  151. </el-col>
  152. </el-row>
  153. <el-row :gutter="20">
  154. <el-col :span="6">
  155. <el-form-item label="科室关键人" prop="sectionKeyPsnname" label-width="110px">
  156. <el-input v-model="form.sectionKeyPsnname" placeholder="请输入科室关键人姓名" />
  157. </el-form-item>
  158. </el-col>
  159. <el-col :span="6">
  160. <el-form-item label="科室关键人联系电话" prop="sectionKeyPsnphone" label-width="140px">
  161. <el-input v-model="form.sectionKeyPsnphone" placeholder="请输入科室关键人联系电话" />
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="6">
  165. <el-form-item label="院级关键人" prop="hospitalKeyPsnname" label-width="110px">
  166. <el-input v-model="form.hospitalKeyPsnname" placeholder="请输入院级关键人姓名" />
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="6">
  170. <el-form-item label="院级关键人联系电话" prop="hospitalKeyPsnphone" label-width="140px">
  171. <el-input v-model="form.hospitalKeyPsnphone" placeholder="请输入院级关键人联系电话" />
  172. </el-form-item>
  173. </el-col>
  174. </el-row>
  175. <el-row :gutter="20">
  176. <el-col :span="6">
  177. <el-form-item label="供应商关键人" prop="rivalKeyPsnname" label-width="140px">
  178. <el-input v-model="form.rivalKeyPsnname" placeholder="请输入供应商关键人姓名" />
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="6">
  182. <el-form-item label="供应商关键人联系电话" prop="rivalKeyPsnphone" label-width="170px">
  183. <el-input v-model="form.rivalKeyPsnphone" placeholder="请输入供应商关键人联系电话" />
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-form-item label="开发思路" prop="idea">
  188. <el-input v-model="form.idea" placeholder="请输入开发思路" type="textarea" />
  189. </el-form-item>
  190. <el-form-item label="机会点/困难点所需资源" prop="chance" label-width="160px">
  191. <el-input v-model="form.chance" placeholder="请输入机会点/困难点所需资源" type="textarea" />
  192. </el-form-item>
  193. <el-form-item label="备注" prop="remark">
  194. <el-input v-model="form.remark" placeholder="请输入备注" type="textarea" />
  195. </el-form-item>
  196. </el-form>
  197. <div slot="footer" class="dialog-footer">
  198. <el-button type="primary" @click="submitForm" :disabled="pageState == 'see'">确 定</el-button>
  199. <el-button @click="cancel">取 消</el-button>
  200. </div>
  201. </el-dialog>
  202. </div>
  203. </template>
  204. <script>
  205. import {
  206. listGather,
  207. getGather,
  208. delGather,
  209. addGather,
  210. updateGather,
  211. upload
  212. } from "@/api/business/spd/bo/gather";
  213. import {
  214. getToken
  215. } from "@/utils/auth";
  216. export default {
  217. name: "Gather",
  218. components: {
  219. ElPopoverSelectV2: () =>
  220. import("@/components/popover-select-v2"),
  221. ElPopoverTreeSelect: () =>
  222. import("@/components/popover-tree-select/index.vue"),
  223. },
  224. data() {
  225. return {
  226. // 遮罩层
  227. loading: true,
  228. // 选中数组
  229. ids: [],
  230. // 非单个禁用
  231. single: true,
  232. // 非多个禁用
  233. multiple: true,
  234. // 总条数
  235. total: 0,
  236. // 竞争产品信息收集表格数据
  237. gatherList: [],
  238. // 弹出层标题
  239. title: "",
  240. // 是否显示弹出层
  241. open: false,
  242. // 查询参数
  243. queryParams: {
  244. pageNum: 1,
  245. pageSize: 10,
  246. customer: null,
  247. customerName: null,
  248. productionLine: null,
  249. productionLineName: null,
  250. rival: null,
  251. rivalName: null,
  252. rivalBulk: null,
  253. brand: null,
  254. brandPortion: null,
  255. cooperationStart: null,
  256. cooperationEnd: null,
  257. sectionKeyPsnname: null,
  258. sectionKeyPsnphone: null,
  259. hospitalKeyPsnname: null,
  260. hospitalKeyPsnphone: null,
  261. rivalKeyPsnname: null,
  262. rivalKeyPsnphone: null,
  263. idea: null,
  264. chance: null,
  265. tenantId: null,
  266. revision: null,
  267. },
  268. // 表单参数
  269. form: {},
  270. // 表单校验
  271. rules: {},
  272. // 页面状态
  273. pageState: null,
  274. };
  275. },
  276. created() {
  277. this.getList();
  278. },
  279. methods: {
  280. /** 查询竞争产品信息收集列表 */
  281. getList() {
  282. this.loading = true;
  283. listGather(this.queryParams).then(response => {
  284. this.gatherList = response.rows;
  285. this.total = response.total;
  286. this.loading = false;
  287. });
  288. },
  289. // 取消按钮
  290. cancel() {
  291. this.open = false;
  292. this.reset();
  293. },
  294. // 表单重置
  295. reset() {
  296. this.form = {
  297. id: null,
  298. customer: null,
  299. customerName: null,
  300. productionLine: null,
  301. productionLineName: null,
  302. rival: null,
  303. rivalName: null,
  304. rivalBulk: null,
  305. brand: null,
  306. brandPortion: null,
  307. cooperationStart: null,
  308. cooperationEnd: null,
  309. sectionKeyPsnname: null,
  310. sectionKeyPsnphone: null,
  311. hospitalKeyPsnname: null,
  312. hospitalKeyPsnphone: null,
  313. rivalKeyPsnname: null,
  314. rivalKeyPsnphone: null,
  315. idea: null,
  316. chance: null,
  317. remark: null,
  318. tenantId: null,
  319. revision: null,
  320. createBy: null,
  321. createTime: null,
  322. updateBy: null,
  323. updateTime: null,
  324. delFlag: null
  325. };
  326. this.resetForm("form");
  327. },
  328. /** 搜索按钮操作 */
  329. handleQuery() {
  330. this.queryParams.pageNum = 1;
  331. this.getList();
  332. },
  333. /** 重置按钮操作 */
  334. resetQuery() {
  335. this.resetForm("queryForm");
  336. this.handleQuery();
  337. },
  338. // 多选框选中数据
  339. handleSelectionChange(selection) {
  340. this.ids = selection.map(item => item.id)
  341. this.single = selection.length !== 1
  342. this.multiple = !selection.length
  343. },
  344. /** 新增按钮操作 */
  345. handleAdd() {
  346. this.reset();
  347. this.open = true;
  348. this.title = "添加竞争产品信息收集";
  349. this.pageState = 'insert';
  350. },
  351. /** 模板下载按钮操作 */
  352. handleDownload() {
  353. this.download('mk/bo/gathercg/download', {}, `竞争对手信息收集导入模板_${new Date().getTime()}.xlsx`)
  354. },
  355. /** 导入按钮操作 */
  356. handleUpload(file) {
  357. this.loading = true;
  358. let formData = new FormData()
  359. formData.append('file', file.file)
  360. upload(formData).then((res) => {
  361. console.log('res', res);
  362. if (res.code == '200') {
  363. this.resetQuery();
  364. if (res.msg.indexOf('导入失败') >= 0) {
  365. this.$message({
  366. duration: 5000,
  367. message: res.msg
  368. });
  369. } else {
  370. this.$message.success(res.msg);
  371. }
  372. } else {
  373. this.$message.error(res.msg);
  374. }
  375. this.loading = false;
  376. }).catch((e) => {
  377. this.$message.error(e.message)
  378. }).finally((e) => {
  379. this.$refs['upload'].clearFiles();
  380. this.loading = false;
  381. })
  382. },
  383. /** 查看按钮操作 */
  384. handleSee(row) {
  385. this.reset();
  386. const id = row.id || this.ids
  387. getGather(id).then(response => {
  388. this.form = response.data;
  389. this.open = true;
  390. this.title = "查看竞争产品信息收集";
  391. this.pageState = 'see';
  392. });
  393. },
  394. /** 修改按钮操作 */
  395. handleUpdate(row) {
  396. this.reset();
  397. const id = row.id || this.ids
  398. getGather(id).then(response => {
  399. this.form = response.data;
  400. this.open = true;
  401. this.title = "修改竞争产品信息收集";
  402. this.pageState = 'update';
  403. });
  404. },
  405. /** 提交按钮 */
  406. submitForm() {
  407. this.$refs["form"].validate(valid => {
  408. if (valid) {
  409. if (this.form.id != null) {
  410. updateGather(this.form).then(response => {
  411. this.$modal.msgSuccess("修改成功");
  412. this.open = false;
  413. this.getList();
  414. });
  415. } else {
  416. addGather(this.form).then(response => {
  417. this.$modal.msgSuccess("新增成功");
  418. this.open = false;
  419. this.getList();
  420. });
  421. }
  422. }
  423. });
  424. },
  425. /** 删除按钮操作 */
  426. handleDelete(row) {
  427. if (row.id != undefined) {
  428. this.ids.push(row.id);
  429. }
  430. const ids = this.ids;
  431. this.$modal.confirm('是否确认删除?').then(function () {
  432. return delGather(ids);
  433. }).then(() => {
  434. this.getList();
  435. this.$modal.msgSuccess("删除成功");
  436. }).catch(() => {});
  437. },
  438. /** 导出按钮操作 */
  439. handleExport() {
  440. this.download('mk/bo/gathercg/export', {
  441. ...this.queryParams
  442. }, `gather_${new Date().getTime()}.xlsx`)
  443. },
  444. }
  445. };
  446. </script>