camera.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <div>
  3. <BasicTable @register="registerTable">
  4. <template #toolbar>
  5. <a-button type="primary" @click="handleEdit" v-if="getCheckPerm('empowerCamera-add')"
  6. >授权</a-button
  7. >
  8. </template>
  9. <template #copy="{ text }">
  10. <a @click="handleCopy(text)">
  11. {{ text }}
  12. </a>
  13. </template>
  14. <template #action="{ record }">
  15. <TableAction
  16. :actions="[
  17. {
  18. label: '详情',
  19. ifShow: getCheckPerm('empowerCamera-loglist'),
  20. onClick: handleDetail.bind(null, record),
  21. },
  22. {
  23. label: '编辑',
  24. ifShow: getCheckPerm('empowerCamera-updata'),
  25. onClick: handleEdit.bind(null, record),
  26. },
  27. {
  28. label: '删除',
  29. color: 'error',
  30. ifShow: getCheckPerm('empowerCamera-delete'),
  31. onClick: handleDelete.bind(null, record),
  32. },
  33. ]"
  34. />
  35. </template>
  36. </BasicTable>
  37. <AddModal @register="register" @update="reload" />
  38. <DetailModal @register="registerDetail" @update="reload" />
  39. </div>
  40. </template>
  41. <script lang="ts">
  42. import { defineComponent, h } from 'vue';
  43. import { BasicTable, useTable, TableAction, BasicColumn, FormProps } from '/@/components/Table';
  44. import { authorizeCameraList, authorizeCameradelete } from '/@/api/authorizeModeling';
  45. import { useModal } from '/@/components/Modal';
  46. import { useI18n } from '/@/hooks/web/useI18n';
  47. import AddModal from './modal/camera/AddCameraModal.vue';
  48. import DetailModal from './modal/camera/detailModel.vue';
  49. import { useMessage } from '/@/hooks/web/useMessage';
  50. import { usePermissionStore } from '/@/store/modules/permission';
  51. import { copyTextToClipboard } from '/@/hooks/web/useCopyToClipboard';
  52. import { incrementUseTypeList } from '/@/api/account';
  53. export default defineComponent({
  54. components: {
  55. BasicTable,
  56. AddModal,
  57. TableAction,
  58. DetailModal,
  59. },
  60. setup() {
  61. const { t } = useI18n();
  62. const { createMessage, createConfirm } = useMessage();
  63. const permissionStore = usePermissionStore();
  64. const { getCheckPerm } = permissionStore;
  65. const [register, { openModal }] = useModal();
  66. const [registerDetail, { openModal: opendetailModel }] = useModal();
  67. const columns: BasicColumn[] = [
  68. {
  69. title: '合同所属公司',
  70. dataIndex: 'companyName',
  71. ellipsis: true,
  72. width: 230,
  73. },
  74. {
  75. title: '业务部门',
  76. dataIndex: 'businessDept',
  77. ellipsis: true,
  78. width: 120,
  79. },
  80. {
  81. title: '业务员',
  82. dataIndex: 'businessName',
  83. ellipsis: true,
  84. width: 120,
  85. },
  86. {
  87. title: '客户付款时间',
  88. dataIndex: 'customerPayTime',
  89. ellipsis: true,
  90. width: 160,
  91. },
  92. {
  93. title: '客户名称',
  94. dataIndex: 'customerName',
  95. ellipsis: true,
  96. width: 100,
  97. },
  98. {
  99. title: '客户类别',
  100. dataIndex: 'customerType',
  101. ellipsis: true,
  102. width: 80,
  103. customRender: ({ record }) => {
  104. return record.customerType == 1 ? '经销' : record.customerType == 0 ? '直销' : '';
  105. },
  106. },
  107. {
  108. title: '终端客户',
  109. ellipsis: true,
  110. dataIndex: 'endCustomer',
  111. width: 120,
  112. },
  113. {
  114. title: '使用类型',
  115. ellipsis: true,
  116. dataIndex: 'useTypeStr',
  117. width: 120,
  118. },
  119. {
  120. title: '项目号',
  121. ellipsis: true,
  122. dataIndex: 'projectNum',
  123. width: 120,
  124. },
  125. {
  126. title: '机器码',
  127. ellipsis: true,
  128. slots: { customRender: 'copy' },
  129. dataIndex: 'machineCode',
  130. width: 120,
  131. },
  132. {
  133. title: '算法授权码',
  134. ellipsis: true,
  135. slots: { customRender: 'copy' },
  136. dataIndex: 'modelAuthCode',
  137. width: 120,
  138. },
  139. {
  140. title: '相机授权Key',
  141. ellipsis: true,
  142. slots: { customRender: 'copy' },
  143. dataIndex: 'authorizeKey',
  144. width: 120,
  145. },
  146. {
  147. title: '相机SN码',
  148. ellipsis: true,
  149. dataIndex: 'snCodes',
  150. width: 120,
  151. },
  152. {
  153. title: '授权相机数量',
  154. ellipsis: true,
  155. dataIndex: 'cameraNum',
  156. width: 120,
  157. },
  158. {
  159. title: '备注',
  160. ellipsis: true,
  161. dataIndex: 'remark',
  162. width: 120,
  163. },
  164. {
  165. title: '创建人',
  166. ellipsis: true,
  167. dataIndex: 'sysUserName',
  168. width: 120,
  169. },
  170. {
  171. title: '创建时间',
  172. ellipsis: true,
  173. dataIndex: 'createTime',
  174. width: 160,
  175. },
  176. ];
  177. const searchForm: Partial<FormProps> = {
  178. labelWidth: 100,
  179. autoSubmitOnEnter: true,
  180. schemas: [
  181. {
  182. field: 'customerName',
  183. label: '客户名称',
  184. component: 'Input',
  185. colProps: {
  186. xl: 8,
  187. xxl: 8,
  188. },
  189. },
  190. {
  191. field: 'customerType',
  192. label: '客户类别',
  193. component: 'Select',
  194. componentProps: {
  195. options: [
  196. {
  197. label: '直销',
  198. value: 0,
  199. key: '0',
  200. },
  201. {
  202. label: '经销',
  203. value: 1,
  204. key: '1',
  205. },
  206. ],
  207. },
  208. colProps: {
  209. xl: 8,
  210. xxl: 8,
  211. },
  212. },
  213. {
  214. field: 'useType',
  215. label: '使用类型',
  216. component: 'ApiSelect',
  217. componentProps: {
  218. api: incrementUseTypeList,
  219. labelField: 'name',
  220. valueField: 'id',
  221. immediate: true,
  222. },
  223. colProps: {
  224. xl: 8,
  225. xxl: 8,
  226. },
  227. },
  228. {
  229. field: 'companyName',
  230. component: 'Select',
  231. label: '合同所属公司',
  232. colProps: {
  233. span: 8,
  234. },
  235. itemProps: {
  236. autoLink: false,
  237. },
  238. componentProps: {
  239. options: [
  240. {
  241. label: '珠海市四维时代网络科技有限公司',
  242. value: '珠海市四维时代网络科技有限公司',
  243. key: '珠海市四维时代网络科技有限公司',
  244. },
  245. {
  246. label: '广东四维看看智能设备有限公司',
  247. value: '广东四维看看智能设备有限公司',
  248. key: '广东四维看看智能设备有限公司',
  249. },
  250. {
  251. label: '四维看看(香港)有限公司',
  252. value: '四维看看(香港)有限公司',
  253. key: '四维看看(香港)有限公司',
  254. },
  255. {
  256. label: '四维看看(北京)数据科技有限公司',
  257. value: '四维看看(北京)数据科技有限公司',
  258. key: '四维看看(北京)数据科技有限公司',
  259. },
  260. ],
  261. },
  262. },
  263. {
  264. field: 'businessDept',
  265. component: 'Select',
  266. label: '业务部门',
  267. colProps: {
  268. span: 8,
  269. },
  270. itemProps: {
  271. autoLink: false,
  272. },
  273. componentProps: {
  274. options: [
  275. {
  276. label: '数字营销事业部',
  277. value: '数字营销事业部',
  278. key: '数字营销事业部',
  279. },
  280. {
  281. label: '政企事业部',
  282. value: '政企事业部',
  283. key: '政企事业部',
  284. },
  285. {
  286. label: '海外事业部',
  287. value: '海外事业部',
  288. key: '海外事业部',
  289. },
  290. {
  291. label: '市场部',
  292. value: '市场部',
  293. key: '市场部',
  294. },
  295. {
  296. label: '总经办',
  297. value: '总经办',
  298. key: '总经办',
  299. },
  300. {
  301. label: '考古和不可移动文物保护事业部',
  302. value: '考古和不可移动文物保护事业部',
  303. key: '考古和不可移动文物保护事业部',
  304. },
  305. ],
  306. },
  307. },
  308. {
  309. field: 'machineCode',
  310. label: '机器码',
  311. component: 'Input',
  312. colProps: {
  313. xl: 8,
  314. xxl: 8,
  315. },
  316. },
  317. {
  318. field: 'modelAuthCode',
  319. label: '算法授权码',
  320. component: 'Input',
  321. colProps: {
  322. xl: 8,
  323. xxl: 8,
  324. },
  325. componentProps: {
  326. maxlength: 100,
  327. },
  328. },
  329. {
  330. field: 'snCode',
  331. label: '相机SN码',
  332. component: 'Input',
  333. colProps: {
  334. xl: 8,
  335. xxl: 8,
  336. },
  337. },
  338. ],
  339. };
  340. const [registerTable, { reload }] = useTable({
  341. api: authorizeCameraList,
  342. title: '深时本地版相机授权',
  343. columns: columns,
  344. useSearchForm: true,
  345. formConfig: searchForm,
  346. showTableSetting: true,
  347. showIndexColumn: false,
  348. fetchSetting: {
  349. pageField: 'pageNum',
  350. sizeField: 'pageSize',
  351. listField: 'list',
  352. totalField: 'total',
  353. },
  354. actionColumn: {
  355. width: 150,
  356. title: '操作',
  357. dataIndex: 'action',
  358. slots: { customRender: 'action' },
  359. },
  360. rowKey: 'id',
  361. canResize: true,
  362. });
  363. async function handleDelete(record) {
  364. createConfirm({
  365. iconType: 'warning',
  366. title: () => h('span', '温馨提示'),
  367. content: () => h('span', '确定要删除授权吗?'),
  368. onOk: async () => {
  369. await authorizeCameradelete({ id: record.id });
  370. reload();
  371. createMessage.success(t('common.optSuccess'));
  372. },
  373. });
  374. }
  375. function handleEdit(record = {}) {
  376. openModal(true, record);
  377. }
  378. function handleDetail(record = {}) {
  379. opendetailModel(true, record);
  380. }
  381. function handleCopy(str: string) {
  382. copyTextToClipboard(str);
  383. createMessage.success('复制成功');
  384. }
  385. return {
  386. registerTable,
  387. handleCopy,
  388. handleDelete,
  389. reload,
  390. register,
  391. registerDetail,
  392. getCheckPerm,
  393. handleEdit,
  394. handleDetail,
  395. };
  396. },
  397. });
  398. </script>