index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :columnParsing="columnParsing"
  7. :optionsEvensGroup="optionsEvensGroup"
  8. :tableAttributes="tableAttributes"
  9. :tableEvents="tableEvents"
  10. :operation="operation()"
  11. >
  12. <div class="cartographer_big">
  13. <el-dialog title="添加网点通知" width="100%" :modal="false" :visible.sync="formBool" :before-close="handleClose">
  14. <zj-page-container v-if="formBool">
  15. <zj-page-fill class="neibuview">
  16. <zj-form-container
  17. ref="formRef"
  18. :form-data="formData"
  19. :form-rules="formRules"
  20. :form-attributes="{ size: 'mini' }"
  21. >
  22. <zj-form-module title="基础信息" :form-data="formData" :form-items="items" />
  23. <zj-form-module title="网点信息" :form-data="formData" :form-items="items2" />
  24. </zj-form-container>
  25. </zj-page-fill>
  26. <!-- 操作按钮 -->
  27. <div style="box-sizing: border-box; padding: 10px; text-align: right">
  28. <el-button size="mini" @click="handleClose">取 消</el-button>
  29. <el-button v-if="~[0, 1].indexOf(formType)" size="mini" @click="formConfirm" type="primary"
  30. >发 送</el-button
  31. >
  32. </div>
  33. </zj-page-container>
  34. </el-dialog>
  35. </div>
  36. <div class="cartographer_big">
  37. <el-dialog
  38. title="网点通知详情"
  39. width="100%"
  40. :modal="false"
  41. :visible.sync="formBoolXQ"
  42. :before-close="handleClose"
  43. >
  44. <zj-page-container v-if="formBoolXQ">
  45. <zj-page-fill class="neibuview">
  46. <div class="nlnlknmlkmkl" style="width: 100%" v-if="formBoolXQ">
  47. <template-page
  48. ref="pageRef2"
  49. :getList="getList2"
  50. :exportList="exportList2"
  51. :operation="operation2()"
  52. ></template-page>
  53. </div>
  54. <zj-form-container
  55. ref="formRef"
  56. :form-data="formData"
  57. :form-rules="formRules"
  58. :form-attributes="{ size: 'mini' }"
  59. >
  60. <zj-form-module title="基础信息" :form-data="formData" :form-items="items" />
  61. </zj-form-container>
  62. </zj-page-fill>
  63. </zj-page-container>
  64. </el-dialog>
  65. </div>
  66. </template-page>
  67. </template>
  68. <script>
  69. import TemplatePage from '@/components/template/template-page-1.vue'
  70. import import_mixin from '@/components/template/import_mixin.js'
  71. import pagingTransfer from '@/components/paging-transfer.vue'
  72. import {
  73. noticeWebsitList,
  74. noticeWebsitListExport,
  75. noticeWebsitAdd,
  76. noticeWebsitUpdate,
  77. noticeWebsitDetail,
  78. noticeWebsitOfOrSend,
  79. noticeWebsitListWebsit,
  80. noticeWebsitListWebsitExport,
  81. noticeWebsitMarkRead,
  82. noticeWebsitMarkReadOne
  83. } from '@/api/networkNotification'
  84. import operation_mixin from '@/components/template/operation_mixin.js'
  85. import { required } from '@/components/template/rules_verify.js'
  86. import { getWebsit } from '@/api/customerManagement.js'
  87. import { EventBus } from '@/utils/eventBus'
  88. import ImageUpload from '@/components/file-upload'
  89. export default {
  90. components: { TemplatePage, ImageUpload },
  91. mixins: [import_mixin, operation_mixin],
  92. data() {
  93. return {
  94. // 表格属性
  95. tableAttributes: {
  96. selectColumn: false
  97. },
  98. // 表格事件
  99. tableEvents: {
  100. 'selection-change': this.selectionChange
  101. },
  102. recordSelected: [],
  103. formBool: false,
  104. formBoolXQ: false,
  105. formType: 0,
  106. formData: {
  107. adminCompanyId: '',
  108. adminCompanyName: '',
  109. code: '',
  110. content: '',
  111. deptName: '',
  112. issueNickName: '',
  113. issueTime: '',
  114. issueUserId: '',
  115. noticeWebsitId: '',
  116. num: '',
  117. status: 'SEND',
  118. title: '',
  119. type: '',
  120. websitIds: [],
  121. websits: [],
  122. file: []
  123. },
  124. formRules: {},
  125. formInline: {
  126. websitId: '',
  127. websitName: ''
  128. }
  129. }
  130. },
  131. computed: {
  132. optionsEvensGroup() {
  133. return [
  134. [
  135. [
  136. this.optionsEvensAuth('add', {
  137. click: () => {
  138. this.openWindow(() => {
  139. this.formType = 0
  140. this.formBool = true
  141. })
  142. }
  143. })
  144. ]
  145. ]
  146. ]
  147. },
  148. items() {
  149. return [
  150. {
  151. isShow: this.formType == 0,
  152. name: 'el-select',
  153. md: 12,
  154. name: 'el-radio',
  155. options: [
  156. { label: '管理', value: 'GL' },
  157. { label: '技术', value: 'JS' },
  158. { label: '其他', value: 'QT' },
  159. { label: '政策', value: 'ZC' },
  160. { label: '资讯', value: 'ZX' }
  161. ],
  162. attributes: {
  163. disabled: this.formType == 2,
  164. placeholder: '请输入'
  165. },
  166. formItemAttributes: {
  167. label: '通知类型',
  168. prop: 'type',
  169. rules: [...required]
  170. }
  171. },
  172. {
  173. isShow: this.formType == 0,
  174. name: 'el-input',
  175. md: 12,
  176. attributes: {
  177. disabled: this.formType == 2,
  178. placeholder: '请输入'
  179. },
  180. formItemAttributes: {
  181. label: '来源部门',
  182. prop: 'deptName',
  183. rules: [...required]
  184. }
  185. },
  186. {
  187. isShow: this.formType == 0,
  188. name: 'el-input',
  189. md: 12,
  190. attributes: {
  191. disabled: this.formType == 2,
  192. placeholder: '请输入'
  193. },
  194. formItemAttributes: {
  195. label: '文件编号',
  196. prop: 'code',
  197. rules: [...required]
  198. }
  199. },
  200. {
  201. isShow: this.formType == 0,
  202. name: 'el-input',
  203. md: 12,
  204. attributes: {
  205. disabled: this.formType == 2,
  206. placeholder: '请输入'
  207. },
  208. formItemAttributes: {
  209. label: '文件标题',
  210. prop: 'title',
  211. rules: [...required]
  212. }
  213. },
  214. {
  215. name: 'slot-component',
  216. md: 24,
  217. attributes: { disabled: this.disabled },
  218. formItemAttributes: { label: '通知内容', prop: 'content', rules: [...required] },
  219. render: (h, { props }) => {
  220. var { formData } = props
  221. return (
  222. <v-quill-editor
  223. value={formData.content}
  224. onInput={val => {
  225. formData.content = val
  226. }}
  227. ></v-quill-editor>
  228. )
  229. }
  230. },
  231. {
  232. md: 24,
  233. isShow: true,
  234. name: 'slot-component',
  235. formItemAttributes: {
  236. label: '附件',
  237. prop: 'file',
  238. rules: []
  239. },
  240. render: (h, { props, onInput }) => {
  241. var { value } = props
  242. return (
  243. <ImageUpload
  244. fileList={this.formData.file}
  245. uid="idcardUpUrl_drawg_FUJIAN"
  246. limit={100}
  247. isEdit={this.formType == 0}
  248. />
  249. )
  250. }
  251. }
  252. ]
  253. },
  254. items2() {
  255. return [
  256. {
  257. name: 'slot-component',
  258. md: 24,
  259. attributes: {},
  260. formItemAttributes: { label: '', 'label-width': '0px', prop: 'websits', rules: [] },
  261. render: (h, { props, onInput }) => {
  262. var { formData } = props
  263. return (
  264. <div>
  265. <div>
  266. <el-form
  267. size="mini"
  268. inline={true}
  269. value={this.formInline}
  270. onInput={v => {
  271. this.formInline = v
  272. }}
  273. label-width="0px"
  274. >
  275. <el-form-item label="">
  276. <el-input
  277. value={this.formInline.websitId}
  278. onInput={v => {
  279. this.formInline.websitId = v
  280. }}
  281. placeholder="网点编号"
  282. ></el-input>
  283. </el-form-item>
  284. <el-form-item label="">
  285. <el-input
  286. value={this.formInline.websitName}
  287. onInput={v => {
  288. this.formInline.websitName = v
  289. }}
  290. placeholder="网点名称"
  291. ></el-input>
  292. </el-form-item>
  293. <el-form-item>
  294. <el-button
  295. type="primary"
  296. onClick={() => {
  297. EventBus.$emit('handlePaginationCallBack22')
  298. }}
  299. >
  300. 查询
  301. </el-button>
  302. <el-button
  303. onClick={() => {
  304. this.formInline.websitId = ''
  305. this.formInline.websitName = ''
  306. this.$nextTick(() => {
  307. EventBus.$emit('handlePaginationCallBack22')
  308. })
  309. }}
  310. >
  311. 重置
  312. </el-button>
  313. </el-form-item>
  314. </el-form>
  315. </div>
  316. <pagingTransfer
  317. handlePaginationCallBackKey="handlePaginationCallBack22"
  318. value={this.formData.websits}
  319. onInput={v => {
  320. this.formData.websits = v
  321. }}
  322. left-columns={[
  323. { id: 'belongCompanyCode', label: '所属公司编号', width: '160' },
  324. { id: 'websitId', label: '网点编号', width: '120' },
  325. { id: 'websitName', label: '网点名称', width: '' }
  326. ]}
  327. right-columns={[
  328. { id: 'belongCompanyCode', label: '所属公司编号', width: '160' },
  329. { id: 'websitId', label: '网点编号', width: '120' },
  330. { id: 'websitName', label: '网点名称', width: '' }
  331. ]}
  332. show-pagination={false}
  333. pagination-call-back={this.paginationCallback}
  334. title-texts={['待选项', '已选项']}
  335. min-height="300px"
  336. table-row-key={row => row.websitId}
  337. />
  338. </div>
  339. )
  340. }
  341. }
  342. ]
  343. }
  344. },
  345. created() {
  346. this.initFun()
  347. },
  348. methods: {
  349. initFun() {
  350. if (this.pageType == 'detail' && this.pageCode) {
  351. noticeWebsitDetail({
  352. id: this.pageCode
  353. }).then(res => {
  354. this.formData = {
  355. ...res.data,
  356. file: res.data.file ? res.data.file.split(',').map(url => ({ url })) : []
  357. }
  358. this.formType = 2
  359. this.openWindow(() => {
  360. this.formBoolXQ = true
  361. })
  362. })
  363. }
  364. },
  365. // 列表请求函数
  366. getList: noticeWebsitList,
  367. // 导出
  368. exportList: noticeWebsitListExport,
  369. // 列表请求函数
  370. getList2(p, cb) {
  371. var pam = JSON.parse(JSON.stringify(p))
  372. try {
  373. pam.params.push({ param: 'a.notice_websit_id', compare: '=', value: this.formData.noticeWebsitId })
  374. cb && cb(pam)
  375. return noticeWebsitListWebsit(pam)
  376. } catch (err) {}
  377. },
  378. // 导出
  379. exportList2: noticeWebsitListWebsitExport,
  380. // 表格列解析渲染数据更改
  381. columnParsing(item, defaultData) {
  382. return defaultData
  383. },
  384. // 获取勾选框数据
  385. selectionChange(data) {
  386. this.recordSelected = data
  387. },
  388. handleClose() {
  389. this.$refs?.pageRef?.refreshList()
  390. this.$data.formData = this.$options.data().formData
  391. this.formType = 0
  392. this.formBool = false
  393. this.formBoolXQ = false
  394. },
  395. formConfirm() {
  396. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  397. if (valid) {
  398. ;(this.formType ? noticeWebsitUpdate : noticeWebsitAdd)({
  399. ...this.formData,
  400. websitIds: this.formData.websits.map(item => item.websitId),
  401. file: this.formData.file.map(item => item.url).join(',')
  402. }).then(res => {
  403. this.$message({ type: 'success', message: '成功!' })
  404. this.$refs.pageRef.refreshList()
  405. this.handleClose()
  406. })
  407. }
  408. })
  409. },
  410. operation() {
  411. return this.operationBtn({
  412. details: {
  413. click: ({ row, index, column }) => {
  414. this.openWindow(() => {
  415. noticeWebsitDetail({
  416. id: row.noticeWebsitId
  417. }).then(res => {
  418. this.formData = {
  419. ...res.data,
  420. file: res.data.file ? res.data.file.split(',').map(url => ({ url })) : []
  421. }
  422. this.formType = 2
  423. this.openWindow(() => {
  424. this.formBoolXQ = true
  425. })
  426. })
  427. })
  428. }
  429. },
  430. publish: {
  431. prompt: '确定发布吗?',
  432. conditions: ({ row, index, column }) => {
  433. return row.status !== 'SEND'
  434. },
  435. click: ({ row, index, column }) => {
  436. noticeWebsitOfOrSend({
  437. id: row.noticeWebsitId,
  438. status: 'SEND'
  439. }).then(res => {
  440. this.$message({
  441. type: 'success',
  442. message: '操作成功!'
  443. })
  444. this.$refs.pageRef.refreshList()
  445. })
  446. }
  447. },
  448. close: {
  449. prompt: '确定关闭吗?',
  450. conditions: ({ row, index, column }) => {
  451. return row.status !== 'OFF'
  452. },
  453. click: ({ row, index, column }) => {
  454. noticeWebsitOfOrSend({
  455. id: row.noticeWebsitId,
  456. status: 'OFF'
  457. }).then(res => {
  458. this.$message({
  459. type: 'success',
  460. message: '操作成功!'
  461. })
  462. this.$refs.pageRef.refreshList()
  463. })
  464. }
  465. }
  466. })
  467. },
  468. operation2() {
  469. return this.operationBtn({
  470. details: {
  471. name: '接收',
  472. conditions: ({ row, index, column }) => {
  473. return row.readFlag == 'NO'
  474. },
  475. click: ({ row, index, column }) => {
  476. noticeWebsitMarkReadOne({
  477. id: row.id
  478. }).then(res => {
  479. this.$message({
  480. type: 'success',
  481. message: '操作成功!'
  482. })
  483. this.$refs.pageRef2.refreshList()
  484. })
  485. }
  486. }
  487. })
  488. },
  489. openWindow(cb) {
  490. this.$nextTick(() => {
  491. cb?.()
  492. })
  493. },
  494. paginationCallback({ pageIndex, pageSize }) {
  495. return new Promise(resolve => {
  496. getWebsit({ ...this.formInline }).then(res => {
  497. resolve({
  498. total: res.data.filter(item => item.type == 'C').length,
  499. data: res.data
  500. .filter(item => item.type == 'C')
  501. .map(item => {
  502. return {
  503. ...item,
  504. websitName: item.name
  505. }
  506. })
  507. })
  508. })
  509. })
  510. }
  511. }
  512. }
  513. </script>
  514. <style lang="scss">
  515. .nlnlknmlkmkl {
  516. .zj-page-template {
  517. padding: 0px !important;
  518. }
  519. .zj-page-fill {
  520. min-height: auto !important;
  521. .zj-page-fill-scroll {
  522. height: auto !important;
  523. .page-content {
  524. height: auto !important;
  525. .el-form {
  526. height: auto !important;
  527. .zj-table-class {
  528. height: auto !important;
  529. .dropUseKey {
  530. height: auto !important;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. }
  537. }
  538. </style>
  539. <style lang="scss" scoped>
  540. .nlnlknmlkmkl {
  541. ::v-deep .zj-page-template {
  542. padding: none !important;
  543. }
  544. }
  545. .neibuview {
  546. box-sizing: border-box;
  547. padding-left: 16px;
  548. ::v-deep & > .zj-page-fill-scroll {
  549. box-sizing: border-box;
  550. padding-right: 16px;
  551. & > div:nth-child(1) {
  552. margin-top: 20px;
  553. }
  554. }
  555. }
  556. </style>