| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <div>
- <el-form ref="form">
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="tableList"
- :needPage="false"
- :minHeight="100"
- tool-class="ele-toolbar-form"
- cache-key="eomContactPageTable"
- :summary-method="getSummaries"
- show-summary
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <div class="listToolbar">
- <el-button
- v-if="dialogType !== 'view'"
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="handleAddInfo"
- >
- 新增
- </el-button>
-
- </div>
- </template>
- <template v-slot:action="{ row, $index }" v-if="dialogType !== 'view'">
- <el-popconfirm
- class="ele-action"
- title="确定要删除此信息吗?"
- @confirm="handleDelInfo($index)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- <template v-slot:dataTime="{ row, $index }" v-if="dialogType !== 'view'">
- <el-form-item :prop="'tableList.' + $index + '.dataTime'">
- <el-date-picker
- v-model="row.dataTime"
- type="date"
- placeholder="选择日期"
- value-format="yyyy-MM-dd"
- >
- </el-date-picker>
- </el-form-item>
- </template>
- <template v-slot:cost="{ row, $index }" v-if="dialogType !== 'view'">
- <el-form-item :prop="'datasource.' + $index + '.cost'">
- <el-input type="number" v-model="row.cost"></el-input>
- </el-form-item>
- </template>
- <template
- v-slot:personal="{ row, $index }"
- v-if="dialogType !== 'view'"
- >
- <el-form-item :prop="'datasource.' + $index + '.personal'">
- <el-input v-model="row.personal"></el-input>
- </el-form-item>
- </template>
- <template v-slot:place="{ row, $index }" v-if="dialogType !== 'view'">
- <el-form-item :prop="'datasource.' + $index + '.place'">
- <el-input v-model="row.place"></el-input>
- </el-form-item>
- </template>
- <template
- v-slot:materialName="{ row, $index }"
- v-if="dialogType !== 'view'"
- >
- <el-form-item :prop="'datasource.' + $index + '.materialName'">
- <el-input v-model="row.materialName">
- <template slot="append">
- <el-link
- type="primary"
- :underline="false"
- @click.native="materialOpen(row, $index)"
- >
- 选择</el-link
- >
- </template>
- </el-input>
- </el-form-item>
- </template>
- <template
- v-slot:materialNum="{ row, $index }"
- v-if="dialogType !== 'view'"
- >
- <el-form-item :prop="'datasource.' + $index + '.materialNum'">
- <el-input type="number" v-model="row.materialNum"></el-input>
- </el-form-item>
- </template>
- <template
- v-slot:ownershipId="{ row, $index }"
- v-if="dialogType !== 'view'"
- >
- <el-form-item :prop="'datasource.' + $index + '.ownershipId'">
- <el-cascader
- class="ele-block"
- :options="organizationList"
- placeholder="请选择"
- :props="defaultProps"
- ref="deptRef"
- :show-all-levels="false"
- v-model="row.ownershipId"
- @change="ownershipChange($index)"
- clearable
- ></el-cascader>
- </el-form-item>
- </template>
- <template v-slot:remark="{ row, $index }" v-if="dialogType !== 'view'">
- <el-form-item :prop="'datasource.' + $index + '.remark'">
- <el-input type="textarea" v-model="row.remark"></el-input>
- </el-form-item>
- </template>
- <template v-slot:unit="{ row, $index }" v-if="dialogType !== 'view'">
- <el-form-item :prop="'datasource.' + $index + '.unit'">
- <DictSelection
- dictName="计量单位"
- clearable
- v-model="row.unit"
- >
- </DictSelection>
- </el-form-item>
- </template>
- </ele-pro-table>
-
- </el-form>
- <productList
- :currentIndex="-1"
- @changeParent="changeParent"
- ref="productListRef"
- ></productList>
- </div>
- </template>
-
- <script>
- import { getSummaries } from '@/utils/util.js';
- import productList from '@/BIZComponents/product-list.vue';
- export default {
- name: 'relatedInfoTable',
- props: {
- dialogType: '',
- organizationList: {
- type: Array,
- default: () => {
- return [];
- }
- }
- },
- components: { productList },
- data() {
- return {
- tableList: [],
- currentIndex: '',
- defaultProps: {
- multiple: false,
- checkStrictly: true,
- emitPath: false,
- children: 'children',
- value: 'id',
- label: 'name'
- }
- };
- },
- computed: {
- columns() {
- return [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'dataTime',
- label: '日期',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- slot: 'dataTime'
- },
- {
- prop: 'personal',
- label: '领用人',
- align: 'center',
- showOverflowTooltip: true,
- width: 120,
- slot: 'personal'
- },
- {
- prop: 'materialName',
- label: '物料名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- slot: 'materialName'
- },
- {
- prop: 'materialNum',
- label: '数量',
- align: 'center',
- showOverflowTooltip: true,
- width: 100,
- slot: 'materialNum'
- },
- {
- prop: 'unit',
- label: '单位',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- slot: 'unit'
- },
- {
- prop: 'ownershipName',
- label: '权属单位',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- slot: 'ownershipId'
- },
- {
- prop: 'cost',
- label: '预计费用',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120,
- slot: 'cost'
- },
- {
- prop: 'remark',
- label: '备注',
- minWidth: 200,
- align: 'center',
- showOverflowTooltip: true,
- slot: 'remark'
- },
- {
- columnKey: 'action',
- slot: 'action',
- label: '操作',
- resizable: false,
- width: 80,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'right'
- }
- ];
- }
- },
- mounted() {},
- methods: {
- getSummaries(param) {
- return getSummaries(param, 'cost');
- },
- //删除任务信息数据
- handleDelInfo(index) {
- this.tableList.splice(index, 1);
- },
- //修改回显
- putTableValue(data) {
- this.tableList = data || [];
- },
- getTableValue() {
- return this.tableList;
- },
- materialOpen(row, index) {
- this.currentIndex = index;
- this.$refs.productListRef.open(row, index);
- },
- changeParent(list) {
- if (list.length > 0) {
- this.$set(
- this.tableList[this.currentIndex],
- 'materialName',
- list[0].name
- );
- this.$set(this.tableList[this.currentIndex], 'materialId', list[0].id);
- }
- },
- ownershipChange(index) {
- this.$nextTick(()=>{
- const data =this.$refs.deptRef.getCheckedNodes()
- this.$set(this.tableList[index], 'ownershipName', data[0].label);
- })
- },
- handleAddInfo() {
- this.tableList.push({
- dataTime: '',
- personal: '',
- place: '',
- materialName: '',
- materialId: '',
- materialNum: '',
- ownershipId: '',
- ownershipName: '',
- remark: '',
- cost: ''
- });
- }
- }
- };
- </script>
-
-
- <style scoped lang="scss">
- :deep(.el-form-item) {
- margin-bottom: 0;
- }
- .listToolbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- </style>
-
|