企微助手 ,仓库名 短剧

warningListInstall.vue 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="con" v-loading="loading">
  3. <div class="tableInfo">
  4. <div class="flex">
  5. <div class="totalCustom">共<span>{{tableData.length}}</span>个预警组</div>
  6. <self-input :hasLabel="false" style="margin-left:60px" label_name="关键词搜索" @inputChange='(val)=>{input_keyword = val;init()}'></self-input>
  7. </div>
  8. <div class="flex">
  9. <el-button type="primary" size="mini" @click="openDialog('add')">添加预警组</el-button>
  10. </div>
  11. </div>
  12. <el-table ref="multipleTable" height="calc(100vh - 130px)" :data="tableData" tooltip-effect="dark" style="width: 100%">
  13. <el-table-column show-overflow-tooltip align="center">
  14. <template slot="header">
  15. <div style="margin-left:60px">预警组</div>
  16. </template>
  17. <template slot-scope="scope">
  18. <div style="margin-left:60px">{{scope.row.name}}</div>
  19. </template>
  20. </el-table-column>
  21. <el-table-column label="预警人" align="center">
  22. <template slot-scope="scope">
  23. <div class="customerServiceTagBox biaoqian" style="justify-content: space-between;display:inline-block" v-if="scope.row.users">
  24. <div class="customerServiceTag" v-for="(item,index) in scope.row.users" :key="index+'user'" style="justify-content:flex-start;">
  25. <i class="el-icon-user-solid"></i> {{ item.name }}
  26. <i class="el-icon-phone" style="margin-left:8px"></i>{{item.phone}}
  27. </div>
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="操作" align="center">
  32. <template slot-scope="scope">
  33. <div class="flex" style="justify-content:center">
  34. <div class="c-00B38A pointer" style="margin:0 6px" @click="getGroupDetail(scope.row.id)">编辑</div>
  35. </div>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <!-- 新增编辑权限-->
  40. <el-dialog class="dialogCon_permission" :title="dialogTitleName" :visible.sync="dialogTableVisible" :append-to-body="true" width="500px">
  41. <div class="dialogCon" v-loading="dialogLoading">
  42. <div class="itemBox" style="margin-bottom:20px">
  43. <div class="name"><em>*</em>预警组名称:</div>
  44. <div class="ipt">
  45. <el-input size="small" v-model="groupName" placeholder="请输入预警组名称"></el-input>
  46. </div>
  47. </div>
  48. <div v-for="(item,index) in warningArrs" :key="index+'wans'">
  49. <div class="f14 c-00B38A" v-if="warningArrs&&warningArrs.length>1" :class="index==0 ? '' : 'tMar20'">预警人员 {{index+1}}
  50. <i class="el-icon-circle-close f14 pointer" @click="deleItem(item.id)"></i>
  51. </div>
  52. <div class="flex">
  53. <div class="itemBox">
  54. <div class="name"><em>*</em>预警人员:</div>
  55. <div class="ipt">
  56. <el-input size="small" v-model="item.name" placeholder="请输入预警人员"></el-input>
  57. </div>
  58. </div>
  59. <div class="itemBox lMar14">
  60. <div class="name" style="width: 60px"><em>*</em>手机号:</div>
  61. <div class="ipt">
  62. <el-input size="small" v-model="item.phone" placeholder="请输入手机号"></el-input>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="itemBox">
  68. <div class="name"></div>
  69. <div class="ipt f13 pointer" @click="addItem"><i class="el-icon-circle-plus-outline f14 c-00B38A rMar5"></i>添加预警人员</div>
  70. </div>
  71. </div>
  72. <div slot="footer" class="dialog-footer">
  73. <el-button size="mini" @click="dialogTableVisible = false">取 消</el-button>
  74. <el-button size="mini" type="primary" @click="addManager()">确 定</el-button>
  75. </div>
  76. </el-dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import selfInput from '@/components/assembly/screen/input.vue'
  81. export default {
  82. components: { selfInput },
  83. name: "warningListInstall",
  84. data () {
  85. return {
  86. input_keyword: '',
  87. groupDetail: {},
  88. loading: false,
  89. dialogLoading: false,
  90. dialogTableVisible: false,
  91. dialogTitleName: '添加预警组',
  92. tableData: [],
  93. groupName: '',
  94. warningArrs: [
  95. {
  96. id: 0,
  97. name: "",
  98. phone: '',
  99. }
  100. ],
  101. okFlag: false,//true表示有问题不能提交
  102. okMes: '以上均为必填项'
  103. }
  104. },
  105. created () {
  106. this.init()
  107. },
  108. methods: {
  109. deleItem (id) {
  110. this.warningArrs.forEach((item, index) => {
  111. if (item.id == id) {
  112. this.warningArrs.splice(index, 1)
  113. }
  114. })
  115. this.warningArrs.forEach((item, index) => {
  116. item.id = index
  117. })
  118. },
  119. addItem () {
  120. this.warningArrs.push({
  121. id: this.warningArrs.length,
  122. name: "",
  123. phone: '',
  124. })
  125. },
  126. init () {
  127. this.loading = true
  128. this.$axios.get(this.URL.BASEURL + this.URL.warn_groupList, {
  129. params: {
  130. keyword: this.input_keyword,
  131. sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : ''
  132. }
  133. }).then((res) => {
  134. var res = res.data
  135. if (res && res.errno == 0) {
  136. this.tableData = res.rst
  137. } else if (res.errno != 4002) {
  138. this.$message({
  139. message: res.err,
  140. type: "warning"
  141. })
  142. }
  143. this.loading = false
  144. }).catch(() => {
  145. this.loading = false
  146. })
  147. },
  148. getGroupDetail (id) {
  149. this.loading = true
  150. this.$axios.get(this.URL.BASEURL + this.URL.warn_groupDetail, {
  151. params: {
  152. group_id: id,
  153. sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : ''
  154. }
  155. }).then((res) => {
  156. var res = res.data
  157. if (res && res.errno == 0) {
  158. this.groupDetail = res.rst;
  159. this.groupName = res.rst.name;
  160. this.warningArrs = res.rst.users;
  161. this.warningArrs.forEach((item, index) => {
  162. item.id = index
  163. })
  164. this.dialogTitleName = '编辑预警组'
  165. this.dialogTableVisible = true;
  166. } else if (res.errno != 4002) {
  167. this.$message({
  168. message: res.err,
  169. type: "warning"
  170. })
  171. }
  172. this.loading = false
  173. }).catch(() => {
  174. this.loading = false
  175. })
  176. },
  177. addManager () {
  178. //判断值是否正确
  179. if (this.groupName == '') {
  180. this.$message({
  181. message: '请输入预警组名称',
  182. type: "warning"
  183. })
  184. return
  185. }
  186. this.warningArrs.forEach((item, index) => {
  187. if (item.name == '' || item.phone == '') {
  188. this.okFlag = true
  189. this.okMes = '以上均为必填项'
  190. } else {
  191. if (this.$judgePhone(item.phone) == 0) { // 是正确手机号
  192. this.okFlag = true
  193. this.okMes = '请填写正确手机号'
  194. } else {
  195. this.okFlag = false
  196. }
  197. }
  198. })
  199. if (this.okFlag) {
  200. this.$message({
  201. message: this.okMes,
  202. type: "warning"
  203. })
  204. return false
  205. }
  206. let axios_api = this.URL.warn_groupEdit;
  207. let params = {
  208. sys_group_id: this.$cookie.getCookie('isSuperManage') == 1 ? sessionStorage.getItem('company_session_defaultCorp_level_1').toString() : '',
  209. group_name: this.groupName,
  210. user_list: JSON.stringify(this.warningArrs)
  211. };
  212. if (this.dialogTitleName == '添加预警组') {
  213. axios_api = this.URL.warn_groupAdd
  214. } else {
  215. params.group_id = this.groupDetail.id;
  216. }
  217. this.dialogLoading = true
  218. this.$axios.post(this.URL.BASEURL + axios_api, params).then((res) => {
  219. var res = res.data
  220. this.dialogLoading = false;
  221. if (res && res.errno == 0) {
  222. this.dialogTableVisible = false
  223. this.init()
  224. this.$message({
  225. message: '成功!',
  226. type: "success"
  227. })
  228. } else {
  229. this.$message({
  230. message: res.err,
  231. type: "warning"
  232. })
  233. }
  234. }).catch(() => {
  235. this.dialogLoading = false
  236. })
  237. },
  238. openDialog () {
  239. this.dialogTitleName = '添加预警组'
  240. this.groupName = '';
  241. this.warningArrs = [
  242. {
  243. id: 0,
  244. name: "",
  245. phone: '',
  246. }
  247. ],
  248. this.dialogTableVisible = true
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. @import "@/style/list.scss";
  255. .tableInfo {
  256. height: 50px;
  257. }
  258. .dialogCon {
  259. margin-top: -20px;
  260. .itemBox {
  261. display: flex;
  262. align-items: center;
  263. margin-top: 6px;
  264. font-size: 14px;
  265. .name {
  266. width: 90px;
  267. flex-wrap: nowrap;
  268. em {
  269. color: red;
  270. }
  271. }
  272. .ipt {
  273. flex: 1;
  274. }
  275. }
  276. }
  277. .lableBox_dad {
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. flex-wrap: wrap;
  282. .lableBox {
  283. font-size: 12px;
  284. background-color: #f0f0f0;
  285. padding: 4px 8px;
  286. margin-top: 5px;
  287. margin-right: 4px;
  288. border-radius: 4px;
  289. }
  290. }
  291. </style>