| | |
| | | @ok="handleSubmit" |
| | | > |
| | | <div> |
| | | <a-alert |
| | | v-if="showAlert" |
| | | :message="message" |
| | | :description="description" |
| | | type="info" |
| | | show-icon |
| | | /> |
| | | <BasicTable @register="registerTable" @edit-change="onEditChange"> |
| | | <template #toolbar> |
| | | <a-button @click="openImg" type="primary"> 预览 </a-button> |
| | |
| | | } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { createImgPreview } from '/@/components/Preview'; |
| | | import { getListByPage, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { DeleteEntity, getListByPage, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { cloneDeep, isFunction } from 'lodash-es'; |
| | | import { isNullOrUnDef } from '/@/utils/is'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; |
| | | import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; |
| | | import { Alert } from 'ant-design-vue'; |
| | | |
| | | const AAlert = Alert; |
| | | const { t } = useI18n(); |
| | | const title = ref(''); |
| | | const tableName = ref(''); |
| | |
| | | const entityName = ref(''); |
| | | const ctype = ref(''); |
| | | const others = ref({}); |
| | | const showAlert = ref(false); |
| | | const message = ref(''); |
| | | const description = ref(''); |
| | | |
| | | //列表 |
| | | const ItemColumns = ref([] as BasicColumn[]); |
| | |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | fixed: 'right', |
| | | }, //自定义操作列 |
| | | }, |
| | | }); |
| | | const { createMessage: msg } = useMessage(); |
| | | const currentEditKeyRef = ref(''); |
| | |
| | | console.log(`第${index + 1}张图片已加载,URL为:${url}`, dom); |
| | | }; |
| | | // 可以使用createImgPreview返回的 PreviewActions 来控制预览逻辑,实现类似幻灯片、自动旋转之类的骚操作 |
| | | createImgPreview({ imageList: [dataSource[0].LABEL_VIEW_PATH], defaultWidth: 700, rememberState: true, onImgLoad }); |
| | | const Keys = Object.getOwnPropertyNames(others.value); |
| | | let path = ''; |
| | | dataSource.map((item) => { |
| | | for (const k in Keys) { |
| | | if (item[Keys[k]] == others.value[Keys[k]] && !isNullOrEmpty(others.value[Keys[k]])) { |
| | | path = item['LABEL_VIEW_PATH']; |
| | | return; |
| | | } |
| | | } |
| | | }); |
| | | if (isNullOrEmpty(path)) { |
| | | path = dataSource.filter((q) => isNullOrEmpty(q.WORK_ORDER) || isNullOrEmpty(q.PROD_CODE))[0] |
| | | .LABEL_VIEW_PATH; |
| | | } |
| | | createImgPreview({ |
| | | imageList: [path], |
| | | defaultWidth: 700, |
| | | rememberState: true, |
| | | onImgLoad, |
| | | }); |
| | | } |
| | | |
| | | async function onDataReceive(data) { |
| | |
| | | entityName.value = data?.entityName; |
| | | ctype.value = data?.ctype; |
| | | others.value = data?.others; |
| | | showAlert.value = data?.alertConfig.showAlert; |
| | | message.value = data?.alertConfig.message; |
| | | description.value = data?.alertConfig.description; |
| | | // getForm().resetFields(); |
| | | /* 动态import实体名.ts的自定义方法 */ |
| | | try { |
| | |
| | | function handleEdit(record: EditRecordRow) { |
| | | currentEditKeyRef.value = record.key; |
| | | record.onEdit?.(true); |
| | | } |
| | | |
| | | /** |
| | | * @description: 删除行 |
| | | * @param {*} record |
| | | * @return {*} |
| | | */ |
| | | function handleDel(record: EditRecordRow) { |
| | | if (!isNullOrEmpty(record.WORK_ORDER) || !isNullOrEmpty(record.PROD_CODE)) { |
| | | //删除 |
| | | DeleteEntity(record, ctype.value).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | try { |
| | | const data = cloneDeep(record.editValueRefs); |
| | | console.log(data); |
| | | |
| | | const [{ CustFunc }] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | if (CustFunc && isFunction(CustFunc)) { |
| | | CustFunc({ |
| | | others: others.value, |
| | | ctype: 'delete', |
| | | values: record, |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | msg.error({ content: t('删除失败'), key: 'saving' }); |
| | | } |
| | | reload(); |
| | | } |
| | | }); |
| | | } else { |
| | | msg.error({ content: t('没有需要删除的变量'), key: 'saving' }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | onClick: handleEdit.bind(null, record), |
| | | name: '', |
| | | }, |
| | | { |
| | | label: '删除', |
| | | color: 'error', |
| | | disabled: currentEditKeyRef.value ? currentEditKeyRef.value !== record.key : false, |
| | | onClick: handleDel.bind(null, record), |
| | | name: '', |
| | | }, |
| | | ]; |
| | | } |
| | | return [ |