index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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: [...required] },
  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. methods: {
  346. // 列表请求函数
  347. getList: noticeWebsitList,
  348. // 导出
  349. exportList: noticeWebsitListExport,
  350. // 列表请求函数
  351. getList2(p, cb) {
  352. var pam = JSON.parse(JSON.stringify(p))
  353. try {
  354. pam.params.push({ param: 'a.notice_websit_id', compare: '=', value: this.formData.noticeWebsitId })
  355. cb && cb(pam)
  356. return noticeWebsitListWebsit(pam)
  357. } catch (err) {}
  358. },
  359. // 导出
  360. exportList2: noticeWebsitListWebsitExport,
  361. // 表格列解析渲染数据更改
  362. columnParsing(item, defaultData) {
  363. return defaultData
  364. },
  365. // 获取勾选框数据
  366. selectionChange(data) {
  367. this.recordSelected = data
  368. },
  369. handleClose() {
  370. this.$refs?.pageRef?.refreshList()
  371. this.$data.formData = this.$options.data().formData
  372. this.formType = 0
  373. this.formBool = false
  374. this.formBoolXQ = false
  375. },
  376. formConfirm() {
  377. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  378. if (valid) {
  379. ;(this.formType ? noticeWebsitUpdate : noticeWebsitAdd)({
  380. ...this.formData,
  381. websitIds: this.formData.websits.map(item => item.websitId),
  382. file: this.formData.file.map(item => item.url).join(',')
  383. }).then(res => {
  384. this.$message({ type: 'success', message: '成功!' })
  385. this.$refs.pageRef.refreshList()
  386. this.handleClose()
  387. })
  388. }
  389. })
  390. },
  391. operation() {
  392. return this.operationBtn({
  393. details: {
  394. click: ({ row, index, column }) => {
  395. this.openWindow(() => {
  396. noticeWebsitDetail({
  397. id: row.noticeWebsitId
  398. }).then(res => {
  399. this.formData = {
  400. ...res.data,
  401. file: res.data.file ? res.data.file.split(',').map(url => ({ url })) : []
  402. }
  403. this.formType = 2
  404. this.openWindow(() => {
  405. this.formBoolXQ = true
  406. })
  407. })
  408. })
  409. }
  410. },
  411. publish: {
  412. prompt: '确定发布吗?',
  413. conditions: ({ row, index, column }) => {
  414. return row.status !== 'SEND'
  415. },
  416. click: ({ row, index, column }) => {
  417. noticeWebsitOfOrSend({
  418. id: row.noticeWebsitId,
  419. status: 'SEND'
  420. }).then(res => {
  421. this.$message({
  422. type: 'success',
  423. message: '操作成功!'
  424. })
  425. this.$refs.pageRef.refreshList()
  426. })
  427. }
  428. },
  429. close: {
  430. prompt: '确定关闭吗?',
  431. conditions: ({ row, index, column }) => {
  432. return row.status !== 'OFF'
  433. },
  434. click: ({ row, index, column }) => {
  435. noticeWebsitOfOrSend({
  436. id: row.noticeWebsitId,
  437. status: 'OFF'
  438. }).then(res => {
  439. this.$message({
  440. type: 'success',
  441. message: '操作成功!'
  442. })
  443. this.$refs.pageRef.refreshList()
  444. })
  445. }
  446. }
  447. })
  448. },
  449. operation2() {
  450. return this.operationBtn({
  451. details: {
  452. name: '接收',
  453. conditions: ({ row, index, column }) => {
  454. return row.readFlag == 'NO'
  455. },
  456. click: ({ row, index, column }) => {
  457. noticeWebsitMarkReadOne({
  458. id: row.id
  459. }).then(res => {
  460. this.$message({
  461. type: 'success',
  462. message: '操作成功!'
  463. })
  464. this.$refs.pageRef2.refreshList()
  465. })
  466. }
  467. }
  468. })
  469. },
  470. openWindow(cb) {
  471. this.$nextTick(() => {
  472. cb?.()
  473. })
  474. },
  475. paginationCallback({ pageIndex, pageSize }) {
  476. return new Promise(resolve => {
  477. getWebsit({ ...this.formInline }).then(res => {
  478. resolve({
  479. total: res.data.filter(item => item.type == 'C').length,
  480. data: res.data
  481. .filter(item => item.type == 'C')
  482. .map(item => {
  483. return {
  484. ...item,
  485. websitName: item.name
  486. }
  487. })
  488. })
  489. })
  490. })
  491. }
  492. }
  493. }
  494. </script>
  495. <style lang="scss">
  496. .nlnlknmlkmkl {
  497. .zj-page-template {
  498. padding: 0px !important;
  499. }
  500. .zj-page-fill {
  501. min-height: auto !important;
  502. .zj-page-fill-scroll {
  503. height: auto !important;
  504. .page-content {
  505. height: auto !important;
  506. .el-form {
  507. height: auto !important;
  508. .zj-table-class {
  509. height: auto !important;
  510. .dropUseKey {
  511. height: auto !important;
  512. }
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519. </style>
  520. <style lang="scss" scoped>
  521. .nlnlknmlkmkl {
  522. ::v-deep .zj-page-template {
  523. padding: none !important;
  524. }
  525. }
  526. .neibuview {
  527. box-sizing: border-box;
  528. padding-left: 16px;
  529. ::v-deep & > .zj-page-fill-scroll {
  530. box-sizing: border-box;
  531. padding-right: 16px;
  532. & > div:nth-child(1) {
  533. margin-top: 20px;
  534. }
  535. }
  536. }
  537. </style>