duanxinmoban.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div>
  3. <div style="display: inline-block;">
  4. <span>状态:</span>
  5. <el-select v-model="status1" style="width:150px;margin-left: 10px;" @change="select()">
  6. <el-option v-for="item in statesnum2" :key="item.value" :label="item.label" :value="item.value">
  7. </el-option>
  8. </el-select>&nbsp;&nbsp;
  9. <div style="position: relative;display: inline-block;">
  10. <span>模板名称:</span>
  11. <el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入模板名称" v-model="templateName1">
  12. </el-input>&nbsp;&nbsp;
  13. </div>
  14. <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="select">查询
  15. </el-button>
  16. <el-button style='margin-left:15px;' size="mini" type="primary" icon="document" @click="cleans">重置
  17. </el-button>
  18. <!-- <el-button style='margin:0 0 20px 20px;' v-if="isAuth('autonym:tongguo')" size="mini" type="primary"
  19. icon="document" @click="passClick()" :disabled="checkBoxData.length <= 0">通过</el-button> -->
  20. </div>
  21. <div style="float: right;margin-right:2%;">
  22. <el-button :disabled="!isAuth('duanxinmoban:add')" icon="document" size="mini" style="margin: 10px 0;"
  23. type="primary" @click="addNotice">添加模板</el-button>
  24. </div>
  25. <el-table v-loading="tableDataLoading" :data="duanxinData.list">
  26. <el-table-column fixed prop="complaintId" label="编号" width="80">
  27. <template slot-scope="scope">
  28. <span>{{scope.$index+1}}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column prop="id" label="订单id" width="200" align="center">
  32. </el-table-column>
  33. <el-table-column prop="status" label="状态" width="150">
  34. <template slot-scope="scope">
  35. <div v-if="scope.row.status=='1'">启用</div>
  36. <div v-if="scope.row.status=='0'">不启用</div>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="templateName" label="模板名称" width="180"></el-table-column>
  40. <el-table-column prop="templateContent" label="短信内容" width="180"></el-table-column>
  41. <el-table-column prop="platformCode" label="第三方平台模板code" width="120" align="center">
  42. </el-table-column>
  43. <el-table-column prop="platformType" label="第三方平台类型" width="150">
  44. <template slot-scope="scope">
  45. <div v-if="scope.row.platformType==1">腾讯</div>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="操作" width="230" fixed="right">
  49. <template slot-scope="scope">
  50. <el-button :disabled="!isAuth('duanxinmoban:update')" size="mini" type="primary"
  51. @click="updates( scope.row)" style="margin: 5px;">修改信息
  52. </el-button>
  53. <el-button size="mini" type="danger"
  54. :disabled="!isAuth('duanxinmoban:delete')" @click="deletes(scope.row)">删除
  55. </el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <div style="text-align: center;margin-top: 10px;">
  60. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  61. :page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
  62. layout="total,sizes, prev, pager, next,jumper" :total="duanxinData.totalCount">
  63. </el-pagination>
  64. </div>
  65. <!-- 添加短信模板 -->
  66. <el-dialog :visible.sync="dialogFormVisible" center :title="titles">
  67. <div style="margin-bottom: 10px;">
  68. <span style="width: 200px;display: inline-block;text-align: right;">模板名称:</span>
  69. <el-input v-model="templateName" placeholder="请输入模板名称" style="width:50%;"></el-input>
  70. </div>
  71. <div style="margin-bottom: 10px;">
  72. <span style="width: 200px;display: inline-block;text-align: right;">模板内容:</span>
  73. <el-input v-model="templateContent" placeholder="请输入模板内容" style="width:50%;"></el-input>
  74. </div>
  75. <div style="margin-bottom: 10px;">
  76. <span style="width: 200px;display: inline-block;text-align: right;">是否启用:</span>
  77. <el-radio-group v-model="status">
  78. <el-radio :label="'0'">不启用</el-radio>
  79. <el-radio :label="'1'">启用</el-radio>
  80. </el-radio-group>
  81. </div>
  82. <div>
  83. <div id="container1" style="width:80%;height:500px;margin-left: 10%;"></div>
  84. </div>
  85. <div slot="footer" class="dialog-footer">
  86. <el-button @click="dialogFormVisible = false">取 消</el-button>
  87. <el-button type="primary" @click="releasNoticeTo()">确 定</el-button>
  88. </div>
  89. </el-dialog>
  90. </div>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. limit: 10,
  97. page: 1,
  98. activeName: 'first',
  99. tableDataLoading: false,
  100. dialogFormVisible: false,
  101. templateName:'',
  102. templateName1:'',
  103. platformType:'',
  104. statesnum2: [{
  105. label: '全部',
  106. value: ''
  107. },
  108. {
  109. label: '不启用',
  110. value: '0'
  111. },
  112. {
  113. label: '启用',
  114. value: '1'
  115. },
  116. ],
  117. platformCode:'',
  118. status:'',
  119. status1:'',
  120. duanxinData:[],
  121. templateContent:'',
  122. titles: '添加',
  123. id:'',
  124. }
  125. },
  126. methods: {
  127. handleSizeChange(val) {
  128. this.limit = val;
  129. this.dataSelect()
  130. },
  131. handleCurrentChange(val) {
  132. this.page = val;
  133. this.dataSelect()
  134. },
  135. // 查询
  136. select() {
  137. this.page = 1
  138. this.limit = 10
  139. this.dataSelect()
  140. },
  141. // 重置
  142. cleans() {
  143. this.templateName1 = ''
  144. this.platformType = ''
  145. this.status1 = ''
  146. this.page = 1
  147. this.dataSelect()
  148. },
  149. //添加模板
  150. addNotice(){
  151. this.titles = '添加'
  152. this.platformCode='1400879272'
  153. this.templateName = ''
  154. this.platformType = '1'
  155. this.templateContent=''
  156. this.status = ''
  157. this.dialogFormVisible = true
  158. },
  159. // 添加模板
  160. releasNoticeTo() {
  161. if (this.templateName == '') {
  162. this.$notify({
  163. title: '提示',
  164. duration: 1800,
  165. message: '请输入模板名称',
  166. type: 'warning'
  167. })
  168. return
  169. }
  170. if (this.templateContent == '') {
  171. this.$notify({
  172. title: '提示',
  173. duration: 1800,
  174. message: '请输入模板内容',
  175. type: 'warning'
  176. })
  177. return
  178. }
  179. var datas = {}
  180. datas.templateName = this.templateName
  181. datas.templateContent=this.templateContent
  182. datas.platformCode = this.platformCode
  183. datas.platformType = this.platformType
  184. datas.status = this.status
  185. var url = 'admin/tb-indent-sms/template'
  186. if (this.titles == '添加') {
  187. var zhuang='post'
  188. }
  189. if (this.titles == '修改') {
  190. var zhuang='put'
  191. datas.id = this.id
  192. }
  193. this.$http({
  194. url: this.$http.adornUrl(url),
  195. method: zhuang,
  196. data: this.$http.adornData(datas)
  197. }).then(({
  198. data
  199. }) => {
  200. if (data.code == 0) {
  201. this.dialogFormVisible = false
  202. this.$message({
  203. message: '操作成功',
  204. type: 'success',
  205. duration: 1500,
  206. onClose: () => {
  207. this.dataSelect()
  208. }
  209. })
  210. } else {
  211. this.$message({
  212. message: data.msg,
  213. type: 'warning',
  214. duration: 1500,
  215. onClose: () => {}
  216. })
  217. }
  218. })
  219. },
  220. // 修改弹框
  221. updates( rows) {
  222. console.log('修改')
  223. console.log(rows.status)
  224. this.titles = '修改'
  225. this.id = rows.id
  226. this.templateName = rows.templateName
  227. this.platformCode='1400879272'
  228. this.platformType = '1'
  229. this.templateContent=rows.templateContent
  230. if (rows.status!=null) {
  231. this.status = rows.status
  232. }else{
  233. this.status = '1'
  234. }
  235. this.dialogFormVisible = true
  236. },
  237. // 删除模板
  238. deletes(row) {
  239. let delid = [row.id]
  240. this.$confirm(`确定删除此条信息?`, '提示', {
  241. confirmButtonText: '确定',
  242. cancelButtonText: '取消',
  243. type: 'warning'
  244. }).then(() => {
  245. this.$http({
  246. url: this.$http.adornUrl('admin/tb-indent-sms/template'),
  247. method: 'delete',
  248. data: this.$http.adornData(delid)
  249. }).then(({
  250. data
  251. }) => {
  252. if (data.code == 0) {
  253. this.$message({
  254. message: '删除成功',
  255. type: 'success',
  256. duration: 1500,
  257. onClose: () => {
  258. this.dataSelect()
  259. }
  260. })
  261. }
  262. })
  263. }).catch(() => {})
  264. },
  265. // 获取派单数据列表
  266. dataSelect() {
  267. this.tableDataLoading = true
  268. this.$http({
  269. url: this.$http.adornUrl('admin/tb-indent-sms/template'),
  270. method: 'get',
  271. params: this.$http.adornParams({
  272. 'page': this.page,
  273. 'limit': this.limit,
  274. 'templateName': this.templateName1,//模板名称
  275. 'platformType': this.platformType,//平台类型
  276. 'status': this.status1,//状态
  277. })
  278. }).then(({
  279. data
  280. }) => {
  281. if (data && data.code === 0) {
  282. this.tableDataLoading = false
  283. let returnData = data.data
  284. this.duanxinData = returnData
  285. }
  286. })
  287. }
  288. },
  289. mounted() {
  290. this.dataSelect()
  291. }
  292. };
  293. </script>
  294. <style>
  295. </style>