index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div>
  3. <normalBook
  4. ref="basicLayout"
  5. tableName="phoneBookTable"
  6. idName="sys_phonebookid"
  7. :apiId="{query:20231220085804,del:''}"
  8. :autoQuery="false"
  9. @onSuccess="selectChange"
  10. :detailPath="{path:'/phonebookDetail'}"
  11. >
  12. <template #titleLight>
  13. <addContact :tagList="tagList" v-if="tool.checkAuth($route.name,'addContact')" slot="addContact" :group="group" @onAddSuccess="selectChange"></addContact>
  14. </template>
  15. <template #custom>
  16. <div class="mt-10" v-if="usertype === 0">
  17. <label class="search__label" >范围:</label>
  18. <el-select class="inline-24" v-model="tabName" placeholder="请选择数据分类" @change="selectChange" size="small" >
  19. <el-option
  20. v-for="item in editableTabsAdmin"
  21. :key="item.index"
  22. :label="item.templetname"
  23. :value="item.templetid"
  24. ></el-option>
  25. </el-select>
  26. </div>
  27. <div class="mt-10" v-else>
  28. <label class="search__label" >范围:</label>
  29. <el-select class="inline-24" v-model="tabName" placeholder="请选择数据分类" @change="selectChange" size="small" >
  30. <el-option
  31. v-for="item in editableTabs"
  32. :key="item.index"
  33. :label="item.templetname"
  34. :value="item.templetid"
  35. ></el-option>
  36. </el-select>
  37. </div>
  38. <div class="inline-16 mt-10">
  39. <span style="font-size: 14px;color: #606266;" class="inline-16" >标签</span>
  40. <el-select v-model="tags" placeholder="请选择标签" size="small" @change="selectChange" clearable @clear="clearSearch" filterable class="inline-16" multiple>
  41. <el-option
  42. v-for="item in tagList"
  43. :key="item.index"
  44. :label="item.tag"
  45. :value="item.tag"
  46. :disabled="hasDisabledTag(item)">
  47. </el-option>
  48. </el-select>
  49. </div>
  50. </template>
  51. <template #custom-right>
  52. <div class="inline-16 mt-10">
  53. <el-button type="primary" size="small" @click="onReset" >重置</el-button>
  54. </div>
  55. </template>
  56. <template #tableLeft style="padding: 0">
  57. <div style="margin: 0;padding: 0;min-width: 320px;max-width: 320px;">
  58. <myGroup ref="groupRef" @clickGroup="clickGroup" @groupList="groupList" :typeTab="tabName" @delGroup="onReset"></myGroup>
  59. </div>
  60. </template>
  61. <template v-slot:tbList="scope">
  62. <div v-if="scope.data.column.columnname === 'tag1'">
  63. <div v-if="scope.data.column.data.tag1">
  64. <div v-if="scope.data.column.data.tag1.length > 0">
  65. <el-tag v-for="tag in scope.data.column.data.tag1" :key="tag.index" :type="tag==='支持者'?'warning':tag==='反对者'?'danger':''" size="mini" style="margin:0 5px 0 0">
  66. {{tag}}
  67. </el-tag>
  68. </div>
  69. <div v-else>--</div>
  70. </div>
  71. <div v-else>--</div>
  72. </div>
  73. <div v-else-if="scope.data.column.columnname === 'isCustomers'">
  74. <div>{{scope.data.column.data.sa_customersid?scope.data.column.data.sa_customersid === 0?'否':'是':'否'}}</div>
  75. </div>
  76. <div v-else-if="scope.data.column.columnname === 'isProject'">
  77. <div>{{scope.data.column.data.sa_projectid?scope.data.column.data.sa_projectid === 0?'否':'是':'否'}}</div>
  78. </div>
  79. <div v-else>
  80. {{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]]:'--'}}
  81. </div>
  82. </template>
  83. <template v-slot:tbOpreation="scope">
  84. <!-- <el-button size="text" @click="onGoto(scope.data.data)" >详 情</el-button>-->
  85. </template>
  86. </normalBook>
  87. </div>
  88. </template>
  89. <script>
  90. import normalBook from "@/components/normal-basic-layout-new/normalBook";
  91. import myGroup from '../mycontact/index';
  92. import addContact from '../mycontact/modules/addContact'
  93. export default {
  94. name: "index",
  95. components:{normalBook,myGroup,addContact},
  96. data(){
  97. return {
  98. tabIndex:"1",
  99. editableTabsValue:"我负责的",
  100. usertype:JSON.parse(sessionStorage.getItem('active_account')).usertype,
  101. editableTabs:[
  102. {
  103. templetname:'我负责的',
  104. templetid:1
  105. },
  106. {
  107. templetname:'我参与的',
  108. templetid:2
  109. },
  110. {
  111. templetname:'我下属负责的',
  112. templetid:3
  113. },
  114. {
  115. templetname:'我下属参与的',
  116. templetid:4
  117. },
  118. {
  119. templetname:'我创建的',
  120. templetid:5
  121. }
  122. ],
  123. editableTabsAdmin:[
  124. {
  125. templetname:'我负责的',
  126. templetid:1
  127. },
  128. {
  129. templetname:'我参与的',
  130. templetid:2
  131. },
  132. {
  133. templetname:'我下属负责的',
  134. templetid:3
  135. },
  136. {
  137. templetname:'我下属参与的',
  138. templetid:4
  139. },
  140. {
  141. templetname:'我创建的',
  142. templetid:5
  143. },
  144. {
  145. templetname:'站点全部',
  146. templetid:99
  147. }
  148. ],
  149. tagList:[],
  150. tags:[],
  151. group:[],
  152. tabName:1,
  153. param:{
  154. "id": 20231220085804,
  155. "content": {
  156. "type":1,
  157. "groupname":"",
  158. "sys_phonebookgroupid":0,
  159. "pageNumber": 1,
  160. "pageSize": 40,
  161. "where": {
  162. "condition": "",
  163. "tag":[]
  164. }
  165. }
  166. }
  167. }
  168. },
  169. methods:{
  170. async listData(id){
  171. this.$refs.basicLayout.param.content.type = this.tabName
  172. this.$nextTick(()=>{
  173. this.$refs.basicLayout.listData()
  174. })
  175. },
  176. /*任务页面跳转*/
  177. onGoto(row){
  178. console.log(row,'row')
  179. this.$store.dispatch('changeDetailDrawer',true)
  180. this.$router.push({
  181. path:'/phonebookDetail',
  182. query:{
  183. id:row.sys_phonebookid,
  184. sa_project_contactsid:row.sa_project_contactsid,
  185. contactsid:row.contactsid
  186. }
  187. })
  188. },
  189. async getTagList () {
  190. let res = await this.$api.requested({
  191. "id": 20220929085401,
  192. "content": {
  193. "ownertable":"sys_phonebook",
  194. "ownerid":102
  195. }
  196. })
  197. this.tagList = res.data.option
  198. },
  199. selectChange(){
  200. console.log(this.tabName)
  201. this.$refs.basicLayout.param.content.type = this.tabName
  202. this.$refs.basicLayout.param.content.where.tag = this.tags
  203. this.$refs.basicLayout.listData()
  204. this.$refs.groupRef.param.content.type = this.tabName
  205. this.$refs.groupRef.listData()
  206. },
  207. onReset(){
  208. this.tags = []
  209. this.tabName = 1
  210. this.$refs.basicLayout.param.content.type = 1
  211. this.param.content.where.tag = []
  212. this.$refs.basicLayout.param.content.where.condition = ''
  213. this.$refs.basicLayout.param.content.groupname = ''
  214. this.$refs.basicLayout.param.content.sys_phonebookgroupid = ''
  215. this.$refs.groupRef.param.content.type = 1
  216. this.$refs.groupRef.param.content.where.groupname = ''
  217. this.$refs.groupRef.$refs.grouplist.active = 0
  218. /*this.$refs.groupRef.listData()*/
  219. this.selectChange()
  220. },
  221. clearSearch(){
  222. this.$refs.basicLayout.listData()
  223. },
  224. clickGroup(val,type){
  225. this.$refs.basicLayout.param.content.groupname = val.groupname
  226. this.$refs.basicLayout.param.content.sys_phonebookgroupid = val.sys_phonebookgroupid
  227. this.listData()
  228. },
  229. /*onAddSuccess () {
  230. this.listData()
  231. this.$refs.groupRef.listData()
  232. },*/
  233. hasDisabledTag (item) {
  234. let arr = []
  235. let arr2 = []
  236. arr = this.tagList.filter(item=>{
  237. return this.tags.includes(item.tag)
  238. })
  239. arr.forEach(e=>{
  240. arr2 = arr2.concat(e.mutextag)
  241. })
  242. arr2 = this.tags.length === 0?[]:arr2
  243. let _isSame = arr2.some(tag=>item.tag === tag)
  244. return _isSame
  245. },
  246. /*async querytemplet () {
  247. const res = await this.$api.requested({
  248. "classname": "sysmanage.develop.querytemplet.querytemplet",
  249. "method":"query",
  250. "content": {}
  251. })
  252. this.editableTabs = res.data
  253. for (let i=0;i<res.data.length;i++){
  254. if (res.data[i].templetname == '站点全部'){
  255. this.tabName = res.data[i].templetid
  256. break
  257. }else {
  258. this.tabName = res.data[0].templetid
  259. }
  260. }
  261. this.listData(this.tabName)
  262. }*/
  263. groupList(res){
  264. let k = 0
  265. for (var i=0;i<res.length;i++){
  266. if (res[i].groupname !== '项目联系人' && res[i].groupname !== '客户联系人' ){
  267. this.group[k] = res[i]
  268. k++
  269. }
  270. }
  271. console.log(this.group,'groupList')
  272. },
  273. onDelSuccess(){
  274. console.log('抽屉关闭')
  275. /*this.onReset()*/
  276. }
  277. },
  278. mounted() {
  279. /*this.querytemplet()*/
  280. this.getTagList()
  281. this.listData(1)
  282. }
  283. }
  284. </script>
  285. <style scoped>
  286. </style>